var AP=t=>{throw TypeError(t)};var dC=(t,e,n)=>e.has(t)||AP("Cannot "+n);var it=(t,e,n)=>(dC(t,e,"read from private field"),n?n.call(t):e.get(t)),zn=(t,e,n)=>e.has(t)?AP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),un=(t,e,n,r)=>(dC(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),fr=(t,e,n)=>(dC(t,e,"access private method"),n);var B3=(t,e,n,r)=>({set _(i){un(t,e,i,n)},get _(){return it(t,e,r)}});function GZ(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function dy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fC={exports:{}},Fb={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var NP;function WZ(){if(NP)return Fb;NP=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var a=null;if(s!==void 0&&(a=""+s),i.key!==void 0&&(a=""+i.key),"key"in i){s={};for(var o in i)o!=="key"&&(s[o]=i[o])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:a,ref:i!==void 0?i:null,props:s}}return Fb.Fragment=e,Fb.jsx=n,Fb.jsxs=n,Fb}var RP;function $Z(){return RP||(RP=1,fC.exports=WZ()),fC.exports}var p=$Z(),hC={exports:{}},xr={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var kP;function qZ(){if(kP)return xr;kP=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),g=Symbol.iterator;function v(j){return j===null||typeof j!="object"?null:(j=g&&j[g]||j["@@iterator"],typeof j=="function"?j:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,w={};function S(j,X,H){this.props=j,this.context=X,this.refs=w,this.updater=H||b}S.prototype.isReactComponent={},S.prototype.setState=function(j,X){if(typeof j!="object"&&typeof j!="function"&&j!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,j,X,"setState")},S.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function E(){}E.prototype=S.prototype;function A(j,X,H){this.props=j,this.context=X,this.refs=w,this.updater=H||b}var N=A.prototype=new E;N.constructor=A,_(N,S.prototype),N.isPureReactComponent=!0;var D=Array.isArray;function P(){}var L={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function O(j,X,H){var ie=H.ref;return{$$typeof:t,type:j,key:X,ref:ie!==void 0?ie:null,props:H}}function W(j,X){return O(j.type,X,j.props)}function F(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function V(j){var X={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(H){return X[H]})}var G=/\/+/g;function Z(j,X){return typeof j=="object"&&j!==null&&j.key!=null?V(""+j.key):X.toString(36)}function B(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(P,P):(j.status="pending",j.then(function(X){j.status==="pending"&&(j.status="fulfilled",j.value=X)},function(X){j.status==="pending"&&(j.status="rejected",j.reason=X)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function q(j,X,H,ie,ne){var re=typeof j;(re==="undefined"||re==="boolean")&&(j=null);var ue=!1;if(j===null)ue=!0;else switch(re){case"bigint":case"string":case"number":ue=!0;break;case"object":switch(j.$$typeof){case t:case e:ue=!0;break;case d:return ue=j._init,q(ue(j._payload),X,H,ie,ne)}}if(ue)return ne=ne(j),ue=ie===""?"."+Z(j,0):ie,D(ne)?(H="",ue!=null&&(H=ue.replace(G,"$&/")+"/"),q(ne,X,H,"",function(we){return we})):ne!=null&&(F(ne)&&(ne=W(ne,H+(ne.key==null||j&&j.key===ne.key?"":(""+ne.key).replace(G,"$&/")+"/")+ue)),X.push(ne)),1;ue=0;var le=ie===""?".":ie+":";if(D(j))for(var fe=0;fe<j.length;fe++)ie=j[fe],re=le+Z(ie,fe),ue+=q(ie,X,H,re,ne);else if(fe=v(j),typeof fe=="function")for(j=fe.call(j),fe=0;!(ie=j.next()).done;)ie=ie.value,re=le+Z(ie,fe++),ue+=q(ie,X,H,re,ne);else if(re==="object"){if(typeof j.then=="function")return q(B(j),X,H,ie,ne);throw X=String(j),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ue}function K(j,X,H){if(j==null)return j;var ie=[],ne=0;return q(j,ie,"","",function(re){return X.call(H,re,ne++)}),ie}function Y(j){if(j._status===-1){var X=j._result;X=X(),X.then(function(H){(j._status===0||j._status===-1)&&(j._status=1,j._result=H)},function(H){(j._status===0||j._status===-1)&&(j._status=2,j._result=H)}),j._status===-1&&(j._status=0,j._result=X)}if(j._status===1)return j._result.default;throw j._result}var Q=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)},U={map:K,forEach:function(j,X,H){K(j,function(){X.apply(this,arguments)},H)},count:function(j){var X=0;return K(j,function(){X++}),X},toArray:function(j){return K(j,function(X){return X})||[]},only:function(j){if(!F(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return xr.Activity=h,xr.Children=U,xr.Component=S,xr.Fragment=n,xr.Profiler=i,xr.PureComponent=A,xr.StrictMode=r,xr.Suspense=l,xr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,xr.__COMPILER_RUNTIME={__proto__:null,c:function(j){return L.H.useMemoCache(j)}},xr.cache=function(j){return function(){return j.apply(null,arguments)}},xr.cacheSignal=function(){return null},xr.cloneElement=function(j,X,H){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var ie=_({},j.props),ne=j.key;if(X!=null)for(re in X.key!==void 0&&(ne=""+X.key),X)!R.call(X,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&X.ref===void 0||(ie[re]=X[re]);var re=arguments.length-2;if(re===1)ie.children=H;else if(1<re){for(var ue=Array(re),le=0;le<re;le++)ue[le]=arguments[le+2];ie.children=ue}return O(j.type,ne,ie)},xr.createContext=function(j){return j={$$typeof:a,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:s,_context:j},j},xr.createElement=function(j,X,H){var ie,ne={},re=null;if(X!=null)for(ie in X.key!==void 0&&(re=""+X.key),X)R.call(X,ie)&&ie!=="key"&&ie!=="__self"&&ie!=="__source"&&(ne[ie]=X[ie]);var ue=arguments.length-2;if(ue===1)ne.children=H;else if(1<ue){for(var le=Array(ue),fe=0;fe<ue;fe++)le[fe]=arguments[fe+2];ne.children=le}if(j&&j.defaultProps)for(ie in ue=j.defaultProps,ue)ne[ie]===void 0&&(ne[ie]=ue[ie]);return O(j,re,ne)},xr.createRef=function(){return{current:null}},xr.forwardRef=function(j){return{$$typeof:o,render:j}},xr.isValidElement=F,xr.lazy=function(j){return{$$typeof:d,_payload:{_status:-1,_result:j},_init:Y}},xr.memo=function(j,X){return{$$typeof:c,type:j,compare:X===void 0?null:X}},xr.startTransition=function(j){var X=L.T,H={};L.T=H;try{var ie=j(),ne=L.S;ne!==null&&ne(H,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(P,Q)}catch(re){Q(re)}finally{X!==null&&H.types!==null&&(X.types=H.types),L.T=X}},xr.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},xr.use=function(j){return L.H.use(j)},xr.useActionState=function(j,X,H){return L.H.useActionState(j,X,H)},xr.useCallback=function(j,X){return L.H.useCallback(j,X)},xr.useContext=function(j){return L.H.useContext(j)},xr.useDebugValue=function(){},xr.useDeferredValue=function(j,X){return L.H.useDeferredValue(j,X)},xr.useEffect=function(j,X){return L.H.useEffect(j,X)},xr.useEffectEvent=function(j){return L.H.useEffectEvent(j)},xr.useId=function(){return L.H.useId()},xr.useImperativeHandle=function(j,X,H){return L.H.useImperativeHandle(j,X,H)},xr.useInsertionEffect=function(j,X){return L.H.useInsertionEffect(j,X)},xr.useLayoutEffect=function(j,X){return L.H.useLayoutEffect(j,X)},xr.useMemo=function(j,X){return L.H.useMemo(j,X)},xr.useOptimistic=function(j,X){return L.H.useOptimistic(j,X)},xr.useReducer=function(j,X,H){return L.H.useReducer(j,X,H)},xr.useRef=function(j){return L.H.useRef(j)},xr.useState=function(j){return L.H.useState(j)},xr.useSyncExternalStore=function(j,X,H){return L.H.useSyncExternalStore(j,X,H)},xr.useTransition=function(){return L.H.useTransition()},xr.version="19.2.1",xr}var PP;function $S(){return PP||(PP=1,hC.exports=qZ()),hC.exports}var T=$S();const Qr=dy(T),PF=GZ({__proto__:null,default:Qr},[T]);var pC={exports:{}},Ub={},mC={exports:{}},gC={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var IP;function XZ(){return IP||(IP=1,(function(t){function e(q,K){var Y=q.length;q.push(K);e:for(;0<Y;){var Q=Y-1>>>1,U=q[Q];if(0<i(U,K))q[Q]=K,q[Y]=U,Y=Q;else break e}}function n(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var K=q[0],Y=q.pop();if(Y!==K){q[0]=Y;e:for(var Q=0,U=q.length,j=U>>>1;Q<j;){var X=2*(Q+1)-1,H=q[X],ie=X+1,ne=q[ie];if(0>i(H,Y))ie<U&&0>i(ne,H)?(q[Q]=ne,q[ie]=Y,Q=ie):(q[Q]=H,q[X]=Y,Q=X);else if(ie<U&&0>i(ne,Y))q[Q]=ne,q[ie]=Y,Q=ie;else break e}}return K}function i(q,K){var Y=q.sortIndex-K.sortIndex;return Y!==0?Y:q.id-K.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,h=null,g=3,v=!1,b=!1,_=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function N(q){for(var K=n(c);K!==null;){if(K.callback===null)r(c);else if(K.startTime<=q)r(c),K.sortIndex=K.expirationTime,e(l,K);else break;K=n(c)}}function D(q){if(_=!1,N(q),!b)if(n(l)!==null)b=!0,P||(P=!0,V());else{var K=n(c);K!==null&&B(D,K.startTime-q)}}var P=!1,L=-1,R=5,O=-1;function W(){return w?!0:!(t.unstable_now()-O<R)}function F(){if(w=!1,P){var q=t.unstable_now();O=q;var K=!0;try{e:{b=!1,_&&(_=!1,E(L),L=-1),v=!0;var Y=g;try{t:{for(N(q),h=n(l);h!==null&&!(h.expirationTime>q&&W());){var Q=h.callback;if(typeof Q=="function"){h.callback=null,g=h.priorityLevel;var U=Q(h.expirationTime<=q);if(q=t.unstable_now(),typeof U=="function"){h.callback=U,N(q),K=!0;break t}h===n(l)&&r(l),N(q)}else r(l);h=n(l)}if(h!==null)K=!0;else{var j=n(c);j!==null&&B(D,j.startTime-q),K=!1}}break e}finally{h=null,g=Y,v=!1}K=void 0}}finally{K?V():P=!1}}}var V;if(typeof A=="function")V=function(){A(F)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,Z=G.port2;G.port1.onmessage=F,V=function(){Z.postMessage(null)}}else V=function(){S(F,0)};function B(q,K){L=S(function(){q(t.unstable_now())},K)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(q){q.callback=null},t.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<q?Math.floor(1e3/q):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function(q){switch(g){case 1:case 2:case 3:var K=3;break;default:K=g}var Y=g;g=K;try{return q()}finally{g=Y}},t.unstable_requestPaint=function(){w=!0},t.unstable_runWithPriority=function(q,K){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var Y=g;g=q;try{return K()}finally{g=Y}},t.unstable_scheduleCallback=function(q,K,Y){var Q=t.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?Q+Y:Q):Y=Q,q){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=Y+U,q={id:d++,callback:K,priorityLevel:q,startTime:Y,expirationTime:U,sortIndex:-1},Y>Q?(q.sortIndex=Y,e(c,q),n(l)===null&&q===n(c)&&(_?(E(L),L=-1):_=!0,B(D,Y-Q))):(q.sortIndex=U,e(l,q),b||v||(b=!0,P||(P=!0,V()))),q},t.unstable_shouldYield=W,t.unstable_wrapCallback=function(q){var K=g;return function(){var Y=g;g=K;try{return q.apply(this,arguments)}finally{g=Y}}}})(gC)),gC}var DP;function IF(){return DP||(DP=1,mC.exports=XZ()),mC.exports}var vC={exports:{}},rl={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var OP;function YZ(){if(OP)return rl;OP=1;var t=$S();function e(l){var c="https://react.dev/errors/"+l;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)c+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+l+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function s(l,c,d){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:h==null?null:""+h,children:l,containerInfo:c,implementation:d}}var a=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(l,c){if(l==="font")return"";if(typeof c=="string")return c==="use-credentials"?c:""}return rl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,rl.createPortal=function(l,c){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!c||c.nodeType!==1&&c.nodeType!==9&&c.nodeType!==11)throw Error(e(299));return s(l,c,null,d)},rl.flushSync=function(l){var c=a.T,d=r.p;try{if(a.T=null,r.p=2,l)return l()}finally{a.T=c,r.p=d,r.d.f()}},rl.preconnect=function(l,c){typeof l=="string"&&(c?(c=c.crossOrigin,c=typeof c=="string"?c==="use-credentials"?c:"":void 0):c=null,r.d.C(l,c))},rl.prefetchDNS=function(l){typeof l=="string"&&r.d.D(l)},rl.preinit=function(l,c){if(typeof l=="string"&&c&&typeof c.as=="string"){var d=c.as,h=o(d,c.crossOrigin),g=typeof c.integrity=="string"?c.integrity:void 0,v=typeof c.fetchPriority=="string"?c.fetchPriority:void 0;d==="style"?r.d.S(l,typeof c.precedence=="string"?c.precedence:void 0,{crossOrigin:h,integrity:g,fetchPriority:v}):d==="script"&&r.d.X(l,{crossOrigin:h,integrity:g,fetchPriority:v,nonce:typeof c.nonce=="string"?c.nonce:void 0})}},rl.preinitModule=function(l,c){if(typeof l=="string")if(typeof c=="object"&&c!==null){if(c.as==null||c.as==="script"){var d=o(c.as,c.crossOrigin);r.d.M(l,{crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0})}}else c==null&&r.d.M(l)},rl.preload=function(l,c){if(typeof l=="string"&&typeof c=="object"&&c!==null&&typeof c.as=="string"){var d=c.as,h=o(d,c.crossOrigin);r.d.L(l,d,{crossOrigin:h,integrity:typeof c.integrity=="string"?c.integrity:void 0,nonce:typeof c.nonce=="string"?c.nonce:void 0,type:typeof c.type=="string"?c.type:void 0,fetchPriority:typeof c.fetchPriority=="string"?c.fetchPriority:void 0,referrerPolicy:typeof c.referrerPolicy=="string"?c.referrerPolicy:void 0,imageSrcSet:typeof c.imageSrcSet=="string"?c.imageSrcSet:void 0,imageSizes:typeof c.imageSizes=="string"?c.imageSizes:void 0,media:typeof c.media=="string"?c.media:void 0})}},rl.preloadModule=function(l,c){if(typeof l=="string")if(c){var d=o(c.as,c.crossOrigin);r.d.m(l,{as:typeof c.as=="string"&&c.as!=="script"?c.as:void 0,crossOrigin:d,integrity:typeof c.integrity=="string"?c.integrity:void 0})}else r.d.m(l)},rl.requestFormReset=function(l){r.d.r(l)},rl.unstable_batchedUpdates=function(l,c){return l(c)},rl.useFormState=function(l,c,d){return a.H.useFormState(l,c,d)},rl.useFormStatus=function(){return a.H.useHostTransitionStatus()},rl.version="19.2.1",rl}var LP;function DF(){if(LP)return vC.exports;LP=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),vC.exports=YZ(),vC.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var zP;function KZ(){if(zP)return Ub;zP=1;var t=IF(),e=$S(),n=DF();function r(u){var f="https://react.dev/errors/"+u;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)f+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+u+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(u){return!(!u||u.nodeType!==1&&u.nodeType!==9&&u.nodeType!==11)}function s(u){var f=u,y=u;if(u.alternate)for(;f.return;)f=f.return;else{u=f;do f=u,(f.flags&4098)!==0&&(y=f.return),u=f.return;while(u)}return f.tag===3?y:null}function a(u){if(u.tag===13){var f=u.memoizedState;if(f===null&&(u=u.alternate,u!==null&&(f=u.memoizedState)),f!==null)return f.dehydrated}return null}function o(u){if(u.tag===31){var f=u.memoizedState;if(f===null&&(u=u.alternate,u!==null&&(f=u.memoizedState)),f!==null)return f.dehydrated}return null}function l(u){if(s(u)!==u)throw Error(r(188))}function c(u){var f=u.alternate;if(!f){if(f=s(u),f===null)throw Error(r(188));return f!==u?null:u}for(var y=u,M=f;;){var I=y.return;if(I===null)break;var z=I.alternate;if(z===null){if(M=I.return,M!==null){y=M;continue}break}if(I.child===z.child){for(z=I.child;z;){if(z===y)return l(I),u;if(z===M)return l(I),f;z=z.sibling}throw Error(r(188))}if(y.return!==M.return)y=I,M=z;else{for(var ce=!1,Ne=I.child;Ne;){if(Ne===y){ce=!0,y=I,M=z;break}if(Ne===M){ce=!0,M=I,y=z;break}Ne=Ne.sibling}if(!ce){for(Ne=z.child;Ne;){if(Ne===y){ce=!0,y=z,M=I;break}if(Ne===M){ce=!0,M=z,y=I;break}Ne=Ne.sibling}if(!ce)throw Error(r(189))}}if(y.alternate!==M)throw Error(r(190))}if(y.tag!==3)throw Error(r(188));return y.stateNode.current===y?u:f}function d(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u;for(u=u.child;u!==null;){if(f=d(u),f!==null)return f;u=u.sibling}return null}var h=Object.assign,g=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),A=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function V(u){return u===null||typeof u!="object"?null:(u=F&&u[F]||u["@@iterator"],typeof u=="function"?u:null)}var G=Symbol.for("react.client.reference");function Z(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===G?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case _:return"Fragment";case S:return"Profiler";case w:return"StrictMode";case D:return"Suspense";case P:return"SuspenseList";case O:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case b:return"Portal";case A:return u.displayName||"Context";case E:return(u._context.displayName||"Context")+".Consumer";case N:var f=u.render;return u=u.displayName,u||(u=f.displayName||f.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case L:return f=u.displayName||null,f!==null?f:Z(u.type)||"Memo";case R:f=u._payload,u=u._init;try{return Z(u(f))}catch{}}return null}var B=Array.isArray,q=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},Q=[],U=-1;function j(u){return{current:u}}function X(u){0>U||(u.current=Q[U],Q[U]=null,U--)}function H(u,f){U++,Q[U]=u.current,u.current=f}var ie=j(null),ne=j(null),re=j(null),ue=j(null);function le(u,f){switch(H(re,f),H(ne,u),H(ie,null),f.nodeType){case 9:case 11:u=(u=f.documentElement)&&(u=u.namespaceURI)?Z9(u):0;break;default:if(u=f.tagName,f=f.namespaceURI)f=Z9(f),u=Q9(f,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}X(ie),H(ie,u)}function fe(){X(ie),X(ne),X(re)}function we(u){u.memoizedState!==null&&H(ue,u);var f=ie.current,y=Q9(f,u.type);f!==y&&(H(ne,u),H(ie,y))}function pe(u){ne.current===u&&(X(ie),X(ne)),ue.current===u&&(X(ue),Ob._currentValue=Y)}var xe,Ve;function ye(u){if(xe===void 0)try{throw Error()}catch(y){var f=y.stack.trim().match(/\n( *(at )?)/);xe=f&&f[1]||"",Ve=-1<y.stack.indexOf(`
    at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
`+xe+u+Ve}var Oe=!1;function he(u,f){if(!u||Oe)return"";Oe=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var M={DetermineComponentFrameRoot:function(){try{if(f){var Ut=function(){throw Error()};if(Object.defineProperty(Ut.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ut,[])}catch(Dt){var Nt=Dt}Reflect.construct(u,[],Ut)}else{try{Ut.call()}catch(Dt){Nt=Dt}u.call(Ut.prototype)}}else{try{throw Error()}catch(Dt){Nt=Dt}(Ut=u())&&typeof Ut.catch=="function"&&Ut.catch(function(){})}}catch(Dt){if(Dt&&Nt&&typeof Dt.stack=="string")return[Dt.stack,Nt.stack]}return[null,null]}};M.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var I=Object.getOwnPropertyDescriptor(M.DetermineComponentFrameRoot,"name");I&&I.configurable&&Object.defineProperty(M.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var z=M.DetermineComponentFrameRoot(),ce=z[0],Ne=z[1];if(ce&&Ne){var rt=ce.split(`
`),Ct=Ne.split(`
`);for(I=M=0;M<rt.length&&!rt[M].includes("DetermineComponentFrameRoot");)M++;for(;I<Ct.length&&!Ct[I].includes("DetermineComponentFrameRoot");)I++;if(M===rt.length||I===Ct.length)for(M=rt.length-1,I=Ct.length-1;1<=M&&0<=I&&rt[M]!==Ct[I];)I--;for(;1<=M&&0<=I;M--,I--)if(rt[M]!==Ct[I]){if(M!==1||I!==1)do if(M--,I--,0>I||rt[M]!==Ct[I]){var Lt=`
`+rt[M].replace(" at new "," at ");return u.displayName&&Lt.includes("<anonymous>")&&(Lt=Lt.replace("<anonymous>",u.displayName)),Lt}while(1<=M&&0<=I);break}}}finally{Oe=!1,Error.prepareStackTrace=y}return(y=u?u.displayName||u.name:"")?ye(y):""}function Re(u,f){switch(u.tag){case 26:case 27:case 5:return ye(u.type);case 16:return ye("Lazy");case 13:return u.child!==f&&f!==null?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("SuspenseList");case 0:case 15:return he(u.type,!1);case 11:return he(u.type.render,!1);case 1:return he(u.type,!0);case 31:return ye("Activity");default:return""}}function oe(u){try{var f="",y=null;do f+=Re(u,y),y=u,u=u.return;while(u);return f}catch(M){return`
Error generating stack: `+M.message+`
`+M.stack}}var Ue=Object.prototype.hasOwnProperty,Ee=t.unstable_scheduleCallback,Pe=t.unstable_cancelCallback,Ze=t.unstable_shouldYield,ae=t.unstable_requestPaint,te=t.unstable_now,be=t.unstable_getCurrentPriorityLevel,me=t.unstable_ImmediatePriority,ge=t.unstable_UserBlockingPriority,ke=t.unstable_NormalPriority,Xe=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,je=t.log,We=t.unstable_setDisableYieldValue,De=null,Be=null;function qe(u){if(typeof je=="function"&&We(u),Be&&typeof Be.setStrictMode=="function")try{Be.setStrictMode(De,u)}catch{}}var Se=Math.clz32?Math.clz32:Le,Ye=Math.log,dt=Math.LN2;function Le(u){return u>>>=0,u===0?32:31-(Ye(u)/dt|0)|0}var st=256,ft=262144,mt=4194304;function tt(u){var f=u&42;if(f!==0)return f;switch(u&-u){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function Qe(u,f,y){var M=u.pendingLanes;if(M===0)return 0;var I=0,z=u.suspendedLanes,ce=u.pingedLanes;u=u.warmLanes;var Ne=M&134217727;return Ne!==0?(M=Ne&~z,M!==0?I=tt(M):(ce&=Ne,ce!==0?I=tt(ce):y||(y=Ne&~u,y!==0&&(I=tt(y))))):(Ne=M&~z,Ne!==0?I=tt(Ne):ce!==0?I=tt(ce):y||(y=M&~u,y!==0&&(I=tt(y)))),I===0?0:f!==0&&f!==I&&(f&z)===0&&(z=I&-I,y=f&-f,z>=y||z===32&&(y&4194048)!==0)?f:I}function ze(u,f){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&f)===0}function Te(u,f){switch(u){case 1:case 2:case 4:case 8:case 64:return f+250;case 16:case 32: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 f+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function He(){var u=mt;return mt<<=1,(mt&62914560)===0&&(mt=4194304),u}function et(u){for(var f=[],y=0;31>y;y++)f.push(u);return f}function ht(u,f){u.pendingLanes|=f,f!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function ct(u,f,y,M,I,z){var ce=u.pendingLanes;u.pendingLanes=y,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=y,u.entangledLanes&=y,u.errorRecoveryDisabledLanes&=y,u.shellSuspendCounter=0;var Ne=u.entanglements,rt=u.expirationTimes,Ct=u.hiddenUpdates;for(y=ce&~y;0<y;){var Lt=31-Se(y),Ut=1<<Lt;Ne[Lt]=0,rt[Lt]=-1;var Nt=Ct[Lt];if(Nt!==null)for(Ct[Lt]=null,Lt=0;Lt<Nt.length;Lt++){var Dt=Nt[Lt];Dt!==null&&(Dt.lane&=-536870913)}y&=~Ut}M!==0&&bt(u,M,0),z!==0&&I===0&&u.tag!==0&&(u.suspendedLanes|=z&~(ce&~f))}function bt(u,f,y){u.pendingLanes|=f,u.suspendedLanes&=~f;var M=31-Se(f);u.entangledLanes|=f,u.entanglements[M]=u.entanglements[M]|1073741824|y&261930}function wt(u,f){var y=u.entangledLanes|=f;for(u=u.entanglements;y;){var M=31-Se(y),I=1<<M;I&f|u[M]&f&&(u[M]|=f),y&=~I}}function Pt(u,f){var y=f&-f;return y=(y&42)!==0?1:$e(y),(y&(u.suspendedLanes|f))!==0?0:y}function $e(u){switch(u){case 2:u=1;break;case 8:u=4;break;case 32:u=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:u=128;break;case 268435456:u=134217728;break;default:u=0}return u}function Tt(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function Et(){var u=K.p;return u!==0?u:(u=window.event,u===void 0?32:_P(u.type))}function Ot(u,f){var y=K.p;try{return K.p=u,f()}finally{K.p=y}}var Gt=Math.random().toString(36).slice(2),an="__reactFiber$"+Gt,On="__reactProps$"+Gt,Bt="__reactContainer$"+Gt,fn="__reactEvents$"+Gt,Ht="__reactListeners$"+Gt,In="__reactHandles$"+Gt,Nn="__reactResources$"+Gt,bn="__reactMarker$"+Gt;function Ln(u){delete u[an],delete u[On],delete u[fn],delete u[Ht],delete u[In]}function Fn(u){var f=u[an];if(f)return f;for(var y=u.parentNode;y;){if(f=y[Bt]||y[an]){if(y=f.alternate,f.child!==null||y!==null&&y.child!==null)for(u=sP(u);u!==null;){if(y=u[an])return y;u=sP(u)}return f}u=y,y=u.parentNode}return null}function Bi(u){if(u=u[an]||u[Bt]){var f=u.tag;if(f===5||f===6||f===13||f===31||f===26||f===27||f===3)return u}return null}function ui(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u.stateNode;throw Error(r(33))}function ve(u){var f=u[Nn];return f||(f=u[Nn]={hoistableStyles:new Map,hoistableScripts:new Map}),f}function ot(u){u[bn]=!0}var _t=new Set,yt={};function vt(u,f){Yt(u,f),Yt(u+"Capture",f)}function Yt(u,f){for(yt[u]=f,u=0;u<f.length;u++)_t.add(f[u])}var rn=RegExp("^[: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]*$"),sn={},Zt={};function Mn(u){return Ue.call(Zt,u)?!0:Ue.call(sn,u)?!1:rn.test(u)?Zt[u]=!0:(sn[u]=!0,!1)}function Un(u,f,y){if(Mn(f))if(y===null)u.removeAttribute(f);else{switch(typeof y){case"undefined":case"function":case"symbol":u.removeAttribute(f);return;case"boolean":var M=f.toLowerCase().slice(0,5);if(M!=="data-"&&M!=="aria-"){u.removeAttribute(f);return}}u.setAttribute(f,""+y)}}function $n(u,f,y){if(y===null)u.removeAttribute(f);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(f);return}u.setAttribute(f,""+y)}}function on(u,f,y,M){if(M===null)u.removeAttribute(y);else{switch(typeof M){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(y);return}u.setAttributeNS(f,y,""+M)}}function ir(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Xr(u){var f=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function Jr(u,f,y){var M=Object.getOwnPropertyDescriptor(u.constructor.prototype,f);if(!u.hasOwnProperty(f)&&typeof M<"u"&&typeof M.get=="function"&&typeof M.set=="function"){var I=M.get,z=M.set;return Object.defineProperty(u,f,{configurable:!0,get:function(){return I.call(this)},set:function(ce){y=""+ce,z.call(this,ce)}}),Object.defineProperty(u,f,{enumerable:M.enumerable}),{getValue:function(){return y},setValue:function(ce){y=""+ce},stopTracking:function(){u._valueTracker=null,delete u[f]}}}}function cr(u){if(!u._valueTracker){var f=Xr(u)?"checked":"value";u._valueTracker=Jr(u,f,""+u[f])}}function Nr(u){if(!u)return!1;var f=u._valueTracker;if(!f)return!0;var y=f.getValue(),M="";return u&&(M=Xr(u)?u.checked?"true":"false":u.value),u=M,u!==y?(f.setValue(u),!0):!1}function en(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var ss=/[\n"\\]/g;function Rn(u){return u.replace(ss,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function gs(u,f,y,M,I,z,ce,Ne){u.name="",ce!=null&&typeof ce!="function"&&typeof ce!="symbol"&&typeof ce!="boolean"?u.type=ce:u.removeAttribute("type"),f!=null?ce==="number"?(f===0&&u.value===""||u.value!=f)&&(u.value=""+ir(f)):u.value!==""+ir(f)&&(u.value=""+ir(f)):ce!=="submit"&&ce!=="reset"||u.removeAttribute("value"),f!=null?Pi(u,ce,ir(f)):y!=null?Pi(u,ce,ir(y)):M!=null&&u.removeAttribute("value"),I==null&&z!=null&&(u.defaultChecked=!!z),I!=null&&(u.checked=I&&typeof I!="function"&&typeof I!="symbol"),Ne!=null&&typeof Ne!="function"&&typeof Ne!="symbol"&&typeof Ne!="boolean"?u.name=""+ir(Ne):u.removeAttribute("name")}function Rs(u,f,y,M,I,z,ce,Ne){if(z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"&&(u.type=z),f!=null||y!=null){if(!(z!=="submit"&&z!=="reset"||f!=null)){cr(u);return}y=y!=null?""+ir(y):"",f=f!=null?""+ir(f):y,Ne||f===u.value||(u.value=f),u.defaultValue=f}M=M??I,M=typeof M!="function"&&typeof M!="symbol"&&!!M,u.checked=Ne?u.checked:!!M,u.defaultChecked=!!M,ce!=null&&typeof ce!="function"&&typeof ce!="symbol"&&typeof ce!="boolean"&&(u.name=ce),cr(u)}function Pi(u,f,y){f==="number"&&en(u.ownerDocument)===u||u.defaultValue===""+y||(u.defaultValue=""+y)}function vs(u,f,y,M){if(u=u.options,f){f={};for(var I=0;I<y.length;I++)f["$"+y[I]]=!0;for(y=0;y<u.length;y++)I=f.hasOwnProperty("$"+u[y].value),u[y].selected!==I&&(u[y].selected=I),I&&M&&(u[y].defaultSelected=!0)}else{for(y=""+ir(y),f=null,I=0;I<u.length;I++){if(u[I].value===y){u[I].selected=!0,M&&(u[I].defaultSelected=!0);return}f!==null||u[I].disabled||(f=u[I])}f!==null&&(f.selected=!0)}}function pr(u,f,y){if(f!=null&&(f=""+ir(f),f!==u.value&&(u.value=f),y==null)){u.defaultValue!==f&&(u.defaultValue=f);return}u.defaultValue=y!=null?""+ir(y):""}function di(u,f,y,M){if(f==null){if(M!=null){if(y!=null)throw Error(r(92));if(B(M)){if(1<M.length)throw Error(r(93));M=M[0]}y=M}y==null&&(y=""),f=y}y=ir(f),u.defaultValue=y,M=u.textContent,M===y&&M!==""&&M!==null&&(u.value=M),cr(u)}function ks(u,f){if(f){var y=u.firstChild;if(y&&y===u.lastChild&&y.nodeType===3){y.nodeValue=f;return}}u.textContent=f}var Ii=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function $a(u,f,y){var M=f.indexOf("--")===0;y==null||typeof y=="boolean"||y===""?M?u.setProperty(f,""):f==="float"?u.cssFloat="":u[f]="":M?u.setProperty(f,y):typeof y!="number"||y===0||Ii.has(f)?f==="float"?u.cssFloat=y:u[f]=(""+y).trim():u[f]=y+"px"}function co(u,f,y){if(f!=null&&typeof f!="object")throw Error(r(62));if(u=u.style,y!=null){for(var M in y)!y.hasOwnProperty(M)||f!=null&&f.hasOwnProperty(M)||(M.indexOf("--")===0?u.setProperty(M,""):M==="float"?u.cssFloat="":u[M]="");for(var I in f)M=f[I],f.hasOwnProperty(I)&&y[I]!==M&&$a(u,I,M)}else for(var z in f)f.hasOwnProperty(z)&&$a(u,z,f[z])}function So(u){if(u.indexOf("-")===-1)return!1;switch(u){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 ql=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),xl=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function uo(u){return xl.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function Ps(){}var Xl=null;function Go(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var wo=null,Mo=null;function kc(u){var f=Bi(u);if(f&&(u=f.stateNode)){var y=u[On]||null;e:switch(u=f.stateNode,f.type){case"input":if(gs(u,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name),f=y.name,y.type==="radio"&&f!=null){for(y=u;y.parentNode;)y=y.parentNode;for(y=y.querySelectorAll('input[name="'+Rn(""+f)+'"][type="radio"]'),f=0;f<y.length;f++){var M=y[f];if(M!==u&&M.form===u.form){var I=M[On]||null;if(!I)throw Error(r(90));gs(M,I.value,I.defaultValue,I.defaultValue,I.checked,I.defaultChecked,I.type,I.name)}}for(f=0;f<y.length;f++)M=y[f],M.form===u.form&&Nr(M)}break e;case"textarea":pr(u,y.value,y.defaultValue);break e;case"select":f=y.value,f!=null&&vs(u,!!y.multiple,f,!1)}}}var Pc=!1;function Yl(u,f,y){if(Pc)return u(f,y);Pc=!0;try{var M=u(f);return M}finally{if(Pc=!1,(wo!==null||Mo!==null)&&(Uc(),wo&&(f=wo,u=Mo,Mo=wo=null,kc(f),u)))for(f=0;f<u.length;f++)kc(u[f])}}function qa(u,f){var y=u.stateNode;if(y===null)return null;var M=y[On]||null;if(M===null)return null;y=M[f];e:switch(f){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(M=!M.disabled)||(u=u.type,M=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!M;break e;default:u=!1}if(u)return null;if(y&&typeof y!="function")throw Error(r(231,f,typeof y));return y}var ia=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Aa=!1;if(ia)try{var yl={};Object.defineProperty(yl,"passive",{get:function(){Aa=!0}}),window.addEventListener("test",yl,yl),window.removeEventListener("test",yl,yl)}catch{Aa=!1}var xs=null,Wo=null,$o=null;function Ic(){if($o)return $o;var u,f=Wo,y=f.length,M,I="value"in xs?xs.value:xs.textContent,z=I.length;for(u=0;u<y&&f[u]===I[u];u++);var ce=y-u;for(M=1;M<=ce&&f[y-M]===I[z-M];M++);return $o=I.slice(u,1<M?1-M:void 0)}function ei(u){var f=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&f===13&&(u=13)):u=f,u===10&&(u=13),32<=u||u===13?u:0}function zr(){return!0}function Xa(){return!1}function mr(u){function f(y,M,I,z,ce){this._reactName=y,this._targetInst=I,this.type=M,this.nativeEvent=z,this.target=ce,this.currentTarget=null;for(var Ne in u)u.hasOwnProperty(Ne)&&(y=u[Ne],this[Ne]=y?y(z):z[Ne]);return this.isDefaultPrevented=(z.defaultPrevented!=null?z.defaultPrevented:z.returnValue===!1)?zr:Xa,this.isPropagationStopped=Xa,this}return h(f.prototype,{preventDefault:function(){this.defaultPrevented=!0;var y=this.nativeEvent;y&&(y.preventDefault?y.preventDefault():typeof y.returnValue!="unknown"&&(y.returnValue=!1),this.isDefaultPrevented=zr)},stopPropagation:function(){var y=this.nativeEvent;y&&(y.stopPropagation?y.stopPropagation():typeof y.cancelBubble!="unknown"&&(y.cancelBubble=!0),this.isPropagationStopped=zr)},persist:function(){},isPersistent:zr}),f}var bi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Di=mr(bi),Wr=h({},bi,{view:0,detail:0}),To=mr(Wr),bl,Kl,ga,hi=h({},Wr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ep,button:0,buttons:0,relatedTarget:function(u){return u.relatedTarget===void 0?u.fromElement===u.srcElement?u.toElement:u.fromElement:u.relatedTarget},movementX:function(u){return"movementX"in u?u.movementX:(u!==ga&&(ga&&u.type==="mousemove"?(bl=u.screenX-ga.screenX,Kl=u.screenY-ga.screenY):Kl=bl=0,ga=u),bl)},movementY:function(u){return"movementY"in u?u.movementY:Kl}}),vh=mr(hi),nd=h({},hi,{dataTransfer:0}),rd=mr(nd),Qd=h({},Wr,{relatedTarget:0}),fo=mr(Qd),Gi=h({},bi,{animationName:0,elapsedTime:0,pseudoElement:0}),Hs=mr(Gi),ys=h({},bi,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),_l=mr(ys),va=h({},bi,{data:0}),Tp=mr(va),xh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_m={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Jd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function id(u){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(u):(u=Jd[u])?!!f[u]:!1}function Ep(){return id}var Cp=h({},Wr,{key:function(u){if(u.key){var f=xh[u.key]||u.key;if(f!=="Unidentified")return f}return u.type==="keypress"?(u=ei(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?_m[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ep,charCode:function(u){return u.type==="keypress"?ei(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?ei(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),sd=mr(Cp),Zl=h({},hi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ql=mr(Zl),ad=h({},Wr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ep}),Sm=mr(ad),Ap=h({},bi,{propertyName:0,elapsedTime:0,pseudoElement:0}),wm=mr(Ap),Vs=h({},hi,{deltaX:function(u){return"deltaX"in u?u.deltaX:"wheelDeltaX"in u?-u.wheelDeltaX:0},deltaY:function(u){return"deltaY"in u?u.deltaY:"wheelDeltaY"in u?-u.wheelDeltaY:"wheelDelta"in u?-u.wheelDelta:0},deltaZ:0,deltaMode:0}),Mm=mr(Vs),Tm=h({},bi,{newState:0,oldState:0}),Em=mr(Tm),Cm=[9,13,27,32],uu=ia&&"CompositionEvent"in window,od=null;ia&&"documentMode"in document&&(od=document.documentMode);var Np=ia&&"TextEvent"in window&&!od,Rp=ia&&(!uu||od&&8<od&&11>=od),Am=" ",Jl=!1;function ld(u,f){switch(u){case"keyup":return Cm.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Is(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var du=!1;function bs(u,f){switch(u){case"compositionend":return Is(f);case"keypress":return f.which!==32?null:(Jl=!0,Am);case"textInput":return u=f.data,u===Am&&Jl?null:u;default:return null}}function kp(u,f){if(du)return u==="compositionend"||!uu&&ld(u,f)?(u=Ic(),$o=Wo=xs=null,du=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1<f.char.length)return f.char;if(f.which)return String.fromCharCode(f.which)}return null;case"compositionend":return Rp&&f.locale!=="ko"?null:f.data;default:return null}}var yh={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function cd(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f==="input"?!!yh[u.type]:f==="textarea"}function Pp(u,f,y,M){wo?Mo?Mo.push(M):Mo=[M]:wo=M,f=E3(f,"onChange"),0<f.length&&(y=new Di("onChange","change",null,y,M),u.push({event:y,listeners:f}))}var fu=null,Dc=null;function de(u){W9(u,0)}function Me(u){var f=ui(u);if(Nr(f))return u}function Ge(u,f){if(u==="change")return f}var Ke=!1;if(ia){var lt;if(ia){var St="oninput"in document;if(!St){var jt=document.createElement("div");jt.setAttribute("oninput","return;"),St=typeof jt.oninput=="function"}lt=St}else lt=!1;Ke=lt&&(!document.documentMode||9<document.documentMode)}function Vt(){fu&&(fu.detachEvent("onpropertychange",Kt),Dc=fu=null)}function Kt(u){if(u.propertyName==="value"&&Me(Dc)){var f=[];Pp(f,Dc,u,Go(u)),Yl(de,f)}}function mn(u,f,y){u==="focusin"?(Vt(),fu=f,Dc=y,fu.attachEvent("onpropertychange",Kt)):u==="focusout"&&Vt()}function vn(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Me(Dc)}function Sn(u,f){if(u==="click")return Me(f)}function er(u,f){if(u==="input"||u==="change")return Me(f)}function Yr(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var tr=typeof Object.is=="function"?Object.is:Yr;function ur(u,f){if(tr(u,f))return!0;if(typeof u!="object"||u===null||typeof f!="object"||f===null)return!1;var y=Object.keys(u),M=Object.keys(f);if(y.length!==M.length)return!1;for(M=0;M<y.length;M++){var I=y[M];if(!Ue.call(f,I)||!tr(u[I],f[I]))return!1}return!0}function Vn(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function An(u,f){var y=Vn(u);u=0;for(var M;y;){if(y.nodeType===3){if(M=u+y.textContent.length,u<=f&&M>=f)return{node:y,offset:f-u};u=M}e:{for(;y;){if(y.nextSibling){y=y.nextSibling;break e}y=y.parentNode}y=void 0}y=Vn(y)}}function qn(u,f){return u&&f?u===f?!0:u&&u.nodeType===3?!1:f&&f.nodeType===3?qn(u,f.parentNode):"contains"in u?u.contains(f):u.compareDocumentPosition?!!(u.compareDocumentPosition(f)&16):!1:!1}function Ji(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var f=en(u.document);f instanceof u.HTMLIFrameElement;){try{var y=typeof f.contentWindow.location.href=="string"}catch{y=!1}if(y)u=f.contentWindow;else break;f=en(u.document)}return f}function Ds(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f&&(f==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||f==="textarea"||u.contentEditable==="true")}var pi=ia&&"documentMode"in document&&11>=document.documentMode,si=null,as=null,Os=null,Ya=!1;function Na(u,f,y){var M=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;Ya||si==null||si!==en(M)||(M=si,"selectionStart"in M&&Ds(M)?M={start:M.selectionStart,end:M.selectionEnd}:(M=(M.ownerDocument&&M.ownerDocument.defaultView||window).getSelection(),M={anchorNode:M.anchorNode,anchorOffset:M.anchorOffset,focusNode:M.focusNode,focusOffset:M.focusOffset}),Os&&ur(Os,M)||(Os=M,M=E3(as,"onSelect"),0<M.length&&(f=new Di("onSelect","select",null,f,y),u.push({event:f,listeners:M}),f.target=si)))}function Hi(u,f){var y={};return y[u.toLowerCase()]=f.toLowerCase(),y["Webkit"+u]="webkit"+f,y["Moz"+u]="moz"+f,y}var Gs={animationend:Hi("Animation","AnimationEnd"),animationiteration:Hi("Animation","AnimationIteration"),animationstart:Hi("Animation","AnimationStart"),transitionrun:Hi("Transition","TransitionRun"),transitionstart:Hi("Transition","TransitionStart"),transitioncancel:Hi("Transition","TransitionCancel"),transitionend:Hi("Transition","TransitionEnd")},Ra={},Eo={};ia&&(Eo=document.createElement("div").style,"AnimationEvent"in window||(delete Gs.animationend.animation,delete Gs.animationiteration.animation,delete Gs.animationstart.animation),"TransitionEvent"in window||delete Gs.transitionend.transition);function sa(u){if(Ra[u])return Ra[u];if(!Gs[u])return u;var f=Gs[u],y;for(y in f)if(f.hasOwnProperty(y)&&y in Eo)return Ra[u]=f[y];return u}var aa=sa("animationend"),xa=sa("animationiteration"),Oc=sa("animationstart"),ka=sa("transitionrun"),Rv=sa("transitionstart"),Nw=sa("transitioncancel"),zy=sa("transitionend"),ec=new Map,Nm="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Nm.push("scrollEnd");function tc(u,f){ec.set(u,f),vt(f,[u])}var Rm=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var f=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof u=="object"&&u!==null&&typeof u.message=="string"?String(u.message):String(u),error:u});if(!window.dispatchEvent(f))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u)},nc=[],ud=0,Pa=0;function km(){for(var u=ud,f=Pa=ud=0;f<u;){var y=nc[f];nc[f++]=null;var M=nc[f];nc[f++]=null;var I=nc[f];nc[f++]=null;var z=nc[f];if(nc[f++]=null,M!==null&&I!==null){var ce=M.pending;ce===null?I.next=I:(I.next=ce.next,ce.next=I),M.pending=I}z!==0&&ef(y,I,z)}}function Ia(u,f,y,M){nc[ud++]=u,nc[ud++]=f,nc[ud++]=y,nc[ud++]=M,Pa|=M,u.lanes|=M,u=u.alternate,u!==null&&(u.lanes|=M)}function kv(u,f,y,M){return Ia(u,f,y,M),rc(u)}function Co(u,f){return Ia(u,null,null,f),rc(u)}function ef(u,f,y){u.lanes|=y;var M=u.alternate;M!==null&&(M.lanes|=y);for(var I=!1,z=u.return;z!==null;)z.childLanes|=y,M=z.alternate,M!==null&&(M.childLanes|=y),z.tag===22&&(u=z.stateNode,u===null||u._visibility&1||(I=!0)),u=z,z=z.return;return u.tag===3?(z=u.stateNode,I&&f!==null&&(I=31-Se(y),u=z.hiddenUpdates,M=u[I],M===null?u[I]=[f]:M.push(f),f.lane=y|536870912),z):null}function rc(u){if(50<bf)throw bf=0,jh=null,Error(r(185));for(var f=u.return;f!==null;)u=f,f=u.return;return u.tag===3?u.stateNode:null}var tf={};function jy(u,f,y,M){this.tag=u,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=M,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _s(u,f,y,M){return new jy(u,f,y,M)}function Pv(u){return u=u.prototype,!(!u||!u.isReactComponent)}function qo(u,f){var y=u.alternate;return y===null?(y=_s(u.tag,f,u.key,u.mode),y.elementType=u.elementType,y.type=u.type,y.stateNode=u.stateNode,y.alternate=u,u.alternate=y):(y.pendingProps=f,y.type=u.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=u.flags&65011712,y.childLanes=u.childLanes,y.lanes=u.lanes,y.child=u.child,y.memoizedProps=u.memoizedProps,y.memoizedState=u.memoizedState,y.updateQueue=u.updateQueue,f=u.dependencies,y.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},y.sibling=u.sibling,y.index=u.index,y.ref=u.ref,y.refCleanup=u.refCleanup,y}function Ip(u,f){u.flags&=65011714;var y=u.alternate;return y===null?(u.childLanes=0,u.lanes=f,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=y.childLanes,u.lanes=y.lanes,u.child=y.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=y.memoizedProps,u.memoizedState=y.memoizedState,u.updateQueue=y.updateQueue,u.type=y.type,f=y.dependencies,u.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),u}function hu(u,f,y,M,I,z){var ce=0;if(M=u,typeof u=="function")Pv(u)&&(ce=1);else if(typeof u=="string")ce=PZ(u,y,ie.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case O:return u=_s(31,y,f,I),u.elementType=O,u.lanes=z,u;case _:return nf(y.children,I,z,f);case w:ce=8,I|=24;break;case S:return u=_s(12,y,f,I|2),u.elementType=S,u.lanes=z,u;case D:return u=_s(13,y,f,I),u.elementType=D,u.lanes=z,u;case P:return u=_s(19,y,f,I),u.elementType=P,u.lanes=z,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case A:ce=10;break e;case E:ce=9;break e;case N:ce=11;break e;case L:ce=14;break e;case R:ce=16,M=null;break e}ce=29,y=Error(r(130,u===null?"null":typeof u,"")),M=null}return f=_s(ce,y,f,I),f.elementType=u,f.type=M,f.lanes=z,f}function nf(u,f,y,M){return u=_s(7,u,M,f),u.lanes=y,u}function Iv(u,f,y){return u=_s(6,u,null,f),u.lanes=y,u}function Dp(u){var f=_s(18,null,null,0);return f.stateNode=u,f}function Dv(u,f,y){return f=_s(4,u.children!==null?u.children:[],u.key,f),f.lanes=y,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}var Pm=new WeakMap;function Sl(u,f){if(typeof u=="object"&&u!==null){var y=Pm.get(u);return y!==void 0?y:(f={value:u,source:f,stack:oe(f)},Pm.set(u,f),f)}return{value:u,source:f,stack:oe(f)}}var rf=[],sf=0,Op=null,Lp=0,Xo=[],os=0,dd=null,Ss=1,Lc="";function pu(u,f){rf[sf++]=Lp,rf[sf++]=Op,Op=u,Lp=f}function Rw(u,f,y){Xo[os++]=Ss,Xo[os++]=Lc,Xo[os++]=dd,dd=u;var M=Ss;u=Lc;var I=32-Se(M)-1;M&=~(1<<I),y+=1;var z=32-Se(f)+I;if(30<z){var ce=I-I%5;z=(M&(1<<ce)-1).toString(32),M>>=ce,I-=ce,Ss=1<<32-Se(f)+I|y<<I|M,Lc=z+u}else Ss=1<<z|y<<I|M,Lc=u}function mu(u){u.return!==null&&(pu(u,1),Rw(u,1,0))}function Ov(u){for(;u===Op;)Op=rf[--sf],rf[sf]=null,Lp=rf[--sf],rf[sf]=null;for(;u===dd;)dd=Xo[--os],Xo[os]=null,Lc=Xo[--os],Xo[os]=null,Ss=Xo[--os],Xo[os]=null}function Lv(u,f){Xo[os++]=Ss,Xo[os++]=Lc,Xo[os++]=dd,Ss=f.id,Lc=f.overflow,dd=u}var Ls=null,Wi=null,$r=!1,fd=null,wl=!1,zp=Error(r(519));function gu(u){var f=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vu(Sl(f,u)),zp}function kw(u){var f=u.stateNode,y=u.type,M=u.memoizedProps;switch(f[an]=u,f[On]=M,y){case"dialog":Zr("cancel",f),Zr("close",f);break;case"iframe":case"object":case"embed":Zr("load",f);break;case"video":case"audio":for(y=0;y<gc.length;y++)Zr(gc[y],f);break;case"source":Zr("error",f);break;case"img":case"image":case"link":Zr("error",f),Zr("load",f);break;case"details":Zr("toggle",f);break;case"input":Zr("invalid",f),Rs(f,M.value,M.defaultValue,M.checked,M.defaultChecked,M.type,M.name,!0);break;case"select":Zr("invalid",f);break;case"textarea":Zr("invalid",f),di(f,M.value,M.defaultValue,M.children)}y=M.children,typeof y!="string"&&typeof y!="number"&&typeof y!="bigint"||f.textContent===""+y||M.suppressHydrationWarning===!0||Y9(f.textContent,y)?(M.popover!=null&&(Zr("beforetoggle",f),Zr("toggle",f)),M.onScroll!=null&&Zr("scroll",f),M.onScrollEnd!=null&&Zr("scrollend",f),M.onClick!=null&&(f.onclick=Ps),f=!0):f=!1,f||gu(u,!0)}function Pw(u){for(Ls=u.return;Ls;)switch(Ls.tag){case 5:case 31:case 13:wl=!1;return;case 27:case 3:wl=!0;return;default:Ls=Ls.return}}function jp(u){if(u!==Ls)return!1;if(!$r)return Pw(u),$r=!0,!1;var f=u.tag,y;if((y=f!==3&&f!==27)&&((y=f===5)&&(y=u.type,y=!(y!=="form"&&y!=="button")||KE(u.type,u.memoizedProps)),y=!y),y&&Wi&&gu(u),Pw(u),f===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Wi=iP(u)}else if(f===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Wi=iP(u)}else f===27?(f=Wi,i0(u.type)?(u=tC,tC=null,Wi=u):Wi=f):Wi=Ls?ku(u.stateNode.nextSibling):null;return!0}function af(){Wi=Ls=null,$r=!1}function zv(){var u=fd;return u!==null&&(js===null?js=u:js.push.apply(js,u),fd=null),u}function vu(u){fd===null?fd=[u]:fd.push(u)}var Fp=j(null),of=null,xu=null;function hd(u,f,y){H(Fp,f._currentValue),f._currentValue=y}function yu(u){u._currentValue=Fp.current,X(Fp)}function jv(u,f,y){for(;u!==null;){var M=u.alternate;if((u.childLanes&f)!==f?(u.childLanes|=f,M!==null&&(M.childLanes|=f)):M!==null&&(M.childLanes&f)!==f&&(M.childLanes|=f),u===y)break;u=u.return}}function Fv(u,f,y,M){var I=u.child;for(I!==null&&(I.return=u);I!==null;){var z=I.dependencies;if(z!==null){var ce=I.child;z=z.firstContext;e:for(;z!==null;){var Ne=z;z=I;for(var rt=0;rt<f.length;rt++)if(Ne.context===f[rt]){z.lanes|=y,Ne=z.alternate,Ne!==null&&(Ne.lanes|=y),jv(z.return,y,u),M||(ce=null);break e}z=Ne.next}}else if(I.tag===18){if(ce=I.return,ce===null)throw Error(r(341));ce.lanes|=y,z=ce.alternate,z!==null&&(z.lanes|=y),jv(ce,y,u),ce=null}else ce=I.child;if(ce!==null)ce.return=I;else for(ce=I;ce!==null;){if(ce===u){ce=null;break}if(I=ce.sibling,I!==null){I.return=ce.return,ce=I;break}ce=ce.return}I=ce}}function bu(u,f,y,M){u=null;for(var I=f,z=!1;I!==null;){if(!z){if((I.flags&524288)!==0)z=!0;else if((I.flags&262144)!==0)break}if(I.tag===10){var ce=I.alternate;if(ce===null)throw Error(r(387));if(ce=ce.memoizedProps,ce!==null){var Ne=I.type;tr(I.pendingProps.value,ce.value)||(u!==null?u.push(Ne):u=[Ne])}}else if(I===ue.current){if(ce=I.alternate,ce===null)throw Error(r(387));ce.memoizedState.memoizedState!==I.memoizedState.memoizedState&&(u!==null?u.push(Ob):u=[Ob])}I=I.return}u!==null&&Fv(f,u,y,M),f.flags|=262144}function Im(u){for(u=u.firstContext;u!==null;){if(!tr(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function lf(u){of=u,xu=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function nr(u){return Iw(of,u)}function Up(u,f){return of===null&&lf(u),Iw(u,f)}function Iw(u,f){var y=f._currentValue;if(f={context:f,memoizedValue:y,next:null},xu===null){if(u===null)throw Error(r(308));xu=f,u.dependencies={lanes:0,firstContext:f},u.flags|=524288}else xu=xu.next=f;return y}var Dw=typeof AbortController<"u"?AbortController:function(){var u=[],f=this.signal={aborted:!1,addEventListener:function(y,M){u.push(M)}};this.abort=function(){f.aborted=!0,u.forEach(function(y){return y()})}},OE=t.unstable_scheduleCallback,LE=t.unstable_NormalPriority,oa={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Fy(){return{controller:new Dw,data:new Map,refCount:0}}function bh(u){u.refCount--,u.refCount===0&&OE(LE,function(){u.controller.abort()})}var Ml=null,Uv=0,pd=0,ic=null;function Uy(u,f){if(Ml===null){var y=Ml=[];Uv=0,pd=kt(),ic={status:"pending",value:void 0,then:function(M){y.push(M)}}}return Uv++,f.then(By,By),f}function By(){if(--Uv===0&&Ml!==null){ic!==null&&(ic.status="fulfilled");var u=Ml;Ml=null,pd=0,ic=null;for(var f=0;f<u.length;f++)(0,u[f])()}}function Hy(u,f){var y=[],M={status:"pending",value:null,reason:null,then:function(I){y.push(I)}};return u.then(function(){M.status="fulfilled",M.value=f;for(var I=0;I<y.length;I++)(0,y[I])(f)},function(I){for(M.status="rejected",M.reason=I,I=0;I<y.length;I++)(0,y[I])(void 0)}),M}var Ow=q.S;q.S=function(u,f){Nb=te(),typeof f=="object"&&f!==null&&typeof f.then=="function"&&Uy(u,f),Ow!==null&&Ow(u,f)};var cf=j(null);function Bv(){var u=cf.current;return u!==null?u:or.pooledCache}function Dm(u,f){f===null?H(cf,cf.current):H(cf,f.pool)}function Vy(){var u=Bv();return u===null?null:{parent:oa._currentValue,pool:u}}var _h=Error(r(460)),Om=Error(r(474)),Sr=Error(r(542)),Hv={then:function(){}};function Yo(u){return u=u.status,u==="fulfilled"||u==="rejected"}function Vv(u,f,y){switch(y=u[y],y===void 0?u.push(f):y!==f&&(f.then(Ps,Ps),f=y),f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,Mh(u),u;default:if(typeof f.status=="string")f.then(Ps,Ps);else{if(u=or,u!==null&&100<u.shellSuspendCounter)throw Error(r(482));u=f,u.status="pending",u.then(function(M){if(f.status==="pending"){var I=f;I.status="fulfilled",I.value=M}},function(M){if(f.status==="pending"){var I=f;I.status="rejected",I.reason=M}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,Mh(u),u}throw _u=f,_h}}function Sh(u){try{var f=u._init;return f(u._payload)}catch(y){throw y!==null&&typeof y=="object"&&typeof y.then=="function"?(_u=y,_h):y}}var _u=null;function wh(){if(_u===null)throw Error(r(459));var u=_u;return _u=null,u}function Mh(u){if(u===_h||u===Sr)throw Error(r(483))}var Th=null,Eh=0;function Lm(u){var f=Eh;return Eh+=1,Th===null&&(Th=[]),Vv(Th,u,f)}function sc(u,f){f=f.props.ref,u.ref=f!==void 0?f:null}function Bp(u,f){throw f.$$typeof===g?Error(r(525)):(u=Object.prototype.toString.call(f),Error(r(31,u==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":u)))}function Gv(u){function f(gt,ut){if(u){var Mt=gt.deletions;Mt===null?(gt.deletions=[ut],gt.flags|=16):Mt.push(ut)}}function y(gt,ut){if(!u)return null;for(;ut!==null;)f(gt,ut),ut=ut.sibling;return null}function M(gt){for(var ut=new Map;gt!==null;)gt.key!==null?ut.set(gt.key,gt):ut.set(gt.index,gt),gt=gt.sibling;return ut}function I(gt,ut){return gt=qo(gt,ut),gt.index=0,gt.sibling=null,gt}function z(gt,ut,Mt){return gt.index=Mt,u?(Mt=gt.alternate,Mt!==null?(Mt=Mt.index,Mt<ut?(gt.flags|=67108866,ut):Mt):(gt.flags|=67108866,ut)):(gt.flags|=1048576,ut)}function ce(gt){return u&&gt.alternate===null&&(gt.flags|=67108866),gt}function Ne(gt,ut,Mt,Ft){return ut===null||ut.tag!==6?(ut=Iv(Mt,gt.mode,Ft),ut.return=gt,ut):(ut=I(ut,Mt),ut.return=gt,ut)}function rt(gt,ut,Mt,Ft){var Wn=Mt.type;return Wn===_?Lt(gt,ut,Mt.props.children,Ft,Mt.key):ut!==null&&(ut.elementType===Wn||typeof Wn=="object"&&Wn!==null&&Wn.$$typeof===R&&Sh(Wn)===ut.type)?(ut=I(ut,Mt.props),sc(ut,Mt),ut.return=gt,ut):(ut=hu(Mt.type,Mt.key,Mt.props,null,gt.mode,Ft),sc(ut,Mt),ut.return=gt,ut)}function Ct(gt,ut,Mt,Ft){return ut===null||ut.tag!==4||ut.stateNode.containerInfo!==Mt.containerInfo||ut.stateNode.implementation!==Mt.implementation?(ut=Dv(Mt,gt.mode,Ft),ut.return=gt,ut):(ut=I(ut,Mt.children||[]),ut.return=gt,ut)}function Lt(gt,ut,Mt,Ft,Wn){return ut===null||ut.tag!==7?(ut=nf(Mt,gt.mode,Ft,Wn),ut.return=gt,ut):(ut=I(ut,Mt),ut.return=gt,ut)}function Ut(gt,ut,Mt){if(typeof ut=="string"&&ut!==""||typeof ut=="number"||typeof ut=="bigint")return ut=Iv(""+ut,gt.mode,Mt),ut.return=gt,ut;if(typeof ut=="object"&&ut!==null){switch(ut.$$typeof){case v:return Mt=hu(ut.type,ut.key,ut.props,null,gt.mode,Mt),sc(Mt,ut),Mt.return=gt,Mt;case b:return ut=Dv(ut,gt.mode,Mt),ut.return=gt,ut;case R:return ut=Sh(ut),Ut(gt,ut,Mt)}if(B(ut)||V(ut))return ut=nf(ut,gt.mode,Mt,null),ut.return=gt,ut;if(typeof ut.then=="function")return Ut(gt,Lm(ut),Mt);if(ut.$$typeof===A)return Ut(gt,Up(gt,ut),Mt);Bp(gt,ut)}return null}function Nt(gt,ut,Mt,Ft){var Wn=ut!==null?ut.key:null;if(typeof Mt=="string"&&Mt!==""||typeof Mt=="number"||typeof Mt=="bigint")return Wn!==null?null:Ne(gt,ut,""+Mt,Ft);if(typeof Mt=="object"&&Mt!==null){switch(Mt.$$typeof){case v:return Mt.key===Wn?rt(gt,ut,Mt,Ft):null;case b:return Mt.key===Wn?Ct(gt,ut,Mt,Ft):null;case R:return Mt=Sh(Mt),Nt(gt,ut,Mt,Ft)}if(B(Mt)||V(Mt))return Wn!==null?null:Lt(gt,ut,Mt,Ft,null);if(typeof Mt.then=="function")return Nt(gt,ut,Lm(Mt),Ft);if(Mt.$$typeof===A)return Nt(gt,ut,Up(gt,Mt),Ft);Bp(gt,Mt)}return null}function Dt(gt,ut,Mt,Ft,Wn){if(typeof Ft=="string"&&Ft!==""||typeof Ft=="number"||typeof Ft=="bigint")return gt=gt.get(Mt)||null,Ne(ut,gt,""+Ft,Wn);if(typeof Ft=="object"&&Ft!==null){switch(Ft.$$typeof){case v:return gt=gt.get(Ft.key===null?Mt:Ft.key)||null,rt(ut,gt,Ft,Wn);case b:return gt=gt.get(Ft.key===null?Mt:Ft.key)||null,Ct(ut,gt,Ft,Wn);case R:return Ft=Sh(Ft),Dt(gt,ut,Mt,Ft,Wn)}if(B(Ft)||V(Ft))return gt=gt.get(Mt)||null,Lt(ut,gt,Ft,Wn,null);if(typeof Ft.then=="function")return Dt(gt,ut,Mt,Lm(Ft),Wn);if(Ft.$$typeof===A)return Dt(gt,ut,Mt,Up(ut,Ft),Wn);Bp(ut,Ft)}return null}function kn(gt,ut,Mt,Ft){for(var Wn=null,_i=null,jn=ut,Rr=ut=0,ni=null;jn!==null&&Rr<Mt.length;Rr++){jn.index>Rr?(ni=jn,jn=null):ni=jn.sibling;var Si=Nt(gt,jn,Mt[Rr],Ft);if(Si===null){jn===null&&(jn=ni);break}u&&jn&&Si.alternate===null&&f(gt,jn),ut=z(Si,ut,Rr),_i===null?Wn=Si:_i.sibling=Si,_i=Si,jn=ni}if(Rr===Mt.length)return y(gt,jn),$r&&pu(gt,Rr),Wn;if(jn===null){for(;Rr<Mt.length;Rr++)jn=Ut(gt,Mt[Rr],Ft),jn!==null&&(ut=z(jn,ut,Rr),_i===null?Wn=jn:_i.sibling=jn,_i=jn);return $r&&pu(gt,Rr),Wn}for(jn=M(jn);Rr<Mt.length;Rr++)ni=Dt(jn,gt,Rr,Mt[Rr],Ft),ni!==null&&(u&&ni.alternate!==null&&jn.delete(ni.key===null?Rr:ni.key),ut=z(ni,ut,Rr),_i===null?Wn=ni:_i.sibling=ni,_i=ni);return u&&jn.forEach(function(c0){return f(gt,c0)}),$r&&pu(gt,Rr),Wn}function Jn(gt,ut,Mt,Ft){if(Mt==null)throw Error(r(151));for(var Wn=null,_i=null,jn=ut,Rr=ut=0,ni=null,Si=Mt.next();jn!==null&&!Si.done;Rr++,Si=Mt.next()){jn.index>Rr?(ni=jn,jn=null):ni=jn.sibling;var c0=Nt(gt,jn,Si.value,Ft);if(c0===null){jn===null&&(jn=ni);break}u&&jn&&c0.alternate===null&&f(gt,jn),ut=z(c0,ut,Rr),_i===null?Wn=c0:_i.sibling=c0,_i=c0,jn=ni}if(Si.done)return y(gt,jn),$r&&pu(gt,Rr),Wn;if(jn===null){for(;!Si.done;Rr++,Si=Mt.next())Si=Ut(gt,Si.value,Ft),Si!==null&&(ut=z(Si,ut,Rr),_i===null?Wn=Si:_i.sibling=Si,_i=Si);return $r&&pu(gt,Rr),Wn}for(jn=M(jn);!Si.done;Rr++,Si=Mt.next())Si=Dt(jn,gt,Rr,Si.value,Ft),Si!==null&&(u&&Si.alternate!==null&&jn.delete(Si.key===null?Rr:Si.key),ut=z(Si,ut,Rr),_i===null?Wn=Si:_i.sibling=Si,_i=Si);return u&&jn.forEach(function(VZ){return f(gt,VZ)}),$r&&pu(gt,Rr),Wn}function Xi(gt,ut,Mt,Ft){if(typeof Mt=="object"&&Mt!==null&&Mt.type===_&&Mt.key===null&&(Mt=Mt.props.children),typeof Mt=="object"&&Mt!==null){switch(Mt.$$typeof){case v:e:{for(var Wn=Mt.key;ut!==null;){if(ut.key===Wn){if(Wn=Mt.type,Wn===_){if(ut.tag===7){y(gt,ut.sibling),Ft=I(ut,Mt.props.children),Ft.return=gt,gt=Ft;break e}}else if(ut.elementType===Wn||typeof Wn=="object"&&Wn!==null&&Wn.$$typeof===R&&Sh(Wn)===ut.type){y(gt,ut.sibling),Ft=I(ut,Mt.props),sc(Ft,Mt),Ft.return=gt,gt=Ft;break e}y(gt,ut);break}else f(gt,ut);ut=ut.sibling}Mt.type===_?(Ft=nf(Mt.props.children,gt.mode,Ft,Mt.key),Ft.return=gt,gt=Ft):(Ft=hu(Mt.type,Mt.key,Mt.props,null,gt.mode,Ft),sc(Ft,Mt),Ft.return=gt,gt=Ft)}return ce(gt);case b:e:{for(Wn=Mt.key;ut!==null;){if(ut.key===Wn)if(ut.tag===4&&ut.stateNode.containerInfo===Mt.containerInfo&&ut.stateNode.implementation===Mt.implementation){y(gt,ut.sibling),Ft=I(ut,Mt.children||[]),Ft.return=gt,gt=Ft;break e}else{y(gt,ut);break}else f(gt,ut);ut=ut.sibling}Ft=Dv(Mt,gt.mode,Ft),Ft.return=gt,gt=Ft}return ce(gt);case R:return Mt=Sh(Mt),Xi(gt,ut,Mt,Ft)}if(B(Mt))return kn(gt,ut,Mt,Ft);if(V(Mt)){if(Wn=V(Mt),typeof Wn!="function")throw Error(r(150));return Mt=Wn.call(Mt),Jn(gt,ut,Mt,Ft)}if(typeof Mt.then=="function")return Xi(gt,ut,Lm(Mt),Ft);if(Mt.$$typeof===A)return Xi(gt,ut,Up(gt,Mt),Ft);Bp(gt,Mt)}return typeof Mt=="string"&&Mt!==""||typeof Mt=="number"||typeof Mt=="bigint"?(Mt=""+Mt,ut!==null&&ut.tag===6?(y(gt,ut.sibling),Ft=I(ut,Mt),Ft.return=gt,gt=Ft):(y(gt,ut),Ft=Iv(Mt,gt.mode,Ft),Ft.return=gt,gt=Ft),ce(gt)):y(gt,ut)}return function(gt,ut,Mt,Ft){try{Eh=0;var Wn=Xi(gt,ut,Mt,Ft);return Th=null,Wn}catch(jn){if(jn===_h||jn===Sr)throw jn;var _i=_s(29,jn,null,gt.mode);return _i.lanes=Ft,_i.return=gt,_i}finally{}}}var md=Gv(!0),Wv=Gv(!1),Ao=!1;function zm(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Gy(u,f){u=u.updateQueue,f.updateQueue===u&&(f.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function gd(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function uf(u,f,y){var M=u.updateQueue;if(M===null)return null;if(M=M.shared,(Bn&2)!==0){var I=M.pending;return I===null?f.next=f:(f.next=I.next,I.next=f),M.pending=f,f=rc(u),ef(u,null,y),f}return Ia(u,M,f,y),rc(u)}function df(u,f,y){if(f=f.updateQueue,f!==null&&(f=f.shared,(y&4194048)!==0)){var M=f.lanes;M&=u.pendingLanes,y|=M,f.lanes=y,wt(u,y)}}function Gn(u,f){var y=u.updateQueue,M=u.alternate;if(M!==null&&(M=M.updateQueue,y===M)){var I=null,z=null;if(y=y.firstBaseUpdate,y!==null){do{var ce={lane:y.lane,tag:y.tag,payload:y.payload,callback:null,next:null};z===null?I=z=ce:z=z.next=ce,y=y.next}while(y!==null);z===null?I=z=f:z=z.next=f}else I=z=f;y={baseState:M.baseState,firstBaseUpdate:I,lastBaseUpdate:z,shared:M.shared,callbacks:M.callbacks},u.updateQueue=y;return}u=y.lastBaseUpdate,u===null?y.firstBaseUpdate=f:u.next=f,y.lastBaseUpdate=f}var Wy=!1;function jm(){if(Wy){var u=ic;if(u!==null)throw u}}function Hp(u,f,y,M){Wy=!1;var I=u.updateQueue;Ao=!1;var z=I.firstBaseUpdate,ce=I.lastBaseUpdate,Ne=I.shared.pending;if(Ne!==null){I.shared.pending=null;var rt=Ne,Ct=rt.next;rt.next=null,ce===null?z=Ct:ce.next=Ct,ce=rt;var Lt=u.alternate;Lt!==null&&(Lt=Lt.updateQueue,Ne=Lt.lastBaseUpdate,Ne!==ce&&(Ne===null?Lt.firstBaseUpdate=Ct:Ne.next=Ct,Lt.lastBaseUpdate=rt))}if(z!==null){var Ut=I.baseState;ce=0,Lt=Ct=rt=null,Ne=z;do{var Nt=Ne.lane&-536870913,Dt=Nt!==Ne.lane;if(Dt?(_r&Nt)===Nt:(M&Nt)===Nt){Nt!==0&&Nt===pd&&(Wy=!0),Lt!==null&&(Lt=Lt.next={lane:0,tag:Ne.tag,payload:Ne.payload,callback:null,next:null});e:{var kn=u,Jn=Ne;Nt=f;var Xi=y;switch(Jn.tag){case 1:if(kn=Jn.payload,typeof kn=="function"){Ut=kn.call(Xi,Ut,Nt);break e}Ut=kn;break e;case 3:kn.flags=kn.flags&-65537|128;case 0:if(kn=Jn.payload,Nt=typeof kn=="function"?kn.call(Xi,Ut,Nt):kn,Nt==null)break e;Ut=h({},Ut,Nt);break e;case 2:Ao=!0}}Nt=Ne.callback,Nt!==null&&(u.flags|=64,Dt&&(u.flags|=8192),Dt=I.callbacks,Dt===null?I.callbacks=[Nt]:Dt.push(Nt))}else Dt={lane:Nt,tag:Ne.tag,payload:Ne.payload,callback:Ne.callback,next:null},Lt===null?(Ct=Lt=Dt,rt=Ut):Lt=Lt.next=Dt,ce|=Nt;if(Ne=Ne.next,Ne===null){if(Ne=I.shared.pending,Ne===null)break;Dt=Ne,Ne=Dt.next,Dt.next=null,I.lastBaseUpdate=Dt,I.shared.pending=null}}while(!0);Lt===null&&(rt=Ut),I.baseState=rt,I.firstBaseUpdate=Ct,I.lastBaseUpdate=Lt,z===null&&(I.shared.lanes=0),Au|=ce,u.lanes=ce,u.memoizedState=Ut}}function Vp(u,f){if(typeof u!="function")throw Error(r(191,u));u.call(f)}function Lw(u,f){var y=u.callbacks;if(y!==null)for(u.callbacks=null,u=0;u<y.length;u++)Vp(y[u],f)}var Gp=j(null),$v=j(0);function zw(u,f){u=Al,H($v,u),H(Gp,f),Al=u|f.baseLanes}function $y(){H($v,Al),H(Gp,Gp.current)}function Fm(){Al=$v.current,X(Gp),X($v)}var Ko=j(null),No=null;function vd(u){var f=u.alternate;H(qr,qr.current&1),H(Ko,u),No===null&&(f===null||Gp.current!==null||f.memoizedState!==null)&&(No=u)}function qy(u){H(qr,qr.current),H(Ko,u),No===null&&(No=u)}function jw(u){u.tag===22?(H(qr,qr.current),H(Ko,u),No===null&&(No=u)):Zo()}function Zo(){H(qr,qr.current),H(Ko,Ko.current)}function Ws(u){X(Ko),No===u&&(No=null),X(qr)}var qr=j(0);function Tl(u){for(var f=u;f!==null;){if(f.tag===13){var y=f.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||JE(y)||eC(y)))return f}else if(f.tag===19&&(f.memoizedProps.revealOrder==="forwards"||f.memoizedProps.revealOrder==="backwards"||f.memoizedProps.revealOrder==="unstable_legacy-backwards"||f.memoizedProps.revealOrder==="together")){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var ls=0,gr=null,Oi=null,jr=null,ac=!1,Wp=!1,Ch=!1,qv=0,Um=0,$p=null,Xy=0;function ws(){throw Error(r(321))}function Yy(u,f){if(f===null)return!1;for(var y=0;y<f.length&&y<u.length;y++)if(!tr(u[y],f[y]))return!1;return!0}function Xv(u,f,y,M,I,z){return ls=z,gr=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,q.H=u===null||u.memoizedState===null?g3:mb,Ch=!1,z=y(M,I),Ch=!1,Wp&&(z=Ah(f,y,M,I)),Fw(u),z}function Fw(u){q.H=qp;var f=Oi!==null&&Oi.next!==null;if(ls=0,jr=Oi=gr=null,ac=!1,Um=0,$p=null,f)throw Error(r(300));u===null||la||(u=u.dependencies,u!==null&&Im(u)&&(la=!0))}function Ah(u,f,y,M){gr=u;var I=0;do{if(Wp&&($p=null),Um=0,Wp=!1,25<=I)throw Error(r(301));if(I+=1,jr=Oi=null,u.updateQueue!=null){var z=u.updateQueue;z.lastEffect=null,z.events=null,z.stores=null,z.memoCache!=null&&(z.memoCache.index=0)}q.H=oc,z=f(y,M)}while(Wp);return z}function Nh(){var u=q.H,f=u.useState()[0];return f=typeof f.then=="function"?Bm(f):f,u=u.useState()[0],(Oi!==null?Oi.memoizedState:null)!==u&&(gr.flags|=1024),f}function Ky(){var u=qv!==0;return qv=0,u}function Zy(u,f,y){f.updateQueue=u.updateQueue,f.flags&=-2053,u.lanes&=~y}function Qy(u){if(ac){for(u=u.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}ac=!1}ls=0,jr=Oi=gr=null,Wp=!1,Um=qv=0,$p=null}function ya(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jr===null?gr.memoizedState=jr=u:jr=jr.next=u,jr}function $s(){if(Oi===null){var u=gr.alternate;u=u!==null?u.memoizedState:null}else u=Oi.next;var f=jr===null?gr.memoizedState:jr.next;if(f!==null)jr=f,Oi=u;else{if(u===null)throw gr.alternate===null?Error(r(467)):Error(r(310));Oi=u,u={memoizedState:Oi.memoizedState,baseState:Oi.baseState,baseQueue:Oi.baseQueue,queue:Oi.queue,next:null},jr===null?gr.memoizedState=jr=u:jr=jr.next=u}return jr}function Yv(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bm(u){var f=Um;return Um+=1,$p===null&&($p=[]),u=Vv($p,u,f),f=gr,(jr===null?f.memoizedState:jr.next)===null&&(f=f.alternate,q.H=f===null||f.memoizedState===null?g3:mb),u}function ff(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return Bm(u);if(u.$$typeof===A)return nr(u)}throw Error(r(438,String(u)))}function Jy(u){var f=null,y=gr.updateQueue;if(y!==null&&(f=y.memoCache),f==null){var M=gr.alternate;M!==null&&(M=M.updateQueue,M!==null&&(M=M.memoCache,M!=null&&(f={data:M.data.map(function(I){return I.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),y===null&&(y=Yv(),gr.updateQueue=y),y.memoCache=f,y=f.data[f.index],y===void 0)for(y=f.data[f.index]=Array(u),M=0;M<u;M++)y[M]=W;return f.index++,y}function xd(u,f){return typeof f=="function"?f(u):f}function Kv(u){var f=$s();return eb(f,Oi,u)}function eb(u,f,y){var M=u.queue;if(M===null)throw Error(r(311));M.lastRenderedReducer=y;var I=u.baseQueue,z=M.pending;if(z!==null){if(I!==null){var ce=I.next;I.next=z.next,z.next=ce}f.baseQueue=I=z,M.pending=null}if(z=u.baseState,I===null)u.memoizedState=z;else{f=I.next;var Ne=ce=null,rt=null,Ct=f,Lt=!1;do{var Ut=Ct.lane&-536870913;if(Ut!==Ct.lane?(_r&Ut)===Ut:(ls&Ut)===Ut){var Nt=Ct.revertLane;if(Nt===0)rt!==null&&(rt=rt.next={lane:0,revertLane:0,gesture:null,action:Ct.action,hasEagerState:Ct.hasEagerState,eagerState:Ct.eagerState,next:null}),Ut===pd&&(Lt=!0);else if((ls&Nt)===Nt){Ct=Ct.next,Nt===pd&&(Lt=!0);continue}else Ut={lane:0,revertLane:Ct.revertLane,gesture:null,action:Ct.action,hasEagerState:Ct.hasEagerState,eagerState:Ct.eagerState,next:null},rt===null?(Ne=rt=Ut,ce=z):rt=rt.next=Ut,gr.lanes|=Nt,Au|=Nt;Ut=Ct.action,Ch&&y(z,Ut),z=Ct.hasEagerState?Ct.eagerState:y(z,Ut)}else Nt={lane:Ut,revertLane:Ct.revertLane,gesture:Ct.gesture,action:Ct.action,hasEagerState:Ct.hasEagerState,eagerState:Ct.eagerState,next:null},rt===null?(Ne=rt=Nt,ce=z):rt=rt.next=Nt,gr.lanes|=Ut,Au|=Ut;Ct=Ct.next}while(Ct!==null&&Ct!==f);if(rt===null?ce=z:rt.next=Ne,!tr(z,u.memoizedState)&&(la=!0,Lt&&(y=ic,y!==null)))throw y;u.memoizedState=z,u.baseState=ce,u.baseQueue=rt,M.lastRenderedState=z}return I===null&&(M.lanes=0),[u.memoizedState,M.dispatch]}function tb(u){var f=$s(),y=f.queue;if(y===null)throw Error(r(311));y.lastRenderedReducer=u;var M=y.dispatch,I=y.pending,z=f.memoizedState;if(I!==null){y.pending=null;var ce=I=I.next;do z=u(z,ce.action),ce=ce.next;while(ce!==I);tr(z,f.memoizedState)||(la=!0),f.memoizedState=z,f.baseQueue===null&&(f.baseState=z),y.lastRenderedState=z}return[z,M]}function Uw(u,f,y){var M=gr,I=$s(),z=$r;if(z){if(y===void 0)throw Error(r(407));y=y()}else y=f();var ce=!tr((Oi||I).memoizedState,y);if(ce&&(I.memoizedState=y,la=!0),I=I.queue,cb(Vw.bind(null,M,I,u),[u]),I.getSnapshot!==f||ce||jr!==null&&jr.memoizedState.tag&1){if(M.flags|=2048,hf(9,{destroy:void 0},Hw.bind(null,M,I,y,f),null),or===null)throw Error(r(349));z||(ls&127)!==0||Bw(M,f,y)}return y}function Bw(u,f,y){u.flags|=16384,u={getSnapshot:f,value:y},f=gr.updateQueue,f===null?(f=Yv(),gr.updateQueue=f,f.stores=[u]):(y=f.stores,y===null?f.stores=[u]:y.push(u))}function Hw(u,f,y,M){f.value=y,f.getSnapshot=M,Gw(f)&&Ww(u)}function Vw(u,f,y){return y(function(){Gw(f)&&Ww(u)})}function Gw(u){var f=u.getSnapshot;u=u.value;try{var y=f();return!tr(u,y)}catch{return!0}}function Ww(u){var f=Co(u,2);f!==null&&Mr(f,u,2)}function nb(u){var f=ya();if(typeof u=="function"){var y=u;if(u=y(),Ch){qe(!0);try{y()}finally{qe(!1)}}}return f.memoizedState=f.baseState=u,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xd,lastRenderedState:u},f}function rb(u,f,y,M){return u.baseState=y,eb(u,Oi,typeof M=="function"?M:xd)}function zE(u,f,y,M,I){if(ex(u))throw Error(r(485));if(u=f.action,u!==null){var z={payload:I,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(ce){z.listeners.push(ce)}};q.T!==null?y(!0):z.isTransition=!1,M(z),y=f.pending,y===null?(z.next=f.pending=z,$w(f,z)):(z.next=y.next,f.pending=y.next=z)}}function $w(u,f){var y=f.action,M=f.payload,I=u.state;if(f.isTransition){var z=q.T,ce={};q.T=ce;try{var Ne=y(I,M),rt=q.S;rt!==null&&rt(ce,Ne),qw(u,f,Ne)}catch(Ct){ib(u,f,Ct)}finally{z!==null&&ce.types!==null&&(z.types=ce.types),q.T=z}}else try{z=y(I,M),qw(u,f,z)}catch(Ct){ib(u,f,Ct)}}function qw(u,f,y){y!==null&&typeof y=="object"&&typeof y.then=="function"?y.then(function(M){Xw(u,f,M)},function(M){return ib(u,f,M)}):Xw(u,f,y)}function Xw(u,f,y){f.status="fulfilled",f.value=y,Yw(f),u.state=y,f=u.pending,f!==null&&(y=f.next,y===f?u.pending=null:(y=y.next,f.next=y,$w(u,y)))}function ib(u,f,y){var M=u.pending;if(u.pending=null,M!==null){M=M.next;do f.status="rejected",f.reason=y,Yw(f),f=f.next;while(f!==M)}u.action=null}function Yw(u){u=u.listeners;for(var f=0;f<u.length;f++)(0,u[f])()}function sb(u,f){return f}function ab(u,f){if($r){var y=or.formState;if(y!==null){e:{var M=gr;if($r){if(Wi){t:{for(var I=Wi,z=wl;I.nodeType!==8;){if(!z){I=null;break t}if(I=ku(I.nextSibling),I===null){I=null;break t}}z=I.data,I=z==="F!"||z==="F"?I:null}if(I){Wi=ku(I.nextSibling),M=I.data==="F!";break e}}gu(M)}M=!1}M&&(f=y[0])}}return y=ya(),y.memoizedState=y.baseState=f,M={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sb,lastRenderedState:f},y.queue=M,y=h3.bind(null,gr,M),M.dispatch=y,M=nb(!1),z=pb.bind(null,gr,!1,M.queue),M=ya(),I={state:f,dispatch:null,action:u,pending:null},M.queue=I,y=zE.bind(null,gr,I,z,y),I.dispatch=y,M.memoizedState=u,[f,y,!1]}function Kw(u){var f=$s();return ob(f,Oi,u)}function ob(u,f,y){if(f=eb(u,f,sb)[0],u=Kv(xd)[0],typeof f=="object"&&f!==null&&typeof f.then=="function")try{var M=Bm(f)}catch(ce){throw ce===_h?Sr:ce}else M=f;f=$s();var I=f.queue,z=I.dispatch;return y!==f.memoizedState&&(gr.flags|=2048,hf(9,{destroy:void 0},Zw.bind(null,I,y),null)),[M,z,u]}function Zw(u,f){u.action=f}function lb(u){var f=$s(),y=Oi;if(y!==null)return ob(f,y,u);$s(),f=f.memoizedState,y=$s();var M=y.queue.dispatch;return y.memoizedState=u,[f,M,!1]}function hf(u,f,y,M){return u={tag:u,create:y,deps:M,inst:f,next:null},f=gr.updateQueue,f===null&&(f=Yv(),gr.updateQueue=f),y=f.lastEffect,y===null?f.lastEffect=u.next=u:(M=y.next,y.next=u,u.next=M,f.lastEffect=u),u}function Zv(){return $s().memoizedState}function Qv(u,f,y,M){var I=ya();gr.flags|=u,I.memoizedState=hf(1|f,{destroy:void 0},y,M===void 0?null:M)}function Jv(u,f,y,M){var I=$s();M=M===void 0?null:M;var z=I.memoizedState.inst;Oi!==null&&M!==null&&Yy(M,Oi.memoizedState.deps)?I.memoizedState=hf(f,z,y,M):(gr.flags|=u,I.memoizedState=hf(1|f,z,y,M))}function Qw(u,f){Qv(8390656,8,u,f)}function cb(u,f){Jv(2048,8,u,f)}function Jw(u){gr.flags|=4;var f=gr.updateQueue;if(f===null)f=Yv(),gr.updateQueue=f,f.events=[u];else{var y=f.events;y===null?f.events=[u]:y.push(u)}}function e3(u){var f=$s().memoizedState;return Jw({ref:f,nextImpl:u}),function(){if((Bn&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}function t3(u,f){return Jv(4,2,u,f)}function n3(u,f){return Jv(4,4,u,f)}function r3(u,f){if(typeof f=="function"){u=u();var y=f(u);return function(){typeof y=="function"?y():f(null)}}if(f!=null)return u=u(),f.current=u,function(){f.current=null}}function i3(u,f,y){y=y!=null?y.concat([u]):null,Jv(4,4,r3.bind(null,f,u),y)}function ub(){}function s3(u,f){var y=$s();f=f===void 0?null:f;var M=y.memoizedState;return f!==null&&Yy(f,M[1])?M[0]:(y.memoizedState=[u,f],u)}function a3(u,f){var y=$s();f=f===void 0?null:f;var M=y.memoizedState;if(f!==null&&Yy(f,M[1]))return M[0];if(M=u(),Ch){qe(!0);try{u()}finally{qe(!1)}}return y.memoizedState=[M,f],M}function db(u,f,y){return y===void 0||(ls&1073741824)!==0&&(_r&261930)===0?u.memoizedState=f:(u.memoizedState=y,u=Ir(),gr.lanes|=u,Au|=u,y)}function o3(u,f,y,M){return tr(y,f)?y:Gp.current!==null?(u=db(u,y,M),tr(u,f)||(la=!0),u):(ls&42)===0||(ls&1073741824)!==0&&(_r&261930)===0?(la=!0,u.memoizedState=y):(u=Ir(),gr.lanes|=u,Au|=u,f)}function l3(u,f,y,M,I){var z=K.p;K.p=z!==0&&8>z?z:8;var ce=q.T,Ne={};q.T=Ne,pb(u,!1,f,y);try{var rt=I(),Ct=q.S;if(Ct!==null&&Ct(Ne,rt),rt!==null&&typeof rt=="object"&&typeof rt.then=="function"){var Lt=Hy(rt,M);Hm(u,f,Lt,Rl(u))}else Hm(u,f,M,Rl(u))}catch(Ut){Hm(u,f,{then:function(){},status:"rejected",reason:Ut},Rl())}finally{K.p=z,ce!==null&&Ne.types!==null&&(ce.types=Ne.types),q.T=ce}}function jE(){}function fb(u,f,y,M){if(u.tag!==5)throw Error(r(476));var I=c3(u).queue;l3(u,I,f,Y,y===null?jE:function(){return u3(u),y(M)})}function c3(u){var f=u.memoizedState;if(f!==null)return f;f={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xd,lastRenderedState:Y},next:null};var y={};return f.next={memoizedState:y,baseState:y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xd,lastRenderedState:y},next:null},u.memoizedState=f,u=u.alternate,u!==null&&(u.memoizedState=f),f}function u3(u){var f=c3(u);f.next===null&&(f=u.alternate.memoizedState),Hm(u,f.next.queue,{},Rl())}function hb(){return nr(Ob)}function d3(){return $s().memoizedState}function f3(){return $s().memoizedState}function FE(u){for(var f=u.return;f!==null;){switch(f.tag){case 24:case 3:var y=Rl();u=gd(y);var M=uf(f,u,y);M!==null&&(Mr(M,f,y),df(M,f,y)),f={cache:Fy()},u.payload=f;return}f=f.return}}function UE(u,f,y){var M=Rl();y={lane:M,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},ex(u)?p3(f,y):(y=kv(u,f,y,M),y!==null&&(Mr(y,u,M),m3(y,f,M)))}function h3(u,f,y){var M=Rl();Hm(u,f,y,M)}function Hm(u,f,y,M){var I={lane:M,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null};if(ex(u))p3(f,I);else{var z=u.alternate;if(u.lanes===0&&(z===null||z.lanes===0)&&(z=f.lastRenderedReducer,z!==null))try{var ce=f.lastRenderedState,Ne=z(ce,y);if(I.hasEagerState=!0,I.eagerState=Ne,tr(Ne,ce))return Ia(u,f,I,0),or===null&&km(),!1}catch{}finally{}if(y=kv(u,f,I,M),y!==null)return Mr(y,u,M),m3(y,f,M),!0}return!1}function pb(u,f,y,M){if(M={lane:2,revertLane:kt(),gesture:null,action:M,hasEagerState:!1,eagerState:null,next:null},ex(u)){if(f)throw Error(r(479))}else f=kv(u,y,M,2),f!==null&&Mr(f,u,2)}function ex(u){var f=u.alternate;return u===gr||f!==null&&f===gr}function p3(u,f){Wp=ac=!0;var y=u.pending;y===null?f.next=f:(f.next=y.next,y.next=f),u.pending=f}function m3(u,f,y){if((y&4194048)!==0){var M=f.lanes;M&=u.pendingLanes,y|=M,f.lanes=y,wt(u,y)}}var qp={readContext:nr,use:ff,useCallback:ws,useContext:ws,useEffect:ws,useImperativeHandle:ws,useLayoutEffect:ws,useInsertionEffect:ws,useMemo:ws,useReducer:ws,useRef:ws,useState:ws,useDebugValue:ws,useDeferredValue:ws,useTransition:ws,useSyncExternalStore:ws,useId:ws,useHostTransitionStatus:ws,useFormState:ws,useActionState:ws,useOptimistic:ws,useMemoCache:ws,useCacheRefresh:ws};qp.useEffectEvent=ws;var g3={readContext:nr,use:ff,useCallback:function(u,f){return ya().memoizedState=[u,f===void 0?null:f],u},useContext:nr,useEffect:Qw,useImperativeHandle:function(u,f,y){y=y!=null?y.concat([u]):null,Qv(4194308,4,r3.bind(null,f,u),y)},useLayoutEffect:function(u,f){return Qv(4194308,4,u,f)},useInsertionEffect:function(u,f){Qv(4,2,u,f)},useMemo:function(u,f){var y=ya();f=f===void 0?null:f;var M=u();if(Ch){qe(!0);try{u()}finally{qe(!1)}}return y.memoizedState=[M,f],M},useReducer:function(u,f,y){var M=ya();if(y!==void 0){var I=y(f);if(Ch){qe(!0);try{y(f)}finally{qe(!1)}}}else I=f;return M.memoizedState=M.baseState=I,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:I},M.queue=u,u=u.dispatch=UE.bind(null,gr,u),[M.memoizedState,u]},useRef:function(u){var f=ya();return u={current:u},f.memoizedState=u},useState:function(u){u=nb(u);var f=u.queue,y=h3.bind(null,gr,f);return f.dispatch=y,[u.memoizedState,y]},useDebugValue:ub,useDeferredValue:function(u,f){var y=ya();return db(y,u,f)},useTransition:function(){var u=nb(!1);return u=l3.bind(null,gr,u.queue,!0,!1),ya().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,f,y){var M=gr,I=ya();if($r){if(y===void 0)throw Error(r(407));y=y()}else{if(y=f(),or===null)throw Error(r(349));(_r&127)!==0||Bw(M,f,y)}I.memoizedState=y;var z={value:y,getSnapshot:f};return I.queue=z,Qw(Vw.bind(null,M,z,u),[u]),M.flags|=2048,hf(9,{destroy:void 0},Hw.bind(null,M,z,y,f),null),y},useId:function(){var u=ya(),f=or.identifierPrefix;if($r){var y=Lc,M=Ss;y=(M&~(1<<32-Se(M)-1)).toString(32)+y,f="_"+f+"R_"+y,y=qv++,0<y&&(f+="H"+y.toString(32)),f+="_"}else y=Xy++,f="_"+f+"r_"+y.toString(32)+"_";return u.memoizedState=f},useHostTransitionStatus:hb,useFormState:ab,useActionState:ab,useOptimistic:function(u){var f=ya();f.memoizedState=f.baseState=u;var y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=y,f=pb.bind(null,gr,!0,y),y.dispatch=f,[u,f]},useMemoCache:Jy,useCacheRefresh:function(){return ya().memoizedState=FE.bind(null,gr)},useEffectEvent:function(u){var f=ya(),y={impl:u};return f.memoizedState=y,function(){if((Bn&2)!==0)throw Error(r(440));return y.impl.apply(void 0,arguments)}}},mb={readContext:nr,use:ff,useCallback:s3,useContext:nr,useEffect:cb,useImperativeHandle:i3,useInsertionEffect:t3,useLayoutEffect:n3,useMemo:a3,useReducer:Kv,useRef:Zv,useState:function(){return Kv(xd)},useDebugValue:ub,useDeferredValue:function(u,f){var y=$s();return o3(y,Oi.memoizedState,u,f)},useTransition:function(){var u=Kv(xd)[0],f=$s().memoizedState;return[typeof u=="boolean"?u:Bm(u),f]},useSyncExternalStore:Uw,useId:d3,useHostTransitionStatus:hb,useFormState:Kw,useActionState:Kw,useOptimistic:function(u,f){var y=$s();return rb(y,Oi,u,f)},useMemoCache:Jy,useCacheRefresh:f3};mb.useEffectEvent=e3;var oc={readContext:nr,use:ff,useCallback:s3,useContext:nr,useEffect:cb,useImperativeHandle:i3,useInsertionEffect:t3,useLayoutEffect:n3,useMemo:a3,useReducer:tb,useRef:Zv,useState:function(){return tb(xd)},useDebugValue:ub,useDeferredValue:function(u,f){var y=$s();return Oi===null?db(y,u,f):o3(y,Oi.memoizedState,u,f)},useTransition:function(){var u=tb(xd)[0],f=$s().memoizedState;return[typeof u=="boolean"?u:Bm(u),f]},useSyncExternalStore:Uw,useId:d3,useHostTransitionStatus:hb,useFormState:lb,useActionState:lb,useOptimistic:function(u,f){var y=$s();return Oi!==null?rb(y,Oi,u,f):(y.baseState=u,[u,y.queue.dispatch])},useMemoCache:Jy,useCacheRefresh:f3};oc.useEffectEvent=e3;function tx(u,f,y,M){f=u.memoizedState,y=y(M,f),y=y==null?f:h({},f,y),u.memoizedState=y,u.lanes===0&&(u.updateQueue.baseState=y)}var Vm={enqueueSetState:function(u,f,y){u=u._reactInternals;var M=Rl(),I=gd(M);I.payload=f,y!=null&&(I.callback=y),f=uf(u,I,M),f!==null&&(Mr(f,u,M),df(f,u,M))},enqueueReplaceState:function(u,f,y){u=u._reactInternals;var M=Rl(),I=gd(M);I.tag=1,I.payload=f,y!=null&&(I.callback=y),f=uf(u,I,M),f!==null&&(Mr(f,u,M),df(f,u,M))},enqueueForceUpdate:function(u,f){u=u._reactInternals;var y=Rl(),M=gd(y);M.tag=2,f!=null&&(M.callback=f),f=uf(u,M,y),f!==null&&(Mr(f,u,y),df(f,u,y))}};function gb(u,f,y,M,I,z,ce){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(M,z,ce):f.prototype&&f.prototype.isPureReactComponent?!ur(y,M)||!ur(I,z):!0}function vb(u,f,y,M){u=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(y,M),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(y,M),f.state!==u&&Vm.enqueueReplaceState(f,f.state,null)}function pf(u,f){var y=f;if("ref"in f){y={};for(var M in f)M!=="ref"&&(y[M]=f[M])}if(u=u.defaultProps){y===f&&(y=h({},y));for(var I in u)y[I]===void 0&&(y[I]=u[I])}return y}function v3(u){Rm(u)}function xb(u){console.error(u)}function yb(u){Rm(u)}function nx(u,f){try{var y=u.onUncaughtError;y(f.value,{componentStack:f.stack})}catch(M){setTimeout(function(){throw M})}}function x3(u,f,y){try{var M=u.onCaughtError;M(y.value,{componentStack:y.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(I){setTimeout(function(){throw I})}}function bb(u,f,y){return y=gd(y),y.tag=3,y.payload={element:null},y.callback=function(){nx(u,f)},y}function _b(u){return u=gd(u),u.tag=3,u}function y3(u,f,y,M){var I=y.type.getDerivedStateFromError;if(typeof I=="function"){var z=M.value;u.payload=function(){return I(z)},u.callback=function(){x3(f,y,M)}}var ce=y.stateNode;ce!==null&&typeof ce.componentDidCatch=="function"&&(u.callback=function(){x3(f,y,M),typeof I!="function"&&(Ys===null?Ys=new Set([this]):Ys.add(this));var Ne=M.stack;this.componentDidCatch(M.value,{componentStack:Ne!==null?Ne:""})})}function ba(u,f,y,M,I){if(y.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){if(f=y.alternate,f!==null&&bu(f,y,I,!0),y=Ko.current,y!==null){switch(y.tag){case 31:case 13:return No===null?e0():y.alternate===null&&Ms===0&&(Ms=3),y.flags&=-257,y.flags|=65536,y.lanes=I,M===Hv?y.flags|=16384:(f=y.updateQueue,f===null?y.updateQueue=new Set([M]):f.add(M),tg(u,M,I)),!1;case 22:return y.flags|=65536,M===Hv?y.flags|=16384:(f=y.updateQueue,f===null?(f={transitions:null,markerInstances:null,retryQueue:new Set([M])},y.updateQueue=f):(y=f.retryQueue,y===null?f.retryQueue=new Set([M]):y.add(M)),tg(u,M,I)),!1}throw Error(r(435,y.tag))}return tg(u,M,I),e0(),!1}if($r)return f=Ko.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=I,M!==zp&&(u=Error(r(422),{cause:M}),vu(Sl(u,y)))):(M!==zp&&(f=Error(r(423),{cause:M}),vu(Sl(f,y))),u=u.current.alternate,u.flags|=65536,I&=-I,u.lanes|=I,M=Sl(M,y),I=bb(u.stateNode,M,I),Gn(u,I),Ms!==4&&(Ms=2)),!1;var z=Error(r(520),{cause:M});if(z=Sl(z,y),zh===null?zh=[z]:zh.push(z),Ms!==4&&(Ms=2),f===null)return!0;M=Sl(M,y),y=f;do{switch(y.tag){case 3:return y.flags|=65536,u=I&-I,y.lanes|=u,u=bb(y.stateNode,M,u),Gn(y,u),!1;case 1:if(f=y.type,z=y.stateNode,(y.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||z!==null&&typeof z.componentDidCatch=="function"&&(Ys===null||!Ys.has(z))))return y.flags|=65536,I&=-I,y.lanes|=I,I=_b(I),y3(I,u,y,M),Gn(y,I),!1}y=y.return}while(y!==null);return!1}var rx=Error(r(461)),la=!1;function Da(u,f,y,M){f.child=u===null?Wv(f,null,y,M):md(f,u.child,y,M)}function Sb(u,f,y,M,I){y=y.render;var z=f.ref;if("ref"in M){var ce={};for(var Ne in M)Ne!=="ref"&&(ce[Ne]=M[Ne])}else ce=M;return lf(f),M=Xv(u,f,y,ce,z,I),Ne=Ky(),u!==null&&!la?(Zy(u,f,I),qs(u,f,I)):($r&&Ne&&mu(f),f.flags|=1,Da(u,f,M,I),f.child)}function Rh(u,f,y,M,I){if(u===null){var z=y.type;return typeof z=="function"&&!Pv(z)&&z.defaultProps===void 0&&y.compare===null?(f.tag=15,f.type=z,ix(u,f,z,M,I)):(u=hu(y.type,null,M,f,f.mode,I),u.ref=f.ref,u.return=f,f.child=u)}if(z=u.child,!ux(u,I)){var ce=z.memoizedProps;if(y=y.compare,y=y!==null?y:ur,y(ce,M)&&u.ref===f.ref)return qs(u,f,I)}return f.flags|=1,u=qo(z,M),u.ref=f.ref,u.return=f,f.child=u}function ix(u,f,y,M,I){if(u!==null){var z=u.memoizedProps;if(ur(z,M)&&u.ref===f.ref)if(la=!1,f.pendingProps=M=z,ux(u,I))(u.flags&131072)!==0&&(la=!0);else return f.lanes=u.lanes,qs(u,f,I)}return Xp(u,f,y,M,I)}function kh(u,f,y,M){var I=M.children,z=u!==null?u.memoizedState:null;if(u===null&&f.stateNode===null&&(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),M.mode==="hidden"){if((f.flags&128)!==0){if(z=z!==null?z.baseLanes|y:y,u!==null){for(M=f.child=u.child,I=0;M!==null;)I=I|M.lanes|M.childLanes,M=M.sibling;M=I&~z}else M=0,f.child=null;return Qo(u,f,z,y,M)}if((y&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},u!==null&&Dm(f,z!==null?z.cachePool:null),z!==null?zw(f,z):$y(),jw(f);else return M=f.lanes=536870912,Qo(u,f,z!==null?z.baseLanes|y:y,y,M)}else z!==null?(Dm(f,z.cachePool),zw(f,z),Zo(),f.memoizedState=null):(u!==null&&Dm(f,null),$y(),Zo());return Da(u,f,I,y),f.child}function Su(u,f){return u!==null&&u.tag===22||f.stateNode!==null||(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.sibling}function Qo(u,f,y,M,I){var z=Bv();return z=z===null?null:{parent:oa._currentValue,pool:z},f.memoizedState={baseLanes:y,cachePool:z},u!==null&&Dm(f,null),$y(),jw(f),u!==null&&bu(u,f,M,!0),f.childLanes=I,null}function sx(u,f){return f=cx({mode:f.mode,children:f.children},u.mode),f.ref=u.ref,u.child=f,f.return=u,f}function b3(u,f,y){return md(f,u.child,null,y),u=sx(f,f.pendingProps),u.flags|=2,Ws(f),f.memoizedState=null,u}function ax(u,f,y){var M=f.pendingProps,I=(f.flags&128)!==0;if(f.flags&=-129,u===null){if($r){if(M.mode==="hidden")return u=sx(f,M),f.lanes=536870912,Su(null,u);if(qy(f),(u=Wi)?(u=rP(u,wl),u=u!==null&&u.data==="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:dd!==null?{id:Ss,overflow:Lc}:null,retryLane:536870912,hydrationErrors:null},y=Dp(u),y.return=f,f.child=y,Ls=f,Wi=null)):u=null,u===null)throw gu(f);return f.lanes=536870912,null}return sx(f,M)}var z=u.memoizedState;if(z!==null){var ce=z.dehydrated;if(qy(f),I)if(f.flags&256)f.flags&=-257,f=b3(u,f,y);else if(f.memoizedState!==null)f.child=u.child,f.flags|=128,f=null;else throw Error(r(558));else if(la||bu(u,f,y,!1),I=(y&u.childLanes)!==0,la||I){if(M=or,M!==null&&(ce=Pt(M,y),ce!==0&&ce!==z.retryLane))throw z.retryLane=ce,Co(u,ce),Mr(M,u,ce),rx;e0(),f=b3(u,f,y)}else u=z.treeContext,Wi=ku(ce.nextSibling),Ls=f,$r=!0,fd=null,wl=!1,u!==null&&Lv(f,u),f=sx(f,M),f.flags|=4096;return f}return u=qo(u.child,{mode:M.mode,children:M.children}),u.ref=f.ref,f.child=u,u.return=f,u}function Ph(u,f){var y=f.ref;if(y===null)u!==null&&u.ref!==null&&(f.flags|=4194816);else{if(typeof y!="function"&&typeof y!="object")throw Error(r(284));(u===null||u.ref!==y)&&(f.flags|=4194816)}}function Xp(u,f,y,M,I){return lf(f),y=Xv(u,f,y,M,void 0,I),M=Ky(),u!==null&&!la?(Zy(u,f,I),qs(u,f,I)):($r&&M&&mu(f),f.flags|=1,Da(u,f,y,I),f.child)}function Gm(u,f,y,M,I,z){return lf(f),f.updateQueue=null,y=Ah(f,M,y,I),Fw(u),M=Ky(),u!==null&&!la?(Zy(u,f,z),qs(u,f,z)):($r&&M&&mu(f),f.flags|=1,Da(u,f,y,z),f.child)}function ox(u,f,y,M,I){if(lf(f),f.stateNode===null){var z=tf,ce=y.contextType;typeof ce=="object"&&ce!==null&&(z=nr(ce)),z=new y(M,z),f.memoizedState=z.state!==null&&z.state!==void 0?z.state:null,z.updater=Vm,f.stateNode=z,z._reactInternals=f,z=f.stateNode,z.props=M,z.state=f.memoizedState,z.refs={},zm(f),ce=y.contextType,z.context=typeof ce=="object"&&ce!==null?nr(ce):tf,z.state=f.memoizedState,ce=y.getDerivedStateFromProps,typeof ce=="function"&&(tx(f,y,ce,M),z.state=f.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof z.getSnapshotBeforeUpdate=="function"||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(ce=z.state,typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount(),ce!==z.state&&Vm.enqueueReplaceState(z,z.state,null),Hp(f,M,z,I),jm(),z.state=f.memoizedState),typeof z.componentDidMount=="function"&&(f.flags|=4194308),M=!0}else if(u===null){z=f.stateNode;var Ne=f.memoizedProps,rt=pf(y,Ne);z.props=rt;var Ct=z.context,Lt=y.contextType;ce=tf,typeof Lt=="object"&&Lt!==null&&(ce=nr(Lt));var Ut=y.getDerivedStateFromProps;Lt=typeof Ut=="function"||typeof z.getSnapshotBeforeUpdate=="function",Ne=f.pendingProps!==Ne,Lt||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(Ne||Ct!==ce)&&vb(f,z,M,ce),Ao=!1;var Nt=f.memoizedState;z.state=Nt,Hp(f,M,z,I),jm(),Ct=f.memoizedState,Ne||Nt!==Ct||Ao?(typeof Ut=="function"&&(tx(f,y,Ut,M),Ct=f.memoizedState),(rt=Ao||gb(f,y,rt,M,Nt,Ct,ce))?(Lt||typeof z.UNSAFE_componentWillMount!="function"&&typeof z.componentWillMount!="function"||(typeof z.componentWillMount=="function"&&z.componentWillMount(),typeof z.UNSAFE_componentWillMount=="function"&&z.UNSAFE_componentWillMount()),typeof z.componentDidMount=="function"&&(f.flags|=4194308)):(typeof z.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=M,f.memoizedState=Ct),z.props=M,z.state=Ct,z.context=ce,M=rt):(typeof z.componentDidMount=="function"&&(f.flags|=4194308),M=!1)}else{z=f.stateNode,Gy(u,f),ce=f.memoizedProps,Lt=pf(y,ce),z.props=Lt,Ut=f.pendingProps,Nt=z.context,Ct=y.contextType,rt=tf,typeof Ct=="object"&&Ct!==null&&(rt=nr(Ct)),Ne=y.getDerivedStateFromProps,(Ct=typeof Ne=="function"||typeof z.getSnapshotBeforeUpdate=="function")||typeof z.UNSAFE_componentWillReceiveProps!="function"&&typeof z.componentWillReceiveProps!="function"||(ce!==Ut||Nt!==rt)&&vb(f,z,M,rt),Ao=!1,Nt=f.memoizedState,z.state=Nt,Hp(f,M,z,I),jm();var Dt=f.memoizedState;ce!==Ut||Nt!==Dt||Ao||u!==null&&u.dependencies!==null&&Im(u.dependencies)?(typeof Ne=="function"&&(tx(f,y,Ne,M),Dt=f.memoizedState),(Lt=Ao||gb(f,y,Lt,M,Nt,Dt,rt)||u!==null&&u.dependencies!==null&&Im(u.dependencies))?(Ct||typeof z.UNSAFE_componentWillUpdate!="function"&&typeof z.componentWillUpdate!="function"||(typeof z.componentWillUpdate=="function"&&z.componentWillUpdate(M,Dt,rt),typeof z.UNSAFE_componentWillUpdate=="function"&&z.UNSAFE_componentWillUpdate(M,Dt,rt)),typeof z.componentDidUpdate=="function"&&(f.flags|=4),typeof z.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof z.componentDidUpdate!="function"||ce===u.memoizedProps&&Nt===u.memoizedState||(f.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||ce===u.memoizedProps&&Nt===u.memoizedState||(f.flags|=1024),f.memoizedProps=M,f.memoizedState=Dt),z.props=M,z.state=Dt,z.context=rt,M=Lt):(typeof z.componentDidUpdate!="function"||ce===u.memoizedProps&&Nt===u.memoizedState||(f.flags|=4),typeof z.getSnapshotBeforeUpdate!="function"||ce===u.memoizedProps&&Nt===u.memoizedState||(f.flags|=1024),M=!1)}return z=M,Ph(u,f),M=(f.flags&128)!==0,z||M?(z=f.stateNode,y=M&&typeof y.getDerivedStateFromError!="function"?null:z.render(),f.flags|=1,u!==null&&M?(f.child=md(f,u.child,null,I),f.child=md(f,null,y,I)):Da(u,f,y,I),f.memoizedState=z.state,u=f.child):u=qs(u,f,I),u}function _3(u,f,y,M){return af(),f.flags|=256,Da(u,f,y,M),f.child}var wb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ho(u){return{baseLanes:u,cachePool:Vy()}}function lx(u,f,y){return u=u!==null?u.childLanes&~y:0,f&&(u|=Po),u}function S3(u,f,y){var M=f.pendingProps,I=!1,z=(f.flags&128)!==0,ce;if((ce=z)||(ce=u!==null&&u.memoizedState===null?!1:(qr.current&2)!==0),ce&&(I=!0,f.flags&=-129),ce=(f.flags&32)!==0,f.flags&=-33,u===null){if($r){if(I?vd(f):Zo(),(u=Wi)?(u=rP(u,wl),u=u!==null&&u.data!=="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:dd!==null?{id:Ss,overflow:Lc}:null,retryLane:536870912,hydrationErrors:null},y=Dp(u),y.return=f,f.child=y,Ls=f,Wi=null)):u=null,u===null)throw gu(f);return eC(u)?f.lanes=32:f.lanes=536870912,null}var Ne=M.children;return M=M.fallback,I?(Zo(),I=f.mode,Ne=cx({mode:"hidden",children:Ne},I),M=nf(M,I,y,null),Ne.return=f,M.return=f,Ne.sibling=M,f.child=Ne,M=f.child,M.memoizedState=ho(y),M.childLanes=lx(u,ce,y),f.memoizedState=wb,Su(null,M)):(vd(f),Wm(f,Ne))}var rt=u.memoizedState;if(rt!==null&&(Ne=rt.dehydrated,Ne!==null)){if(z)f.flags&256?(vd(f),f.flags&=-257,f=Mb(u,f,y)):f.memoizedState!==null?(Zo(),f.child=u.child,f.flags|=128,f=null):(Zo(),Ne=M.fallback,I=f.mode,M=cx({mode:"visible",children:M.children},I),Ne=nf(Ne,I,y,null),Ne.flags|=2,M.return=f,Ne.return=f,M.sibling=Ne,f.child=M,md(f,u.child,null,y),M=f.child,M.memoizedState=ho(y),M.childLanes=lx(u,ce,y),f.memoizedState=wb,f=Su(null,M));else if(vd(f),eC(Ne)){if(ce=Ne.nextSibling&&Ne.nextSibling.dataset,ce)var Ct=ce.dgst;ce=Ct,M=Error(r(419)),M.stack="",M.digest=ce,vu({value:M,source:null,stack:null}),f=Mb(u,f,y)}else if(la||bu(u,f,y,!1),ce=(y&u.childLanes)!==0,la||ce){if(ce=or,ce!==null&&(M=Pt(ce,y),M!==0&&M!==rt.retryLane))throw rt.retryLane=M,Co(u,M),Mr(ce,u,M),rx;JE(Ne)||e0(),f=Mb(u,f,y)}else JE(Ne)?(f.flags|=192,f.child=u.child,f=null):(u=rt.treeContext,Wi=ku(Ne.nextSibling),Ls=f,$r=!0,fd=null,wl=!1,u!==null&&Lv(f,u),f=Wm(f,M.children),f.flags|=4096);return f}return I?(Zo(),Ne=M.fallback,I=f.mode,rt=u.child,Ct=rt.sibling,M=qo(rt,{mode:"hidden",children:M.children}),M.subtreeFlags=rt.subtreeFlags&65011712,Ct!==null?Ne=qo(Ct,Ne):(Ne=nf(Ne,I,y,null),Ne.flags|=2),Ne.return=f,M.return=f,M.sibling=Ne,f.child=M,Su(null,M),M=f.child,Ne=u.child.memoizedState,Ne===null?Ne=ho(y):(I=Ne.cachePool,I!==null?(rt=oa._currentValue,I=I.parent!==rt?{parent:rt,pool:rt}:I):I=Vy(),Ne={baseLanes:Ne.baseLanes|y,cachePool:I}),M.memoizedState=Ne,M.childLanes=lx(u,ce,y),f.memoizedState=wb,Su(u.child,M)):(vd(f),y=u.child,u=y.sibling,y=qo(y,{mode:"visible",children:M.children}),y.return=f,y.sibling=null,u!==null&&(ce=f.deletions,ce===null?(f.deletions=[u],f.flags|=16):ce.push(u)),f.child=y,f.memoizedState=null,y)}function Wm(u,f){return f=cx({mode:"visible",children:f},u.mode),f.return=u,u.child=f}function cx(u,f){return u=_s(22,u,null,f),u.lanes=0,u}function Mb(u,f,y){return md(f,u.child,null,y),u=Wm(f,f.pendingProps.children),u.flags|=2,f.memoizedState=null,u}function w3(u,f,y){u.lanes|=f;var M=u.alternate;M!==null&&(M.lanes|=f),jv(u.return,f,y)}function Ih(u,f,y,M,I,z){var ce=u.memoizedState;ce===null?u.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:M,tail:y,tailMode:I,treeForkCount:z}:(ce.isBackwards=f,ce.rendering=null,ce.renderingStartTime=0,ce.last=M,ce.tail=y,ce.tailMode=I,ce.treeForkCount=z)}function Jo(u,f,y){var M=f.pendingProps,I=M.revealOrder,z=M.tail;M=M.children;var ce=qr.current,Ne=(ce&2)!==0;if(Ne?(ce=ce&1|2,f.flags|=128):ce&=1,H(qr,ce),Da(u,f,M,y),M=$r?Lp:0,!Ne&&u!==null&&(u.flags&128)!==0)e:for(u=f.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&w3(u,y,f);else if(u.tag===19)w3(u,y,f);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===f)break e;for(;u.sibling===null;){if(u.return===null||u.return===f)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}switch(I){case"forwards":for(y=f.child,I=null;y!==null;)u=y.alternate,u!==null&&Tl(u)===null&&(I=y),y=y.sibling;y=I,y===null?(I=f.child,f.child=null):(I=y.sibling,y.sibling=null),Ih(f,!1,I,y,z,M);break;case"backwards":case"unstable_legacy-backwards":for(y=null,I=f.child,f.child=null;I!==null;){if(u=I.alternate,u!==null&&Tl(u)===null){f.child=I;break}u=I.sibling,I.sibling=y,y=I,I=u}Ih(f,!0,y,null,z,M);break;case"together":Ih(f,!1,null,null,void 0,M);break;default:f.memoizedState=null}return f.child}function qs(u,f,y){if(u!==null&&(f.dependencies=u.dependencies),Au|=f.lanes,(y&f.childLanes)===0)if(u!==null){if(bu(u,f,y,!1),(y&f.childLanes)===0)return null}else return null;if(u!==null&&f.child!==u.child)throw Error(r(153));if(f.child!==null){for(u=f.child,y=qo(u,u.pendingProps),f.child=y,y.return=f;u.sibling!==null;)u=u.sibling,y=y.sibling=qo(u,u.pendingProps),y.return=f;y.sibling=null}return f.child}function ux(u,f){return(u.lanes&f)!==0?!0:(u=u.dependencies,!!(u!==null&&Im(u)))}function BE(u,f,y){switch(f.tag){case 3:le(f,f.stateNode.containerInfo),hd(f,oa,u.memoizedState.cache),af();break;case 27:case 5:we(f);break;case 4:le(f,f.stateNode.containerInfo);break;case 10:hd(f,f.type,f.memoizedProps.value);break;case 31:if(f.memoizedState!==null)return f.flags|=128,qy(f),null;break;case 13:var M=f.memoizedState;if(M!==null)return M.dehydrated!==null?(vd(f),f.flags|=128,null):(y&f.child.childLanes)!==0?S3(u,f,y):(vd(f),u=qs(u,f,y),u!==null?u.sibling:null);vd(f);break;case 19:var I=(u.flags&128)!==0;if(M=(y&f.childLanes)!==0,M||(bu(u,f,y,!1),M=(y&f.childLanes)!==0),I){if(M)return Jo(u,f,y);f.flags|=128}if(I=f.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),H(qr,qr.current),M)break;return null;case 22:return f.lanes=0,kh(u,f,y,f.pendingProps);case 24:hd(f,oa,u.memoizedState.cache)}return qs(u,f,y)}function dx(u,f,y){if(u!==null)if(u.memoizedProps!==f.pendingProps)la=!0;else{if(!ux(u,y)&&(f.flags&128)===0)return la=!1,BE(u,f,y);la=(u.flags&131072)!==0}else la=!1,$r&&(f.flags&1048576)!==0&&Rw(f,Lp,f.index);switch(f.lanes=0,f.tag){case 16:e:{var M=f.pendingProps;if(u=Sh(f.elementType),f.type=u,typeof u=="function")Pv(u)?(M=pf(u,M),f.tag=1,f=ox(null,f,u,M,y)):(f.tag=0,f=Xp(null,f,u,M,y));else{if(u!=null){var I=u.$$typeof;if(I===N){f.tag=11,f=Sb(null,f,u,M,y);break e}else if(I===L){f.tag=14,f=Rh(null,f,u,M,y);break e}}throw f=Z(u)||u,Error(r(306,f,""))}}return f;case 0:return Xp(u,f,f.type,f.pendingProps,y);case 1:return M=f.type,I=pf(M,f.pendingProps),ox(u,f,M,I,y);case 3:e:{if(le(f,f.stateNode.containerInfo),u===null)throw Error(r(387));M=f.pendingProps;var z=f.memoizedState;I=z.element,Gy(u,f),Hp(f,M,null,y);var ce=f.memoizedState;if(M=ce.cache,hd(f,oa,M),M!==z.cache&&Fv(f,[oa],y,!0),jm(),M=ce.element,z.isDehydrated)if(z={element:M,isDehydrated:!1,cache:ce.cache},f.updateQueue.baseState=z,f.memoizedState=z,f.flags&256){f=_3(u,f,M,y);break e}else if(M!==I){I=Sl(Error(r(424)),f),vu(I),f=_3(u,f,M,y);break e}else{switch(u=f.stateNode.containerInfo,u.nodeType){case 9:u=u.body;break;default:u=u.nodeName==="HTML"?u.ownerDocument.body:u}for(Wi=ku(u.firstChild),Ls=f,$r=!0,fd=null,wl=!0,y=Wv(f,null,M,y),f.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling}else{if(af(),M===I){f=qs(u,f,y);break e}Da(u,f,M,y)}f=f.child}return f;case 26:return Ph(u,f),u===null?(y=cP(f.type,null,f.pendingProps,null))?f.memoizedState=y:$r||(y=f.type,u=f.pendingProps,M=C3(re.current).createElement(y),M[an]=f,M[On]=u,Do(M,y,u),ot(M),f.stateNode=M):f.memoizedState=cP(f.type,u.memoizedProps,f.pendingProps,u.memoizedState),null;case 27:return we(f),u===null&&$r&&(M=f.stateNode=aP(f.type,f.pendingProps,re.current),Ls=f,wl=!0,I=Wi,i0(f.type)?(tC=I,Wi=ku(M.firstChild)):Wi=I),Da(u,f,f.pendingProps.children,y),Ph(u,f),u===null&&(f.flags|=4194304),f.child;case 5:return u===null&&$r&&((I=M=Wi)&&(M=yZ(M,f.type,f.pendingProps,wl),M!==null?(f.stateNode=M,Ls=f,Wi=ku(M.firstChild),wl=!1,I=!0):I=!1),I||gu(f)),we(f),I=f.type,z=f.pendingProps,ce=u!==null?u.memoizedProps:null,M=z.children,KE(I,z)?M=null:ce!==null&&KE(I,ce)&&(f.flags|=32),f.memoizedState!==null&&(I=Xv(u,f,Nh,null,null,y),Ob._currentValue=I),Ph(u,f),Da(u,f,M,y),f.child;case 6:return u===null&&$r&&((u=y=Wi)&&(y=bZ(y,f.pendingProps,wl),y!==null?(f.stateNode=y,Ls=f,Wi=null,u=!0):u=!1),u||gu(f)),null;case 13:return S3(u,f,y);case 4:return le(f,f.stateNode.containerInfo),M=f.pendingProps,u===null?f.child=md(f,null,M,y):Da(u,f,M,y),f.child;case 11:return Sb(u,f,f.type,f.pendingProps,y);case 7:return Da(u,f,f.pendingProps,y),f.child;case 8:return Da(u,f,f.pendingProps.children,y),f.child;case 12:return Da(u,f,f.pendingProps.children,y),f.child;case 10:return M=f.pendingProps,hd(f,f.type,M.value),Da(u,f,M.children,y),f.child;case 9:return I=f.type._context,M=f.pendingProps.children,lf(f),I=nr(I),M=M(I),f.flags|=1,Da(u,f,M,y),f.child;case 14:return Rh(u,f,f.type,f.pendingProps,y);case 15:return ix(u,f,f.type,f.pendingProps,y);case 19:return Jo(u,f,y);case 31:return ax(u,f,y);case 22:return kh(u,f,y,f.pendingProps);case 24:return lf(f),M=nr(oa),u===null?(I=Bv(),I===null&&(I=or,z=Fy(),I.pooledCache=z,z.refCount++,z!==null&&(I.pooledCacheLanes|=y),I=z),f.memoizedState={parent:M,cache:I},zm(f),hd(f,oa,I)):((u.lanes&y)!==0&&(Gy(u,f),Hp(f,null,null,y),jm()),I=u.memoizedState,z=f.memoizedState,I.parent!==M?(I={parent:M,cache:M},f.memoizedState=I,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=I),hd(f,oa,M)):(M=z.cache,hd(f,oa,M),M!==I.cache&&Fv(f,[oa],y,!0))),Da(u,f,f.pendingProps.children,y),f.child;case 29:throw f.pendingProps}throw Error(r(156,f.tag))}function wu(u){u.flags|=4}function $m(u,f,y,M,I){if((f=(u.mode&32)!==0)&&(f=!1),f){if(u.flags|=16777216,(I&335544128)===I)if(u.stateNode.complete)u.flags|=8192;else if(Es())u.flags|=8192;else throw _u=Hv,Om}else u.flags&=-16777217}function Tb(u,f){if(f.type!=="stylesheet"||(f.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!pP(f))if(Es())u.flags|=8192;else throw _u=Hv,Om}function yd(u,f){f!==null&&(u.flags|=4),u.flags&16384&&(f=u.tag!==22?He():536870912,u.lanes|=f,es|=f)}function Mu(u,f){if(!$r)switch(u.tailMode){case"hidden":f=u.tail;for(var y=null;f!==null;)f.alternate!==null&&(y=f),f=f.sibling;y===null?u.tail=null:y.sibling=null;break;case"collapsed":y=u.tail;for(var M=null;y!==null;)y.alternate!==null&&(M=y),y=y.sibling;M===null?f||u.tail===null?u.tail=null:u.tail.sibling=null:M.sibling=null}}function Li(u){var f=u.alternate!==null&&u.alternate.child===u.child,y=0,M=0;if(f)for(var I=u.child;I!==null;)y|=I.lanes|I.childLanes,M|=I.subtreeFlags&65011712,M|=I.flags&65011712,I.return=u,I=I.sibling;else for(I=u.child;I!==null;)y|=I.lanes|I.childLanes,M|=I.subtreeFlags,M|=I.flags,I.return=u,I=I.sibling;return u.subtreeFlags|=M,u.childLanes=y,f}function qm(u,f,y){var M=f.pendingProps;switch(Ov(f),f.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Li(f),null;case 1:return Li(f),null;case 3:return y=f.stateNode,M=null,u!==null&&(M=u.memoizedState.cache),f.memoizedState.cache!==M&&(f.flags|=2048),yu(oa),fe(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(u===null||u.child===null)&&(jp(f)?wu(f):u===null||u.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,zv())),Li(f),null;case 26:var I=f.type,z=f.memoizedState;return u===null?(wu(f),z!==null?(Li(f),Tb(f,z)):(Li(f),$m(f,I,null,M,y))):z?z!==u.memoizedState?(wu(f),Li(f),Tb(f,z)):(Li(f),f.flags&=-16777217):(u=u.memoizedProps,u!==M&&wu(f),Li(f),$m(f,I,u,M,y)),null;case 27:if(pe(f),y=re.current,I=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==M&&wu(f);else{if(!M){if(f.stateNode===null)throw Error(r(166));return Li(f),null}u=ie.current,jp(f)?kw(f):(u=aP(I,M,y),f.stateNode=u,wu(f))}return Li(f),null;case 5:if(pe(f),I=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==M&&wu(f);else{if(!M){if(f.stateNode===null)throw Error(r(166));return Li(f),null}if(z=ie.current,jp(f))kw(f);else{var ce=C3(re.current);switch(z){case 1:z=ce.createElementNS("http://www.w3.org/2000/svg",I);break;case 2:z=ce.createElementNS("http://www.w3.org/1998/Math/MathML",I);break;default:switch(I){case"svg":z=ce.createElementNS("http://www.w3.org/2000/svg",I);break;case"math":z=ce.createElementNS("http://www.w3.org/1998/Math/MathML",I);break;case"script":z=ce.createElement("div"),z.innerHTML="<script><\/script>",z=z.removeChild(z.firstChild);break;case"select":z=typeof M.is=="string"?ce.createElement("select",{is:M.is}):ce.createElement("select"),M.multiple?z.multiple=!0:M.size&&(z.size=M.size);break;default:z=typeof M.is=="string"?ce.createElement(I,{is:M.is}):ce.createElement(I)}}z[an]=f,z[On]=M;e:for(ce=f.child;ce!==null;){if(ce.tag===5||ce.tag===6)z.appendChild(ce.stateNode);else if(ce.tag!==4&&ce.tag!==27&&ce.child!==null){ce.child.return=ce,ce=ce.child;continue}if(ce===f)break e;for(;ce.sibling===null;){if(ce.return===null||ce.return===f)break e;ce=ce.return}ce.sibling.return=ce.return,ce=ce.sibling}f.stateNode=z;e:switch(Do(z,I,M),I){case"button":case"input":case"select":case"textarea":M=!!M.autoFocus;break e;case"img":M=!0;break e;default:M=!1}M&&wu(f)}}return Li(f),$m(f,f.type,u===null?null:u.memoizedProps,f.pendingProps,y),null;case 6:if(u&&f.stateNode!=null)u.memoizedProps!==M&&wu(f);else{if(typeof M!="string"&&f.stateNode===null)throw Error(r(166));if(u=re.current,jp(f)){if(u=f.stateNode,y=f.memoizedProps,M=null,I=Ls,I!==null)switch(I.tag){case 27:case 5:M=I.memoizedProps}u[an]=f,u=!!(u.nodeValue===y||M!==null&&M.suppressHydrationWarning===!0||Y9(u.nodeValue,y)),u||gu(f,!0)}else u=C3(u).createTextNode(M),u[an]=f,f.stateNode=u}return Li(f),null;case 31:if(y=f.memoizedState,u===null||u.memoizedState!==null){if(M=jp(f),y!==null){if(u===null){if(!M)throw Error(r(318));if(u=f.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[an]=f}else af(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;Li(f),u=!1}else y=zv(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=y),u=!0;if(!u)return f.flags&256?(Ws(f),f):(Ws(f),null);if((f.flags&128)!==0)throw Error(r(558))}return Li(f),null;case 13:if(M=f.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(I=jp(f),M!==null&&M.dehydrated!==null){if(u===null){if(!I)throw Error(r(318));if(I=f.memoizedState,I=I!==null?I.dehydrated:null,!I)throw Error(r(317));I[an]=f}else af(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;Li(f),I=!1}else I=zv(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=I),I=!0;if(!I)return f.flags&256?(Ws(f),f):(Ws(f),null)}return Ws(f),(f.flags&128)!==0?(f.lanes=y,f):(y=M!==null,u=u!==null&&u.memoizedState!==null,y&&(M=f.child,I=null,M.alternate!==null&&M.alternate.memoizedState!==null&&M.alternate.memoizedState.cachePool!==null&&(I=M.alternate.memoizedState.cachePool.pool),z=null,M.memoizedState!==null&&M.memoizedState.cachePool!==null&&(z=M.memoizedState.cachePool.pool),z!==I&&(M.flags|=2048)),y!==u&&y&&(f.child.flags|=8192),yd(f,f.updateQueue),Li(f),null);case 4:return fe(),u===null&&WE(f.stateNode.containerInfo),Li(f),null;case 10:return yu(f.type),Li(f),null;case 19:if(X(qr),M=f.memoizedState,M===null)return Li(f),null;if(I=(f.flags&128)!==0,z=M.rendering,z===null)if(I)Mu(M,!1);else{if(Ms!==0||u!==null&&(u.flags&128)!==0)for(u=f.child;u!==null;){if(z=Tl(u),z!==null){for(f.flags|=128,Mu(M,!1),u=z.updateQueue,f.updateQueue=u,yd(f,u),f.subtreeFlags=0,u=y,y=f.child;y!==null;)Ip(y,u),y=y.sibling;return H(qr,qr.current&1|2),$r&&pu(f,M.treeForkCount),f.child}u=u.sibling}M.tail!==null&&te()>Xs&&(f.flags|=128,I=!0,Mu(M,!1),f.lanes=4194304)}else{if(!I)if(u=Tl(z),u!==null){if(f.flags|=128,I=!0,u=u.updateQueue,f.updateQueue=u,yd(f,u),Mu(M,!0),M.tail===null&&M.tailMode==="hidden"&&!z.alternate&&!$r)return Li(f),null}else 2*te()-M.renderingStartTime>Xs&&y!==536870912&&(f.flags|=128,I=!0,Mu(M,!1),f.lanes=4194304);M.isBackwards?(z.sibling=f.child,f.child=z):(u=M.last,u!==null?u.sibling=z:f.child=z,M.last=z)}return M.tail!==null?(u=M.tail,M.rendering=u,M.tail=u.sibling,M.renderingStartTime=te(),u.sibling=null,y=qr.current,H(qr,I?y&1|2:y&1),$r&&pu(f,M.treeForkCount),u):(Li(f),null);case 22:case 23:return Ws(f),Fm(),M=f.memoizedState!==null,u!==null?u.memoizedState!==null!==M&&(f.flags|=8192):M&&(f.flags|=8192),M?(y&536870912)!==0&&(f.flags&128)===0&&(Li(f),f.subtreeFlags&6&&(f.flags|=8192)):Li(f),y=f.updateQueue,y!==null&&yd(f,y.retryQueue),y=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),M=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(M=f.memoizedState.cachePool.pool),M!==y&&(f.flags|=2048),u!==null&&X(cf),null;case 24:return y=null,u!==null&&(y=u.memoizedState.cache),f.memoizedState.cache!==y&&(f.flags|=2048),yu(oa),Li(f),null;case 25:return null;case 30:return null}throw Error(r(156,f.tag))}function lc(u,f){switch(Ov(f),f.tag){case 1:return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return yu(oa),fe(),u=f.flags,(u&65536)!==0&&(u&128)===0?(f.flags=u&-65537|128,f):null;case 26:case 27:case 5:return pe(f),null;case 31:if(f.memoizedState!==null){if(Ws(f),f.alternate===null)throw Error(r(340));af()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 13:if(Ws(f),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(r(340));af()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return X(qr),null;case 4:return fe(),null;case 10:return yu(f.type),null;case 22:case 23:return Ws(f),Fm(),u!==null&&X(cf),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 24:return yu(oa),null;case 25:return null;default:return null}}function El(u,f){switch(Ov(f),f.tag){case 3:yu(oa),fe();break;case 26:case 27:case 5:pe(f);break;case 4:fe();break;case 31:f.memoizedState!==null&&Ws(f);break;case 13:Ws(f);break;case 19:X(qr);break;case 10:yu(f.type);break;case 22:case 23:Ws(f),Fm(),u!==null&&X(cf);break;case 24:yu(oa)}}function cc(u,f){try{var y=f.updateQueue,M=y!==null?y.lastEffect:null;if(M!==null){var I=M.next;y=I;do{if((y.tag&u)===u){M=void 0;var z=y.create,ce=y.inst;M=z(),ce.destroy=M}y=y.next}while(y!==I)}}catch(Ne){ai(f,f.return,Ne)}}function Ka(u,f,y){try{var M=f.updateQueue,I=M!==null?M.lastEffect:null;if(I!==null){var z=I.next;M=z;do{if((M.tag&u)===u){var ce=M.inst,Ne=ce.destroy;if(Ne!==void 0){ce.destroy=void 0,I=f;var rt=y,Ct=Ne;try{Ct()}catch(Lt){ai(I,rt,Lt)}}}M=M.next}while(M!==z)}}catch(Lt){ai(f,f.return,Lt)}}function zc(u){var f=u.updateQueue;if(f!==null){var y=u.stateNode;try{Lw(f,y)}catch(M){ai(u,u.return,M)}}}function Oa(u,f,y){y.props=pf(u.type,u.memoizedProps),y.state=u.memoizedState;try{y.componentWillUnmount()}catch(M){ai(u,f,M)}}function bd(u,f){try{var y=u.ref;if(y!==null){switch(u.tag){case 26:case 27:case 5:var M=u.stateNode;break;case 30:M=u.stateNode;break;default:M=u.stateNode}typeof y=="function"?u.refCleanup=y(M):y.current=M}}catch(I){ai(u,f,I)}}function Za(u,f){var y=u.ref,M=u.refCleanup;if(y!==null)if(typeof M=="function")try{M()}catch(I){ai(u,f,I)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof y=="function")try{y(null)}catch(I){ai(u,f,I)}else y.current=null}function Xm(u){var f=u.type,y=u.memoizedProps,M=u.stateNode;try{e:switch(f){case"button":case"input":case"select":case"textarea":y.autoFocus&&M.focus();break e;case"img":y.src?M.src=y.src:y.srcSet&&(M.srcset=y.srcSet)}}catch(I){ai(u,u.return,I)}}function _a(u,f,y){try{var M=u.stateNode;hZ(M,u.type,y,f),M[On]=f}catch(I){ai(u,u.return,I)}}function cs(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&i0(u.type)||u.tag===4}function Fr(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||cs(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&i0(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function Tu(u,f,y){var M=u.tag;if(M===5||M===6)u=u.stateNode,f?(y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y).insertBefore(u,f):(f=y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y,f.appendChild(u),y=y._reactRootContainer,y!=null||f.onclick!==null||(f.onclick=Ps));else if(M!==4&&(M===27&&i0(u.type)&&(y=u.stateNode,f=null),u=u.child,u!==null))for(Tu(u,f,y),u=u.sibling;u!==null;)Tu(u,f,y),u=u.sibling}function Ro(u,f,y){var M=u.tag;if(M===5||M===6)u=u.stateNode,f?y.insertBefore(u,f):y.appendChild(u);else if(M!==4&&(M===27&&i0(u.type)&&(y=u.stateNode),u=u.child,u!==null))for(Ro(u,f,y),u=u.sibling;u!==null;)Ro(u,f,y),u=u.sibling}function fx(u){var f=u.stateNode,y=u.memoizedProps;try{for(var M=u.type,I=f.attributes;I.length;)f.removeAttributeNode(I[0]);Do(f,M,y),f[an]=u,f[On]=y}catch(z){ai(u,u.return,z)}}var uc=!1,$i=!1,jc=!1,M3=typeof WeakSet=="function"?WeakSet:Set,La=null;function HE(u,f){if(u=u.containerInfo,XE=D3,u=Ji(u),Ds(u)){if("selectionStart"in u)var y={start:u.selectionStart,end:u.selectionEnd};else e:{y=(y=u.ownerDocument)&&y.defaultView||window;var M=y.getSelection&&y.getSelection();if(M&&M.rangeCount!==0){y=M.anchorNode;var I=M.anchorOffset,z=M.focusNode;M=M.focusOffset;try{y.nodeType,z.nodeType}catch{y=null;break e}var ce=0,Ne=-1,rt=-1,Ct=0,Lt=0,Ut=u,Nt=null;t:for(;;){for(var Dt;Ut!==y||I!==0&&Ut.nodeType!==3||(Ne=ce+I),Ut!==z||M!==0&&Ut.nodeType!==3||(rt=ce+M),Ut.nodeType===3&&(ce+=Ut.nodeValue.length),(Dt=Ut.firstChild)!==null;)Nt=Ut,Ut=Dt;for(;;){if(Ut===u)break t;if(Nt===y&&++Ct===I&&(Ne=ce),Nt===z&&++Lt===M&&(rt=ce),(Dt=Ut.nextSibling)!==null)break;Ut=Nt,Nt=Ut.parentNode}Ut=Dt}y=Ne===-1||rt===-1?null:{start:Ne,end:rt}}else y=null}y=y||{start:0,end:0}}else y=null;for(YE={focusedElem:u,selectionRange:y},D3=!1,La=f;La!==null;)if(f=La,u=f.child,(f.subtreeFlags&1028)!==0&&u!==null)u.return=f,La=u;else for(;La!==null;){switch(f=La,z=f.alternate,u=f.flags,f.tag){case 0:if((u&4)!==0&&(u=f.updateQueue,u=u!==null?u.events:null,u!==null))for(y=0;y<u.length;y++)I=u[y],I.ref.impl=I.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&z!==null){u=void 0,y=f,I=z.memoizedProps,z=z.memoizedState,M=y.stateNode;try{var kn=pf(y.type,I);u=M.getSnapshotBeforeUpdate(kn,z),M.__reactInternalSnapshotBeforeUpdate=u}catch(Jn){ai(y,y.return,Jn)}}break;case 3:if((u&1024)!==0){if(u=f.stateNode.containerInfo,y=u.nodeType,y===9)QE(u);else if(y===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":QE(u);break;default:u.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((u&1024)!==0)throw Error(r(163))}if(u=f.sibling,u!==null){u.return=f.return,La=u;break}La=f.return}}function us(u,f,y){var M=y.flags;switch(y.tag){case 0:case 11:case 15:hc(u,y),M&4&&cc(5,y);break;case 1:if(hc(u,y),M&4)if(u=y.stateNode,f===null)try{u.componentDidMount()}catch(ce){ai(y,y.return,ce)}else{var I=pf(y.type,f.memoizedProps);f=f.memoizedState;try{u.componentDidUpdate(I,f,u.__reactInternalSnapshotBeforeUpdate)}catch(ce){ai(y,y.return,ce)}}M&64&&zc(y),M&512&&bd(y,y.return);break;case 3:if(hc(u,y),M&64&&(u=y.updateQueue,u!==null)){if(f=null,y.child!==null)switch(y.child.tag){case 27:case 5:f=y.child.stateNode;break;case 1:f=y.child.stateNode}try{Lw(u,f)}catch(ce){ai(y,y.return,ce)}}break;case 27:f===null&&M&4&&fx(y);case 26:case 5:hc(u,y),f===null&&M&4&&Xm(y),M&512&&bd(y,y.return);break;case 12:hc(u,y);break;case 31:hc(u,y),M&4&&mf(u,y);break;case 13:hc(u,y),M&4&&Yp(u,y),M&64&&(u=y.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(y=C.bind(null,y),_Z(u,y))));break;case 22:if(M=y.memoizedState!==null||uc,!M){f=f!==null&&f.memoizedState!==null||$i,I=uc;var z=$i;uc=M,($i=f)&&!z?ko(u,y,(y.subtreeFlags&8772)!==0):hc(u,y),uc=I,$i=z}break;case 30:break;default:hc(u,y)}}function Ym(u){var f=u.alternate;f!==null&&(u.alternate=null,Ym(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&Ln(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}var Ei=null,po=!1;function dc(u,f,y){for(y=y.child;y!==null;)hx(u,f,y),y=y.sibling}function hx(u,f,y){if(Be&&typeof Be.onCommitFiberUnmount=="function")try{Be.onCommitFiberUnmount(De,y)}catch{}switch(y.tag){case 26:$i||Za(y,f),dc(u,f,y),y.memoizedState?y.memoizedState.count--:y.stateNode&&(y=y.stateNode,y.parentNode.removeChild(y));break;case 27:$i||Za(y,f);var M=Ei,I=po;i0(y.type)&&(Ei=y.stateNode,po=!1),dc(u,f,y),Pb(y.stateNode),Ei=M,po=I;break;case 5:$i||Za(y,f);case 6:if(M=Ei,I=po,Ei=null,dc(u,f,y),Ei=M,po=I,Ei!==null)if(po)try{(Ei.nodeType===9?Ei.body:Ei.nodeName==="HTML"?Ei.ownerDocument.body:Ei).removeChild(y.stateNode)}catch(z){ai(y,f,z)}else try{Ei.removeChild(y.stateNode)}catch(z){ai(y,f,z)}break;case 18:Ei!==null&&(po?(u=Ei,tP(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,y.stateNode),_x(u)):tP(Ei,y.stateNode));break;case 4:M=Ei,I=po,Ei=y.stateNode.containerInfo,po=!0,dc(u,f,y),Ei=M,po=I;break;case 0:case 11:case 14:case 15:Ka(2,y,f),$i||Ka(4,y,f),dc(u,f,y);break;case 1:$i||(Za(y,f),M=y.stateNode,typeof M.componentWillUnmount=="function"&&Oa(y,f,M)),dc(u,f,y);break;case 21:dc(u,f,y);break;case 22:$i=(M=$i)||y.memoizedState!==null,dc(u,f,y),$i=M;break;default:dc(u,f,y)}}function mf(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{_x(u)}catch(y){ai(f,f.return,y)}}}function Yp(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{_x(u)}catch(y){ai(f,f.return,y)}}function Eb(u){switch(u.tag){case 31:case 13:case 19:var f=u.stateNode;return f===null&&(f=u.stateNode=new M3),f;case 22:return u=u.stateNode,f=u._retryCache,f===null&&(f=u._retryCache=new M3),f;default:throw Error(r(435,u.tag))}}function _d(u,f){var y=Eb(u);f.forEach(function(M){if(!y.has(M)){y.add(M);var I=k.bind(null,u,M);M.then(I,I)}})}function Sa(u,f){var y=f.deletions;if(y!==null)for(var M=0;M<y.length;M++){var I=y[M],z=u,ce=f,Ne=ce;e:for(;Ne!==null;){switch(Ne.tag){case 27:if(i0(Ne.type)){Ei=Ne.stateNode,po=!1;break e}break;case 5:Ei=Ne.stateNode,po=!1;break e;case 3:case 4:Ei=Ne.stateNode.containerInfo,po=!0;break e}Ne=Ne.return}if(Ei===null)throw Error(r(160));hx(z,ce,I),Ei=null,po=!1,z=I.alternate,z!==null&&(z.return=null),I.return=null}if(f.subtreeFlags&13886)for(f=f.child;f!==null;)gf(f,u),f=f.sibling}var fc=null;function gf(u,f){var y=u.alternate,M=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:Sa(f,u),wa(u),M&4&&(Ka(3,u,u.return),cc(3,u),Ka(5,u,u.return));break;case 1:Sa(f,u),wa(u),M&512&&($i||y===null||Za(y,y.return)),M&64&&uc&&(u=u.updateQueue,u!==null&&(M=u.callbacks,M!==null&&(y=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=y===null?M:y.concat(M))));break;case 26:var I=fc;if(Sa(f,u),wa(u),M&512&&($i||y===null||Za(y,y.return)),M&4){var z=y!==null?y.memoizedState:null;if(M=u.memoizedState,y===null)if(M===null)if(u.stateNode===null){e:{M=u.type,y=u.memoizedProps,I=I.ownerDocument||I;t:switch(M){case"title":z=I.getElementsByTagName("title")[0],(!z||z[bn]||z[an]||z.namespaceURI==="http://www.w3.org/2000/svg"||z.hasAttribute("itemprop"))&&(z=I.createElement(M),I.head.insertBefore(z,I.querySelector("head > title"))),Do(z,M,y),z[an]=u,ot(z),M=z;break e;case"link":var ce=fP("link","href",I).get(M+(y.href||""));if(ce){for(var Ne=0;Ne<ce.length;Ne++)if(z=ce[Ne],z.getAttribute("href")===(y.href==null||y.href===""?null:y.href)&&z.getAttribute("rel")===(y.rel==null?null:y.rel)&&z.getAttribute("title")===(y.title==null?null:y.title)&&z.getAttribute("crossorigin")===(y.crossOrigin==null?null:y.crossOrigin)){ce.splice(Ne,1);break t}}z=I.createElement(M),Do(z,M,y),I.head.appendChild(z);break;case"meta":if(ce=fP("meta","content",I).get(M+(y.content||""))){for(Ne=0;Ne<ce.length;Ne++)if(z=ce[Ne],z.getAttribute("content")===(y.content==null?null:""+y.content)&&z.getAttribute("name")===(y.name==null?null:y.name)&&z.getAttribute("property")===(y.property==null?null:y.property)&&z.getAttribute("http-equiv")===(y.httpEquiv==null?null:y.httpEquiv)&&z.getAttribute("charset")===(y.charSet==null?null:y.charSet)){ce.splice(Ne,1);break t}}z=I.createElement(M),Do(z,M,y),I.head.appendChild(z);break;default:throw Error(r(468,M))}z[an]=u,ot(z),M=z}u.stateNode=M}else hP(I,u.type,u.stateNode);else u.stateNode=dP(I,M,u.memoizedProps);else z!==M?(z===null?y.stateNode!==null&&(y=y.stateNode,y.parentNode.removeChild(y)):z.count--,M===null?hP(I,u.type,u.stateNode):dP(I,M,u.memoizedProps)):M===null&&u.stateNode!==null&&_a(u,u.memoizedProps,y.memoizedProps)}break;case 27:Sa(f,u),wa(u),M&512&&($i||y===null||Za(y,y.return)),y!==null&&M&4&&_a(u,u.memoizedProps,y.memoizedProps);break;case 5:if(Sa(f,u),wa(u),M&512&&($i||y===null||Za(y,y.return)),u.flags&32){I=u.stateNode;try{ks(I,"")}catch(kn){ai(u,u.return,kn)}}M&4&&u.stateNode!=null&&(I=u.memoizedProps,_a(u,I,y!==null?y.memoizedProps:I)),M&1024&&(jc=!0);break;case 6:if(Sa(f,u),wa(u),M&4){if(u.stateNode===null)throw Error(r(162));M=u.memoizedProps,y=u.stateNode;try{y.nodeValue=M}catch(kn){ai(u,u.return,kn)}}break;case 3:if(R3=null,I=fc,fc=A3(f.containerInfo),Sa(f,u),fc=I,wa(u),M&4&&y!==null&&y.memoizedState.isDehydrated)try{_x(f.containerInfo)}catch(kn){ai(u,u.return,kn)}jc&&(jc=!1,px(u));break;case 4:M=fc,fc=A3(u.stateNode.containerInfo),Sa(f,u),wa(u),fc=M;break;case 12:Sa(f,u),wa(u);break;case 31:Sa(f,u),wa(u),M&4&&(M=u.updateQueue,M!==null&&(u.updateQueue=null,_d(u,M)));break;case 13:Sa(f,u),wa(u),u.child.flags&8192&&u.memoizedState!==null!=(y!==null&&y.memoizedState!==null)&&(Kp=te()),M&4&&(M=u.updateQueue,M!==null&&(u.updateQueue=null,_d(u,M)));break;case 22:I=u.memoizedState!==null;var rt=y!==null&&y.memoizedState!==null,Ct=uc,Lt=$i;if(uc=Ct||I,$i=Lt||rt,Sa(f,u),$i=Lt,uc=Ct,wa(u),M&8192)e:for(f=u.stateNode,f._visibility=I?f._visibility&-2:f._visibility|1,I&&(y===null||rt||uc||$i||Eu(u)),y=null,f=u;;){if(f.tag===5||f.tag===26){if(y===null){rt=y=f;try{if(z=rt.stateNode,I)ce=z.style,typeof ce.setProperty=="function"?ce.setProperty("display","none","important"):ce.display="none";else{Ne=rt.stateNode;var Ut=rt.memoizedProps.style,Nt=Ut!=null&&Ut.hasOwnProperty("display")?Ut.display:null;Ne.style.display=Nt==null||typeof Nt=="boolean"?"":(""+Nt).trim()}}catch(kn){ai(rt,rt.return,kn)}}}else if(f.tag===6){if(y===null){rt=f;try{rt.stateNode.nodeValue=I?"":rt.memoizedProps}catch(kn){ai(rt,rt.return,kn)}}}else if(f.tag===18){if(y===null){rt=f;try{var Dt=rt.stateNode;I?nP(Dt,!0):nP(rt.stateNode,!1)}catch(kn){ai(rt,rt.return,kn)}}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===u)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break e;for(;f.sibling===null;){if(f.return===null||f.return===u)break e;y===f&&(y=null),f=f.return}y===f&&(y=null),f.sibling.return=f.return,f=f.sibling}M&4&&(M=u.updateQueue,M!==null&&(y=M.retryQueue,y!==null&&(M.retryQueue=null,_d(u,y))));break;case 19:Sa(f,u),wa(u),M&4&&(M=u.updateQueue,M!==null&&(u.updateQueue=null,_d(u,M)));break;case 30:break;case 21:break;default:Sa(f,u),wa(u)}}function wa(u){var f=u.flags;if(f&2){try{for(var y,M=u.return;M!==null;){if(cs(M)){y=M;break}M=M.return}if(y==null)throw Error(r(160));switch(y.tag){case 27:var I=y.stateNode,z=Fr(u);Ro(u,z,I);break;case 5:var ce=y.stateNode;y.flags&32&&(ks(ce,""),y.flags&=-33);var Ne=Fr(u);Ro(u,Ne,ce);break;case 3:case 4:var rt=y.stateNode.containerInfo,Ct=Fr(u);Tu(u,Ct,rt);break;default:throw Error(r(161))}}catch(Lt){ai(u,u.return,Lt)}u.flags&=-3}f&4096&&(u.flags&=-4097)}function px(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var f=u;px(f),f.tag===5&&f.flags&1024&&f.stateNode.reset(),u=u.sibling}}function hc(u,f){if(f.subtreeFlags&8772)for(f=f.child;f!==null;)us(u,f.alternate,f),f=f.sibling}function Eu(u){for(u=u.child;u!==null;){var f=u;switch(f.tag){case 0:case 11:case 14:case 15:Ka(4,f,f.return),Eu(f);break;case 1:Za(f,f.return);var y=f.stateNode;typeof y.componentWillUnmount=="function"&&Oa(f,f.return,y),Eu(f);break;case 27:Pb(f.stateNode);case 26:case 5:Za(f,f.return),Eu(f);break;case 22:f.memoizedState===null&&Eu(f);break;case 30:Eu(f);break;default:Eu(f)}u=u.sibling}}function ko(u,f,y){for(y=y&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var M=f.alternate,I=u,z=f,ce=z.flags;switch(z.tag){case 0:case 11:case 15:ko(I,z,y),cc(4,z);break;case 1:if(ko(I,z,y),M=z,I=M.stateNode,typeof I.componentDidMount=="function")try{I.componentDidMount()}catch(Ct){ai(M,M.return,Ct)}if(M=z,I=M.updateQueue,I!==null){var Ne=M.stateNode;try{var rt=I.shared.hiddenCallbacks;if(rt!==null)for(I.shared.hiddenCallbacks=null,I=0;I<rt.length;I++)Vp(rt[I],Ne)}catch(Ct){ai(M,M.return,Ct)}}y&&ce&64&&zc(z),bd(z,z.return);break;case 27:fx(z);case 26:case 5:ko(I,z,y),y&&M===null&&ce&4&&Xm(z),bd(z,z.return);break;case 12:ko(I,z,y);break;case 31:ko(I,z,y),y&&ce&4&&mf(I,z);break;case 13:ko(I,z,y),y&&ce&4&&Yp(I,z);break;case 22:z.memoizedState===null&&ko(I,z,y),bd(z,z.return);break;case 30:break;default:ko(I,z,y)}f=f.sibling}}function vf(u,f){var y=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),u=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(u=f.memoizedState.cachePool.pool),u!==y&&(u!=null&&u.refCount++,y!=null&&bh(y))}function Dh(u,f){u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&bh(u))}function Qa(u,f,y,M){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)Cb(u,f,y,M),f=f.sibling}function Cb(u,f,y,M){var I=f.flags;switch(f.tag){case 0:case 11:case 15:Qa(u,f,y,M),I&2048&&cc(9,f);break;case 1:Qa(u,f,y,M);break;case 3:Qa(u,f,y,M),I&2048&&(u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&bh(u)));break;case 12:if(I&2048){Qa(u,f,y,M),u=f.stateNode;try{var z=f.memoizedProps,ce=z.id,Ne=z.onPostCommit;typeof Ne=="function"&&Ne(ce,f.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(rt){ai(f,f.return,rt)}}else Qa(u,f,y,M);break;case 31:Qa(u,f,y,M);break;case 13:Qa(u,f,y,M);break;case 23:break;case 22:z=f.stateNode,ce=f.alternate,f.memoizedState!==null?z._visibility&2?Qa(u,f,y,M):Cu(u,f):z._visibility&2?Qa(u,f,y,M):(z._visibility|=2,Ja(u,f,y,M,(f.subtreeFlags&10256)!==0||!1)),I&2048&&vf(ce,f);break;case 24:Qa(u,f,y,M),I&2048&&Dh(f.alternate,f);break;default:Qa(u,f,y,M)}}function Ja(u,f,y,M,I){for(I=I&&((f.subtreeFlags&10256)!==0||!1),f=f.child;f!==null;){var z=u,ce=f,Ne=y,rt=M,Ct=ce.flags;switch(ce.tag){case 0:case 11:case 15:Ja(z,ce,Ne,rt,I),cc(8,ce);break;case 23:break;case 22:var Lt=ce.stateNode;ce.memoizedState!==null?Lt._visibility&2?Ja(z,ce,Ne,rt,I):Cu(z,ce):(Lt._visibility|=2,Ja(z,ce,Ne,rt,I)),I&&Ct&2048&&vf(ce.alternate,ce);break;case 24:Ja(z,ce,Ne,rt,I),I&&Ct&2048&&Dh(ce.alternate,ce);break;default:Ja(z,ce,Ne,rt,I)}f=f.sibling}}function Cu(u,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var y=u,M=f,I=M.flags;switch(M.tag){case 22:Cu(y,M),I&2048&&vf(M.alternate,M);break;case 24:Cu(y,M),I&2048&&Dh(M.alternate,M);break;default:Cu(y,M)}f=f.sibling}}var Oh=8192;function Cl(u,f,y){if(u.subtreeFlags&Oh)for(u=u.child;u!==null;)mx(u,f,y),u=u.sibling}function mx(u,f,y){switch(u.tag){case 26:Cl(u,f,y),u.flags&Oh&&u.memoizedState!==null&&IZ(y,fc,u.memoizedState,u.memoizedProps);break;case 5:Cl(u,f,y);break;case 3:case 4:var M=fc;fc=A3(u.stateNode.containerInfo),Cl(u,f,y),fc=M;break;case 22:u.memoizedState===null&&(M=u.alternate,M!==null&&M.memoizedState!==null?(M=Oh,Oh=16777216,Cl(u,f,y),Oh=M):Cl(u,f,y));break;default:Cl(u,f,y)}}function Lh(u){var f=u.alternate;if(f!==null&&(u=f.child,u!==null)){f.child=null;do f=u.sibling,u.sibling=null,u=f;while(u!==null)}}function xf(u){var f=u.deletions;if((u.flags&16)!==0){if(f!==null)for(var y=0;y<f.length;y++){var M=f[y];La=M,zs(M,u)}Lh(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)el(u),u=u.sibling}function el(u){switch(u.tag){case 0:case 11:case 15:xf(u),u.flags&2048&&Ka(9,u,u.return);break;case 3:xf(u);break;case 12:xf(u);break;case 22:var f=u.stateNode;u.memoizedState!==null&&f._visibility&2&&(u.return===null||u.return.tag!==13)?(f._visibility&=-3,tl(u)):xf(u);break;default:xf(u)}}function tl(u){var f=u.deletions;if((u.flags&16)!==0){if(f!==null)for(var y=0;y<f.length;y++){var M=f[y];La=M,zs(M,u)}Lh(u)}for(u=u.child;u!==null;){switch(f=u,f.tag){case 0:case 11:case 15:Ka(8,f,f.return),tl(f);break;case 22:y=f.stateNode,y._visibility&2&&(y._visibility&=-3,tl(f));break;default:tl(f)}u=u.sibling}}function zs(u,f){for(;La!==null;){var y=La;switch(y.tag){case 0:case 11:case 15:Ka(8,y,f);break;case 23:case 22:if(y.memoizedState!==null&&y.memoizedState.cachePool!==null){var M=y.memoizedState.cachePool.pool;M!=null&&M.refCount++}break;case 24:bh(y.memoizedState.cache)}if(M=y.child,M!==null)M.return=y,La=M;else e:for(y=u;La!==null;){M=La;var I=M.sibling,z=M.return;if(Ym(M),M===y){La=null;break e}if(I!==null){I.return=z,La=I;break e}La=z}}}var Sd={getCacheForType:function(u){var f=nr(oa),y=f.data.get(u);return y===void 0&&(y=u(),f.data.set(u,y)),y},cacheSignal:function(){return nr(oa).controller.signal}},vr=typeof WeakMap=="function"?WeakMap:Map,Bn=0,or=null,wr=null,_r=0,Kr=0,mo=null,pc=!1,Fc=!1,Ab=!1,Al=0,Ms=0,Au=0,yf=0,Km=0,Po=0,es=0,zh=null,js=null,Fs=!1,Kp=0,Nb=0,Xs=1/0,Ts=null,Ys=null,Ci=0,Nl=null,Zp=null,mc=0,Qp=0,Jp=null,Zm=null,bf=0,jh=null;function Rl(){return(Bn&2)!==0&&_r!==0?_r&-_r:q.T!==null?kt():Et()}function Ir(){if(Po===0)if((_r&536870912)===0||$r){var u=ft;ft<<=1,(ft&3932160)===0&&(ft=262144),Po=u}else Po=536870912;return u=Ko.current,u!==null&&(u.flags|=32),Po}function Mr(u,f,y){(u===or&&(Kr===2||Kr===9)||u.cancelPendingCommit!==null)&&(Sf(u,0),ca(u,_r,Po,!1)),ht(u,y),((Bn&2)===0||u!==or)&&(u===or&&((Bn&2)===0&&(yf|=y),Ms===4&&ca(u,_r,Po,!1)),qt(u))}function Dr(u,f,y){if((Bn&6)!==0)throw Error(r(327));var M=!y&&(f&127)===0&&(f&u.expiredLanes)===0||ze(u,f),I=M?Qm(u,f):Io(u,f,!0),z=M;do{if(I===0){Fc&&!M&&ca(u,f,0,!1);break}else{if(y=u.current.alternate,z&&!Ai(y)){I=Io(u,f,!1),z=!1;continue}if(I===2){if(z=f,u.errorRecoveryDisabledLanes&z)var ce=0;else ce=u.pendingLanes&-536870913,ce=ce!==0?ce:ce&536870912?536870912:0;if(ce!==0){f=ce;e:{var Ne=u;I=zh;var rt=Ne.current.memoizedState.isDehydrated;if(rt&&(Sf(Ne,ce).flags|=256),ce=Io(Ne,ce,!1),ce!==2){if(Ab&&!rt){Ne.errorRecoveryDisabledLanes|=z,yf|=z,I=4;break e}z=js,js=I,z!==null&&(js===null?js=z:js.push.apply(js,z))}I=ce}if(z=!1,I!==2)continue}}if(I===1){Sf(u,0),ca(u,f,0,!0);break}e:{switch(M=u,z=I,z){case 0:case 1:throw Error(r(345));case 4:if((f&4194048)!==f)break;case 6:ca(M,f,Po,!pc);break e;case 2:js=null;break;case 3:case 5:break;default:throw Error(r(329))}if((f&62914560)===f&&(I=Kp+300-te(),10<I)){if(ca(M,f,Po,!pc),Qe(M,0,!0)!==0)break e;mc=f,M.timeoutHandle=J9(Ur.bind(null,M,y,js,Ts,Fs,f,Po,yf,es,pc,z,"Throttled",-0,0),I);break e}Ur(M,y,js,Ts,Fs,f,Po,yf,es,pc,z,null,-0,0)}}break}while(!0);qt(u)}function Ur(u,f,y,M,I,z,ce,Ne,rt,Ct,Lt,Ut,Nt,Dt){if(u.timeoutHandle=-1,Ut=f.subtreeFlags,Ut&8192||(Ut&16785408)===16785408){Ut={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ps},mx(f,z,Ut);var kn=(z&62914560)===z?Kp-te():(z&4194048)===z?Nb-te():0;if(kn=DZ(Ut,kn),kn!==null){mc=z,u.cancelPendingCommit=kn(Md.bind(null,u,f,z,y,M,I,ce,Ne,rt,Lt,Ut,null,Nt,Dt)),ca(u,z,ce,!Ct);return}}Md(u,f,z,y,M,I,ce,Ne,rt)}function Ai(u){for(var f=u;;){var y=f.tag;if((y===0||y===11||y===15)&&f.flags&16384&&(y=f.updateQueue,y!==null&&(y=y.stores,y!==null)))for(var M=0;M<y.length;M++){var I=y[M],z=I.getSnapshot;I=I.value;try{if(!tr(z(),I))return!1}catch{return!1}}if(y=f.child,f.subtreeFlags&16384&&y!==null)y.return=f,f=y;else{if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function ca(u,f,y,M){f&=~Km,f&=~yf,u.suspendedLanes|=f,u.pingedLanes&=~f,M&&(u.warmLanes|=f),M=u.expirationTimes;for(var I=f;0<I;){var z=31-Se(I),ce=1<<z;M[z]=-1,I&=~ce}y!==0&&bt(u,y,f)}function Uc(){return(Bn&6)===0?(yn(0),!1):!0}function _f(){if(wr!==null){if(Kr===0)var u=wr.return;else u=wr,xu=of=null,Qy(u),Th=null,Eh=0,u=wr;for(;u!==null;)El(u.alternate,u),u=u.return;wr=null}}function Sf(u,f){var y=u.timeoutHandle;y!==-1&&(u.timeoutHandle=-1,gZ(y)),y=u.cancelPendingCommit,y!==null&&(u.cancelPendingCommit=null,y()),mc=0,_f(),or=u,wr=y=qo(u.current,null),_r=f,Kr=0,mo=null,pc=!1,Fc=ze(u,f),Ab=!1,es=Po=Km=yf=Au=Ms=0,js=zh=null,Fs=!1,(f&8)!==0&&(f|=f&32);var M=u.entangledLanes;if(M!==0)for(u=u.entanglements,M&=f;0<M;){var I=31-Se(M),z=1<<I;f|=u[I],M&=~z}return Al=f,km(),y}function Nu(u,f){gr=null,q.H=qp,f===_h||f===Sr?(f=wh(),Kr=3):f===Om?(f=wh(),Kr=4):Kr=f===rx?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,mo=f,wr===null&&(Ms=1,nx(u,Sl(f,u.current)))}function Es(){var u=Ko.current;return u===null?!0:(_r&4194048)===_r?No===null:(_r&62914560)===_r||(_r&536870912)!==0?u===No:!1}function wd(){var u=q.H;return q.H=qp,u===null?qp:u}function wf(){var u=q.A;return q.A=Sd,u}function e0(){Ms=4,pc||(_r&4194048)!==_r&&Ko.current!==null||(Fc=!0),(Au&134217727)===0&&(yf&134217727)===0||or===null||ca(or,_r,Po,!1)}function Io(u,f,y){var M=Bn;Bn|=2;var I=wd(),z=wf();(or!==u||_r!==f)&&(Ts=null,Sf(u,f)),f=!1;var ce=Ms;e:do try{if(Kr!==0&&wr!==null){var Ne=wr,rt=mo;switch(Kr){case 8:_f(),ce=6;break e;case 3:case 2:case 9:case 6:Ko.current===null&&(f=!0);var Ct=Kr;if(Kr=0,mo=null,Fh(u,Ne,rt,Ct),y&&Fc){ce=0;break e}break;default:Ct=Kr,Kr=0,mo=null,Fh(u,Ne,rt,Ct)}}t0(),ce=Ms;break}catch(Lt){Nu(u,Lt)}while(!0);return f&&u.shellSuspendCounter++,xu=of=null,Bn=M,q.H=I,q.A=z,wr===null&&(or=null,_r=0,km()),ce}function t0(){for(;wr!==null;)gx(wr)}function Qm(u,f){var y=Bn;Bn|=2;var M=wd(),I=wf();or!==u||_r!==f?(Ts=null,Xs=te()+500,Sf(u,f)):Fc=ze(u,f);e:do try{if(Kr!==0&&wr!==null){f=wr;var z=mo;t:switch(Kr){case 1:Kr=0,mo=null,Fh(u,f,z,1);break;case 2:case 9:if(Yo(z)){Kr=0,mo=null,Jm(f);break}f=function(){Kr!==2&&Kr!==9||or!==u||(Kr=7),qt(u)},z.then(f,f);break e;case 3:Kr=7;break e;case 4:Kr=5;break e;case 7:Yo(z)?(Kr=0,mo=null,Jm(f)):(Kr=0,mo=null,Fh(u,f,z,7));break;case 5:var ce=null;switch(wr.tag){case 26:ce=wr.memoizedState;case 5:case 27:var Ne=wr;if(ce?pP(ce):Ne.stateNode.complete){Kr=0,mo=null;var rt=Ne.sibling;if(rt!==null)wr=rt;else{var Ct=Ne.return;Ct!==null?(wr=Ct,Mf(Ct)):wr=null}break t}}Kr=0,mo=null,Fh(u,f,z,5);break;case 6:Kr=0,mo=null,Fh(u,f,z,6);break;case 8:_f(),Ms=6;break e;default:throw Error(r(462))}}nl();break}catch(Lt){Nu(u,Lt)}while(!0);return xu=of=null,q.H=M,q.A=I,Bn=y,wr!==null?0:(or=null,_r=0,km(),Ms)}function nl(){for(;wr!==null&&!Ze();)gx(wr)}function gx(u){var f=dx(u.alternate,u,Al);u.memoizedProps=u.pendingProps,f===null?Mf(u):wr=f}function Jm(u){var f=u,y=f.alternate;switch(f.tag){case 15:case 0:f=Gm(y,f,f.pendingProps,f.type,void 0,_r);break;case 11:f=Gm(y,f,f.pendingProps,f.type.render,f.ref,_r);break;case 5:Qy(f);default:El(y,f),f=wr=Ip(f,Al),f=dx(y,f,Al)}u.memoizedProps=u.pendingProps,f===null?Mf(u):wr=f}function Fh(u,f,y,M){xu=of=null,Qy(f),Th=null,Eh=0;var I=f.return;try{if(ba(u,I,f,y,_r)){Ms=1,nx(u,Sl(y,u.current)),wr=null;return}}catch(z){if(I!==null)throw wr=I,z;Ms=1,nx(u,Sl(y,u.current)),wr=null;return}f.flags&32768?($r||M===1?u=!0:Fc||(_r&536870912)!==0?u=!1:(pc=u=!0,(M===2||M===9||M===3||M===6)&&(M=Ko.current,M!==null&&M.tag===13&&(M.flags|=16384))),eg(f,u)):Mf(f)}function Mf(u){var f=u;do{if((f.flags&32768)!==0){eg(f,pc);return}u=f.return;var y=qm(f.alternate,f,Al);if(y!==null){wr=y;return}if(f=f.sibling,f!==null){wr=f;return}wr=f=u}while(f!==null);Ms===0&&(Ms=5)}function eg(u,f){do{var y=lc(u.alternate,u);if(y!==null){y.flags&=32767,wr=y;return}if(y=u.return,y!==null&&(y.flags|=32768,y.subtreeFlags=0,y.deletions=null),!f&&(u=u.sibling,u!==null)){wr=u;return}wr=u=y}while(u!==null);Ms=6,wr=null}function Md(u,f,y,M,I,z,ce,Ne,rt){u.cancelPendingCommit=null;do n0();while(Ci!==0);if((Bn&6)!==0)throw Error(r(327));if(f!==null){if(f===u.current)throw Error(r(177));if(z=f.lanes|f.childLanes,z|=Pa,ct(u,y,z,ce,Ne,rt),u===or&&(wr=or=null,_r=0),Zp=f,Nl=u,mc=y,Qp=z,Jp=I,Zm=M,(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,$(ke,function(){return vx(),null})):(u.callbackNode=null,u.callbackPriority=0),M=(f.flags&13878)!==0,(f.subtreeFlags&13878)!==0||M){M=q.T,q.T=null,I=K.p,K.p=2,ce=Bn,Bn|=4;try{HE(u,f,y)}finally{Bn=ce,K.p=I,q.T=M}}Ci=1,ua(),Td(),Uh()}}function ua(){if(Ci===1){Ci=0;var u=Nl,f=Zp,y=(f.flags&13878)!==0;if((f.subtreeFlags&13878)!==0||y){y=q.T,q.T=null;var M=K.p;K.p=2;var I=Bn;Bn|=4;try{gf(f,u);var z=YE,ce=Ji(u.containerInfo),Ne=z.focusedElem,rt=z.selectionRange;if(ce!==Ne&&Ne&&Ne.ownerDocument&&qn(Ne.ownerDocument.documentElement,Ne)){if(rt!==null&&Ds(Ne)){var Ct=rt.start,Lt=rt.end;if(Lt===void 0&&(Lt=Ct),"selectionStart"in Ne)Ne.selectionStart=Ct,Ne.selectionEnd=Math.min(Lt,Ne.value.length);else{var Ut=Ne.ownerDocument||document,Nt=Ut&&Ut.defaultView||window;if(Nt.getSelection){var Dt=Nt.getSelection(),kn=Ne.textContent.length,Jn=Math.min(rt.start,kn),Xi=rt.end===void 0?Jn:Math.min(rt.end,kn);!Dt.extend&&Jn>Xi&&(ce=Xi,Xi=Jn,Jn=ce);var gt=An(Ne,Jn),ut=An(Ne,Xi);if(gt&&ut&&(Dt.rangeCount!==1||Dt.anchorNode!==gt.node||Dt.anchorOffset!==gt.offset||Dt.focusNode!==ut.node||Dt.focusOffset!==ut.offset)){var Mt=Ut.createRange();Mt.setStart(gt.node,gt.offset),Dt.removeAllRanges(),Jn>Xi?(Dt.addRange(Mt),Dt.extend(ut.node,ut.offset)):(Mt.setEnd(ut.node,ut.offset),Dt.addRange(Mt))}}}}for(Ut=[],Dt=Ne;Dt=Dt.parentNode;)Dt.nodeType===1&&Ut.push({element:Dt,left:Dt.scrollLeft,top:Dt.scrollTop});for(typeof Ne.focus=="function"&&Ne.focus(),Ne=0;Ne<Ut.length;Ne++){var Ft=Ut[Ne];Ft.element.scrollLeft=Ft.left,Ft.element.scrollTop=Ft.top}}D3=!!XE,YE=XE=null}finally{Bn=I,K.p=M,q.T=y}}u.current=f,Ci=2}}function Td(){if(Ci===2){Ci=0;var u=Nl,f=Zp,y=(f.flags&8772)!==0;if((f.subtreeFlags&8772)!==0||y){y=q.T,q.T=null;var M=K.p;K.p=2;var I=Bn;Bn|=4;try{us(u,f.alternate,f)}finally{Bn=I,K.p=M,q.T=y}}Ci=3}}function Uh(){if(Ci===4||Ci===3){Ci=0,ae();var u=Nl,f=Zp,y=mc,M=Zm;(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?Ci=5:(Ci=0,Zp=Nl=null,Ru(u,u.pendingLanes));var I=u.pendingLanes;if(I===0&&(Ys=null),Tt(y),f=f.stateNode,Be&&typeof Be.onCommitFiberRoot=="function")try{Be.onCommitFiberRoot(De,f,void 0,(f.current.flags&128)===128)}catch{}if(M!==null){f=q.T,I=K.p,K.p=2,q.T=null;try{for(var z=u.onRecoverableError,ce=0;ce<M.length;ce++){var Ne=M[ce];z(Ne.value,{componentStack:Ne.stack})}}finally{q.T=f,K.p=I}}(mc&3)!==0&&n0(),qt(u),I=u.pendingLanes,(y&261930)!==0&&(I&42)!==0?u===jh?bf++:(bf=0,jh=u):bf=0,yn(0)}}function Ru(u,f){(u.pooledCacheLanes&=f)===0&&(f=u.pooledCache,f!=null&&(u.pooledCache=null,bh(f)))}function n0(){return ua(),Td(),Uh(),vx()}function vx(){if(Ci!==5)return!1;var u=Nl,f=Qp;Qp=0;var y=Tt(mc),M=q.T,I=K.p;try{K.p=32>y?32:y,q.T=null,y=Jp,Jp=null;var z=Nl,ce=mc;if(Ci=0,Zp=Nl=null,mc=0,(Bn&6)!==0)throw Error(r(331));var Ne=Bn;if(Bn|=4,el(z.current),Cb(z,z.current,ce,y),Bn=Ne,yn(0,!1),Be&&typeof Be.onPostCommitFiberRoot=="function")try{Be.onPostCommitFiberRoot(De,z)}catch{}return!0}finally{K.p=I,q.T=M,Ru(u,f)}}function Rb(u,f,y){f=Sl(y,f),f=bb(u.stateNode,f,2),u=uf(u,f,2),u!==null&&(ht(u,2),qt(u))}function ai(u,f,y){if(u.tag===3)Rb(u,u,y);else for(;f!==null;){if(f.tag===3){Rb(f,u,y);break}else if(f.tag===1){var M=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof M.componentDidCatch=="function"&&(Ys===null||!Ys.has(M))){u=Sl(y,u),y=_b(2),M=uf(f,y,2),M!==null&&(y3(y,M,f,u),ht(M,2),qt(M));break}}f=f.return}}function tg(u,f,y){var M=u.pingCache;if(M===null){M=u.pingCache=new vr;var I=new Set;M.set(f,I)}else I=M.get(f),I===void 0&&(I=new Set,M.set(f,I));I.has(y)||(Ab=!0,I.add(y),u=m.bind(null,u,f,y),f.then(u,u))}function m(u,f,y){var M=u.pingCache;M!==null&&M.delete(f),u.pingedLanes|=u.suspendedLanes&y,u.warmLanes&=~y,or===u&&(_r&y)===y&&(Ms===4||Ms===3&&(_r&62914560)===_r&&300>te()-Kp?(Bn&2)===0&&Sf(u,0):Km|=y,es===_r&&(es=0)),qt(u)}function x(u,f){f===0&&(f=He()),u=Co(u,f),u!==null&&(ht(u,f),qt(u))}function C(u){var f=u.memoizedState,y=0;f!==null&&(y=f.retryLane),x(u,y)}function k(u,f){var y=0;switch(u.tag){case 31:case 13:var M=u.stateNode,I=u.memoizedState;I!==null&&(y=I.retryLane);break;case 19:M=u.stateNode;break;case 22:M=u.stateNode._retryCache;break;default:throw Error(r(314))}M!==null&&M.delete(f),x(u,y)}function $(u,f){return Ee(u,f)}var ee=null,Ce=null,at=!1,It=!1,Wt=!1,ln=0;function qt(u){u!==Ce&&u.next===null&&(Ce===null?ee=Ce=u:Ce=Ce.next=u),It=!0,at||(at=!0,xt())}function yn(u,f){if(!Wt&&It){Wt=!0;do for(var y=!1,M=ee;M!==null;){if(u!==0){var I=M.pendingLanes;if(I===0)var z=0;else{var ce=M.suspendedLanes,Ne=M.pingedLanes;z=(1<<31-Se(42|u)+1)-1,z&=I&~(ce&~Ne),z=z&201326741?z&201326741|1:z?z|2:0}z!==0&&(y=!0,At(M,z))}else z=_r,z=Qe(M,M===or?z:0,M.cancelPendingCommit!==null||M.timeoutHandle!==-1),(z&3)===0||ze(M,z)||(y=!0,At(M,z));M=M.next}while(y);Wt=!1}}function dr(){Ks()}function Ks(){It=at=!1;var u=0;ln!==0&&mZ()&&(u=ln);for(var f=te(),y=null,M=ee;M!==null;){var I=M.next,z=r0(M,f);z===0?(M.next=null,y===null?ee=I:y.next=I,I===null&&(Ce=y)):(y=M,(u!==0||(z&3)!==0)&&(It=!0)),M=I}Ci!==0&&Ci!==5||yn(u),ln!==0&&(ln=0)}function r0(u,f){for(var y=u.suspendedLanes,M=u.pingedLanes,I=u.expirationTimes,z=u.pendingLanes&-62914561;0<z;){var ce=31-Se(z),Ne=1<<ce,rt=I[ce];rt===-1?((Ne&y)===0||(Ne&M)!==0)&&(I[ce]=Te(Ne,f)):rt<=f&&(u.expiredLanes|=Ne),z&=~Ne}if(f=or,y=_r,y=Qe(u,u===f?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),M=u.callbackNode,y===0||u===f&&(Kr===2||Kr===9)||u.cancelPendingCommit!==null)return M!==null&&M!==null&&Pe(M),u.callbackNode=null,u.callbackPriority=0;if((y&3)===0||ze(u,y)){if(f=y&-y,f===u.callbackPriority)return f;switch(M!==null&&Pe(M),Tt(y)){case 2:case 8:y=ge;break;case 32:y=ke;break;case 268435456:y=Ae;break;default:y=ke}return M=Tf.bind(null,u),y=Ee(y,M),u.callbackPriority=f,u.callbackNode=y,f}return M!==null&&M!==null&&Pe(M),u.callbackPriority=2,u.callbackNode=null,2}function Tf(u,f){if(Ci!==0&&Ci!==5)return u.callbackNode=null,u.callbackPriority=0,null;var y=u.callbackNode;if(n0()&&u.callbackNode!==y)return null;var M=_r;return M=Qe(u,u===or?M:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),M===0?null:(Dr(u,M,f),r0(u,te()),u.callbackNode!=null&&u.callbackNode===y?Tf.bind(null,u):null)}function At(u,f){if(n0())return null;Dr(u,f,!0)}function xt(){vZ(function(){(Bn&6)!==0?Ee(me,dr):Ks()})}function kt(){if(ln===0){var u=pd;u===0&&(u=st,st<<=1,(st&261888)===0&&(st=256)),ln=u}return ln}function tn(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:uo(""+u)}function Xn(u,f){var y=f.ownerDocument.createElement("input");return y.name=f.name,y.value=f.value,u.id&&y.setAttribute("form",u.id),f.parentNode.insertBefore(y,f),u=new FormData(u),y.parentNode.removeChild(y),u}function Cs(u,f,y,M,I){if(f==="submit"&&y&&y.stateNode===I){var z=tn((I[On]||null).action),ce=M.submitter;ce&&(f=(f=ce[On]||null)?tn(f.formAction):ce.getAttribute("formAction"),f!==null&&(z=f,ce=null));var Ne=new Di("action","action",null,M,I);u.push({event:Ne,listeners:[{instance:null,listener:function(){if(M.defaultPrevented){if(ln!==0){var rt=ce?Xn(I,ce):new FormData(I);fb(y,{pending:!0,data:rt,method:I.method,action:z},null,rt)}}else typeof z=="function"&&(Ne.preventDefault(),rt=ce?Xn(I,ce):new FormData(I),fb(y,{pending:!0,data:rt,method:I.method,action:z},z,rt))},currentTarget:I}]})}}for(var Kn=0;Kn<Nm.length;Kn++){var ti=Nm[Kn],za=ti.toLowerCase(),fi=ti[0].toUpperCase()+ti.slice(1);tc(za,"on"+fi)}tc(aa,"onAnimationEnd"),tc(xa,"onAnimationIteration"),tc(Oc,"onAnimationStart"),tc("dblclick","onDoubleClick"),tc("focusin","onFocus"),tc("focusout","onBlur"),tc(ka,"onTransitionRun"),tc(Rv,"onTransitionStart"),tc(Nw,"onTransitionCancel"),tc(zy,"onTransitionEnd"),Yt("onMouseEnter",["mouseout","mouseover"]),Yt("onMouseLeave",["mouseout","mouseover"]),Yt("onPointerEnter",["pointerout","pointerover"]),Yt("onPointerLeave",["pointerout","pointerover"]),vt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),vt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),vt("onBeforeInput",["compositionend","keypress","textInput","paste"]),vt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),vt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),vt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var gc="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),VE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(gc));function W9(u,f){f=(f&4)!==0;for(var y=0;y<u.length;y++){var M=u[y],I=M.event;M=M.listeners;e:{var z=void 0;if(f)for(var ce=M.length-1;0<=ce;ce--){var Ne=M[ce],rt=Ne.instance,Ct=Ne.currentTarget;if(Ne=Ne.listener,rt!==z&&I.isPropagationStopped())break e;z=Ne,I.currentTarget=Ct;try{z(I)}catch(Lt){Rm(Lt)}I.currentTarget=null,z=rt}else for(ce=0;ce<M.length;ce++){if(Ne=M[ce],rt=Ne.instance,Ct=Ne.currentTarget,Ne=Ne.listener,rt!==z&&I.isPropagationStopped())break e;z=Ne,I.currentTarget=Ct;try{z(I)}catch(Lt){Rm(Lt)}I.currentTarget=null,z=rt}}}}function Zr(u,f){var y=f[fn];y===void 0&&(y=f[fn]=new Set);var M=u+"__bubble";y.has(M)||($9(f,u,2,!1),y.add(M))}function GE(u,f,y){var M=0;f&&(M|=4),$9(y,u,M,f)}var T3="_reactListening"+Math.random().toString(36).slice(2);function WE(u){if(!u[T3]){u[T3]=!0,_t.forEach(function(y){y!=="selectionchange"&&(VE.has(y)||GE(y,!1,u),GE(y,!0,u))});var f=u.nodeType===9?u:u.ownerDocument;f===null||f[T3]||(f[T3]=!0,GE("selectionchange",!1,f))}}function $9(u,f,y,M){switch(_P(f)){case 2:var I=zZ;break;case 8:I=jZ;break;default:I=aC}y=I.bind(null,f,y,u),I=void 0,!Aa||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(I=!0),M?I!==void 0?u.addEventListener(f,y,{capture:!0,passive:I}):u.addEventListener(f,y,!0):I!==void 0?u.addEventListener(f,y,{passive:I}):u.addEventListener(f,y,!1)}function $E(u,f,y,M,I){var z=M;if((f&1)===0&&(f&2)===0&&M!==null)e:for(;;){if(M===null)return;var ce=M.tag;if(ce===3||ce===4){var Ne=M.stateNode.containerInfo;if(Ne===I)break;if(ce===4)for(ce=M.return;ce!==null;){var rt=ce.tag;if((rt===3||rt===4)&&ce.stateNode.containerInfo===I)return;ce=ce.return}for(;Ne!==null;){if(ce=Fn(Ne),ce===null)return;if(rt=ce.tag,rt===5||rt===6||rt===26||rt===27){M=z=ce;continue e}Ne=Ne.parentNode}}M=M.return}Yl(function(){var Ct=z,Lt=Go(y),Ut=[];e:{var Nt=ec.get(u);if(Nt!==void 0){var Dt=Di,kn=u;switch(u){case"keypress":if(ei(y)===0)break e;case"keydown":case"keyup":Dt=sd;break;case"focusin":kn="focus",Dt=fo;break;case"focusout":kn="blur",Dt=fo;break;case"beforeblur":case"afterblur":Dt=fo;break;case"click":if(y.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Dt=vh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Dt=rd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Dt=Sm;break;case aa:case xa:case Oc:Dt=Hs;break;case zy:Dt=wm;break;case"scroll":case"scrollend":Dt=To;break;case"wheel":Dt=Mm;break;case"copy":case"cut":case"paste":Dt=_l;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Dt=Ql;break;case"toggle":case"beforetoggle":Dt=Em}var Jn=(f&4)!==0,Xi=!Jn&&(u==="scroll"||u==="scrollend"),gt=Jn?Nt!==null?Nt+"Capture":null:Nt;Jn=[];for(var ut=Ct,Mt;ut!==null;){var Ft=ut;if(Mt=Ft.stateNode,Ft=Ft.tag,Ft!==5&&Ft!==26&&Ft!==27||Mt===null||gt===null||(Ft=qa(ut,gt),Ft!=null&&Jn.push(kb(ut,Ft,Mt))),Xi)break;ut=ut.return}0<Jn.length&&(Nt=new Dt(Nt,kn,null,y,Lt),Ut.push({event:Nt,listeners:Jn}))}}if((f&7)===0){e:{if(Nt=u==="mouseover"||u==="pointerover",Dt=u==="mouseout"||u==="pointerout",Nt&&y!==Xl&&(kn=y.relatedTarget||y.fromElement)&&(Fn(kn)||kn[Bt]))break e;if((Dt||Nt)&&(Nt=Lt.window===Lt?Lt:(Nt=Lt.ownerDocument)?Nt.defaultView||Nt.parentWindow:window,Dt?(kn=y.relatedTarget||y.toElement,Dt=Ct,kn=kn?Fn(kn):null,kn!==null&&(Xi=s(kn),Jn=kn.tag,kn!==Xi||Jn!==5&&Jn!==27&&Jn!==6)&&(kn=null)):(Dt=null,kn=Ct),Dt!==kn)){if(Jn=vh,Ft="onMouseLeave",gt="onMouseEnter",ut="mouse",(u==="pointerout"||u==="pointerover")&&(Jn=Ql,Ft="onPointerLeave",gt="onPointerEnter",ut="pointer"),Xi=Dt==null?Nt:ui(Dt),Mt=kn==null?Nt:ui(kn),Nt=new Jn(Ft,ut+"leave",Dt,y,Lt),Nt.target=Xi,Nt.relatedTarget=Mt,Ft=null,Fn(Lt)===Ct&&(Jn=new Jn(gt,ut+"enter",kn,y,Lt),Jn.target=Mt,Jn.relatedTarget=Xi,Ft=Jn),Xi=Ft,Dt&&kn)t:{for(Jn=uZ,gt=Dt,ut=kn,Mt=0,Ft=gt;Ft;Ft=Jn(Ft))Mt++;Ft=0;for(var Wn=ut;Wn;Wn=Jn(Wn))Ft++;for(;0<Mt-Ft;)gt=Jn(gt),Mt--;for(;0<Ft-Mt;)ut=Jn(ut),Ft--;for(;Mt--;){if(gt===ut||ut!==null&&gt===ut.alternate){Jn=gt;break t}gt=Jn(gt),ut=Jn(ut)}Jn=null}else Jn=null;Dt!==null&&q9(Ut,Nt,Dt,Jn,!1),kn!==null&&Xi!==null&&q9(Ut,Xi,kn,Jn,!0)}}e:{if(Nt=Ct?ui(Ct):window,Dt=Nt.nodeName&&Nt.nodeName.toLowerCase(),Dt==="select"||Dt==="input"&&Nt.type==="file")var _i=Ge;else if(cd(Nt))if(Ke)_i=er;else{_i=vn;var jn=mn}else Dt=Nt.nodeName,!Dt||Dt.toLowerCase()!=="input"||Nt.type!=="checkbox"&&Nt.type!=="radio"?Ct&&So(Ct.elementType)&&(_i=Ge):_i=Sn;if(_i&&(_i=_i(u,Ct))){Pp(Ut,_i,y,Lt);break e}jn&&jn(u,Nt,Ct),u==="focusout"&&Ct&&Nt.type==="number"&&Ct.memoizedProps.value!=null&&Pi(Nt,"number",Nt.value)}switch(jn=Ct?ui(Ct):window,u){case"focusin":(cd(jn)||jn.contentEditable==="true")&&(si=jn,as=Ct,Os=null);break;case"focusout":Os=as=si=null;break;case"mousedown":Ya=!0;break;case"contextmenu":case"mouseup":case"dragend":Ya=!1,Na(Ut,y,Lt);break;case"selectionchange":if(pi)break;case"keydown":case"keyup":Na(Ut,y,Lt)}var Rr;if(uu)e:{switch(u){case"compositionstart":var ni="onCompositionStart";break e;case"compositionend":ni="onCompositionEnd";break e;case"compositionupdate":ni="onCompositionUpdate";break e}ni=void 0}else du?ld(u,y)&&(ni="onCompositionEnd"):u==="keydown"&&y.keyCode===229&&(ni="onCompositionStart");ni&&(Rp&&y.locale!=="ko"&&(du||ni!=="onCompositionStart"?ni==="onCompositionEnd"&&du&&(Rr=Ic()):(xs=Lt,Wo="value"in xs?xs.value:xs.textContent,du=!0)),jn=E3(Ct,ni),0<jn.length&&(ni=new Tp(ni,u,null,y,Lt),Ut.push({event:ni,listeners:jn}),Rr?ni.data=Rr:(Rr=Is(y),Rr!==null&&(ni.data=Rr)))),(Rr=Np?bs(u,y):kp(u,y))&&(ni=E3(Ct,"onBeforeInput"),0<ni.length&&(jn=new Tp("onBeforeInput","beforeinput",null,y,Lt),Ut.push({event:jn,listeners:ni}),jn.data=Rr)),Cs(Ut,u,Ct,y,Lt)}W9(Ut,f)})}function kb(u,f,y){return{instance:u,listener:f,currentTarget:y}}function E3(u,f){for(var y=f+"Capture",M=[];u!==null;){var I=u,z=I.stateNode;if(I=I.tag,I!==5&&I!==26&&I!==27||z===null||(I=qa(u,y),I!=null&&M.unshift(kb(u,I,z)),I=qa(u,f),I!=null&&M.push(kb(u,I,z))),u.tag===3)return M;u=u.return}return[]}function uZ(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function q9(u,f,y,M,I){for(var z=f._reactName,ce=[];y!==null&&y!==M;){var Ne=y,rt=Ne.alternate,Ct=Ne.stateNode;if(Ne=Ne.tag,rt!==null&&rt===M)break;Ne!==5&&Ne!==26&&Ne!==27||Ct===null||(rt=Ct,I?(Ct=qa(y,z),Ct!=null&&ce.unshift(kb(y,Ct,rt))):I||(Ct=qa(y,z),Ct!=null&&ce.push(kb(y,Ct,rt)))),y=y.return}ce.length!==0&&u.push({event:f,listeners:ce})}var dZ=/\r\n?/g,fZ=/\u0000|\uFFFD/g;function X9(u){return(typeof u=="string"?u:""+u).replace(dZ,`
`).replace(fZ,"")}function Y9(u,f){return f=X9(f),X9(u)===f}function qi(u,f,y,M,I,z){switch(y){case"children":typeof M=="string"?f==="body"||f==="textarea"&&M===""||ks(u,M):(typeof M=="number"||typeof M=="bigint")&&f!=="body"&&ks(u,""+M);break;case"className":$n(u,"class",M);break;case"tabIndex":$n(u,"tabindex",M);break;case"dir":case"role":case"viewBox":case"width":case"height":$n(u,y,M);break;case"style":co(u,M,z);break;case"data":if(f!=="object"){$n(u,"data",M);break}case"src":case"href":if(M===""&&(f!=="a"||y!=="href")){u.removeAttribute(y);break}if(M==null||typeof M=="function"||typeof M=="symbol"||typeof M=="boolean"){u.removeAttribute(y);break}M=uo(""+M),u.setAttribute(y,M);break;case"action":case"formAction":if(typeof M=="function"){u.setAttribute(y,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof z=="function"&&(y==="formAction"?(f!=="input"&&qi(u,f,"name",I.name,I,null),qi(u,f,"formEncType",I.formEncType,I,null),qi(u,f,"formMethod",I.formMethod,I,null),qi(u,f,"formTarget",I.formTarget,I,null)):(qi(u,f,"encType",I.encType,I,null),qi(u,f,"method",I.method,I,null),qi(u,f,"target",I.target,I,null)));if(M==null||typeof M=="symbol"||typeof M=="boolean"){u.removeAttribute(y);break}M=uo(""+M),u.setAttribute(y,M);break;case"onClick":M!=null&&(u.onclick=Ps);break;case"onScroll":M!=null&&Zr("scroll",u);break;case"onScrollEnd":M!=null&&Zr("scrollend",u);break;case"dangerouslySetInnerHTML":if(M!=null){if(typeof M!="object"||!("__html"in M))throw Error(r(61));if(y=M.__html,y!=null){if(I.children!=null)throw Error(r(60));u.innerHTML=y}}break;case"multiple":u.multiple=M&&typeof M!="function"&&typeof M!="symbol";break;case"muted":u.muted=M&&typeof M!="function"&&typeof M!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(M==null||typeof M=="function"||typeof M=="boolean"||typeof M=="symbol"){u.removeAttribute("xlink:href");break}y=uo(""+M),u.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",y);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":M!=null&&typeof M!="function"&&typeof M!="symbol"?u.setAttribute(y,""+M):u.removeAttribute(y);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":M&&typeof M!="function"&&typeof M!="symbol"?u.setAttribute(y,""):u.removeAttribute(y);break;case"capture":case"download":M===!0?u.setAttribute(y,""):M!==!1&&M!=null&&typeof M!="function"&&typeof M!="symbol"?u.setAttribute(y,M):u.removeAttribute(y);break;case"cols":case"rows":case"size":case"span":M!=null&&typeof M!="function"&&typeof M!="symbol"&&!isNaN(M)&&1<=M?u.setAttribute(y,M):u.removeAttribute(y);break;case"rowSpan":case"start":M==null||typeof M=="function"||typeof M=="symbol"||isNaN(M)?u.removeAttribute(y):u.setAttribute(y,M);break;case"popover":Zr("beforetoggle",u),Zr("toggle",u),Un(u,"popover",M);break;case"xlinkActuate":on(u,"http://www.w3.org/1999/xlink","xlink:actuate",M);break;case"xlinkArcrole":on(u,"http://www.w3.org/1999/xlink","xlink:arcrole",M);break;case"xlinkRole":on(u,"http://www.w3.org/1999/xlink","xlink:role",M);break;case"xlinkShow":on(u,"http://www.w3.org/1999/xlink","xlink:show",M);break;case"xlinkTitle":on(u,"http://www.w3.org/1999/xlink","xlink:title",M);break;case"xlinkType":on(u,"http://www.w3.org/1999/xlink","xlink:type",M);break;case"xmlBase":on(u,"http://www.w3.org/XML/1998/namespace","xml:base",M);break;case"xmlLang":on(u,"http://www.w3.org/XML/1998/namespace","xml:lang",M);break;case"xmlSpace":on(u,"http://www.w3.org/XML/1998/namespace","xml:space",M);break;case"is":Un(u,"is",M);break;case"innerText":case"textContent":break;default:(!(2<y.length)||y[0]!=="o"&&y[0]!=="O"||y[1]!=="n"&&y[1]!=="N")&&(y=ql.get(y)||y,Un(u,y,M))}}function qE(u,f,y,M,I,z){switch(y){case"style":co(u,M,z);break;case"dangerouslySetInnerHTML":if(M!=null){if(typeof M!="object"||!("__html"in M))throw Error(r(61));if(y=M.__html,y!=null){if(I.children!=null)throw Error(r(60));u.innerHTML=y}}break;case"children":typeof M=="string"?ks(u,M):(typeof M=="number"||typeof M=="bigint")&&ks(u,""+M);break;case"onScroll":M!=null&&Zr("scroll",u);break;case"onScrollEnd":M!=null&&Zr("scrollend",u);break;case"onClick":M!=null&&(u.onclick=Ps);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!yt.hasOwnProperty(y))e:{if(y[0]==="o"&&y[1]==="n"&&(I=y.endsWith("Capture"),f=y.slice(2,I?y.length-7:void 0),z=u[On]||null,z=z!=null?z[y]:null,typeof z=="function"&&u.removeEventListener(f,z,I),typeof M=="function")){typeof z!="function"&&z!==null&&(y in u?u[y]=null:u.hasAttribute(y)&&u.removeAttribute(y)),u.addEventListener(f,M,I);break e}y in u?u[y]=M:M===!0?u.setAttribute(y,""):Un(u,y,M)}}}function Do(u,f,y){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Zr("error",u),Zr("load",u);var M=!1,I=!1,z;for(z in y)if(y.hasOwnProperty(z)){var ce=y[z];if(ce!=null)switch(z){case"src":M=!0;break;case"srcSet":I=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:qi(u,f,z,ce,y,null)}}I&&qi(u,f,"srcSet",y.srcSet,y,null),M&&qi(u,f,"src",y.src,y,null);return;case"input":Zr("invalid",u);var Ne=z=ce=I=null,rt=null,Ct=null;for(M in y)if(y.hasOwnProperty(M)){var Lt=y[M];if(Lt!=null)switch(M){case"name":I=Lt;break;case"type":ce=Lt;break;case"checked":rt=Lt;break;case"defaultChecked":Ct=Lt;break;case"value":z=Lt;break;case"defaultValue":Ne=Lt;break;case"children":case"dangerouslySetInnerHTML":if(Lt!=null)throw Error(r(137,f));break;default:qi(u,f,M,Lt,y,null)}}Rs(u,z,Ne,rt,Ct,ce,I,!1);return;case"select":Zr("invalid",u),M=ce=z=null;for(I in y)if(y.hasOwnProperty(I)&&(Ne=y[I],Ne!=null))switch(I){case"value":z=Ne;break;case"defaultValue":ce=Ne;break;case"multiple":M=Ne;default:qi(u,f,I,Ne,y,null)}f=z,y=ce,u.multiple=!!M,f!=null?vs(u,!!M,f,!1):y!=null&&vs(u,!!M,y,!0);return;case"textarea":Zr("invalid",u),z=I=M=null;for(ce in y)if(y.hasOwnProperty(ce)&&(Ne=y[ce],Ne!=null))switch(ce){case"value":M=Ne;break;case"defaultValue":I=Ne;break;case"children":z=Ne;break;case"dangerouslySetInnerHTML":if(Ne!=null)throw Error(r(91));break;default:qi(u,f,ce,Ne,y,null)}di(u,M,I,z);return;case"option":for(rt in y)if(y.hasOwnProperty(rt)&&(M=y[rt],M!=null))switch(rt){case"selected":u.selected=M&&typeof M!="function"&&typeof M!="symbol";break;default:qi(u,f,rt,M,y,null)}return;case"dialog":Zr("beforetoggle",u),Zr("toggle",u),Zr("cancel",u),Zr("close",u);break;case"iframe":case"object":Zr("load",u);break;case"video":case"audio":for(M=0;M<gc.length;M++)Zr(gc[M],u);break;case"image":Zr("error",u),Zr("load",u);break;case"details":Zr("toggle",u);break;case"embed":case"source":case"link":Zr("error",u),Zr("load",u);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Ct in y)if(y.hasOwnProperty(Ct)&&(M=y[Ct],M!=null))switch(Ct){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:qi(u,f,Ct,M,y,null)}return;default:if(So(f)){for(Lt in y)y.hasOwnProperty(Lt)&&(M=y[Lt],M!==void 0&&qE(u,f,Lt,M,y,void 0));return}}for(Ne in y)y.hasOwnProperty(Ne)&&(M=y[Ne],M!=null&&qi(u,f,Ne,M,y,null))}function hZ(u,f,y,M){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var I=null,z=null,ce=null,Ne=null,rt=null,Ct=null,Lt=null;for(Dt in y){var Ut=y[Dt];if(y.hasOwnProperty(Dt)&&Ut!=null)switch(Dt){case"checked":break;case"value":break;case"defaultValue":rt=Ut;default:M.hasOwnProperty(Dt)||qi(u,f,Dt,null,M,Ut)}}for(var Nt in M){var Dt=M[Nt];if(Ut=y[Nt],M.hasOwnProperty(Nt)&&(Dt!=null||Ut!=null))switch(Nt){case"type":z=Dt;break;case"name":I=Dt;break;case"checked":Ct=Dt;break;case"defaultChecked":Lt=Dt;break;case"value":ce=Dt;break;case"defaultValue":Ne=Dt;break;case"children":case"dangerouslySetInnerHTML":if(Dt!=null)throw Error(r(137,f));break;default:Dt!==Ut&&qi(u,f,Nt,Dt,M,Ut)}}gs(u,ce,Ne,rt,Ct,Lt,z,I);return;case"select":Dt=ce=Ne=Nt=null;for(z in y)if(rt=y[z],y.hasOwnProperty(z)&&rt!=null)switch(z){case"value":break;case"multiple":Dt=rt;default:M.hasOwnProperty(z)||qi(u,f,z,null,M,rt)}for(I in M)if(z=M[I],rt=y[I],M.hasOwnProperty(I)&&(z!=null||rt!=null))switch(I){case"value":Nt=z;break;case"defaultValue":Ne=z;break;case"multiple":ce=z;default:z!==rt&&qi(u,f,I,z,M,rt)}f=Ne,y=ce,M=Dt,Nt!=null?vs(u,!!y,Nt,!1):!!M!=!!y&&(f!=null?vs(u,!!y,f,!0):vs(u,!!y,y?[]:"",!1));return;case"textarea":Dt=Nt=null;for(Ne in y)if(I=y[Ne],y.hasOwnProperty(Ne)&&I!=null&&!M.hasOwnProperty(Ne))switch(Ne){case"value":break;case"children":break;default:qi(u,f,Ne,null,M,I)}for(ce in M)if(I=M[ce],z=y[ce],M.hasOwnProperty(ce)&&(I!=null||z!=null))switch(ce){case"value":Nt=I;break;case"defaultValue":Dt=I;break;case"children":break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(r(91));break;default:I!==z&&qi(u,f,ce,I,M,z)}pr(u,Nt,Dt);return;case"option":for(var kn in y)if(Nt=y[kn],y.hasOwnProperty(kn)&&Nt!=null&&!M.hasOwnProperty(kn))switch(kn){case"selected":u.selected=!1;break;default:qi(u,f,kn,null,M,Nt)}for(rt in M)if(Nt=M[rt],Dt=y[rt],M.hasOwnProperty(rt)&&Nt!==Dt&&(Nt!=null||Dt!=null))switch(rt){case"selected":u.selected=Nt&&typeof Nt!="function"&&typeof Nt!="symbol";break;default:qi(u,f,rt,Nt,M,Dt)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Jn in y)Nt=y[Jn],y.hasOwnProperty(Jn)&&Nt!=null&&!M.hasOwnProperty(Jn)&&qi(u,f,Jn,null,M,Nt);for(Ct in M)if(Nt=M[Ct],Dt=y[Ct],M.hasOwnProperty(Ct)&&Nt!==Dt&&(Nt!=null||Dt!=null))switch(Ct){case"children":case"dangerouslySetInnerHTML":if(Nt!=null)throw Error(r(137,f));break;default:qi(u,f,Ct,Nt,M,Dt)}return;default:if(So(f)){for(var Xi in y)Nt=y[Xi],y.hasOwnProperty(Xi)&&Nt!==void 0&&!M.hasOwnProperty(Xi)&&qE(u,f,Xi,void 0,M,Nt);for(Lt in M)Nt=M[Lt],Dt=y[Lt],!M.hasOwnProperty(Lt)||Nt===Dt||Nt===void 0&&Dt===void 0||qE(u,f,Lt,Nt,M,Dt);return}}for(var gt in y)Nt=y[gt],y.hasOwnProperty(gt)&&Nt!=null&&!M.hasOwnProperty(gt)&&qi(u,f,gt,null,M,Nt);for(Ut in M)Nt=M[Ut],Dt=y[Ut],!M.hasOwnProperty(Ut)||Nt===Dt||Nt==null&&Dt==null||qi(u,f,Ut,Nt,M,Dt)}function K9(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function pZ(){if(typeof performance.getEntriesByType=="function"){for(var u=0,f=0,y=performance.getEntriesByType("resource"),M=0;M<y.length;M++){var I=y[M],z=I.transferSize,ce=I.initiatorType,Ne=I.duration;if(z&&Ne&&K9(ce)){for(ce=0,Ne=I.responseEnd,M+=1;M<y.length;M++){var rt=y[M],Ct=rt.startTime;if(Ct>Ne)break;var Lt=rt.transferSize,Ut=rt.initiatorType;Lt&&K9(Ut)&&(rt=rt.responseEnd,ce+=Lt*(rt<Ne?1:(Ne-Ct)/(rt-Ct)))}if(--M,f+=8*(z+ce)/(I.duration/1e3),u++,10<u)break}}if(0<u)return f/u/1e6}return navigator.connection&&(u=navigator.connection.downlink,typeof u=="number")?u:5}var XE=null,YE=null;function C3(u){return u.nodeType===9?u:u.ownerDocument}function Z9(u){switch(u){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Q9(u,f){if(u===0)switch(f){case"svg":return 1;case"math":return 2;default:return 0}return u===1&&f==="foreignObject"?0:u}function KE(u,f){return u==="textarea"||u==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.children=="bigint"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var ZE=null;function mZ(){var u=window.event;return u&&u.type==="popstate"?u===ZE?!1:(ZE=u,!0):(ZE=null,!1)}var J9=typeof setTimeout=="function"?setTimeout:void 0,gZ=typeof clearTimeout=="function"?clearTimeout:void 0,eP=typeof Promise=="function"?Promise:void 0,vZ=typeof queueMicrotask=="function"?queueMicrotask:typeof eP<"u"?function(u){return eP.resolve(null).then(u).catch(xZ)}:J9;function xZ(u){setTimeout(function(){throw u})}function i0(u){return u==="head"}function tP(u,f){var y=f,M=0;do{var I=y.nextSibling;if(u.removeChild(y),I&&I.nodeType===8)if(y=I.data,y==="/$"||y==="/&"){if(M===0){u.removeChild(I),_x(f);return}M--}else if(y==="$"||y==="$?"||y==="$~"||y==="$!"||y==="&")M++;else if(y==="html")Pb(u.ownerDocument.documentElement);else if(y==="head"){y=u.ownerDocument.head,Pb(y);for(var z=y.firstChild;z;){var ce=z.nextSibling,Ne=z.nodeName;z[bn]||Ne==="SCRIPT"||Ne==="STYLE"||Ne==="LINK"&&z.rel.toLowerCase()==="stylesheet"||y.removeChild(z),z=ce}}else y==="body"&&Pb(u.ownerDocument.body);y=I}while(y);_x(f)}function nP(u,f){var y=u;u=0;do{var M=y.nextSibling;if(y.nodeType===1?f?(y._stashedDisplay=y.style.display,y.style.display="none"):(y.style.display=y._stashedDisplay||"",y.getAttribute("style")===""&&y.removeAttribute("style")):y.nodeType===3&&(f?(y._stashedText=y.nodeValue,y.nodeValue=""):y.nodeValue=y._stashedText||""),M&&M.nodeType===8)if(y=M.data,y==="/$"){if(u===0)break;u--}else y!=="$"&&y!=="$?"&&y!=="$~"&&y!=="$!"||u++;y=M}while(y)}function QE(u){var f=u.firstChild;for(f&&f.nodeType===10&&(f=f.nextSibling);f;){var y=f;switch(f=f.nextSibling,y.nodeName){case"HTML":case"HEAD":case"BODY":QE(y),Ln(y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(y.rel.toLowerCase()==="stylesheet")continue}u.removeChild(y)}}function yZ(u,f,y,M){for(;u.nodeType===1;){var I=y;if(u.nodeName.toLowerCase()!==f.toLowerCase()){if(!M&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(M){if(!u[bn])switch(f){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(z=u.getAttribute("rel"),z==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(z!==I.rel||u.getAttribute("href")!==(I.href==null||I.href===""?null:I.href)||u.getAttribute("crossorigin")!==(I.crossOrigin==null?null:I.crossOrigin)||u.getAttribute("title")!==(I.title==null?null:I.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(z=u.getAttribute("src"),(z!==(I.src==null?null:I.src)||u.getAttribute("type")!==(I.type==null?null:I.type)||u.getAttribute("crossorigin")!==(I.crossOrigin==null?null:I.crossOrigin))&&z&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(f==="input"&&u.type==="hidden"){var z=I.name==null?null:""+I.name;if(I.type==="hidden"&&u.getAttribute("name")===z)return u}else return u;if(u=ku(u.nextSibling),u===null)break}return null}function bZ(u,f,y){if(f==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!y||(u=ku(u.nextSibling),u===null))return null;return u}function rP(u,f){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!f||(u=ku(u.nextSibling),u===null))return null;return u}function JE(u){return u.data==="$?"||u.data==="$~"}function eC(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function _Z(u,f){var y=u.ownerDocument;if(u.data==="$~")u._reactRetry=f;else if(u.data!=="$?"||y.readyState!=="loading")f();else{var M=function(){f(),y.removeEventListener("DOMContentLoaded",M)};y.addEventListener("DOMContentLoaded",M),u._reactRetry=M}}function ku(u){for(;u!=null;u=u.nextSibling){var f=u.nodeType;if(f===1||f===3)break;if(f===8){if(f=u.data,f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"||f==="F!"||f==="F")break;if(f==="/$"||f==="/&")return null}}return u}var tC=null;function iP(u){u=u.nextSibling;for(var f=0;u;){if(u.nodeType===8){var y=u.data;if(y==="/$"||y==="/&"){if(f===0)return ku(u.nextSibling);f--}else y!=="$"&&y!=="$!"&&y!=="$?"&&y!=="$~"&&y!=="&"||f++}u=u.nextSibling}return null}function sP(u){u=u.previousSibling;for(var f=0;u;){if(u.nodeType===8){var y=u.data;if(y==="$"||y==="$!"||y==="$?"||y==="$~"||y==="&"){if(f===0)return u;f--}else y!=="/$"&&y!=="/&"||f++}u=u.previousSibling}return null}function aP(u,f,y){switch(f=C3(y),u){case"html":if(u=f.documentElement,!u)throw Error(r(452));return u;case"head":if(u=f.head,!u)throw Error(r(453));return u;case"body":if(u=f.body,!u)throw Error(r(454));return u;default:throw Error(r(451))}}function Pb(u){for(var f=u.attributes;f.length;)u.removeAttributeNode(f[0]);Ln(u)}var Pu=new Map,oP=new Set;function A3(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var Bh=K.d;K.d={f:SZ,r:wZ,D:MZ,C:TZ,L:EZ,m:CZ,X:NZ,S:AZ,M:RZ};function SZ(){var u=Bh.f(),f=Uc();return u||f}function wZ(u){var f=Bi(u);f!==null&&f.tag===5&&f.type==="form"?u3(f):Bh.r(u)}var xx=typeof document>"u"?null:document;function lP(u,f,y){var M=xx;if(M&&typeof f=="string"&&f){var I=Rn(f);I='link[rel="'+u+'"][href="'+I+'"]',typeof y=="string"&&(I+='[crossorigin="'+y+'"]'),oP.has(I)||(oP.add(I),u={rel:u,crossOrigin:y,href:f},M.querySelector(I)===null&&(f=M.createElement("link"),Do(f,"link",u),ot(f),M.head.appendChild(f)))}}function MZ(u){Bh.D(u),lP("dns-prefetch",u,null)}function TZ(u,f){Bh.C(u,f),lP("preconnect",u,f)}function EZ(u,f,y){Bh.L(u,f,y);var M=xx;if(M&&u&&f){var I='link[rel="preload"][as="'+Rn(f)+'"]';f==="image"&&y&&y.imageSrcSet?(I+='[imagesrcset="'+Rn(y.imageSrcSet)+'"]',typeof y.imageSizes=="string"&&(I+='[imagesizes="'+Rn(y.imageSizes)+'"]')):I+='[href="'+Rn(u)+'"]';var z=I;switch(f){case"style":z=yx(u);break;case"script":z=bx(u)}Pu.has(z)||(u=h({rel:"preload",href:f==="image"&&y&&y.imageSrcSet?void 0:u,as:f},y),Pu.set(z,u),M.querySelector(I)!==null||f==="style"&&M.querySelector(Ib(z))||f==="script"&&M.querySelector(Db(z))||(f=M.createElement("link"),Do(f,"link",u),ot(f),M.head.appendChild(f)))}}function CZ(u,f){Bh.m(u,f);var y=xx;if(y&&u){var M=f&&typeof f.as=="string"?f.as:"script",I='link[rel="modulepreload"][as="'+Rn(M)+'"][href="'+Rn(u)+'"]',z=I;switch(M){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":z=bx(u)}if(!Pu.has(z)&&(u=h({rel:"modulepreload",href:u},f),Pu.set(z,u),y.querySelector(I)===null)){switch(M){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(y.querySelector(Db(z)))return}M=y.createElement("link"),Do(M,"link",u),ot(M),y.head.appendChild(M)}}}function AZ(u,f,y){Bh.S(u,f,y);var M=xx;if(M&&u){var I=ve(M).hoistableStyles,z=yx(u);f=f||"default";var ce=I.get(z);if(!ce){var Ne={loading:0,preload:null};if(ce=M.querySelector(Ib(z)))Ne.loading=5;else{u=h({rel:"stylesheet",href:u,"data-precedence":f},y),(y=Pu.get(z))&&nC(u,y);var rt=ce=M.createElement("link");ot(rt),Do(rt,"link",u),rt._p=new Promise(function(Ct,Lt){rt.onload=Ct,rt.onerror=Lt}),rt.addEventListener("load",function(){Ne.loading|=1}),rt.addEventListener("error",function(){Ne.loading|=2}),Ne.loading|=4,N3(ce,f,M)}ce={type:"stylesheet",instance:ce,count:1,state:Ne},I.set(z,ce)}}}function NZ(u,f){Bh.X(u,f);var y=xx;if(y&&u){var M=ve(y).hoistableScripts,I=bx(u),z=M.get(I);z||(z=y.querySelector(Db(I)),z||(u=h({src:u,async:!0},f),(f=Pu.get(I))&&rC(u,f),z=y.createElement("script"),ot(z),Do(z,"link",u),y.head.appendChild(z)),z={type:"script",instance:z,count:1,state:null},M.set(I,z))}}function RZ(u,f){Bh.M(u,f);var y=xx;if(y&&u){var M=ve(y).hoistableScripts,I=bx(u),z=M.get(I);z||(z=y.querySelector(Db(I)),z||(u=h({src:u,async:!0,type:"module"},f),(f=Pu.get(I))&&rC(u,f),z=y.createElement("script"),ot(z),Do(z,"link",u),y.head.appendChild(z)),z={type:"script",instance:z,count:1,state:null},M.set(I,z))}}function cP(u,f,y,M){var I=(I=re.current)?A3(I):null;if(!I)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof y.precedence=="string"&&typeof y.href=="string"?(f=yx(y.href),y=ve(I).hoistableStyles,M=y.get(f),M||(M={type:"style",instance:null,count:0,state:null},y.set(f,M)),M):{type:"void",instance:null,count:0,state:null};case"link":if(y.rel==="stylesheet"&&typeof y.href=="string"&&typeof y.precedence=="string"){u=yx(y.href);var z=ve(I).hoistableStyles,ce=z.get(u);if(ce||(I=I.ownerDocument||I,ce={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},z.set(u,ce),(z=I.querySelector(Ib(u)))&&!z._p&&(ce.instance=z,ce.state.loading=5),Pu.has(u)||(y={rel:"preload",as:"style",href:y.href,crossOrigin:y.crossOrigin,integrity:y.integrity,media:y.media,hrefLang:y.hrefLang,referrerPolicy:y.referrerPolicy},Pu.set(u,y),z||kZ(I,u,y,ce.state))),f&&M===null)throw Error(r(528,""));return ce}if(f&&M!==null)throw Error(r(529,""));return null;case"script":return f=y.async,y=y.src,typeof y=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=bx(y),y=ve(I).hoistableScripts,M=y.get(f),M||(M={type:"script",instance:null,count:0,state:null},y.set(f,M)),M):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function yx(u){return'href="'+Rn(u)+'"'}function Ib(u){return'link[rel="stylesheet"]['+u+"]"}function uP(u){return h({},u,{"data-precedence":u.precedence,precedence:null})}function kZ(u,f,y,M){u.querySelector('link[rel="preload"][as="style"]['+f+"]")?M.loading=1:(f=u.createElement("link"),M.preload=f,f.addEventListener("load",function(){return M.loading|=1}),f.addEventListener("error",function(){return M.loading|=2}),Do(f,"link",y),ot(f),u.head.appendChild(f))}function bx(u){return'[src="'+Rn(u)+'"]'}function Db(u){return"script[async]"+u}function dP(u,f,y){if(f.count++,f.instance===null)switch(f.type){case"style":var M=u.querySelector('style[data-href~="'+Rn(y.href)+'"]');if(M)return f.instance=M,ot(M),M;var I=h({},y,{"data-href":y.href,"data-precedence":y.precedence,href:null,precedence:null});return M=(u.ownerDocument||u).createElement("style"),ot(M),Do(M,"style",I),N3(M,y.precedence,u),f.instance=M;case"stylesheet":I=yx(y.href);var z=u.querySelector(Ib(I));if(z)return f.state.loading|=4,f.instance=z,ot(z),z;M=uP(y),(I=Pu.get(I))&&nC(M,I),z=(u.ownerDocument||u).createElement("link"),ot(z);var ce=z;return ce._p=new Promise(function(Ne,rt){ce.onload=Ne,ce.onerror=rt}),Do(z,"link",M),f.state.loading|=4,N3(z,y.precedence,u),f.instance=z;case"script":return z=bx(y.src),(I=u.querySelector(Db(z)))?(f.instance=I,ot(I),I):(M=y,(I=Pu.get(z))&&(M=h({},y),rC(M,I)),u=u.ownerDocument||u,I=u.createElement("script"),ot(I),Do(I,"link",M),u.head.appendChild(I),f.instance=I);case"void":return null;default:throw Error(r(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(M=f.instance,f.state.loading|=4,N3(M,y.precedence,u));return f.instance}function N3(u,f,y){for(var M=y.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),I=M.length?M[M.length-1]:null,z=I,ce=0;ce<M.length;ce++){var Ne=M[ce];if(Ne.dataset.precedence===f)z=Ne;else if(z!==I)break}z?z.parentNode.insertBefore(u,z.nextSibling):(f=y.nodeType===9?y.head:y,f.insertBefore(u,f.firstChild))}function nC(u,f){u.crossOrigin==null&&(u.crossOrigin=f.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=f.referrerPolicy),u.title==null&&(u.title=f.title)}function rC(u,f){u.crossOrigin==null&&(u.crossOrigin=f.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=f.referrerPolicy),u.integrity==null&&(u.integrity=f.integrity)}var R3=null;function fP(u,f,y){if(R3===null){var M=new Map,I=R3=new Map;I.set(y,M)}else I=R3,M=I.get(y),M||(M=new Map,I.set(y,M));if(M.has(u))return M;for(M.set(u,null),y=y.getElementsByTagName(u),I=0;I<y.length;I++){var z=y[I];if(!(z[bn]||z[an]||u==="link"&&z.getAttribute("rel")==="stylesheet")&&z.namespaceURI!=="http://www.w3.org/2000/svg"){var ce=z.getAttribute(f)||"";ce=u+ce;var Ne=M.get(ce);Ne?Ne.push(z):M.set(ce,[z])}}return M}function hP(u,f,y){u=u.ownerDocument||u,u.head.insertBefore(y,f==="title"?u.querySelector("head > title"):null)}function PZ(u,f,y){if(y===1||f.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;switch(f.rel){case"stylesheet":return u=f.disabled,typeof f.precedence=="string"&&u==null;default:return!0}case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function pP(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function IZ(u,f,y,M){if(y.type==="stylesheet"&&(typeof M.media!="string"||matchMedia(M.media).matches!==!1)&&(y.state.loading&4)===0){if(y.instance===null){var I=yx(M.href),z=f.querySelector(Ib(I));if(z){f=z._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(u.count++,u=k3.bind(u),f.then(u,u)),y.state.loading|=4,y.instance=z,ot(z);return}z=f.ownerDocument||f,M=uP(M),(I=Pu.get(I))&&nC(M,I),z=z.createElement("link"),ot(z);var ce=z;ce._p=new Promise(function(Ne,rt){ce.onload=Ne,ce.onerror=rt}),Do(z,"link",M),y.instance=z}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(y,f),(f=y.state.preload)&&(y.state.loading&3)===0&&(u.count++,y=k3.bind(u),f.addEventListener("load",y),f.addEventListener("error",y))}}var iC=0;function DZ(u,f){return u.stylesheets&&u.count===0&&I3(u,u.stylesheets),0<u.count||0<u.imgCount?function(y){var M=setTimeout(function(){if(u.stylesheets&&I3(u,u.stylesheets),u.unsuspend){var z=u.unsuspend;u.unsuspend=null,z()}},6e4+f);0<u.imgBytes&&iC===0&&(iC=62500*pZ());var I=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&I3(u,u.stylesheets),u.unsuspend)){var z=u.unsuspend;u.unsuspend=null,z()}},(u.imgBytes>iC?50:800)+f);return u.unsuspend=y,function(){u.unsuspend=null,clearTimeout(M),clearTimeout(I)}}:null}function k3(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)I3(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var P3=null;function I3(u,f){u.stylesheets=null,u.unsuspend!==null&&(u.count++,P3=new Map,f.forEach(OZ,u),P3=null,k3.call(u))}function OZ(u,f){if(!(f.state.loading&4)){var y=P3.get(u);if(y)var M=y.get(null);else{y=new Map,P3.set(u,y);for(var I=u.querySelectorAll("link[data-precedence],style[data-precedence]"),z=0;z<I.length;z++){var ce=I[z];(ce.nodeName==="LINK"||ce.getAttribute("media")!=="not all")&&(y.set(ce.dataset.precedence,ce),M=ce)}M&&y.set(null,M)}I=f.instance,ce=I.getAttribute("data-precedence"),z=y.get(ce)||M,z===M&&y.set(null,I),y.set(ce,I),this.count++,M=k3.bind(this),I.addEventListener("load",M),I.addEventListener("error",M),z?z.parentNode.insertBefore(I,z.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(I,u.firstChild)),f.state.loading|=4}}var Ob={$$typeof:A,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function LZ(u,f,y,M,I,z,ce,Ne,rt){this.tag=1,this.containerInfo=u,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=et(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=et(0),this.hiddenUpdates=et(null),this.identifierPrefix=M,this.onUncaughtError=I,this.onCaughtError=z,this.onRecoverableError=ce,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=rt,this.incompleteTransitions=new Map}function mP(u,f,y,M,I,z,ce,Ne,rt,Ct,Lt,Ut){return u=new LZ(u,f,y,ce,rt,Ct,Lt,Ut,Ne),f=1,z===!0&&(f|=24),z=_s(3,null,null,f),u.current=z,z.stateNode=u,f=Fy(),f.refCount++,u.pooledCache=f,f.refCount++,z.memoizedState={element:M,isDehydrated:y,cache:f},zm(z),u}function gP(u){return u?(u=tf,u):tf}function vP(u,f,y,M,I,z){I=gP(I),M.context===null?M.context=I:M.pendingContext=I,M=gd(f),M.payload={element:y},z=z===void 0?null:z,z!==null&&(M.callback=z),y=uf(u,M,f),y!==null&&(Mr(y,u,f),df(y,u,f))}function xP(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var y=u.retryLane;u.retryLane=y!==0&&y<f?y:f}}function sC(u,f){xP(u,f),(u=u.alternate)&&xP(u,f)}function yP(u){if(u.tag===13||u.tag===31){var f=Co(u,67108864);f!==null&&Mr(f,u,67108864),sC(u,67108864)}}function bP(u){if(u.tag===13||u.tag===31){var f=Rl();f=$e(f);var y=Co(u,f);y!==null&&Mr(y,u,f),sC(u,f)}}var D3=!0;function zZ(u,f,y,M){var I=q.T;q.T=null;var z=K.p;try{K.p=2,aC(u,f,y,M)}finally{K.p=z,q.T=I}}function jZ(u,f,y,M){var I=q.T;q.T=null;var z=K.p;try{K.p=8,aC(u,f,y,M)}finally{K.p=z,q.T=I}}function aC(u,f,y,M){if(D3){var I=oC(M);if(I===null)$E(u,f,M,O3,y),SP(u,M);else if(UZ(I,u,f,y,M))M.stopPropagation();else if(SP(u,M),f&4&&-1<FZ.indexOf(u)){for(;I!==null;){var z=Bi(I);if(z!==null)switch(z.tag){case 3:if(z=z.stateNode,z.current.memoizedState.isDehydrated){var ce=tt(z.pendingLanes);if(ce!==0){var Ne=z;for(Ne.pendingLanes|=2,Ne.entangledLanes|=2;ce;){var rt=1<<31-Se(ce);Ne.entanglements[1]|=rt,ce&=~rt}qt(z),(Bn&6)===0&&(Xs=te()+500,yn(0))}}break;case 31:case 13:Ne=Co(z,2),Ne!==null&&Mr(Ne,z,2),Uc(),sC(z,2)}if(z=oC(M),z===null&&$E(u,f,M,O3,y),z===I)break;I=z}I!==null&&M.stopPropagation()}else $E(u,f,M,null,y)}}function oC(u){return u=Go(u),lC(u)}var O3=null;function lC(u){if(O3=null,u=Fn(u),u!==null){var f=s(u);if(f===null)u=null;else{var y=f.tag;if(y===13){if(u=a(f),u!==null)return u;u=null}else if(y===31){if(u=o(f),u!==null)return u;u=null}else if(y===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;u=null}else f!==u&&(u=null)}}return O3=u,null}function _P(u){switch(u){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(be()){case me:return 2;case ge:return 8;case ke:case Xe:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var cC=!1,s0=null,a0=null,o0=null,Lb=new Map,zb=new Map,l0=[],FZ="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function SP(u,f){switch(u){case"focusin":case"focusout":s0=null;break;case"dragenter":case"dragleave":a0=null;break;case"mouseover":case"mouseout":o0=null;break;case"pointerover":case"pointerout":Lb.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":zb.delete(f.pointerId)}}function jb(u,f,y,M,I,z){return u===null||u.nativeEvent!==z?(u={blockedOn:f,domEventName:y,eventSystemFlags:M,nativeEvent:z,targetContainers:[I]},f!==null&&(f=Bi(f),f!==null&&yP(f)),u):(u.eventSystemFlags|=M,f=u.targetContainers,I!==null&&f.indexOf(I)===-1&&f.push(I),u)}function UZ(u,f,y,M,I){switch(f){case"focusin":return s0=jb(s0,u,f,y,M,I),!0;case"dragenter":return a0=jb(a0,u,f,y,M,I),!0;case"mouseover":return o0=jb(o0,u,f,y,M,I),!0;case"pointerover":var z=I.pointerId;return Lb.set(z,jb(Lb.get(z)||null,u,f,y,M,I)),!0;case"gotpointercapture":return z=I.pointerId,zb.set(z,jb(zb.get(z)||null,u,f,y,M,I)),!0}return!1}function wP(u){var f=Fn(u.target);if(f!==null){var y=s(f);if(y!==null){if(f=y.tag,f===13){if(f=a(y),f!==null){u.blockedOn=f,Ot(u.priority,function(){bP(y)});return}}else if(f===31){if(f=o(y),f!==null){u.blockedOn=f,Ot(u.priority,function(){bP(y)});return}}else if(f===3&&y.stateNode.current.memoizedState.isDehydrated){u.blockedOn=y.tag===3?y.stateNode.containerInfo:null;return}}}u.blockedOn=null}function L3(u){if(u.blockedOn!==null)return!1;for(var f=u.targetContainers;0<f.length;){var y=oC(u.nativeEvent);if(y===null){y=u.nativeEvent;var M=new y.constructor(y.type,y);Xl=M,y.target.dispatchEvent(M),Xl=null}else return f=Bi(y),f!==null&&yP(f),u.blockedOn=y,!1;f.shift()}return!0}function MP(u,f,y){L3(u)&&y.delete(f)}function BZ(){cC=!1,s0!==null&&L3(s0)&&(s0=null),a0!==null&&L3(a0)&&(a0=null),o0!==null&&L3(o0)&&(o0=null),Lb.forEach(MP),zb.forEach(MP)}function z3(u,f){u.blockedOn===f&&(u.blockedOn=null,cC||(cC=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,BZ)))}var j3=null;function TP(u){j3!==u&&(j3=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){j3===u&&(j3=null);for(var f=0;f<u.length;f+=3){var y=u[f],M=u[f+1],I=u[f+2];if(typeof M!="function"){if(lC(M||y)===null)continue;break}var z=Bi(y);z!==null&&(u.splice(f,3),f-=3,fb(z,{pending:!0,data:I,method:y.method,action:M},M,I))}}))}function _x(u){function f(rt){return z3(rt,u)}s0!==null&&z3(s0,u),a0!==null&&z3(a0,u),o0!==null&&z3(o0,u),Lb.forEach(f),zb.forEach(f);for(var y=0;y<l0.length;y++){var M=l0[y];M.blockedOn===u&&(M.blockedOn=null)}for(;0<l0.length&&(y=l0[0],y.blockedOn===null);)wP(y),y.blockedOn===null&&l0.shift();if(y=(u.ownerDocument||u).$$reactFormReplay,y!=null)for(M=0;M<y.length;M+=3){var I=y[M],z=y[M+1],ce=I[On]||null;if(typeof z=="function")ce||TP(y);else if(ce){var Ne=null;if(z&&z.hasAttribute("formAction")){if(I=z,ce=z[On]||null)Ne=ce.formAction;else if(lC(I)!==null)continue}else Ne=ce.action;typeof Ne=="function"?y[M+1]=Ne:(y.splice(M,3),M-=3),TP(y)}}}function EP(){function u(z){z.canIntercept&&z.info==="react-transition"&&z.intercept({handler:function(){return new Promise(function(ce){return I=ce})},focusReset:"manual",scroll:"manual"})}function f(){I!==null&&(I(),I=null),M||setTimeout(y,20)}function y(){if(!M&&!navigation.transition){var z=navigation.currentEntry;z&&z.url!=null&&navigation.navigate(z.url,{state:z.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var M=!1,I=null;return navigation.addEventListener("navigate",u),navigation.addEventListener("navigatesuccess",f),navigation.addEventListener("navigateerror",f),setTimeout(y,100),function(){M=!0,navigation.removeEventListener("navigate",u),navigation.removeEventListener("navigatesuccess",f),navigation.removeEventListener("navigateerror",f),I!==null&&(I(),I=null)}}}function uC(u){this._internalRoot=u}F3.prototype.render=uC.prototype.render=function(u){var f=this._internalRoot;if(f===null)throw Error(r(409));var y=f.current,M=Rl();vP(y,M,u,f,null,null)},F3.prototype.unmount=uC.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var f=u.containerInfo;vP(u.current,2,null,u,null,null),Uc(),f[Bt]=null}};function F3(u){this._internalRoot=u}F3.prototype.unstable_scheduleHydration=function(u){if(u){var f=Et();u={blockedOn:null,target:u,priority:f};for(var y=0;y<l0.length&&f!==0&&f<l0[y].priority;y++);l0.splice(y,0,u),y===0&&wP(u)}};var CP=e.version;if(CP!=="19.2.1")throw Error(r(527,CP,"19.2.1"));K.findDOMNode=function(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(r(188)):(u=Object.keys(u).join(","),Error(r(268,u)));return u=c(f),u=u!==null?d(u):null,u=u===null?null:u.stateNode,u};var HZ={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var U3=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!U3.isDisabled&&U3.supportsFiber)try{De=U3.inject(HZ),Be=U3}catch{}}return Ub.createRoot=function(u,f){if(!i(u))throw Error(r(299));var y=!1,M="",I=v3,z=xb,ce=yb;return f!=null&&(f.unstable_strictMode===!0&&(y=!0),f.identifierPrefix!==void 0&&(M=f.identifierPrefix),f.onUncaughtError!==void 0&&(I=f.onUncaughtError),f.onCaughtError!==void 0&&(z=f.onCaughtError),f.onRecoverableError!==void 0&&(ce=f.onRecoverableError)),f=mP(u,1,!1,null,null,y,M,null,I,z,ce,EP),u[Bt]=f.current,WE(u),new uC(f)},Ub.hydrateRoot=function(u,f,y){if(!i(u))throw Error(r(299));var M=!1,I="",z=v3,ce=xb,Ne=yb,rt=null;return y!=null&&(y.unstable_strictMode===!0&&(M=!0),y.identifierPrefix!==void 0&&(I=y.identifierPrefix),y.onUncaughtError!==void 0&&(z=y.onUncaughtError),y.onCaughtError!==void 0&&(ce=y.onCaughtError),y.onRecoverableError!==void 0&&(Ne=y.onRecoverableError),y.formState!==void 0&&(rt=y.formState)),f=mP(u,1,!0,f,y??null,M,I,rt,z,ce,Ne,EP),f.context=gP(null),y=f.current,M=Rl(),M=$e(M),I=gd(M),I.callback=null,uf(y,I,M),y=M,f.current.lanes=y,ht(f,y),qt(f),u[Bt]=f.current,WE(u),new F3(f)},Ub.version="19.2.1",Ub}var jP;function ZZ(){if(jP)return pC.exports;jP=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),pC.exports=KZ(),pC.exports}var OF=ZZ();/**
 * react-router v7.13.1
 *
 * 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
 */var FP="popstate";function UP(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function QZ(t={}){function e(r,i){var c;let s=(c=i.state)==null?void 0:c.masked,{pathname:a,search:o,hash:l}=s||r.location;return X6("",{pathname:a,search:o,hash:l},i.state&&i.state.usr||null,i.state&&i.state.key||"default",s?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,i){return typeof i=="string"?i:Y_(i)}return eQ(e,n,null,t)}function na(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Vd(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function JZ(){return Math.random().toString(36).substring(2,10)}function BP(t,e){return{usr:t.state,key:t.key,idx:e,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function X6(t,e,n=null,r,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?fy(e):e,state:n,key:e&&e.key||r||JZ(),unstable_mask:i}}function Y_({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function fy(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function eQ(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,a=i.history,o="POP",l=null,c=d();c==null&&(c=0,a.replaceState({...a.state,idx:c},""));function d(){return(a.state||{idx:null}).idx}function h(){o="POP";let w=d(),S=w==null?null:w-c;c=w,l&&l({action:o,location:_.location,delta:S})}function g(w,S){o="PUSH";let E=UP(w)?w:X6(_.location,w,S);c=d()+1;let A=BP(E,c),N=_.createHref(E.unstable_mask||E);try{a.pushState(A,"",N)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(N)}s&&l&&l({action:o,location:_.location,delta:1})}function v(w,S){o="REPLACE";let E=UP(w)?w:X6(_.location,w,S);c=d();let A=BP(E,c),N=_.createHref(E.unstable_mask||E);a.replaceState(A,"",N),s&&l&&l({action:o,location:_.location,delta:0})}function b(w){return tQ(w)}let _={get action(){return o},get location(){return t(i,a)},listen(w){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(FP,h),l=w,()=>{i.removeEventListener(FP,h),l=null}},createHref(w){return e(i,w)},createURL:b,encodeLocation(w){let S=b(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:g,replace:v,go(w){return a.go(w)}};return _}function tQ(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),na(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Y_(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function LF(t,e,n="/"){return nQ(t,e,n,!1)}function nQ(t,e,n,r){let i=typeof e=="string"?fy(e):e,s=up(i.pathname||"/",n);if(s==null)return null;let a=zF(t);rQ(a);let o=null;for(let l=0;o==null&&l<a.length;++l){let c=pQ(s);o=fQ(a[l],c,r)}return o}function zF(t,e=[],n=[],r="",i=!1){let s=(a,o,l=i,c)=>{let d={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&l)return;na(d.relativePath.startsWith(r),`Absolute route path "${d.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),d.relativePath=d.relativePath.slice(r.length)}let h=Qf([r,d.relativePath]),g=n.concat(d);a.children&&a.children.length>0&&(na(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),zF(a.children,e,g,h,l)),!(a.path==null&&!a.index)&&e.push({path:h,score:uQ(h,a.index),routesMeta:g})};return t.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))s(a,o);else for(let c of jF(a.path))s(a,o,!0,c)}),e}function jF(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let a=jF(r.join("/")),o=[];return o.push(...a.map(l=>l===""?s:[s,l].join("/"))),i&&o.push(...a),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function rQ(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:dQ(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var iQ=/^:[\w-]+$/,sQ=3,aQ=2,oQ=1,lQ=10,cQ=-2,HP=t=>t==="*";function uQ(t,e){let n=t.split("/"),r=n.length;return n.some(HP)&&(r+=cQ),e&&(r+=aQ),n.filter(i=>!HP(i)).reduce((i,s)=>i+(iQ.test(s)?sQ:s===""?oQ:lQ),r)}function dQ(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function fQ(t,e,n=!1){let{routesMeta:r}=t,i={},s="/",a=[];for(let o=0;o<r.length;++o){let l=r[o],c=o===r.length-1,d=s==="/"?e:e.slice(s.length)||"/",h=$M({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),g=l.route;if(!h&&c&&n&&!r[r.length-1].route.index&&(h=$M({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!h)return null;Object.assign(i,h.params),a.push({params:i,pathname:Qf([s,h.pathname]),pathnameBase:xQ(Qf([s,h.pathnameBase])),route:g}),h.pathnameBase!=="/"&&(s=Qf([s,h.pathnameBase]))}return a}function $M(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=hQ(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],a=s.replace(/(.)\/+$/,"$1"),o=i.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:h},g)=>{if(d==="*"){let b=o[g]||"";a=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const v=o[g];return h&&!v?c[d]=void 0:c[d]=(v||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:a,pattern:t}}function hQ(t,e=!1,n=!0){Vd(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,l,c,d)=>{if(r.push({paramName:o,isOptional:l!=null}),l){let h=d.charAt(c+a.length);return h&&h!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function pQ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Vd(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function up(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}var mQ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function gQ(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?fy(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=VP(n.substring(1),"/"):s=VP(n,e)):s=e,{pathname:s,search:yQ(r),hash:bQ(i)}}function VP(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function xC(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}].  Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function vQ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function FF(t){let e=vQ(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function y7(t,e,n,r=!1){let i;typeof t=="string"?i=fy(t):(i={...t},na(!i.pathname||!i.pathname.includes("?"),xC("?","pathname","search",i)),na(!i.pathname||!i.pathname.includes("#"),xC("#","pathname","hash",i)),na(!i.search||!i.search.includes("#"),xC("#","search","hash",i)));let s=t===""||i.pathname==="",a=s?"/":i.pathname,o;if(a==null)o=n;else{let h=e.length-1;if(!r&&a.startsWith("..")){let g=a.split("/");for(;g[0]==="..";)g.shift(),h-=1;i.pathname=g.join("/")}o=h>=0?e[h]:"/"}let l=gQ(i,o),c=a&&a!=="/"&&a.endsWith("/"),d=(s||a===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var Qf=t=>t.join("/").replace(/\/\/+/g,"/"),xQ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),yQ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,bQ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,_Q=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function SQ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function wQ(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var UF=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function BF(t,e){let n=t;if(typeof n!="string"||!mQ.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(UF)try{let s=new URL(window.location.href),a=n.startsWith("//")?new URL(s.protocol+n):new URL(n),o=up(a.pathname,e);a.origin===s.origin&&o!=null?n=o+a.search+a.hash:i=!0}catch{Vd(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var HF=["POST","PUT","PATCH","DELETE"];new Set(HF);var MQ=["GET",...HF];new Set(MQ);var hy=T.createContext(null);hy.displayName="DataRouter";var R5=T.createContext(null);R5.displayName="DataRouterState";var TQ=T.createContext(!1),VF=T.createContext({isTransitioning:!1});VF.displayName="ViewTransition";var EQ=T.createContext(new Map);EQ.displayName="Fetchers";var CQ=T.createContext(null);CQ.displayName="Await";var Zu=T.createContext(null);Zu.displayName="Navigation";var qS=T.createContext(null);qS.displayName="Location";var xp=T.createContext({outlet:null,matches:[],isDataRoute:!1});xp.displayName="Route";var b7=T.createContext(null);b7.displayName="RouteError";var GF="REACT_ROUTER_ERROR",AQ="REDIRECT",NQ="ROUTE_ERROR_RESPONSE";function RQ(t){if(t.startsWith(`${GF}:${AQ}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function kQ(t){if(t.startsWith(`${GF}:${NQ}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new _Q(e.status,e.statusText,e.data)}catch{}}function PQ(t,{relative:e}={}){na(XS(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=T.useContext(Zu),{hash:i,pathname:s,search:a}=YS(t,{relative:e}),o=s;return n!=="/"&&(o=s==="/"?n:Qf([n,s])),r.createHref({pathname:o,search:a,hash:i})}function XS(){return T.useContext(qS)!=null}function ch(){return na(XS(),"useLocation() may be used only in the context of a <Router> component."),T.useContext(qS).location}var WF="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function $F(t){T.useContext(Zu).static||T.useLayoutEffect(t)}function k5(){let{isDataRoute:t}=T.useContext(xp);return t?WQ():IQ()}function IQ(){na(XS(),"useNavigate() may be used only in the context of a <Router> component.");let t=T.useContext(hy),{basename:e,navigator:n}=T.useContext(Zu),{matches:r}=T.useContext(xp),{pathname:i}=ch(),s=JSON.stringify(FF(r)),a=T.useRef(!1);return $F(()=>{a.current=!0}),T.useCallback((l,c={})=>{if(Vd(a.current,WF),!a.current)return;if(typeof l=="number"){n.go(l);return}let d=y7(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Qf([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,i,t])}T.createContext(null);function YS(t,{relative:e}={}){let{matches:n}=T.useContext(xp),{pathname:r}=ch(),i=JSON.stringify(FF(n));return T.useMemo(()=>y7(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function DQ(t,e){return qF(t,e)}function qF(t,e,n){var w;na(XS(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=T.useContext(Zu),{matches:i}=T.useContext(xp),s=i[i.length-1],a=s?s.params:{},o=s?s.pathname:"/",l=s?s.pathnameBase:"/",c=s&&s.route;{let S=c&&c.path||"";YF(o,!c||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${o}" (under <Route path="${S}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.

Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}/*`}">.`)}let d=ch(),h;if(e){let S=typeof e=="string"?fy(e):e;na(l==="/"||((w=S.pathname)==null?void 0:w.startsWith(l)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${l}" but pathname "${S.pathname}" was given in the \`location\` prop.`),h=S}else h=d;let g=h.pathname||"/",v=g;if(l!=="/"){let S=l.replace(/^\//,"").split("/");v="/"+g.replace(/^\//,"").split("/").slice(S.length).join("/")}let b=LF(t,{pathname:v});Vd(c||b!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),Vd(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${h.pathname}${h.search}${h.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=FQ(b&&b.map(S=>Object.assign({},S,{params:Object.assign({},a,S.params),pathname:Qf([l,r.encodeLocation?r.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?l:Qf([l,r.encodeLocation?r.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),i,n);return e&&_?T.createElement(qS.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},_):_}function OQ(){let t=GQ(),e=SQ(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",t),a=T.createElement(T.Fragment,null,T.createElement("p",null,"💿 Hey developer 👋"),T.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",T.createElement("code",{style:s},"ErrorBoundary")," or"," ",T.createElement("code",{style:s},"errorElement")," prop on your route.")),T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},e),n?T.createElement("pre",{style:i},n):null,a)}var LQ=T.createElement(OQ,null),XF=class extends T.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,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=kQ(t.digest);n&&(t=n)}let e=t!==void 0?T.createElement(xp.Provider,{value:this.props.routeContext},T.createElement(b7.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?T.createElement(zQ,{error:t},e):e}};XF.contextType=TQ;var yC=new WeakMap;function zQ({children:t,error:e}){let{basename:n}=T.useContext(Zu);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=RQ(e.digest);if(r){let i=yC.get(e);if(i)throw i;let s=BF(r.location,n);if(UF&&!yC.get(e))if(s.isExternal||r.reloadDocument)window.location.href=s.absoluteURL||s.to;else{const a=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw yC.set(e,a),a}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function jQ({routeContext:t,match:e,children:n}){let r=T.useContext(hy);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),T.createElement(xp.Provider,{value:t},n)}function FQ(t,e=[],n){let r=n==null?void 0:n.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let i=t,s=r==null?void 0:r.errors;if(s!=null){let d=i.findIndex(h=>h.route.id&&(s==null?void 0:s[h.route.id])!==void 0);na(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,d+1))}let a=!1,o=-1;if(n&&r){a=r.renderFallback;for(let d=0;d<i.length;d++){let h=i[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(o=d),h.route.id){let{loaderData:g,errors:v}=r,b=h.route.loader&&!g.hasOwnProperty(h.route.id)&&(!v||v[h.route.id]===void 0);if(h.route.lazy||b){n.isStatic&&(a=!0),o>=0?i=i.slice(0,o+1):i=[i[0]];break}}}}let l=n==null?void 0:n.onError,c=r&&l?(d,h)=>{var g,v;l(d,{location:r.location,params:((v=(g=r.matches)==null?void 0:g[0])==null?void 0:v.params)??{},unstable_pattern:wQ(r.matches),errorInfo:h})}:void 0;return i.reduceRight((d,h,g)=>{let v,b=!1,_=null,w=null;r&&(v=s&&h.route.id?s[h.route.id]:void 0,_=h.route.errorElement||LQ,a&&(o<0&&g===0?(YF("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,w=null):o===g&&(b=!0,w=h.route.hydrateFallbackElement||null)));let S=e.concat(i.slice(0,g+1)),E=()=>{let A;return v?A=_:b?A=w:h.route.Component?A=T.createElement(h.route.Component,null):h.route.element?A=h.route.element:A=d,T.createElement(jQ,{match:h,routeContext:{outlet:d,matches:S,isDataRoute:r!=null},children:A})};return r&&(h.route.ErrorBoundary||h.route.errorElement||g===0)?T.createElement(XF,{location:r.location,revalidation:r.revalidation,component:_,error:v,children:E(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:c}):E()},null)}function _7(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function UQ(t){let e=T.useContext(hy);return na(e,_7(t)),e}function BQ(t){let e=T.useContext(R5);return na(e,_7(t)),e}function HQ(t){let e=T.useContext(xp);return na(e,_7(t)),e}function S7(t){let e=HQ(t),n=e.matches[e.matches.length-1];return na(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function VQ(){return S7("useRouteId")}function GQ(){var r;let t=T.useContext(b7),e=BQ("useRouteError"),n=S7("useRouteError");return t!==void 0?t:(r=e.errors)==null?void 0:r[n]}function WQ(){let{router:t}=UQ("useNavigate"),e=S7("useNavigate"),n=T.useRef(!1);return $F(()=>{n.current=!0}),T.useCallback(async(i,s={})=>{Vd(n.current,WF),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var GP={};function YF(t,e,n){!e&&!GP[t]&&(GP[t]=!0,Vd(!1,n))}T.memo($Q);function $Q({routes:t,future:e,state:n,isStatic:r,onError:i}){return qF(t,void 0,{state:n,isStatic:r,onError:i})}function Df(t){na(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function qQ({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:a}){na(!XS(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=t.replace(/^\/*/,"/"),l=T.useMemo(()=>({basename:o,navigator:i,static:s,unstable_useTransitions:a,future:{}}),[o,i,s,a]);typeof n=="string"&&(n=fy(n));let{pathname:c="/",search:d="",hash:h="",state:g=null,key:v="default",unstable_mask:b}=n,_=T.useMemo(()=>{let w=up(c,o);return w==null?null:{location:{pathname:w,search:d,hash:h,state:g,key:v,unstable_mask:b},navigationType:r}},[o,c,d,h,g,v,r,b]);return Vd(_!=null,`<Router basename="${o}"> is not able to match the URL "${c}${d}${h}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:T.createElement(Zu.Provider,{value:l},T.createElement(qS.Provider,{children:e,value:_}))}function XQ({children:t,location:e}){return DQ(Y6(t),e)}function Y6(t,e=[]){let n=[];return T.Children.forEach(t,(r,i)=>{if(!T.isValidElement(r))return;let s=[...e,i];if(r.type===T.Fragment){n.push.apply(n,Y6(r.props.children,s));return}na(r.type===Df,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),na(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=Y6(r.props.children,s)),n.push(a)}),n}var NM="get",RM="application/x-www-form-urlencoded";function P5(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function YQ(t){return P5(t)&&t.tagName.toLowerCase()==="button"}function KQ(t){return P5(t)&&t.tagName.toLowerCase()==="form"}function ZQ(t){return P5(t)&&t.tagName.toLowerCase()==="input"}function QQ(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function JQ(t,e){return t.button===0&&(!e||e==="_self")&&!QQ(t)}function K6(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function eJ(t,e){let n=K6(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}var H3=null;function tJ(){if(H3===null)try{new FormData(document.createElement("form"),0),H3=!1}catch{H3=!0}return H3}var nJ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function bC(t){return t!=null&&!nJ.has(t)?(Vd(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${RM}"`),null):t}function rJ(t,e){let n,r,i,s,a;if(KQ(t)){let o=t.getAttribute("action");r=o?up(o,e):null,n=t.getAttribute("method")||NM,i=bC(t.getAttribute("enctype"))||RM,s=new FormData(t)}else if(YQ(t)||ZQ(t)&&(t.type==="submit"||t.type==="image")){let o=t.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||o.getAttribute("action");if(r=l?up(l,e):null,n=t.getAttribute("formmethod")||o.getAttribute("method")||NM,i=bC(t.getAttribute("formenctype"))||bC(o.getAttribute("enctype"))||RM,s=new FormData(o,t),!tJ()){let{name:c,type:d,value:h}=t;if(d==="image"){let g=c?`${c}.`:"";s.append(`${g}x`,"0"),s.append(`${g}y`,"0")}else c&&s.append(c,h)}}else{if(P5(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=NM,r=null,i=RM,a=t}return s&&i==="text/plain"&&(a=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function w7(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function iJ(t,e,n,r){let i=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:e&&up(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function sJ(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function aJ(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function oJ(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let a=await sJ(s,n);return a.links?a.links():[]}return[]}));return dJ(r.flat(1).filter(aJ).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function WP(t,e,n,r,i,s){let a=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,o=(l,c)=>{var d;return n[c].pathname!==l.pathname||((d=n[c].route.path)==null?void 0:d.endsWith("*"))&&n[c].params["*"]!==l.params["*"]};return s==="assets"?e.filter((l,c)=>a(l,c)||o(l,c)):s==="data"?e.filter((l,c)=>{var h;let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(a(l,c)||o(l,c))return!0;if(l.route.shouldRevalidate){let g=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((h=n[0])==null?void 0:h.params)||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function lJ(t,e,{includeHydrateFallback:n}={}){return cJ(t.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function cJ(t){return[...new Set(t)]}function uJ(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function dJ(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(uJ(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function KF(){let t=T.useContext(hy);return w7(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function fJ(){let t=T.useContext(R5);return w7(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var M7=T.createContext(void 0);M7.displayName="FrameworkContext";function ZF(){let t=T.useContext(M7);return w7(t,"You must render this element inside a <HydratedRouter> element"),t}function hJ(t,e){let n=T.useContext(M7),[r,i]=T.useState(!1),[s,a]=T.useState(!1),{onFocus:o,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:h}=e,g=T.useRef(null);T.useEffect(()=>{if(t==="render"&&a(!0),t==="viewport"){let _=S=>{S.forEach(E=>{a(E.isIntersecting)})},w=new IntersectionObserver(_,{threshold:.5});return g.current&&w.observe(g.current),()=>{w.disconnect()}}},[t]),T.useEffect(()=>{if(r){let _=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(_)}}},[r]);let v=()=>{i(!0)},b=()=>{i(!1),a(!1)};return n?t!=="intent"?[s,g,{}]:[s,g,{onFocus:Bb(o,v),onBlur:Bb(l,b),onMouseEnter:Bb(c,v),onMouseLeave:Bb(d,b),onTouchStart:Bb(h,v)}]:[!1,g,{}]}function Bb(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function pJ({page:t,...e}){let{router:n}=KF(),r=T.useMemo(()=>LF(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?T.createElement(gJ,{page:t,matches:r,...e}):null}function mJ(t){let{manifest:e,routeModules:n}=ZF(),[r,i]=T.useState([]);return T.useEffect(()=>{let s=!1;return oJ(t,e,n).then(a=>{s||i(a)}),()=>{s=!0}},[t,e,n]),r}function gJ({page:t,matches:e,...n}){let r=ch(),{future:i,manifest:s,routeModules:a}=ZF(),{basename:o}=KF(),{loaderData:l,matches:c}=fJ(),d=T.useMemo(()=>WP(t,e,c,s,r,"data"),[t,e,c,s,r]),h=T.useMemo(()=>WP(t,e,c,s,r,"assets"),[t,e,c,s,r]),g=T.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let _=new Set,w=!1;if(e.forEach(E=>{var N;let A=s.routes[E.route.id];!A||!A.hasLoader||(!d.some(D=>D.route.id===E.route.id)&&E.route.id in l&&((N=a[E.route.id])!=null&&N.shouldRevalidate)||A.hasClientLoader?w=!0:_.add(E.route.id))}),_.size===0)return[];let S=iJ(t,o,i.unstable_trailingSlashAwareDataRequests,"data");return w&&_.size>0&&S.searchParams.set("_routes",e.filter(E=>_.has(E.route.id)).map(E=>E.route.id).join(",")),[S.pathname+S.search]},[o,i.unstable_trailingSlashAwareDataRequests,l,r,s,d,e,t,a]),v=T.useMemo(()=>lJ(h,s),[h,s]),b=mJ(h);return T.createElement(T.Fragment,null,g.map(_=>T.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...n})),v.map(_=>T.createElement("link",{key:_,rel:"modulepreload",href:_,...n})),b.map(({key:_,link:w})=>T.createElement("link",{key:_,nonce:n.nonce,...w,crossOrigin:w.crossOrigin??n.crossOrigin})))}function vJ(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var xJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{xJ&&(window.__reactRouterVersion="7.13.1")}catch{}function yJ({basename:t,children:e,unstable_useTransitions:n,window:r}){let i=T.useRef();i.current==null&&(i.current=QZ({window:r,v5Compat:!0}));let s=i.current,[a,o]=T.useState({action:s.action,location:s.location}),l=T.useCallback(c=>{n===!1?o(c):T.startTransition(()=>o(c))},[n]);return T.useLayoutEffect(()=>s.listen(l),[s,l]),T.createElement(qQ,{basename:t,children:e,location:a.location,navigationType:a.action,navigator:s,unstable_useTransitions:n})}var QF=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qM=T.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:s,replace:a,unstable_mask:o,state:l,target:c,to:d,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:v,...b},_){let{basename:w,navigator:S,unstable_useTransitions:E}=T.useContext(Zu),A=typeof d=="string"&&QF.test(d),N=BF(d,w);d=N.to;let D=PQ(d,{relative:i}),P=ch(),L=null;if(o){let B=y7(o,[],P.unstable_mask?P.unstable_mask.pathname:"/",!0);w!=="/"&&(B.pathname=B.pathname==="/"?w:Qf([w,B.pathname])),L=S.createHref(B)}let[R,O,W]=hJ(r,b),F=wJ(d,{replace:a,unstable_mask:o,state:l,target:c,preventScrollReset:h,relative:i,viewTransition:g,unstable_defaultShouldRevalidate:v,unstable_useTransitions:E});function V(B){e&&e(B),B.defaultPrevented||F(B)}let G=!(N.isExternal||s),Z=T.createElement("a",{...b,...W,href:(G?L:void 0)||N.absoluteURL||D,onClick:G?V:e,ref:vJ(_,O),target:c,"data-discover":!A&&n==="render"?"true":void 0});return R&&!A?T.createElement(T.Fragment,null,Z,T.createElement(pJ,{page:D})):Z});qM.displayName="Link";var bJ=T.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:a,viewTransition:o,children:l,...c},d){let h=YS(a,{relative:c.relative}),g=ch(),v=T.useContext(R5),{navigator:b,basename:_}=T.useContext(Zu),w=v!=null&&AJ(h)&&o===!0,S=b.encodeLocation?b.encodeLocation(h).pathname:h.pathname,E=g.pathname,A=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;n||(E=E.toLowerCase(),A=A?A.toLowerCase():null,S=S.toLowerCase()),A&&_&&(A=up(A,_)||A);const N=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let D=E===S||!i&&E.startsWith(S)&&E.charAt(N)==="/",P=A!=null&&(A===S||!i&&A.startsWith(S)&&A.charAt(S.length)==="/"),L={isActive:D,isPending:P,isTransitioning:w},R=D?e:void 0,O;typeof r=="function"?O=r(L):O=[r,D?"active":null,P?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let W=typeof s=="function"?s(L):s;return T.createElement(qM,{...c,"aria-current":R,className:O,ref:d,style:W,to:a,viewTransition:o},typeof l=="function"?l(L):l)});bJ.displayName="NavLink";var _J=T.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:a=NM,action:o,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:h,unstable_defaultShouldRevalidate:g,...v},b)=>{let{unstable_useTransitions:_}=T.useContext(Zu),w=EJ(),S=CJ(o,{relative:c}),E=a.toLowerCase()==="get"?"get":"post",A=typeof o=="string"&&QF.test(o),N=D=>{if(l&&l(D),D.defaultPrevented)return;D.preventDefault();let P=D.nativeEvent.submitter,L=(P==null?void 0:P.getAttribute("formmethod"))||a,R=()=>w(P||D.currentTarget,{fetcherKey:e,method:L,navigate:n,replace:i,state:s,relative:c,preventScrollReset:d,viewTransition:h,unstable_defaultShouldRevalidate:g});_&&n!==!1?T.startTransition(()=>R()):R()};return T.createElement("form",{ref:b,method:E,action:S,onSubmit:r?l:N,...v,"data-discover":!A&&t==="render"?"true":void 0})});_J.displayName="Form";function SJ(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function JF(t){let e=T.useContext(hy);return na(e,SJ(t)),e}function wJ(t,{target:e,replace:n,unstable_mask:r,state:i,preventScrollReset:s,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:l,unstable_useTransitions:c}={}){let d=k5(),h=ch(),g=YS(t,{relative:a});return T.useCallback(v=>{if(JQ(v,e)){v.preventDefault();let b=n!==void 0?n:Y_(h)===Y_(g),_=()=>d(t,{replace:b,unstable_mask:r,state:i,preventScrollReset:s,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:l});c?T.startTransition(()=>_()):_()}},[h,d,g,n,r,i,e,t,s,a,o,l,c])}function T7(t){Vd(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=T.useRef(K6(t)),n=T.useRef(!1),r=ch(),i=T.useMemo(()=>eJ(r.search,n.current?null:e.current),[r.search]),s=k5(),a=T.useCallback((o,l)=>{const c=K6(typeof o=="function"?o(new URLSearchParams(i)):o);n.current=!0,s("?"+c,l)},[s,i]);return[i,a]}var MJ=0,TJ=()=>`__${String(++MJ)}__`;function EJ(){let{router:t}=JF("useSubmit"),{basename:e}=T.useContext(Zu),n=VQ(),r=t.fetch,i=t.navigate;return T.useCallback(async(s,a={})=>{let{action:o,method:l,encType:c,formData:d,body:h}=rJ(s,e);if(a.navigate===!1){let g=a.fetcherKey||TJ();await r(g,n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||l,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:d,body:h,formMethod:a.method||l,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,e,n])}function CJ(t,{relative:e}={}){let{basename:n}=T.useContext(Zu),r=T.useContext(xp);na(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...YS(t||".",{relative:e})},a=ch();if(t==null){s.search=a.search;let o=new URLSearchParams(s.search),l=o.getAll("index");if(l.some(d=>d==="")){o.delete("index"),l.filter(h=>h).forEach(h=>o.append("index",h));let d=o.toString();s.search=d?`?${d}`:""}}return(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Qf([n,s.pathname])),Y_(s)}function AJ(t,{relative:e}={}){let n=T.useContext(VF);na(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=JF("useViewTransitionState"),i=YS(t,{relative:e});if(!n.isTransitioning)return!1;let s=up(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=up(n.nextLocation.pathname,r)||n.nextLocation.pathname;return $M(i.pathname,a)!=null||$M(i.pathname,s)!=null}var Ld=DF();const NJ=dy(Ld);var py=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},RJ={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},R0,x7,_F,kJ=(_F=class{constructor(){zn(this,R0,RJ);zn(this,x7,!1)}setTimeoutProvider(t){un(this,R0,t)}setTimeout(t,e){return it(this,R0).setTimeout(t,e)}clearTimeout(t){it(this,R0).clearTimeout(t)}setInterval(t,e){return it(this,R0).setInterval(t,e)}clearInterval(t){it(this,R0).clearInterval(t)}},R0=new WeakMap,x7=new WeakMap,_F),Rg=new kJ;function PJ(t){setTimeout(t,0)}var Zg=typeof window>"u"||"Deno"in globalThis;function Ol(){}function IJ(t,e){return typeof t=="function"?t(e):t}function Z6(t){return typeof t=="number"&&t>=0&&t!==1/0}function eU(t,e){return Math.max(t+(e||0)-Date.now(),0)}function G0(t,e){return typeof t=="function"?t(e):t}function zu(t,e){return typeof t=="function"?t(e):t}function $P(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:o}=t;if(a){if(r){if(e.queryHash!==E7(a,e.options))return!1}else if(!Z_(e.queryKey,a))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||i&&i!==e.state.fetchStatus||s&&!s(e))}function qP(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(K_(e.options.mutationKey)!==K_(s))return!1}else if(!Z_(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function E7(t,e){return((e==null?void 0:e.queryKeyHashFn)||K_)(t)}function K_(t){return JSON.stringify(t,(e,n)=>Q6(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Z_(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>Z_(t[n],e[n])):!1}var DJ=Object.prototype.hasOwnProperty;function C7(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=XP(t)&&XP(e);if(!r&&!(Q6(t)&&Q6(e)))return e;const s=(r?t:Object.keys(t)).length,a=r?e:Object.keys(e),o=a.length,l=r?new Array(o):{};let c=0;for(let d=0;d<o;d++){const h=r?d:a[d],g=t[h],v=e[h];if(g===v){l[h]=g,(r?d<s:DJ.call(t,h))&&c++;continue}if(g===null||v===null||typeof g!="object"||typeof v!="object"){l[h]=v;continue}const b=C7(g,v,n+1);l[h]=b,b===g&&c++}return s===o&&c===s?t:l}function XM(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function XP(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Q6(t){if(!YP(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!YP(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function YP(t){return Object.prototype.toString.call(t)==="[object Object]"}function OJ(t){return new Promise(e=>{Rg.setTimeout(e,t)})}function J6(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?C7(t,e):e}function Xd(t){return t}function LJ(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function zJ(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var A7=Symbol();function tU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===A7?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function nU(t,e){return typeof t=="function"?t(...e):!!t}function jJ(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var Lg,k0,T1,SF,FJ=(SF=class extends py{constructor(){super();zn(this,Lg);zn(this,k0);zn(this,T1);un(this,T1,e=>{if(!Zg&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){it(this,k0)||this.setEventListener(it(this,T1))}onUnsubscribe(){var e;this.hasListeners()||((e=it(this,k0))==null||e.call(this),un(this,k0,void 0))}setEventListener(e){var n;un(this,T1,e),(n=it(this,k0))==null||n.call(this),un(this,k0,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){it(this,Lg)!==e&&(un(this,Lg,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof it(this,Lg)=="boolean"?it(this,Lg):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Lg=new WeakMap,k0=new WeakMap,T1=new WeakMap,SF),N7=new FJ;function eN(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var UJ=PJ;function BJ(){let t=[],e=0,n=o=>{o()},r=o=>{o()},i=UJ;const s=o=>{e?t.push(o):i(()=>{n(o)})},a=()=>{const o=t;t=[],o.length&&i(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||a()}return l},batchCalls:o=>(...l)=>{s(()=>{o(...l)})},schedule:s,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{i=o}}}var Ba=BJ(),E1,P0,C1,wF,HJ=(wF=class extends py{constructor(){super();zn(this,E1,!0);zn(this,P0);zn(this,C1);un(this,C1,e=>{if(!Zg&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){it(this,P0)||this.setEventListener(it(this,C1))}onUnsubscribe(){var e;this.hasListeners()||((e=it(this,P0))==null||e.call(this),un(this,P0,void 0))}setEventListener(e){var n;un(this,C1,e),(n=it(this,P0))==null||n.call(this),un(this,P0,e(this.setOnline.bind(this)))}setOnline(e){it(this,E1)!==e&&(un(this,E1,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return it(this,E1)}},E1=new WeakMap,P0=new WeakMap,C1=new WeakMap,wF),YM=new HJ;function VJ(t){return Math.min(1e3*2**t,3e4)}function rU(t){return(t??"online")==="online"?YM.isOnline():!0}var tN=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function iU(t){let e=!1,n=0,r;const i=eN(),s=()=>i.status!=="pending",a=_=>{var w;if(!s()){const S=new tN(_);g(S),(w=t.onCancel)==null||w.call(t,S)}},o=()=>{e=!0},l=()=>{e=!1},c=()=>N7.isFocused()&&(t.networkMode==="always"||YM.isOnline())&&t.canRun(),d=()=>rU(t.networkMode)&&t.canRun(),h=_=>{s()||(r==null||r(),i.resolve(_))},g=_=>{s()||(r==null||r(),i.reject(_))},v=()=>new Promise(_=>{var w;r=S=>{(s()||c())&&_(S)},(w=t.onPause)==null||w.call(t)}).then(()=>{var _;r=void 0,s()||(_=t.onContinue)==null||_.call(t)}),b=()=>{if(s())return;let _;const w=n===0?t.initialPromise:void 0;try{_=w??t.fn()}catch(S){_=Promise.reject(S)}Promise.resolve(_).then(h).catch(S=>{var P;if(s())return;const E=t.retry??(Zg?0:3),A=t.retryDelay??VJ,N=typeof A=="function"?A(n,S):A,D=E===!0||typeof E=="number"&&n<E||typeof E=="function"&&E(n,S);if(e||!D){g(S);return}n++,(P=t.onFail)==null||P.call(t,n,S),OJ(N).then(()=>c()?void 0:v()).then(()=>{e?g(S):b()})})};return{promise:i,status:()=>i.status,cancel:a,continue:()=>(r==null||r(),i),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?b():v().then(b),i)}}var zg,MF,sU=(MF=class{constructor(){zn(this,zg)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Z6(this.gcTime)&&un(this,zg,Rg.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Zg?1/0:300*1e3))}clearGcTimeout(){it(this,zg)&&(Rg.clearTimeout(it(this,zg)),un(this,zg,void 0))}},zg=new WeakMap,MF),jg,A1,Ou,Fg,xo,zS,Ug,kd,Kh,TF,GJ=(TF=class extends sU{constructor(e){super();zn(this,kd);zn(this,jg);zn(this,A1);zn(this,Ou);zn(this,Fg);zn(this,xo);zn(this,zS);zn(this,Ug);un(this,Ug,!1),un(this,zS,e.defaultOptions),this.setOptions(e.options),this.observers=[],un(this,Fg,e.client),un(this,Ou,it(this,Fg).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,un(this,jg,ZP(this.options)),this.state=e.state??it(this,jg),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=it(this,xo))==null?void 0:e.promise}setOptions(e){if(this.options={...it(this,zS),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=ZP(this.options);n.data!==void 0&&(this.setState(KP(n.data,n.dataUpdatedAt)),un(this,jg,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&it(this,Ou).remove(this)}setData(e,n){const r=J6(this.state.data,e,this.options);return fr(this,kd,Kh).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){fr(this,kd,Kh).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=it(this,xo))==null?void 0:r.promise;return(i=it(this,xo))==null||i.cancel(e),n?n.then(Ol).catch(Ol):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(it(this,jg))}isActive(){return this.observers.some(e=>zu(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===A7||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>G0(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!eU(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=it(this,xo))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=it(this,xo))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),it(this,Ou).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(it(this,xo)&&(it(this,Ug)?it(this,xo).cancel({revert:!0}):it(this,xo).cancelRetry()),this.scheduleGc()),it(this,Ou).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||fr(this,kd,Kh).call(this,{type:"invalidate"})}async fetch(e,n){var l,c,d,h,g,v,b,_,w,S,E,A;if(this.state.fetchStatus!=="idle"&&((l=it(this,xo))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(it(this,xo))return it(this,xo).continueRetry(),it(this,xo).promise}if(e&&this.setOptions(e),!this.options.queryFn){const N=this.observers.find(D=>D.options.queryFn);N&&this.setOptions(N.options)}const r=new AbortController,i=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(un(this,Ug,!0),r.signal)})},s=()=>{const N=tU(this.options,n),P=(()=>{const L={client:it(this,Fg),queryKey:this.queryKey,meta:this.meta};return i(L),L})();return un(this,Ug,!1),this.options.persister?this.options.persister(N,P,this):N(P)},o=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:it(this,Fg),state:this.state,fetchFn:s};return i(N),N})();(c=this.options.behavior)==null||c.onFetch(o,this),un(this,A1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&fr(this,kd,Kh).call(this,{type:"fetch",meta:(h=o.fetchOptions)==null?void 0:h.meta}),un(this,xo,iU({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:N=>{N instanceof tN&&N.revert&&this.setState({...it(this,A1),fetchStatus:"idle"}),r.abort()},onFail:(N,D)=>{fr(this,kd,Kh).call(this,{type:"failed",failureCount:N,error:D})},onPause:()=>{fr(this,kd,Kh).call(this,{type:"pause"})},onContinue:()=>{fr(this,kd,Kh).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const N=await it(this,xo).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(v=(g=it(this,Ou).config).onSuccess)==null||v.call(g,N,this),(_=(b=it(this,Ou).config).onSettled)==null||_.call(b,N,this.state.error,this),N}catch(N){if(N instanceof tN){if(N.silent)return it(this,xo).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw fr(this,kd,Kh).call(this,{type:"error",error:N}),(S=(w=it(this,Ou).config).onError)==null||S.call(w,N,this),(A=(E=it(this,Ou).config).onSettled)==null||A.call(E,this.state.data,N,this),N}finally{this.scheduleGc()}}},jg=new WeakMap,A1=new WeakMap,Ou=new WeakMap,Fg=new WeakMap,xo=new WeakMap,zS=new WeakMap,Ug=new WeakMap,kd=new WeakSet,Kh=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...aU(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...KP(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return un(this,A1,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Ba.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),it(this,Ou).notify({query:this,type:"updated",action:e})})},TF);function aU(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:rU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function KP(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ZP(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var bc,oi,jS,Dl,Bg,N1,ep,I0,FS,R1,k1,Hg,Vg,D0,P1,Ui,f_,nN,rN,iN,sN,aN,oN,lN,oU,EF,R7=(EF=class extends py{constructor(e,n){super();zn(this,Ui);zn(this,bc);zn(this,oi);zn(this,jS);zn(this,Dl);zn(this,Bg);zn(this,N1);zn(this,ep);zn(this,I0);zn(this,FS);zn(this,R1);zn(this,k1);zn(this,Hg);zn(this,Vg);zn(this,D0);zn(this,P1,new Set);this.options=n,un(this,bc,e),un(this,I0,null),un(this,ep,eN()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(it(this,oi).addObserver(this),QP(it(this,oi),this.options)?fr(this,Ui,f_).call(this):this.updateResult(),fr(this,Ui,sN).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return cN(it(this,oi),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return cN(it(this,oi),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,fr(this,Ui,aN).call(this),fr(this,Ui,oN).call(this),it(this,oi).removeObserver(this)}setOptions(e){const n=this.options,r=it(this,oi);if(this.options=it(this,bc).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof zu(this.options.enabled,it(this,oi))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");fr(this,Ui,lN).call(this),it(this,oi).setOptions(this.options),n._defaulted&&!XM(this.options,n)&&it(this,bc).getQueryCache().notify({type:"observerOptionsUpdated",query:it(this,oi),observer:this});const i=this.hasListeners();i&&JP(it(this,oi),r,this.options,n)&&fr(this,Ui,f_).call(this),this.updateResult(),i&&(it(this,oi)!==r||zu(this.options.enabled,it(this,oi))!==zu(n.enabled,it(this,oi))||G0(this.options.staleTime,it(this,oi))!==G0(n.staleTime,it(this,oi)))&&fr(this,Ui,nN).call(this);const s=fr(this,Ui,rN).call(this);i&&(it(this,oi)!==r||zu(this.options.enabled,it(this,oi))!==zu(n.enabled,it(this,oi))||s!==it(this,D0))&&fr(this,Ui,iN).call(this,s)}getOptimisticResult(e){const n=it(this,bc).getQueryCache().build(it(this,bc),e),r=this.createResult(n,e);return $J(this,r)&&(un(this,Dl,r),un(this,N1,this.options),un(this,Bg,it(this,oi).state)),r}getCurrentResult(){return it(this,Dl)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&it(this,ep).status==="pending"&&it(this,ep).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){it(this,P1).add(e)}getCurrentQuery(){return it(this,oi)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=it(this,bc).defaultQueryOptions(e),r=it(this,bc).getQueryCache().build(it(this,bc),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return fr(this,Ui,f_).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),it(this,Dl)))}createResult(e,n){var O;const r=it(this,oi),i=this.options,s=it(this,Dl),a=it(this,Bg),o=it(this,N1),c=e!==r?e.state:it(this,jS),{state:d}=e;let h={...d},g=!1,v;if(n._optimisticResults){const W=this.hasListeners(),F=!W&&QP(e,n),V=W&&JP(e,r,n,i);(F||V)&&(h={...h,...aU(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:b,errorUpdatedAt:_,status:w}=h;v=h.data;let S=!1;if(n.placeholderData!==void 0&&v===void 0&&w==="pending"){let W;s!=null&&s.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(W=s.data,S=!0):W=typeof n.placeholderData=="function"?n.placeholderData((O=it(this,k1))==null?void 0:O.state.data,it(this,k1)):n.placeholderData,W!==void 0&&(w="success",v=J6(s==null?void 0:s.data,W,n),g=!0)}if(n.select&&v!==void 0&&!S)if(s&&v===(a==null?void 0:a.data)&&n.select===it(this,FS))v=it(this,R1);else try{un(this,FS,n.select),v=n.select(v),v=J6(s==null?void 0:s.data,v,n),un(this,R1,v),un(this,I0,null)}catch(W){un(this,I0,W)}it(this,I0)&&(b=it(this,I0),v=it(this,R1),_=Date.now(),w="error");const E=h.fetchStatus==="fetching",A=w==="pending",N=w==="error",D=A&&E,P=v!==void 0,R={status:w,fetchStatus:h.fetchStatus,isPending:A,isSuccess:w==="success",isError:N,isInitialLoading:D,isLoading:D,data:v,dataUpdatedAt:h.dataUpdatedAt,error:b,errorUpdatedAt:_,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:E,isRefetching:E&&!A,isLoadingError:N&&!P,isPaused:h.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:N&&P,isStale:k7(e,n),refetch:this.refetch,promise:it(this,ep),isEnabled:zu(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const W=R.data!==void 0,F=R.status==="error"&&!W,V=B=>{F?B.reject(R.error):W&&B.resolve(R.data)},G=()=>{const B=un(this,ep,R.promise=eN());V(B)},Z=it(this,ep);switch(Z.status){case"pending":e.queryHash===r.queryHash&&V(Z);break;case"fulfilled":(F||R.data!==Z.value)&&G();break;case"rejected":(!F||R.error!==Z.reason)&&G();break}}return R}updateResult(){const e=it(this,Dl),n=this.createResult(it(this,oi),this.options);if(un(this,Bg,it(this,oi).state),un(this,N1,this.options),it(this,Bg).data!==void 0&&un(this,k1,it(this,oi)),XM(n,e))return;un(this,Dl,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!it(this,P1).size)return!0;const a=new Set(s??it(this,P1));return this.options.throwOnError&&a.add("error"),Object.keys(it(this,Dl)).some(o=>{const l=o;return it(this,Dl)[l]!==e[l]&&a.has(l)})};fr(this,Ui,oU).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&fr(this,Ui,sN).call(this)}},bc=new WeakMap,oi=new WeakMap,jS=new WeakMap,Dl=new WeakMap,Bg=new WeakMap,N1=new WeakMap,ep=new WeakMap,I0=new WeakMap,FS=new WeakMap,R1=new WeakMap,k1=new WeakMap,Hg=new WeakMap,Vg=new WeakMap,D0=new WeakMap,P1=new WeakMap,Ui=new WeakSet,f_=function(e){fr(this,Ui,lN).call(this);let n=it(this,oi).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Ol)),n},nN=function(){fr(this,Ui,aN).call(this);const e=G0(this.options.staleTime,it(this,oi));if(Zg||it(this,Dl).isStale||!Z6(e))return;const r=eU(it(this,Dl).dataUpdatedAt,e)+1;un(this,Hg,Rg.setTimeout(()=>{it(this,Dl).isStale||this.updateResult()},r))},rN=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(it(this,oi)):this.options.refetchInterval)??!1},iN=function(e){fr(this,Ui,oN).call(this),un(this,D0,e),!(Zg||zu(this.options.enabled,it(this,oi))===!1||!Z6(it(this,D0))||it(this,D0)===0)&&un(this,Vg,Rg.setInterval(()=>{(this.options.refetchIntervalInBackground||N7.isFocused())&&fr(this,Ui,f_).call(this)},it(this,D0)))},sN=function(){fr(this,Ui,nN).call(this),fr(this,Ui,iN).call(this,fr(this,Ui,rN).call(this))},aN=function(){it(this,Hg)&&(Rg.clearTimeout(it(this,Hg)),un(this,Hg,void 0))},oN=function(){it(this,Vg)&&(Rg.clearInterval(it(this,Vg)),un(this,Vg,void 0))},lN=function(){const e=it(this,bc).getQueryCache().build(it(this,bc),this.options);if(e===it(this,oi))return;const n=it(this,oi);un(this,oi,e),un(this,jS,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},oU=function(e){Ba.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(it(this,Dl))}),it(this,bc).getQueryCache().notify({query:it(this,oi),type:"observerResultsUpdated"})})},EF);function WJ(t,e){return zu(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function QP(t,e){return WJ(t,e)||t.state.data!==void 0&&cN(t,e,e.refetchOnMount)}function cN(t,e,n){if(zu(e.enabled,t)!==!1&&G0(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&k7(t,e)}return!1}function JP(t,e,n,r){return(t!==e||zu(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&k7(t,n)}function k7(t,e){return zu(e.enabled,t)!==!1&&t.isStaleByTime(G0(e.staleTime,t))}function $J(t,e){return!XM(t.getCurrentResult(),e)}function eI(t){return{onFetch:(e,n)=>{var d,h,g,v,b;const r=e.options,i=(g=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:g.direction,s=((v=e.state.data)==null?void 0:v.pages)||[],a=((b=e.state.data)==null?void 0:b.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let _=!1;const w=A=>{jJ(A,()=>e.signal,()=>_=!0)},S=tU(e.options,e.fetchOptions),E=async(A,N,D)=>{if(_)return Promise.reject();if(N==null&&A.pages.length)return Promise.resolve(A);const L=(()=>{const F={client:e.client,queryKey:e.queryKey,pageParam:N,direction:D?"backward":"forward",meta:e.options.meta};return w(F),F})(),R=await S(L),{maxPages:O}=e.options,W=D?zJ:LJ;return{pages:W(A.pages,R,O),pageParams:W(A.pageParams,N,O)}};if(i&&s.length){const A=i==="backward",N=A?qJ:tI,D={pages:s,pageParams:a},P=N(r,D);o=await E(D,P,A)}else{const A=t??s.length;do{const N=l===0?a[0]??r.initialPageParam:tI(r,o);if(l>0&&N==null)break;o=await E(o,N),l++}while(l<A)}return o};e.options.persister?e.fetchFn=()=>{var _,w;return(w=(_=e.options).persister)==null?void 0:w.call(_,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function tI(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function qJ(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var US,zf,ol,Gg,jf,w0,CF,XJ=(CF=class extends sU{constructor(e){super();zn(this,jf);zn(this,US);zn(this,zf);zn(this,ol);zn(this,Gg);un(this,US,e.client),this.mutationId=e.mutationId,un(this,ol,e.mutationCache),un(this,zf,[]),this.state=e.state||YJ(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){it(this,zf).includes(e)||(it(this,zf).push(e),this.clearGcTimeout(),it(this,ol).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){un(this,zf,it(this,zf).filter(n=>n!==e)),this.scheduleGc(),it(this,ol).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){it(this,zf).length||(this.state.status==="pending"?this.scheduleGc():it(this,ol).remove(this))}continue(){var e;return((e=it(this,Gg))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,l,c,d,h,g,v,b,_,w,S,E,A,N,D,P,L;const n=()=>{fr(this,jf,w0).call(this,{type:"continue"})},r={client:it(this,US),meta:this.options.meta,mutationKey:this.options.mutationKey};un(this,Gg,iU({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,O)=>{fr(this,jf,w0).call(this,{type:"failed",failureCount:R,error:O})},onPause:()=>{fr(this,jf,w0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>it(this,ol).canRun(this)}));const i=this.state.status==="pending",s=!it(this,Gg).canStart();try{if(i)n();else{fr(this,jf,w0).call(this,{type:"pending",variables:e,isPaused:s}),it(this,ol).config.onMutate&&await it(this,ol).config.onMutate(e,this,r);const O=await((o=(a=this.options).onMutate)==null?void 0:o.call(a,e,r));O!==this.state.context&&fr(this,jf,w0).call(this,{type:"pending",context:O,variables:e,isPaused:s})}const R=await it(this,Gg).start();return await((c=(l=it(this,ol).config).onSuccess)==null?void 0:c.call(l,R,e,this.state.context,this,r)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,R,e,this.state.context,r)),await((v=(g=it(this,ol).config).onSettled)==null?void 0:v.call(g,R,null,this.state.variables,this.state.context,this,r)),await((_=(b=this.options).onSettled)==null?void 0:_.call(b,R,null,e,this.state.context,r)),fr(this,jf,w0).call(this,{type:"success",data:R}),R}catch(R){try{await((S=(w=it(this,ol).config).onError)==null?void 0:S.call(w,R,e,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((A=(E=this.options).onError)==null?void 0:A.call(E,R,e,this.state.context,r))}catch(O){Promise.reject(O)}try{await((D=(N=it(this,ol).config).onSettled)==null?void 0:D.call(N,void 0,R,this.state.variables,this.state.context,this,r))}catch(O){Promise.reject(O)}try{await((L=(P=this.options).onSettled)==null?void 0:L.call(P,void 0,R,e,this.state.context,r))}catch(O){Promise.reject(O)}throw fr(this,jf,w0).call(this,{type:"error",error:R}),R}finally{it(this,ol).runNext(this)}}},US=new WeakMap,zf=new WeakMap,ol=new WeakMap,Gg=new WeakMap,jf=new WeakSet,w0=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ba.batch(()=>{it(this,zf).forEach(r=>{r.onMutationUpdate(e)}),it(this,ol).notify({mutation:this,type:"updated",action:e})})},CF);function YJ(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var tp,Pd,BS,AF,KJ=(AF=class extends py{constructor(e={}){super();zn(this,tp);zn(this,Pd);zn(this,BS);this.config=e,un(this,tp,new Set),un(this,Pd,new Map),un(this,BS,0)}build(e,n,r){const i=new XJ({client:e,mutationCache:this,mutationId:++B3(this,BS)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){it(this,tp).add(e);const n=V3(e);if(typeof n=="string"){const r=it(this,Pd).get(n);r?r.push(e):it(this,Pd).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(it(this,tp).delete(e)){const n=V3(e);if(typeof n=="string"){const r=it(this,Pd).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&it(this,Pd).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=V3(e);if(typeof n=="string"){const r=it(this,Pd).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=V3(e);if(typeof n=="string"){const i=(r=it(this,Pd).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Ba.batch(()=>{it(this,tp).forEach(e=>{this.notify({type:"removed",mutation:e})}),it(this,tp).clear(),it(this,Pd).clear()})}getAll(){return Array.from(it(this,tp))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>qP(n,r))}findAll(e={}){return this.getAll().filter(n=>qP(e,n))}notify(e){Ba.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Ba.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ol))))}},tp=new WeakMap,Pd=new WeakMap,BS=new WeakMap,AF);function V3(t){var e;return(e=t.options.scope)==null?void 0:e.id}function nI(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function ZJ(t,e,n){const r=t.slice(0);return r[e]=n,r}var I1,Wc,D1,O1,Lu,O0,HS,VS,GS,WS,Ho,uN,dN,fN,hN,pN,NF,QJ=(NF=class extends py{constructor(e,n,r){super();zn(this,Ho);zn(this,I1);zn(this,Wc);zn(this,D1);zn(this,O1);zn(this,Lu);zn(this,O0);zn(this,HS);zn(this,VS);zn(this,GS);zn(this,WS,[]);un(this,I1,e),un(this,O1,r),un(this,D1,[]),un(this,Lu,[]),un(this,Wc,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&it(this,Lu).forEach(e=>{e.subscribe(n=>{fr(this,Ho,hN).call(this,e,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,it(this,Lu).forEach(e=>{e.destroy()})}setQueries(e,n){un(this,D1,e),un(this,O1,n),Ba.batch(()=>{const r=it(this,Lu),i=fr(this,Ho,fN).call(this,it(this,D1));i.forEach(h=>h.observer.setOptions(h.defaultedQueryOptions));const s=i.map(h=>h.observer),a=s.map(h=>h.getCurrentResult()),o=r.length!==s.length,l=s.some((h,g)=>h!==r[g]),c=o||l,d=c?!0:a.some((h,g)=>{const v=it(this,Wc)[g];return!v||!XM(h,v)});!c&&!d||(c&&(un(this,WS,i),un(this,Lu,s)),un(this,Wc,a),this.hasListeners()&&(c&&(nI(r,s).forEach(h=>{h.destroy()}),nI(s,r).forEach(h=>{h.subscribe(g=>{fr(this,Ho,hN).call(this,h,g)})})),fr(this,Ho,pN).call(this)))})}getCurrentResult(){return it(this,Wc)}getQueries(){return it(this,Lu).map(e=>e.getCurrentQuery())}getObservers(){return it(this,Lu)}getOptimisticResult(e,n){const r=fr(this,Ho,fN).call(this,e),i=r.map(a=>a.observer.getOptimisticResult(a.defaultedQueryOptions)),s=r.map(a=>a.defaultedQueryOptions.queryHash);return[i,a=>fr(this,Ho,dN).call(this,a??i,n,s),()=>fr(this,Ho,uN).call(this,i,r)]}},I1=new WeakMap,Wc=new WeakMap,D1=new WeakMap,O1=new WeakMap,Lu=new WeakMap,O0=new WeakMap,HS=new WeakMap,VS=new WeakMap,GS=new WeakMap,WS=new WeakMap,Ho=new WeakSet,uN=function(e,n){return n.map((r,i)=>{const s=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?s:r.observer.trackResult(s,a=>{n.forEach(o=>{o.observer.trackProp(a)})})})},dN=function(e,n,r){if(n){const i=it(this,GS),s=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((a,o)=>a!==i[o]));return(!it(this,O0)||it(this,Wc)!==it(this,VS)||s||n!==it(this,HS))&&(un(this,HS,n),un(this,VS,it(this,Wc)),r!==void 0&&un(this,GS,r),un(this,O0,C7(it(this,O0),n(e)))),it(this,O0)}return e},fN=function(e){const n=new Map;it(this,Lu).forEach(i=>{const s=i.options.queryHash;if(!s)return;const a=n.get(s);a?a.push(i):n.set(s,[i])});const r=[];return e.forEach(i=>{var l;const s=it(this,I1).defaultQueryOptions(i),o=((l=n.get(s.queryHash))==null?void 0:l.shift())??new R7(it(this,I1),s);r.push({defaultedQueryOptions:s,observer:o})}),r},hN=function(e,n){const r=it(this,Lu).indexOf(e);r!==-1&&(un(this,Wc,ZJ(it(this,Wc),r,n)),fr(this,Ho,pN).call(this))},pN=function(){var e;if(this.hasListeners()){const n=it(this,O0),r=fr(this,Ho,uN).call(this,it(this,Wc),it(this,WS)),i=fr(this,Ho,dN).call(this,r,(e=it(this,O1))==null?void 0:e.combine);n!==i&&Ba.batch(()=>{this.listeners.forEach(s=>{s(it(this,Wc))})})}},NF),Ff,RF,JJ=(RF=class extends py{constructor(e={}){super();zn(this,Ff);this.config=e,un(this,Ff,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??E7(i,n);let a=this.get(s);return a||(a=new GJ({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){it(this,Ff).has(e.queryHash)||(it(this,Ff).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=it(this,Ff).get(e.queryHash);n&&(e.destroy(),n===e&&it(this,Ff).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ba.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return it(this,Ff).get(e)}getAll(){return[...it(this,Ff).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>$P(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>$P(e,r)):n}notify(e){Ba.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Ba.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ba.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ff=new WeakMap,RF),ha,L0,z0,L1,z1,j0,j1,F1,kF,eee=(kF=class{constructor(t={}){zn(this,ha);zn(this,L0);zn(this,z0);zn(this,L1);zn(this,z1);zn(this,j0);zn(this,j1);zn(this,F1);un(this,ha,t.queryCache||new JJ),un(this,L0,t.mutationCache||new KJ),un(this,z0,t.defaultOptions||{}),un(this,L1,new Map),un(this,z1,new Map),un(this,j0,0)}mount(){B3(this,j0)._++,it(this,j0)===1&&(un(this,j1,N7.subscribe(async t=>{t&&(await this.resumePausedMutations(),it(this,ha).onFocus())})),un(this,F1,YM.subscribe(async t=>{t&&(await this.resumePausedMutations(),it(this,ha).onOnline())})))}unmount(){var t,e;B3(this,j0)._--,it(this,j0)===0&&((t=it(this,j1))==null||t.call(this),un(this,j1,void 0),(e=it(this,F1))==null||e.call(this),un(this,F1,void 0))}isFetching(t){return it(this,ha).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return it(this,L0).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=it(this,ha).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=it(this,ha).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(G0(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return it(this,ha).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=it(this,ha).get(r.queryHash),s=i==null?void 0:i.state.data,a=IJ(e,s);if(a!==void 0)return it(this,ha).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(t,e,n){return Ba.batch(()=>it(this,ha).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=it(this,ha).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=it(this,ha);Ba.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=it(this,ha);return Ba.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Ba.batch(()=>it(this,ha).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Ol).catch(Ol)}invalidateQueries(t,e={}){return Ba.batch(()=>(it(this,ha).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Ba.batch(()=>it(this,ha).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ol)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ol)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=it(this,ha).build(this,e);return n.isStaleByTime(G0(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ol).catch(Ol)}fetchInfiniteQuery(t){return t.behavior=eI(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ol).catch(Ol)}ensureInfiniteQueryData(t){return t.behavior=eI(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return YM.isOnline()?it(this,L0).resumePausedMutations():Promise.resolve()}getQueryCache(){return it(this,ha)}getMutationCache(){return it(this,L0)}getDefaultOptions(){return it(this,z0)}setDefaultOptions(t){un(this,z0,t)}setQueryDefaults(t,e){it(this,L1).set(K_(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...it(this,L1).values()],n={};return e.forEach(r=>{Z_(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){it(this,z1).set(K_(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...it(this,z1).values()],n={};return e.forEach(r=>{Z_(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...it(this,z0).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=E7(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===A7&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...it(this,z0).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){it(this,ha).clear(),it(this,L0).clear()}},ha=new WeakMap,L0=new WeakMap,z0=new WeakMap,L1=new WeakMap,z1=new WeakMap,j0=new WeakMap,j1=new WeakMap,F1=new WeakMap,kF),lU=T.createContext(void 0),my=t=>{const e=T.useContext(lU);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},tee=({client:t,children:e})=>(T.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),p.jsx(lU.Provider,{value:t,children:e})),cU=T.createContext(!1),uU=()=>T.useContext(cU);cU.Provider;function nee(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var ree=T.createContext(nee()),dU=()=>T.useContext(ree),fU=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?nU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},hU=t=>{T.useEffect(()=>{t.clearReset()},[t])},pU=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||nU(n,[t.error,r])),mU=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},iee=(t,e)=>t.isLoading&&t.isFetching&&!e,mN=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,gN=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function see({queries:t,...e},n){const r=my(),i=uU(),s=dU(),a=T.useMemo(()=>t.map(_=>{const w=r.defaultQueryOptions(_);return w._optimisticResults=i?"isRestoring":"optimistic",w}),[t,r,i]);a.forEach(_=>{mU(_);const w=r.getQueryCache().get(_.queryHash);fU(_,s,w)}),hU(s);const[o]=T.useState(()=>new QJ(r,a,e)),[l,c,d]=o.getOptimisticResult(a,e.combine),h=!i&&e.subscribed!==!1;T.useSyncExternalStore(T.useCallback(_=>h?o.subscribe(Ba.batchCalls(_)):Ol,[o,h]),()=>o.getCurrentResult(),()=>o.getCurrentResult()),T.useEffect(()=>{o.setQueries(a,e)},[a,e,o]);const v=l.some((_,w)=>mN(a[w],_))?l.flatMap((_,w)=>{const S=a[w];if(S&&mN(S,_)){const E=new R7(r,S);return gN(S,E,s)}return[]}):[];if(v.length>0)throw Promise.all(v);const b=l.find((_,w)=>{const S=a[w];return S&&pU({result:_,errorResetBoundary:s,throwOnError:S.throwOnError,query:r.getQueryCache().get(S.queryHash),suspense:S.suspense})});if(b!=null&&b.error)throw b.error;return c(d())}function aee(t,e,n){var g,v,b,_;const r=uU(),i=dU(),s=my(),a=s.defaultQueryOptions(t);(v=(g=s.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||v.call(g,a);const o=s.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",mU(a),fU(a,i,o),hU(i);const l=!s.getQueryCache().get(a.queryHash),[c]=T.useState(()=>new e(s,a)),d=c.getOptimisticResult(a),h=!r&&t.subscribed!==!1;if(T.useSyncExternalStore(T.useCallback(w=>{const S=h?c.subscribe(Ba.batchCalls(w)):Ol;return c.updateResult(),S},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),T.useEffect(()=>{c.setOptions(a)},[a,c]),mN(a,d))throw gN(a,c,i);if(pU({result:d,errorResetBoundary:i,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw d.error;if((_=(b=s.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||_.call(b,a,d),a.experimental_prefetchInRender&&!Zg&&iee(d,r)){const w=l?gN(a,c,i):o==null?void 0:o.promise;w==null||w.catch(Ol).finally(()=>{c.updateResult()})}return a.notifyOnChangeProps?d:c.trackResult(d)}function ps(t,e){return aee(t,R7)}const Bf={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function gU(t){return"init"in t}function vN(t){return!!t.write}function rI(t){return"v"in t||"e"in t}function KM(t){if("e"in t)throw t.e;if((Bf?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v}function ZM(t){return typeof(t==null?void 0:t.then)=="function"}function vU(t,e,n){if(!n.p.has(t)){n.p.add(t);const r=()=>n.p.delete(t);e.then(r,r)}}function xU(t,e,n){var r;const i=new Set;for(const s of((r=n.get(t))==null?void 0:r.t)||[])i.add(s);for(const s of e.p)i.add(s);return i}const oee=(t,e,...n)=>e.read(...n),lee=(t,e,...n)=>e.write(...n),cee=(t,e)=>{var n;return(n=e.INTERNAL_onInit)==null?void 0:n.call(e,t)},uee=(t,e,n)=>{var r;return(r=e.onMount)==null?void 0:r.call(e,n)},dee=(t,e)=>{var n;const r=io(t),i=r[0],s=r[6],a=r[9];if((Bf?"production":void 0)!=="production"&&!e)throw new Error("Atom is undefined or null");let o=i.get(e);return o||(o={d:new Map,p:new Set,n:0},i.set(e,o),(n=s.i)==null||n.call(s,e),a==null||a(t,e)),o},fee=t=>{const e=io(t),n=e[1],r=e[3],i=e[4],s=e[5],a=e[6],o=e[13],l=[],c=d=>{try{d()}catch(h){l.push(h)}};do{a.f&&c(a.f);const d=new Set,h=d.add.bind(d);r.forEach(g=>{var v;return(v=n.get(g))==null?void 0:v.l.forEach(h)}),r.clear(),s.forEach(h),s.clear(),i.forEach(h),i.clear(),d.forEach(c),r.size&&o(t)}while(r.size||s.size||i.size);if(l.length)throw new AggregateError(l)},hee=t=>{const e=io(t),n=e[1],r=e[2],i=e[3],s=e[11],a=e[14],o=e[17],l=[],c=new WeakSet,d=new WeakSet,h=Array.from(i);for(;h.length;){const g=h[h.length-1],v=s(t,g);if(d.has(g)){h.pop();continue}if(c.has(g)){if(r.get(g)===v.n)l.push([g,v]);else if((Bf?"production":void 0)!=="production"&&r.has(g))throw new Error("[Bug] invalidated atom exists");d.add(g),h.pop();continue}c.add(g);for(const b of xU(g,v,n))c.has(b)||h.push(b)}for(let g=l.length-1;g>=0;--g){const[v,b]=l[g];let _=!1;for(const w of b.d.keys())if(w!==v&&i.has(w)){_=!0;break}_&&(a(t,v),o(t,v)),r.delete(v)}},xN=new WeakSet,pee=(t,e)=>{var n,r;const i=io(t),s=i[1],a=i[2],o=i[3],l=i[6],c=i[7],d=i[11],h=i[12],g=i[13],v=i[14],b=i[16],_=i[17],w=i[20],S=i[26],E=d(t,e);if(rI(E)){if(s.has(e)&&a.get(e)!==E.n)return E;let G=!1;for(const[Z,B]of E.d)if(v(t,Z).n!==B){G=!0;break}if(!G)return E}let A=!0;const N=new Set(E.d.keys()),D=new Map,P=()=>{for(const G of N)D.has(G)||E.d.delete(G)},L=()=>{if(s.has(e)){const G=!o.size;_(t,e),G&&(g(t),h(t))}},R=G=>{var Z;if(G===e){const q=d(t,G);if(!rI(q))if(gU(G))w(t,G,G.init);else throw new Error("no atom init");return KM(q)}const B=v(t,G);try{return KM(B)}finally{D.set(G,B.n),E.d.set(G,B.n),ZM(E.v)&&vU(e,E.v,B),s.has(e)&&((Z=s.get(G))==null||Z.t.add(e)),A||L()}};let O,W;const F={get signal(){return O||(O=new AbortController),O.signal},get setSelf(){return(Bf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(Bf?"production":void 0)!=="production"&&!vN(e)&&console.warn("setSelf function cannot be used with read-only atom"),!W&&vN(e)&&(W=(...G)=>{if((Bf?"production":void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)try{return b(t,e,...G)}finally{g(t),h(t)}}),W}},V=E.n;try{(Bf?"production":void 0)!=="production"&&xN.delete(t);const G=c(t,e,R,F);if((Bf?"production":void 0)!=="production"&&xN.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),w(t,e,G),ZM(G)){S(t,G,()=>O==null?void 0:O.abort());const Z=()=>{P(),L()};G.then(Z,Z)}else P();return(n=l.r)==null||n.call(l,e),E}catch(G){return delete E.v,E.e=G,++E.n,E}finally{A=!1,V!==E.n&&a.get(e)===V&&(a.set(e,E.n),o.add(e),(r=l.c)==null||r.call(l,e))}},mee=(t,e)=>{const n=io(t),r=n[1],i=n[2],s=n[11],a=[e];for(;a.length;){const o=a.pop(),l=s(t,o);for(const c of xU(o,l,r)){const d=s(t,c);i.get(c)!==d.n&&(i.set(c,d.n),a.push(c))}}},gee=(t,e,...n)=>{const r=io(t),i=r[3],s=r[6],a=r[8],o=r[11],l=r[12],c=r[13],d=r[14],h=r[15],g=r[16],v=r[17],b=r[20];let _=!0;const w=E=>KM(d(t,E)),S=(E,...A)=>{var N;const D=o(t,E);try{if(E===e){if(!gU(E))throw new Error("atom not writable");(Bf?"production":void 0)!=="production"&&xN.add(t);const P=D.n,L=A[0];b(t,E,L),v(t,E),P!==D.n&&(i.add(E),h(t,E),(N=s.c)==null||N.call(s,E));return}else return g(t,E,...A)}finally{_||(c(t),l(t))}};try{return a(t,e,w,S,...n)}finally{_=!1}},vee=(t,e)=>{var n;const r=io(t),i=r[1],s=r[3],a=r[6],o=r[11],l=r[15],c=r[18],d=r[19],h=o(t,e),g=i.get(e);if(g){for(const[v,b]of h.d)if(!g.d.has(v)){const _=o(t,v);c(t,v).t.add(e),g.d.add(v),b!==_.n&&(s.add(v),l(t,v),(n=a.c)==null||n.call(a,v))}for(const v of g.d)if(!h.d.has(v)){g.d.delete(v);const b=d(t,v);b==null||b.t.delete(e)}}},xee=(t,e)=>{var n;const r=io(t),i=r[1],s=r[4],a=r[6],o=r[10],l=r[11],c=r[12],d=r[13],h=r[14],g=r[16],v=r[18],b=l(t,e);let _=i.get(e);if(!_){h(t,e);for(const w of b.d.keys())v(t,w).t.add(e);if(_={l:new Set,d:new Set(b.d.keys()),t:new Set},i.set(e,_),vN(e)){const w=()=>{let S=!0;const E=(...A)=>{try{return g(t,e,...A)}finally{S||(d(t),c(t))}};try{const A=o(t,e,E);A&&(_.u=()=>{S=!0;try{A()}finally{S=!1}})}finally{S=!1}};s.add(w)}(n=a.m)==null||n.call(a,e)}return _},yee=(t,e)=>{var n,r;const i=io(t),s=i[1],a=i[5],o=i[6],l=i[11],c=i[19],d=l(t,e);let h=s.get(e);if(!h||h.l.size)return h;let g=!1;for(const v of h.t)if((n=s.get(v))!=null&&n.d.has(e)){g=!0;break}if(!g){h.u&&a.add(h.u),h=void 0,s.delete(e);for(const v of d.d.keys()){const b=c(t,v);b==null||b.t.delete(e)}(r=o.u)==null||r.call(o,e);return}return h},bee=(t,e,n)=>{const r=io(t),i=r[11],s=r[27],a=i(t,e),o="v"in a,l=a.v;if(ZM(n))for(const c of a.d.keys())vU(e,n,i(t,c));a.v=n,delete a.e,(!o||!Object.is(l,a.v))&&(++a.n,ZM(l)&&s(t,l))},_ee=(t,e)=>{const n=io(t)[14];return KM(n(t,e))},See=(t,e,...n)=>{const r=io(t),i=r[12],s=r[13],a=r[16];try{return a(t,e,...n)}finally{s(t),i(t)}},wee=(t,e,n)=>{const r=io(t),i=r[12],s=r[18],a=r[19],l=s(t,e).l;return l.add(n),i(t),()=>{l.delete(n),a(t,e),i(t)}},Mee=(t,e,n)=>{const i=io(t)[25];let s=i.get(e);if(!s){s=new Set,i.set(e,s);const a=()=>i.delete(e);e.then(a,a)}s.add(n)},Tee=(t,e)=>{const i=io(t)[25].get(e);i==null||i.forEach(s=>s())},yU=new WeakMap,io=t=>{const e=yU.get(t);if((Bf?"production":void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function Eee(t){const e=io(t),n=e[24];return n?n(e):e}function Cee(...t){const e={get(r){const i=io(e)[21];return i(e,r)},set(r,...i){const s=io(e)[22];return s(e,r,...i)},sub(r,i){const s=io(e)[23];return s(e,r,i)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},oee,lee,cee,uee,dee,fee,hee,pee,mee,gee,vee,xee,yee,bee,_ee,See,wee,void 0,new WeakMap,Mee,Tee].map((r,i)=>t[i]||r);return yU.set(e,Object.freeze(n)),e}const bU={};let Aee=0;function Gr(t,e){const n=`atom${++Aee}`,r={toString(){return(bU?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=Nee,r.write=Ree),e&&(r.write=e),r}function Nee(t){return t(this)}function Ree(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}function _U(){return Cee()}let Hb;function kee(){return Hb||(Hb=_U(),(bU?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Hb),globalThis.__JOTAI_DEFAULT_STORE__!==Hb&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Hb}const Pee={},yN=T.createContext(void 0);function SU(t){return T.useContext(yN)||kee()}function Iee({children:t,store:e}){const n=T.useRef(null);return e?T.createElement(yN.Provider,{value:e},t):(n.current===null&&(n.current=_U()),T.createElement(yN.Provider,{value:n.current},t))}const bN=t=>typeof(t==null?void 0:t.then)=="function",_N=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},Dee=Qr.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(_N(t),t)}),_C=new WeakMap,iI=(t,e,n)=>{const i=Eee(t)[26];let s=_C.get(e);return s||(s=new Promise((a,o)=>{let l=e;const c=g=>v=>{l===g&&a(v)},d=g=>v=>{l===g&&o(v)},h=()=>{try{const g=n();bN(g)?(_C.set(g,s),l=g,g.then(c(g),d(g)),i(t,g,h)):a(g)}catch(g){o(g)}};e.then(c(e),d(e)),i(t,e,h)}),_C.set(e,s)),s};function ki(t,e){const{delay:n,unstable_promiseStatus:r=!Qr.use}={},i=SU(),[[s,a,o],l]=T.useReducer(d=>{const h=i.get(t);return Object.is(d[0],h)&&d[1]===i&&d[2]===t?d:[h,i,t]},void 0,()=>[i.get(t),i,t]);let c=s;if((a!==i||o!==t)&&(l(),c=i.get(t)),T.useEffect(()=>{const d=i.sub(t,()=>{if(r)try{const h=i.get(t);bN(h)&&_N(iI(i,h,()=>i.get(t)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),d},[i,t,n,r]),T.useDebugValue(c),bN(c)){const d=iI(i,c,()=>i.get(t));return r&&_N(d),Dee(d)}return c}function zd(t,e){const n=SU();return T.useCallback((...i)=>{if((Pee?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...i)},[n,t])}function cn(t,e){return[ki(t),zd(t)]}function sI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function I5(...t){return e=>{let n=!1;const r=t.map(i=>{const s=sI(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():sI(t[i],null)}}}}function Lr(...t){return T.useCallback(I5(...t),t)}function q0(t){const e=Oee(t),n=T.forwardRef((r,i)=>{const{children:s,...a}=r,o=T.Children.toArray(s),l=o.find(Lee);if(l){const c=l.props.children,d=o.map(h=>h===l?T.Children.count(c)>1?T.Children.only(null):T.isValidElement(c)?c.props.children:null:h);return p.jsx(e,{...a,ref:i,children:T.isValidElement(c)?T.cloneElement(c,void 0,d):null})}return p.jsx(e,{...a,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var wU=q0("Slot");function Oee(t){const e=T.forwardRef((n,r)=>{const{children:i,...s}=n;if(T.isValidElement(i)){const a=jee(i),o=zee(s,i.props);return i.type!==T.Fragment&&(o.ref=r?I5(r,a):a),T.cloneElement(i,o)}return T.Children.count(i)>1?T.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var MU=Symbol("radix.slottable");function TU(t){const e=({children:n})=>p.jsx(p.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=MU,e}function Lee(t){return T.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===MU}function zee(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function jee(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Fee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ar=Fee.reduce((t,e)=>{const n=q0(`Primitive.${e}`),r=T.forwardRef((i,s)=>{const{asChild:a,...o}=i,l=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...o,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function EU(t,e){t&&Ld.flushSync(()=>t.dispatchEvent(e))}var CU=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Uee="VisuallyHidden",AU=T.forwardRef((t,e)=>p.jsx(ar.span,{...t,ref:e,style:{...CU,...t.style}}));AU.displayName=Uee;var Bee=AU;function Hee(t,e){const n=T.createContext(e),r=s=>{const{children:a,...o}=s,l=T.useMemo(()=>o,Object.values(o));return p.jsx(n.Provider,{value:l,children:a})};r.displayName=t+"Provider";function i(s){const a=T.useContext(n);if(a)return a;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,i]}function ou(t,e=[]){let n=[];function r(s,a){const o=T.createContext(a),l=n.length;n=[...n,a];const c=h=>{var S;const{scope:g,children:v,...b}=h,_=((S=g==null?void 0:g[t])==null?void 0:S[l])||o,w=T.useMemo(()=>b,Object.values(b));return p.jsx(_.Provider,{value:w,children:v})};c.displayName=s+"Provider";function d(h,g){var _;const v=((_=g==null?void 0:g[t])==null?void 0:_[l])||o,b=T.useContext(v);if(b)return b;if(a!==void 0)return a;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(a=>T.createContext(a));return function(o){const l=(o==null?void 0:o[t])||s;return T.useMemo(()=>({[`__scope${t}`]:{...o,[t]:l}}),[o,l])}};return i.scopeName=t,[r,Vee(i,...e)]}function Vee(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const a=r.reduce((o,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...o,...h}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}function P7(t){const e=t+"CollectionProvider",[n,r]=ou(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=_=>{const{scope:w,children:S}=_,E=Qr.useRef(null),A=Qr.useRef(new Map).current;return p.jsx(i,{scope:w,itemMap:A,collectionRef:E,children:S})};a.displayName=e;const o=t+"CollectionSlot",l=q0(o),c=Qr.forwardRef((_,w)=>{const{scope:S,children:E}=_,A=s(o,S),N=Lr(w,A.collectionRef);return p.jsx(l,{ref:N,children:E})});c.displayName=o;const d=t+"CollectionItemSlot",h="data-radix-collection-item",g=q0(d),v=Qr.forwardRef((_,w)=>{const{scope:S,children:E,...A}=_,N=Qr.useRef(null),D=Lr(w,N),P=s(d,S);return Qr.useEffect(()=>(P.itemMap.set(N,{ref:N,...A}),()=>void P.itemMap.delete(N))),p.jsx(g,{[h]:"",ref:D,children:E})});v.displayName=d;function b(_){const w=s(t+"CollectionConsumer",_);return Qr.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const A=Array.from(E.querySelectorAll(`[${h}]`));return Array.from(w.itemMap.values()).sort((P,L)=>A.indexOf(P.ref.current)-A.indexOf(L.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:c,ItemSlot:v},b,r]}function gn(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}var bo=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{},Gee=PF[" useInsertionEffect ".trim().toString()]||bo;function Gd({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,a]=Wee({defaultProp:e,onChange:n}),o=t!==void 0,l=o?t:i;{const d=T.useRef(t!==void 0);T.useEffect(()=>{const h=d.current;h!==o&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=o},[o,r])}const c=T.useCallback(d=>{var h;if(o){const g=$ee(d)?d(t):d;g!==t&&((h=a.current)==null||h.call(a,g))}else s(d)},[o,t,s,a]);return[l,c]}function Wee({defaultProp:t,onChange:e}){const[n,r]=T.useState(t),i=T.useRef(n),s=T.useRef(e);return Gee(()=>{s.current=e},[e]),T.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}function $ee(t){return typeof t=="function"}function qee(t,e){return T.useReducer((n,r)=>e[n][r]??n,t)}var Vo=t=>{const{present:e,children:n}=t,r=Xee(e),i=typeof n=="function"?n({present:r.isPresent}):T.Children.only(n),s=Lr(r.ref,Yee(i));return typeof n=="function"||r.isPresent?T.cloneElement(i,{ref:s}):null};Vo.displayName="Presence";function Xee(t){const[e,n]=T.useState(),r=T.useRef(null),i=T.useRef(t),s=T.useRef("none"),a=t?"mounted":"unmounted",[o,l]=qee(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const c=G3(r.current);s.current=o==="mounted"?c:"none"},[o]),bo(()=>{const c=r.current,d=i.current;if(d!==t){const g=s.current,v=G3(c);t?l("MOUNT"):v==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&g!==v?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),bo(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,h=v=>{const _=G3(r.current).includes(CSS.escape(v.animationName));if(v.target===e&&_&&(l("ANIMATION_END"),!i.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},g=v=>{v.target===e&&(s.current=G3(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:T.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function G3(t){return(t==null?void 0:t.animationName)||"none"}function Yee(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Kee=PF[" useId ".trim().toString()]||(()=>{}),Zee=0;function Gu(t){const[e,n]=T.useState(Kee());return bo(()=>{n(r=>r??String(Zee++))},[t]),t||(e?`radix-${e}`:"")}var D5="Collapsible",[Qee]=ou(D5),[Jee,I7]=Qee(D5),NU=T.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:a,...o}=t,[l,c]=Gd({prop:r,defaultProp:i??!1,onChange:a,caller:D5});return p.jsx(Jee,{scope:n,disabled:s,contentId:Gu(),open:l,onOpenToggle:T.useCallback(()=>c(d=>!d),[c]),children:p.jsx(ar.div,{"data-state":O7(l),"data-disabled":s?"":void 0,...o,ref:e})})});NU.displayName=D5;var RU="CollapsibleTrigger",kU=T.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=I7(RU,n);return p.jsx(ar.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":O7(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:gn(t.onClick,i.onOpenToggle)})});kU.displayName=RU;var D7="CollapsibleContent",PU=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=I7(D7,t.__scopeCollapsible);return p.jsx(Vo,{present:n||i.open,children:({present:s})=>p.jsx(ete,{...r,ref:e,present:s})})});PU.displayName=D7;var ete=T.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=t,a=I7(D7,n),[o,l]=T.useState(r),c=T.useRef(null),d=Lr(e,c),h=T.useRef(0),g=h.current,v=T.useRef(0),b=v.current,_=a.open||o,w=T.useRef(_),S=T.useRef(void 0);return T.useEffect(()=>{const E=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(E)},[]),bo(()=>{const E=c.current;if(E){S.current=S.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const A=E.getBoundingClientRect();h.current=A.height,v.current=A.width,w.current||(E.style.transitionDuration=S.current.transitionDuration,E.style.animationName=S.current.animationName),l(r)}},[a.open,r]),p.jsx(ar.div,{"data-state":O7(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!_,...s,ref:d,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...t.style},children:_&&i})});function O7(t){return t?"open":"closed"}var tte=NU,nte=kU,rte=PU,ite=T.createContext(void 0);function KS(t){const e=T.useContext(ite);return t||e||"ltr"}function Fo(t){const e=T.useRef(t);return T.useEffect(()=>{e.current=t}),T.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function ste(t,e=globalThis==null?void 0:globalThis.document){const n=Fo(t);T.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var ate="DismissableLayer",SN="dismissableLayer.update",ote="dismissableLayer.pointerDownOutside",lte="dismissableLayer.focusOutside",aI,IU=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gy=T.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:a,onDismiss:o,...l}=t,c=T.useContext(IU),[d,h]=T.useState(null),g=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=T.useState({}),b=Lr(e,L=>h(L)),_=Array.from(c.layers),[w]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),S=_.indexOf(w),E=d?_.indexOf(d):-1,A=c.layersWithOutsidePointerEventsDisabled.size>0,N=E>=S,D=dte(L=>{const R=L.target,O=[...c.branches].some(W=>W.contains(R));!N||O||(i==null||i(L),a==null||a(L),L.defaultPrevented||o==null||o())},g),P=fte(L=>{const R=L.target;[...c.branches].some(W=>W.contains(R))||(s==null||s(L),a==null||a(L),L.defaultPrevented||o==null||o())},g);return ste(L=>{E===c.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&o&&(L.preventDefault(),o()))},g),T.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(aI=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),oI(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=aI)}},[d,g,n,c]),T.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),oI())},[d,c]),T.useEffect(()=>{const L=()=>v({});return document.addEventListener(SN,L),()=>document.removeEventListener(SN,L)},[]),p.jsx(ar.div,{...l,ref:b,style:{pointerEvents:A?N?"auto":"none":void 0,...t.style},onFocusCapture:gn(t.onFocusCapture,P.onFocusCapture),onBlurCapture:gn(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:gn(t.onPointerDownCapture,D.onPointerDownCapture)})});gy.displayName=ate;var cte="DismissableLayerBranch",ute=T.forwardRef((t,e)=>{const n=T.useContext(IU),r=T.useRef(null),i=Lr(e,r);return T.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),p.jsx(ar.div,{...t,ref:i})});ute.displayName=cte;function dte(t,e=globalThis==null?void 0:globalThis.document){const n=Fo(t),r=T.useRef(!1),i=T.useRef(()=>{});return T.useEffect(()=>{const s=o=>{if(o.target&&!r.current){let l=function(){DU(ote,n,c,{discrete:!0})};const c={originalEvent:o};o.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},a=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function fte(t,e=globalThis==null?void 0:globalThis.document){const n=Fo(t),r=T.useRef(!1);return T.useEffect(()=>{const i=s=>{s.target&&!r.current&&DU(lte,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function oI(){const t=new CustomEvent(SN);document.dispatchEvent(t)}function DU(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?EU(i,s):i.dispatchEvent(s)}var SC="focusScope.autoFocusOnMount",wC="focusScope.autoFocusOnUnmount",lI={bubbles:!1,cancelable:!0},hte="FocusScope",ZS=T.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=t,[o,l]=T.useState(null),c=Fo(i),d=Fo(s),h=T.useRef(null),g=Lr(e,_=>l(_)),v=T.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;T.useEffect(()=>{if(r){let _=function(A){if(v.paused||!o)return;const N=A.target;o.contains(N)?h.current=N:M0(h.current,{select:!0})},w=function(A){if(v.paused||!o)return;const N=A.relatedTarget;N!==null&&(o.contains(N)||M0(h.current,{select:!0}))},S=function(A){if(document.activeElement===document.body)for(const D of A)D.removedNodes.length>0&&M0(o)};document.addEventListener("focusin",_),document.addEventListener("focusout",w);const E=new MutationObserver(S);return o&&E.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),E.disconnect()}}},[r,o,v.paused]),T.useEffect(()=>{if(o){uI.add(v);const _=document.activeElement;if(!o.contains(_)){const S=new CustomEvent(SC,lI);o.addEventListener(SC,c),o.dispatchEvent(S),S.defaultPrevented||(pte(yte(OU(o)),{select:!0}),document.activeElement===_&&M0(o))}return()=>{o.removeEventListener(SC,c),setTimeout(()=>{const S=new CustomEvent(wC,lI);o.addEventListener(wC,d),o.dispatchEvent(S),S.defaultPrevented||M0(_??document.body,{select:!0}),o.removeEventListener(wC,d),uI.remove(v)},0)}}},[o,c,d,v]);const b=T.useCallback(_=>{if(!n&&!r||v.paused)return;const w=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,S=document.activeElement;if(w&&S){const E=_.currentTarget,[A,N]=mte(E);A&&N?!_.shiftKey&&S===N?(_.preventDefault(),n&&M0(A,{select:!0})):_.shiftKey&&S===A&&(_.preventDefault(),n&&M0(N,{select:!0})):S===E&&_.preventDefault()}},[n,r,v.paused]);return p.jsx(ar.div,{tabIndex:-1,...a,ref:g,onKeyDown:b})});ZS.displayName=hte;function pte(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(M0(r,{select:e}),document.activeElement!==n)return}function mte(t){const e=OU(t),n=cI(e,t),r=cI(e.reverse(),t);return[n,r]}function OU(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function cI(t,e){for(const n of t)if(!gte(n,{upTo:e}))return n}function gte(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function vte(t){return t instanceof HTMLInputElement&&"select"in t}function M0(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&vte(t)&&e&&t.select()}}var uI=xte();function xte(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=dI(t,e),t.unshift(e)},remove(e){var n;t=dI(t,e),(n=t[0])==null||n.resume()}}}function dI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function yte(t){return t.filter(e=>e.tagName!=="A")}var bte="Portal",vy=T.forwardRef((t,e)=>{var o;const{container:n,...r}=t,[i,s]=T.useState(!1);bo(()=>s(!0),[]);const a=n||i&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return a?NJ.createPortal(p.jsx(ar.div,{...r,ref:e}),a):null});vy.displayName=bte;var MC=0;function O5(){T.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??fI()),document.body.insertAdjacentElement("beforeend",t[1]??fI()),MC++,()=>{MC===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),MC--}},[])}function fI(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Hf=function(){return Hf=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},Hf.apply(this,arguments)};function LU(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function _te(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,s;r<i;r++)(s||!(r in e))&&(s||(s=Array.prototype.slice.call(e,0,r)),s[r]=e[r]);return t.concat(s||Array.prototype.slice.call(e))}var kM="right-scroll-bar-position",PM="width-before-scroll-bar",Ste="with-scroll-bars-hidden",wte="--removed-body-scroll-bar-size";function TC(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Mte(t,e){var n=T.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var i=n.value;i!==r&&(n.value=r,n.callback(r,i))}}}})[0];return n.callback=e,n.facade}var Tte=typeof window<"u"?T.useLayoutEffect:T.useEffect,hI=new WeakMap;function Ete(t,e){var n=Mte(null,function(r){return t.forEach(function(i){return TC(i,r)})});return Tte(function(){var r=hI.get(n);if(r){var i=new Set(r),s=new Set(t),a=n.current;i.forEach(function(o){s.has(o)||TC(o,null)}),s.forEach(function(o){i.has(o)||TC(o,a)})}hI.set(n,t)},[t]),n}function Cte(t){return t}function Ate(t,e){e===void 0&&(e=Cte);var n=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(s){var a=e(s,r);return n.push(a),function(){n=n.filter(function(o){return o!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(o){return s(o)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var o=n;n=[],o.forEach(s),a=n}var l=function(){var d=a;a=[],d.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){a.push(d),c()},filter:function(d){return a=a.filter(d),n}}}};return i}function Nte(t){t===void 0&&(t={});var e=Ate(null);return e.options=Hf({async:!0,ssr:!1},t),e}var zU=function(t){var e=t.sideCar,n=LU(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return T.createElement(r,Hf({},n))};zU.isSideCarExport=!0;function Rte(t,e){return t.useMedium(e),zU}var jU=Nte(),EC=function(){},L5=T.forwardRef(function(t,e){var n=T.useRef(null),r=T.useState({onScrollCapture:EC,onWheelCapture:EC,onTouchMoveCapture:EC}),i=r[0],s=r[1],a=t.forwardProps,o=t.children,l=t.className,c=t.removeScrollBar,d=t.enabled,h=t.shards,g=t.sideCar,v=t.noRelative,b=t.noIsolation,_=t.inert,w=t.allowPinchZoom,S=t.as,E=S===void 0?"div":S,A=t.gapMode,N=LU(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=g,P=Ete([n,e]),L=Hf(Hf({},N),i);return T.createElement(T.Fragment,null,d&&T.createElement(D,{sideCar:jU,removeScrollBar:c,shards:h,noRelative:v,noIsolation:b,inert:_,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:A}),a?T.cloneElement(T.Children.only(o),Hf(Hf({},L),{ref:P})):T.createElement(E,Hf({},L,{className:l,ref:P}),o))});L5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};L5.classNames={fullWidth:PM,zeroRight:kM};var kte=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Pte(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=kte();return e&&t.setAttribute("nonce",e),t}function Ite(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Dte(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Ote=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Pte())&&(Ite(e,n),Dte(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Lte=function(){var t=Ote();return function(e,n){T.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},FU=function(){var t=Lte(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},zte={left:0,top:0,right:0,gap:0},CC=function(t){return parseInt(t||"",10)||0},jte=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],i=e[t==="padding"?"paddingRight":"marginRight"];return[CC(n),CC(r),CC(i)]},Fte=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return zte;var e=jte(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},Ute=FU(),c1="data-scroll-locked",Bte=function(t,e,n,r){var i=t.left,s=t.top,a=t.right,o=t.gap;return n===void 0&&(n="margin"),`
  .`.concat(Ste,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(o,"px ").concat(r,`;
  }
  body[`).concat(c1,`] {
    overflow: hidden `).concat(r,`;
    overscroll-behavior: contain;
    `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
    padding-left: `.concat(i,`px;
    padding-top: `).concat(s,`px;
    padding-right: `).concat(a,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(o,"px ").concat(r,`;
    `),n==="padding"&&"padding-right: ".concat(o,"px ").concat(r,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(kM,` {
    right: `).concat(o,"px ").concat(r,`;
  }
  
  .`).concat(PM,` {
    margin-right: `).concat(o,"px ").concat(r,`;
  }
  
  .`).concat(kM," .").concat(kM,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(PM," .").concat(PM,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(c1,`] {
    `).concat(wte,": ").concat(o,`px;
  }
`)},pI=function(){var t=parseInt(document.body.getAttribute(c1)||"0",10);return isFinite(t)?t:0},Hte=function(){T.useEffect(function(){return document.body.setAttribute(c1,(pI()+1).toString()),function(){var t=pI()-1;t<=0?document.body.removeAttribute(c1):document.body.setAttribute(c1,t.toString())}},[])},Vte=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;Hte();var s=T.useMemo(function(){return Fte(i)},[i]);return T.createElement(Ute,{styles:Bte(s,!e,i,n?"":"!important")})},wN=!1;if(typeof window<"u")try{var W3=Object.defineProperty({},"passive",{get:function(){return wN=!0,!0}});window.addEventListener("test",W3,W3),window.removeEventListener("test",W3,W3)}catch{wN=!1}var Sx=wN?{passive:!1}:!1,Gte=function(t){return t.tagName==="TEXTAREA"},UU=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Gte(t)&&n[e]==="visible")},Wte=function(t){return UU(t,"overflowY")},$te=function(t){return UU(t,"overflowX")},mI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=BU(t,r);if(i){var s=HU(t,r),a=s[1],o=s[2];if(a>o)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},qte=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Xte=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},BU=function(t,e){return t==="v"?Wte(e):$te(e)},HU=function(t,e){return t==="v"?qte(e):Xte(e)},Yte=function(t,e){return t==="h"&&e==="rtl"?-1:1},Kte=function(t,e,n,r,i){var s=Yte(t,window.getComputedStyle(e).direction),a=s*r,o=n.target,l=e.contains(o),c=!1,d=a>0,h=0,g=0;do{if(!o)break;var v=HU(t,o),b=v[0],_=v[1],w=v[2],S=_-w-s*b;(b||S)&&BU(t,o)&&(h+=S,g+=b);var E=o.parentNode;o=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!l&&o!==document.body||l&&(e.contains(o)||e===o));return(d&&Math.abs(h)<1||!d&&Math.abs(g)<1)&&(c=!0),c},$3=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},gI=function(t){return[t.deltaX,t.deltaY]},vI=function(t){return t&&"current"in t?t.current:t},Zte=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Qte=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Jte=0,wx=[];function ene(t){var e=T.useRef([]),n=T.useRef([0,0]),r=T.useRef(),i=T.useState(Jte++)[0],s=T.useState(FU)[0],a=T.useRef(t);T.useEffect(function(){a.current=t},[t]),T.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var _=_te([t.lockRef.current],(t.shards||[]).map(vI),!0).filter(Boolean);return _.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),_.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var o=T.useCallback(function(_,w){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!a.current.allowPinchZoom;var S=$3(_),E=n.current,A="deltaX"in _?_.deltaX:E[0]-S[0],N="deltaY"in _?_.deltaY:E[1]-S[1],D,P=_.target,L=Math.abs(A)>Math.abs(N)?"h":"v";if("touches"in _&&L==="h"&&P.type==="range")return!1;var R=window.getSelection(),O=R&&R.anchorNode,W=O?O===P||O.contains(P):!1;if(W)return!1;var F=mI(L,P);if(!F)return!0;if(F?D=L:(D=L==="v"?"h":"v",F=mI(L,P)),!F)return!1;if(!r.current&&"changedTouches"in _&&(A||N)&&(r.current=D),!D)return!0;var V=r.current||D;return Kte(V,w,_,V==="h"?A:N)},[]),l=T.useCallback(function(_){var w=_;if(!(!wx.length||wx[wx.length-1]!==s)){var S="deltaY"in w?gI(w):$3(w),E=e.current.filter(function(D){return D.name===w.type&&(D.target===w.target||w.target===D.shadowParent)&&Zte(D.delta,S)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var A=(a.current.shards||[]).map(vI).filter(Boolean).filter(function(D){return D.contains(w.target)}),N=A.length>0?o(w,A[0]):!a.current.noIsolation;N&&w.cancelable&&w.preventDefault()}}},[]),c=T.useCallback(function(_,w,S,E){var A={name:_,delta:w,target:S,should:E,shadowParent:tne(S)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(N){return N!==A})},1)},[]),d=T.useCallback(function(_){n.current=$3(_),r.current=void 0},[]),h=T.useCallback(function(_){c(_.type,gI(_),_.target,o(_,t.lockRef.current))},[]),g=T.useCallback(function(_){c(_.type,$3(_),_.target,o(_,t.lockRef.current))},[]);T.useEffect(function(){return wx.push(s),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Sx),document.addEventListener("touchmove",l,Sx),document.addEventListener("touchstart",d,Sx),function(){wx=wx.filter(function(_){return _!==s}),document.removeEventListener("wheel",l,Sx),document.removeEventListener("touchmove",l,Sx),document.removeEventListener("touchstart",d,Sx)}},[]);var v=t.removeScrollBar,b=t.inert;return T.createElement(T.Fragment,null,b?T.createElement(s,{styles:Qte(i)}):null,v?T.createElement(Vte,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function tne(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const nne=Rte(jU,ene);var QS=T.forwardRef(function(t,e){return T.createElement(L5,Hf({},t,{ref:e,sideCar:nne}))});QS.classNames=L5.classNames;var rne=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Mx=new WeakMap,q3=new WeakMap,X3={},AC=0,VU=function(t){return t&&(t.host||VU(t.parentNode))},ine=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=VU(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},sne=function(t,e,n,r){var i=ine(e,Array.isArray(t)?t:[t]);X3[n]||(X3[n]=new WeakMap);var s=X3[n],a=[],o=new Set,l=new Set(i),c=function(h){!h||o.has(h)||(o.add(h),c(h.parentNode))};i.forEach(c);var d=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(g){if(o.has(g))d(g);else try{var v=g.getAttribute(r),b=v!==null&&v!=="false",_=(Mx.get(g)||0)+1,w=(s.get(g)||0)+1;Mx.set(g,_),s.set(g,w),a.push(g),_===1&&b&&q3.set(g,!0),w===1&&g.setAttribute(n,"true"),b||g.setAttribute(r,"true")}catch(S){console.error("aria-hidden: cannot operate on ",g,S)}})};return d(e),o.clear(),AC++,function(){a.forEach(function(h){var g=Mx.get(h)-1,v=s.get(h)-1;Mx.set(h,g),s.set(h,v),g||(q3.has(h)||h.removeAttribute(r),q3.delete(h)),v||h.removeAttribute(n)}),AC--,AC||(Mx=new WeakMap,Mx=new WeakMap,q3=new WeakMap,X3={})}},z5=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=rne(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),sne(r,i,n,"aria-hidden")):function(){return null}},j5="Dialog",[GU,WU]=ou(j5),[ane,Yd]=GU(j5),$U=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!0}=t,o=T.useRef(null),l=T.useRef(null),[c,d]=Gd({prop:r,defaultProp:i??!1,onChange:s,caller:j5});return p.jsx(ane,{scope:e,triggerRef:o,contentRef:l,contentId:Gu(),titleId:Gu(),descriptionId:Gu(),open:c,onOpenChange:d,onOpenToggle:T.useCallback(()=>d(h=>!h),[d]),modal:a,children:n})};$U.displayName=j5;var qU="DialogTrigger",XU=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(qU,n),s=Lr(e,i.triggerRef);return p.jsx(ar.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":j7(i.open),...r,ref:s,onClick:gn(t.onClick,i.onOpenToggle)})});XU.displayName=qU;var L7="DialogPortal",[one,YU]=GU(L7,{forceMount:void 0}),KU=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Yd(L7,e);return p.jsx(one,{scope:e,forceMount:n,children:T.Children.map(r,a=>p.jsx(Vo,{present:n||s.open,children:p.jsx(vy,{asChild:!0,container:i,children:a})}))})};KU.displayName=L7;var QM="DialogOverlay",ZU=T.forwardRef((t,e)=>{const n=YU(QM,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Yd(QM,t.__scopeDialog);return s.modal?p.jsx(Vo,{present:r||s.open,children:p.jsx(cne,{...i,ref:e})}):null});ZU.displayName=QM;var lne=q0("DialogOverlay.RemoveScroll"),cne=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(QM,n);return p.jsx(QS,{as:lne,allowPinchZoom:!0,shards:[i.contentRef],children:p.jsx(ar.div,{"data-state":j7(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Qg="DialogContent",QU=T.forwardRef((t,e)=>{const n=YU(Qg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Yd(Qg,t.__scopeDialog);return p.jsx(Vo,{present:r||s.open,children:s.modal?p.jsx(une,{...i,ref:e}):p.jsx(dne,{...i,ref:e})})});QU.displayName=Qg;var une=T.forwardRef((t,e)=>{const n=Yd(Qg,t.__scopeDialog),r=T.useRef(null),i=Lr(e,n.contentRef,r);return T.useEffect(()=>{const s=r.current;if(s)return z5(s)},[]),p.jsx(JU,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gn(t.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:gn(t.onPointerDownOutside,s=>{const a=s.detail.originalEvent,o=a.button===0&&a.ctrlKey===!0;(a.button===2||o)&&s.preventDefault()}),onFocusOutside:gn(t.onFocusOutside,s=>s.preventDefault())})}),dne=T.forwardRef((t,e)=>{const n=Yd(Qg,t.__scopeDialog),r=T.useRef(!1),i=T.useRef(!1);return p.jsx(JU,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),JU=T.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...a}=t,o=Yd(Qg,n),l=T.useRef(null),c=Lr(e,l);return O5(),p.jsxs(p.Fragment,{children:[p.jsx(ZS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(gy,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":j7(o.open),...a,ref:c,onDismiss:()=>o.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(hne,{titleId:o.titleId}),p.jsx(mne,{contentRef:l,descriptionId:o.descriptionId})]})]})}),z7="DialogTitle",eB=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(z7,n);return p.jsx(ar.h2,{id:i.titleId,...r,ref:e})});eB.displayName=z7;var tB="DialogDescription",nB=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(tB,n);return p.jsx(ar.p,{id:i.descriptionId,...r,ref:e})});nB.displayName=tB;var rB="DialogClose",iB=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(rB,n);return p.jsx(ar.button,{type:"button",...r,ref:e,onClick:gn(t.onClick,()=>i.onOpenChange(!1))})});iB.displayName=rB;function j7(t){return t?"open":"closed"}var sB="DialogTitleWarning",[fne,aB]=Hee(sB,{contentName:Qg,titleName:z7,docsSlug:"dialog"}),hne=({titleId:t})=>{const e=aB(sB),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return T.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},pne="DialogDescriptionWarning",mne=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${aB(pne).contentName}}.`;return T.useEffect(()=>{var s;const i=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},oB=$U,lB=XU,cB=KU,uB=ZU,dB=QU,fB=eB,hB=nB,F7=iB,pB="AlertDialog",[gne]=ou(pB,[WU]),yp=WU(),mB=t=>{const{__scopeAlertDialog:e,...n}=t,r=yp(e);return p.jsx(oB,{...r,...n,modal:!0})};mB.displayName=pB;var vne="AlertDialogTrigger",xne=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=yp(n);return p.jsx(lB,{...i,...r,ref:e})});xne.displayName=vne;var yne="AlertDialogPortal",gB=t=>{const{__scopeAlertDialog:e,...n}=t,r=yp(e);return p.jsx(cB,{...r,...n})};gB.displayName=yne;var bne="AlertDialogOverlay",vB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=yp(n);return p.jsx(uB,{...i,...r,ref:e})});vB.displayName=bne;var u1="AlertDialogContent",[_ne,Sne]=gne(u1),wne=TU("AlertDialogContent"),xB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,s=yp(n),a=T.useRef(null),o=Lr(e,a),l=T.useRef(null);return p.jsx(fne,{contentName:u1,titleName:yB,docsSlug:"alert-dialog",children:p.jsx(_ne,{scope:n,cancelRef:l,children:p.jsxs(dB,{role:"alertdialog",...s,...i,ref:o,onOpenAutoFocus:gn(i.onOpenAutoFocus,c=>{var d;c.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[p.jsx(wne,{children:r}),p.jsx(Tne,{contentRef:a})]})})})});xB.displayName=u1;var yB="AlertDialogTitle",bB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=yp(n);return p.jsx(fB,{...i,...r,ref:e})});bB.displayName=yB;var _B="AlertDialogDescription",SB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=yp(n);return p.jsx(hB,{...i,...r,ref:e})});SB.displayName=_B;var Mne="AlertDialogAction",wB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=yp(n);return p.jsx(F7,{...i,...r,ref:e})});wB.displayName=Mne;var MB="AlertDialogCancel",TB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=Sne(MB,n),s=yp(n),a=Lr(e,i);return p.jsx(F7,{...s,...r,ref:a})});TB.displayName=MB;var Tne=({contentRef:t})=>{const e=`\`${u1}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${u1}\` by passing a \`${_B}\` component as a child, which also benefits sighted users by adding visible context to the dialog.

Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${u1}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.

For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return T.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Ene=mB,Cne=gB,Ane=vB,Nne=xB,Rne=wB,kne=TB,Pne=bB,Ine=SB,NC={exports:{}},RC={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var xI;function Dne(){if(xI)return RC;xI=1;var t=$S();function e(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue;function o(h,g){var v=g(),b=r({inst:{value:v,getSnapshot:g}}),_=b[0].inst,w=b[1];return s(function(){_.value=v,_.getSnapshot=g,l(_)&&w({inst:_})},[h,v,g]),i(function(){return l(_)&&w({inst:_}),h(function(){l(_)&&w({inst:_})})},[h]),a(v),v}function l(h){var g=h.getSnapshot;h=h.value;try{var v=g();return!n(h,v)}catch{return!0}}function c(h,g){return g()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return RC.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,RC}var yI;function One(){return yI||(yI=1,NC.exports=Dne()),NC.exports}function Lne(t){const e=T.useRef({value:t,previous:t});return T.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function zne(t){const[e,n]=T.useState(void 0);return bo(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let a,o;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;a=c.inlineSize,o=c.blockSize}else a=t.offsetWidth,o=t.offsetHeight;n({width:a,height:o})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const jne=["top","right","bottom","left"],X0=Math.min,qc=Math.max,JM=Math.round,Y3=Math.floor,Jf=t=>({x:t,y:t}),Fne={left:"right",right:"left",bottom:"top",top:"bottom"},Une={start:"end",end:"start"};function MN(t,e,n){return qc(t,X0(e,n))}function dp(t,e){return typeof t=="function"?t(e):t}function fp(t){return t.split("-")[0]}function xy(t){return t.split("-")[1]}function U7(t){return t==="x"?"y":"x"}function B7(t){return t==="y"?"height":"width"}const Bne=new Set(["top","bottom"]);function Wf(t){return Bne.has(fp(t))?"y":"x"}function H7(t){return U7(Wf(t))}function Hne(t,e,n){n===void 0&&(n=!1);const r=xy(t),i=H7(t),s=B7(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=e2(a)),[a,e2(a)]}function Vne(t){const e=e2(t);return[TN(t),e,TN(e)]}function TN(t){return t.replace(/start|end/g,e=>Une[e])}const bI=["left","right"],_I=["right","left"],Gne=["top","bottom"],Wne=["bottom","top"];function $ne(t,e,n){switch(t){case"top":case"bottom":return n?e?_I:bI:e?bI:_I;case"left":case"right":return e?Gne:Wne;default:return[]}}function qne(t,e,n,r){const i=xy(t);let s=$ne(fp(t),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),e&&(s=s.concat(s.map(TN)))),s}function e2(t){return t.replace(/left|right|bottom|top/g,e=>Fne[e])}function Xne(t){return{top:0,right:0,bottom:0,left:0,...t}}function EB(t){return typeof t!="number"?Xne(t):{top:t,right:t,bottom:t,left:t}}function t2(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function SI(t,e,n){let{reference:r,floating:i}=t;const s=Wf(e),a=H7(e),o=B7(a),l=fp(e),c=s==="y",d=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[o]/2-i[o]/2;let v;switch(l){case"top":v={x:d,y:r.y-i.height};break;case"bottom":v={x:d,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:h};break;case"left":v={x:r.x-i.width,y:h};break;default:v={x:r.x,y:r.y}}switch(xy(e)){case"start":v[a]-=g*(n&&c?-1:1);break;case"end":v[a]+=g*(n&&c?-1:1);break}return v}async function Yne(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:a,elements:o,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:g=!1,padding:v=0}=dp(e,t),b=EB(v),w=o[g?h==="floating"?"reference":"floating":h],S=t2(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(o.floating)),boundary:c,rootBoundary:d,strategy:l})),E=h==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(o.floating)),N=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},D=t2(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:E,offsetParent:A,strategy:l}):E);return{top:(S.top-D.top+b.top)/N.y,bottom:(D.bottom-S.bottom+b.bottom)/N.y,left:(S.left-D.left+b.left)/N.x,right:(D.right-S.right+b.right)/N.x}}const Kne=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,o=s.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:h}=SI(c,r,l),g=r,v={},b=0;for(let w=0;w<o.length;w++){var _;const{name:S,fn:E}=o[w],{x:A,y:N,data:D,reset:P}=await E({x:d,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:v,rects:c,platform:{...a,detectOverflow:(_=a.detectOverflow)!=null?_:Yne},elements:{reference:t,floating:e}});d=A??d,h=N??h,v={...v,[S]:{...v[S],...D}},P&&b<=50&&(b++,typeof P=="object"&&(P.placement&&(g=P.placement),P.rects&&(c=P.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:i}):P.rects),{x:d,y:h}=SI(c,g,l)),w=-1)}return{x:d,y:h,placement:g,strategy:i,middlewareData:v}},Zne=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:a,elements:o,middlewareData:l}=e,{element:c,padding:d=0}=dp(t,e)||{};if(c==null)return{};const h=EB(d),g={x:n,y:r},v=H7(i),b=B7(v),_=await a.getDimensions(c),w=v==="y",S=w?"top":"left",E=w?"bottom":"right",A=w?"clientHeight":"clientWidth",N=s.reference[b]+s.reference[v]-g[v]-s.floating[b],D=g[v]-s.reference[v],P=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let L=P?P[A]:0;(!L||!await(a.isElement==null?void 0:a.isElement(P)))&&(L=o.floating[A]||s.floating[b]);const R=N/2-D/2,O=L/2-_[b]/2-1,W=X0(h[S],O),F=X0(h[E],O),V=W,G=L-_[b]-F,Z=L/2-_[b]/2+R,B=MN(V,Z,G),q=!l.arrow&&xy(i)!=null&&Z!==B&&s.reference[b]/2-(Z<V?W:F)-_[b]/2<0,K=q?Z<V?Z-V:Z-G:0;return{[v]:g[v]+K,data:{[v]:B,centerOffset:Z-B-K,...q&&{alignmentOffset:K}},reset:q}}}),Qne=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:o,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:_=!0,...w}=dp(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const S=fp(i),E=Wf(o),A=fp(o)===o,N=await(l.isRTL==null?void 0:l.isRTL(c.floating)),D=g||(A||!_?[e2(o)]:Vne(o)),P=b!=="none";!g&&P&&D.push(...qne(o,_,b,N));const L=[o,...D],R=await l.detectOverflow(e,w),O=[];let W=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&O.push(R[S]),h){const Z=Hne(i,a,N);O.push(R[Z[0]],R[Z[1]])}if(W=[...W,{placement:i,overflows:O}],!O.every(Z=>Z<=0)){var F,V;const Z=(((F=s.flip)==null?void 0:F.index)||0)+1,B=L[Z];if(B&&(!(h==="alignment"?E!==Wf(B):!1)||W.every(Y=>Wf(Y.placement)===E?Y.overflows[0]>0:!0)))return{data:{index:Z,overflows:W},reset:{placement:B}};let q=(V=W.filter(K=>K.overflows[0]<=0).sort((K,Y)=>K.overflows[1]-Y.overflows[1])[0])==null?void 0:V.placement;if(!q)switch(v){case"bestFit":{var G;const K=(G=W.filter(Y=>{if(P){const Q=Wf(Y.placement);return Q===E||Q==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(Q=>Q>0).reduce((Q,U)=>Q+U,0)]).sort((Y,Q)=>Y[1]-Q[1])[0])==null?void 0:G[0];K&&(q=K);break}case"initialPlacement":q=o;break}if(i!==q)return{reset:{placement:q}}}return{}}}};function wI(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function MI(t){return jne.some(e=>t[e]>=0)}const Jne=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=dp(t,e);switch(i){case"referenceHidden":{const a=await r.detectOverflow(e,{...s,elementContext:"reference"}),o=wI(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:MI(o)}}}case"escaped":{const a=await r.detectOverflow(e,{...s,altBoundary:!0}),o=wI(a,n.floating);return{data:{escapedOffsets:o,escaped:MI(o)}}}default:return{}}}}},CB=new Set(["left","top"]);async function ere(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=fp(n),o=xy(n),l=Wf(n)==="y",c=CB.has(a)?-1:1,d=s&&l?-1:1,h=dp(e,t);let{mainAxis:g,crossAxis:v,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof b=="number"&&(v=o==="end"?b*-1:b),l?{x:v*d,y:g*c}:{x:g*c,y:v*d}}const tre=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:a,middlewareData:o}=e,l=await ere(e,t);return a===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:a}}}}},nre=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:S=>{let{x:E,y:A}=S;return{x:E,y:A}}},...c}=dp(t,e),d={x:n,y:r},h=await s.detectOverflow(e,c),g=Wf(fp(i)),v=U7(g);let b=d[v],_=d[g];if(a){const S=v==="y"?"top":"left",E=v==="y"?"bottom":"right",A=b+h[S],N=b-h[E];b=MN(A,b,N)}if(o){const S=g==="y"?"top":"left",E=g==="y"?"bottom":"right",A=_+h[S],N=_-h[E];_=MN(A,_,N)}const w=l.fn({...e,[v]:b,[g]:_});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[v]:a,[g]:o}}}}}},rre=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=e,{offset:o=0,mainAxis:l=!0,crossAxis:c=!0}=dp(t,e),d={x:n,y:r},h=Wf(i),g=U7(h);let v=d[g],b=d[h];const _=dp(o,e),w=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(l){const A=g==="y"?"height":"width",N=s.reference[g]-s.floating[A]+w.mainAxis,D=s.reference[g]+s.reference[A]-w.mainAxis;v<N?v=N:v>D&&(v=D)}if(c){var S,E;const A=g==="y"?"width":"height",N=CB.has(fp(i)),D=s.reference[h]-s.floating[A]+(N&&((S=a.offset)==null?void 0:S[h])||0)+(N?0:w.crossAxis),P=s.reference[h]+s.reference[A]+(N?0:((E=a.offset)==null?void 0:E[h])||0)-(N?w.crossAxis:0);b<D?b=D:b>P&&(b=P)}return{[g]:v,[h]:b}}}},ire=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:a,elements:o}=e,{apply:l=()=>{},...c}=dp(t,e),d=await a.detectOverflow(e,c),h=fp(i),g=xy(i),v=Wf(i)==="y",{width:b,height:_}=s.floating;let w,S;h==="top"||h==="bottom"?(w=h,S=g===(await(a.isRTL==null?void 0:a.isRTL(o.floating))?"start":"end")?"left":"right"):(S=h,w=g==="end"?"top":"bottom");const E=_-d.top-d.bottom,A=b-d.left-d.right,N=X0(_-d[w],E),D=X0(b-d[S],A),P=!e.middlewareData.shift;let L=N,R=D;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=A),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(L=E),P&&!g){const W=qc(d.left,0),F=qc(d.right,0),V=qc(d.top,0),G=qc(d.bottom,0);v?R=b-2*(W!==0||F!==0?W+F:qc(d.left,d.right)):L=_-2*(V!==0||G!==0?V+G:qc(d.top,d.bottom))}await l({...e,availableWidth:R,availableHeight:L});const O=await a.getDimensions(o.floating);return b!==O.width||_!==O.height?{reset:{rects:!0}}:{}}}};function F5(){return typeof window<"u"}function yy(t){return AB(t)?(t.nodeName||"").toLowerCase():"#document"}function Jc(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function uh(t){var e;return(e=(AB(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function AB(t){return F5()?t instanceof Node||t instanceof Jc(t).Node:!1}function Wd(t){return F5()?t instanceof Element||t instanceof Jc(t).Element:!1}function nh(t){return F5()?t instanceof HTMLElement||t instanceof Jc(t).HTMLElement:!1}function TI(t){return!F5()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Jc(t).ShadowRoot}const sre=new Set(["inline","contents"]);function JS(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=$d(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!sre.has(i)}const are=new Set(["table","td","th"]);function ore(t){return are.has(yy(t))}const lre=[":popover-open",":modal"];function U5(t){return lre.some(e=>{try{return t.matches(e)}catch{return!1}})}const cre=["transform","translate","scale","rotate","perspective"],ure=["transform","translate","scale","rotate","perspective","filter"],dre=["paint","layout","strict","content"];function V7(t){const e=G7(),n=Wd(t)?$d(t):t;return cre.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||ure.some(r=>(n.willChange||"").includes(r))||dre.some(r=>(n.contain||"").includes(r))}function fre(t){let e=Y0(t);for(;nh(e)&&!U1(e);){if(V7(e))return e;if(U5(e))return null;e=Y0(e)}return null}function G7(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const hre=new Set(["html","body","#document"]);function U1(t){return hre.has(yy(t))}function $d(t){return Jc(t).getComputedStyle(t)}function B5(t){return Wd(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Y0(t){if(yy(t)==="html")return t;const e=t.assignedSlot||t.parentNode||TI(t)&&t.host||uh(t);return TI(e)?e.host:e}function NB(t){const e=Y0(t);return U1(e)?t.ownerDocument?t.ownerDocument.body:t.body:nh(e)&&JS(e)?e:NB(e)}function Q_(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=NB(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),a=Jc(i);if(s){const o=EN(a);return e.concat(a,a.visualViewport||[],JS(i)?i:[],o&&n?Q_(o):[])}return e.concat(i,Q_(i,[],n))}function EN(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function RB(t){const e=$d(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=nh(t),s=i?t.offsetWidth:n,a=i?t.offsetHeight:r,o=JM(n)!==s||JM(r)!==a;return o&&(n=s,r=a),{width:n,height:r,$:o}}function W7(t){return Wd(t)?t:t.contextElement}function d1(t){const e=W7(t);if(!nh(e))return Jf(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=RB(e);let a=(s?JM(n.width):n.width)/r,o=(s?JM(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const pre=Jf(0);function kB(t){const e=Jc(t);return!G7()||!e.visualViewport?pre:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function mre(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Jc(t)?!1:e}function Jg(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=W7(t);let a=Jf(1);e&&(r?Wd(r)&&(a=d1(r)):a=d1(t));const o=mre(s,n,r)?kB(s):Jf(0);let l=(i.left+o.x)/a.x,c=(i.top+o.y)/a.y,d=i.width/a.x,h=i.height/a.y;if(s){const g=Jc(s),v=r&&Wd(r)?Jc(r):r;let b=g,_=EN(b);for(;_&&r&&v!==b;){const w=d1(_),S=_.getBoundingClientRect(),E=$d(_),A=S.left+(_.clientLeft+parseFloat(E.paddingLeft))*w.x,N=S.top+(_.clientTop+parseFloat(E.paddingTop))*w.y;l*=w.x,c*=w.y,d*=w.x,h*=w.y,l+=A,c+=N,b=Jc(_),_=EN(b)}}return t2({width:d,height:h,x:l,y:c})}function H5(t,e){const n=B5(t).scrollLeft;return e?e.left+n:Jg(uh(t)).left+n}function PB(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-H5(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function gre(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",a=uh(r),o=e?U5(e.floating):!1;if(r===a||o&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Jf(1);const d=Jf(0),h=nh(r);if((h||!h&&!s)&&((yy(r)!=="body"||JS(a))&&(l=B5(r)),nh(r))){const v=Jg(r);c=d1(r),d.x=v.x+r.clientLeft,d.y=v.y+r.clientTop}const g=a&&!h&&!s?PB(a,l):Jf(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+g.x,y:n.y*c.y-l.scrollTop*c.y+d.y+g.y}}function vre(t){return Array.from(t.getClientRects())}function xre(t){const e=uh(t),n=B5(t),r=t.ownerDocument.body,i=qc(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=qc(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+H5(t);const o=-n.scrollTop;return $d(r).direction==="rtl"&&(a+=qc(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:o}}const EI=25;function yre(t,e){const n=Jc(t),r=uh(t),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,o=0,l=0;if(i){s=i.width,a=i.height;const d=G7();(!d||d&&e==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}const c=H5(r);if(c<=0){const d=r.ownerDocument,h=d.body,g=getComputedStyle(h),v=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,b=Math.abs(r.clientWidth-h.clientWidth-v);b<=EI&&(s-=b)}else c<=EI&&(s+=c);return{width:s,height:a,x:o,y:l}}const bre=new Set(["absolute","fixed"]);function _re(t,e){const n=Jg(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=nh(t)?d1(t):Jf(1),a=t.clientWidth*s.x,o=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:a,height:o,x:l,y:c}}function CI(t,e,n){let r;if(e==="viewport")r=yre(t,n);else if(e==="document")r=xre(uh(t));else if(Wd(e))r=_re(e,n);else{const i=kB(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return t2(r)}function IB(t,e){const n=Y0(t);return n===e||!Wd(n)||U1(n)?!1:$d(n).position==="fixed"||IB(n,e)}function Sre(t,e){const n=e.get(t);if(n)return n;let r=Q_(t,[],!1).filter(o=>Wd(o)&&yy(o)!=="body"),i=null;const s=$d(t).position==="fixed";let a=s?Y0(t):t;for(;Wd(a)&&!U1(a);){const o=$d(a),l=V7(a);!l&&o.position==="fixed"&&(i=null),(s?!l&&!i:!l&&o.position==="static"&&!!i&&bre.has(i.position)||JS(a)&&!l&&IB(t,a))?r=r.filter(d=>d!==a):i=o,a=Y0(a)}return e.set(t,r),r}function wre(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const a=[...n==="clippingAncestors"?U5(e)?[]:Sre(e,this._c):[].concat(n),r],o=a[0],l=a.reduce((c,d)=>{const h=CI(e,d,i);return c.top=qc(h.top,c.top),c.right=X0(h.right,c.right),c.bottom=X0(h.bottom,c.bottom),c.left=qc(h.left,c.left),c},CI(e,o,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Mre(t){const{width:e,height:n}=RB(t);return{width:e,height:n}}function Tre(t,e,n){const r=nh(e),i=uh(e),s=n==="fixed",a=Jg(t,!0,s,e);let o={scrollLeft:0,scrollTop:0};const l=Jf(0);function c(){l.x=H5(i)}if(r||!r&&!s)if((yy(e)!=="body"||JS(i))&&(o=B5(e)),r){const v=Jg(e,!0,s,e);l.x=v.x+e.clientLeft,l.y=v.y+e.clientTop}else i&&c();s&&!r&&i&&c();const d=i&&!r&&!s?PB(i,o):Jf(0),h=a.left+o.scrollLeft-l.x-d.x,g=a.top+o.scrollTop-l.y-d.y;return{x:h,y:g,width:a.width,height:a.height}}function kC(t){return $d(t).position==="static"}function AI(t,e){if(!nh(t)||$d(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return uh(t)===n&&(n=n.ownerDocument.body),n}function DB(t,e){const n=Jc(t);if(U5(t))return n;if(!nh(t)){let i=Y0(t);for(;i&&!U1(i);){if(Wd(i)&&!kC(i))return i;i=Y0(i)}return n}let r=AI(t,e);for(;r&&ore(r)&&kC(r);)r=AI(r,e);return r&&U1(r)&&kC(r)&&!V7(r)?n:r||fre(t)||n}const Ere=async function(t){const e=this.getOffsetParent||DB,n=this.getDimensions,r=await n(t.floating);return{reference:Tre(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Cre(t){return $d(t).direction==="rtl"}const Are={convertOffsetParentRelativeRectToViewportRelativeRect:gre,getDocumentElement:uh,getClippingRect:wre,getOffsetParent:DB,getElementRects:Ere,getClientRects:vre,getDimensions:Mre,getScale:d1,isElement:Wd,isRTL:Cre};function OB(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Nre(t,e){let n=null,r;const i=uh(t);function s(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:d,top:h,width:g,height:v}=c;if(o||e(),!g||!v)return;const b=Y3(h),_=Y3(i.clientWidth-(d+g)),w=Y3(i.clientHeight-(h+v)),S=Y3(d),A={rootMargin:-b+"px "+-_+"px "+-w+"px "+-S+"px",threshold:qc(0,X0(1,l))||1};let N=!0;function D(P){const L=P[0].intersectionRatio;if(L!==l){if(!N)return a();L?a(!1,L):r=setTimeout(()=>{a(!1,1e-7)},1e3)}L===1&&!OB(c,t.getBoundingClientRect())&&a(),N=!1}try{n=new IntersectionObserver(D,{...A,root:i.ownerDocument})}catch{n=new IntersectionObserver(D,A)}n.observe(t)}return a(!0),s}function Rre(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=W7(t),d=i||s?[...c?Q_(c):[],...Q_(e)]:[];d.forEach(S=>{i&&S.addEventListener("scroll",n,{passive:!0}),s&&S.addEventListener("resize",n)});const h=c&&o?Nre(c,n):null;let g=-1,v=null;a&&(v=new ResizeObserver(S=>{let[E]=S;E&&E.target===c&&v&&(v.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var A;(A=v)==null||A.observe(e)})),n()}),c&&!l&&v.observe(c),v.observe(e));let b,_=l?Jg(t):null;l&&w();function w(){const S=Jg(t);_&&!OB(_,S)&&n(),_=S,b=requestAnimationFrame(w)}return n(),()=>{var S;d.forEach(E=>{i&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),h==null||h(),(S=v)==null||S.disconnect(),v=null,l&&cancelAnimationFrame(b)}}const kre=tre,Pre=nre,Ire=Qne,Dre=ire,Ore=Jne,NI=Zne,Lre=rre,zre=(t,e,n)=>{const r=new Map,i={platform:Are,...n},s={...i.platform,_c:r};return Kne(t,e,{...i,platform:s})};var jre=typeof document<"u",Fre=function(){},IM=jre?T.useLayoutEffect:Fre;function n2(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!n2(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!n2(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function LB(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function RI(t,e){const n=LB(t);return Math.round(e*n)/n}function PC(t){const e=T.useRef(t);return IM(()=>{e.current=t}),e}function Ure(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:a}={},transform:o=!0,whileElementsMounted:l,open:c}=t,[d,h]=T.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[g,v]=T.useState(r);n2(g,r)||v(r);const[b,_]=T.useState(null),[w,S]=T.useState(null),E=T.useCallback(Y=>{Y!==P.current&&(P.current=Y,_(Y))},[]),A=T.useCallback(Y=>{Y!==L.current&&(L.current=Y,S(Y))},[]),N=s||b,D=a||w,P=T.useRef(null),L=T.useRef(null),R=T.useRef(d),O=l!=null,W=PC(l),F=PC(i),V=PC(c),G=T.useCallback(()=>{if(!P.current||!L.current)return;const Y={placement:e,strategy:n,middleware:g};F.current&&(Y.platform=F.current),zre(P.current,L.current,Y).then(Q=>{const U={...Q,isPositioned:V.current!==!1};Z.current&&!n2(R.current,U)&&(R.current=U,Ld.flushSync(()=>{h(U)}))})},[g,e,n,F,V]);IM(()=>{c===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,h(Y=>({...Y,isPositioned:!1})))},[c]);const Z=T.useRef(!1);IM(()=>(Z.current=!0,()=>{Z.current=!1}),[]),IM(()=>{if(N&&(P.current=N),D&&(L.current=D),N&&D){if(W.current)return W.current(N,D,G);G()}},[N,D,G,W,O]);const B=T.useMemo(()=>({reference:P,floating:L,setReference:E,setFloating:A}),[E,A]),q=T.useMemo(()=>({reference:N,floating:D}),[N,D]),K=T.useMemo(()=>{const Y={position:n,left:0,top:0};if(!q.floating)return Y;const Q=RI(q.floating,d.x),U=RI(q.floating,d.y);return o?{...Y,transform:"translate("+Q+"px, "+U+"px)",...LB(q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:U}},[n,o,q.floating,d.x,d.y]);return T.useMemo(()=>({...d,update:G,refs:B,elements:q,floatingStyles:K}),[d,G,B,q,K])}const Bre=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?NI({element:r.current,padding:i}).fn(n):{}:r?NI({element:r,padding:i}).fn(n):{}}}},Hre=(t,e)=>({...kre(t),options:[t,e]}),Vre=(t,e)=>({...Pre(t),options:[t,e]}),Gre=(t,e)=>({...Lre(t),options:[t,e]}),Wre=(t,e)=>({...Ire(t),options:[t,e]}),$re=(t,e)=>({...Dre(t),options:[t,e]}),qre=(t,e)=>({...Ore(t),options:[t,e]}),Xre=(t,e)=>({...Bre(t),options:[t,e]});var Yre="Arrow",zB=T.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return p.jsx(ar.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});zB.displayName=Yre;var Kre=zB,$7="Popper",[jB,lm]=ou($7),[Zre,FB]=jB($7),UB=t=>{const{__scopePopper:e,children:n}=t,[r,i]=T.useState(null);return p.jsx(Zre,{scope:e,anchor:r,onAnchorChange:i,children:n})};UB.displayName=$7;var BB="PopperAnchor",HB=T.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=FB(BB,n),a=T.useRef(null),o=Lr(e,a),l=T.useRef(null);return T.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||a.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:p.jsx(ar.div,{...i,ref:o})});HB.displayName=BB;var q7="PopperContent",[Qre,Jre]=jB(q7),VB=T.forwardRef((t,e)=>{var ue,le,fe,we,pe,xe;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:a=0,arrowPadding:o=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:b,..._}=t,w=FB(q7,n),[S,E]=T.useState(null),A=Lr(e,Ve=>E(Ve)),[N,D]=T.useState(null),P=zne(N),L=(P==null?void 0:P.width)??0,R=(P==null?void 0:P.height)??0,O=r+(s!=="center"?"-"+s:""),W=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},F=Array.isArray(c)?c:[c],V=F.length>0,G={padding:W,boundary:F.filter(tie),altBoundary:V},{refs:Z,floatingStyles:B,placement:q,isPositioned:K,middlewareData:Y}=Ure({strategy:"fixed",placement:O,whileElementsMounted:(...Ve)=>Rre(...Ve,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[Hre({mainAxis:i+R,alignmentAxis:a}),l&&Vre({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Gre():void 0,...G}),l&&Wre({...G}),$re({...G,apply:({elements:Ve,rects:ye,availableWidth:Oe,availableHeight:he})=>{const{width:Re,height:oe}=ye.reference,Ue=Ve.floating.style;Ue.setProperty("--radix-popper-available-width",`${Oe}px`),Ue.setProperty("--radix-popper-available-height",`${he}px`),Ue.setProperty("--radix-popper-anchor-width",`${Re}px`),Ue.setProperty("--radix-popper-anchor-height",`${oe}px`)}}),N&&Xre({element:N,padding:o}),nie({arrowWidth:L,arrowHeight:R}),g&&qre({strategy:"referenceHidden",...G})]}),[Q,U]=$B(q),j=Fo(b);bo(()=>{K&&(j==null||j())},[K,j]);const X=(ue=Y.arrow)==null?void 0:ue.x,H=(le=Y.arrow)==null?void 0:le.y,ie=((fe=Y.arrow)==null?void 0:fe.centerOffset)!==0,[ne,re]=T.useState();return bo(()=>{S&&re(window.getComputedStyle(S).zIndex)},[S]),p.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:K?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ne,"--radix-popper-transform-origin":[(we=Y.transformOrigin)==null?void 0:we.x,(pe=Y.transformOrigin)==null?void 0:pe.y].join(" "),...((xe=Y.hide)==null?void 0:xe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:p.jsx(Qre,{scope:n,placedSide:Q,onArrowChange:D,arrowX:X,arrowY:H,shouldHideArrow:ie,children:p.jsx(ar.div,{"data-side":Q,"data-align":U,..._,ref:A,style:{..._.style,animation:K?void 0:"none"}})})})});VB.displayName=q7;var GB="PopperArrow",eie={top:"bottom",right:"left",bottom:"top",left:"right"},WB=T.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=Jre(GB,r),a=eie[s.placedSide];return p.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:p.jsx(Kre,{...i,ref:n,style:{...i.style,display:"block"}})})});WB.displayName=GB;function tie(t){return t!==null}var nie=t=>({name:"transformOrigin",options:t,fn(e){var w,S,E;const{placement:n,rects:r,middlewareData:i}=e,a=((w=i.arrow)==null?void 0:w.centerOffset)!==0,o=a?0:t.arrowWidth,l=a?0:t.arrowHeight,[c,d]=$B(n),h={start:"0%",center:"50%",end:"100%"}[d],g=(((S=i.arrow)==null?void 0:S.x)??0)+o/2,v=(((E=i.arrow)==null?void 0:E.y)??0)+l/2;let b="",_="";return c==="bottom"?(b=a?h:`${g}px`,_=`${-l}px`):c==="top"?(b=a?h:`${g}px`,_=`${r.floating.height+l}px`):c==="right"?(b=`${-l}px`,_=a?h:`${v}px`):c==="left"&&(b=`${r.floating.width+l}px`,_=a?h:`${v}px`),{data:{x:b,y:_}}}});function $B(t){const[e,n="center"]=t.split("-");return[e,n]}var V5=UB,ew=HB,G5=VB,W5=WB,IC="rovingFocusGroup.onEntryFocus",rie={bubbles:!1,cancelable:!0},tw="RovingFocusGroup",[CN,qB,iie]=P7(tw),[sie,$5]=ou(tw,[iie]),[aie,oie]=sie(tw),XB=T.forwardRef((t,e)=>p.jsx(CN.Provider,{scope:t.__scopeRovingFocusGroup,children:p.jsx(CN.Slot,{scope:t.__scopeRovingFocusGroup,children:p.jsx(lie,{...t,ref:e})})}));XB.displayName=tw;var lie=T.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...h}=t,g=T.useRef(null),v=Lr(e,g),b=KS(s),[_,w]=Gd({prop:a,defaultProp:o??null,onChange:l,caller:tw}),[S,E]=T.useState(!1),A=Fo(c),N=qB(n),D=T.useRef(!1),[P,L]=T.useState(0);return T.useEffect(()=>{const R=g.current;if(R)return R.addEventListener(IC,A),()=>R.removeEventListener(IC,A)},[A]),p.jsx(aie,{scope:n,orientation:r,dir:b,loop:i,currentTabStopId:_,onItemFocus:T.useCallback(R=>w(R),[w]),onItemShiftTab:T.useCallback(()=>E(!0),[]),onFocusableItemAdd:T.useCallback(()=>L(R=>R+1),[]),onFocusableItemRemove:T.useCallback(()=>L(R=>R-1),[]),children:p.jsx(ar.div,{tabIndex:S||P===0?-1:0,"data-orientation":r,...h,ref:v,style:{outline:"none",...t.style},onMouseDown:gn(t.onMouseDown,()=>{D.current=!0}),onFocus:gn(t.onFocus,R=>{const O=!D.current;if(R.target===R.currentTarget&&O&&!S){const W=new CustomEvent(IC,rie);if(R.currentTarget.dispatchEvent(W),!W.defaultPrevented){const F=N().filter(q=>q.focusable),V=F.find(q=>q.active),G=F.find(q=>q.id===_),B=[V,G,...F].filter(Boolean).map(q=>q.ref.current);ZB(B,d)}}D.current=!1}),onBlur:gn(t.onBlur,()=>E(!1))})})}),YB="RovingFocusGroupItem",KB=T.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:a,...o}=t,l=Gu(),c=s||l,d=oie(YB,n),h=d.currentTabStopId===c,g=qB(n),{onFocusableItemAdd:v,onFocusableItemRemove:b,currentTabStopId:_}=d;return T.useEffect(()=>{if(r)return v(),()=>b()},[r,v,b]),p.jsx(CN.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:p.jsx(ar.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...o,ref:e,onMouseDown:gn(t.onMouseDown,w=>{r?d.onItemFocus(c):w.preventDefault()}),onFocus:gn(t.onFocus,()=>d.onItemFocus(c)),onKeyDown:gn(t.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){d.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const S=die(w,d.orientation,d.dir);if(S!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let A=g().filter(N=>N.focusable).map(N=>N.ref.current);if(S==="last")A.reverse();else if(S==="prev"||S==="next"){S==="prev"&&A.reverse();const N=A.indexOf(w.currentTarget);A=d.loop?fie(A,N+1):A.slice(N+1)}setTimeout(()=>ZB(A))}}),children:typeof a=="function"?a({isCurrentTabStop:h,hasTabStop:_!=null}):a})})});KB.displayName=YB;var cie={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function uie(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function die(t,e,n){const r=uie(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return cie[r]}function ZB(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function fie(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var QB=XB,JB=KB,AN=["Enter"," "],hie=["ArrowDown","PageUp","Home"],eH=["ArrowUp","PageDown","End"],pie=[...hie,...eH],mie={ltr:[...AN,"ArrowRight"],rtl:[...AN,"ArrowLeft"]},gie={ltr:["ArrowLeft"],rtl:["ArrowRight"]},nw="Menu",[J_,vie,xie]=P7(nw),[pv,tH]=ou(nw,[xie,lm,$5]),q5=lm(),nH=$5(),[yie,mv]=pv(nw),[bie,rw]=pv(nw),rH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:a=!0}=t,o=q5(e),[l,c]=T.useState(null),d=T.useRef(!1),h=Fo(s),g=KS(i);return T.useEffect(()=>{const v=()=>{d.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>d.current=!1;return document.addEventListener("keydown",v,{capture:!0}),()=>{document.removeEventListener("keydown",v,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),p.jsx(V5,{...o,children:p.jsx(yie,{scope:e,open:n,onOpenChange:h,content:l,onContentChange:c,children:p.jsx(bie,{scope:e,onClose:T.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:g,modal:a,children:r})})})};rH.displayName=nw;var _ie="MenuAnchor",X7=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=q5(n);return p.jsx(ew,{...i,...r,ref:e})});X7.displayName=_ie;var Y7="MenuPortal",[Sie,iH]=pv(Y7,{forceMount:void 0}),sH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=mv(Y7,e);return p.jsx(Sie,{scope:e,forceMount:n,children:p.jsx(Vo,{present:n||s.open,children:p.jsx(vy,{asChild:!0,container:i,children:r})})})};sH.displayName=Y7;var Wu="MenuContent",[wie,K7]=pv(Wu),aH=T.forwardRef((t,e)=>{const n=iH(Wu,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=mv(Wu,t.__scopeMenu),a=rw(Wu,t.__scopeMenu);return p.jsx(J_.Provider,{scope:t.__scopeMenu,children:p.jsx(Vo,{present:r||s.open,children:p.jsx(J_.Slot,{scope:t.__scopeMenu,children:a.modal?p.jsx(Mie,{...i,ref:e}):p.jsx(Tie,{...i,ref:e})})})})}),Mie=T.forwardRef((t,e)=>{const n=mv(Wu,t.__scopeMenu),r=T.useRef(null),i=Lr(e,r);return T.useEffect(()=>{const s=r.current;if(s)return z5(s)},[]),p.jsx(Z7,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:gn(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Tie=T.forwardRef((t,e)=>{const n=mv(Wu,t.__scopeMenu);return p.jsx(Z7,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Eie=q0("MenuContent.ScrollLock"),Z7=T.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:b,..._}=t,w=mv(Wu,n),S=rw(Wu,n),E=q5(n),A=nH(n),N=vie(n),[D,P]=T.useState(null),L=T.useRef(null),R=Lr(e,L,w.onContentChange),O=T.useRef(0),W=T.useRef(""),F=T.useRef(0),V=T.useRef(null),G=T.useRef("right"),Z=T.useRef(0),B=b?QS:T.Fragment,q=b?{as:Eie,allowPinchZoom:!0}:void 0,K=Q=>{var ue,le;const U=W.current+Q,j=N().filter(fe=>!fe.disabled),X=document.activeElement,H=(ue=j.find(fe=>fe.ref.current===X))==null?void 0:ue.textValue,ie=j.map(fe=>fe.textValue),ne=jie(ie,U,H),re=(le=j.find(fe=>fe.textValue===ne))==null?void 0:le.ref.current;(function fe(we){W.current=we,window.clearTimeout(O.current),we!==""&&(O.current=window.setTimeout(()=>fe(""),1e3))})(U),re&&setTimeout(()=>re.focus())};T.useEffect(()=>()=>window.clearTimeout(O.current),[]),O5();const Y=T.useCallback(Q=>{var j,X;return G.current===((j=V.current)==null?void 0:j.side)&&Uie(Q,(X=V.current)==null?void 0:X.area)},[]);return p.jsx(wie,{scope:n,searchRef:W,onItemEnter:T.useCallback(Q=>{Y(Q)&&Q.preventDefault()},[Y]),onItemLeave:T.useCallback(Q=>{var U;Y(Q)||((U=L.current)==null||U.focus(),P(null))},[Y]),onTriggerLeave:T.useCallback(Q=>{Y(Q)&&Q.preventDefault()},[Y]),pointerGraceTimerRef:F,onPointerGraceIntentChange:T.useCallback(Q=>{V.current=Q},[]),children:p.jsx(B,{...q,children:p.jsx(ZS,{asChild:!0,trapped:i,onMountAutoFocus:gn(s,Q=>{var U;Q.preventDefault(),(U=L.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:p.jsx(gy,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:g,onDismiss:v,children:p.jsx(QB,{asChild:!0,...A,dir:S.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:P,onEntryFocus:gn(l,Q=>{S.isUsingKeyboardRef.current||Q.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(G5,{role:"menu","aria-orientation":"vertical","data-state":SH(w.open),"data-radix-menu-content":"",dir:S.dir,...E,..._,ref:R,style:{outline:"none",..._.style},onKeyDown:gn(_.onKeyDown,Q=>{const j=Q.target.closest("[data-radix-menu-content]")===Q.currentTarget,X=Q.ctrlKey||Q.altKey||Q.metaKey,H=Q.key.length===1;j&&(Q.key==="Tab"&&Q.preventDefault(),!X&&H&&K(Q.key));const ie=L.current;if(Q.target!==ie||!pie.includes(Q.key))return;Q.preventDefault();const re=N().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);eH.includes(Q.key)&&re.reverse(),Lie(re)}),onBlur:gn(t.onBlur,Q=>{Q.currentTarget.contains(Q.target)||(window.clearTimeout(O.current),W.current="")}),onPointerMove:gn(t.onPointerMove,eS(Q=>{const U=Q.target,j=Z.current!==Q.clientX;if(Q.currentTarget.contains(U)&&j){const X=Q.clientX>Z.current?"right":"left";G.current=X,Z.current=Q.clientX}}))})})})})})})});aH.displayName=Wu;var Cie="MenuGroup",Q7=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return p.jsx(ar.div,{role:"group",...r,ref:e})});Q7.displayName=Cie;var Aie="MenuLabel",oH=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return p.jsx(ar.div,{...r,ref:e})});oH.displayName=Aie;var r2="MenuItem",kI="menu.itemSelect",X5=T.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=T.useRef(null),a=rw(r2,t.__scopeMenu),o=K7(r2,t.__scopeMenu),l=Lr(e,s),c=T.useRef(!1),d=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(kI,{bubbles:!0,cancelable:!0});h.addEventListener(kI,v=>r==null?void 0:r(v),{once:!0}),EU(h,g),g.defaultPrevented?c.current=!1:a.onClose()}};return p.jsx(lH,{...i,ref:l,disabled:n,onClick:gn(t.onClick,d),onPointerDown:h=>{var g;(g=t.onPointerDown)==null||g.call(t,h),c.current=!0},onPointerUp:gn(t.onPointerUp,h=>{var g;c.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:gn(t.onKeyDown,h=>{const g=o.searchRef.current!=="";n||g&&h.key===" "||AN.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});X5.displayName=r2;var lH=T.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,a=K7(r2,n),o=nH(n),l=T.useRef(null),c=Lr(e,l),[d,h]=T.useState(!1),[g,v]=T.useState("");return T.useEffect(()=>{const b=l.current;b&&v((b.textContent??"").trim())},[s.children]),p.jsx(J_.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:p.jsx(JB,{asChild:!0,...o,focusable:!r,children:p.jsx(ar.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:gn(t.onPointerMove,eS(b=>{r?a.onItemLeave(b):(a.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:gn(t.onPointerLeave,eS(b=>a.onItemLeave(b))),onFocus:gn(t.onFocus,()=>h(!0)),onBlur:gn(t.onBlur,()=>h(!1))})})})}),Nie="MenuCheckboxItem",cH=T.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return p.jsx(pH,{scope:t.__scopeMenu,checked:n,children:p.jsx(X5,{role:"menuitemcheckbox","aria-checked":i2(n)?"mixed":n,...i,ref:e,"data-state":e8(n),onSelect:gn(i.onSelect,()=>r==null?void 0:r(i2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});cH.displayName=Nie;var uH="MenuRadioGroup",[Rie,kie]=pv(uH,{value:void 0,onValueChange:()=>{}}),dH=T.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=Fo(r);return p.jsx(Rie,{scope:t.__scopeMenu,value:n,onValueChange:s,children:p.jsx(Q7,{...i,ref:e})})});dH.displayName=uH;var fH="MenuRadioItem",hH=T.forwardRef((t,e)=>{const{value:n,...r}=t,i=kie(fH,t.__scopeMenu),s=n===i.value;return p.jsx(pH,{scope:t.__scopeMenu,checked:s,children:p.jsx(X5,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":e8(s),onSelect:gn(r.onSelect,()=>{var a;return(a=i.onValueChange)==null?void 0:a.call(i,n)},{checkForDefaultPrevented:!1})})})});hH.displayName=fH;var J7="MenuItemIndicator",[pH,Pie]=pv(J7,{checked:!1}),mH=T.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=Pie(J7,n);return p.jsx(Vo,{present:r||i2(s.checked)||s.checked===!0,children:p.jsx(ar.span,{...i,ref:e,"data-state":e8(s.checked)})})});mH.displayName=J7;var Iie="MenuSeparator",gH=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return p.jsx(ar.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});gH.displayName=Iie;var Die="MenuArrow",vH=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=q5(n);return p.jsx(W5,{...i,...r,ref:e})});vH.displayName=Die;var Oie="MenuSub",[q6e,xH]=pv(Oie),h_="MenuSubTrigger",yH=T.forwardRef((t,e)=>{const n=mv(h_,t.__scopeMenu),r=rw(h_,t.__scopeMenu),i=xH(h_,t.__scopeMenu),s=K7(h_,t.__scopeMenu),a=T.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},d=T.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return T.useEffect(()=>d,[d]),T.useEffect(()=>{const h=o.current;return()=>{window.clearTimeout(h),l(null)}},[o,l]),p.jsx(X7,{asChild:!0,...c,children:p.jsx(lH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":SH(n.open),...t,ref:I5(e,i.onTriggerChange),onClick:h=>{var g;(g=t.onClick)==null||g.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:gn(t.onPointerMove,eS(h=>{s.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:gn(t.onPointerLeave,eS(h=>{var v,b;d();const g=(v=n.content)==null?void 0:v.getBoundingClientRect();if(g){const _=(b=n.content)==null?void 0:b.dataset.side,w=_==="right",S=w?-5:5,E=g[w?"left":"right"],A=g[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+S,y:h.clientY},{x:E,y:g.top},{x:A,y:g.top},{x:A,y:g.bottom},{x:E,y:g.bottom}],side:_}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:gn(t.onKeyDown,h=>{var v;const g=s.searchRef.current!=="";t.disabled||g&&h.key===" "||mie[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});yH.displayName=h_;var bH="MenuSubContent",_H=T.forwardRef((t,e)=>{const n=iH(Wu,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=mv(Wu,t.__scopeMenu),a=rw(Wu,t.__scopeMenu),o=xH(bH,t.__scopeMenu),l=T.useRef(null),c=Lr(e,l);return p.jsx(J_.Provider,{scope:t.__scopeMenu,children:p.jsx(Vo,{present:r||s.open,children:p.jsx(J_.Slot,{scope:t.__scopeMenu,children:p.jsx(Z7,{id:o.contentId,"aria-labelledby":o.triggerId,...i,ref:c,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;a.isUsingKeyboardRef.current&&((h=l.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:gn(t.onFocusOutside,d=>{d.target!==o.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:gn(t.onEscapeKeyDown,d=>{a.onClose(),d.preventDefault()}),onKeyDown:gn(t.onKeyDown,d=>{var v;const h=d.currentTarget.contains(d.target),g=gie[a.dir].includes(d.key);h&&g&&(s.onOpenChange(!1),(v=o.trigger)==null||v.focus(),d.preventDefault())})})})})})});_H.displayName=bH;function SH(t){return t?"open":"closed"}function i2(t){return t==="indeterminate"}function e8(t){return i2(t)?"indeterminate":t?"checked":"unchecked"}function Lie(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function zie(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function jie(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let a=zie(t,Math.max(s,0));i.length===1&&(a=a.filter(c=>c!==n));const l=a.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Fie(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const o=e[s],l=e[a],c=o.x,d=o.y,h=l.x,g=l.y;d>r!=g>r&&n<(h-c)*(r-d)/(g-d)+c&&(i=!i)}return i}function Uie(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Fie(n,e)}function eS(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Bie=rH,Hie=X7,Vie=sH,Gie=aH,Wie=Q7,$ie=oH,qie=X5,Xie=cH,Yie=dH,Kie=hH,Zie=mH,Qie=gH,Jie=vH,ese=yH,tse=_H,Y5="DropdownMenu",[nse]=ou(Y5,[tH]),Gl=tH(),[rse,wH]=nse(Y5),MH=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:a,modal:o=!0}=t,l=Gl(e),c=T.useRef(null),[d,h]=Gd({prop:i,defaultProp:s??!1,onChange:a,caller:Y5});return p.jsx(rse,{scope:e,triggerId:Gu(),triggerRef:c,contentId:Gu(),open:d,onOpenChange:h,onOpenToggle:T.useCallback(()=>h(g=>!g),[h]),modal:o,children:p.jsx(Bie,{...l,open:d,onOpenChange:h,dir:r,modal:o,children:n})})};MH.displayName=Y5;var TH="DropdownMenuTrigger",EH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=wH(TH,n),a=Gl(n);return p.jsx(Hie,{asChild:!0,...a,children:p.jsx(ar.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:I5(e,s.triggerRef),onPointerDown:gn(t.onPointerDown,o=>{!r&&o.button===0&&o.ctrlKey===!1&&(s.onOpenToggle(),s.open||o.preventDefault())}),onKeyDown:gn(t.onKeyDown,o=>{r||(["Enter"," "].includes(o.key)&&s.onOpenToggle(),o.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});EH.displayName=TH;var ise="DropdownMenuPortal",CH=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Gl(e);return p.jsx(Vie,{...r,...n})};CH.displayName=ise;var AH="DropdownMenuContent",NH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=wH(AH,n),s=Gl(n),a=T.useRef(!1);return p.jsx(Gie,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:gn(t.onCloseAutoFocus,o=>{var l;a.current||(l=i.triggerRef.current)==null||l.focus(),a.current=!1,o.preventDefault()}),onInteractOutside:gn(t.onInteractOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;(!i.modal||d)&&(a.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});NH.displayName=AH;var sse="DropdownMenuGroup",ase=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Wie,{...i,...r,ref:e})});ase.displayName=sse;var ose="DropdownMenuLabel",RH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx($ie,{...i,...r,ref:e})});RH.displayName=ose;var lse="DropdownMenuItem",kH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(qie,{...i,...r,ref:e})});kH.displayName=lse;var cse="DropdownMenuCheckboxItem",PH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Xie,{...i,...r,ref:e})});PH.displayName=cse;var use="DropdownMenuRadioGroup",dse=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Yie,{...i,...r,ref:e})});dse.displayName=use;var fse="DropdownMenuRadioItem",hse=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Kie,{...i,...r,ref:e})});hse.displayName=fse;var pse="DropdownMenuItemIndicator",IH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Zie,{...i,...r,ref:e})});IH.displayName=pse;var mse="DropdownMenuSeparator",DH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Qie,{...i,...r,ref:e})});DH.displayName=mse;var gse="DropdownMenuArrow",vse=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(Jie,{...i,...r,ref:e})});vse.displayName=gse;var xse="DropdownMenuSubTrigger",yse=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(ese,{...i,...r,ref:e})});yse.displayName=xse;var bse="DropdownMenuSubContent",_se=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Gl(n);return p.jsx(tse,{...i,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});_se.displayName=bse;var Sse=MH,wse=EH,Mse=CH,Tse=NH,Ese=RH,Cse=kH,Ase=PH,Nse=IH,Rse=DH,kse="Label",OH=T.forwardRef((t,e)=>p.jsx(ar.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));OH.displayName=kse;var Pse=OH;function NN(t,[e,n]){return Math.min(n,Math.max(e,t))}var K5="Popover",[LH]=ou(K5,[lm]),iw=lm(),[Ise,cm]=LH(K5),zH=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!1}=t,o=iw(e),l=T.useRef(null),[c,d]=T.useState(!1),[h,g]=Gd({prop:r,defaultProp:i??!1,onChange:s,caller:K5});return p.jsx(V5,{...o,children:p.jsx(Ise,{scope:e,contentId:Gu(),triggerRef:l,open:h,onOpenChange:g,onOpenToggle:T.useCallback(()=>g(v=>!v),[g]),hasCustomAnchor:c,onCustomAnchorAdd:T.useCallback(()=>d(!0),[]),onCustomAnchorRemove:T.useCallback(()=>d(!1),[]),modal:a,children:n})})};zH.displayName=K5;var jH="PopoverAnchor",Dse=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=cm(jH,n),s=iw(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=i;return T.useEffect(()=>(a(),()=>o()),[a,o]),p.jsx(ew,{...s,...r,ref:e})});Dse.displayName=jH;var FH="PopoverTrigger",UH=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=cm(FH,n),s=iw(n),a=Lr(e,i.triggerRef),o=p.jsx(ar.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":WH(i.open),...r,ref:a,onClick:gn(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?o:p.jsx(ew,{asChild:!0,...s,children:o})});UH.displayName=FH;var t8="PopoverPortal",[Ose,Lse]=LH(t8,{forceMount:void 0}),BH=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=cm(t8,e);return p.jsx(Ose,{scope:e,forceMount:n,children:p.jsx(Vo,{present:n||s.open,children:p.jsx(vy,{asChild:!0,container:i,children:r})})})};BH.displayName=t8;var B1="PopoverContent",HH=T.forwardRef((t,e)=>{const n=Lse(B1,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=cm(B1,t.__scopePopover);return p.jsx(Vo,{present:r||s.open,children:s.modal?p.jsx(jse,{...i,ref:e}):p.jsx(Fse,{...i,ref:e})})});HH.displayName=B1;var zse=q0("PopoverContent.RemoveScroll"),jse=T.forwardRef((t,e)=>{const n=cm(B1,t.__scopePopover),r=T.useRef(null),i=Lr(e,r),s=T.useRef(!1);return T.useEffect(()=>{const a=r.current;if(a)return z5(a)},[]),p.jsx(QS,{as:zse,allowPinchZoom:!0,children:p.jsx(VH,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:gn(t.onCloseAutoFocus,a=>{var o;a.preventDefault(),s.current||(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:gn(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0,c=o.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:gn(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Fse=T.forwardRef((t,e)=>{const n=cm(B1,t.__scopePopover),r=T.useRef(!1),i=T.useRef(!1);return p.jsx(VH,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const a=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),VH=T.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...h}=t,g=cm(B1,n),v=iw(n);return O5(),p.jsx(ZS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(gy,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:d,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>g.onOpenChange(!1),children:p.jsx(G5,{"data-state":WH(g.open),role:"dialog",id:g.contentId,...v,...h,ref:e,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),GH="PopoverClose",Use=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=cm(GH,n);return p.jsx(ar.button,{type:"button",...r,ref:e,onClick:gn(t.onClick,()=>i.onOpenChange(!1))})});Use.displayName=GH;var Bse="PopoverArrow",Hse=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=iw(n);return p.jsx(W5,{...i,...r,ref:e})});Hse.displayName=Bse;function WH(t){return t?"open":"closed"}var Vse=zH,Gse=UH,Wse=BH,$se=HH;function qse(t,e){return T.useReducer((n,r)=>e[n][r]??n,t)}var n8="ScrollArea",[$H]=ou(n8),[Xse,Qu]=$H(n8),qH=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:s=600,...a}=t,[o,l]=T.useState(null),[c,d]=T.useState(null),[h,g]=T.useState(null),[v,b]=T.useState(null),[_,w]=T.useState(null),[S,E]=T.useState(0),[A,N]=T.useState(0),[D,P]=T.useState(!1),[L,R]=T.useState(!1),O=Lr(e,F=>l(F)),W=KS(i);return p.jsx(Xse,{scope:n,type:r,dir:W,scrollHideDelay:s,scrollArea:o,viewport:c,onViewportChange:d,content:h,onContentChange:g,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:P,scrollbarY:_,onScrollbarYChange:w,scrollbarYEnabled:L,onScrollbarYEnabledChange:R,onCornerWidthChange:E,onCornerHeightChange:N,children:p.jsx(ar.div,{dir:W,...a,ref:O,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});qH.displayName=n8;var XH="ScrollAreaViewport",YH=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:i,...s}=t,a=Qu(XH,n),o=T.useRef(null),l=Lr(e,o,a.onViewportChange);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),p.jsx(ar.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:p.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});YH.displayName=XH;var dh="ScrollAreaScrollbar",KH=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Qu(dh,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:a}=i,o=t.orientation==="horizontal";return T.useEffect(()=>(o?s(!0):a(!0),()=>{o?s(!1):a(!1)}),[o,s,a]),i.type==="hover"?p.jsx(Yse,{...r,ref:e,forceMount:n}):i.type==="scroll"?p.jsx(Kse,{...r,ref:e,forceMount:n}):i.type==="auto"?p.jsx(ZH,{...r,ref:e,forceMount:n}):i.type==="always"?p.jsx(r8,{...r,ref:e}):null});KH.displayName=dh;var Yse=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Qu(dh,t.__scopeScrollArea),[s,a]=T.useState(!1);return T.useEffect(()=>{const o=i.scrollArea;let l=0;if(o){const c=()=>{window.clearTimeout(l),a(!0)},d=()=>{l=window.setTimeout(()=>a(!1),i.scrollHideDelay)};return o.addEventListener("pointerenter",c),o.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),o.removeEventListener("pointerenter",c),o.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),p.jsx(Vo,{present:n||s,children:p.jsx(ZH,{"data-state":s?"visible":"hidden",...r,ref:e})})}),Kse=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Qu(dh,t.__scopeScrollArea),s=t.orientation==="horizontal",a=Q5(()=>l("SCROLL_END"),100),[o,l]=qse("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return T.useEffect(()=>{if(o==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[o,i.scrollHideDelay,l]),T.useEffect(()=>{const c=i.viewport,d=s?"scrollLeft":"scrollTop";if(c){let h=c[d];const g=()=>{const v=c[d];h!==v&&(l("SCROLL"),a()),h=v};return c.addEventListener("scroll",g),()=>c.removeEventListener("scroll",g)}},[i.viewport,s,l,a]),p.jsx(Vo,{present:n||o!=="hidden",children:p.jsx(r8,{"data-state":o==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:gn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:gn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),ZH=T.forwardRef((t,e)=>{const n=Qu(dh,t.__scopeScrollArea),{forceMount:r,...i}=t,[s,a]=T.useState(!1),o=t.orientation==="horizontal",l=Q5(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;a(o?c:d)}},10);return H1(n.viewport,l),H1(n.content,l),p.jsx(Vo,{present:r||s,children:p.jsx(r8,{"data-state":s?"visible":"hidden",...i,ref:e})})}),r8=T.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,i=Qu(dh,t.__scopeScrollArea),s=T.useRef(null),a=T.useRef(0),[o,l]=T.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=nV(o.viewport,o.content),d={...r,sizes:o,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function h(g,v){return nae(g,a.current,o,v)}return n==="horizontal"?p.jsx(Zse,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const g=i.viewport.scrollLeft,v=PI(g,o,i.dir);s.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollLeft=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollLeft=h(g,i.dir))}}):n==="vertical"?p.jsx(Qse,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const g=i.viewport.scrollTop,v=PI(g,o);s.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:g=>{i.viewport&&(i.viewport.scrollTop=g)},onDragScroll:g=>{i.viewport&&(i.viewport.scrollTop=h(g))}}):null}),Zse=T.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=Qu(dh,t.__scopeScrollArea),[a,o]=T.useState(),l=T.useRef(null),c=Lr(e,l,s.onScrollbarXChange);return T.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),p.jsx(JH,{"data-orientation":"horizontal",...i,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Z5(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(s.viewport){const g=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(g),iV(g,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:a2(a.paddingLeft),paddingEnd:a2(a.paddingRight)}})}})}),Qse=T.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=Qu(dh,t.__scopeScrollArea),[a,o]=T.useState(),l=T.useRef(null),c=Lr(e,l,s.onScrollbarYChange);return T.useEffect(()=>{l.current&&o(getComputedStyle(l.current))},[l]),p.jsx(JH,{"data-orientation":"vertical",...i,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Z5(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(s.viewport){const g=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(g),iV(g,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&a&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:a2(a.paddingTop),paddingEnd:a2(a.paddingBottom)}})}})}),[Jse,QH]=$H(dh),JH=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:s,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:h,...g}=t,v=Qu(dh,n),[b,_]=T.useState(null),w=Lr(e,O=>_(O)),S=T.useRef(null),E=T.useRef(""),A=v.viewport,N=r.content-r.viewport,D=Fo(d),P=Fo(l),L=Q5(h,10);function R(O){if(S.current){const W=O.clientX-S.current.left,F=O.clientY-S.current.top;c({x:W,y:F})}}return T.useEffect(()=>{const O=W=>{const F=W.target;(b==null?void 0:b.contains(F))&&D(W,N)};return document.addEventListener("wheel",O,{passive:!1}),()=>document.removeEventListener("wheel",O,{passive:!1})},[A,b,N,D]),T.useEffect(P,[r,P]),H1(b,L),H1(v.content,L),p.jsx(Jse,{scope:n,scrollbar:b,hasThumb:i,onThumbChange:Fo(s),onThumbPointerUp:Fo(a),onThumbPositionChange:P,onThumbPointerDown:Fo(o),children:p.jsx(ar.div,{...g,ref:w,style:{position:"absolute",...g.style},onPointerDown:gn(t.onPointerDown,O=>{O.button===0&&(O.target.setPointerCapture(O.pointerId),S.current=b.getBoundingClientRect(),E.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),R(O))}),onPointerMove:gn(t.onPointerMove,R),onPointerUp:gn(t.onPointerUp,O=>{const W=O.target;W.hasPointerCapture(O.pointerId)&&W.releasePointerCapture(O.pointerId),document.body.style.webkitUserSelect=E.current,v.viewport&&(v.viewport.style.scrollBehavior=""),S.current=null})})})}),s2="ScrollAreaThumb",eV=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=QH(s2,t.__scopeScrollArea);return p.jsx(Vo,{present:n||i.hasThumb,children:p.jsx(eae,{ref:e,...r})})}),eae=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,s=Qu(s2,n),a=QH(s2,n),{onThumbPositionChange:o}=a,l=Lr(e,h=>a.onThumbChange(h)),c=T.useRef(void 0),d=Q5(()=>{c.current&&(c.current(),c.current=void 0)},100);return T.useEffect(()=>{const h=s.viewport;if(h){const g=()=>{if(d(),!c.current){const v=rae(h,o);c.current=v,o()}};return o(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,d,o]),p.jsx(ar.div,{"data-state":a.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:gn(t.onPointerDownCapture,h=>{const v=h.target.getBoundingClientRect(),b=h.clientX-v.left,_=h.clientY-v.top;a.onThumbPointerDown({x:b,y:_})}),onPointerUp:gn(t.onPointerUp,a.onThumbPointerUp)})});eV.displayName=s2;var i8="ScrollAreaCorner",tV=T.forwardRef((t,e)=>{const n=Qu(i8,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.jsx(tae,{...t,ref:e}):null});tV.displayName=i8;var tae=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=Qu(i8,n),[s,a]=T.useState(0),[o,l]=T.useState(0),c=!!(s&&o);return H1(i.scrollbarX,()=>{var h;const d=((h=i.scrollbarX)==null?void 0:h.offsetHeight)||0;i.onCornerHeightChange(d),l(d)}),H1(i.scrollbarY,()=>{var h;const d=((h=i.scrollbarY)==null?void 0:h.offsetWidth)||0;i.onCornerWidthChange(d),a(d)}),c?p.jsx(ar.div,{...r,ref:e,style:{width:s,height:o,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function a2(t){return t?parseInt(t,10):0}function nV(t,e){const n=t/e;return isNaN(n)?0:n}function Z5(t){const e=nV(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function nae(t,e,n,r="ltr"){const i=Z5(n),s=i/2,a=e||s,o=i-a,l=n.scrollbar.paddingStart+a,c=n.scrollbar.size-n.scrollbar.paddingEnd-o,d=n.content-n.viewport,h=r==="ltr"?[0,d]:[d*-1,0];return rV([l,c],h)(t)}function PI(t,e,n="ltr"){const r=Z5(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,a=e.content-e.viewport,o=s-r,l=n==="ltr"?[0,a]:[a*-1,0],c=NN(t,l);return rV([0,a],[0,o])(c)}function rV(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function iV(t,e){return t>0&&t<e}var rae=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function i(){const s={left:t.scrollLeft,top:t.scrollTop},a=n.left!==s.left,o=n.top!==s.top;(a||o)&&e(),n=s,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Q5(t,e){const n=Fo(t),r=T.useRef(0);return T.useEffect(()=>()=>window.clearTimeout(r.current),[]),T.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function H1(t,e){const n=Fo(e);bo(()=>{let r=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}var iae=qH,sae=YH,aae=tV,oae=[" ","Enter","ArrowUp","ArrowDown"],lae=[" ","Enter"],ev="Select",[J5,eT,cae]=P7(ev),[by]=ou(ev,[cae,lm]),tT=lm(),[uae,um]=by(ev),[dae,fae]=by(ev),sV=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:a,defaultValue:o,onValueChange:l,dir:c,name:d,autoComplete:h,disabled:g,required:v,form:b}=t,_=tT(e),[w,S]=T.useState(null),[E,A]=T.useState(null),[N,D]=T.useState(!1),P=KS(c),[L,R]=Gd({prop:r,defaultProp:i??!1,onChange:s,caller:ev}),[O,W]=Gd({prop:a,defaultProp:o,onChange:l,caller:ev}),F=T.useRef(null),V=w?b||!!w.closest("form"):!0,[G,Z]=T.useState(new Set),B=Array.from(G).map(q=>q.props.value).join(";");return p.jsx(V5,{..._,children:p.jsxs(uae,{required:v,scope:e,trigger:w,onTriggerChange:S,valueNode:E,onValueNodeChange:A,valueNodeHasChildren:N,onValueNodeHasChildrenChange:D,contentId:Gu(),value:O,onValueChange:W,open:L,onOpenChange:R,dir:P,triggerPointerDownPosRef:F,disabled:g,children:[p.jsx(J5.Provider,{scope:e,children:p.jsx(dae,{scope:t.__scopeSelect,onNativeOptionAdd:T.useCallback(q=>{Z(K=>new Set(K).add(q))},[]),onNativeOptionRemove:T.useCallback(q=>{Z(K=>{const Y=new Set(K);return Y.delete(q),Y})},[]),children:n})}),V?p.jsxs(CV,{"aria-hidden":!0,required:v,tabIndex:-1,name:d,autoComplete:h,value:O,onChange:q=>W(q.target.value),disabled:g,form:b,children:[O===void 0?p.jsx("option",{value:""}):null,Array.from(G)]},B):null]})})};sV.displayName=ev;var aV="SelectTrigger",oV=T.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=tT(n),a=um(aV,n),o=a.disabled||r,l=Lr(e,a.onTriggerChange),c=eT(n),d=T.useRef("touch"),[h,g,v]=NV(_=>{const w=c().filter(A=>!A.disabled),S=w.find(A=>A.value===a.value),E=RV(w,_,S);E!==void 0&&a.onValueChange(E.value)}),b=_=>{o||(a.onOpenChange(!0),v()),_&&(a.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return p.jsx(ew,{asChild:!0,...s,children:p.jsx(ar.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":AV(a.value)?"":void 0,...i,ref:l,onClick:gn(i.onClick,_=>{_.currentTarget.focus(),d.current!=="mouse"&&b(_)}),onPointerDown:gn(i.onPointerDown,_=>{d.current=_.pointerType;const w=_.target;w.hasPointerCapture(_.pointerId)&&w.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(b(_),_.preventDefault())}),onKeyDown:gn(i.onKeyDown,_=>{const w=h.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&g(_.key),!(w&&_.key===" ")&&oae.includes(_.key)&&(b(),_.preventDefault())})})})});oV.displayName=aV;var lV="SelectValue",cV=T.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:a="",...o}=t,l=um(lV,n),{onValueNodeHasChildrenChange:c}=l,d=s!==void 0,h=Lr(e,l.onValueNodeChange);return bo(()=>{c(d)},[c,d]),p.jsx(ar.span,{...o,ref:h,style:{pointerEvents:"none"},children:AV(l.value)?p.jsx(p.Fragment,{children:a}):s})});cV.displayName=lV;var hae="SelectIcon",uV=T.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return p.jsx(ar.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});uV.displayName=hae;var pae="SelectPortal",dV=t=>p.jsx(vy,{asChild:!0,...t});dV.displayName=pae;var tv="SelectContent",fV=T.forwardRef((t,e)=>{const n=um(tv,t.__scopeSelect),[r,i]=T.useState();if(bo(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?Ld.createPortal(p.jsx(hV,{scope:t.__scopeSelect,children:p.jsx(J5.Slot,{scope:t.__scopeSelect,children:p.jsx("div",{children:t.children})})}),s):null}return p.jsx(pV,{...t,ref:e})});fV.displayName=tv;var Rd=10,[hV,dm]=by(tv),mae="SelectContentImpl",gae=q0("SelectContent.RemoveScroll"),pV=T.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:a,side:o,sideOffset:l,align:c,alignOffset:d,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:_,avoidCollisions:w,...S}=t,E=um(tv,n),[A,N]=T.useState(null),[D,P]=T.useState(null),L=Lr(e,ue=>N(ue)),[R,O]=T.useState(null),[W,F]=T.useState(null),V=eT(n),[G,Z]=T.useState(!1),B=T.useRef(!1);T.useEffect(()=>{if(A)return z5(A)},[A]),O5();const q=T.useCallback(ue=>{const[le,...fe]=V().map(xe=>xe.ref.current),[we]=fe.slice(-1),pe=document.activeElement;for(const xe of ue)if(xe===pe||(xe==null||xe.scrollIntoView({block:"nearest"}),xe===le&&D&&(D.scrollTop=0),xe===we&&D&&(D.scrollTop=D.scrollHeight),xe==null||xe.focus(),document.activeElement!==pe))return},[V,D]),K=T.useCallback(()=>q([R,A]),[q,R,A]);T.useEffect(()=>{G&&K()},[G,K]);const{onOpenChange:Y,triggerPointerDownPosRef:Q}=E;T.useEffect(()=>{if(A){let ue={x:0,y:0};const le=we=>{var pe,xe;ue={x:Math.abs(Math.round(we.pageX)-(((pe=Q.current)==null?void 0:pe.x)??0)),y:Math.abs(Math.round(we.pageY)-(((xe=Q.current)==null?void 0:xe.y)??0))}},fe=we=>{ue.x<=10&&ue.y<=10?we.preventDefault():A.contains(we.target)||Y(!1),document.removeEventListener("pointermove",le),Q.current=null};return Q.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",fe,{capture:!0})}}},[A,Y,Q]),T.useEffect(()=>{const ue=()=>Y(!1);return window.addEventListener("blur",ue),window.addEventListener("resize",ue),()=>{window.removeEventListener("blur",ue),window.removeEventListener("resize",ue)}},[Y]);const[U,j]=NV(ue=>{const le=V().filter(pe=>!pe.disabled),fe=le.find(pe=>pe.ref.current===document.activeElement),we=RV(le,ue,fe);we&&setTimeout(()=>we.ref.current.focus())}),X=T.useCallback((ue,le,fe)=>{const we=!B.current&&!fe;(E.value!==void 0&&E.value===le||we)&&(O(ue),we&&(B.current=!0))},[E.value]),H=T.useCallback(()=>A==null?void 0:A.focus(),[A]),ie=T.useCallback((ue,le,fe)=>{const we=!B.current&&!fe;(E.value!==void 0&&E.value===le||we)&&F(ue)},[E.value]),ne=r==="popper"?RN:mV,re=ne===RN?{side:o,sideOffset:l,align:c,alignOffset:d,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:_,avoidCollisions:w}:{};return p.jsx(hV,{scope:n,content:A,viewport:D,onViewportChange:P,itemRefCallback:X,selectedItem:R,onItemLeave:H,itemTextRefCallback:ie,focusSelectedItem:K,selectedItemText:W,position:r,isPositioned:G,searchRef:U,children:p.jsx(QS,{as:gae,allowPinchZoom:!0,children:p.jsx(ZS,{asChild:!0,trapped:E.open,onMountAutoFocus:ue=>{ue.preventDefault()},onUnmountAutoFocus:gn(i,ue=>{var le;(le=E.trigger)==null||le.focus({preventScroll:!0}),ue.preventDefault()}),children:p.jsx(gy,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:ue=>ue.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:p.jsx(ne,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:ue=>ue.preventDefault(),...S,...re,onPlaced:()=>Z(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:gn(S.onKeyDown,ue=>{const le=ue.ctrlKey||ue.altKey||ue.metaKey;if(ue.key==="Tab"&&ue.preventDefault(),!le&&ue.key.length===1&&j(ue.key),["ArrowUp","ArrowDown","Home","End"].includes(ue.key)){let we=V().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);if(["ArrowUp","End"].includes(ue.key)&&(we=we.slice().reverse()),["ArrowUp","ArrowDown"].includes(ue.key)){const pe=ue.target,xe=we.indexOf(pe);we=we.slice(xe+1)}setTimeout(()=>q(we)),ue.preventDefault()}})})})})})})});pV.displayName=mae;var vae="SelectItemAlignedPosition",mV=T.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=um(tv,n),a=dm(tv,n),[o,l]=T.useState(null),[c,d]=T.useState(null),h=Lr(e,L=>d(L)),g=eT(n),v=T.useRef(!1),b=T.useRef(!0),{viewport:_,selectedItem:w,selectedItemText:S,focusSelectedItem:E}=a,A=T.useCallback(()=>{if(s.trigger&&s.valueNode&&o&&c&&_&&w&&S){const L=s.trigger.getBoundingClientRect(),R=c.getBoundingClientRect(),O=s.valueNode.getBoundingClientRect(),W=S.getBoundingClientRect();if(s.dir!=="rtl"){const pe=W.left-R.left,xe=O.left-pe,Ve=L.left-xe,ye=L.width+Ve,Oe=Math.max(ye,R.width),he=window.innerWidth-Rd,Re=NN(xe,[Rd,Math.max(Rd,he-Oe)]);o.style.minWidth=ye+"px",o.style.left=Re+"px"}else{const pe=R.right-W.right,xe=window.innerWidth-O.right-pe,Ve=window.innerWidth-L.right-xe,ye=L.width+Ve,Oe=Math.max(ye,R.width),he=window.innerWidth-Rd,Re=NN(xe,[Rd,Math.max(Rd,he-Oe)]);o.style.minWidth=ye+"px",o.style.right=Re+"px"}const F=g(),V=window.innerHeight-Rd*2,G=_.scrollHeight,Z=window.getComputedStyle(c),B=parseInt(Z.borderTopWidth,10),q=parseInt(Z.paddingTop,10),K=parseInt(Z.borderBottomWidth,10),Y=parseInt(Z.paddingBottom,10),Q=B+q+G+Y+K,U=Math.min(w.offsetHeight*5,Q),j=window.getComputedStyle(_),X=parseInt(j.paddingTop,10),H=parseInt(j.paddingBottom,10),ie=L.top+L.height/2-Rd,ne=V-ie,re=w.offsetHeight/2,ue=w.offsetTop+re,le=B+q+ue,fe=Q-le;if(le<=ie){const pe=F.length>0&&w===F[F.length-1].ref.current;o.style.bottom="0px";const xe=c.clientHeight-_.offsetTop-_.offsetHeight,Ve=Math.max(ne,re+(pe?H:0)+xe+K),ye=le+Ve;o.style.height=ye+"px"}else{const pe=F.length>0&&w===F[0].ref.current;o.style.top="0px";const Ve=Math.max(ie,B+_.offsetTop+(pe?X:0)+re)+fe;o.style.height=Ve+"px",_.scrollTop=le-ie+_.offsetTop}o.style.margin=`${Rd}px 0`,o.style.minHeight=U+"px",o.style.maxHeight=V+"px",r==null||r(),requestAnimationFrame(()=>v.current=!0)}},[g,s.trigger,s.valueNode,o,c,_,w,S,s.dir,r]);bo(()=>A(),[A]);const[N,D]=T.useState();bo(()=>{c&&D(window.getComputedStyle(c).zIndex)},[c]);const P=T.useCallback(L=>{L&&b.current===!0&&(A(),E==null||E(),b.current=!1)},[A,E]);return p.jsx(yae,{scope:n,contentWrapper:o,shouldExpandOnScrollRef:v,onScrollButtonChange:P,children:p.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:p.jsx(ar.div,{...i,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});mV.displayName=vae;var xae="SelectPopperPosition",RN=T.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Rd,...s}=t,a=tT(n);return p.jsx(G5,{...a,...s,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});RN.displayName=xae;var[yae,s8]=by(tv,{}),kN="SelectViewport",gV=T.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=dm(kN,n),a=s8(kN,n),o=Lr(e,s.onViewportChange),l=T.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),p.jsx(J5.Slot,{scope:n,children:p.jsx(ar.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:gn(i.onScroll,c=>{const d=c.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:g}=a;if(g!=null&&g.current&&h){const v=Math.abs(l.current-d.scrollTop);if(v>0){const b=window.innerHeight-Rd*2,_=parseFloat(h.style.minHeight),w=parseFloat(h.style.height),S=Math.max(_,w);if(S<b){const E=S+v,A=Math.min(b,E),N=E-A;h.style.height=A+"px",h.style.bottom==="0px"&&(d.scrollTop=N>0?N:0,h.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});gV.displayName=kN;var vV="SelectGroup",[bae,_ae]=by(vV),Sae=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Gu();return p.jsx(bae,{scope:n,id:i,children:p.jsx(ar.div,{role:"group","aria-labelledby":i,...r,ref:e})})});Sae.displayName=vV;var xV="SelectLabel",wae=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=_ae(xV,n);return p.jsx(ar.div,{id:i.id,...r,ref:e})});wae.displayName=xV;var o2="SelectItem",[Mae,yV]=by(o2),bV=T.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...a}=t,o=um(o2,n),l=dm(o2,n),c=o.value===r,[d,h]=T.useState(s??""),[g,v]=T.useState(!1),b=Lr(e,E=>{var A;return(A=l.itemRefCallback)==null?void 0:A.call(l,E,r,i)}),_=Gu(),w=T.useRef("touch"),S=()=>{i||(o.onValueChange(r),o.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(Mae,{scope:n,value:r,disabled:i,textId:_,isSelected:c,onItemTextChange:T.useCallback(E=>{h(A=>A||((E==null?void 0:E.textContent)??"").trim())},[]),children:p.jsx(J5.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:p.jsx(ar.div,{role:"option","aria-labelledby":_,"data-highlighted":g?"":void 0,"aria-selected":c&&g,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...a,ref:b,onFocus:gn(a.onFocus,()=>v(!0)),onBlur:gn(a.onBlur,()=>v(!1)),onClick:gn(a.onClick,()=>{w.current!=="mouse"&&S()}),onPointerUp:gn(a.onPointerUp,()=>{w.current==="mouse"&&S()}),onPointerDown:gn(a.onPointerDown,E=>{w.current=E.pointerType}),onPointerMove:gn(a.onPointerMove,E=>{var A;w.current=E.pointerType,i?(A=l.onItemLeave)==null||A.call(l):w.current==="mouse"&&E.currentTarget.focus({preventScroll:!0})}),onPointerLeave:gn(a.onPointerLeave,E=>{var A;E.currentTarget===document.activeElement&&((A=l.onItemLeave)==null||A.call(l))}),onKeyDown:gn(a.onKeyDown,E=>{var N;((N=l.searchRef)==null?void 0:N.current)!==""&&E.key===" "||(lae.includes(E.key)&&S(),E.key===" "&&E.preventDefault())})})})})});bV.displayName=o2;var p_="SelectItemText",_V=T.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,a=um(p_,n),o=dm(p_,n),l=yV(p_,n),c=fae(p_,n),[d,h]=T.useState(null),g=Lr(e,S=>h(S),l.onItemTextChange,S=>{var E;return(E=o.itemTextRefCallback)==null?void 0:E.call(o,S,l.value,l.disabled)}),v=d==null?void 0:d.textContent,b=T.useMemo(()=>p.jsx("option",{value:l.value,disabled:l.disabled,children:v},l.value),[l.disabled,l.value,v]),{onNativeOptionAdd:_,onNativeOptionRemove:w}=c;return bo(()=>(_(b),()=>w(b)),[_,w,b]),p.jsxs(p.Fragment,{children:[p.jsx(ar.span,{id:l.textId,...s,ref:g}),l.isSelected&&a.valueNode&&!a.valueNodeHasChildren?Ld.createPortal(s.children,a.valueNode):null]})});_V.displayName=p_;var SV="SelectItemIndicator",wV=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return yV(SV,n).isSelected?p.jsx(ar.span,{"aria-hidden":!0,...r,ref:e}):null});wV.displayName=SV;var PN="SelectScrollUpButton",MV=T.forwardRef((t,e)=>{const n=dm(PN,t.__scopeSelect),r=s8(PN,t.__scopeSelect),[i,s]=T.useState(!1),a=Lr(e,r.onScrollButtonChange);return bo(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),i?p.jsx(EV,{...t,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=n;o&&l&&(o.scrollTop=o.scrollTop-l.offsetHeight)}}):null});MV.displayName=PN;var IN="SelectScrollDownButton",TV=T.forwardRef((t,e)=>{const n=dm(IN,t.__scopeSelect),r=s8(IN,t.__scopeSelect),[i,s]=T.useState(!1),a=Lr(e,r.onScrollButtonChange);return bo(()=>{if(n.viewport&&n.isPositioned){let o=function(){const c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;s(d)};const l=n.viewport;return o(),l.addEventListener("scroll",o),()=>l.removeEventListener("scroll",o)}},[n.viewport,n.isPositioned]),i?p.jsx(EV,{...t,ref:a,onAutoScroll:()=>{const{viewport:o,selectedItem:l}=n;o&&l&&(o.scrollTop=o.scrollTop+l.offsetHeight)}}):null});TV.displayName=IN;var EV=T.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=dm("SelectScrollButton",n),a=T.useRef(null),o=eT(n),l=T.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return T.useEffect(()=>()=>l(),[l]),bo(()=>{var d;const c=o().find(h=>h.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[o]),p.jsx(ar.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:gn(i.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:gn(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:gn(i.onPointerLeave,()=>{l()})})}),Tae="SelectSeparator",Eae=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return p.jsx(ar.div,{"aria-hidden":!0,...r,ref:e})});Eae.displayName=Tae;var DN="SelectArrow",Cae=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=tT(n),s=um(DN,n),a=dm(DN,n);return s.open&&a.position==="popper"?p.jsx(W5,{...i,...r,ref:e}):null});Cae.displayName=DN;var Aae="SelectBubbleInput",CV=T.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=T.useRef(null),s=Lr(r,i),a=Lne(e);return T.useEffect(()=>{const o=i.current;if(!o)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(a!==e&&d){const h=new Event("change",{bubbles:!0});d.call(o,e),o.dispatchEvent(h)}},[a,e]),p.jsx(ar.select,{...n,style:{...CU,...n.style},ref:s,defaultValue:e})});CV.displayName=Aae;function AV(t){return t===""||t===void 0}function NV(t){const e=Fo(t),n=T.useRef(""),r=T.useRef(0),i=T.useCallback(a=>{const o=n.current+a;e(o),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(o)},[e]),s=T.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return T.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function RV(t,e,n){const i=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let a=Nae(t,Math.max(s,0));i.length===1&&(a=a.filter(c=>c!==n));const l=a.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Nae(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Rae=sV,kae=oV,Pae=cV,Iae=uV,Dae=dV,Oae=fV,Lae=gV,zae=bV,jae=_V,Fae=wV,Uae=MV,Bae=TV,kV="Toggle",a8=T.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...s}=t,[a,o]=Gd({prop:n,onChange:i,defaultProp:r??!1,caller:kV});return p.jsx(ar.button,{type:"button","aria-pressed":a,"data-state":a?"on":"off","data-disabled":t.disabled?"":void 0,...s,ref:e,onClick:gn(t.onClick,()=>{t.disabled||o(!a)})})});a8.displayName=kV;var Hae=a8,fm="ToggleGroup",[PV]=ou(fm,[$5]),IV=$5(),o8=Qr.forwardRef((t,e)=>{const{type:n,...r}=t;if(n==="single"){const i=r;return p.jsx(Vae,{...i,ref:e})}if(n==="multiple"){const i=r;return p.jsx(Gae,{...i,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${fm}\``)});o8.displayName=fm;var[DV,OV]=PV(fm),Vae=Qr.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[a,o]=Gd({prop:n,defaultProp:r??"",onChange:i,caller:fm});return p.jsx(DV,{scope:t.__scopeToggleGroup,type:"single",value:Qr.useMemo(()=>a?[a]:[],[a]),onItemActivate:o,onItemDeactivate:Qr.useCallback(()=>o(""),[o]),children:p.jsx(LV,{...s,ref:e})})}),Gae=Qr.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[a,o]=Gd({prop:n,defaultProp:r??[],onChange:i,caller:fm}),l=Qr.useCallback(d=>o((h=[])=>[...h,d]),[o]),c=Qr.useCallback(d=>o((h=[])=>h.filter(g=>g!==d)),[o]);return p.jsx(DV,{scope:t.__scopeToggleGroup,type:"multiple",value:a,onItemActivate:l,onItemDeactivate:c,children:p.jsx(LV,{...s,ref:e})})});o8.displayName=fm;var[Wae,$ae]=PV(fm),LV=Qr.forwardRef((t,e)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:s,dir:a,loop:o=!0,...l}=t,c=IV(n),d=KS(a),h={role:"group",dir:d,...l};return p.jsx(Wae,{scope:n,rovingFocus:i,disabled:r,children:i?p.jsx(QB,{asChild:!0,...c,orientation:s,dir:d,loop:o,children:p.jsx(ar.div,{...h,ref:e})}):p.jsx(ar.div,{...h,ref:e})})}),l2="ToggleGroupItem",zV=Qr.forwardRef((t,e)=>{const n=OV(l2,t.__scopeToggleGroup),r=$ae(l2,t.__scopeToggleGroup),i=IV(t.__scopeToggleGroup),s=n.value.includes(t.value),a=r.disabled||t.disabled,o={...t,pressed:s,disabled:a},l=Qr.useRef(null);return r.rovingFocus?p.jsx(JB,{asChild:!0,...i,focusable:!a,active:s,ref:l,children:p.jsx(II,{...o,ref:e})}):p.jsx(II,{...o,ref:e})});zV.displayName=l2;var II=Qr.forwardRef((t,e)=>{const{__scopeToggleGroup:n,value:r,...i}=t,s=OV(l2,n),a={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},o=s.type==="single"?a:void 0;return p.jsx(a8,{...o,...i,ref:e,onPressedChange:l=>{l?s.onItemActivate(r):s.onItemDeactivate(r)}})}),qae=o8,Xae=zV,[nT]=ou("Tooltip",[lm]),rT=lm(),jV="TooltipProvider",Yae=700,ON="tooltip.open",[Kae,l8]=nT(jV),FV=t=>{const{__scopeTooltip:e,delayDuration:n=Yae,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,a=T.useRef(!0),o=T.useRef(!1),l=T.useRef(0);return T.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),p.jsx(Kae,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:T.useCallback(()=>{window.clearTimeout(l.current),a.current=!1},[]),onClose:T.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:o,onPointerInTransitChange:T.useCallback(c=>{o.current=c},[]),disableHoverableContent:i,children:s})};FV.displayName=jV;var tS="Tooltip",[Zae,sw]=nT(tS),UV=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:a,delayDuration:o}=t,l=l8(tS,t.__scopeTooltip),c=rT(e),[d,h]=T.useState(null),g=Gu(),v=T.useRef(0),b=a??l.disableHoverableContent,_=o??l.delayDuration,w=T.useRef(!1),[S,E]=Gd({prop:r,defaultProp:i??!1,onChange:L=>{L?(l.onOpen(),document.dispatchEvent(new CustomEvent(ON))):l.onClose(),s==null||s(L)},caller:tS}),A=T.useMemo(()=>S?w.current?"delayed-open":"instant-open":"closed",[S]),N=T.useCallback(()=>{window.clearTimeout(v.current),v.current=0,w.current=!1,E(!0)},[E]),D=T.useCallback(()=>{window.clearTimeout(v.current),v.current=0,E(!1)},[E]),P=T.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{w.current=!0,E(!0),v.current=0},_)},[_,E]);return T.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),p.jsx(V5,{...c,children:p.jsx(Zae,{scope:e,contentId:g,open:S,stateAttribute:A,trigger:d,onTriggerChange:h,onTriggerEnter:T.useCallback(()=>{l.isOpenDelayedRef.current?P():N()},[l.isOpenDelayedRef,P,N]),onTriggerLeave:T.useCallback(()=>{b?D():(window.clearTimeout(v.current),v.current=0)},[D,b]),onOpen:N,onClose:D,disableHoverableContent:b,children:n})})};UV.displayName=tS;var LN="TooltipTrigger",BV=T.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=sw(LN,n),s=l8(LN,n),a=rT(n),o=T.useRef(null),l=Lr(e,o,i.onTriggerChange),c=T.useRef(!1),d=T.useRef(!1),h=T.useCallback(()=>c.current=!1,[]);return T.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),p.jsx(ew,{asChild:!0,...a,children:p.jsx(ar.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:gn(t.onPointerMove,g=>{g.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:gn(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:gn(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:gn(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:gn(t.onBlur,i.onClose),onClick:gn(t.onClick,i.onClose)})})});BV.displayName=LN;var c8="TooltipPortal",[Qae,Jae]=nT(c8,{forceMount:void 0}),HV=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=sw(c8,e);return p.jsx(Qae,{scope:e,forceMount:n,children:p.jsx(Vo,{present:n||s.open,children:p.jsx(vy,{asChild:!0,container:i,children:r})})})};HV.displayName=c8;var V1="TooltipContent",VV=T.forwardRef((t,e)=>{const n=Jae(V1,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,a=sw(V1,t.__scopeTooltip);return p.jsx(Vo,{present:r||a.open,children:a.disableHoverableContent?p.jsx(GV,{side:i,...s,ref:e}):p.jsx(eoe,{side:i,...s,ref:e})})}),eoe=T.forwardRef((t,e)=>{const n=sw(V1,t.__scopeTooltip),r=l8(V1,t.__scopeTooltip),i=T.useRef(null),s=Lr(e,i),[a,o]=T.useState(null),{trigger:l,onClose:c}=n,d=i.current,{onPointerInTransitChange:h}=r,g=T.useCallback(()=>{o(null),h(!1)},[h]),v=T.useCallback((b,_)=>{const w=b.currentTarget,S={x:b.clientX,y:b.clientY},E=soe(S,w.getBoundingClientRect()),A=aoe(S,E),N=ooe(_.getBoundingClientRect()),D=coe([...A,...N]);o(D),h(!0)},[h]);return T.useEffect(()=>()=>g(),[g]),T.useEffect(()=>{if(l&&d){const b=w=>v(w,d),_=w=>v(w,l);return l.addEventListener("pointerleave",b),d.addEventListener("pointerleave",_),()=>{l.removeEventListener("pointerleave",b),d.removeEventListener("pointerleave",_)}}},[l,d,v,g]),T.useEffect(()=>{if(a){const b=_=>{const w=_.target,S={x:_.clientX,y:_.clientY},E=(l==null?void 0:l.contains(w))||(d==null?void 0:d.contains(w)),A=!loe(S,a);E?g():A&&(g(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[l,d,a,c,g]),p.jsx(GV,{...t,ref:s})}),[toe,noe]=nT(tS,{isInside:!1}),roe=TU("TooltipContent"),GV=T.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:a,...o}=t,l=sw(V1,n),c=rT(n),{onClose:d}=l;return T.useEffect(()=>(document.addEventListener(ON,d),()=>document.removeEventListener(ON,d)),[d]),T.useEffect(()=>{if(l.trigger){const h=g=>{const v=g.target;v!=null&&v.contains(l.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,d]),p.jsx(gy,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:p.jsxs(G5,{"data-state":l.stateAttribute,...c,...o,ref:e,style:{...o.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(roe,{children:r}),p.jsx(toe,{scope:n,isInside:!0,children:p.jsx(Bee,{id:l.contentId,role:"tooltip",children:i||r})})]})})});VV.displayName=V1;var WV="TooltipArrow",ioe=T.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=rT(n);return noe(WV,n).isInside?null:p.jsx(W5,{...i,...r,ref:e})});ioe.displayName=WV;function soe(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function aoe(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function ooe(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function loe(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const o=e[s],l=e[a],c=o.x,d=o.y,h=l.x,g=l.y;d>r!=g>r&&n<(h-c)*(r-d)/(g-d)+c&&(i=!i)}return i}function coe(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),uoe(e)}function uoe(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],a=e[e.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var doe=FV,foe=UV,hoe=BV,poe=HV,moe=VV;function $V(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=$V(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function qV(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=$V(t))&&(r&&(r+=" "),r+=e);return r}const goe=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},voe=(t,e)=>({classGroupId:t,validator:e}),XV=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),c2="-",DI=[],xoe="arbitrary..",yoe=t=>{const e=_oe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return boe(a);const o=a.split(c2),l=o[0]===""&&o.length>1?1:0;return YV(o,l,e)},getConflictingClassGroupIds:(a,o)=>{if(o){const l=r[a],c=n[a];return l?c?goe(c,l):l:c||DI}return n[a]||DI}}},YV=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const c=YV(t,e+1,s);if(c)return c}const a=n.validators;if(a===null)return;const o=e===0?t.join(c2):t.slice(e).join(c2),l=a.length;for(let c=0;c<l;c++){const d=a[c];if(d.validator(o))return d.classGroupId}},boe=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?xoe+r:void 0})(),_oe=t=>{const{theme:e,classGroups:n}=t;return Soe(n,e)},Soe=(t,e)=>{const n=XV();for(const r in t){const i=t[r];u8(i,n,r,e)}return n},u8=(t,e,n,r)=>{const i=t.length;for(let s=0;s<i;s++){const a=t[s];woe(a,e,n,r)}},woe=(t,e,n,r)=>{if(typeof t=="string"){Moe(t,e,n);return}if(typeof t=="function"){Toe(t,e,n,r);return}Eoe(t,e,n,r)},Moe=(t,e,n)=>{const r=t===""?e:KV(e,t);r.classGroupId=n},Toe=(t,e,n,r)=>{if(Coe(t)){u8(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(voe(n,t))},Eoe=(t,e,n,r)=>{const i=Object.entries(t),s=i.length;for(let a=0;a<s;a++){const[o,l]=i[a];u8(l,KV(e,o),n,r)}},KV=(t,e)=>{let n=t;const r=e.split(c2),i=r.length;for(let s=0;s<i;s++){const a=r[s];let o=n.nextPart.get(a);o||(o=XV(),n.nextPart.set(a,o)),n=o}return n},Coe=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Aoe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(s,a)=>{n[s]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=r[s])!==void 0)return i(s,a),a},set(s,a){s in n?n[s]=a:i(s,a)}}},zN="!",OI=":",Noe=[],LI=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Roe=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let a=0,o=0,l=0,c;const d=i.length;for(let _=0;_<d;_++){const w=i[_];if(a===0&&o===0){if(w===OI){s.push(i.slice(l,_)),l=_+1;continue}if(w==="/"){c=_;continue}}w==="["?a++:w==="]"?a--:w==="("?o++:w===")"&&o--}const h=s.length===0?i:i.slice(l);let g=h,v=!1;h.endsWith(zN)?(g=h.slice(0,-1),v=!0):h.startsWith(zN)&&(g=h.slice(1),v=!0);const b=c&&c>l?c-l:void 0;return LI(s,v,g,b)};if(e){const i=e+OI,s=r;r=a=>a.startsWith(i)?s(a.slice(i.length)):LI(Noe,!1,a,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},koe=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let s=0;s<n.length;s++){const a=n[s],o=a[0]==="[",l=e.has(a);o||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(a)):i.push(a)}return i.length>0&&(i.sort(),r.push(...i)),r}},Poe=t=>({cache:Aoe(t.cacheSize),parseClassName:Roe(t),sortModifiers:koe(t),...yoe(t)}),Ioe=/\s+/,Doe=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,a=[],o=t.trim().split(Ioe);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{isExternal:h,modifiers:g,hasImportantModifier:v,baseClassName:b,maybePostfixModifierPosition:_}=n(d);if(h){l=d+(l.length>0?" "+l:l);continue}let w=!!_,S=r(w?b.substring(0,_):b);if(!S){if(!w){l=d+(l.length>0?" "+l:l);continue}if(S=r(b),!S){l=d+(l.length>0?" "+l:l);continue}w=!1}const E=g.length===0?"":g.length===1?g[0]:s(g).join(":"),A=v?E+zN:E,N=A+S;if(a.indexOf(N)>-1)continue;a.push(N);const D=i(S,w);for(let P=0;P<D.length;++P){const L=D[P];a.push(A+L)}l=d+(l.length>0?" "+l:l)}return l},Ooe=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=ZV(n))&&(i&&(i+=" "),i+=r);return i},ZV=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=ZV(t[r]))&&(n&&(n+=" "),n+=e);return n},Loe=(t,...e)=>{let n,r,i,s;const a=l=>{const c=e.reduce((d,h)=>h(d),t());return n=Poe(c),r=n.cache.get,i=n.cache.set,s=o,o(l)},o=l=>{const c=r(l);if(c)return c;const d=Doe(l,n);return i(l,d),d};return s=a,(...l)=>s(Ooe(...l))},zoe=[],eo=t=>{const e=n=>n[t]||zoe;return e.isThemeGetter=!0,e},QV=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,JV=/^\((?:(\w[\w-]*):)?(.+)\)$/i,joe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Foe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uoe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Boe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Hoe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Voe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,u0=t=>joe.test(t),Br=t=>!!t&&!Number.isNaN(Number(t)),d0=t=>!!t&&Number.isInteger(Number(t)),DC=t=>t.endsWith("%")&&Br(t.slice(0,-1)),Hh=t=>Foe.test(t),eG=()=>!0,Goe=t=>Uoe.test(t)&&!Boe.test(t),d8=()=>!1,Woe=t=>Hoe.test(t),$oe=t=>Voe.test(t),qoe=t=>!Pn(t)&&!Dn(t),Xoe=t=>hm(t,rG,d8),Pn=t=>QV.test(t),ng=t=>hm(t,iG,Goe),zI=t=>hm(t,nle,Br),Yoe=t=>hm(t,aG,eG),Koe=t=>hm(t,sG,d8),jI=t=>hm(t,tG,d8),Zoe=t=>hm(t,nG,$oe),K3=t=>hm(t,oG,Woe),Dn=t=>JV.test(t),Vb=t=>gv(t,iG),Qoe=t=>gv(t,sG),FI=t=>gv(t,tG),Joe=t=>gv(t,rG),ele=t=>gv(t,nG),Z3=t=>gv(t,oG,!0),tle=t=>gv(t,aG,!0),hm=(t,e,n)=>{const r=QV.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},gv=(t,e,n=!1)=>{const r=JV.exec(t);return r?r[1]?e(r[1]):n:!1},tG=t=>t==="position"||t==="percentage",nG=t=>t==="image"||t==="url",rG=t=>t==="length"||t==="size"||t==="bg-size",iG=t=>t==="length",nle=t=>t==="number",sG=t=>t==="family-name",aG=t=>t==="number"||t==="weight",oG=t=>t==="shadow",rle=()=>{const t=eo("color"),e=eo("font"),n=eo("text"),r=eo("font-weight"),i=eo("tracking"),s=eo("leading"),a=eo("breakpoint"),o=eo("container"),l=eo("spacing"),c=eo("radius"),d=eo("shadow"),h=eo("inset-shadow"),g=eo("text-shadow"),v=eo("drop-shadow"),b=eo("blur"),_=eo("perspective"),w=eo("aspect"),S=eo("ease"),E=eo("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...N(),Dn,Pn],P=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],R=()=>[Dn,Pn,l],O=()=>[u0,"full","auto",...R()],W=()=>[d0,"none","subgrid",Dn,Pn],F=()=>["auto",{span:["full",d0,Dn,Pn]},d0,Dn,Pn],V=()=>[d0,"auto",Dn,Pn],G=()=>["auto","min","max","fr",Dn,Pn],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],B=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...R()],K=()=>[u0,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],Y=()=>[u0,"screen","full","dvw","lvw","svw","min","max","fit",...R()],Q=()=>[u0,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],U=()=>[t,Dn,Pn],j=()=>[...N(),FI,jI,{position:[Dn,Pn]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",Joe,Xoe,{size:[Dn,Pn]}],ie=()=>[DC,Vb,ng],ne=()=>["","none","full",c,Dn,Pn],re=()=>["",Br,Vb,ng],ue=()=>["solid","dashed","dotted","double"],le=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[Br,DC,FI,jI],we=()=>["","none",b,Dn,Pn],pe=()=>["none",Br,Dn,Pn],xe=()=>["none",Br,Dn,Pn],Ve=()=>[Br,Dn,Pn],ye=()=>[u0,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Hh],breakpoint:[Hh],color:[eG],container:[Hh],"drop-shadow":[Hh],ease:["in","out","in-out"],font:[qoe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Hh],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Hh],shadow:[Hh],spacing:["px",Br],text:[Hh],"text-shadow":[Hh],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",u0,Pn,Dn,w]}],container:["container"],columns:[{columns:[Br,Pn,Dn,o]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{"inset-s":O(),start:O()}],end:[{"inset-e":O(),end:O()}],"inset-bs":[{"inset-bs":O()}],"inset-be":[{"inset-be":O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[d0,"auto",Dn,Pn]}],basis:[{basis:[u0,"full","auto",o,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Br,u0,"auto","initial","none",Pn]}],grow:[{grow:["",Br,Dn,Pn]}],shrink:[{shrink:["",Br,Dn,Pn]}],order:[{order:[d0,"first","last","none",Dn,Pn]}],"grid-cols":[{"grid-cols":W()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":W()}],"row-start-end":[{row:F()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[...B(),"normal"]}],"justify-self":[{"justify-self":["auto",...B()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[...B(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...B(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[...B(),"baseline"]}],"place-self":[{"place-self":["auto",...B()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pbs:[{pbs:R()}],pbe:[{pbe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mbs:[{mbs:q()}],mbe:[{mbe:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],"inline-size":[{inline:["auto",...Y()]}],"min-inline-size":[{"min-inline":["auto",...Y()]}],"max-inline-size":[{"max-inline":["none",...Y()]}],"block-size":[{block:["auto",...Q()]}],"min-block-size":[{"min-block":["auto",...Q()]}],"max-block-size":[{"max-block":["none",...Q()]}],w:[{w:[o,"screen",...K()]}],"min-w":[{"min-w":[o,"screen","none",...K()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",n,Vb,ng]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,tle,Yoe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",DC,Pn]}],"font-family":[{font:[Qoe,Koe,e]}],"font-features":[{"font-features":[Pn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Dn,Pn]}],"line-clamp":[{"line-clamp":[Br,"none",Dn,zI]}],leading:[{leading:[s,...R()]}],"list-image":[{"list-image":["none",Dn,Pn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Dn,Pn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ue(),"wavy"]}],"text-decoration-thickness":[{decoration:[Br,"from-font","auto",Dn,ng]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[Br,"auto",Dn,Pn]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Dn,Pn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Dn,Pn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},d0,Dn,Pn],radial:["",Dn,Pn],conic:[d0,Dn,Pn]},ele,Zoe]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-bs":[{"border-bs":re()}],"border-w-be":[{"border-be":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ue(),"hidden","none"]}],"divide-style":[{divide:[...ue(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...ue(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Br,Dn,Pn]}],"outline-w":[{outline:["",Br,Vb,ng]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",d,Z3,K3]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",h,Z3,K3]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[Br,ng]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",g,Z3,K3]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[Br,Dn,Pn]}],"mix-blend":[{"mix-blend":[...le(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":le()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Br]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Dn,Pn]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[Br]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Dn,Pn]}],filter:[{filter:["","none",Dn,Pn]}],blur:[{blur:we()}],brightness:[{brightness:[Br,Dn,Pn]}],contrast:[{contrast:[Br,Dn,Pn]}],"drop-shadow":[{"drop-shadow":["","none",v,Z3,K3]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",Br,Dn,Pn]}],"hue-rotate":[{"hue-rotate":[Br,Dn,Pn]}],invert:[{invert:["",Br,Dn,Pn]}],saturate:[{saturate:[Br,Dn,Pn]}],sepia:[{sepia:["",Br,Dn,Pn]}],"backdrop-filter":[{"backdrop-filter":["","none",Dn,Pn]}],"backdrop-blur":[{"backdrop-blur":we()}],"backdrop-brightness":[{"backdrop-brightness":[Br,Dn,Pn]}],"backdrop-contrast":[{"backdrop-contrast":[Br,Dn,Pn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Br,Dn,Pn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Br,Dn,Pn]}],"backdrop-invert":[{"backdrop-invert":["",Br,Dn,Pn]}],"backdrop-opacity":[{"backdrop-opacity":[Br,Dn,Pn]}],"backdrop-saturate":[{"backdrop-saturate":[Br,Dn,Pn]}],"backdrop-sepia":[{"backdrop-sepia":["",Br,Dn,Pn]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Dn,Pn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Br,"initial",Dn,Pn]}],ease:[{ease:["linear","initial",S,Dn,Pn]}],delay:[{delay:[Br,Dn,Pn]}],animate:[{animate:["none",E,Dn,Pn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Dn,Pn]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:pe()}],"rotate-x":[{"rotate-x":pe()}],"rotate-y":[{"rotate-y":pe()}],"rotate-z":[{"rotate-z":pe()}],scale:[{scale:xe()}],"scale-x":[{"scale-x":xe()}],"scale-y":[{"scale-y":xe()}],"scale-z":[{"scale-z":xe()}],"scale-3d":["scale-3d"],skew:[{skew:Ve()}],"skew-x":[{"skew-x":Ve()}],"skew-y":[{"skew-y":Ve()}],transform:[{transform:[Dn,Pn,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Dn,Pn]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mbs":[{"scroll-mbs":R()}],"scroll-mbe":[{"scroll-mbe":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pbs":[{"scroll-pbs":R()}],"scroll-pbe":[{"scroll-pbe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Dn,Pn]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[Br,Vb,ng,zI]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ile=Loe(rle);function Rt(...t){return ile(qV(t))}function lG({delayDuration:t=0,...e}){return p.jsx(doe,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function vv({...t}){return p.jsx(lG,{children:p.jsx(foe,{"data-slot":"tooltip",...t})})}function xv({...t}){return p.jsx(hoe,{"data-slot":"tooltip-trigger",...t})}function yv({className:t,sideOffset:e=4,children:n,...r}){return p.jsx(poe,{children:p.jsx(moe,{"data-slot":"tooltip-content",sideOffset:e,className:Rt("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-xs bg-foreground text-background z-50 w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin)",t),...r,children:n})})}function sle({children:t}){const[e]=T.useState(()=>new eee({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1}}}));return p.jsx(Iee,{children:p.jsx(tee,{client:e,children:p.jsx(lG,{children:t})})})}/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ale=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ole=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),UI=t=>{const e=ole(t);return e.charAt(0).toUpperCase()+e.slice(1)},cG=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),lle=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var cle={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ule=T.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...o},l)=>T.createElement("svg",{ref:l,...cle,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:cG("lucide",i),...!s&&!lle(o)&&{"aria-hidden":"true"},...o},[...a.map(([c,d])=>T.createElement(c,d)),...Array.isArray(s)?s:[s]]));/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ti=(t,e)=>{const n=T.forwardRef(({className:r,...i},s)=>T.createElement(ule,{ref:s,iconNode:e,className:cG(`lucide-${ale(UI(t))}`,`lucide-${t}`,r),...i}));return n.displayName=UI(t),n};/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dle=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],fle=Ti("arrow-down",dle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hle=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],OC=Ti("arrow-left",hle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ple=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],mle=Ti("arrow-right",ple);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gle=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],vle=Ti("arrow-up",gle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xle=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],bv=Ti("check",xle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yle=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Vr=Ti("chevron-down",yle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ble=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],f8=Ti("chevron-left",ble);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _le=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],f1=Ti("chevron-right",_le);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sle=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],h8=Ti("chevron-up",Sle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wle=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Mle=Ti("chevrons-left",wle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Tle=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Ele=Ti("chevrons-right",Tle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Cle=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ale=Ti("circle-check",Cle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nle=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Rle=Ti("circle-x",Nle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kle=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],iT=Ti("copy",kle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ple=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Ile=Ti("database",Ple);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dle=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Ole=Ti("file-code-corner",Dle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lle=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],zle=Ti("folder-open",Lle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jle=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Fle=Ti("folder",jle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ule=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],p8=Ti("grip-vertical",Ule);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ble=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],Hle=Ti("layers",Ble);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vle=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kd=Ti("loader-circle",Vle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Gle=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],jN=Ti("menu",Gle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wle=[["path",{d:"M5 12h14",key:"1ays0h"}]],$le=Ti("minus",Wle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qle=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Xle=Ti("panel-left-close",qle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yle=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Kle=Ti("panel-right-close",Yle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zle=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],uG=Ti("pencil",Zle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qle=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ip=Ti("plus",Qle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jle=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],dG=Ti("settings",Jle);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ece=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],aw=Ti("sliders-horizontal",ece);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tce=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],nce=Ti("trash-2",tce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rce=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ice=Ti("triangle-alert",rce);/**
 * @license lucide-react v0.561.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sce=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ju=Ti("x",sce);function $f({...t}){return p.jsx(oB,{"data-slot":"dialog",...t})}function sT({...t}){return p.jsx(lB,{"data-slot":"dialog-trigger",...t})}function ace({...t}){return p.jsx(cB,{"data-slot":"dialog-portal",...t})}function oce({className:t,...e}){return p.jsx(uB,{"data-slot":"dialog-overlay",className:Rt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...e})}function qf({className:t,children:e,...n}){return p.jsxs(ace,{children:[p.jsx(oce,{}),p.jsxs(dB,{"data-slot":"dialog-content",className:Rt("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...n,children:[e,p.jsxs(F7,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[p.jsx(Ju,{}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function jd({className:t,...e}){return p.jsx("div",{"data-slot":"dialog-header",className:Rt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function m8({className:t,...e}){return p.jsx("div",{"data-slot":"dialog-footer",className:Rt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Fd({className:t,...e}){return p.jsx(fB,{"data-slot":"dialog-title",className:Rt("text-lg leading-none font-semibold",t),...e})}function kg({className:t,...e}){return p.jsx(hB,{"data-slot":"dialog-description",className:Rt("text-muted-foreground text-sm",t),...e})}function fl({...t}){return p.jsx(Sse,{"data-slot":"dropdown-menu",...t})}function hl({...t}){return p.jsx(wse,{"data-slot":"dropdown-menu-trigger",...t})}function pl({className:t,align:e="start",sideOffset:n=4,...r}){return p.jsx(Mse,{children:p.jsx(Tse,{"data-slot":"dropdown-menu-content",sideOffset:n,align:e,className:Rt("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto data-[state=closed]:overflow-hidden",t),...r})})}function _c({className:t,inset:e,variant:n="default",...r}){return p.jsx(Cse,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:Rt("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r})}function vi({className:t,children:e,checked:n,...r}){return p.jsxs(Ase,{"data-slot":"dropdown-menu-checkbox-item",className:Rt("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),checked:n,...r,children:[p.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none","data-slot":"dropdown-menu-checkbox-item-indicator",children:p.jsx(Nse,{children:p.jsx(bv,{})})}),e]})}function nS({className:t,inset:e,...n}){return p.jsx(Ese,{"data-slot":"dropdown-menu-label","data-inset":e,className:Rt("text-muted-foreground px-1.5 py-1 text-xs font-medium data-[inset]:pl-8",t),...n})}function Hl({className:t,...e}){return p.jsx(Rse,{"data-slot":"dropdown-menu-separator",className:Rt("bg-border -mx-1 my-1 h-px",t),...e})}const BI=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,HI=qV,g8=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return HI(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=e,a=Object.keys(i).map(c=>{const d=n==null?void 0:n[c],h=s==null?void 0:s[c];if(d===null)return null;const g=BI(d)||BI(h);return i[c][g]}),o=n&&Object.entries(n).reduce((c,d)=>{let[h,g]=d;return g===void 0||(c[h]=g),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,d)=>{let{class:h,className:g,...v}=d;return Object.entries(v).every(b=>{let[_,w]=b;return Array.isArray(w)?w.includes({...s,...o}[_]):{...s,...o}[_]===w})?[...c,h,g]:c},[]);return HI(t,a,l,n==null?void 0:n.class,n==null?void 0:n.className)},lce=g8("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",destructive:"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Tn({className:t,variant:e="default",size:n="default",asChild:r=!1,...i}){const s=r?wU:"button";return p.jsx(s,{"data-slot":"button","data-variant":e,"data-size":n,className:Rt(lce({variant:e,size:n,className:t})),...i})}function W0({className:t,type:e,...n}){return p.jsx("input",{type:e,"data-slot":"input",className:Rt("dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",t),...n})}function cce({className:t,...e}){return p.jsx(Pse,{"data-slot":"label",className:Rt("gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",t),...e})}function ll({className:t,...e}){return p.jsx(Kd,{role:"status","aria-label":"Loading",className:Rt("size-4 animate-spin",t),...e})}function _v({className:t,children:e,...n}){return p.jsxs(iae,{"data-slot":"scroll-area",className:Rt("relative",t),...n,children:[p.jsx(sae,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:e}),p.jsx(uce,{}),p.jsx(aae,{})]})}function uce({className:t,orientation:e="vertical",...n}){return p.jsx(KH,{"data-slot":"scroll-area-scrollbar","data-orientation":e,orientation:e,className:Rt("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none",t),...n,children:p.jsx(eV,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function aT({...t}){return p.jsx(Vse,{"data-slot":"popover",...t})}function oT({...t}){return p.jsx(Gse,{"data-slot":"popover-trigger",...t})}function lT({className:t,align:e="center",sideOffset:n=4,...r}){return p.jsx(Wse,{children:p.jsx($se,{"data-slot":"popover-content",align:e,sideOffset:n,className:Rt("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex flex-col gap-2.5 rounded-lg p-2.5 text-sm shadow-md ring-1 duration-100 z-50 w-72 origin-(--radix-popover-content-transform-origin) outline-hidden",t),...r})})}function FN({...t}){return p.jsx(Ene,{"data-slot":"alert-dialog",...t})}function dce({...t}){return p.jsx(Cne,{"data-slot":"alert-dialog-portal",...t})}function fce({className:t,...e}){return p.jsx(Ane,{"data-slot":"alert-dialog-overlay",className:Rt("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",t),...e})}function UN({className:t,size:e="default",...n}){return p.jsxs(dce,{children:[p.jsx(fce,{}),p.jsx(Nne,{"data-slot":"alert-dialog-content","data-size":e,className:Rt("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-4 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",t),...n})]})}function BN({className:t,...e}){return p.jsx("div",{"data-slot":"alert-dialog-header",className:Rt("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",t),...e})}function HN({className:t,...e}){return p.jsx("div",{"data-slot":"alert-dialog-footer",className:Rt("bg-muted/50 -mx-4 -mb-4 rounded-b-xl border-t p-4 flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",t),...e})}function hce({className:t,...e}){return p.jsx("div",{"data-slot":"alert-dialog-media",className:Rt("bg-muted mb-2 inline-flex size-10 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",t),...e})}function VN({className:t,...e}){return p.jsx(Pne,{"data-slot":"alert-dialog-title",className:Rt("text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",t),...e})}function GN({className:t,...e}){return p.jsx(Ine,{"data-slot":"alert-dialog-description",className:Rt("text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",t),...e})}function WN({className:t,variant:e="default",size:n="default",...r}){return p.jsx(Tn,{variant:e,size:n,asChild:!0,children:p.jsx(Rne,{"data-slot":"alert-dialog-action",className:Rt(t),...r})})}function $N({className:t,variant:e="outline",size:n="default",...r}){return p.jsx(Tn,{variant:e,size:n,asChild:!0,children:p.jsx(kne,{"data-slot":"alert-dialog-cancel",className:Rt(t),...r})})}const v8={},pce=Symbol((v8?"production":void 0)!=="production"?"RESET":""),fG=t=>typeof(t==null?void 0:t.then)=="function";function mce(t=()=>{try{return window.localStorage}catch(n){(v8?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,i;const s={getItem:(l,c)=>{var d,h;const g=b=>{if(b=b||"",r!==b){try{i=JSON.parse(b,e==null?void 0:e.reviver)}catch{return c}r=b}return i},v=(h=(d=t())==null?void 0:d.getItem(l))!=null?h:null;return fG(v)?v.then(g):g(v)},setItem:(l,c)=>{var d;return(d=t())==null?void 0:d.setItem(l,JSON.stringify(c,void 0))},removeItem:l=>{var c;return(c=t())==null?void 0:c.removeItem(l)}},a=l=>(c,d,h)=>l(c,g=>{let v;try{v=JSON.parse(g||"")}catch{v=h}d(v)});let o;try{o=(n=t())==null?void 0:n.subscribe}catch{}return!o&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(o=(l,c)=>{if(!(t()instanceof window.Storage))return()=>{};const d=h=>{h.storageArea===t()&&h.key===l&&c(h.newValue)};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}}),o&&(s.subscribe=a(o)),s}const gce=mce();function Ga(t,e,n=gce,r){const i=Gr(e);return(v8?"production":void 0)!=="production"&&(i.debugPrivate=!0),i.onMount=a=>{a(n.getItem(t,e));let o;return n.subscribe&&(o=n.subscribe(t,a,e)),o},Gr(a=>a(i),(a,o,l)=>{const c=typeof l=="function"?l(a(i)):l;return c===pce?(o(i,e),n.removeItem(t)):fG(c)?c.then(d=>(o(i,d),n.setItem(t,d))):(o(i,c),n.setItem(t,c))})}const hG=Gr(!1),pG=Gr(!1),mG=Gr(!1),vce=()=>{try{const t=localStorage.getItem("selected-run-path");if(t!==null)return JSON.parse(t)}catch{}return null},VI=Gr(vce()),ml=Gr(t=>t(VI),(t,e,n)=>{e(VI,n);try{n===null?localStorage.removeItem("selected-run-path"):localStorage.setItem("selected-run-path",JSON.stringify(n))}catch{}}),cT=Ga("visible-runs",[]),gG=Gr(!1),vG=Gr(!1);function ms(t){const e=Gr({});return Gr(n=>{const r=n(ml);if(!r)return t;const i=n(e);return Object.prototype.hasOwnProperty.call(i,r)?i[r]:t},(n,r,i)=>{const s=n(ml);if(!s)return;const a=n(e),o=Object.prototype.hasOwnProperty.call(a,s)?a[s]:t,l=typeof i=="function"?i(o):i;r(e,{...a,[s]:l})})}const xG=Gr(!1),xce=Ga("overview-show-ema",!1),yce=Ga("overview-ema-span",10),bce=Ga("overview-show-all-runs",!1),_ce=[{id:"default-reward",metricKey:"reward_sum_mean",label:"Reward",plotType:"step_metric"},{id:"default-timing",metricKey:"timing_step_total",label:"Time per Step",plotType:"step_metric"},{id:"default-grad-norm",metricKey:"grad_norm",label:"Grad Norm",plotType:"step_metric"}],Sce=Ga("overview-plots",_ce),wce=Gr(!1),Mce=Gr(10),Tce=Gr("step"),Ece=Gr(!1),Cce=Gr(100),Ace=Gr(3600),Nce=Gr(0),Rce=Gr("all"),yG=Gr({}),kce=ms(0),Pce=Gr(30),uT=ms(null),GI=ms(null),Ice=Gr(0),Dce=Gr(0),dT=Gr(!0),Oce=Gr(!0),bG=Gr(!1),Lce=Gr(14),zce=Gr(0),jce=Ga("inference-max-lanes",128),_G=ms(null),SG=ms(null),Fce=Ga("rollouts-selected-metrics",[]),Uce=Ga("rollouts-discarded-selected-metrics",[]),x8=Ga("rollouts-metrics-sidebar-open",!0),LC=Ga("rollouts-discarded-metrics-sidebar-open",!0),y8=Ga("rollouts-sample-picker-sidebar-open",!0),zC=Ga("rollouts-discarded-sample-picker-sidebar-open",!0),wG=ms(null),WI=ms(null),MG=ms(null),$I=ms(null),TG=ms(null),qI=ms(null),EG=Gr("groups"),Bce=Ga("rollouts-sample-picker-display-metrics",["gen_length_avg","reward"]),Hce=Ga("rollouts-sample-picker-tooltips",!0),Vce=Ga("rollouts-sample-view-metrics",[]),XI=Gr("groups"),YI=ms(null),Gce=ms(null),KI=ms(null),ZI=ms(null),QI=ms(null),jC=Ga("evals-sample-picker-sidebar-open",!0),JI=Gr("groups"),FC=Ga("evals-metrics-sidebar-open",!0),Wce=Ga("evals-selected-metrics",[]),$ce=Gr("metrics"),qce=ms(0),Xce=Gr(60),Yce=Gr(!0),Kce=Gr(!1),Zce=Gr(1),Qce=ms(0),Jce=ms("separated"),eue=ms(!0),tue=ms(!0),nue=ms(!0),rue=ms(!0),iue=ms("combined"),sue=ms("combined"),aue=ms(!0),fT=Gr(null),hT=Ga("rollouts-render-options",["markdown","latex","code"]),pT=Ga("rollouts-format-think",!0),CG=Gr(null),Ar="",_o=5e3,UC={inference_processes_start:"#3b82f6",trainer_process_start:"#8b5cf6",inference_servers_ready:"#22c55e",trainer_ready:"#10b981",weight_update:"#f59e0b",save_batch:"#ef4444",inference_call:"#06b6d4",wandb_initialized:"#6366f1",training_loop_start:"#ec4899",rollouts_group_done:"#4ccf7c",rollout_discarded_max_async:"#bdbdbd",rollout_discarded_zero_advantage:"#969696",rollout_paused_max_async:"#ffabab",rollout_resumed_max_async:"#3856ff",checkpoint_save_start:"#328519",checkpoint_save_done:"#328519"},Q3={forward:"#3b82f6",forward_backward:"#4f6edb",loss:"#d6cd1c",loss_computation:"#d6cd1c","loss/shift":"#fbbf24","loss/log_softmax":"#facc15","loss/policy_loss":"#eab308","loss/reduction":"#ca8a04",backward:"#ef4444",optimizer:"#22c55e",data_wait:"#6b7280",weight_broadcast:"#f97316",grad_clip:"#b342f5",grad_norm:"#f9a8d4",data_to_device:"#06b6d4",prepare_tensors:"#14b8a6",compute_entropy:"#f97316",compute_kl:"#ec4899",finalize_model_grads:"#9041c4",checkpoint:"#328519"},DM="#0284c7",BC="#10b981",qN="#ababab",AG="#c9c9c9",eD={request:DM,weight_broadcast:"#f97316"},G1="#e6e9ed",b8="#6b7280";function _8(t){if(UC[t])return UC[t];for(const[e,n]of Object.entries(UC))if(t.startsWith(e))return n;return b8}function u2(t){if(Q3[t])return Q3[t];if(t.includes("/")){const e=t.split("/")[0];if(Q3[e])return Q3[e]}return b8}function NG(t){return eD[t]?eD[t]:b8}function S8(t){return t.replace(/_step_\d+$/,"").replace(/_/g," ")}function RG(t,e,n,r){const i=t.replace(/_/g," ").split(" ").map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "),s=[];return e!==-1&&s.push(`Step ${e}`),r!=null&&r!==-1&&s.push(`Mini Batch ${r}`),n!=null&&n!==-1&&s.push(`Micro Batch ${n}`),{primary:i,secondary:s.length>0?`(${s.join(" ")})`:null}}function pm(){return ps({queryKey:["runs"],queryFn:async()=>{const t=await fetch(`${Ar}/runs`);if(!t.ok)throw new Error("Failed to fetch runs");return t.json()},refetchInterval:t=>{var n,r;return((r=(n=t.state.data)==null?void 0:n.discovery)==null?void 0:r.status)==="discovering"?1500:_o}})}function oue(t=!0){return ps({queryKey:["removed-runs"],queryFn:async()=>{const e=await fetch(`${Ar}/removed-runs`);if(!e.ok)throw new Error("Failed to fetch removed runs");return e.json()},enabled:t})}function lue(t=!0){return ps({queryKey:["known-projects"],queryFn:async()=>{const e=await fetch(`${Ar}/known-projects`);if(!e.ok)throw new Error("Failed to fetch known projects");return e.json()},enabled:t})}function cue(t,e,n,r){return ps({queryKey:["rollouts",t,e],queryFn:async()=>{const i=await fetch(`${Ar}/rollouts`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,step:e})});if(!i.ok)throw new Error("Failed to fetch rollouts");return i.json()},enabled:n&&!!t,refetchInterval:_o})}function uue(t,e,n,r){return ps({queryKey:["rollouts-discarded",t,e],queryFn:async()=>{const i=await fetch(`${Ar}/rollouts-discarded`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,trainer_step:e})});if(!i.ok)throw new Error("Failed to fetch discarded rollouts");return i.json()},enabled:n&&!!t,refetchInterval:_o})}function due(t,e,n,r,i){return ps({queryKey:["evals",t,e,n],queryFn:async()=>{const s=await fetch(`${Ar}/evals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,step:e,eval_name:n})});if(!s.ok)throw new Error("Failed to fetch evals");return s.json()},enabled:r&&!!t,refetchInterval:_o})}function kG(t,e,n,r,i){return ps({queryKey:["sample-details",t,e,n,i??!1],queryFn:async()=>{const s=await fetch(`${Ar}/sample-details`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,group_id:e,sample_idx:n,is_eval:i??!1})});if(!s.ok)throw new Error("Failed to fetch sample details");return s.json()},enabled:r&&!!t&&e!=null&&n!=null})}function w8(t,e,n){const r=T.useMemo(()=>{const s=new Set,a=[];for(const o of e){const l=`${o.group_id}:${o.sample_idx}`;s.has(l)||(s.add(l),a.push(o))}return a.sort((o,l)=>o.group_id-l.group_id||o.sample_idx-l.sample_idx)},[e]),i=T.useMemo(()=>r.map(s=>`${s.group_id}:${s.sample_idx}`).join("|"),[r]);return ps({queryKey:["sample-statuses",t,i],queryFn:async()=>{const s=await fetch(`${Ar}/sample-statuses`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,samples:r})});if(!s.ok)throw new Error("Failed to fetch sample statuses");return s.json()},enabled:n&&!!t&&r.length>0})}function ed(t,e,n){return ps({queryKey:["run-summary",t],queryFn:async()=>{const r=await fetch(`${Ar}/run-summary/${encodeURIComponent(t)}`);if(!r.ok)throw new Error("Failed to fetch run summary");return r.json()},enabled:e&&!!t,refetchInterval:n?_o:!1})}function tD(t,e){return ps({queryKey:["run-code-tree",t],queryFn:async()=>{const n=await fetch(`${Ar}/run-code/tree/${encodeURIComponent(t)}`);if(!n.ok)throw new Error("Failed to fetch run code tree");return n.json()},enabled:e&&!!t,staleTime:6e4})}function nD(t,e,n){return ps({queryKey:["run-code-file",t,e],queryFn:async()=>{const r=await fetch(`${Ar}/run-code/file/${encodeURIComponent(t)}?file_path=${encodeURIComponent(e)}`);if(!r.ok)throw new Error("Failed to fetch run code file");return r.json()},enabled:n&&!!t&&!!e,staleTime:6e4,placeholderData:Xd})}function fue(t,e,n){return ps({queryKey:["run-code-diff-summary",t,e],queryFn:async()=>{const r=await fetch(`${Ar}/run-code/diff-summary/${encodeURIComponent(t)}?right_run_path=${encodeURIComponent(e)}`);if(!r.ok)throw new Error("Failed to fetch run code diff summary");return r.json()},enabled:n&&!!t&&!!e,staleTime:6e4,placeholderData:Xd})}function hue(t,e,n,r,i){return ps({queryKey:["timeline-paginated",t,e,n],queryFn:async()=>{const s=await fetch(`${Ar}/events/timeline-paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n})});if(!s.ok)throw new Error("Failed to fetch paginated timeline");return s.json()},enabled:r&&!!t,refetchInterval:_o,placeholderData:Xd,gcTime:0})}function pue(t,e,n){return ps({queryKey:["inference-events-by-group",t,e],queryFn:async()=>{const r=await fetch(`${Ar}/events/inference-by-group`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,group_id:e})});if(!r.ok)throw new Error("Failed to fetch inference events by group");return r.json()},enabled:n&&!!t&&e!==null})}function mue(t,e,n,r,i){return ps({queryKey:["trainer-breakdown-events",t,e,n,r],queryFn:async()=>{const s=await fetch(`${Ar}/events/trainer-breakdown`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,parent_event_type:e,rank:n,step:r})});if(!s.ok)throw new Error("Failed to fetch trainer breakdown events");return s.json()},enabled:i&&!!t&&!!e&&n!==null&&r!==null})}function gue(t,e,n,r,i,s,a){const o=n.filter(l=>Number.isFinite(l.rank));return see({queries:o.map(l=>({queryKey:["gpu-metrics-rank",t,e,l.rank,l.node_id??null,l.local_rank??null,l.source??null,r,i],queryFn:async()=>{const c=await fetch(`${Ar}/system-metrics/gpu`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,metric_names:e,rank:l.rank,node_id:l.node_id??null,local_rank:l.local_rank??null,source:l.source??null,include_associated_system_metrics:!0,include_edge_points:!0,start_time:r,end_time:i,limit:5e4})});if(!c.ok)throw new Error("Failed to fetch rank-scoped GPU metrics");return c.json()},enabled:s&&!!t&&Number.isFinite(l.rank),refetchInterval:_o,placeholderData:Xd}))})}function vue(t,e,n,r,i,s){return ps({queryKey:["gpu-metrics-paginated",t,e,n,r],queryFn:async()=>{const a=await fetch(`${Ar}/system-metrics/gpu-paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n,align_to_latest:r})});if(!a.ok)throw new Error("Failed to fetch paginated GPU metrics");return a.json()},enabled:i&&!!t,refetchInterval:_o,placeholderData:Xd})}function xue(t,e,n,r,i,s,a,o){return ps({queryKey:["cpu-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${Ar}/system-metrics/cpu-paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n,anchor_start_time:r,align_to_latest:i,metric_names:s})});if(!l.ok)throw new Error("Failed to fetch paginated CPU metrics");return l.json()},enabled:a&&!!t,refetchInterval:_o,placeholderData:Xd})}function yue(t,e,n,r,i,s,a,o){return ps({queryKey:["vllm-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${Ar}/vllm-metrics/paginated`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,interval_seconds:n,anchor_start_time:r,align_to_latest:i,metric_names:s})});if(!l.ok)throw new Error("Failed to fetch paginated vLLM metrics");return l.json()},enabled:a&&!!t,refetchInterval:_o,placeholderData:Xd})}function bue(t,e,n,r){const i=my(),s=T.useRef([]),a=t.join("\0"),o=s.current.join("\0");if(a!==o){const l=s.current;if(l.length>0&&t.length<l.length){const c=new Set(l);if(t.every(h=>c.has(h))){const h=["step-metrics-multi",l,e],g=i.getQueryData(h);if(g){const v=new Set(t),b=["step-metrics-multi",t,e];i.setQueryData(b,{runs:g.runs.filter(_=>v.has(_.run_path))})}}}s.current=t}return ps({queryKey:["step-metrics-multi",t,e],queryFn:async()=>{const l=await fetch(`${Ar}/step-metrics/multi`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_paths:t,metric_names:e,limit:1e5})});if(!l.ok)throw new Error("Failed to fetch step metrics (multi-run)");return l.json()},enabled:n&&t.length>0,refetchInterval:r?_o:!1,staleTime:_o})}function Or(t,e,n){return ps({queryKey:["step-times",t],queryFn:async()=>{const r=await fetch(`${Ar}/step-times`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t})});if(!r.ok)throw new Error("Failed to fetch step times");return r.json()},enabled:e&&!!t,refetchInterval:n?_o:!1})}function PG(t,e,n,r){return ps({queryKey:["step-metric-single",t,e],queryFn:async()=>{const i=await fetch(`${Ar}/step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,metric_names:[e],limit:1e5})});if(!i.ok)throw new Error("Failed to fetch step metric");return i.json()},enabled:n&&!!t&&!!e,refetchInterval:r?_o:!1,placeholderData:Xd})}function _ue(t,e,n,r,i,s){return ps({queryKey:["eval-step-metric-single",t,e,n,s??null],queryFn:async()=>{const a={run_path:t,eval_name:e,metric_names:[n],limit:1e5};s!==void 0&&(a.sample_idx=s);const o=await fetch(`${Ar}/eval-step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error("Failed to fetch eval step metric");return o.json()},enabled:r&&!!t&&!!e&&!!n,refetchInterval:i?_o:!1,placeholderData:Xd})}function Sue(t,e,n,r,i){const s=my(),a=T.useRef([]),o=t.join("\0"),l=a.current.join("\0");if(o!==l){const c=a.current;if(c.length>0&&t.length<c.length){const d=new Set(c);if(t.every(g=>d.has(g))){const g=["eval-step-metrics-multi",c,e,n],v=s.getQueryData(g);if(v){const b=new Set(t),_=["eval-step-metrics-multi",t,e,n];s.setQueryData(_,{runs:v.runs.filter(w=>b.has(w.run_path))})}}}a.current=t}return ps({queryKey:["eval-step-metrics-multi",t,e,n],queryFn:async()=>({runs:await Promise.all(t.map(async d=>{const h=await fetch(`${Ar}/eval-step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:d,eval_name:e,metric_names:n,limit:1e5})});if(!h.ok)return{run_path:d,metrics:[]};const g=await h.json();return{run_path:d,metrics:g.metrics??[]}}))}),enabled:r&&t.length>0&&!!e&&n.length>0,refetchInterval:i?_o:!1,staleTime:_o})}function wue(t,e,n,r){return ps({queryKey:["step-histogram",t,e,n],queryFn:async()=>{const i=await fetch(`${Ar}/step-histogram`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,step:e,metric_type:n})});if(!i.ok)throw new Error("Failed to fetch step histogram");return i.json()},enabled:r&&!!t&&e!==null&&!!n,staleTime:6e4,placeholderData:Xd})}function IG(t,e,n,r){return ps({queryKey:["step-distribution-over-time",t,e],queryFn:async()=>{const i=await fetch(`${Ar}/step-distribution-over-time`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,metric_type:e,num_bins:10})});if(!i.ok)throw new Error("Failed to fetch step distribution over time");return i.json()},enabled:n&&!!t&&!!e,refetchInterval:r?_o:!1,staleTime:3e4,placeholderData:Xd})}function DG(){return ps({queryKey:["custom-metrics-layout"],queryFn:async()=>{const t=await fetch(`${Ar}/custom-metrics-layout`);if(!t.ok)throw new Error("Failed to fetch custom metrics layout");return t.json()},staleTime:6e4})}function K0(t,e){const n=Math.abs(e)<600;return new Date(t*1e3).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",...n?{second:"2-digit"}:{},hour12:!1})}function sp(t){return`${t.toFixed(0)}s`}function qu(t){if(Number.isInteger(t))return t.toLocaleString();const e=Math.abs(t);if(e===0)return"0.0";if(e>=1)return t.toFixed(1);if(e>=.01)return t.toFixed(2);const n=Math.max(2,Math.ceil(-Math.log10(e))+1);return t.toFixed(n)}function OG(t){const e=Math.abs(t);if(e===0)return"0.00";if(e>=1)return t.toFixed(1);if(e>=.01)return t.toFixed(2);const n=Math.max(2,Math.ceil(-Math.log10(e))+1);return t.toFixed(n)}function mT(t){if(t<60)return`${OG(t)}s`;const e=Math.floor(t),n=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return n>0?`${n}h ${r}m`:`${r}m ${i}s`}function rD(t){const e=`${OG(t)}s`;return t<60?e:`${mT(t)} <span class="text-muted-foreground font-normal">(${e})</span>`}function nv(t){const e=Math.abs(t);if(e>=3600){const n=t/3600;return`${parseFloat(n.toFixed(1))}h`}if(e>=60){const n=t/60;return`${parseFloat(n.toFixed(1))}m`}return e<.1&&e!==0?`${parseFloat((t*1e3).toFixed(1))}ms`:`${parseFloat(t.toFixed(1))}s`}function gT(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60),r=Math.floor(t%60);return e>0&&n>0&&r>0?`${e}h ${n}m ${r}s`:e>0&&n>0?`${e}h ${n}m`:e>0&&r>0?`${e}h ${r}s`:e>0?`${e}h`:n>0&&r>0?`${n}m ${r}s`:n>0?`${n}m`:`${r}s`}function W1(t){if(!t)return"";let e=t;/[Zz]|[+-]\d{2}(:\d{2})?$/.test(t)||(e=t+"Z");const n=new Date(e),i=new Date().getTime()-n.getTime(),s=Math.floor(i/(1e3*60)),a=Math.floor(i/(1e3*60*60)),o=Math.floor(i/(1e3*60*60*24)),l=Math.floor(o/30),c=Math.floor(o/365);return c>=1?`${c}y`:l>=1?`${l}mo`:o>=1?`${o}d`:a>=1?`${a}h`:`${Math.max(1,s)}m`}const h1=16,Mue=6,iD=4,Tue=2;function LG(t,e=h1){const n=Math.max(Mue,e);if(!t||t.length<=n)return{prefix:t,suffix:"",isTruncated:!1};const r=Math.max(Tue,n-iD);return{prefix:t.slice(0,r),suffix:t.slice(-iD),isTruncated:!0}}function Ki({...t}){return p.jsx(tte,{"data-slot":"collapsible",...t})}function Zi({...t}){return p.jsx(nte,{"data-slot":"collapsible-trigger",...t})}function Qi({...t}){return p.jsx(rte,{"data-slot":"collapsible-content",...t})}function Eue(t,e=0){try{return JSON.stringify(t,(r,i)=>i&&typeof i=="object"&&!Array.isArray(i)?Object.keys(i).sort().reduce((s,a)=>(s[a]=i[a],s),{}):i,e)??String(t)}catch{return String(t)}}function Cue(t){if(t==null)return null;const e=typeof t=="object"&&t!==null&&"value"in t?t.value:t;return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||Array.isArray(e)||typeof e=="object"&&e!==null?e:null}function Aue(t){return t==null?"—":typeof t=="boolean"?t?"True":"False":typeof t=="number"?Number.isInteger(t)?t.toLocaleString():Math.abs(t)<.001&&t!==0?t.toExponential(2):t.toLocaleString(void 0,{maximumFractionDigits:6}):typeof t=="object"?Eue(t,2):String(t)}function Nue(t){if(typeof t!="string")return t;const e=t.trim();if(!e)return t;const n=e.startsWith("{")&&e.endsWith("}"),r=e.startsWith("[")&&e.endsWith("]");if(!n&&!r)return t;try{const i=JSON.parse(e);if(Array.isArray(i)||i&&typeof i=="object")return i}catch{}return t}function sD(t){const e=t.split("/"),n=e[e.length-1],r=n.replace(/^_+/,"");return(r.length>0?r:n).replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Rue(t){const e=[{key:"general",label:"General",match:l=>l==="debug",order:["debug"]},{key:"model",label:"Model",match:l=>l==="model"||l==="model_dtype"||l==="mixed_precision_dtype",order:["model","model_dtype","mixed_precision_dtype"]},{key:"ray_cluster",label:"Ray Cluster",match:l=>l.startsWith("ray_")&&l!=="ray_torch_memory_drain_interval_seconds",order:["ray_address","ray_auto_start_local","ray_namespace","ray_log_to_driver","ray_disable_runtime_env_hook","ray_pin_py_executable","ray_propagate_active_venv","ray_propagate_run_dir","ray_broadcast_init_timeout_s","ray_broadcast_prefer_loopback_if_single_node","ray_shutdown_on_exit","ray_inference_cpus_per_worker","ray_trainer_cpus_per_worker","ray_inference_placement_strategy","ray_trainer_placement_strategy","ray_placement_timeout_s"]},{key:"workers",label:"Workers",match:l=>["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"].includes(l),order:["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"]},{key:"orchestrator",label:"Orchestrator",match:l=>["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"].includes(l),order:["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"]},{key:"trainer",label:"Trainer",match:l=>["learning_rate","weight_decay","grad_clip","lr_scheduler","warmup_steps","min_lr_ratio","train_backend","fsdp_activation_checkpointing","jit"].includes(l)||l.startsWith("megatron_"),order:["learning_rate","weight_decay","grad_clip","lr_scheduler","warmup_steps","min_lr_ratio","train_backend","fsdp_activation_checkpointing","jit","megatron_tensor_parallel_size","megatron_pipeline_parallel_size","megatron_context_parallel_size","megatron_expert_parallel_size","megatron_disable_unified_memory_jit","megatron_optimizer_cpu_offload","megatron_optimizer_offload_fraction","megatron_overlap_cpu_optimizer_d2h_h2d","megatron_use_precision_aware_optimizer","megatron_main_grads_dtype","megatron_main_params_dtype","megatron_exp_avg_dtype","megatron_exp_avg_sq_dtype"]},{key:"algorithm",label:"Algorithm",match:l=>["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","dr_grpo_loss_agg_mode","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"].includes(l),order:["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","dr_grpo_loss_agg_mode","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"]},{key:"weight_sync",label:"Weight Sync",match:l=>l.startsWith("weight_broadcast_"),order:["weight_broadcast_mode","weight_broadcast_bucket_mb","weight_broadcast_cpu_staging"]},{key:"sequence_packing",label:"Sequence Packing",match:l=>l==="seq_len"||l==="pad_to_multiple_of",order:["seq_len","pad_to_multiple_of"]},{key:"inference",label:"Inference",match:l=>["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"].includes(l),order:["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"]},{key:"rollout",label:"Rollout / Sampling",match:l=>["group_size","temperature","max_tokens","top_p","interleaved_rollouts"].includes(l),order:["group_size","temperature","max_tokens","top_p","interleaved_rollouts"]},{key:"checkpoint",label:"Checkpoint",match:l=>["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"].includes(l),order:["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"]},{key:"logging",label:"Logging",match:l=>l==="use_wandb"||l.startsWith("wandb_")||l==="_wandb"||l.startsWith("event_")||l.endsWith("_interval_seconds")||l==="rollout_block_size"||l==="track_gpu_events",order:["use_wandb","wandb_project","wandb_run_name","wandb_tags","wandb_upload_code","wandb_code_max_file_size_mb","wandb_code_exclude_patterns","system_metrics_collection_interval_seconds","torch_memory_sample_interval_seconds","event_tail_window_seconds","event_block_duration_seconds","event_upload_interval_seconds","metrics_logger_interval_seconds","ray_torch_memory_drain_interval_seconds","rollout_block_size","track_gpu_events"]},{key:"evals",label:"Evals",match:l=>l.startsWith("eval_")||l==="evals",order:["eval_before_training","eval_after_training","eval_num_servers","eval_start_end_use_all_servers","evals"]},{key:"vllm_tracing",label:"vLLM Tracing",match:l=>l==="enable_vllm_tracing"||l==="otlp_receiver_port",order:["enable_vllm_tracing","otlp_receiver_port"]},{key:"environments",label:"Environments",match:l=>l==="environments"},{key:"setup/gpu",label:"GPU",match:l=>l.startsWith("setup/gpu/")},{key:"setup/cpu",label:"CPU",match:l=>l.startsWith("setup/cpu/")},{key:"setup/memory",label:"Memory",match:l=>l.startsWith("setup/memory/")},{key:"setup/disk",label:"Disk",match:l=>l.startsWith("setup/disk/")},{key:"setup/network",label:"Network",match:l=>l.startsWith("setup/network/")},{key:"setup/os",label:"Operating System",match:l=>l.startsWith("setup/os/")},{key:"setup/package_versions",label:"Package Versions",match:l=>l.startsWith("setup/package_versions/")}],n=new Map;for(const l of e)n.set(l.key,{key:l.key,label:l.label,items:[]});for(const[l,c]of Object.entries(t)){const d=Cue(c),h=l==="environments"?Nue(d):d;let g=!1;for(const v of e)if(v.match(l)){n.get(v.key).items.push({key:l,displayKey:sD(l),value:h}),g=!0;break}g||(n.has("other")||n.set("other",{key:"other",label:"Other",items:[]}),n.get("other").items.push({key:l,displayKey:sD(l),value:h}))}const r=new Map(e.map(l=>[l.key,l]));for(const[,l]of n){const c=r.get(l.key);if(c!=null&&c.order&&l.items.length>1){const d=new Map(c.order.map((h,g)=>[h,g]));l.items.sort((h,g)=>{const v=d.get(h.key)??1/0,b=d.get(g.key)??1/0;return v!==b?v-b:h.key.localeCompare(g.key)})}}const i=new Set(["setup/gpu","setup/cpu","setup/memory","setup/disk","setup/network","setup/os","setup/package_versions"]),s=["general","model","ray_cluster","workers","orchestrator","trainer","algorithm","weight_sync","sequence_packing","inference","rollout","checkpoint","logging","evals","vllm_tracing","environments","hardware","other"],a=[];for(const l of i){const c=n.get(l);c&&c.items.length>0&&a.push(c)}const o=[];for(const l of s)if(l==="hardware")a.length>0&&o.push({key:"hardware",label:"Hardware & Environment",items:[],subcategories:a});else{const c=n.get(l);c&&c.items.length>0&&o.push(c)}return o}function kue({displayKey:t,value:e}){const n=Aue(e);return typeof e=="object"&&e!==null?p.jsxs("div",{className:"py-1 rounded-md hover:bg-muted/50 transition-colors group",children:[p.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:t}),p.jsx("pre",{className:"mt-1 text-xs font-sans font-medium rounded-md bg-muted/40 border border-border/40 p-2 whitespace-pre-wrap break-all max-h-72 overflow-auto",children:n})]}):p.jsxs("div",{className:"flex items-baseline gap-2 py-1 rounded-md hover:bg-muted/50 transition-colors group",children:[p.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors whitespace-nowrap",children:t}),p.jsx("span",{className:"text-sm font-sans font-medium break-all",children:n})]})}const Pue="ml-[22px]",Iue="ml-[38px]";function zG({category:t,defaultOpen:e=!1,nested:n=!1,collapseAllSignal:r=0,expandAllSignal:i=0}){const[s,a]=T.useState(e),[o,l]=T.useState(r),[c,d]=T.useState(i);r!==o&&(l(r),a(!1)),i!==c&&(d(i),a(!0));const h=t.subcategories&&t.subcategories.length>0;return p.jsxs(Ki,{open:s,onOpenChange:a,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:Rt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",n&&"ml-4"),children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!s&&"-rotate-90")}),p.jsx("span",{className:"text-sm font-semibold",children:t.label})]})})}),p.jsx(Qi,{children:h?p.jsx("div",{className:"mt-1",children:t.subcategories.map(g=>p.jsx(zG,{category:g,nested:!0,collapseAllSignal:r,expandAllSignal:i},g.key))}):p.jsx("div",{className:Rt("mt-1",n?Iue:Pue),children:t.items.map(g=>p.jsx(kue,{displayKey:g.displayKey,value:g.value},g.key))})})]})}function jG({config:t,collapseAllSignal:e=0,expandAllSignal:n=0}){const r=T.useMemo(()=>Rue(t),[t]),i=new Set(["model","environments"]);return r.length===0?p.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"}):p.jsx("div",{className:"space-y-1",children:r.map(s=>p.jsx(zG,{category:s,defaultOpen:i.has(s.key),collapseAllSignal:e,expandAllSignal:n},s.key))})}const FG="#e67439",Due="linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",Oue=["#865ed6","#f07fdd","#e67439","#87cec0","#dc4cdc","#ffb83e","#5ac5db","#239487","#fab796","#9bc750","#ad6f51","#c2337a","#a2a9ad","#538ae6","#f1444f","#479a60"];function p1(t){return Math.max(0,Math.min(1,t))}function Wg(t){return Math.max(0,Math.min(255,Math.round(t)))}function d2({r:t,g:e,b:n}){const r=i=>i.toString(16).padStart(2,"0");return`#${r(Wg(t))}${r(Wg(e))}${r(Wg(n))}`}function M8(t){const e=t.trim(),n=/^#([0-9a-f]{3})$/i.exec(e);if(n){const[i,s,a]=n[1].split("");return{r:Number.parseInt(i+i,16),g:Number.parseInt(s+s,16),b:Number.parseInt(a+a,16)}}const r=/^#([0-9a-f]{6})$/i.exec(e);return r?{r:Number.parseInt(r[1].slice(0,2),16),g:Number.parseInt(r[1].slice(2,4),16),b:Number.parseInt(r[1].slice(4,6),16)}:null}function Lue({r:t,g:e,b:n}){const r=t/255,i=e/255,s=n/255,a=Math.max(r,i,s),o=Math.min(r,i,s),l=a-o;let c=0;return l!==0&&(a===r?c=60*((i-s)/l%6):a===i?c=60*((s-r)/l+2):c=60*((r-i)/l+4)),c<0&&(c+=360),{h:c,s:a===0?0:l/a,v:a}}function zue({h:t,s:e,v:n}){const r=(t%360+360)%360,i=p1(e),s=p1(n),a=s*i,o=a*(1-Math.abs(r/60%2-1)),l=s-a;let c=0,d=0,h=0;return r<60?(c=a,d=o):r<120?(c=o,d=a):r<180?(d=a,h=o):r<240?(d=o,h=a):r<300?(c=o,h=a):(c=a,h=o),{r:Wg((c+l)*255),g:Wg((d+l)*255),b:Wg((h+l)*255)}}function jue(t,e){const n=M8(t);if(!n)return"#000000";const r=p1(1-e);return d2({r:n.r*r,g:n.g*r,b:n.b*r})}function M_(t,e=FG){const n=M8(t);return n?d2(n):e}function Fue({value:t,onChange:e,className:n}){const r=T.useMemo(()=>M_(t,FG),[t]),i=T.useMemo(()=>M8(r),[r]),s=T.useMemo(()=>Lue(i),[i]),[a,o]=T.useState(r.slice(1).toUpperCase());T.useEffect(()=>{o(r.slice(1).toUpperCase())},[r]);const l=T.useCallback(v=>{const b=d2(zue(v));e(b)},[e]),c=T.useCallback(v=>{const b=v.currentTarget.getBoundingClientRect(),_=p1((v.clientX-b.left)/b.width),w=p1((v.clientY-b.top)/b.height);l({h:s.h,s:_,v:1-w})},[s.h,l]),d=T.useCallback(v=>{const b=v.currentTarget.getBoundingClientRect(),_=p1((v.clientX-b.left)/b.width);l({h:_*360,s:s.s,v:s.v})},[s.s,s.v,l]),h=T.useCallback(()=>{const b=`#${a.replace(/[^0-9a-f]/gi,"")}`,_=M_(b,r);o(_.slice(1).toUpperCase()),_!==r&&e(_)},[a,r,e]),g=T.useCallback((v,b)=>{const _=Number.parseInt(b,10);if(Number.isNaN(_))return;const w={...i,[v]:Wg(_)};e(d2(w))},[e,i]);return p.jsxs("div",{className:Rt("w-[196px] space-y-1.5 text-[10px]",n),children:[p.jsxs("div",{className:"relative h-28 w-full cursor-crosshair overflow-hidden rounded-md border border-border touch-none select-none",style:{backgroundColor:`hsl(${s.h.toFixed(0)} 100% 50%)`},onPointerDown:v=>{v.preventDefault(),v.currentTarget.setPointerCapture(v.pointerId),c(v)},onPointerMove:v=>{v.currentTarget.hasPointerCapture(v.pointerId)&&c(v)},onPointerUp:v=>{v.currentTarget.hasPointerCapture(v.pointerId)&&v.currentTarget.releasePointerCapture(v.pointerId)},children:[p.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white to-transparent"}),p.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black to-transparent"}),p.jsx("div",{className:"pointer-events-none absolute h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(0,0,0,0.25)]",style:{left:`${s.s*100}%`,top:`${(1-s.v)*100}%`}})]}),p.jsx("div",{className:"relative h-2 w-full cursor-ew-resize rounded-md border border-border touch-none select-none",style:{background:Due},onPointerDown:v=>{v.preventDefault(),v.currentTarget.setPointerCapture(v.pointerId),d(v)},onPointerMove:v=>{v.currentTarget.hasPointerCapture(v.pointerId)&&d(v)},onPointerUp:v=>{v.currentTarget.hasPointerCapture(v.pointerId)&&v.currentTarget.releasePointerCapture(v.pointerId)},children:p.jsx("div",{className:"pointer-events-none absolute top-1/2 h-2.5 w-1.5 -translate-y-1/2 rounded border border-white shadow-[0_0_0_1px_rgba(0,0,0,0.35)]",style:{left:`calc(${s.h/360*100}% - 3px)`}})}),p.jsxs("div",{className:"grid grid-cols-[1fr_48px] items-end gap-1",children:[p.jsxs("div",{className:"space-y-0.5",children:[p.jsx("label",{className:"text-[8px] uppercase tracking-wide text-muted-foreground",children:"Hex"}),p.jsx(W0,{value:a,onChange:v=>{o(v.target.value.replace(/[^0-9a-f]/gi,"").slice(0,6).toUpperCase())},onBlur:h,onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),h())},className:"h-6 px-1.5 font-sans !text-[11px] md:!text-[11px] uppercase","aria-label":"Hex color"})]}),p.jsx("div",{className:"h-6 rounded-md border border-border",style:{backgroundColor:r},"aria-label":"Selected color preview"})]}),p.jsx("div",{className:"grid grid-cols-3 gap-1",children:[["R",i.r,"r"],["G",i.g,"g"],["B",i.b,"b"]].map(([v,b,_])=>p.jsxs("div",{className:"space-y-0.5",children:[p.jsx("label",{className:"text-[8px] uppercase tracking-wide text-muted-foreground",children:v}),p.jsx(W0,{type:"number",min:0,max:255,value:b,onChange:w=>g(_,w.target.value),className:"h-6 px-1.5 !text-[11px] md:!text-[11px]","aria-label":`${v} channel`})]},v))}),p.jsx("div",{className:"grid grid-cols-8 gap-x-0.5 gap-y-1.5 pt-0.5",children:Oue.map(v=>p.jsx("button",{type:"button",className:Rt("h-4 w-4 rounded-[3px] border transition",r===v?"ring-1 ring-foreground/70 ring-offset-0":"hover:brightness-[0.97]"),style:{backgroundColor:v,borderColor:jue(v,.2)},onClick:()=>e(v),"aria-label":`Use color ${v}`},v))})]})}const UG=[{key:"pausing_syncs",label:"Pausing syncs"},{key:"exporting",label:"Exporting database"},{key:"importing",label:"Compressing data"},{key:"finalizing",label:"Finalizing"}],Uue=UG.map(t=>t.key);function Bue(t){return Uue.indexOf(t)}function HC(t){return t>=1024**3?`${(t/1024**3).toFixed(2)} GB`:t>=1024**2?`${(t/1024**2).toFixed(1)} MB`:t>=1024?`${(t/1024).toFixed(0)} KB`:`${t} B`}function Hue({open:t,onOpenChange:e}){const[n,r]=T.useState(null),[i,s]=T.useState(!1),[a,o]=T.useState(null),l=T.useRef(null),c=a!=null&&a.status!=="idle"&&a.status!=="done"&&a.status!=="error",d=T.useCallback(async()=>{s(!0);try{const S=await fetch(`${Ar}/database-info`);if(S.ok){const E=await S.json();r(E.size_bytes)}}catch{}finally{s(!1)}},[]);T.useEffect(()=>(t&&(d(),o(null)),()=>{l.current&&clearInterval(l.current),l.current=null}),[t,d]);const h=async()=>{try{const S=await fetch(`${Ar}/compact-database`,{method:"POST"});if(!S.ok){const E=await S.json().catch(()=>({}));o({status:"error",error:E.detail||"Failed to start compaction",size_before:null,size_after:null});return}o({status:"pausing_syncs",error:null,size_before:null,size_after:null}),l.current=setInterval(async()=>{try{const E=await fetch(`${Ar}/compact-database/status`);if(E.ok){const A=await E.json();o(A),(A.status==="done"||A.status==="error")&&(l.current&&clearInterval(l.current),l.current=null,A.status==="done"&&A.size_after!=null&&r(A.size_after))}}catch{}},500)}catch(S){o({status:"error",error:S instanceof Error?S.message:"Unknown error",size_before:null,size_after:null})}},g=S=>{c&&!S||e(S)},v=a?Bue(a.status):-1,b=(a==null?void 0:a.status)==="done",_=(a==null?void 0:a.status)==="error",w=a!=null&&a.status!=="idle";return p.jsx($f,{open:t,onOpenChange:g,children:p.jsxs(qf,{className:Rt("sm:max-w-md",c&&"[&>[data-slot=dialog-close]]:hidden"),onInteractOutside:S=>{c&&S.preventDefault()},onEscapeKeyDown:S=>{c&&S.preventDefault()},children:[p.jsxs(jd,{children:[p.jsxs(Fd,{className:"flex items-center gap-2",children:[p.jsx(Ile,{className:"h-4 w-4"}),"Database"]}),!w&&p.jsx(kg,{children:"Manage your local database storage."})]}),!w&&p.jsxs("div",{className:"space-y-4 py-2",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:"Database size"}),p.jsx("span",{className:"text-sm font-medium",children:i?p.jsx(ll,{className:"h-3.5 w-3.5"}):n!=null?HC(n):"—"})]}),p.jsx("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:p.jsx("p",{className:"text-xs text-muted-foreground",children:"Compressing rewrites the database to reclaim unused space and apply optimal compression. This can reduce the file size by 20–30% depending on the data. Syncs will be paused during compression."})})]}),w&&p.jsxs("div",{className:"space-y-3 py-2",children:[UG.map((S,E)=>{const A=S.key===a.status,N=b||v>E||_&&v>E,D=_&&S.key===a.status;return p.jsxs("div",{className:"flex items-center gap-2.5",children:[N?p.jsx(Ale,{className:"h-4 w-4 text-green-500 shrink-0"}):D?p.jsx(Rle,{className:"h-4 w-4 text-destructive shrink-0"}):A?p.jsx(ll,{className:"h-4 w-4 text-primary shrink-0"}):p.jsx("div",{className:"h-4 w-4 rounded-full border border-border shrink-0"}),p.jsxs("span",{className:Rt("text-sm",N&&"text-muted-foreground",A&&!_&&"text-foreground font-medium",D&&"text-destructive font-medium",!N&&!A&&!D&&"text-muted-foreground/60"),children:[S.label,A&&!b&&!_&&"…"]})]},S.key)}),c&&p.jsx("p",{className:"text-xs text-muted-foreground pt-1",children:"Do not close the application while compressing."}),b&&a.size_before!=null&&a.size_after!=null&&p.jsx("div",{className:"rounded-md border border-green-500/20 bg-green-500/5 p-3 mt-2",children:p.jsxs("p",{className:"text-sm text-foreground",children:[p.jsx("span",{className:"font-medium",children:HC(a.size_before)})," → ",p.jsx("span",{className:"font-medium text-green-600 dark:text-green-400",children:HC(a.size_after)}),p.jsxs("span",{className:"text-muted-foreground ml-1.5",children:["(",Math.round((1-a.size_after/a.size_before)*100),"% reduction)"]})]})}),_&&a.error&&p.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/5 p-3 mt-2",children:[p.jsx("p",{className:"text-sm text-destructive",children:a.error}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"The original database has been restored."})]})]}),p.jsxs(m8,{children:[!w&&p.jsx(Tn,{onClick:h,disabled:i||n==null,children:"Compress Database"}),(b||_)&&p.jsx(Tn,{onClick:()=>e(!1),children:"Close"})]})]})})}function J3({name:t,className:e,maxChars:n=h1}){const r=e??"text-xs font-sans",{isTruncated:i,prefix:s,suffix:a}=LG(t,n);return i?p.jsxs(vv,{delayDuration:300,children:[p.jsx(xv,{asChild:!0,children:p.jsxs("span",{className:Rt("flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",r),children:[p.jsx("span",{className:"shrink-0",children:s}),p.jsxs("span",{className:"relative shrink-0 inline-flex items-center px-0.5 text-muted-foreground/50",style:{backgroundColor:"var(--run-item-bg)"},children:[p.jsx("span",{className:"pointer-events-none absolute inset-y-0 -left-3 w-3",style:{background:"linear-gradient(to right, transparent, var(--run-item-bg))"},"aria-hidden":"true"}),"..."]}),p.jsx("span",{className:"shrink-0",children:a})]})}),p.jsx(yv,{side:"top",className:"max-w-56 break-all text-xs font-sans",children:t})]}):p.jsx("span",{className:Rt("truncate",r),children:s})}function Vue(){const{pathname:t}=ch(),e=my(),[n,r]=cn(ml),[i,s]=cn(cT),[a,o]=cn(hG),[l,c]=cn(pG),d=zd(fT),h=zd(xG),[g,v]=T.useState(!1),[b,_]=cn(mG),[w,S]=T.useState(""),[E,A]=T.useState(!1),[N,D]=T.useState(null),[P,L]=T.useState(null),[R,O]=T.useState(!1),[W,F]=T.useState(""),[V,G]=T.useState(!1),[Z,B]=T.useState(!1),[q,K]=T.useState(null),[Y,Q]=T.useState(null),[U,j]=T.useState("removed_at"),[X,H]=T.useState("desc"),[ie,ne]=T.useState(null),[re,ue]=T.useState(null),[le,fe]=T.useState(null),[we,pe]=T.useState(null),[xe,Ve]=T.useState(!1),[ye,Oe]=T.useState(""),[he,Re]=T.useState(null),[oe,Ue]=T.useState(!1),[Ee,Pe]=T.useState(null),[Ze,ae]=T.useState({}),te=zd(vG),be=zd(gG),{data:me,isLoading:ge}=pm(),{data:ke,isLoading:Xe}=oue(g),{data:Ae,refetch:je}=lue(b),We=T.useRef(new Map);T.useEffect(()=>{if(!(me!=null&&me.runs))return;const $e=We.current,Tt=[];for(const Et of me.runs){const Ot=$e.get(Et.run_id);Ot!=null&&Ot.is_syncing&&!Et.is_syncing&&Tt.push(Et.run_id),Ot!=null&&Ot.is_tracking&&!Et.is_tracking&&Tt.push(Et.run_id),$e.set(Et.run_id,{is_syncing:Et.is_syncing,is_tracking:Et.is_tracking})}if(Tt.length>0){const Et=[...new Set(Tt)];for(const Ot of Et)e.invalidateQueries({predicate:Gt=>{const an=Gt.queryKey;return Array.isArray(an)?an.some(On=>!!(On===Ot||Array.isArray(On)&&On.includes(Ot))):!1}});e.invalidateQueries({queryKey:["runs"]})}},[me==null?void 0:me.runs,e]),T.useEffect(()=>{if(!(me!=null&&me.runs)||!n)return;const $e=me.runs.find(Tt=>Tt.run_id===n);$e&&(te($e.is_syncing),be($e.is_tracking))},[me==null?void 0:me.runs,n,te,be]),T.useEffect(()=>{t!=="/"&&h(!1)},[t,h]),T.useEffect(()=>{if(!(me!=null&&me.runs))return;const $e=new Set(me.runs.map(Tt=>Tt.run_id));s(Tt=>{const Et=Tt.filter(Ot=>$e.has(Ot));return Et.length===Tt.length?Tt:Et}),n&&!$e.has(n)&&(r(null),te(!1),be(!1))},[me==null?void 0:me.runs,n,r,s,te,be]);const De=T.useMemo(()=>{const $e=(ke==null?void 0:ke.runs)??[];return $e.length===0?$e:[...$e].sort((Tt,Et)=>{const Ot=U;let Gt,an;if(Ot==="run_id"?(Gt=Tt.run_id.split("/").pop()??Tt.run_id,an=Et.run_id.split("/").pop()??Et.run_id):(Gt=Tt[Ot],an=Et[Ot]),Gt==null&&an==null)return 0;if(Gt==null)return 1;if(an==null)return-1;const On=Gt.localeCompare(an);return X==="asc"?On:-On})},[ke==null?void 0:ke.runs,U,X]),Be=$e=>{U===$e?H(Tt=>Tt==="asc"?"desc":"asc"):(j($e),H("asc"))},qe=async $e=>{$e.preventDefault();const Tt=V?{use_netrc:!0}:{api_key:W.trim(),use_netrc:!1};if(!(!V&&!W.trim())){B(!0);try{const Et=await fetch(`${Ar}/wandb-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Tt)});if(!Et.ok){const Ot=await Et.json();throw new Error(Ot.detail||"Failed to configure W&B")}o(!0),e.invalidateQueries({queryKey:["runs"]}),c(!1),F("")}catch(Et){console.error("Failed to configure W&B:",Et)}finally{B(!1)}}},Se=$e=>{v(!1),r($e),fetch(`${Ar}/add-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})}).then(Tt=>{if(!Tt.ok)return Tt.json().then(Et=>{throw new Error(Et.detail||"Failed to add run")})}).then(()=>{e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}).catch(Tt=>{console.error("Failed to add run:",Tt)})},Ye=async()=>{const $e=w.trim();if($e){A(!0),D(null);try{const Tt=await fetch(`${Ar}/add-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:$e})});if(!Tt.ok){const Et=await Tt.json();D(Et.detail||"Failed to add project");return}S(""),_(!1),je(),e.invalidateQueries({queryKey:["runs"]})}catch{D("Failed to add project")}finally{A(!1)}}},dt=async $e=>{L($e);try{const Tt=await fetch(`${Ar}/remove-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:$e})});if(!Tt.ok){const Et=await Tt.json();throw new Error(Et.detail||"Failed to remove project")}je()}catch(Tt){console.error("Failed to remove project:",Tt)}finally{L(null)}},Le=async $e=>{if($e){K($e);try{const Tt=await fetch(`${Ar}/remove-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})});if(!Tt.ok){const Et=await Tt.json();throw new Error(Et.detail||"Failed to remove run")}s(Et=>Et.filter(Ot=>Ot!==$e)),n===$e&&r(null),e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}catch(Tt){console.error("Failed to remove run:",Tt)}finally{K(null),Q(null)}}},st=$e=>{s(Tt=>Tt.includes($e)?Tt.filter(Et=>Et!==$e):[...Tt,$e])},ft=T.useCallback(($e,Tt)=>{e.setQueryData(["runs"],Et=>Et&&{...Et,runs:Et.runs.map(Ot=>Ot.run_id===$e?{...Ot,color:Tt}:Ot)})},[e]),mt=T.useCallback(async($e,Tt,Et)=>{const Ot=M_(Tt,Et);if(Ot.toLowerCase()!==Et.toLowerCase()){ft($e,Ot);try{const Gt=await fetch(`${Ar}/set-run-color`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e,color:Ot})});if(!Gt.ok){let an="Failed to update run color";try{an=(await Gt.json()).detail??an}catch{}throw new Error(an)}}catch(Gt){console.error("Failed to update run color:",Gt),ft($e,Et)}finally{e.invalidateQueries({queryKey:["runs"]})}}},[e,ft]),tt=T.useCallback(($e,Tt,Et)=>{if(Tt){Pe($e),ae(Gt=>Gt[$e]===Et?Gt:{...Gt,[$e]:Et});return}Pe(Gt=>Gt===$e?null:Gt);const Ot=Ze[$e];Ot&&mt($e,Ot,Et),ae(Gt=>{if(!($e in Gt))return Gt;const an={...Gt};return delete an[$e],an})},[mt,Ze]),Qe=T.useCallback(async $e=>{fe($e);try{const Tt=me==null?void 0:me.runs.find(Ot=>Ot.run_id===$e);Tt!=null&&Tt.is_tracking&&await fetch(`${Ar}/stop-tracking`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})});const Et=await fetch(`${Ar}/delete-run-data`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})});if(!Et.ok){const Ot=await Et.json();throw new Error(Ot.detail||"Failed to delete run data")}await fetch(`${Ar}/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})}),e.invalidateQueries({queryKey:["run-summary",$e]}),e.invalidateQueries({queryKey:["runs"]})}catch(Tt){console.error("Failed to force full resync:",Tt)}finally{fe(null),ue(null)}},[me==null?void 0:me.runs,e]),ze=T.useCallback(async $e=>{pe($e);try{const Tt=await fetch(`${Ar}/sync-evals-after-training`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e})});if(!Tt.ok){const Et=await Tt.json();throw new Error(Et.detail||"Failed to start evals sync")}e.invalidateQueries({queryKey:["run-summary",$e]}),e.invalidateQueries({queryKey:["runs"]})}catch(Tt){console.error("Failed to sync evals after training:",Tt)}finally{pe(null)}},[e]),Te=ye.trimStart().toLowerCase().startsWith("config:"),He=T.useCallback(async()=>{const Tt=ye.trimStart().slice(7).trim();if(Tt){Ue(!0);try{const Et=await fetch(`${Ar}/search-runs-by-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filters:Tt})});if(!Et.ok){Re([]);return}const Ot=await Et.json();Re(Ot.run_ids??[])}catch{Re([])}finally{Ue(!1)}}},[ye]);T.useEffect(()=>{Te||Re(null)},[Te]);const et=(me==null?void 0:me.runs)||[],ht=me==null?void 0:me.discovery,ct=(me==null?void 0:me.has_wandb_key)??a,bt=(me==null?void 0:me.has_netrc_wandb_key)??!1,wt=(me==null?void 0:me.wandb_key_source)??"unconfigured";T.useEffect(()=>{l&&G(wt==="netrc")},[l,wt]);const Pt=[{title:"Overview",href:"/",isActive:t==="/"},{title:"Metrics",href:"/metrics",isActive:t==="/metrics"},{title:"Rollouts",href:"/rollouts",isActive:t==="/rollouts"},{title:"Rollouts Discarded",href:"/rollouts-discarded",isActive:t==="/rollouts-discarded"},{title:"Timeline",href:"/timeline",isActive:t==="/timeline"},{title:"Infra",href:"/infra",isActive:t==="/infra"},{title:"Evals",href:"/evals",isActive:t==="/evals"}];return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex flex-col h-screen w-56 shrink-0 border-r border-sidebar-border bg-sidebar text-sidebar-foreground fixed left-0 top-0",children:[p.jsx("div",{className:"py-2.5 px-4 border-b border-sidebar-border shrink-0",children:p.jsx(qM,{to:"/about",className:"flex items-center h-7 hover:opacity-80 transition-opacity",children:p.jsx("img",{src:"/logo-full.svg",alt:"Telescope",className:"h-5"})})}),p.jsx("nav",{className:"flex flex-col gap-1 p-2 border-b border-sidebar-border shrink-0",children:Pt.map($e=>p.jsx(qM,{to:$e.href,onClick:()=>{$e.href==="/"&&h(!1)},className:Rt("rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",$e.isActive&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),children:$e.title},$e.href))}),p.jsxs("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[p.jsxs("div",{className:"px-2 py-2 shrink-0 flex items-center gap-1",children:[p.jsxs("div",{className:"relative flex-1 min-w-0",children:[p.jsx(W0,{type:"text",placeholder:"Search runs…",value:ye,onChange:$e=>Oe($e.target.value),onKeyDown:$e=>{$e.key==="Enter"&&Te&&($e.preventDefault(),He())},className:Rt("h-6 text-[11px] w-full placeholder:text-muted-foreground/60 placeholder:text-[10px]",Te&&"pr-10")}),Te&&p.jsx(Tn,{variant:"default",size:"sm",className:"absolute right-0.5 top-1/2 -translate-y-1/2 h-4 px-1.5 text-[9px] rounded-sm",onClick:He,disabled:oe,children:oe?p.jsx(ll,{className:"h-2.5 w-2.5"}):"Go"})]}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-foreground",children:p.jsx(jN,{className:"h-3.5 w-3.5"})})}),p.jsxs(pl,{align:"end",className:"w-48",children:[p.jsx(_c,{className:"text-xs",onClick:()=>_(!0),children:"Add Project"}),p.jsx(_c,{className:"text-xs",onClick:()=>v(!0),children:"Add Run"}),p.jsxs(_c,{className:"text-xs",onClick:()=>c(!0),children:["W&B Key"," ",ct?p.jsx("span",{className:"!text-green-500 ml-1",children:"added"}):p.jsx("span",{className:"!text-red-500 ml-1",children:"missing"})]}),p.jsx(Hl,{}),p.jsx(_c,{className:"text-xs",onClick:()=>{s([]),r(null)},children:"Unselect All"}),p.jsxs(_c,{className:"text-xs flex items-center justify-between",onClick:()=>Ve($e=>!$e),children:["Only Show Selected",p.jsx(bv,{className:Rt("h-3.5 w-3.5",xe?"opacity-100":"opacity-0")})]}),p.jsx(Hl,{}),p.jsx(_c,{className:"text-xs flex items-center gap-1.5",onClick:()=>O(!0),children:"Database"})]})]})]}),(ht==null?void 0:ht.status)==="discovering"?p.jsx("div",{className:"px-4 pb-2 shrink-0",children:p.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-muted/50 px-2.5 py-2",children:[p.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Fetching runs from W&B…"}),p.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[p.jsx(ll,{className:"h-3 w-3 shrink-0"}),(ht==null?void 0:ht.runs_found)??0," found"]}),p.jsx("span",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Looking for telescope-tagged runs…"})]})}):null,p.jsx(_v,{className:"flex-1 min-h-0 overflow-hidden",children:p.jsx("div",{className:"px-2 pb-2",children:ge?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx(ll,{className:"h-4 w-4"})}):p.jsxs("div",{className:"flex flex-col",children:[et.filter($e=>{if(xe&&n!==$e.run_id&&!i.includes($e.run_id))return!1;if(Te){if(he!==null&&!he.includes($e.run_id))return!1}else if(ye.trim()){const Tt=ye.trim().toLowerCase(),Et=($e.name||"").toLowerCase(),Ot=$e.run_id.toLowerCase();if(!Et.includes(Tt)&&!Ot.includes(Tt))return!1}return!0}).map($e=>{const Tt=n===$e.run_id,Et=Tt||i.includes($e.run_id),Ot=Ze[$e.run_id],Gt=M_(Ot??$e.color,$e.color),an=$e.last_rollout_step===-1&&!$e.is_syncing&&!$e.is_tracking,On=Number($e.is_tracking)+Number($e.is_syncing),Bt=On>=2?h1-4:On===1?h1-2:h1-1,fn=$e.name||$e.run_id.split("/").pop()||$e.run_id;return p.jsxs("div",{className:Rt("group flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors w-full cursor-pointer",!Tt&&"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [--run-item-bg:var(--sidebar)] hover:[--run-item-bg:var(--sidebar-accent)]",Tt&&"bg-[var(--sidebar-selected)] text-sidebar-accent-foreground [--run-item-bg:var(--sidebar-selected)]"),onClick:()=>r($e.run_id),onMouseEnter:()=>{Et&&d($e.run_id)},onMouseLeave:()=>d(null),children:[p.jsx("button",{onClick:Ht=>{Ht.stopPropagation(),Tt||st($e.run_id)},disabled:Tt,className:Rt("w-3 h-3 rounded-sm border shrink-0 flex items-center justify-center transition-colors",Et?"bg-foreground border-foreground":"border-muted-foreground/50",Tt&&"opacity-50 cursor-not-allowed"),children:Et&&p.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",className:"text-background",children:p.jsx("path",{d:"M1 4L3 6L7 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),p.jsxs(aT,{open:Ee===$e.run_id,onOpenChange:Ht=>tt($e.run_id,Ht,$e.color),children:[p.jsx(oT,{asChild:!0,children:p.jsx("button",{type:"button",className:"w-2.5 h-2.5 rounded-full shrink-0 focus:outline-none focus:ring-1 focus:ring-ring",style:{backgroundColor:Gt},onClick:Ht=>Ht.stopPropagation(),"aria-label":`Change color for ${fn}`})}),p.jsx(lT,{side:"right",align:"start",className:"w-auto p-1.5",onClick:Ht=>Ht.stopPropagation(),onOpenAutoFocus:Ht=>Ht.preventDefault(),children:p.jsx(Fue,{value:Gt,onChange:Ht=>{ae(In=>({...In,[$e.run_id]:M_(Ht,$e.color)}))}})})]}),p.jsx("div",{className:Rt("flex-1 min-w-0 text-left",an&&"text-muted-foreground/60"),children:p.jsx(J3,{name:fn,maxChars:Bt})}),$e.is_tracking&&p.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0",title:"Live"}),$e.is_syncing&&p.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),p.jsxs("div",{className:"ml-auto relative h-6 w-6 flex items-center justify-center",children:[p.jsx("span",{className:"absolute text-[10px] text-muted-foreground transition-opacity group-hover:opacity-0",children:W1($e.created_at)}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx(Tn,{variant:"ghost",size:"icon",className:"absolute h-6 w-6 opacity-0 transition-opacity group-hover:opacity-100 hover:bg-transparent",disabled:q===$e.run_id,onClick:Ht=>Ht.stopPropagation(),children:p.jsx(jN,{className:"h-3.5 w-3.5"})})}),p.jsxs(pl,{align:"end",className:"w-auto",children:[p.jsx(nS,{className:"text-xs font-normal",children:p.jsx("span",{className:"font-sans",children:$e.run_id})}),p.jsx(Hl,{}),p.jsx(_c,{disabled:le===$e.run_id,onClick:Ht=>{Ht.stopPropagation(),ue($e.run_id)},children:le===$e.run_id?"Resyncing...":"Force Full Resync"}),p.jsx(_c,{disabled:we===$e.run_id,onClick:Ht=>{Ht.stopPropagation(),ze($e.run_id)},children:we===$e.run_id?"Syncing evals...":"Sync Evals After Training"}),p.jsx(_c,{className:"text-destructive",disabled:q===$e.run_id,onClick:Ht=>{Ht.stopPropagation(),Q($e.run_id)},children:"Remove"})]})]})]})]},$e.run_id)}),et.length===0&&p.jsx("div",{className:"text-center py-4 px-2",children:ct?p.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs yet"}):p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"text-xs text-muted-foreground",children:"No wandb key added yet"}),p.jsx(Tn,{size:"sm",className:"h-6 px-2 text-[11px] bg-green-600 hover:bg-green-700",onClick:()=>c(!0),children:"Add wandb key"})]})})]})})})]})]}),p.jsx($f,{open:l,onOpenChange:c,children:p.jsxs(qf,{className:"sm:max-w-md",children:[p.jsxs(jd,{children:[p.jsx(Fd,{children:"Configure W&B"}),p.jsx(kg,{children:V?p.jsxs(p.Fragment,{children:["Use the API key saved by"," ",p.jsx("span",{className:"font-sans",children:"wandb login"})," to fetch all runs tagged ",p.jsx("span",{className:"font-sans",children:"telescope"}),"."]}):p.jsxs(p.Fragment,{children:["Paste your W&B API key to fetch all runs tagged"," ",p.jsx("span",{className:"font-sans",children:"telescope"}),"."]})})]}),p.jsxs("form",{onSubmit:qe,children:[p.jsxs("div",{className:"space-y-4 py-4",children:[p.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[p.jsx("input",{type:"checkbox",checked:V,onChange:$e=>G($e.target.checked),className:"accent-primary h-3.5 w-3.5"}),p.jsxs("span",{className:"text-sm",children:["Use key from"," ",p.jsx("span",{className:"font-sans text-xs",children:"wandb login"})]}),V&&!bt&&p.jsxs("span",{className:"text-[11px] text-red-500 font-medium",children:["Not found — run"," ",p.jsx("code",{className:"text-[10px]",children:"wandb login"})]}),V&&bt&&p.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Found"})]}),!V&&p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(cce,{htmlFor:"config-api-key",children:"W&B API Key"}),ct&&wt==="custom"?p.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Key added"}):p.jsx("span",{className:"text-[11px] text-red-500 font-medium",children:"No key configured"})]}),p.jsx(W0,{id:"config-api-key",type:"password",placeholder:"Enter API key",value:W,onChange:$e=>F($e.target.value),required:!0})]})]}),p.jsxs(m8,{children:[p.jsx(Tn,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),p.jsx(Tn,{type:"submit",disabled:Z||(V?!bt:!W.trim()),children:Z?p.jsxs(p.Fragment,{children:[p.jsx(ll,{className:"mr-2 h-4 w-4"}),"Saving..."]}):"Ok"})]})]})]})}),p.jsx($f,{open:g,onOpenChange:v,children:p.jsxs(qf,{className:"sm:max-w-3xl !grid-rows-[auto_1fr] !gap-0 max-h-[80vh] overflow-hidden",onOpenAutoFocus:$e=>{$e.preventDefault();const Tt=$e.currentTarget;Tt==null||Tt.focus()},children:[p.jsxs(jd,{className:"pb-3",children:[p.jsx(Fd,{children:"Add Run"}),p.jsx(kg,{children:"Select a removed run to add it back. Uses the stored W&B API key."})]}),p.jsxs("div",{className:"overflow-y-auto -mx-6 px-6",children:[p.jsxs("div",{className:"sticky top-0 z-10 bg-background grid grid-cols-[12px_1fr_80px_100px_90px_76px_56px_44px] gap-2 items-center pb-1.5 border-b border-border px-3",children:[p.jsx("div",{}),[{key:"name",label:"Name",cls:""},{key:"entity",label:"Entity",cls:""},{key:"project",label:"Project",cls:""},{key:"run_id",label:"Run ID",cls:""},{key:"created_at",label:"Created",cls:""},{key:"removed_at",label:"Removed",cls:"justify-center"}].map($e=>p.jsxs("button",{className:Rt("flex items-center gap-0.5 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors whitespace-nowrap select-none",$e.cls),onClick:()=>Be($e.key),children:[$e.label,U===$e.key&&(X==="asc"?p.jsx(vle,{className:"h-2.5 w-2.5"}):p.jsx(fle,{className:"h-2.5 w-2.5"}))]},$e.key)),p.jsx("span",{className:"text-[10px] font-medium text-muted-foreground text-center",children:"Config"})]}),p.jsx("div",{className:"py-1",children:Xe?p.jsx("div",{className:"flex items-center justify-center py-6",children:p.jsx(ll,{className:"h-4 w-4"})}):p.jsxs(p.Fragment,{children:[De.map($e=>{const Tt=$e.run_id.split("/").pop()??$e.run_id;return p.jsxs("div",{className:"w-full grid grid-cols-[12px_1fr_80px_100px_90px_76px_56px_44px] gap-2 items-center rounded-md px-3 py-1.5 text-left hover:bg-muted transition-colors group/row [--run-item-bg:var(--background)] hover:[--run-item-bg:var(--muted)]",children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-full cursor-pointer",style:{backgroundColor:$e.color??"#888"},onClick:()=>Se($e.run_id)}),p.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Se($e.run_id),children:p.jsx(J3,{name:$e.name??"Unnamed"})}),p.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Se($e.run_id),children:p.jsx(J3,{name:$e.entity??"—",className:"text-xs font-sans text-muted-foreground"})}),p.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Se($e.run_id),children:p.jsx(J3,{name:$e.project??"—",className:"text-xs font-sans text-muted-foreground"})}),p.jsx("span",{className:"text-xs font-sans text-muted-foreground truncate cursor-pointer",onClick:()=>Se($e.run_id),children:Tt}),p.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap cursor-pointer",onClick:()=>Se($e.run_id),children:$e.created_at?new Date($e.created_at).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"}):"—"}),p.jsx("span",{className:"text-[10px] text-red-400 whitespace-nowrap text-center cursor-pointer",onClick:()=>Se($e.run_id),children:$e.removed_at?W1($e.removed_at):"—"}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:Et=>{Et.stopPropagation(),ne($e)},disabled:!$e.config,children:"View"})]},$e.run_id)}),De.length===0&&p.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"No removed runs"})]})})]})]})}),p.jsx($f,{open:b,onOpenChange:_,children:p.jsxs(qf,{className:"sm:max-w-lg max-h-[70vh] !grid-rows-[auto_1fr] !gap-0 overflow-hidden",children:[p.jsxs(jd,{className:"pb-3",children:[p.jsx(Fd,{children:"Known Projects"}),p.jsx(kg,{children:"Projects polled for new telescope-tagged runs. Add an entity/project pair to start discovering runs from it."})]}),p.jsxs("div",{className:"overflow-y-auto -mx-6 px-6",children:[p.jsxs("div",{className:"flex flex-col gap-1 mb-3",children:[p.jsxs("div",{className:"flex gap-2",children:[p.jsx(W0,{className:"h-7 text-xs flex-1",placeholder:"entity/project",value:w,onChange:$e=>{S($e.target.value),N&&D(null)},onKeyDown:$e=>{$e.key==="Enter"&&Ye()}}),p.jsx(Tn,{variant:"default",size:"sm",className:"h-7 px-3 text-xs",onClick:Ye,disabled:E||!w.trim(),children:E?p.jsx(ll,{className:"h-3 w-3"}):"Ok"})]}),N&&p.jsx("span",{className:"text-[11px] text-red-500",children:N})]}),p.jsxs("div",{className:"space-y-1",children:[Ae==null?void 0:Ae.projects.map($e=>p.jsxs("div",{className:"flex items-center justify-between rounded-md px-3 py-1.5 hover:bg-muted transition-colors group",children:[p.jsxs("div",{className:"flex flex-col min-w-0",children:[p.jsx("span",{className:"text-xs font-mono truncate",children:$e.project}),p.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[$e.source==="user"?"User-added":"From existing runs",$e.added_at&&` · ${new Date($e.added_at).toLocaleDateString()}`]})]}),$e.source==="user"&&p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0 text-muted-foreground hover:text-destructive opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>dt($e.project),disabled:P===$e.project,children:P===$e.project?p.jsx(ll,{className:"h-3 w-3"}):p.jsx(nce,{className:"h-3 w-3"})})]},$e.project)),(Ae==null?void 0:Ae.projects.length)===0&&p.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"No known projects. Add a W&B API key and sync runs, or add a project manually above."})]})]})]})}),p.jsx($f,{open:!!ie,onOpenChange:$e=>{$e||ne(null)},children:p.jsxs(qf,{className:"sm:max-w-2xl max-h-[85vh] !grid-rows-[auto_1fr] overflow-hidden",children:[p.jsxs(jd,{children:[p.jsxs(Fd,{className:"flex items-center gap-2",children:[(ie==null?void 0:ie.color)&&p.jsx("div",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:ie.color}}),"Configuration —"," ",(ie==null?void 0:ie.name)??(ie==null?void 0:ie.run_id.split("/").pop())]}),p.jsx(kg,{children:ie==null?void 0:ie.run_id})]}),p.jsx("div",{className:"overflow-y-auto -mx-6 px-6",children:ie!=null&&ie.config?p.jsx(jG,{config:ie.config}):p.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"})})]})}),p.jsx(FN,{open:!!Y,onOpenChange:$e=>{$e||Q(null)},children:p.jsxs(UN,{children:[p.jsxs(BN,{children:[p.jsx(VN,{children:"Remove run locally?"}),p.jsx(GN,{children:"All the data of this run will be removed from your local database. It will not be removed from W&B, your data is safe in W&B and you can add it again locally if you want."})]}),p.jsxs(HN,{children:[p.jsx($N,{children:"Cancel"}),p.jsx(WN,{onClick:()=>{Y&&Le(Y)},children:"Remove"})]})]})}),p.jsx(FN,{open:!!re,onOpenChange:$e=>{$e||ue(null)},children:p.jsxs(UN,{children:[p.jsxs(BN,{children:[p.jsx(hce,{className:"bg-destructive/10",children:p.jsx(ice,{className:"text-destructive"})}),p.jsx(VN,{children:"Force Full Resync"}),p.jsx(GN,{children:"This will stop tracking (if active), delete all data for this run from the database, and then sync all data again from scratch. This action cannot be undone."})]}),p.jsxs(HN,{children:[p.jsx($N,{children:"Cancel"}),p.jsx(WN,{variant:"destructive",onClick:()=>{re&&Qe(re)},children:"Yes, Delete & Resync"})]})]})}),p.jsx(Hue,{open:R,onOpenChange:O})]})}function Gue(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return T.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const vT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _y(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function T8(t){return"nodeType"in t}function Cc(t){var e,n;return t?_y(t)?t:T8(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function E8(t){const{Document:e}=Cc(t);return t instanceof e}function ow(t){return _y(t)?!1:t instanceof Cc(t).HTMLElement}function BG(t){return t instanceof Cc(t).SVGElement}function Sy(t){return t?_y(t)?t.document:T8(t)?E8(t)?t:ow(t)||BG(t)?t.ownerDocument:document:document:document}const rh=vT?T.useLayoutEffect:T.useEffect;function C8(t){const e=T.useRef(t);return rh(()=>{e.current=t}),T.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function Wue(){const t=T.useRef(null),e=T.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=T.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function rS(t,e){e===void 0&&(e=[t]);const n=T.useRef(t);return rh(()=>{n.current!==t&&(n.current=t)},e),n}function lw(t,e){const n=T.useRef();return T.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function f2(t){const e=C8(t),n=T.useRef(null),r=T.useCallback(i=>{i!==n.current&&(e==null||e(i,n.current)),n.current=i},[]);return[n,r]}function XN(t){const e=T.useRef();return T.useEffect(()=>{e.current=t},[t]),e.current}let VC={};function cw(t,e){return T.useMemo(()=>{if(e)return e;const n=VC[t]==null?0:VC[t]+1;return VC[t]=n,t+"-"+n},[t,e])}function HG(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,a)=>{const o=Object.entries(a);for(const[l,c]of o){const d=s[l];d!=null&&(s[l]=d+t*c)}return s},{...e})}}const m1=HG(1),iS=HG(-1);function $ue(t){return"clientX"in t&&"clientY"in t}function A8(t){if(!t)return!1;const{KeyboardEvent:e}=Cc(t.target);return e&&t instanceof e}function que(t){if(!t)return!1;const{TouchEvent:e}=Cc(t.target);return e&&t instanceof e}function YN(t){if(que(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return $ue(t)?{x:t.clientX,y:t.clientY}:null}const $1=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[$1.Translate.toString(t),$1.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),aD="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Xue(t){return t.matches(aD)?t:t.querySelector(aD)}const Yue={display:"none"};function Kue(t){let{id:e,value:n}=t;return Qr.createElement("div",{id:e,style:Yue},n)}function Zue(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Qr.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function Que(){const[t,e]=T.useState("");return{announce:T.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const VG=T.createContext(null);function Jue(t){const e=T.useContext(VG);T.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function ede(){const[t]=T.useState(()=>new Set),e=T.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[T.useCallback(r=>{let{type:i,event:s}=r;t.forEach(a=>{var o;return(o=a[i])==null?void 0:o.call(a,s)})},[t]),e]}const tde={draggable:`
    To pick up a draggable item, press the space bar.
    While dragging, use the arrow keys to move the item.
    Press space again to drop the item in its new position, or press escape to cancel.
  `},nde={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function rde(t){let{announcements:e=nde,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=tde}=t;const{announce:s,announcement:a}=Que(),o=cw("DndLiveRegion"),[l,c]=T.useState(!1);if(T.useEffect(()=>{c(!0)},[]),Jue(T.useMemo(()=>({onDragStart(h){let{active:g}=h;s(e.onDragStart({active:g}))},onDragMove(h){let{active:g,over:v}=h;e.onDragMove&&s(e.onDragMove({active:g,over:v}))},onDragOver(h){let{active:g,over:v}=h;s(e.onDragOver({active:g,over:v}))},onDragEnd(h){let{active:g,over:v}=h;s(e.onDragEnd({active:g,over:v}))},onDragCancel(h){let{active:g,over:v}=h;s(e.onDragCancel({active:g,over:v}))}}),[s,e])),!l)return null;const d=Qr.createElement(Qr.Fragment,null,Qr.createElement(Kue,{id:r,value:i.draggable}),Qr.createElement(Zue,{id:o,announcement:a}));return n?Ld.createPortal(d,n):d}var ro;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(ro||(ro={}));function h2(){}function Xf(t,e){return T.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function sS(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return T.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const qd=Object.freeze({x:0,y:0});function GG(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function WG(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function ide(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function oD(t){let{left:e,top:n,height:r,width:i}=t;return[{x:e,y:n},{x:e+i,y:n},{x:e,y:n+r},{x:e+i,y:n+r}]}function $G(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function lD(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const aS=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=lD(e,e.left,e.top),s=[];for(const a of r){const{id:o}=a,l=n.get(o);if(l){const c=GG(lD(l),i);s.push({id:o,data:{droppableContainer:a,value:c}})}}return s.sort(WG)},sde=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=oD(e),s=[];for(const a of r){const{id:o}=a,l=n.get(o);if(l){const c=oD(l),d=i.reduce((g,v,b)=>g+GG(c[b],v),0),h=Number((d/4).toFixed(4));s.push({id:o,data:{droppableContainer:a,value:h}})}}return s.sort(WG)};function ade(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),s=Math.min(e.top+e.height,t.top+t.height),a=i-r,o=s-n;if(r<i&&n<s){const l=e.width*e.height,c=t.width*t.height,d=a*o,h=d/(l+c-d);return Number(h.toFixed(4))}return 0}const ode=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const s of r){const{id:a}=s,o=n.get(a);if(o){const l=ade(o,e);l>0&&i.push({id:a,data:{droppableContainer:s,value:l}})}}return i.sort(ide)};function lde(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function qG(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:qd}function cde(t){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return i.reduce((a,o)=>({...a,top:a.top+t*o.y,bottom:a.bottom+t*o.y,left:a.left+t*o.x,right:a.right+t*o.x}),{...n})}}const ude=cde(1);function dde(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function fde(t,e,n){const r=dde(e);if(!r)return t;const{scaleX:i,scaleY:s,x:a,y:o}=r,l=t.left-a-(1-i)*parseFloat(n),c=t.top-o-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?t.width/i:t.width,h=s?t.height/s:t.height;return{width:d,height:h,top:c,right:l+d,bottom:c+h,left:l}}const hde={ignoreTransform:!1};function wy(t,e){e===void 0&&(e=hde);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Cc(t).getComputedStyle(t);c&&(n=fde(n,c,d))}const{top:r,left:i,width:s,height:a,bottom:o,right:l}=n;return{top:r,left:i,width:s,height:a,bottom:o,right:l}}function cD(t){return wy(t,{ignoreTransform:!0})}function pde(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function mde(t,e){return e===void 0&&(e=Cc(t).getComputedStyle(t)),e.position==="fixed"}function gde(t,e){e===void 0&&(e=Cc(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=e[i];return typeof s=="string"?n.test(s):!1})}function xT(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(E8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!ow(i)||BG(i)||n.includes(i))return n;const s=Cc(t).getComputedStyle(i);return i!==t&&gde(i,s)&&n.push(i),mde(i,s)?n:r(i.parentNode)}return t?r(t):n}function XG(t){const[e]=xT(t,1);return e??null}function GC(t){return!vT||!t?null:_y(t)?t:T8(t)?E8(t)||t===Sy(t).scrollingElement?window:ow(t)?t:null:null}function YG(t){return _y(t)?t.scrollX:t.scrollLeft}function KG(t){return _y(t)?t.scrollY:t.scrollTop}function KN(t){return{x:YG(t),y:KG(t)}}var yo;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(yo||(yo={}));function ZG(t){return!vT||!t?!1:t===document.scrollingElement}function QG(t){const e={x:0,y:0},n=ZG(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},i=t.scrollTop<=e.y,s=t.scrollLeft<=e.x,a=t.scrollTop>=r.y,o=t.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:a,isRight:o,maxScroll:r,minScroll:e}}const vde={x:.2,y:.2};function xde(t,e,n,r,i){let{top:s,left:a,right:o,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=vde);const{isTop:c,isBottom:d,isLeft:h,isRight:g}=QG(t),v={x:0,y:0},b={x:0,y:0},_={height:e.height*i.y,width:e.width*i.x};return!c&&s<=e.top+_.height?(v.y=yo.Backward,b.y=r*Math.abs((e.top+_.height-s)/_.height)):!d&&l>=e.bottom-_.height&&(v.y=yo.Forward,b.y=r*Math.abs((e.bottom-_.height-l)/_.height)),!g&&o>=e.right-_.width?(v.x=yo.Forward,b.x=r*Math.abs((e.right-_.width-o)/_.width)):!h&&a<=e.left+_.width&&(v.x=yo.Backward,b.x=r*Math.abs((e.left+_.width-a)/_.width)),{direction:v,speed:b}}function yde(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:e,left:n,right:r,bottom:i}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:i,width:t.clientWidth,height:t.clientHeight}}function JG(t){return t.reduce((e,n)=>m1(e,KN(n)),qd)}function bde(t){return t.reduce((e,n)=>e+YG(n),0)}function _de(t){return t.reduce((e,n)=>e+KG(n),0)}function Sde(t,e){if(e===void 0&&(e=wy),!t)return;const{top:n,left:r,bottom:i,right:s}=e(t);XG(t)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const wde=[["x",["left","right"],bde],["y",["top","bottom"],_de]];class N8{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=xT(n),i=JG(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,a,o]of wde)for(const l of a)Object.defineProperty(this,l,{get:()=>{const c=o(r),d=i[s]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class T_{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var i;(i=this.target)==null||i.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function Mde(t){const{EventTarget:e}=Cc(t);return t instanceof e?t:Sy(t)}function WC(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var ju;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(ju||(ju={}));function uD(t){t.preventDefault()}function Tde(t){t.stopPropagation()}var li;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(li||(li={}));const eW={start:[li.Space,li.Enter],cancel:[li.Esc],end:[li.Space,li.Enter,li.Tab]},Ede=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case li.Right:return{...n,x:n.x+25};case li.Left:return{...n,x:n.x-25};case li.Down:return{...n,y:n.y+25};case li.Up:return{...n,y:n.y-25}}};class rv{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new T_(Sy(n)),this.windowListeners=new T_(Cc(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(ju.Resize,this.handleCancel),this.windowListeners.add(ju.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(ju.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Sde(r),n(qd)}handleKeyDown(e){if(A8(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=eW,coordinateGetter:a=Ede,scrollBehavior:o="smooth"}=i,{code:l}=e;if(s.end.includes(l)){this.handleEnd(e);return}if(s.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:c}=r.current,d=c?{x:c.left,y:c.top}:qd;this.referenceCoordinates||(this.referenceCoordinates=d);const h=a(e,{active:n,context:r.current,currentCoordinates:d});if(h){const g=iS(h,d),v={x:0,y:0},{scrollableAncestors:b}=r.current;for(const _ of b){const w=e.code,{isTop:S,isRight:E,isLeft:A,isBottom:N,maxScroll:D,minScroll:P}=QG(_),L=yde(_),R={x:Math.min(w===li.Right?L.right-L.width/2:L.right,Math.max(w===li.Right?L.left:L.left+L.width/2,h.x)),y:Math.min(w===li.Down?L.bottom-L.height/2:L.bottom,Math.max(w===li.Down?L.top:L.top+L.height/2,h.y))},O=w===li.Right&&!E||w===li.Left&&!A,W=w===li.Down&&!N||w===li.Up&&!S;if(O&&R.x!==h.x){const F=_.scrollLeft+g.x,V=w===li.Right&&F<=D.x||w===li.Left&&F>=P.x;if(V&&!g.y){_.scrollTo({left:F,behavior:o});return}V?v.x=_.scrollLeft-F:v.x=w===li.Right?_.scrollLeft-D.x:_.scrollLeft-P.x,v.x&&_.scrollBy({left:-v.x,behavior:o});break}else if(W&&R.y!==h.y){const F=_.scrollTop+g.y,V=w===li.Down&&F<=D.y||w===li.Up&&F>=P.y;if(V&&!g.x){_.scrollTo({top:F,behavior:o});return}V?v.y=_.scrollTop-F:v.y=w===li.Down?_.scrollTop-D.y:_.scrollTop-P.y,v.y&&_.scrollBy({top:-v.y,behavior:o});break}}this.handleMove(e,m1(iS(h,this.referenceCoordinates),v))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}rv.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=eW,onActivation:i}=e,{active:s}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const o=s.activatorNode.current;return o&&t.target!==o?!1:(t.preventDefault(),i==null||i({event:t.nativeEvent}),!0)}return!1}}];function dD(t){return!!(t&&"distance"in t)}function fD(t){return!!(t&&"delay"in t)}class R8{constructor(e,n,r){var i;r===void 0&&(r=Mde(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:s}=e,{target:a}=s;this.props=e,this.events=n,this.document=Sy(a),this.documentListeners=new T_(this.document),this.listeners=new T_(r),this.windowListeners=new T_(Cc(a)),this.initialCoordinates=(i=YN(s))!=null?i:qd,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(ju.Resize,this.handleCancel),this.windowListeners.add(ju.DragStart,uD),this.windowListeners.add(ju.VisibilityChange,this.handleCancel),this.windowListeners.add(ju.ContextMenu,uD),this.documentListeners.add(ju.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(fD(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(dD(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:i}=this.props;i(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(ju.Click,Tde,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(ju.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:a,options:{activationConstraint:o}}=s;if(!i)return;const l=(n=YN(e))!=null?n:qd,c=iS(i,l);if(!r&&o){if(dD(o)){if(o.tolerance!=null&&WC(c,o.tolerance))return this.handleCancel();if(WC(c,o.distance))return this.handleStart()}if(fD(o)&&WC(c,o.tolerance))return this.handleCancel();this.handlePending(o,c);return}e.cancelable&&e.preventDefault(),a(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===li.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Cde={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class iv extends R8{constructor(e){const{event:n}=e,r=Sy(n.target);super(e,Cde,r)}}iv.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Ade={move:{name:"mousemove"},end:{name:"mouseup"}};var ZN;(function(t){t[t.RightClick=2]="RightClick"})(ZN||(ZN={}));class Nde extends R8{constructor(e){super(e,Ade,Sy(e.event.target))}}Nde.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===ZN.RightClick?!1:(r==null||r({event:n}),!0)}}];const $C={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Rde extends R8{constructor(e){super(e,$C)}static setup(){return window.addEventListener($C.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener($C.move.name,e)};function e(){}}}Rde.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var E_;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(E_||(E_={}));var p2;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(p2||(p2={}));function kde(t){let{acceleration:e,activator:n=E_.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:a=5,order:o=p2.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:h,threshold:g}=t;const v=Ide({delta:h,disabled:!s}),[b,_]=Wue(),w=T.useRef({x:0,y:0}),S=T.useRef({x:0,y:0}),E=T.useMemo(()=>{switch(n){case E_.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case E_.DraggableRect:return i}},[n,i,l]),A=T.useRef(null),N=T.useCallback(()=>{const P=A.current;if(!P)return;const L=w.current.x*S.current.x,R=w.current.y*S.current.y;P.scrollBy(L,R)},[]),D=T.useMemo(()=>o===p2.TreeOrder?[...c].reverse():c,[o,c]);T.useEffect(()=>{if(!s||!c.length||!E){_();return}for(const P of D){if((r==null?void 0:r(P))===!1)continue;const L=c.indexOf(P),R=d[L];if(!R)continue;const{direction:O,speed:W}=xde(P,R,E,e,g);for(const F of["x","y"])v[F][O[F]]||(W[F]=0,O[F]=0);if(W.x>0||W.y>0){_(),A.current=P,b(N,a),w.current=W,S.current=O;return}}w.current={x:0,y:0},S.current={x:0,y:0},_()},[e,N,r,_,s,a,JSON.stringify(E),JSON.stringify(v),b,c,D,d,JSON.stringify(g)])}const Pde={x:{[yo.Backward]:!1,[yo.Forward]:!1},y:{[yo.Backward]:!1,[yo.Forward]:!1}};function Ide(t){let{delta:e,disabled:n}=t;const r=XN(e);return lw(i=>{if(n||!r||!i)return Pde;const s={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[yo.Backward]:i.x[yo.Backward]||s.x===-1,[yo.Forward]:i.x[yo.Forward]||s.x===1},y:{[yo.Backward]:i.y[yo.Backward]||s.y===-1,[yo.Forward]:i.y[yo.Forward]||s.y===1}}},[n,e,r])}function Dde(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return lw(i=>{var s;return e==null?null:(s=r??i)!=null?s:null},[r,e])}function Ode(t,e){return T.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...s]},[]),[t,e])}var oS;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(oS||(oS={}));var QN;(function(t){t.Optimized="optimized"})(QN||(QN={}));const hD=new Map;function Lde(t,e){let{dragging:n,dependencies:r,config:i}=e;const[s,a]=T.useState(null),{frequency:o,measure:l,strategy:c}=i,d=T.useRef(t),h=w(),g=rS(h),v=T.useCallback(function(S){S===void 0&&(S=[]),!g.current&&a(E=>E===null?S:E.concat(S.filter(A=>!E.includes(A))))},[g]),b=T.useRef(null),_=lw(S=>{if(h&&!n)return hD;if(!S||S===hD||d.current!==t||s!=null){const E=new Map;for(let A of t){if(!A)continue;if(s&&s.length>0&&!s.includes(A.id)&&A.rect.current){E.set(A.id,A.rect.current);continue}const N=A.node.current,D=N?new N8(l(N),N):null;A.rect.current=D,D&&E.set(A.id,D)}return E}return S},[t,s,n,h,l]);return T.useEffect(()=>{d.current=t},[t]),T.useEffect(()=>{h||v()},[n,h]),T.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),T.useEffect(()=>{h||typeof o!="number"||b.current!==null||(b.current=setTimeout(()=>{v(),b.current=null},o))},[o,h,v,...r]),{droppableRects:_,measureDroppableContainers:v,measuringScheduled:s!=null};function w(){switch(c){case oS.Always:return!1;case oS.BeforeDragging:return n;default:return!n}}}function tW(t,e){return lw(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function zde(t,e){return tW(t,e)}function jde(t){let{callback:e,disabled:n}=t;const r=C8(e),i=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return T.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function yT(t){let{callback:e,disabled:n}=t;const r=C8(e),i=T.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return T.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Fde(t){return new N8(wy(t),t)}function pD(t,e,n){e===void 0&&(e=Fde);const[r,i]=T.useState(null);function s(){i(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const a=jde({callback(l){if(t)for(const c of l){const{type:d,target:h}=c;if(d==="childList"&&h instanceof HTMLElement&&h.contains(t)){s();break}}}}),o=yT({callback:s});return rh(()=>{s(),t?(o==null||o.observe(t),a==null||a.observe(document.body,{childList:!0,subtree:!0})):(o==null||o.disconnect(),a==null||a.disconnect())},[t]),r}function Ude(t){const e=tW(t);return qG(t,e)}const mD=[];function Bde(t){const e=T.useRef(t),n=lw(r=>t?r&&r!==mD&&t&&e.current&&t.parentNode===e.current.parentNode?r:xT(t):mD,[t]);return T.useEffect(()=>{e.current=t},[t]),n}function Hde(t){const[e,n]=T.useState(null),r=T.useRef(t),i=T.useCallback(s=>{const a=GC(s.target);a&&n(o=>o?(o.set(a,KN(a)),new Map(o)):null)},[]);return T.useEffect(()=>{const s=r.current;if(t!==s){a(s);const o=t.map(l=>{const c=GC(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,KN(c)]):null}).filter(l=>l!=null);n(o.length?new Map(o):null),r.current=t}return()=>{a(t),a(s)};function a(o){o.forEach(l=>{const c=GC(l);c==null||c.removeEventListener("scroll",i)})}},[i,t]),T.useMemo(()=>t.length?e?Array.from(e.values()).reduce((s,a)=>m1(s,a),qd):JG(t):qd,[t,e])}function gD(t,e){e===void 0&&(e=[]);const n=T.useRef(null);return T.useEffect(()=>{n.current=null},e),T.useEffect(()=>{const r=t!==qd;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?iS(t,n.current):qd}function Vde(t){T.useEffect(()=>{if(!vT)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n==null||n()}},t.map(e=>{let{sensor:n}=e;return n}))}function Gde(t,e){return T.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=a=>{s(a,e)},n},{}),[t,e])}function nW(t){return T.useMemo(()=>t?pde(t):null,[t])}const vD=[];function Wde(t,e){e===void 0&&(e=wy);const[n]=t,r=nW(n?Cc(n):null),[i,s]=T.useState(vD);function a(){s(()=>t.length?t.map(l=>ZG(l)?r:new N8(e(l),l)):vD)}const o=yT({callback:a});return rh(()=>{o==null||o.disconnect(),a(),t.forEach(l=>o==null?void 0:o.observe(l))},[t]),i}function $de(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return ow(e)?e:t}function qde(t){let{measure:e}=t;const[n,r]=T.useState(null),i=T.useCallback(c=>{for(const{target:d}of c)if(ow(d)){r(h=>{const g=e(d);return h?{...h,width:g.width,height:g.height}:g});break}},[e]),s=yT({callback:i}),a=T.useCallback(c=>{const d=$de(c);s==null||s.disconnect(),d&&(s==null||s.observe(d)),r(d?e(d):null)},[e,s]),[o,l]=f2(a);return T.useMemo(()=>({nodeRef:o,rect:n,setRef:l}),[n,o,l])}const Xde=[{sensor:iv,options:{}},{sensor:rv,options:{}}],Yde={current:{}},OM={draggable:{measure:cD},droppable:{measure:cD,strategy:oS.WhileDragging,frequency:QN.Optimized},dragOverlay:{measure:wy}};class C_ extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const Kde={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new C_,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:h2},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:OM,measureDroppableContainers:h2,windowRect:null,measuringScheduled:!1},Zde={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:h2,draggableNodes:new Map,over:null,measureDroppableContainers:h2},bT=T.createContext(Zde),rW=T.createContext(Kde);function Qde(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new C_}}}function Jde(t,e){switch(e.type){case ro.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ro.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case ro.DragEnd:case ro.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ro.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new C_(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case ro.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const a=new C_(t.droppable.containers);return a.set(n,{...s,disabled:i}),{...t,droppable:{...t.droppable,containers:a}}}case ro.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const s=new C_(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function efe(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=T.useContext(bT),s=XN(r),a=XN(n==null?void 0:n.id);return T.useEffect(()=>{if(!e&&!r&&s&&a!=null){if(!A8(s)||document.activeElement===s.target)return;const o=i.get(a);if(!o)return;const{activatorNode:l,node:c}=o;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const h=Xue(d);if(h){h.focus();break}}})}},[r,e,i,a,s]),null}function tfe(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,s)=>s({transform:i,...r}),n):n}function nfe(t){return T.useMemo(()=>({draggable:{...OM.draggable,...t==null?void 0:t.draggable},droppable:{...OM.droppable,...t==null?void 0:t.droppable},dragOverlay:{...OM.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function rfe(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const s=T.useRef(!1),{x:a,y:o}=typeof i=="boolean"?{x:i,y:i}:i;rh(()=>{if(!a&&!o||!e){s.current=!1;return}if(s.current||!r)return;const c=e==null?void 0:e.node.current;if(!c||c.isConnected===!1)return;const d=n(c),h=qG(d,r);if(a||(h.x=0),o||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=XG(c);g&&g.scrollBy({top:h.y,left:h.x})}},[e,a,o,r,n])}const iW=T.createContext({...qd,scaleX:1,scaleY:1});var T0;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(T0||(T0={}));const lS=T.memo(function(e){var n,r,i,s;let{id:a,accessibility:o,autoScroll:l=!0,children:c,sensors:d=Xde,collisionDetection:h=ode,measuring:g,modifiers:v,...b}=e;const _=T.useReducer(Jde,void 0,Qde),[w,S]=_,[E,A]=ede(),[N,D]=T.useState(T0.Uninitialized),P=N===T0.Initialized,{draggable:{active:L,nodes:R,translate:O},droppable:{containers:W}}=w,F=L!=null?R.get(L):null,V=T.useRef({initial:null,translated:null}),G=T.useMemo(()=>{var mt;return L!=null?{id:L,data:(mt=F==null?void 0:F.data)!=null?mt:Yde,rect:V}:null},[L,F]),Z=T.useRef(null),[B,q]=T.useState(null),[K,Y]=T.useState(null),Q=rS(b,Object.values(b)),U=cw("DndDescribedBy",a),j=T.useMemo(()=>W.getEnabled(),[W]),X=nfe(g),{droppableRects:H,measureDroppableContainers:ie,measuringScheduled:ne}=Lde(j,{dragging:P,dependencies:[O.x,O.y],config:X.droppable}),re=Dde(R,L),ue=T.useMemo(()=>K?YN(K):null,[K]),le=ft(),fe=zde(re,X.draggable.measure);rfe({activeNode:L!=null?R.get(L):null,config:le.layoutShiftCompensation,initialRect:fe,measure:X.draggable.measure});const we=pD(re,X.draggable.measure,fe),pe=pD(re?re.parentElement:null),xe=T.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:W,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ve=W.getNodeFor((n=xe.current.over)==null?void 0:n.id),ye=qde({measure:X.dragOverlay.measure}),Oe=(r=ye.nodeRef.current)!=null?r:re,he=P?(i=ye.rect)!=null?i:we:null,Re=!!(ye.nodeRef.current&&ye.rect),oe=Ude(Re?null:we),Ue=nW(Oe?Cc(Oe):null),Ee=Bde(P?Ve??re:null),Pe=Wde(Ee),Ze=tfe(v,{transform:{x:O.x-oe.x,y:O.y-oe.y,scaleX:1,scaleY:1},activatorEvent:K,active:G,activeNodeRect:we,containerNodeRect:pe,draggingNodeRect:he,over:xe.current.over,overlayNodeRect:ye.rect,scrollableAncestors:Ee,scrollableAncestorRects:Pe,windowRect:Ue}),ae=ue?m1(ue,O):null,te=Hde(Ee),be=gD(te),me=gD(te,[we]),ge=m1(Ze,be),ke=he?ude(he,Ze):null,Xe=G&&ke?h({active:G,collisionRect:ke,droppableRects:H,droppableContainers:j,pointerCoordinates:ae}):null,Ae=$G(Xe,"id"),[je,We]=T.useState(null),De=Re?Ze:m1(Ze,me),Be=lde(De,(s=je==null?void 0:je.rect)!=null?s:null,we),qe=T.useRef(null),Se=T.useCallback((mt,tt)=>{let{sensor:Qe,options:ze}=tt;if(Z.current==null)return;const Te=R.get(Z.current);if(!Te)return;const He=mt.nativeEvent,et=new Qe({active:Z.current,activeNode:Te,event:He,options:ze,context:xe,onAbort(ct){if(!R.get(ct))return;const{onDragAbort:wt}=Q.current,Pt={id:ct};wt==null||wt(Pt),E({type:"onDragAbort",event:Pt})},onPending(ct,bt,wt,Pt){if(!R.get(ct))return;const{onDragPending:Tt}=Q.current,Et={id:ct,constraint:bt,initialCoordinates:wt,offset:Pt};Tt==null||Tt(Et),E({type:"onDragPending",event:Et})},onStart(ct){const bt=Z.current;if(bt==null)return;const wt=R.get(bt);if(!wt)return;const{onDragStart:Pt}=Q.current,$e={activatorEvent:He,active:{id:bt,data:wt.data,rect:V}};Ld.unstable_batchedUpdates(()=>{Pt==null||Pt($e),D(T0.Initializing),S({type:ro.DragStart,initialCoordinates:ct,active:bt}),E({type:"onDragStart",event:$e}),q(qe.current),Y(He)})},onMove(ct){S({type:ro.DragMove,coordinates:ct})},onEnd:ht(ro.DragEnd),onCancel:ht(ro.DragCancel)});qe.current=et;function ht(ct){return async function(){const{active:wt,collisions:Pt,over:$e,scrollAdjustedTranslate:Tt}=xe.current;let Et=null;if(wt&&Tt){const{cancelDrop:Ot}=Q.current;Et={activatorEvent:He,active:wt,collisions:Pt,delta:Tt,over:$e},ct===ro.DragEnd&&typeof Ot=="function"&&await Promise.resolve(Ot(Et))&&(ct=ro.DragCancel)}Z.current=null,Ld.unstable_batchedUpdates(()=>{S({type:ct}),D(T0.Uninitialized),We(null),q(null),Y(null),qe.current=null;const Ot=ct===ro.DragEnd?"onDragEnd":"onDragCancel";if(Et){const Gt=Q.current[Ot];Gt==null||Gt(Et),E({type:Ot,event:Et})}})}}},[R]),Ye=T.useCallback((mt,tt)=>(Qe,ze)=>{const Te=Qe.nativeEvent,He=R.get(ze);if(Z.current!==null||!He||Te.dndKit||Te.defaultPrevented)return;const et={active:He};mt(Qe,tt.options,et)===!0&&(Te.dndKit={capturedBy:tt.sensor},Z.current=ze,Se(Qe,tt))},[R,Se]),dt=Ode(d,Ye);Vde(d),rh(()=>{we&&N===T0.Initializing&&D(T0.Initialized)},[we,N]),T.useEffect(()=>{const{onDragMove:mt}=Q.current,{active:tt,activatorEvent:Qe,collisions:ze,over:Te}=xe.current;if(!tt||!Qe)return;const He={active:tt,activatorEvent:Qe,collisions:ze,delta:{x:ge.x,y:ge.y},over:Te};Ld.unstable_batchedUpdates(()=>{mt==null||mt(He),E({type:"onDragMove",event:He})})},[ge.x,ge.y]),T.useEffect(()=>{const{active:mt,activatorEvent:tt,collisions:Qe,droppableContainers:ze,scrollAdjustedTranslate:Te}=xe.current;if(!mt||Z.current==null||!tt||!Te)return;const{onDragOver:He}=Q.current,et=ze.get(Ae),ht=et&&et.rect.current?{id:et.id,rect:et.rect.current,data:et.data,disabled:et.disabled}:null,ct={active:mt,activatorEvent:tt,collisions:Qe,delta:{x:Te.x,y:Te.y},over:ht};Ld.unstable_batchedUpdates(()=>{We(ht),He==null||He(ct),E({type:"onDragOver",event:ct})})},[Ae]),rh(()=>{xe.current={activatorEvent:K,active:G,activeNode:re,collisionRect:ke,collisions:Xe,droppableRects:H,draggableNodes:R,draggingNode:Oe,draggingNodeRect:he,droppableContainers:W,over:je,scrollableAncestors:Ee,scrollAdjustedTranslate:ge},V.current={initial:he,translated:ke}},[G,re,Xe,ke,R,Oe,he,H,W,je,Ee,ge]),kde({...le,delta:O,draggingRect:ke,pointerCoordinates:ae,scrollableAncestors:Ee,scrollableAncestorRects:Pe});const Le=T.useMemo(()=>({active:G,activeNode:re,activeNodeRect:we,activatorEvent:K,collisions:Xe,containerNodeRect:pe,dragOverlay:ye,draggableNodes:R,droppableContainers:W,droppableRects:H,over:je,measureDroppableContainers:ie,scrollableAncestors:Ee,scrollableAncestorRects:Pe,measuringConfiguration:X,measuringScheduled:ne,windowRect:Ue}),[G,re,we,K,Xe,pe,ye,R,W,H,je,ie,Ee,Pe,X,ne,Ue]),st=T.useMemo(()=>({activatorEvent:K,activators:dt,active:G,activeNodeRect:we,ariaDescribedById:{draggable:U},dispatch:S,draggableNodes:R,over:je,measureDroppableContainers:ie}),[K,dt,G,we,S,U,R,je,ie]);return Qr.createElement(VG.Provider,{value:A},Qr.createElement(bT.Provider,{value:st},Qr.createElement(rW.Provider,{value:Le},Qr.createElement(iW.Provider,{value:Be},c)),Qr.createElement(efe,{disabled:(o==null?void 0:o.restoreFocus)===!1})),Qr.createElement(rde,{...o,hiddenTextDescribedById:U}));function ft(){const mt=(B==null?void 0:B.autoScrollEnabled)===!1,tt=typeof l=="object"?l.enabled===!1:l===!1,Qe=P&&!mt&&!tt;return typeof l=="object"?{...l,enabled:Qe}:{enabled:Qe}}}),ife=T.createContext(null),xD="button",sfe="Draggable";function afe(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const s=cw(sfe),{activators:a,activatorEvent:o,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:h,over:g}=T.useContext(bT),{role:v=xD,roleDescription:b="draggable",tabIndex:_=0}=i??{},w=(l==null?void 0:l.id)===e,S=T.useContext(w?iW:ife),[E,A]=f2(),[N,D]=f2(),P=Gde(a,e),L=rS(n);rh(()=>(h.set(e,{id:e,key:s,node:E,activatorNode:N,data:L}),()=>{const O=h.get(e);O&&O.key===s&&h.delete(e)}),[h,e]);const R=T.useMemo(()=>({role:v,tabIndex:_,"aria-disabled":r,"aria-pressed":w&&v===xD?!0:void 0,"aria-roledescription":b,"aria-describedby":d.draggable}),[r,v,_,w,b,d.draggable]);return{active:l,activatorEvent:o,activeNodeRect:c,attributes:R,isDragging:w,listeners:r?void 0:P,node:E,over:g,setNodeRef:A,setActivatorNodeRef:D,transform:S}}function ofe(){return T.useContext(rW)}const lfe="Droppable",cfe={timeout:25};function ufe(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const s=cw(lfe),{active:a,dispatch:o,over:l,measureDroppableContainers:c}=T.useContext(bT),d=T.useRef({disabled:n}),h=T.useRef(!1),g=T.useRef(null),v=T.useRef(null),{disabled:b,updateMeasurementsFor:_,timeout:w}={...cfe,...i},S=rS(_??r),E=T.useCallback(()=>{if(!h.current){h.current=!0;return}v.current!=null&&clearTimeout(v.current),v.current=setTimeout(()=>{c(Array.isArray(S.current)?S.current:[S.current]),v.current=null},w)},[w]),A=yT({callback:E,disabled:b||!a}),N=T.useCallback((R,O)=>{A&&(O&&(A.unobserve(O),h.current=!1),R&&A.observe(R))},[A]),[D,P]=f2(N),L=rS(e);return T.useEffect(()=>{!A||!D.current||(A.disconnect(),h.current=!1,A.observe(D.current))},[D,A]),T.useEffect(()=>(o({type:ro.RegisterDroppable,element:{id:r,key:s,disabled:n,node:D,rect:g,data:L}}),()=>o({type:ro.UnregisterDroppable,key:s,id:r})),[r]),T.useEffect(()=>{n!==d.current.disabled&&(o({type:ro.SetDroppableDisabled,id:r,key:s,disabled:n}),d.current.disabled=n)},[r,s,n,o]),{active:a,rect:g,isOver:(l==null?void 0:l.id)===r,node:D,over:l,setNodeRef:P}}function sv(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function dfe(t,e){return t.reduce((n,r,i)=>{const s=e.get(r);return s&&(n[i]=s),n},Array(t.length))}function e4(t){return t!==null&&t>=0}function ffe(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function hfe(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const uw=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const s=sv(e,r,n),a=e[i],o=s[i];return!o||!a?null:{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}},t4={scaleX:1,scaleY:1},sW=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:i,rects:s,overIndex:a}=t;const o=(e=s[n])!=null?e:r;if(!o)return null;if(i===n){const c=s[a];return c?{x:0,y:n<a?c.top+c.height-(o.top+o.height):c.top-o.top,...t4}:null}const l=pfe(s,i,n);return i>n&&i<=a?{x:0,y:-o.height-l,...t4}:i<n&&i>=a?{x:0,y:o.height+l,...t4}:{x:0,y:0,...t4}};function pfe(t,e,n){const r=t[e],i=t[e-1],s=t[e+1];return r?n<e?i?r.top-(i.top+i.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}const aW="Sortable",oW=Qr.createContext({activeIndex:-1,containerId:aW,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:uw,disabled:{draggable:!1,droppable:!1}});function cS(t){let{children:e,id:n,items:r,strategy:i=uw,disabled:s=!1}=t;const{active:a,dragOverlay:o,droppableRects:l,over:c,measureDroppableContainers:d}=ofe(),h=cw(aW,n),g=o.rect!==null,v=T.useMemo(()=>r.map(P=>typeof P=="object"&&"id"in P?P.id:P),[r]),b=a!=null,_=a?v.indexOf(a.id):-1,w=c?v.indexOf(c.id):-1,S=T.useRef(v),E=!ffe(v,S.current),A=w!==-1&&_===-1||E,N=hfe(s);rh(()=>{E&&b&&d(v)},[E,v,b,d]),T.useEffect(()=>{S.current=v},[v]);const D=T.useMemo(()=>({activeIndex:_,containerId:h,disabled:N,disableTransforms:A,items:v,overIndex:w,useDragOverlay:g,sortedRects:dfe(v,l),strategy:i}),[_,h,N.draggable,N.droppable,A,v,w,l,g,i]);return Qr.createElement(oW.Provider,{value:D},e)}const mfe=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return sv(n,r,i).indexOf(e)},gfe=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:s,newIndex:a,previousItems:o,previousContainerId:l,transition:c}=t;return!c||!r||o!==s&&i===a?!1:n?!0:a!==i&&e===l},vfe={duration:200,easing:"ease"},lW="transform",xfe=$1.Transition.toString({property:lW,duration:0,easing:"linear"}),yfe={roleDescription:"sortable"};function bfe(t){let{disabled:e,index:n,node:r,rect:i}=t;const[s,a]=T.useState(null),o=T.useRef(n);return rh(()=>{if(!e&&n!==o.current&&r.current){const l=i.current;if(l){const c=wy(r.current,{ignoreTransform:!0}),d={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(d.x||d.y)&&a(d)}}n!==o.current&&(o.current=n)},[e,n,r,i]),T.useEffect(()=>{s&&a(null)},[s]),s}function k8(t){let{animateLayoutChanges:e=gfe,attributes:n,disabled:r,data:i,getNewIndex:s=mfe,id:a,strategy:o,resizeObserverConfig:l,transition:c=vfe}=t;const{items:d,containerId:h,activeIndex:g,disabled:v,disableTransforms:b,sortedRects:_,overIndex:w,useDragOverlay:S,strategy:E}=T.useContext(oW),A=_fe(r,v),N=d.indexOf(a),D=T.useMemo(()=>({sortable:{containerId:h,index:N,items:d},...i}),[h,i,N,d]),P=T.useMemo(()=>d.slice(d.indexOf(a)),[d,a]),{rect:L,node:R,isOver:O,setNodeRef:W}=ufe({id:a,data:D,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...l}}),{active:F,activatorEvent:V,activeNodeRect:G,attributes:Z,setNodeRef:B,listeners:q,isDragging:K,over:Y,setActivatorNodeRef:Q,transform:U}=afe({id:a,data:D,attributes:{...yfe,...n},disabled:A.draggable}),j=Gue(W,B),X=!!F,H=X&&!b&&e4(g)&&e4(w),ie=!S&&K,ne=ie&&H?U:null,ue=H?ne??(o??E)({rects:_,activeNodeRect:G,activeIndex:g,overIndex:w,index:N}):null,le=e4(g)&&e4(w)?s({id:a,items:d,activeIndex:g,overIndex:w}):N,fe=F==null?void 0:F.id,we=T.useRef({activeId:fe,items:d,newIndex:le,containerId:h}),pe=d!==we.current.items,xe=e({active:F,containerId:h,isDragging:K,isSorting:X,id:a,index:N,items:d,newIndex:we.current.newIndex,previousItems:we.current.items,previousContainerId:we.current.containerId,transition:c,wasDragging:we.current.activeId!=null}),Ve=bfe({disabled:!xe,index:N,node:R,rect:L});return T.useEffect(()=>{X&&we.current.newIndex!==le&&(we.current.newIndex=le),h!==we.current.containerId&&(we.current.containerId=h),d!==we.current.items&&(we.current.items=d)},[X,le,h,d]),T.useEffect(()=>{if(fe===we.current.activeId)return;if(fe!=null&&we.current.activeId==null){we.current.activeId=fe;return}const Oe=setTimeout(()=>{we.current.activeId=fe},50);return()=>clearTimeout(Oe)},[fe]),{active:F,activeIndex:g,attributes:Z,data:D,rect:L,index:N,newIndex:le,items:d,isOver:O,isSorting:X,isDragging:K,listeners:q,node:R,overIndex:w,over:Y,setNodeRef:j,setActivatorNodeRef:Q,setDroppableNodeRef:W,setDraggableNodeRef:B,transform:Ve??ue,transition:ye()};function ye(){if(Ve||pe&&we.current.newIndex===N)return xfe;if(!(ie&&!A8(V)||!c)&&(X||xe))return $1.Transition.toString({...c,property:lW})}}function _fe(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t==null?void 0:t.draggable)!=null?n:e.draggable,droppable:(r=t==null?void 0:t.droppable)!=null?r:e.droppable}}function m2(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Sfe=[li.Down,li.Right,li.Up,li.Left],uS=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:s,over:a,scrollableAncestors:o}}=e;if(Sfe.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];s.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const g=i.get(h.id);if(g)switch(t.code){case li.Down:r.top<g.top&&l.push(h);break;case li.Up:r.top>g.top&&l.push(h);break;case li.Left:r.left>g.left&&l.push(h);break;case li.Right:r.left<g.left&&l.push(h);break}});const c=sde({collisionRect:r,droppableRects:i,droppableContainers:l});let d=$G(c,"id");if(d===(a==null?void 0:a.id)&&c.length>1&&(d=c[1].id),d!=null){const h=s.get(n.id),g=s.get(d),v=g?i.get(g.id):null,b=g==null?void 0:g.node.current;if(b&&v&&h&&g){const w=xT(b).some((P,L)=>o[L]!==P),S=cW(h,g),E=wfe(h,g),A=w||!S?{x:0,y:0}:{x:E?r.width-v.width:0,y:E?r.height-v.height:0},N={x:v.left,y:v.top};return A.x&&A.y?N:iS(N,A)}}}};function cW(t,e){return!m2(t)||!m2(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function wfe(t,e){return!m2(t)||!m2(e)||!cW(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function $u({className:t,size:e="default",...n}){return p.jsx("div",{"data-slot":"card","data-size":e,className:Rt("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col",t),...n})}function yD({className:t,...e}){return p.jsx("div",{"data-slot":"card-header",className:Rt("gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",t),...e})}function n4({className:t,...e}){return p.jsx("div",{"data-slot":"card-title",className:Rt("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",t),...e})}function r4({className:t,...e}){return p.jsx("div",{"data-slot":"card-description",className:Rt("text-muted-foreground text-sm",t),...e})}function eh({className:t,...e}){return p.jsx("div",{"data-slot":"card-content",className:Rt("px-4 group-data-[size=sm]/card:px-3",t),...e})}function Zh({className:t,...e}){return p.jsx("div",{"data-slot":"skeleton",className:Rt("bg-muted rounded-md animate-pulse",t),...e})}const uW=g8("hover:text-foreground aria-pressed:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[state=on]:bg-muted gap-1 rounded-lg text-sm font-medium transition-all [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border-input hover:bg-muted border bg-transparent",selecting:"bg-accent text-muted-foreground data-[state=on]:bg-primary data-[state=on]:text-secondary hover:text-accent-foreground"},size:{default:"h-8 min-w-8 px-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-1.5 text-[0.8rem]",lg:"h-9 min-w-9 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});function g1({className:t,variant:e="default",size:n="default",...r}){return p.jsx(Hae,{"data-slot":"toggle",className:Rt(uW({variant:e,size:n,className:t})),...r})}const dW=T.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function Z0({className:t,variant:e,size:n,spacing:r=0,orientation:i="horizontal",children:s,...a}){return p.jsx(qae,{"data-slot":"toggle-group","data-variant":e,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:Rt("rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",t),...a,children:p.jsx(dW.Provider,{value:{variant:e,size:n,spacing:r,orientation:i},children:s})})}function Uo({className:t,children:e,variant:n="default",size:r="default",...i}){const s=T.useContext(dW);return p.jsx(Xae,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:Rt("group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg shrink-0 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",uW({variant:s.variant||n,size:s.size||r}),t),...i,children:e})}function dS({label:t,enabled:e,onEnabledChange:n,value:r,onValueChange:i,onValueCommit:s,inputType:a="number",inputMin:o,inputMax:l,inputWidth:c="w-12",icon:d,variant:h="default",size:g="default",className:v}){const b=S=>{S.key==="Enter"&&(e||n(!0),s(r),S.currentTarget.blur())},_=()=>{s(r)},w=h==="selecting";return p.jsxs("div",{className:Rt("inline-flex items-center rounded-lg transition-colors",h==="default"&&"border border-input bg-transparent",h==="default"&&e&&"bg-muted",h==="outline"&&"border border-input bg-transparent",h==="outline"&&e&&"bg-muted",w&&"bg-accent",w&&e&&"bg-primary",v),children:[p.jsxs(g1,{variant:h,size:g,pressed:e,onPressedChange:n,className:Rt("gap-1.5 border-0 rounded-r-none pr-1",g==="sm"&&"text-xs px-2"),children:[d,p.jsx("span",{children:t})]}),p.jsx("input",{type:a,min:o,max:l,value:r,onChange:S=>i(S.target.value),onKeyDown:b,onBlur:_,className:Rt("bg-transparent text-center font-medium outline-none rounded-r-lg transition-colors",c,g==="default"&&"h-8 text-sm",g==="sm"&&"h-7 text-xs",w?e?"text-secondary":"text-muted-foreground/50":e?"text-foreground":"text-muted-foreground/50")})]})}const Mfe=g8("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function q1({className:t,variant:e="default",asChild:n=!1,...r}){const i=n?wU:"span";return p.jsx(i,{"data-slot":"badge","data-variant":e,className:Rt(Mfe({variant:e}),t),...r})}const fW="...";function Tfe(t,e){if(!t||e<=0||t.length<=e)return{prefix:t,suffix:"",isTruncated:!1};const n=e-fW.length;if(n<2)return{prefix:t.slice(0,Math.max(1,e)),suffix:"",isTruncated:!1};const r=4;let i=n<=r+1?Math.max(1,Math.floor(n/2)):r;i=Math.min(i,t.length-1);let s=n-i;return s<1&&(s=1,i=Math.max(1,n-s)),{prefix:t.slice(0,s),suffix:t.slice(-i),isTruncated:!0}}function r1({text:t,className:e,tooltipClassName:n,ellipsisClassName:r,ellipsisFadeClassName:i,tooltipDelay:s=300}){const a=T.useRef(null),o=T.useRef(null),[l,c]=T.useState({prefix:t,suffix:"",isTruncated:!1}),d=T.useCallback(()=>{const g=a.current,v=o.current;if(!g||!v)return;const b=g.getBoundingClientRect().width,_=v.getBoundingClientRect().width;if(!b||!_)return;if(_<=b){c(A=>A.isTruncated||A.prefix!==t?{prefix:t,suffix:"",isTruncated:!1}:A);return}const w=_/Math.max(1,t.length),S=Math.max(1,Math.floor(b/w)),E=Tfe(t,S);c(A=>A.prefix===E.prefix&&A.suffix===E.suffix&&A.isTruncated===E.isTruncated?A:E)},[t]);T.useLayoutEffect(()=>{d();const g=a.current;if(!g||typeof ResizeObserver>"u")return;const v=new ResizeObserver(()=>{d()});return v.observe(g),()=>v.disconnect()},[d]);const h=p.jsxs("span",{ref:a,className:Rt("relative flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",e),children:[p.jsx("span",{ref:o,className:"pointer-events-none absolute -z-10 opacity-0","aria-hidden":"true",children:t||"M"}),l.isTruncated?p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"shrink-0",children:l.prefix}),p.jsx("span",{className:Rt("relative inline-flex items-center rounded-[2px] px-0.5 text-muted-foreground","before:absolute before:inset-y-0 before:-left-2 before:w-2 before:bg-gradient-to-r before:from-transparent before:content-['']",r??"bg-background",i??"before:to-background"),children:fW}),p.jsx("span",{className:"shrink-0",children:l.suffix})]}):p.jsx("span",{className:"truncate",children:t})]});return l.isTruncated?p.jsxs(vv,{delayDuration:s,children:[p.jsx(xv,{asChild:!0,children:h}),p.jsx(yv,{side:"top",className:Rt("max-w-xs break-all text-[11px]",n),children:t})]}):h}function JN(t){try{return JSON.stringify(t,(n,r)=>r&&typeof r=="object"&&!Array.isArray(r)?Object.keys(r).sort().reduce((i,s)=>(i[s]=r[s],i),{}):r)??String(t)}catch{return String(t)}}function hW(t){if(t==null)return null;const e=typeof t=="object"&&t!==null&&"value"in t?t.value:t;return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||Array.isArray(e)||typeof e=="object"&&e!==null?e:null}function bD(t){return t==null?"—":typeof t=="boolean"?t?"True":"False":typeof t=="number"?Number.isInteger(t)?t.toLocaleString():Math.abs(t)<.001&&t!==0?t.toExponential(2):t.toLocaleString(void 0,{maximumFractionDigits:6}):typeof t=="object"?JN(t):String(t)}function _D(t){const e=t.split("/");return e[e.length-1].replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function P8(t,e){return t===e?!0:t==null?e==null:e==null?!1:typeof t=="object"||typeof e=="object"?JN(t)===JN(e):String(t)===String(e)}function Efe(t){const e=[{key:"general",label:"General",match:l=>l==="debug",order:["debug"]},{key:"model",label:"Model",match:l=>l==="model"||l==="model_dtype"||l==="mixed_precision_dtype",order:["model","model_dtype","mixed_precision_dtype"]},{key:"ray_cluster",label:"Ray Cluster",match:l=>l.startsWith("ray_")&&l!=="ray_torch_memory_drain_interval_seconds",order:["ray_address","ray_auto_start_local","ray_namespace","ray_log_to_driver","ray_disable_runtime_env_hook","ray_pin_py_executable","ray_propagate_active_venv","ray_propagate_run_dir","ray_broadcast_init_timeout_s","ray_broadcast_prefer_loopback_if_single_node","ray_shutdown_on_exit","ray_inference_cpus_per_worker","ray_trainer_cpus_per_worker","ray_inference_placement_strategy","ray_trainer_placement_strategy","ray_placement_timeout_s"]},{key:"workers",label:"Workers",match:l=>["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"].includes(l),order:["inference_num_workers","inference_tensor_parallel_size","trainer_num_workers","trainer_devices"]},{key:"orchestrator",label:"Orchestrator",match:l=>["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"].includes(l),order:["max_concurrent_prompts_per_server","prompts_batch_size_for_trainer","number_of_steps","max_async_rollout","max_off_policy_steps","discard_group_zero_advantage","enable_prompt_prefetch","prompt_prefetch_buffer_size","enable_individual_sample_lanes"]},{key:"trainer",label:"Trainer",match:l=>["learning_rate","weight_decay","warmup_steps","grad_clip","train_backend","fsdp_activation_checkpointing","jit"].includes(l)||l.startsWith("megatron_"),order:["learning_rate","weight_decay","warmup_steps","grad_clip","train_backend","fsdp_activation_checkpointing","jit","megatron_tensor_parallel_size","megatron_pipeline_parallel_size","megatron_context_parallel_size","megatron_expert_parallel_size","megatron_disable_unified_memory_jit","megatron_optimizer_cpu_offload","megatron_optimizer_offload_fraction","megatron_overlap_cpu_optimizer_d2h_h2d","megatron_use_precision_aware_optimizer","megatron_main_grads_dtype","megatron_main_params_dtype","megatron_exp_avg_dtype","megatron_exp_avg_sq_dtype"]},{key:"algorithm",label:"Algorithm",match:l=>["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"].includes(l),order:["algorithm","number_of_minibatches","use_ppo_clip","ppo_clip_ref_logprobs","clip_low","clip_high","sapo_tau_pos","sapo_tau_neg","advantage_norm","use_tis","tis_cap","tis_logprob_clamp","entropy_chunk_size"]},{key:"weight_sync",label:"Weight Sync",match:l=>l.startsWith("weight_broadcast_"),order:["weight_broadcast_mode","weight_broadcast_bucket_mb","weight_broadcast_cpu_staging"]},{key:"sequence_packing",label:"Sequence Packing",match:l=>l==="seq_len"||l==="pad_to_multiple_of",order:["seq_len","pad_to_multiple_of"]},{key:"inference",label:"Inference",match:l=>["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"].includes(l),order:["inference_host","inference_devices","inference_base_port","num_inference_servers","gpu_memory_utilization","max_model_len","vllm_scheduling_policy","enable_thinking","chat_template","reasoning_parser","enable_tool_call","tool_call_parser"]},{key:"rollout",label:"Rollout / Sampling",match:l=>["group_size","temperature","max_tokens","top_p","interleaved_rollouts"].includes(l),order:["group_size","temperature","max_tokens","top_p","interleaved_rollouts"]},{key:"checkpoint",label:"Checkpoint",match:l=>["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"].includes(l),order:["checkpoint_every","checkpoint_save_training_state","resume_from_checkpoint","checkpoint_dir","checkpoint_keep_last","checkpoint_keep_every"]},{key:"logging",label:"Logging",match:l=>l==="use_wandb"||l.startsWith("wandb_")||l==="_wandb"||l.startsWith("event_")||l.endsWith("_interval_seconds")||l==="rollout_block_size"||l==="track_gpu_events",order:["use_wandb","wandb_project","wandb_run_name","wandb_tags","wandb_upload_code","wandb_code_max_file_size_mb","wandb_code_exclude_patterns","system_metrics_collection_interval_seconds","torch_memory_sample_interval_seconds","event_tail_window_seconds","event_block_duration_seconds","event_upload_interval_seconds","metrics_logger_interval_seconds","ray_torch_memory_drain_interval_seconds","rollout_block_size","track_gpu_events"]},{key:"evals",label:"Evals",match:l=>l.startsWith("eval_"),order:["eval_before_training","eval_after_training","eval_num_servers","eval_start_end_use_all_servers"]},{key:"vllm_tracing",label:"vLLM Tracing",match:l=>l==="enable_vllm_tracing"||l==="otlp_receiver_port",order:["enable_vllm_tracing","otlp_receiver_port"]},{key:"environments",label:"Environments",match:l=>l==="environments"||l==="evals"},{key:"setup/gpu",label:"GPU",match:l=>l.startsWith("setup/gpu/")},{key:"setup/cpu",label:"CPU",match:l=>l.startsWith("setup/cpu/")},{key:"setup/memory",label:"Memory",match:l=>l.startsWith("setup/memory/")},{key:"setup/disk",label:"Disk",match:l=>l.startsWith("setup/disk/")},{key:"setup/network",label:"Network",match:l=>l.startsWith("setup/network/")},{key:"setup/os",label:"Operating System",match:l=>l.startsWith("setup/os/")},{key:"setup/package_versions",label:"Package Versions",match:l=>l.startsWith("setup/package_versions/")}],n=new Map;for(const l of e)n.set(l.key,{key:l.key,label:l.label,items:[]});for(const[l,c]of Object.entries(t)){if(l==="_wandb")continue;const d=hW(c);if(d===null)continue;let h=!1;for(const g of e)if(g.match(l)){n.get(g.key).items.push({key:l,displayKey:_D(l),value:d}),h=!0;break}h||(n.has("other")||n.set("other",{key:"other",label:"Other",items:[]}),n.get("other").items.push({key:l,displayKey:_D(l),value:d}))}const r=new Map(e.map(l=>[l.key,l]));for(const[,l]of n){const c=r.get(l.key);if(c!=null&&c.order&&l.items.length>1){const d=new Map(c.order.map((h,g)=>[h,g]));l.items.sort((h,g)=>{const v=d.get(h.key)??1/0,b=d.get(g.key)??1/0;return v!==b?v-b:h.key.localeCompare(g.key)})}}const i=new Set(["setup/gpu","setup/cpu","setup/memory","setup/disk","setup/network","setup/os","setup/package_versions"]),s=["general","model","ray_cluster","workers","orchestrator","trainer","algorithm","weight_sync","sequence_packing","inference","rollout","checkpoint","logging","evals","vllm_tracing","environments","hardware","other"],a=[];for(const l of i){const c=n.get(l);c&&c.items.length>0&&a.push(c)}const o=[];for(const l of s)if(l==="hardware")a.length>0&&o.push({key:"hardware",label:"Hardware & Environment",items:[],subcategories:a});else{const c=n.get(l);c&&c.items.length>0&&o.push(c)}return o}function SD(t){const e=new Map;for(const[n,r]of Object.entries(t)){if(n==="_wandb")continue;const i=hW(r);i!==null&&e.set(n,i)}return e}function I8(t,e,n){return t.subcategories?t.subcategories.some(r=>I8(r,e,n)):t.items.some(r=>{const i=e.get(r.key),s=n.get(r.key);return!P8(i,s)})}function Cfe({runs:t,currentRunId:e,onSelect:n}){return p.jsxs("div",{className:"flex flex-col gap-1",children:[t.map(r=>{const i=r.run_id===e,s=r.name||r.run_id.split("/").pop()||r.run_id;return p.jsxs("button",{onClick:()=>!i&&n(r.run_id),disabled:i,className:Rt("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left transition-colors",i?"opacity-40 cursor-not-allowed":"hover:bg-muted cursor-pointer"),children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:r.color}}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"min-w-0",children:p.jsx(r1,{text:s,className:"text-sm font-medium"})}),p.jsx("div",{className:"truncate text-xs text-muted-foreground",children:r.run_id})]}),i&&p.jsx(q1,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),r.is_tracking&&p.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0",title:"Live"}),r.is_syncing&&p.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),r.created_at&&p.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:W1(r.created_at)})]},r.run_id)}),t.length===0&&p.jsx("div",{className:"text-sm text-muted-foreground text-center py-4",children:"No other runs available"})]})}function wD({value:t,formatted:e,isDifferent:n}){const r=e.length>20,i=p.jsx("span",{className:Rt("text-sm font-sans truncate block max-w-full overflow-hidden text-ellipsis",n?"font-medium":"text-muted-foreground"),children:e});return r?p.jsxs(vv,{children:[p.jsx(xv,{asChild:!0,children:i}),p.jsx(yv,{side:"top",className:"max-w-xs break-all font-sans text-xs",children:e})]}):i}function Afe({displayKey:t,value1:e,value2:n,showOnlyDifferences:r}){const i=bD(e),s=bD(n),a=!P8(e,n);return r&&!a?null:p.jsxs("div",{className:Rt("grid grid-cols-[1fr_2fr_2fr] gap-3 py-1.5 rounded-md transition-colors min-w-0",a?"hover:bg-muted/50":"opacity-40 hover:opacity-60"),children:[p.jsxs(vv,{children:[p.jsx(xv,{asChild:!0,children:p.jsx("span",{className:Rt("text-sm truncate min-w-0",a?"text-foreground":"text-muted-foreground"),children:t})}),p.jsx(yv,{side:"left",className:"text-xs",children:t})]}),p.jsx("div",{className:"min-w-0 overflow-hidden",children:p.jsx(wD,{value:e,formatted:i,isDifferent:a})}),p.jsx("div",{className:"min-w-0 overflow-hidden",children:p.jsx(wD,{value:n,formatted:s,isDifferent:a})})]})}const Nfe="ml-[22px]",Rfe="ml-[38px]";function pW({category:t,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:i=!1,defaultOpen:s}){const a=I8(t,e,n),[o,l]=T.useState(s??a);if(r&&!a)return null;const c=t.subcategories&&t.subcategories.length>0;return p.jsxs(Ki,{open:o,onOpenChange:l,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:Rt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",i&&"ml-4",!a&&"opacity-40"),children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!o&&"-rotate-90")}),p.jsx("span",{className:"text-sm font-semibold",children:t.label})]})})}),p.jsx(Qi,{children:c?p.jsx("div",{className:"mt-1",children:t.subcategories.map(d=>p.jsx(pW,{category:d,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:!0},d.key))}):p.jsx("div",{className:Rt("mt-1",i?Rfe:Nfe),children:t.items.map(d=>p.jsx(Afe,{displayKey:d.displayKey,value1:e.get(d.key),value2:n.get(d.key),showOnlyDifferences:r},d.key))})})]})}function kfe({config1:t,config2:e,run1Name:n,run2Name:r,run1Path:i,run2Path:s,run1Color:a,run2Color:o}){const[l,c]=T.useState(!0),d=T.useMemo(()=>SD(t),[t]),h=T.useMemo(()=>SD(e),[e]),g=T.useMemo(()=>{const _={...t};for(const[w,S]of Object.entries(e))w in _||(_[w]=S);return _},[t,e]),v=T.useMemo(()=>Efe(g),[g]),b=T.useMemo(()=>{let _=0;for(const[w,S]of d){const E=h.get(w);P8(S,E)||_++}for(const[w]of h)d.has(w)||_++;return _},[d,h]);return p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between gap-4 pb-2 border-b",children:[p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs(q1,{variant:"secondary",className:"text-xs",children:[b," difference",b!==1?"s":""]})}),p.jsxs(Z0,{type:"single",value:l?"differences":"everything",onValueChange:_=>{_&&c(_==="differences")},variant:"outline",size:"sm",children:[p.jsx(Uo,{value:"everything",className:"text-xs px-3",children:"Everything"}),p.jsx(Uo,{value:"differences",className:"text-xs px-3",children:"Only differences"})]})]}),p.jsxs("div",{className:"grid grid-cols-[1fr_2fr_2fr] gap-3 pb-2 border-b text-sm font-medium",children:[p.jsx("span",{className:"text-muted-foreground",children:"Config"}),p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:a}}),p.jsx(r1,{text:n,className:"text-sm font-medium min-w-0"})]}),p.jsx("div",{className:"ml-4",children:p.jsx(r1,{text:i,className:"text-xs font-normal text-muted-foreground min-w-0"})})]}),p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:o}}),p.jsx(r1,{text:r,className:"text-sm font-medium min-w-0"})]}),p.jsx("div",{className:"ml-4",children:p.jsx(r1,{text:s,className:"text-xs font-normal text-muted-foreground min-w-0"})})]})]}),p.jsx(_v,{className:"h-[72vh]",children:p.jsx("div",{className:"space-y-1 pr-4",children:v.map(_=>{let w;return _.key==="hardware"&&(w=v.filter(E=>E.key!=="hardware"&&I8(E,d,h)).length===0),p.jsx(pW,{category:_,config1Map:d,config2Map:h,showOnlyDifferences:l,defaultOpen:w},_.key)})})})]})}function Pfe({currentRunId:t,currentConfig:e}){const[n,r]=T.useState(!1),[i,s]=T.useState(null),{data:a,isLoading:o}=pm(),l=(a==null?void 0:a.runs)||[],{data:c,isLoading:d}=ed(i||"",!!i,!1),h=l.find(N=>N.run_id===t),g=l.find(N=>N.run_id===i),v=(h==null?void 0:h.color)??"",b=(g==null?void 0:g.color)??"",_=N=>{s(N)},w=()=>{s(null)},S=()=>{r(!1),setTimeout(()=>s(null),200)},E=(h==null?void 0:h.name)||t.split("/").pop()||t,A=(g==null?void 0:g.name)||(i==null?void 0:i.split("/").pop())||"";return p.jsxs($f,{open:n,onOpenChange:N=>{N?r(!0):S()},children:[p.jsx(sT,{asChild:!0,children:p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Compare"})}),p.jsx(qf,{className:"sm:max-w-4xl max-h-[95vh]",children:i?p.jsxs(p.Fragment,{children:[p.jsx(jd,{children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Tn,{variant:"ghost",size:"sm",onClick:w,className:"h-7 px-2",children:"← Back"}),p.jsx("div",{children:p.jsx(Fd,{children:"Configuration Comparison"})})]})}),d?p.jsxs("div",{className:"flex items-center justify-center py-16",children:[p.jsx(ll,{className:"h-6 w-6"}),p.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading configuration..."})]}):c!=null&&c.config?p.jsx(kfe,{config1:c.config,config2:e,run1Name:A,run2Name:E,run1Path:i||"",run2Path:t,run1Color:b,run2Color:v}):p.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No configuration data available for the selected run."})]}):p.jsxs(p.Fragment,{children:[p.jsxs(jd,{children:[p.jsx(Fd,{children:"Compare Configuration"}),p.jsxs(kg,{children:["Select another run to compare its configuration with"," ",p.jsx("span",{className:"font-sans text-foreground",children:E})]})]}),p.jsx(_v,{className:"h-[500px] pr-4",children:o?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx(ll,{className:"h-5 w-5"})}):p.jsx(Cfe,{runs:l,currentRunId:t,onSelect:_})})]})})]})}class Ife{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(e,r),a=this.castInput(n,r),o=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(o,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;const a=E=>{if(E=this.postProcess(E,r),i){setTimeout(function(){i(E)},0);return}else return E},o=n.length,l=e.length;let c=1,d=o+l;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const h=(s=r.timeout)!==null&&s!==void 0?s:1/0,g=Date.now()+h,v=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(v[0],n,e,0,r);if(v[0].oldPos+1>=l&&b+1>=o)return a(this.buildValues(v[0].lastComponent,n,e));let _=-1/0,w=1/0;const S=()=>{for(let E=Math.max(_,-c);E<=Math.min(w,c);E+=2){let A;const N=v[E-1],D=v[E+1];N&&(v[E-1]=void 0);let P=!1;if(D){const R=D.oldPos-E;P=D&&0<=R&&R<o}const L=N&&N.oldPos+1<l;if(!P&&!L){v[E]=void 0;continue}if(!L||P&&N.oldPos<D.oldPos?A=this.addToPath(D,!0,!1,0,r):A=this.addToPath(N,!1,!0,1,r),b=this.extractCommon(A,n,e,E,r),A.oldPos+1>=l&&b+1>=o)return a(this.buildValues(A.lastComponent,n,e))||!0;v[E]=A,A.oldPos+1>=l&&(w=Math.min(w,E-1)),b+1>=o&&(_=Math.max(_,E+1))}c++};if(i)(function E(){setTimeout(function(){if(c>d||Date.now()>g)return i(void 0);S()||E()},0)})();else for(;c<=d&&Date.now()<=g;){const E=S();if(E)return E}}addToPath(e,n,r,i,s){const a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(e,n,r,i,s){const a=n.length,o=r.length;let l=e.oldPos,c=l-i,d=0;for(;c+1<a&&l+1<o&&this.equals(r[l+1],n[c+1],s);)c++,l++,d++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(e.lastComponent={count:d,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const a=i.length;let o=0,l=0,c=0;for(;o<a;o++){const d=i[o];if(d.removed)d.value=this.join(r.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&this.useLongestToken){let h=n.slice(l,l+d.count);h=h.map(function(g,v){const b=r[c+v];return b.length>g.length?b:g}),d.value=this.join(h)}else d.value=this.join(n.slice(l,l+d.count));l+=d.count,d.added||(c+=d.count)}}return i}}class Dfe extends Ife{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const Ofe=new Dfe;function Lfe(t,e,n){return Ofe.diff(t,e,n)}function zfe({runs:t,currentRunId:e,selectedCompareRunId:n,onSelect:r}){return p.jsxs("div",{className:"flex flex-col gap-1",children:[t.map(i=>{const s=i.run_id===e,a=i.run_id===n,o=i.name||i.run_id.split("/").pop()||i.run_id;return p.jsxs("button",{onClick:()=>!s&&r(i.run_id),disabled:s,className:Rt("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left transition-colors",s?"cursor-not-allowed opacity-40":Rt("cursor-pointer hover:bg-muted",a&&"bg-muted")),children:[p.jsx("div",{className:"h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:i.color}}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"min-w-0",children:p.jsx(r1,{text:o,className:"text-sm font-medium"})}),p.jsx("div",{className:"truncate text-xs text-muted-foreground",children:i.run_id})]}),s&&p.jsx(q1,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),!s&&a&&p.jsx(q1,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Comparing"}),i.is_tracking&&p.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0",title:"Live"}),i.is_syncing&&p.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),i.created_at&&p.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:W1(i.created_at)})]},i.run_id)}),t.length===0&&p.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No other runs available."})]})}function MD({currentRunId:t,selectedCompareRunId:e,onSelectCompareRun:n,disabled:r=!1}){const[i,s]=T.useState(!1),{data:a,isLoading:o}=pm(),l=(a==null?void 0:a.runs)??[],c=l.find(v=>v.run_id===t)??null,d=(c==null?void 0:c.name)||t.split("/").pop()||t,h=l.find(v=>v.run_id===e)??null,g=(h==null?void 0:h.name)||(h==null?void 0:h.run_id.split("/").pop())||null;return p.jsxs($f,{open:i,onOpenChange:v=>{s(v)},children:[p.jsx(sT,{asChild:!0,children:p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:r,children:"Compare"})}),p.jsxs(qf,{className:"sm:max-w-4xl max-h-[90vh]",children:[p.jsxs(jd,{children:[p.jsx(Fd,{children:"Select Run To Compare"}),p.jsxs(kg,{children:["Choose another run to compare against"," ",p.jsx("span",{className:"font-sans text-foreground",children:d}),"."]})]}),e&&p.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-xs",children:[p.jsxs("span",{className:"text-muted-foreground",children:["Currently comparing with"," ",p.jsx("span",{className:"font-medium text-foreground",children:g||e})]}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{n(null),s(!1)},children:"Stop comparing"})]}),p.jsx(_v,{className:"h-[480px] pr-4",children:o?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx(ll,{className:"h-5 w-5"})}):p.jsx(zfe,{runs:l,currentRunId:t,selectedCompareRunId:e,onSelect:v=>{n(v),s(!1)}})})]})]})}const jfe={python:["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","False","finally","for","from","global","if","import","in","is","lambda","None","nonlocal","not","or","pass","raise","return","True","try","while","with","yield"],javascript:["break","case","catch","class","const","continue","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","let","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield"],typescript:["any","as","async","await","boolean","break","case","catch","class","const","continue","default","declare","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","interface","let","namespace","new","null","private","protected","public","readonly","return","static","super","switch","this","throw","true","try","type","typeof","undefined","var","while"],json:["true","false","null"],bash:["if","then","else","elif","fi","for","while","do","done","case","esac","function","in","local","export","return"],sql:["SELECT","FROM","WHERE","JOIN","LEFT","RIGHT","INNER","OUTER","ON","GROUP","BY","ORDER","HAVING","LIMIT","OFFSET","INSERT","INTO","VALUES","UPDATE","SET","DELETE","CREATE","TABLE","ALTER","DROP","AND","OR","NOT","NULL","AS","DISTINCT","UNION","ALL"]},Ffe=new Set(["python","bash","yaml","toml"]),Ufe=new Set(["sql"]);function Bfe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hfe(t){if(!t)return"plaintext";const e=t.toLowerCase(),n=e.split(".").pop()??"";return n==="py"?"python":n==="ts"||n==="tsx"?"typescript":n==="js"||n==="jsx"||n==="mjs"||n==="cjs"?"javascript":n==="json"?"json":n==="sh"||n==="bash"||n==="zsh"?"bash":n==="sql"?"sql":n==="yml"||n==="yaml"?"yaml":n==="toml"?"toml":n==="md"?"markdown":n==="go"?"go":n==="rs"?"rust":n==="java"?"java":n==="php"?"php":n==="rb"?"ruby":n==="css"?"css":n==="html"?"html":e.endsWith("/dockerfile")?"dockerfile":"plaintext"}function Vfe(t){return Ffe.has(t)?"#.*$":Ufe.has(t)?"--.*$":t==="json"?null:"//.*$"}function E0(t,e){if(t.length===0)return[{text:" "}];const n=jfe[e]??[],r=new Set(n),i="\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|`(?:\\\\.|[^`\\\\])*`",s=Vfe(e),a=n.length>0?`\\b(?:${n.map(g=>Bfe(g)).join("|")})\\b`:null,o="\\b\\d+(?:\\.\\d+)?\\b",l=[i];s&&l.push(s),a&&l.push(a),l.push(o);const c=new RegExp(l.join("|"),"g"),d=[];let h=0;for(const g of t.matchAll(c)){const v=g[0]??"",b=g.index;if(b===void 0||v.length===0)continue;b>h&&d.push({text:t.slice(h,b)});let _;v.startsWith('"')||v.startsWith("'")||v.startsWith("`")?_="text-emerald-600 dark:text-emerald-400":v.startsWith("#")||v.startsWith("//")||v.startsWith("--")?_="text-muted-foreground":r.has(v)?_="text-violet-600 dark:text-violet-400":/^\d/.test(v)&&(_="text-amber-600 dark:text-amber-400"),d.push({text:v,className:_}),h=b+v.length}return h<t.length&&d.push({text:t.slice(h)}),d}function Gfe(t){const e=t.indexOf('"""'),n=t.indexOf("'''");return e===-1&&n===-1?null:e===-1?{index:n,quote:"'''"}:n===-1?{index:e,quote:'"""'}:e<=n?{index:e,quote:'"""'}:{index:n,quote:"'''"}}function qC(t,e){const n=t.split(/\r?\n/);if(e!=="python")return n.map(s=>E0(s,e));let r=null;const i=[];for(const s of n){if(s.length===0){i.push([{text:" "}]);continue}if(r){const g=s.indexOf(r);if(g===-1){i.push([{text:s,className:"text-muted-foreground"}]);continue}const v=s.slice(0,g+3),b=s.slice(g+3),_=[{text:v,className:"text-muted-foreground"}];r=null,b.length>0&&_.push(...E0(b,e)),i.push(_);continue}const a=Gfe(s);if(!a){i.push(E0(s,e));continue}const o=s.indexOf(a.quote,a.index+3),l=s.slice(0,a.index);if(o===-1){const g=[];l.length>0&&g.push(...E0(l,e)),g.push({text:s.slice(a.index),className:"text-muted-foreground"}),i.push(g),r=a.quote;continue}const c=[],d=s.slice(a.index,o+3),h=s.slice(o+3);l.length>0&&c.push(...E0(l,e)),c.push({text:d,className:"text-muted-foreground"}),h.length>0&&c.push(...E0(h,e)),i.push(c)}return i}function TD(t){if(!t)return[];const n=t.replace(/\r\n/g,`
`).replace(/\r/g,`
`).split(`
`);return n.length>0&&n[n.length-1]===""&&n.pop(),n}function Wfe(t,e){const n=TD(t),r=TD(e),i=Lfe(n,r),s=[];let a=1,o=1;for(const l of i)for(const c of l.value)l.added?(s.push({kind:"add",text:c,leftLine:null,rightLine:o}),o+=1):l.removed?(s.push({kind:"remove",text:c,leftLine:a,rightLine:null}),a+=1):(s.push({kind:"context",text:c,leftLine:a,rightLine:o}),a+=1,o+=1);return s}function mW(t){return t.map(e=>{var n;return{name:e.name,path:e.path,type:e.type,status:"common",children:e.type==="directory"&&((n=e.children)!=null&&n.length)?mW(e.children):void 0}})}function gW(t,e){const n=new Map(t.map(a=>[a.name,a])),r=new Map(e.map(a=>[a.name,a])),i=Array.from(new Set([...n.keys(),...r.keys()]));i.sort((a,o)=>{const l=n.get(a)??r.get(a),c=n.get(o)??r.get(o);return!l||!c?a.localeCompare(o):l.type!==c.type?l.type==="directory"?-1:1:l.name.localeCompare(c.name)});const s=[];for(const a of i){const o=n.get(a),l=r.get(a);if(!o&&!l)continue;const c=o??l;if(!c)continue;const d=o?l?"common":"removed":"added";if(c.type==="directory"){const h=gW((o==null?void 0:o.children)??[],(l==null?void 0:l.children)??[]),g=d==="common"&&h.some(v=>v.status!=="common")?"modified":d;s.push({name:c.name,path:c.path,type:"directory",status:g,children:h})}else{const h=d==="common"&&(o==null?void 0:o.hash)!=null&&(l==null?void 0:l.hash)!=null&&o.hash!==l.hash?"modified":d;s.push({name:c.name,path:c.path,type:"file",status:h})}}return s}function $fe(t){const e=[],n=r=>{var i;for(const s of r)s.type==="file"?s.status!=="common"&&e.push(s.path):(i=s.children)!=null&&i.length&&n(s.children)};return n(t),e}function XC(t){const e=t.split("/"),n=[];for(let r=1;r<e.length;r++)n.push(e.slice(0,r).join("/"));return n}function qfe(t){const e=[];let n=-1;for(let r=0;r<t.length;r++)t[r].kind!=="context"?n===-1&&(n=r):n!==-1&&(e.push({startRowIndex:n,endRowIndex:r-1}),n=-1);return n!==-1&&e.push({startRowIndex:n,endRowIndex:t.length-1}),e}function vW(t){var e;for(const n of t){if(n.type==="file")return n.path;if(n.type==="directory"&&((e=n.children)!=null&&e.length)){const r=vW(n.children);if(r)return r}}return null}function eR(t,e){var n;for(const r of t)if(r.type==="file"&&r.path===e||r.type==="directory"&&((n=r.children)!=null&&n.length)&&eR(r.children,e))return!0;return!1}function xW(t,e){var n;for(const r of t)if(r.type==="file"&&r.path===e||r.type==="directory"&&((n=r.children)!=null&&n.length)&&xW(r.children,e))return!0;return!1}function ED(t){const e=new Set;for(const n of t)n.type==="directory"&&e.add(n.path);return e}function Xfe({runPath:t,onBack:e}){const[n,r]=T.useState(null),[i,s]=T.useState(null),[a,o]=T.useState(null),[l,c]=T.useState(null),[d,h]=T.useState(0),[g,v]=T.useState(null),b=T.useRef({}),_=T.useRef({}),w=T.useRef(!1),S=T.useRef(null),E=T.useRef(null),{data:A}=pm(),N=(A==null?void 0:A.runs.find(Bt=>Bt.run_id===t))??null,D=(N==null?void 0:N.name)||t.split("/").pop()||t,P=(A==null?void 0:A.runs.find(Bt=>Bt.run_id===a))??null,L=(P==null?void 0:P.name)||(a==null?void 0:a.split("/").pop())||a,{data:R,isLoading:O,error:W}=tD(t,!!t),{data:F,isLoading:V,error:G}=tD(a||"",!!a),{data:Z,isFetching:B}=fue(a||"",t,!!a&&!!(R!=null&&R.available)&&!!(F!=null&&F.available)&&!V),q=T.useMemo(()=>R!=null&&R.available?R.tree:[],[R]),K=T.useMemo(()=>F!=null&&F.available?F.tree:[],[F]),Y=a!==null,Q=Y&&!V&&(F==null?void 0:F.available)===!0,U=T.useMemo(()=>Q?gW(K,q):mW(q),[Q,q,K]),j=ED(U),X=n??j,H=U.length===0?null:i&&xW(U,i)?i:vW(U),ie=Hfe(H),ne=!!H&&eR(q,H),re=!!H&&eR(K,H),{data:ue,isLoading:le,isFetching:fe,error:we}=nD(t,H??"",!!t&&!!H&&!!(R!=null&&R.available)&&ne),{data:pe,isLoading:xe,isFetching:Ve,error:ye}=nD(a??"",H??"",!!a&&!!H&&!!(F!=null&&F.available)&&re),Oe=ne?ue:null,he=re?pe:null,Re=H&&(Oe==null?void 0:Oe.file_path)===H?Oe:null,oe=H&&(he==null?void 0:he.file_path)===H?he:null,Ue=(Oe==null?void 0:Oe.content)??null,Ee=(Re==null?void 0:Re.content)??null,Pe=(oe==null?void 0:oe.content)??null,Ze=ne?Ee:"",ae=re?Pe:"",te=H&&(g==null?void 0:g.targetPath)===H?g:null,me=Y&&!(Ze!==null&&ae!==null)&&te!==null,ge=me?te.rightContent:Ze,ke=me?te.leftContent:ae,Xe=Bt=>{r(fn=>{const Ht=new Set(fn??j);return Ht.has(Bt)?Ht.delete(Bt):Ht.add(Bt),Ht})},Ae=(Bt,fn)=>Bt.map(Ht=>{var Ln;const In=Ht.status==="added"?"text-emerald-700 dark:text-emerald-400":Ht.status==="removed"?"text-[#f27c7e] line-through":Ht.status==="modified"?"text-[#ab6100]":"",Nn=Ht.status==="added"?"text-emerald-700 dark:text-emerald-400":Ht.status==="removed"?"text-[#f27c7e]":Ht.status==="modified"?"text-[#ab6100]":"text-muted-foreground";if(Ht.type==="directory"){const Fn=X.has(Ht.path);return p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>Xe(Ht.path),className:"flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",style:{paddingLeft:`${fn*14+6}px`},children:[p.jsx("span",{className:Rt("inline-flex h-4 w-4 items-center justify-center",Nn),children:Fn?p.jsx(Vr,{className:"h-3 w-3"}):p.jsx(f1,{className:"h-3 w-3"})}),Fn?p.jsx(zle,{className:Rt("h-3.5 w-3.5",Nn)}):p.jsx(Fle,{className:Rt("h-3.5 w-3.5",Nn)}),p.jsx("span",{className:Rt("truncate",In),children:Ht.name})]}),Fn&&((Ln=Ht.children)!=null&&Ln.length)?Ae(Ht.children,fn+1):null]},Ht.path)}const bn=H===Ht.path;return p.jsxs("button",{type:"button",ref:Fn=>{_.current[Ht.path]=Fn},onClick:()=>{Ot(Ht.path),s(Ht.path),Y&&(h(0),w.current=!0,S.current=Ht.path)},className:Rt("flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",bn&&"bg-muted font-medium"),style:{paddingLeft:`${fn*14+26}px`},children:[p.jsx(Ole,{className:Rt("h-3.5 w-3.5",Nn)}),p.jsx("span",{className:Rt("truncate",In),children:Ht.name})]},Ht.path)}),je=T.useMemo(()=>qC(Ue??"",ie),[Ue,ie]),We=T.useMemo(()=>qC(ke??"",ie),[ke,ie]),De=T.useMemo(()=>qC(ge??"",ie),[ge,ie]),Be=T.useMemo(()=>!Y||!H?[]:Wfe(ke??"",ge??""),[Y,H,ke,ge]),qe=!!H&&Y&&!me&&(ne&&Ze===null&&!we||re&&ae===null&&!ye),Se=!!H&&Y&&(ne&&fe||re&&Ve),Ye=!ne||Re!==null&&!le&&!fe,dt=!re||oe!==null&&!xe&&!Ve,Le=!!(oe!=null&&oe.is_binary),st=!!(Oe!=null&&Oe.is_binary),ft=!!(Re!=null&&Re.is_binary),mt=Y?ne?ge:re?ke:null:Ue,Qe=!!H&&mt!==null&&!(Y?ne?ft:re?Le:!1:st),ze=T.useMemo(()=>qfe(Be),[Be]),Te=T.useMemo(()=>$fe(U),[U]),He=H?Te.indexOf(H):-1,et=ze.length>0?(d%ze.length+ze.length)%ze.length:0,ht=ze.length>0?et+1:0,ct=Te.length>0&&He>=0?He+1:0,bt=T.useMemo(()=>Be.reduce((Bt,fn)=>Bt+(fn.kind==="add"?1:0),0),[Be]),wt=T.useMemo(()=>Be.reduce((Bt,fn)=>Bt+(fn.kind==="remove"?1:0),0),[Be]),Pt=(Z==null?void 0:Z.added_lines)??0,$e=(Z==null?void 0:Z.removed_lines)??0,Tt=l!==null&&l===H,Et=async()=>{!Qe||mt===null||(await navigator.clipboard.writeText(mt),c(H),setTimeout(()=>c(null),2e3))},Ot=Bt=>{Y&&v({targetPath:Bt,leftContent:ke??"",rightContent:ge??""})},Gt=Bt=>{var In;if(ze.length===0)return;const fn=(et+Bt+ze.length)%ze.length;h(fn);const Ht=ze[fn].startRowIndex;(In=b.current[Ht])==null||In.scrollIntoView({behavior:"smooth",block:"center"})},an=Bt=>{if(Te.length===0)return;const fn=He<0?Bt===1?0:Te.length-1:(He+Bt+Te.length)%Te.length;if(fn===He)return;const Ht=Te[fn];Ot(Ht),s(Ht),r(In=>{const Nn=new Set(In??j);for(const bn of XC(Ht))Nn.add(bn);return Nn}),h(0),w.current=!0,S.current=Ht,setTimeout(()=>{var In;(In=_.current[Ht])==null||In.scrollIntoView({behavior:"smooth",block:"center"})},0)},On=()=>{if(Te.length===0)return;const Bt=Te[0];Ot(Bt),s(Bt),r(fn=>{const Ht=new Set(fn??j);for(const In of XC(Bt))Ht.add(In);return Ht}),h(0),w.current=!0,S.current=Bt,setTimeout(()=>{var fn;(fn=_.current[Bt])==null||fn.scrollIntoView({behavior:"smooth",block:"center"})},0)};return T.useEffect(()=>{E.current=a,a===null&&(w.current=!1,S.current=null)},[a]),T.useEffect(()=>{if(!Y||!a||!Q||E.current!==a||(E.current=null,Te.length===0))return;const Bt=Te[0];w.current=!0,S.current=Bt;const fn=window.setTimeout(()=>{var Ht;H!==Bt&&(v({targetPath:Bt,leftContent:ke??"",rightContent:ge??""}),s(Bt),r(In=>{const Nn=new Set(In??ED(U));for(const bn of XC(Bt))Nn.add(bn);return Nn})),h(0),(Ht=_.current[Bt])==null||Ht.scrollIntoView({behavior:"smooth",block:"center"})},0);return()=>window.clearTimeout(fn)},[Y,a,Q,Te,H,ke,ge,U]),T.useEffect(()=>{if(!Y||!H||!w.current||S.current!==null&&S.current!==H||!Ye||!dt)return;const Bt=ze.length>0?ze[0].startRowIndex:null,fn=requestAnimationFrame(()=>{var Ht;Bt!==null&&((Ht=b.current[Bt])==null||Ht.scrollIntoView({behavior:"smooth",block:"center"})),w.current=!1,S.current=null});return()=>cancelAnimationFrame(fn)},[Y,H,ze,Ye,dt]),p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[Y&&L&&p.jsxs("div",{className:"flex h-9 items-center gap-2 border-b px-3 text-xs",children:[p.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[p.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[p.jsx("span",{className:"truncate font-medium",children:L}),(P==null?void 0:P.created_at)&&p.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:W1(P.created_at)})]}),p.jsx(mle,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),p.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[p.jsx("span",{className:"truncate font-medium",children:D}),(N==null?void 0:N.created_at)&&p.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:W1(N.created_at)})]})]}),p.jsxs("div",{className:"ml-2 flex shrink-0 items-center gap-2 tabular-nums",children:[p.jsxs("span",{className:Rt("text-emerald-700 transition-opacity dark:text-emerald-400",B&&"opacity-70"),children:["+",Pt]}),p.jsxs("span",{className:Rt("text-red-500 transition-opacity dark:text-red-300",B&&"opacity-70"),children:["-",$e]})]}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 p-0 text-muted-foreground/70 hover:text-muted-foreground","aria-label":"Stop comparing code runs",onClick:()=>{o(null),v(null),h(0),w.current=!1,S.current=null},children:p.jsx(Ju,{className:"h-3.5 w-3.5"})})]}),p.jsx("div",{className:"min-h-0 flex-1",children:O&&!R?p.jsx("div",{className:"h-full min-h-0"}):W?p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[p.jsx("div",{className:"flex h-10 items-center border-b px-2",children:p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[p.jsx(OC,{className:"mr-1 h-3.5 w-3.5"}),"Back"]})}),p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load code tree."})]}):R!=null&&R.available?p.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden grid-cols-1 lg:grid-cols-[320px_minmax(0,1fr)]",children:[p.jsxs("div",{className:"flex min-h-0 flex-col border-b lg:border-b-0 lg:border-r",children:[p.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[p.jsx(OC,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),p.jsx(MD,{currentRunId:t,selectedCompareRunId:a,onSelectCompareRun:o,disabled:!H})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-2",children:Ae(U,0)})]}),p.jsxs("div",{className:"flex min-h-0 min-w-0 flex-col",children:[p.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-3",children:[p.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:H??"Select a file"}),H&&p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button",onClick:Et,disabled:!Qe,className:"inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40",title:Tt?"Copied!":"Copy code",children:Tt?p.jsx(bv,{className:"h-3.5 w-3.5"}):p.jsx(iT,{className:"h-3.5 w-3.5"})}),p.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:ie})]}),Y&&H&&p.jsxs("div",{className:"ml-1 flex shrink-0 items-center gap-2 text-[11px] tabular-nums",children:[p.jsxs("span",{className:"text-emerald-700 dark:text-emerald-400",children:["+",bt]}),p.jsxs("span",{className:"text-red-500 dark:text-red-300",children:["-",wt]})]})]}),p.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[p.jsx("div",{className:Rt("h-full overflow-auto",Y&&"pb-14"),children:H?Y?V&&!F?p.jsx("div",{className:"h-full"}):G?p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load compared run code."}):a&&!V&&F&&!F.available?p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Compared run has no downloaded code snapshot."}):qe?p.jsx("div",{className:"h-full"}):ne&&we&&!Re||re&&ye&&!oe?p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load one side of the comparison."}):ft||Le?p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Binary file comparison is not supported."}):p.jsx("div",{className:Rt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",Se&&"opacity-50"),children:Be.map((Bt,fn)=>{const Ht=Bt.kind==="add"?De[(Bt.rightLine??1)-1]??E0(Bt.text.length>0?Bt.text:" ",ie):We[(Bt.leftLine??1)-1]??E0(Bt.text.length>0?Bt.text:" ",ie);return p.jsxs("div",{ref:In=>{Bt.kind!=="context"&&(b.current[fn]=In)},className:Rt("flex",Bt.kind==="add"&&"bg-emerald-500/18",Bt.kind==="remove"&&"bg-red-400/10"),children:[p.jsxs("div",{className:Rt("sticky left-0 z-10 flex shrink-0 bg-background",Bt.kind==="add"&&"border-l-2 border-emerald-500/60",Bt.kind==="remove"&&"border-l-2 border-red-400/35"),children:[p.jsx("span",{className:Rt("select-none w-6 px-1.5 py-0.5 text-right text-[11px]",Bt.kind==="add"&&"bg-emerald-500/18 text-emerald-700 dark:text-emerald-400",Bt.kind==="remove"&&"bg-red-400/10 text-red-500 dark:text-red-300",Bt.kind==="context"&&"text-muted-foreground"),children:Bt.kind==="add"?"+":Bt.kind==="remove"?"-":" "}),p.jsx("span",{className:Rt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",Bt.kind==="add"&&"bg-emerald-500/18",Bt.kind==="remove"&&"bg-red-400/10"),children:Bt.leftLine??""}),p.jsx("span",{className:Rt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",Bt.kind==="add"&&"bg-emerald-500/18",Bt.kind==="remove"&&"bg-red-400/10"),children:Bt.rightLine??""})]}),p.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:Ht.map((In,Nn)=>p.jsx("span",{className:Rt(In.className),children:In.text},`diff-line-${fn}-token-${Nn}`))})]},`diff-line-${fn}`)})}):le&&!Oe?p.jsx("div",{className:"h-full"}):we&&!Oe?p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load file content."}):st?p.jsx("div",{className:Rt("p-4 text-sm text-muted-foreground transition-opacity",fe&&"opacity-50"),children:"Binary file preview is not supported."}):p.jsxs("div",{className:Rt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",fe&&"opacity-50"),children:[(Oe==null?void 0:Oe.truncated)&&p.jsx("div",{className:"border-b px-3 py-1 text-[11px] text-muted-foreground",children:"Showing first 2MB of this file."}),je.map((Bt,fn)=>p.jsxs("div",{className:"flex",children:[p.jsx("div",{className:"sticky left-0 z-10 flex shrink-0 bg-background",children:p.jsx("span",{className:"select-none border-r bg-muted/35 w-[3.25rem] px-2 py-0.5 text-right text-[11px] text-muted-foreground",children:fn+1})}),p.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:Bt.map((Ht,In)=>p.jsx("span",{className:Rt(Ht.className),children:Ht.text},`line-${fn}-token-${In}`))})]},`line-${fn}`))]}):p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Select a file on the left to view its source."})}),Y&&H&&p.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",children:ze.length===0?p.jsx("div",{className:"pointer-events-auto rounded-full border border-border/75 bg-background/90 px-2 py-1 backdrop-blur-sm",children:p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:On,disabled:Te.length===0,children:p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx("span",{children:"See Changes"}),p.jsx(f1,{className:"h-3.5 w-3.5"})]})})}):p.jsxs("div",{className:"pointer-events-auto flex items-center gap-3 rounded-full border border-border/75 bg-background/90 px-3 py-1 backdrop-blur-sm",children:[p.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Gt(-1),disabled:ze.length===0,children:p.jsx(h8,{className:"h-3.5 w-3.5"})}),p.jsxs("span",{className:"min-w-[4rem] text-center tabular-nums",children:[ht," / ",ze.length]}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Gt(1),disabled:ze.length===0,children:p.jsx(Vr,{className:"h-3.5 w-3.5"})})]}),p.jsx("div",{className:"h-4 w-px bg-border"}),p.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>an(-1),disabled:Te.length===0,children:p.jsx(f8,{className:"h-3.5 w-3.5"})}),p.jsxs("span",{className:"min-w-[6rem] text-center tabular-nums",children:[ct," / ",Te.length," files"]}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>an(1),disabled:Te.length===0,children:p.jsx(f1,{className:"h-3.5 w-3.5"})})]})]})})]})]})]}):p.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[p.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[p.jsx(OC,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),p.jsx(MD,{currentRunId:t,selectedCompareRunId:a,onSelectCompareRun:o,disabled:!H})]}),p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"This run does not have a local `code/source.zip` extracted yet."})]})})]})}function mm({description:t}){const e=ki(hG),n=zd(pG),r=zd(mG),{data:i,isLoading:s}=pm(),a=(i==null?void 0:i.runs)??[],o=i==null?void 0:i.discovery,l=(i==null?void 0:i.has_wandb_key)??e,c=a.length>0,d=(i==null?void 0:i.has_known_projects)??!1,h=(o==null?void 0:o.status)==="discovering",g=!s&&!h&&!l&&!c,v=!s&&!h&&!g&&l&&!c&&!d,b=!g&&!v&&!c;return h?p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsx($u,{className:"max-w-md w-full border-dashed",children:p.jsxs(yD,{className:"items-center text-center",children:[p.jsx(n4,{children:"Fetching runs from W&B…"}),p.jsxs(r4,{className:"flex items-center gap-1.5 font-medium",children:[p.jsx(ll,{className:"h-3 w-3 shrink-0"}),(o==null?void 0:o.runs_found)??0," found"]})]})})}):b?p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs yet"})}):p.jsx("div",{className:"flex h-full items-center justify-center p-8",children:p.jsx($u,{className:"max-w-md w-full border-dashed",children:p.jsx(yD,{className:"text-center items-center",children:g?p.jsxs(p.Fragment,{children:[p.jsx(n4,{children:"No wandb key added yet"}),p.jsx(r4,{children:"Add your W&B API key to discover and sync runs."}),p.jsx(Tn,{className:"mt-4 bg-green-600 hover:bg-green-700",onClick:()=>n(!0),children:"Add wandb key"})]}):v?p.jsxs(p.Fragment,{children:[p.jsx(n4,{children:"Add a project"}),p.jsx(r4,{children:"Add a W&B project to start discovering telescope-tagged runs."}),p.jsx(Tn,{className:"mt-4",onClick:()=>r(!0),children:"Add project"})]}):p.jsxs(p.Fragment,{children:[p.jsx(n4,{children:"No Run Selected"}),p.jsx(r4,{children:t})]})})})})}const Yfe=!0,lo="u-",Kfe="uplot",Zfe=lo+"hz",Qfe=lo+"vt",Jfe=lo+"title",ehe=lo+"wrap",the=lo+"under",nhe=lo+"over",rhe=lo+"axis",Ag=lo+"off",ihe=lo+"select",she=lo+"cursor-x",ahe=lo+"cursor-y",ohe=lo+"cursor-pt",lhe=lo+"legend",che=lo+"live",uhe=lo+"inline",dhe=lo+"series",fhe=lo+"marker",CD=lo+"label",hhe=lo+"value",m_="width",g_="height",Gb="top",AD="bottom",Tx="left",YC="right",D8="#000",ND=D8+"0",KC="mousemove",RD="mousedown",ZC="mouseup",kD="mouseenter",PD="mouseleave",ID="dblclick",phe="resize",mhe="scroll",DD="change",g2="dppxchange",O8="--",My=typeof window<"u",tR=My?document:null,v1=My?window:null,ghe=My?navigator:null;let Ni,i4;function nR(){let t=devicePixelRatio;Ni!=t&&(Ni=t,i4&&iR(DD,i4,nR),i4=matchMedia(`(min-resolution: ${Ni-.001}dppx) and (max-resolution: ${Ni+.001}dppx)`),$g(DD,i4,nR),v1.dispatchEvent(new CustomEvent(g2)))}function Gc(t,e){if(e!=null){let n=t.classList;!n.contains(e)&&n.add(e)}}function rR(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function As(t,e,n){t.style[e]=n+"px"}function Nd(t,e,n,r){let i=tR.createElement(t);return e!=null&&Gc(i,e),n!=null&&n.insertBefore(i,r),i}function Du(t,e){return Nd("div",t,e)}const OD=new WeakMap;function Ef(t,e,n,r,i){let s="translate("+e+"px,"+n+"px)",a=OD.get(t);s!=a&&(t.style.transform=s,OD.set(t,s),e<0||n<0||e>r||n>i?Gc(t,Ag):rR(t,Ag))}const LD=new WeakMap;function zD(t,e,n){let r=e+n,i=LD.get(t);r!=i&&(LD.set(t,r),t.style.background=e,t.style.borderColor=n)}const jD=new WeakMap;function FD(t,e,n,r){let i=e+""+n,s=jD.get(t);i!=s&&(jD.set(t,i),t.style.height=n+"px",t.style.width=e+"px",t.style.marginLeft=r?-e/2+"px":0,t.style.marginTop=r?-n/2+"px":0)}const L8={passive:!0},vhe={...L8,capture:!0};function $g(t,e,n,r){e.addEventListener(t,n,r?vhe:L8)}function iR(t,e,n,r){e.removeEventListener(t,n,L8)}My&&nR();function Id(t,e,n,r){let i;n=n||0,r=r||e.length-1;let s=r<=2147483647;for(;r-n>1;)i=s?n+r>>1:eu((n+r)/2),e[i]<t?n=i:r=i;return t-e[n]<=e[r]-t?n:r}function yW(t){return(n,r,i)=>{let s=-1,a=-1;for(let o=r;o<=i;o++)if(t(n[o])){s=o;break}for(let o=i;o>=r;o--)if(t(n[o])){a=o;break}return[s,a]}}const bW=t=>t!=null,_W=t=>t!=null&&t>0,_T=yW(bW),xhe=yW(_W);function yhe(t,e,n,r=0,i=!1){let s=i?xhe:_T,a=i?_W:bW;[e,n]=s(t,e,n);let o=t[e],l=t[e];if(e>-1)if(r==1)o=t[e],l=t[n];else if(r==-1)o=t[n],l=t[e];else for(let c=e;c<=n;c++){let d=t[c];a(d)&&(d<o?o=d:d>l&&(l=d))}return[o??ts,l??-ts]}function ST(t,e,n,r){let i=HD(t),s=HD(e);t==e&&(i==-1?(t*=n,e/=n):(t/=n,e*=n));let a=n==10?ap:SW,o=i==1?eu:Fu,l=s==1?Fu:eu,c=o(a(no(t))),d=l(a(no(e))),h=X1(n,c),g=X1(n,d);return n==10&&(c<0&&(h=ns(h,-c)),d<0&&(g=ns(g,-d))),r||n==2?(t=h*i,e=g*s):(t=EW(t,h),e=wT(e,g)),[t,e]}function z8(t,e,n,r){let i=ST(t,e,n,r);return t==0&&(i[0]=0),e==0&&(i[1]=0),i}const j8=.1,UD={mode:3,pad:j8},A_={pad:0,soft:null,mode:0},bhe={min:A_,max:A_};function v2(t,e,n,r){return MT(n)?BD(t,e,n):(A_.pad=n,A_.soft=r?0:null,A_.mode=r?3:0,BD(t,e,bhe))}function wi(t,e){return t??e}function _he(t,e,n){for(e=wi(e,0),n=wi(n,t.length-1);e<=n;){if(t[e]!=null)return!0;e++}return!1}function BD(t,e,n){let r=n.min,i=n.max,s=wi(r.pad,0),a=wi(i.pad,0),o=wi(r.hard,-ts),l=wi(i.hard,ts),c=wi(r.soft,ts),d=wi(i.soft,-ts),h=wi(r.mode,0),g=wi(i.mode,0),v=e-t,b=ap(v),_=Fl(no(t),no(e)),w=ap(_),S=no(w-b);(v<1e-24||S>10)&&(v=0,(t==0||e==0)&&(v=1e-24,h==2&&c!=ts&&(s=0),g==2&&d!=-ts&&(a=0)));let E=v||_||1e3,A=ap(E),N=X1(10,eu(A)),D=E*(v==0?t==0?.1:1:s),P=ns(EW(t-D,N/10),24),L=t>=c&&(h==1||h==3&&P<=c||h==2&&P>=c)?c:ts,R=Fl(o,P<L&&t>=L?L:Od(L,P)),O=E*(v==0?e==0?.1:1:a),W=ns(wT(e+O,N/10),24),F=e<=d&&(g==1||g==3&&W>=d||g==2&&W<=d)?d:-ts,V=Od(l,W>F&&e<=F?F:Fl(F,W));return R==V&&R==0&&(V=100),[R,V]}const She=new Intl.NumberFormat(My?ghe.language:"en-US"),F8=t=>She.format(t),lu=Math,LM=lu.PI,no=lu.abs,eu=lu.floor,to=lu.round,Fu=lu.ceil,Od=lu.min,Fl=lu.max,X1=lu.pow,HD=lu.sign,ap=lu.log10,SW=lu.log2,whe=(t,e=1)=>lu.sinh(t)*e,QC=(t,e=1)=>lu.asinh(t/e),ts=1/0;function VD(t){return(ap((t^t>>31)-(t>>31))|0)+1}function sR(t,e,n){return Od(Fl(t,e),n)}function wW(t){return typeof t=="function"}function ri(t){return wW(t)?t:()=>t}const Mhe=()=>{},MW=t=>t,TW=(t,e)=>e,The=t=>null,GD=t=>!0,WD=(t,e)=>t==e,Ehe=/\.\d*?(?=9{6,}|0{6,})/gm,av=t=>{if(AW(t)||Q0.has(t))return t;const e=`${t}`,n=e.match(Ehe);if(n==null)return t;let r=n[0].length-1;if(e.indexOf("e-")!=-1){let[i,s]=e.split("e");return+`${av(i)}e${s}`}return ns(t,r)};function wg(t,e){return av(ns(av(t/e))*e)}function wT(t,e){return av(Fu(av(t/e))*e)}function EW(t,e){return av(eu(av(t/e))*e)}function ns(t,e=0){if(AW(t))return t;let n=10**e,r=t*n*(1+Number.EPSILON);return to(r)/n}const Q0=new Map;function CW(t){return((""+t).split(".")[1]||"").length}function fS(t,e,n,r){let i=[],s=r.map(CW);for(let a=e;a<n;a++){let o=no(a),l=ns(X1(t,a),o);for(let c=0;c<r.length;c++){let d=t==10?+`${r[c]}e${a}`:r[c]*l,h=(a>=0?0:o)+(a>=s[c]?0:s[c]),g=t==10?d:ns(d,h);i.push(g),Q0.set(g,h)}}return i}const N_={},U8=[],Y1=[null,null],C0=Array.isArray,AW=Number.isInteger,Che=t=>t===void 0;function $D(t){return typeof t=="string"}function MT(t){let e=!1;if(t!=null){let n=t.constructor;e=n==null||n==Object}return e}function Ahe(t){return t!=null&&typeof t=="object"}const Nhe=Object.getPrototypeOf(Uint8Array),NW="__proto__";function K1(t,e=MT){let n;if(C0(t)){let r=t.find(i=>i!=null);if(C0(r)||e(r)){n=Array(t.length);for(let i=0;i<t.length;i++)n[i]=K1(t[i],e)}else n=t.slice()}else if(t instanceof Nhe)n=t.slice();else if(e(t)){n={};for(let r in t)r!=NW&&(n[r]=K1(t[r],e))}else n=t;return n}function Ua(t){let e=arguments;for(let n=1;n<e.length;n++){let r=e[n];for(let i in r)i!=NW&&(MT(t[i])?Ua(t[i],K1(r[i])):t[i]=K1(r[i]))}return t}const Rhe=0,khe=1,Phe=2;function Ihe(t,e,n){for(let r=0,i,s=-1;r<e.length;r++){let a=e[r];if(a>s){for(i=a-1;i>=0&&t[i]==null;)t[i--]=null;for(i=a+1;i<n&&t[i]==null;)t[s=i++]=null}}}function Dhe(t,e){if(zhe(t)){let a=t[0].slice();for(let o=1;o<t.length;o++)a.push(...t[o].slice(1));return jhe(a[0])||(a=Lhe(a)),a}let n=new Set;for(let a=0;a<t.length;a++){let l=t[a][0],c=l.length;for(let d=0;d<c;d++)n.add(l[d])}let r=[Array.from(n).sort((a,o)=>a-o)],i=r[0].length,s=new Map;for(let a=0;a<i;a++)s.set(r[0][a],a);for(let a=0;a<t.length;a++){let o=t[a],l=o[0];for(let c=1;c<o.length;c++){let d=o[c],h=Array(i).fill(void 0),g=e?e[a][c]:khe,v=[];for(let b=0;b<d.length;b++){let _=d[b],w=s.get(l[b]);_===null?g!=Rhe&&(h[w]=_,g==Phe&&v.push(w)):h[w]=_}Ihe(h,v,i),r.push(h)}}return r}const Ohe=typeof queueMicrotask>"u"?t=>Promise.resolve().then(t):queueMicrotask;function Lhe(t){let e=t[0],n=e.length,r=Array(n);for(let s=0;s<r.length;s++)r[s]=s;r.sort((s,a)=>e[s]-e[a]);let i=[];for(let s=0;s<t.length;s++){let a=t[s],o=Array(n);for(let l=0;l<n;l++)o[l]=a[r[l]];i.push(o)}return i}function zhe(t){let e=t[0][0],n=e.length;for(let r=1;r<t.length;r++){let i=t[r][0];if(i.length!=n)return!1;if(i!=e){for(let s=0;s<n;s++)if(i[s]!=e[s])return!1}}return!0}function jhe(t,e=100){const n=t.length;if(n<=1)return!0;let r=0,i=n-1;for(;r<=i&&t[r]==null;)r++;for(;i>=r&&t[i]==null;)i--;if(i<=r)return!0;const s=Fl(1,eu((i-r+1)/e));for(let a=t[r],o=r+s;o<=i;o+=s){const l=t[o];if(l!=null){if(l<=a)return!1;a=l}}return!0}const RW=["January","February","March","April","May","June","July","August","September","October","November","December"],kW=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function PW(t){return t.slice(0,3)}const Fhe=kW.map(PW),Uhe=RW.map(PW),Bhe={MMMM:RW,MMM:Uhe,WWWW:kW,WWW:Fhe};function Wb(t){return(t<10?"0":"")+t}function Hhe(t){return(t<10?"00":t<100?"0":"")+t}const Vhe={YYYY:t=>t.getFullYear(),YY:t=>(t.getFullYear()+"").slice(2),MMMM:(t,e)=>e.MMMM[t.getMonth()],MMM:(t,e)=>e.MMM[t.getMonth()],MM:t=>Wb(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>Wb(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>Wb(t.getHours()),H:t=>t.getHours(),h:t=>{let e=t.getHours();return e==0?12:e>12?e-12:e},AA:t=>t.getHours()>=12?"PM":"AM",aa:t=>t.getHours()>=12?"pm":"am",a:t=>t.getHours()>=12?"p":"a",mm:t=>Wb(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>Wb(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>Hhe(t.getMilliseconds())};function B8(t,e){e=e||Bhe;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(t);)n.push(i[0][0]=="{"?Vhe[i[1]]:i[0]);return s=>{let a="";for(let o=0;o<n.length;o++)a+=typeof n[o]=="string"?n[o]:n[o](s,e);return a}}const Ghe=new Intl.DateTimeFormat().resolvedOptions().timeZone;function Whe(t,e){let n;return e=="UTC"||e=="Etc/UTC"?n=new Date(+t+t.getTimezoneOffset()*6e4):e==Ghe?n=t:(n=new Date(t.toLocaleString("en-US",{timeZone:e})),n.setMilliseconds(t.getMilliseconds())),n}const IW=t=>t%1==0,x2=[1,2,2.5,5],$he=fS(10,-32,0,x2),DW=fS(10,0,32,x2),qhe=DW.filter(IW),Mg=$he.concat(DW),H8=`
`,OW="{YYYY}",qD=H8+OW,LW="{M}/{D}",v_=H8+LW,s4=v_+"/{YY}",zW="{aa}",Xhe="{h}:{mm}",e1=Xhe+zW,XD=H8+e1,YD=":{ss}",zi=null;function jW(t){let e=t*1e3,n=e*60,r=n*60,i=r*24,s=i*30,a=i*365,l=(t==1?fS(10,0,3,x2).filter(IW):fS(10,-3,0,x2)).concat([e,e*5,e*10,e*15,e*30,n,n*5,n*10,n*15,n*30,r,r*2,r*3,r*4,r*6,r*8,r*12,i,i*2,i*3,i*4,i*5,i*6,i*7,i*8,i*9,i*10,i*15,s,s*2,s*3,s*4,s*6,a,a*2,a*5,a*10,a*25,a*50,a*100]);const c=[[a,OW,zi,zi,zi,zi,zi,zi,1],[i*28,"{MMM}",qD,zi,zi,zi,zi,zi,1],[i,LW,qD,zi,zi,zi,zi,zi,1],[r,"{h}"+zW,s4,zi,v_,zi,zi,zi,1],[n,e1,s4,zi,v_,zi,zi,zi,1],[e,YD,s4+" "+e1,zi,v_+" "+e1,zi,XD,zi,1],[t,YD+".{fff}",s4+" "+e1,zi,v_+" "+e1,zi,XD,zi,1]];function d(h){return(g,v,b,_,w,S)=>{let E=[],A=w>=a,N=w>=s&&w<a,D=h(b),P=ns(D*t,3),L=JC(D.getFullYear(),A?0:D.getMonth(),N||A?1:D.getDate()),R=ns(L*t,3);if(N||A){let O=N?w/s:0,W=A?w/a:0,F=P==R?P:ns(JC(L.getFullYear()+W,L.getMonth()+O,1)*t,3),V=new Date(to(F/t)),G=V.getFullYear(),Z=V.getMonth();for(let B=0;F<=_;B++){let q=JC(G+W*B,Z+O*B,1),K=q-h(ns(q*t,3));F=ns((+q+K)*t,3),F<=_&&E.push(F)}}else{let O=w>=i?i:w,W=eu(b)-eu(P),F=R+W+wT(P-R,O);E.push(F);let V=h(F),G=V.getHours()+V.getMinutes()/n+V.getSeconds()/r,Z=w/r,B=g.axes[v]._space,q=S/B;for(;F=ns(F+w,t==1?0:3),!(F>_);)if(Z>1){let K=eu(ns(G+Z,6))%24,U=h(F).getHours()-K;U>1&&(U=-1),F-=U*r,G=(G+Z)%24;let j=E[E.length-1];ns((F-j)/w,3)*q>=.7&&E.push(F)}else E.push(F)}return E}}return[l,c,d]}const[Yhe,Khe,Zhe]=jW(1),[Qhe,Jhe,epe]=jW(.001);fS(2,-53,53,[1]);function KD(t,e){return t.map(n=>n.map((r,i)=>i==0||i==8||r==null?r:e(i==1||n[8]==0?r:n[1]+r)))}function ZD(t,e){return(n,r,i,s,a)=>{let o=e.find(b=>a>=b[0])||e[e.length-1],l,c,d,h,g,v;return r.map(b=>{let _=t(b),w=_.getFullYear(),S=_.getMonth(),E=_.getDate(),A=_.getHours(),N=_.getMinutes(),D=_.getSeconds(),P=w!=l&&o[2]||S!=c&&o[3]||E!=d&&o[4]||A!=h&&o[5]||N!=g&&o[6]||D!=v&&o[7]||o[1];return l=w,c=S,d=E,h=A,g=N,v=D,P(_)})}}function tpe(t,e){let n=B8(e);return(r,i,s,a,o)=>i.map(l=>n(t(l)))}function JC(t,e,n){return new Date(t,e,n)}function QD(t,e){return e(t)}const npe="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function JD(t,e){return(n,r,i,s)=>s==null?O8:e(t(r))}function rpe(t,e){let n=t.series[e];return n.width?n.stroke(t,e):n.points.width?n.points.stroke(t,e):null}function ipe(t,e){return t.series[e].fill(t,e)}const spe={show:!0,live:!0,isolate:!1,mount:Mhe,markers:{show:!0,width:2,stroke:rpe,fill:ipe,dash:"solid"},idx:null,idxs:null,values:[]};function ape(t,e){let n=t.cursor.points,r=Du(),i=n.size(t,e);As(r,m_,i),As(r,g_,i);let s=i/-2;As(r,"marginLeft",s),As(r,"marginTop",s);let a=n.width(t,e,i);return a&&As(r,"borderWidth",a),r}function ope(t,e){let n=t.series[e].points;return n._fill||n._stroke}function lpe(t,e){let n=t.series[e].points;return n._stroke||n._fill}function cpe(t,e){return t.series[e].points.size}const eA=[0,0];function upe(t,e,n){return eA[0]=e,eA[1]=n,eA}function a4(t,e,n,r=!0){return i=>{i.button==0&&(!r||i.target==e)&&n(i)}}function tA(t,e,n,r=!0){return i=>{(!r||i.target==e)&&n(i)}}const dpe={show:!0,x:!0,y:!0,lock:!1,move:upe,points:{one:!1,show:ape,size:cpe,width:0,stroke:lpe,fill:ope},bind:{mousedown:a4,mouseup:a4,click:a4,dblclick:a4,mousemove:tA,mouseleave:tA,mouseenter:tA},drag:{setScale:!0,x:!0,y:!1,dist:0,uni:null,click:(t,e)=>{e.stopPropagation(),e.stopImmediatePropagation()},_x:!1,_y:!1},focus:{dist:(t,e,n,r,i)=>r-i,prox:-1,bias:0},hover:{skip:[void 0],prox:null,bias:0},left:-10,top:-10,idx:null,dataIdx:null,idxs:null,event:null},FW={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},V8=Ua({},FW,{filter:TW}),UW=Ua({},V8,{size:10}),BW=Ua({},FW,{show:!1}),G8='12px system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"',HW="bold "+G8,VW=1.5,eO={show:!0,scale:"x",stroke:D8,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:HW,side:2,grid:V8,ticks:UW,border:BW,font:G8,lineGap:VW,rotate:0},fpe="Value",hpe="Time",tO={show:!0,scale:"x",auto:!1,sorted:1,min:ts,max:-ts,idxs:[]};function ppe(t,e,n,r,i){return e.map(s=>s==null?"":F8(s))}function mpe(t,e,n,r,i,s,a){let o=[],l=Q0.get(i)||0;n=a?n:ns(wT(n,i),l);for(let c=n;c<=r;c=ns(c+i,l))o.push(Object.is(c,-0)?0:c);return o}function aR(t,e,n,r,i,s,a){const o=[],l=t.scales[t.axes[e].scale].log,c=l==10?ap:SW,d=eu(c(n));i=X1(l,d),l==10&&(i=Mg[Id(i,Mg)]);let h=n,g=i*l;l==10&&(g=Mg[Id(g,Mg)]);do o.push(h),h=h+i,l==10&&!Q0.has(h)&&(h=ns(h,Q0.get(i))),h>=g&&(i=h,g=i*l,l==10&&(g=Mg[Id(g,Mg)]));while(h<=r);return o}function gpe(t,e,n,r,i,s,a){let l=t.scales[t.axes[e].scale].asinh,c=r>l?aR(t,e,Fl(l,n),r,i):[l],d=r>=0&&n<=0?[0]:[];return(n<-l?aR(t,e,Fl(l,-r),-n,i):[l]).reverse().map(g=>-g).concat(d,c)}const GW=/./,vpe=/[12357]/,xpe=/[125]/,nO=/1/,oR=(t,e,n,r)=>t.map((i,s)=>e==4&&i==0||s%r==0&&n.test(i.toExponential()[i<0?1:0])?i:null);function ype(t,e,n,r,i){let s=t.axes[n],a=s.scale,o=t.scales[a],l=t.valToPos,c=s._space,d=l(10,a),h=l(9,a)-d>=c?GW:l(7,a)-d>=c?vpe:l(5,a)-d>=c?xpe:nO;if(h==nO){let g=no(l(1,a)-d);if(g<c)return oR(e.slice().reverse(),o.distr,h,Fu(c/g)).reverse()}return oR(e,o.distr,h,1)}function bpe(t,e,n,r,i){let s=t.axes[n],a=s.scale,o=s._space,l=t.valToPos,c=no(l(1,a)-l(2,a));return c<o?oR(e.slice().reverse(),3,GW,Fu(o/c)).reverse():e}function _pe(t,e,n,r){return r==null?O8:e==null?"":F8(e)}const rO={show:!0,scale:"y",stroke:D8,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:HW,side:3,grid:V8,ticks:UW,border:BW,font:G8,lineGap:VW,rotate:0};function Spe(t,e){let n=3+(t||1)*2;return ns(n*e,3)}function wpe(t,e){let{scale:n,idxs:r}=t.series[0],i=t._data[0],s=t.valToPos(i[r[0]],n,!0),a=t.valToPos(i[r[1]],n,!0),o=no(a-s),l=t.series[e],c=o/(l.points.space*Ni);return r[1]-r[0]<=c}const iO={scale:null,auto:!0,sorted:0,min:ts,max:-ts},WW=(t,e,n,r,i)=>i,sO={show:!0,auto:!0,sorted:0,gaps:WW,alpha:1,facets:[Ua({},iO,{scale:"x"}),Ua({},iO,{scale:"y"})]},aO={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:WW,alpha:1,points:{show:wpe,filter:null},values:null,min:ts,max:-ts,idxs:[],path:null,clip:null};function Mpe(t,e,n,r,i){return n/10}const $W={time:Yfe,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},Tpe=Ua({},$W,{time:!1,ori:1}),oO={};function qW(t,e){let n=oO[t];return n||(n={key:t,plots:[],sub(r){n.plots.push(r)},unsub(r){n.plots=n.plots.filter(i=>i!=r)},pub(r,i,s,a,o,l,c){for(let d=0;d<n.plots.length;d++)n.plots[d]!=i&&n.plots[d].pub(r,i,s,a,o,l,c)}},t!=null&&(oO[t]=n)),n}const Z1=1,lR=2;function Sv(t,e,n){const r=t.mode,i=t.series[e],s=r==2?t._data[e]:t._data,a=t.scales,o=t.bbox;let l=s[0],c=r==2?s[1]:s[e],d=r==2?a[i.facets[0].scale]:a[t.series[0].scale],h=r==2?a[i.facets[1].scale]:a[i.scale],g=o.left,v=o.top,b=o.width,_=o.height,w=t.valToPosH,S=t.valToPosV;return d.ori==0?n(i,l,c,d,h,w,S,g,v,b,_,ET,Ty,AT,YW,ZW):n(i,l,c,d,h,S,w,v,g,_,b,CT,Ey,q8,KW,QW)}function W8(t,e){let n=0,r=0,i=wi(t.bands,U8);for(let s=0;s<i.length;s++){let a=i[s];a.series[0]==e?n=a.dir:a.series[1]==e&&(a.dir==1?r|=1:r|=2)}return[n,r==1?-1:r==2?1:r==3?2:0]}function Epe(t,e,n,r,i){let s=t.mode,a=t.series[e],o=s==2?a.facets[1].scale:a.scale,l=t.scales[o];return i==-1?l.min:i==1?l.max:l.distr==3?l.dir==1?l.min:l.max:0}function op(t,e,n,r,i,s){return Sv(t,e,(a,o,l,c,d,h,g,v,b,_,w)=>{let S=a.pxRound;const E=c.dir*(c.ori==0?1:-1),A=c.ori==0?Ty:Ey;let N,D;E==1?(N=n,D=r):(N=r,D=n);let P=S(h(o[N],c,_,v)),L=S(g(l[N],d,w,b)),R=S(h(o[D],c,_,v)),O=S(g(s==1?d.max:d.min,d,w,b)),W=new Path2D(i);return A(W,R,O),A(W,P,O),A(W,P,L),W})}function TT(t,e,n,r,i,s){let a=null;if(t.length>0){a=new Path2D;const o=e==0?AT:q8;let l=n;for(let h=0;h<t.length;h++){let g=t[h];if(g[1]>g[0]){let v=g[0]-l;v>0&&o(a,l,r,v,r+s),l=g[1]}}let c=n+i-l,d=10;c>0&&o(a,l,r-d/2,c,r+s+d)}return a}function Cpe(t,e,n){let r=t[t.length-1];r&&r[0]==e?r[1]=n:t.push([e,n])}function $8(t,e,n,r,i,s,a){let o=[],l=t.length;for(let c=i==1?n:r;c>=n&&c<=r;c+=i)if(e[c]===null){let h=c,g=c;if(i==1)for(;++c<=r&&e[c]===null;)g=c;else for(;--c>=n&&e[c]===null;)g=c;let v=s(t[h]),b=g==h?v:s(t[g]),_=h-i;v=a<=0&&_>=0&&_<l?s(t[_]):v;let S=g+i;b=a>=0&&S>=0&&S<l?s(t[S]):b,b>=v&&o.push([v,b])}return o}function lO(t){return t==0?MW:t==1?to:e=>wg(e,t)}function XW(t){let e=t==0?ET:CT,n=t==0?(i,s,a,o,l,c)=>{i.arcTo(s,a,o,l,c)}:(i,s,a,o,l,c)=>{i.arcTo(a,s,l,o,c)},r=t==0?(i,s,a,o,l)=>{i.rect(s,a,o,l)}:(i,s,a,o,l)=>{i.rect(a,s,l,o)};return(i,s,a,o,l,c=0,d=0)=>{c==0&&d==0?r(i,s,a,o,l):(c=Od(c,o/2,l/2),d=Od(d,o/2,l/2),e(i,s+c,a),n(i,s+o,a,s+o,a+l,c),n(i,s+o,a+l,s,a+l,d),n(i,s,a+l,s,a,d),n(i,s,a,s+o,a,c),i.closePath())}}const ET=(t,e,n)=>{t.moveTo(e,n)},CT=(t,e,n)=>{t.moveTo(n,e)},Ty=(t,e,n)=>{t.lineTo(e,n)},Ey=(t,e,n)=>{t.lineTo(n,e)},AT=XW(0),q8=XW(1),YW=(t,e,n,r,i,s)=>{t.arc(e,n,r,i,s)},KW=(t,e,n,r,i,s)=>{t.arc(n,e,r,i,s)},ZW=(t,e,n,r,i,s,a)=>{t.bezierCurveTo(e,n,r,i,s,a)},QW=(t,e,n,r,i,s,a)=>{t.bezierCurveTo(n,e,i,r,a,s)};function JW(t){return(e,n,r,i,s)=>Sv(e,n,(a,o,l,c,d,h,g,v,b,_,w)=>{let{pxRound:S,points:E}=a,A,N;c.ori==0?(A=ET,N=YW):(A=CT,N=KW);const D=ns(E.width*Ni,3);let P=(E.size-E.width)/2*Ni,L=ns(P*2,3),R=new Path2D,O=new Path2D,{left:W,top:F,width:V,height:G}=e.bbox;AT(O,W-L,F-L,V+L*2,G+L*2);const Z=B=>{if(l[B]!=null){let q=S(h(o[B],c,_,v)),K=S(g(l[B],d,w,b));A(R,q+P,K),N(R,q,K,P,0,LM*2)}};if(s)s.forEach(Z);else for(let B=r;B<=i;B++)Z(B);return{stroke:D>0?R:null,fill:R,clip:O,flags:Z1|lR}})}function e$(t){return(e,n,r,i,s,a)=>{r!=i&&(s!=r&&a!=r&&t(e,n,r),s!=i&&a!=i&&t(e,n,i),t(e,n,a))}}const Ape=e$(Ty),Npe=e$(Ey);function t$(t){const e=wi(t==null?void 0:t.alignGaps,0);return(n,r,i,s)=>Sv(n,r,(a,o,l,c,d,h,g,v,b,_,w)=>{[i,s]=_T(l,i,s);let S=a.pxRound,E=G=>S(h(G,c,_,v)),A=G=>S(g(G,d,w,b)),N,D;c.ori==0?(N=Ty,D=Ape):(N=Ey,D=Npe);const P=c.dir*(c.ori==0?1:-1),L={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Z1},R=L.stroke;let O=!1;if(s-i>=_*4){let G=H=>n.posToVal(H,c.key,!0),Z=null,B=null,q,K,Y,Q=E(o[P==1?i:s]),U=E(o[i]),j=E(o[s]),X=G(P==1?U+1:j-1);for(let H=P==1?i:s;H>=i&&H<=s;H+=P){let ie=o[H],re=(P==1?ie<X:ie>X)?Q:E(ie),ue=l[H];re==Q?ue!=null?(K=ue,Z==null?(N(R,re,A(K)),q=Z=B=K):K<Z?Z=K:K>B&&(B=K)):ue===null&&(O=!0):(Z!=null&&D(R,Q,A(Z),A(B),A(q),A(K)),ue!=null?(K=ue,N(R,re,A(K)),Z=B=q=K):(Z=B=null,ue===null&&(O=!0)),Q=re,X=G(Q+P))}Z!=null&&Z!=B&&Y!=Q&&D(R,Q,A(Z),A(B),A(q),A(K))}else for(let G=P==1?i:s;G>=i&&G<=s;G+=P){let Z=l[G];Z===null?O=!0:Z!=null&&N(R,E(o[G]),A(Z))}let[F,V]=W8(n,r);if(a.fill!=null||F!=0){let G=L.fill=new Path2D(R),Z=a.fillTo(n,r,a.min,a.max,F),B=A(Z),q=E(o[i]),K=E(o[s]);P==-1&&([K,q]=[q,K]),N(G,K,B),N(G,q,B)}if(!a.spanGaps){let G=[];O&&G.push(...$8(o,l,i,s,P,E,e)),L.gaps=G=a.gaps(n,r,i,s,G),L.clip=TT(G,c.ori,v,b,_,w)}return V!=0&&(L.band=V==2?[op(n,r,i,s,R,-1),op(n,r,i,s,R,1)]:op(n,r,i,s,R,V)),L})}function Rpe(t){const e=wi(t.align,1),n=wi(t.ascDesc,!1),r=wi(t.alignGaps,0),i=wi(t.extend,!1);return(s,a,o,l)=>Sv(s,a,(c,d,h,g,v,b,_,w,S,E,A)=>{[o,l]=_T(h,o,l);let N=c.pxRound,{left:D,width:P}=s.bbox,L=U=>N(b(U,g,E,w)),R=U=>N(_(U,v,A,S)),O=g.ori==0?Ty:Ey;const W={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:Z1},F=W.stroke,V=g.dir*(g.ori==0?1:-1);let G=R(h[V==1?o:l]),Z=L(d[V==1?o:l]),B=Z,q=Z;i&&e==-1&&(q=D,O(F,q,G)),O(F,Z,G);for(let U=V==1?o:l;U>=o&&U<=l;U+=V){let j=h[U];if(j==null)continue;let X=L(d[U]),H=R(j);e==1?O(F,X,G):O(F,B,H),O(F,X,H),G=H,B=X}let K=B;i&&e==1&&(K=D+P,O(F,K,G));let[Y,Q]=W8(s,a);if(c.fill!=null||Y!=0){let U=W.fill=new Path2D(F),j=c.fillTo(s,a,c.min,c.max,Y),X=R(j);O(U,K,X),O(U,q,X)}if(!c.spanGaps){let U=[];U.push(...$8(d,h,o,l,V,L,r));let j=c.width*Ni/2,X=n||e==1?j:-j,H=n||e==-1?-j:j;U.forEach(ie=>{ie[0]+=X,ie[1]+=H}),W.gaps=U=c.gaps(s,a,o,l,U),W.clip=TT(U,g.ori,w,S,E,A)}return Q!=0&&(W.band=Q==2?[op(s,a,o,l,F,-1),op(s,a,o,l,F,1)]:op(s,a,o,l,F,Q)),W})}function cO(t,e,n,r,i,s,a=ts){if(t.length>1){let o=null;for(let l=0,c=1/0;l<t.length;l++)if(e[l]!==void 0){if(o!=null){let d=no(t[l]-t[o]);d<c&&(c=d,a=no(n(t[l],r,i,s)-n(t[o],r,i,s)))}o=l}}return a}function kpe(t){t=t||N_;const e=wi(t.size,[.6,ts,1]),n=t.align||0,r=t.gap||0;let i=t.radius;i=i==null?[0,0]:typeof i=="number"?[i,0]:i;const s=ri(i),a=1-e[0],o=wi(e[1],ts),l=wi(e[2],1),c=wi(t.disp,N_),d=wi(t.each,v=>{}),{fill:h,stroke:g}=c;return(v,b,_,w)=>Sv(v,b,(S,E,A,N,D,P,L,R,O,W,F)=>{let V=S.pxRound,G=n,Z=r*Ni,B=o*Ni,q=l*Ni,K,Y;N.ori==0?[K,Y]=s(v,b):[Y,K]=s(v,b);const Q=N.dir*(N.ori==0?1:-1);let U=N.ori==0?AT:q8,j=N.ori==0?d:(be,me,ge,ke,Xe,Ae,je)=>{d(be,me,ge,Xe,ke,je,Ae)},X=wi(v.bands,U8).find(be=>be.series[0]==b),H=X!=null?X.dir:0,ie=S.fillTo(v,b,S.min,S.max,H),ne=V(L(ie,D,F,O)),re,ue,le,fe=W,we=V(S.width*Ni),pe=!1,xe=null,Ve=null,ye=null,Oe=null;h!=null&&(we==0||g!=null)&&(pe=!0,xe=h.values(v,b,_,w),Ve=new Map,new Set(xe).forEach(be=>{be!=null&&Ve.set(be,new Path2D)}),we>0&&(ye=g.values(v,b,_,w),Oe=new Map,new Set(ye).forEach(be=>{be!=null&&Oe.set(be,new Path2D)})));let{x0:he,size:Re}=c;if(he!=null&&Re!=null){G=1,E=he.values(v,b,_,w),he.unit==2&&(E=E.map(ge=>v.posToVal(R+ge*W,N.key,!0)));let be=Re.values(v,b,_,w);Re.unit==2?ue=be[0]*W:ue=P(be[0],N,W,R)-P(0,N,W,R),fe=cO(E,A,P,N,W,R,fe),le=fe-ue+Z}else fe=cO(E,A,P,N,W,R,fe),le=fe*a+Z,ue=fe-le;le<1&&(le=0),we>=ue/2&&(we=0),le<5&&(V=MW);let oe=le>0,Ue=fe-le-(oe?we:0);ue=V(sR(Ue,q,B)),re=(G==0?ue/2:G==Q?0:ue)-G*Q*((G==0?Z/2:0)+(oe?we/2:0));const Ee={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},Pe=pe?null:new Path2D;let Ze=null;if(X!=null)Ze=v.data[X.series[1]];else{let{y0:be,y1:me}=c;be!=null&&me!=null&&(A=me.values(v,b,_,w),Ze=be.values(v,b,_,w))}let ae=K*ue,te=Y*ue;for(let be=Q==1?_:w;be>=_&&be<=w;be+=Q){let me=A[be];if(me==null)continue;if(Ze!=null){let Be=Ze[be]??0;if(me-Be==0)continue;ne=L(Be,D,F,O)}let ge=N.distr!=2||c!=null?E[be]:be,ke=P(ge,N,W,R),Xe=L(wi(me,ie),D,F,O),Ae=V(ke-re),je=V(Fl(Xe,ne)),We=V(Od(Xe,ne)),De=je-We;if(me!=null){let Be=me<0?te:ae,qe=me<0?ae:te;pe?(we>0&&ye[be]!=null&&U(Oe.get(ye[be]),Ae,We+eu(we/2),ue,Fl(0,De-we),Be,qe),xe[be]!=null&&U(Ve.get(xe[be]),Ae,We+eu(we/2),ue,Fl(0,De-we),Be,qe)):U(Pe,Ae,We+eu(we/2),ue,Fl(0,De-we),Be,qe),j(v,b,be,Ae-we/2,We,ue+we,De)}}return we>0?Ee.stroke=pe?Oe:Pe:pe||(Ee._fill=S.width==0?S._fill:S._stroke??S._fill,Ee.width=0),Ee.fill=pe?Ve:Pe,Ee})}function Ppe(t,e){const n=wi(e==null?void 0:e.alignGaps,0);return(r,i,s,a)=>Sv(r,i,(o,l,c,d,h,g,v,b,_,w,S)=>{[s,a]=_T(c,s,a);let E=o.pxRound,A=K=>E(g(K,d,w,b)),N=K=>E(v(K,h,S,_)),D,P,L;d.ori==0?(D=ET,L=Ty,P=ZW):(D=CT,L=Ey,P=QW);const R=d.dir*(d.ori==0?1:-1);let O=A(l[R==1?s:a]),W=O,F=[],V=[];for(let K=R==1?s:a;K>=s&&K<=a;K+=R)if(c[K]!=null){let Q=l[K],U=A(Q);F.push(W=U),V.push(N(c[K]))}const G={stroke:t(F,V,D,L,P,E),fill:null,clip:null,band:null,gaps:null,flags:Z1},Z=G.stroke;let[B,q]=W8(r,i);if(o.fill!=null||B!=0){let K=G.fill=new Path2D(Z),Y=o.fillTo(r,i,o.min,o.max,B),Q=N(Y);L(K,W,Q),L(K,O,Q)}if(!o.spanGaps){let K=[];K.push(...$8(l,c,s,a,R,A,n)),G.gaps=K=o.gaps(r,i,s,a,K),G.clip=TT(K,d.ori,b,_,w,S)}return q!=0&&(G.band=q==2?[op(r,i,s,a,Z,-1),op(r,i,s,a,Z,1)]:op(r,i,s,a,Z,q)),G})}function Ipe(t){return Ppe(Dpe,t)}function Dpe(t,e,n,r,i,s){const a=t.length;if(a<2)return null;const o=new Path2D;if(n(o,t[0],e[0]),a==2)r(o,t[1],e[1]);else{let l=Array(a),c=Array(a-1),d=Array(a-1),h=Array(a-1);for(let g=0;g<a-1;g++)d[g]=e[g+1]-e[g],h[g]=t[g+1]-t[g],c[g]=d[g]/h[g];l[0]=c[0];for(let g=1;g<a-1;g++)c[g]===0||c[g-1]===0||c[g-1]>0!=c[g]>0?l[g]=0:(l[g]=3*(h[g-1]+h[g])/((2*h[g]+h[g-1])/c[g-1]+(h[g]+2*h[g-1])/c[g]),isFinite(l[g])||(l[g]=0));l[a-1]=c[a-2];for(let g=0;g<a-1;g++)i(o,t[g]+h[g]/3,e[g]+l[g]*h[g]/3,t[g+1]-h[g]/3,e[g+1]-l[g+1]*h[g]/3,t[g+1],e[g+1])}return o}const cR=new Set;function uO(){for(let t of cR)t.syncRect(!0)}My&&($g(phe,v1,uO),$g(mhe,v1,uO,!0),$g(g2,v1,()=>{ma.pxRatio=Ni}));const Ope=t$(),Lpe=JW();function dO(t,e,n,r){return(r?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map((s,a)=>uR(s,a,e,n))}function zpe(t,e){return t.map((n,r)=>r==0?{}:Ua({},e,n))}function uR(t,e,n,r){return Ua({},e==0?n:r,t)}function n$(t,e,n){return e==null?Y1:[e,n]}const jpe=n$;function Fpe(t,e,n){return e==null?Y1:v2(e,n,j8,!0)}function r$(t,e,n,r){return e==null?Y1:ST(e,n,t.scales[r].log,!1)}const Upe=r$;function i$(t,e,n,r){return e==null?Y1:z8(e,n,t.scales[r].log,!1)}const Bpe=i$;function Hpe(t,e,n,r,i){let s=Fl(VD(t),VD(e)),a=e-t,o=Id(i/r*a,n);do{let l=n[o],c=r*l/a;if(c>=i&&s+(l<5?Q0.get(l):0)<=17)return[l,c]}while(++o<n.length);return[0,0]}function fO(t){let e,n;return t=t.replace(/(\d+)px/,(r,i)=>(e=to((n=+i)*Ni))+"px"),[t,e,n]}function Vpe(t){t.show&&[t.font,t.labelFont].forEach(e=>{let n=ns(e[2]*Ni,1);e[0]=e[0].replace(/[0-9.]+px/,n+"px"),e[1]=n})}function ma(t,e,n){const r={mode:wi(t.mode,1)},i=r.mode;function s(de,Me,Ge,Ke){let lt=Me.valToPct(de);return Ke+Ge*(Me.dir==-1?1-lt:lt)}function a(de,Me,Ge,Ke){let lt=Me.valToPct(de);return Ke+Ge*(Me.dir==-1?lt:1-lt)}function o(de,Me,Ge,Ke){return Me.ori==0?s(de,Me,Ge,Ke):a(de,Me,Ge,Ke)}r.valToPosH=s,r.valToPosV=a;let l=!1;r.status=0;const c=r.root=Du(Kfe);if(t.id!=null&&(c.id=t.id),Gc(c,t.class),t.title){let de=Du(Jfe,c);de.textContent=t.title}const d=Nd("canvas"),h=r.ctx=d.getContext("2d"),g=Du(ehe,c);$g("click",g,de=>{de.target===b&&(ei!=xs||zr!=Wo)&&mr.click(r,de)},!0);const v=r.under=Du(the,g);g.appendChild(d);const b=r.over=Du(nhe,g);t=K1(t);const _=+wi(t.pxAlign,1),w=lO(_);(t.plugins||[]).forEach(de=>{de.opts&&(t=de.opts(r,t)||t)});const S=t.ms||.001,E=r.series=i==1?dO(t.series||[],tO,aO,!1):zpe(t.series||[null],sO),A=r.axes=dO(t.axes||[],eO,rO,!0),N=r.scales={},D=r.bands=t.bands||[];D.forEach(de=>{de.fill=ri(de.fill||null),de.dir=wi(de.dir,-1)});const P=i==2?E[1].facets[0].scale:E[0].scale,L={axes:So,series:ss},R=(t.drawOrder||["axes","series"]).map(de=>L[de]);function O(de){const Me=de.distr==3?Ge=>ap(Ge>0?Ge:de.clamp(r,Ge,de.min,de.max,de.key)):de.distr==4?Ge=>QC(Ge,de.asinh):de.distr==100?Ge=>de.fwd(Ge):Ge=>Ge;return Ge=>{let Ke=Me(Ge),{_min:lt,_max:St}=de,jt=St-lt;return(Ke-lt)/jt}}function W(de){let Me=N[de];if(Me==null){let Ge=(t.scales||N_)[de]||N_;if(Ge.from!=null){W(Ge.from);let Ke=Ua({},N[Ge.from],Ge,{key:de});Ke.valToPct=O(Ke),N[de]=Ke}else{Me=N[de]=Ua({},de==P?$W:Tpe,Ge),Me.key=de;let Ke=Me.time,lt=Me.range,St=C0(lt);if((de!=P||i==2&&!Ke)&&(St&&(lt[0]==null||lt[1]==null)&&(lt={min:lt[0]==null?UD:{mode:1,hard:lt[0],soft:lt[0]},max:lt[1]==null?UD:{mode:1,hard:lt[1],soft:lt[1]}},St=!1),!St&&MT(lt))){let jt=lt;lt=(Vt,Kt,mn)=>Kt==null?Y1:v2(Kt,mn,jt)}Me.range=ri(lt||(Ke?jpe:de==P?Me.distr==3?Upe:Me.distr==4?Bpe:n$:Me.distr==3?r$:Me.distr==4?i$:Fpe)),Me.auto=ri(St?!1:Me.auto),Me.clamp=ri(Me.clamp||Mpe),Me._min=Me._max=null,Me.valToPct=O(Me)}}}W("x"),W("y"),i==1&&E.forEach(de=>{W(de.scale)}),A.forEach(de=>{W(de.scale)});for(let de in t.scales)W(de);const F=N[P],V=F.distr;let G,Z;F.ori==0?(Gc(c,Zfe),G=s,Z=a):(Gc(c,Qfe),G=a,Z=s);const B={};for(let de in N){let Me=N[de];(Me.min!=null||Me.max!=null)&&(B[de]={min:Me.min,max:Me.max},Me.min=Me.max=null)}const q=t.tzDate||(de=>new Date(to(de/S))),K=t.fmtDate||B8,Y=S==1?Zhe(q):epe(q),Q=ZD(q,KD(S==1?Khe:Jhe,K)),U=JD(q,QD(npe,K)),j=[],X=r.legend=Ua({},spe,t.legend),H=r.cursor=Ua({},dpe,{drag:{y:i==2}},t.cursor),ie=X.show,ne=H.show,re=X.markers;X.idxs=j,re.width=ri(re.width),re.dash=ri(re.dash),re.stroke=ri(re.stroke),re.fill=ri(re.fill);let ue,le,fe,we=[],pe=[],xe,Ve=!1,ye={};if(X.live){const de=E[1]?E[1].values:null;Ve=de!=null,xe=Ve?de(r,1,0):{_:0};for(let Me in xe)ye[Me]=O8}if(ie)if(ue=Nd("table",lhe,c),fe=Nd("tbody",null,ue),X.mount(r,ue),Ve){le=Nd("thead",null,ue,fe);let de=Nd("tr",null,le);Nd("th",null,de);for(var Oe in xe)Nd("th",CD,de).textContent=Oe}else Gc(ue,uhe),X.live&&Gc(ue,che);const he={show:!0},Re={show:!1};function oe(de,Me){if(Me==0&&(Ve||!X.live||i==2))return Y1;let Ge=[],Ke=Nd("tr",dhe,fe,fe.childNodes[Me]);Gc(Ke,de.class),de.show||Gc(Ke,Ag);let lt=Nd("th",null,Ke);if(re.show){let Vt=Du(fhe,lt);if(Me>0){let Kt=re.width(r,Me);Kt&&(Vt.style.border=Kt+"px "+re.dash(r,Me)+" "+re.stroke(r,Me)),Vt.style.background=re.fill(r,Me)}}let St=Du(CD,lt);de.label instanceof HTMLElement?St.appendChild(de.label):St.textContent=de.label,Me>0&&(re.show||(St.style.color=de.width>0?re.stroke(r,Me):re.fill(r,Me)),Ee("click",lt,Vt=>{if(H._lock)return;ht(Vt);let Kt=E.indexOf(de);if((Vt.ctrlKey||Vt.metaKey)!=X.isolate){let mn=E.some((vn,Sn)=>Sn>0&&Sn!=Kt&&vn.show);E.forEach((vn,Sn)=>{Sn>0&&hi(Sn,mn?Sn==Kt?he:Re:he,!0,bs.setSeries)})}else hi(Kt,{show:!de.show},!0,bs.setSeries)},!1),wt&&Ee(kD,lt,Vt=>{H._lock||(ht(Vt),hi(E.indexOf(de),ys,!0,bs.setSeries))},!1));for(var jt in xe){let Vt=Nd("td",hhe,Ke);Vt.textContent="--",Ge.push(Vt)}return[Ke,Ge]}const Ue=new Map;function Ee(de,Me,Ge,Ke=!0){const lt=Ue.get(Me)||{},St=H.bind[de](r,Me,Ge,Ke);St&&($g(de,Me,lt[de]=St),Ue.set(Me,lt))}function Pe(de,Me,Ge){const Ke=Ue.get(Me)||{};for(let lt in Ke)(de==null||lt==de)&&(iR(lt,Me,Ke[lt]),delete Ke[lt]);de==null&&Ue.delete(Me)}let Ze=0,ae=0,te=0,be=0,me=0,ge=0,ke=me,Xe=ge,Ae=te,je=be,We=0,De=0,Be=0,qe=0;r.bbox={};let Se=!1,Ye=!1,dt=!1,Le=!1,st=!1,ft=!1;function mt(de,Me,Ge){(Ge||de!=r.width||Me!=r.height)&&tt(de,Me),ql(!1),dt=!0,Ye=!0,Go()}function tt(de,Me){r.width=Ze=te=de,r.height=ae=be=Me,me=ge=0,He(),et();let Ge=r.bbox;We=Ge.left=wg(me*Ni,.5),De=Ge.top=wg(ge*Ni,.5),Be=Ge.width=wg(te*Ni,.5),qe=Ge.height=wg(be*Ni,.5)}const Qe=3;function ze(){let de=!1,Me=0;for(;!de;){Me++;let Ge=$a(Me),Ke=co(Me);de=Me==Qe||Ge&&Ke,de||(tt(r.width,r.height),Ye=!0)}}function Te({width:de,height:Me}){mt(de,Me)}r.setSize=Te;function He(){let de=!1,Me=!1,Ge=!1,Ke=!1;A.forEach((lt,St)=>{if(lt.show&&lt._show){let{side:jt,_size:Vt}=lt,Kt=jt%2,mn=lt.label!=null?lt.labelSize:0,vn=Vt+mn;vn>0&&(Kt?(te-=vn,jt==3?(me+=vn,Ke=!0):Ge=!0):(be-=vn,jt==0?(ge+=vn,de=!0):Me=!0))}}),Bt[0]=de,Bt[1]=Ge,Bt[2]=Me,Bt[3]=Ke,te-=Nn[1]+Nn[3],me+=Nn[3],be-=Nn[2]+Nn[0],ge+=Nn[0]}function et(){let de=me+te,Me=ge+be,Ge=me,Ke=ge;function lt(St,jt){switch(St){case 1:return de+=jt,de-jt;case 2:return Me+=jt,Me-jt;case 3:return Ge-=jt,Ge+jt;case 0:return Ke-=jt,Ke+jt}}A.forEach((St,jt)=>{if(St.show&&St._show){let Vt=St.side;St._pos=lt(Vt,St._size),St.label!=null&&(St._lpos=lt(Vt,St.labelSize))}})}if(H.dataIdx==null){let de=H.hover,Me=de.skip=new Set(de.skip??[]);Me.add(void 0);let Ge=de.prox=ri(de.prox),Ke=de.bias??(de.bias=0);H.dataIdx=(lt,St,jt,Vt)=>{if(St==0)return jt;let Kt=jt,mn=Ge(lt,St,jt,Vt)??ts,vn=mn>=0&&mn<ts,Sn=F.ori==0?te:be,er=H.left,Yr=e[0],tr=e[St];if(Me.has(tr[jt])){Kt=null;let ur=null,Vn=null,An;if(Ke==0||Ke==-1)for(An=jt;ur==null&&An-- >0;)Me.has(tr[An])||(ur=An);if(Ke==0||Ke==1)for(An=jt;Vn==null&&An++<tr.length;)Me.has(tr[An])||(Vn=An);if(ur!=null||Vn!=null)if(vn){let qn=ur==null?-1/0:G(Yr[ur],F,Sn,0),Ji=Vn==null?1/0:G(Yr[Vn],F,Sn,0),Ds=er-qn,pi=Ji-er;Ds<=pi?Ds<=mn&&(Kt=ur):pi<=mn&&(Kt=Vn)}else Kt=Vn==null?ur:ur==null?Vn:jt-ur<=Vn-jt?ur:Vn}else vn&&no(er-G(Yr[jt],F,Sn,0))>mn&&(Kt=null);return Kt}}const ht=de=>{H.event=de};H.idxs=j,H._lock=!1;let ct=H.points;ct.show=ri(ct.show),ct.size=ri(ct.size),ct.stroke=ri(ct.stroke),ct.width=ri(ct.width),ct.fill=ri(ct.fill);const bt=r.focus=Ua({},t.focus||{alpha:.3},H.focus),wt=bt.prox>=0,Pt=wt&&ct.one;let $e=[],Tt=[],Et=[];function Ot(de,Me){let Ge=ct.show(r,Me);if(Ge instanceof HTMLElement)return Gc(Ge,ohe),Gc(Ge,de.class),Ef(Ge,-10,-10,te,be),b.insertBefore(Ge,$e[Me]),Ge}function Gt(de,Me){if(i==1||Me>0){let Ge=i==1&&N[de.scale].time,Ke=de.value;de.value=Ge?$D(Ke)?JD(q,QD(Ke,K)):Ke||U:Ke||_pe,de.label=de.label||(Ge?hpe:fpe)}if(Pt||Me>0){de.width=de.width==null?1:de.width,de.paths=de.paths||Ope||The,de.fillTo=ri(de.fillTo||Epe),de.pxAlign=+wi(de.pxAlign,_),de.pxRound=lO(de.pxAlign),de.stroke=ri(de.stroke||null),de.fill=ri(de.fill||null),de._stroke=de._fill=de._paths=de._focus=null;let Ge=Spe(Fl(1,de.width),1),Ke=de.points=Ua({},{size:Ge,width:Fl(1,Ge*.2),stroke:de.stroke,space:Ge*2,paths:Lpe,_stroke:null,_fill:null},de.points);Ke.show=ri(Ke.show),Ke.filter=ri(Ke.filter),Ke.fill=ri(Ke.fill),Ke.stroke=ri(Ke.stroke),Ke.paths=ri(Ke.paths),Ke.pxAlign=de.pxAlign}if(ie){let Ge=oe(de,Me);we.splice(Me,0,Ge[0]),pe.splice(Me,0,Ge[1]),X.values.push(null)}if(ne){j.splice(Me,0,null);let Ge=null;Pt?Me==0&&(Ge=Ot(de,Me)):Me>0&&(Ge=Ot(de,Me)),$e.splice(Me,0,Ge),Tt.splice(Me,0,0),Et.splice(Me,0,0)}Is("addSeries",Me)}function an(de,Me){Me=Me??E.length,de=i==1?uR(de,Me,tO,aO):uR(de,Me,{},sO),E.splice(Me,0,de),Gt(E[Me],Me)}r.addSeries=an;function On(de){if(E.splice(de,1),ie){X.values.splice(de,1),pe.splice(de,1);let Me=we.splice(de,1)[0];Pe(null,Me.firstChild),Me.remove()}ne&&(j.splice(de,1),$e.splice(de,1)[0].remove(),Tt.splice(de,1),Et.splice(de,1)),Is("delSeries",de)}r.delSeries=On;const Bt=[!1,!1,!1,!1];function fn(de,Me){if(de._show=de.show,de.show){let Ge=de.side%2,Ke=N[de.scale];Ke==null&&(de.scale=Ge?E[1].scale:P,Ke=N[de.scale]);let lt=Ke.time;de.size=ri(de.size),de.space=ri(de.space),de.rotate=ri(de.rotate),C0(de.incrs)&&de.incrs.forEach(jt=>{!Q0.has(jt)&&Q0.set(jt,CW(jt))}),de.incrs=ri(de.incrs||(Ke.distr==2?qhe:lt?S==1?Yhe:Qhe:Mg)),de.splits=ri(de.splits||(lt&&Ke.distr==1?Y:Ke.distr==3?aR:Ke.distr==4?gpe:mpe)),de.stroke=ri(de.stroke),de.grid.stroke=ri(de.grid.stroke),de.ticks.stroke=ri(de.ticks.stroke),de.border.stroke=ri(de.border.stroke);let St=de.values;de.values=C0(St)&&!C0(St[0])?ri(St):lt?C0(St)?ZD(q,KD(St,K)):$D(St)?tpe(q,St):St||Q:St||ppe,de.filter=ri(de.filter||(Ke.distr>=3&&Ke.log==10?ype:Ke.distr==3&&Ke.log==2?bpe:TW)),de.font=fO(de.font),de.labelFont=fO(de.labelFont),de._size=de.size(r,null,Me,0),de._space=de._rotate=de._incrs=de._found=de._splits=de._values=null,de._size>0&&(Bt[Me]=!0,de._el=Du(rhe,g))}}function Ht(de,Me,Ge,Ke){let[lt,St,jt,Vt]=Ge,Kt=Me%2,mn=0;return Kt==0&&(Vt||St)&&(mn=Me==0&&!lt||Me==2&&!jt?to(eO.size/3):0),Kt==1&&(lt||jt)&&(mn=Me==1&&!St||Me==3&&!Vt?to(rO.size/2):0),mn}const In=r.padding=(t.padding||[Ht,Ht,Ht,Ht]).map(de=>ri(wi(de,Ht))),Nn=r._padding=In.map((de,Me)=>de(r,Me,Bt,0));let bn,Ln=null,Fn=null;const Bi=i==1?E[0].idxs:null;let ui=null,ve=!1;function ot(de,Me){if(e=de??[],r.data=r._data=e,i==2){bn=0;for(let Ge=1;Ge<E.length;Ge++)bn+=e[Ge][0].length}else{e.length==0&&(r.data=r._data=e=[[]]),ui=e[0],bn=ui.length;let Ge=e;if(V==2){Ge=e.slice();let Ke=Ge[0]=Array(bn);for(let lt=0;lt<bn;lt++)Ke[lt]=lt}r._data=e=Ge}if(ql(!0),Is("setData"),V==2&&(dt=!0),Me!==!1){let Ge=F;Ge.auto(r,ve)?_t():ga(P,Ge.min,Ge.max),Le=Le||H.left>=0,ft=!0,Go()}}r.setData=ot;function _t(){ve=!0;let de,Me;i==1&&(bn>0?(Ln=Bi[0]=0,Fn=Bi[1]=bn-1,de=e[0][Ln],Me=e[0][Fn],V==2?(de=Ln,Me=Fn):de==Me&&(V==3?[de,Me]=ST(de,de,F.log,!1):V==4?[de,Me]=z8(de,de,F.log,!1):F.time?Me=de+to(86400/S):[de,Me]=v2(de,Me,j8,!0))):(Ln=Bi[0]=de=null,Fn=Bi[1]=Me=null)),ga(P,de,Me)}let yt,vt,Yt,rn,sn,Zt,Mn,Un,$n,on;function ir(de,Me,Ge,Ke,lt,St){de??(de=ND),Ge??(Ge=U8),Ke??(Ke="butt"),lt??(lt=ND),St??(St="round"),de!=yt&&(h.strokeStyle=yt=de),lt!=vt&&(h.fillStyle=vt=lt),Me!=Yt&&(h.lineWidth=Yt=Me),St!=sn&&(h.lineJoin=sn=St),Ke!=Zt&&(h.lineCap=Zt=Ke),Ge!=rn&&h.setLineDash(rn=Ge)}function Xr(de,Me,Ge,Ke){Me!=vt&&(h.fillStyle=vt=Me),de!=Mn&&(h.font=Mn=de),Ge!=Un&&(h.textAlign=Un=Ge),Ke!=$n&&(h.textBaseline=$n=Ke)}function Jr(de,Me,Ge,Ke,lt=0){if(Ke.length>0&&de.auto(r,ve)&&(Me==null||Me.min==null)){let St=wi(Ln,0),jt=wi(Fn,Ke.length-1),Vt=Ge.min==null?yhe(Ke,St,jt,lt,de.distr==3):[Ge.min,Ge.max];de.min=Od(de.min,Ge.min=Vt[0]),de.max=Fl(de.max,Ge.max=Vt[1])}}const cr={min:null,max:null};function Nr(){for(let Ke in N){let lt=N[Ke];B[Ke]==null&&(lt.min==null||B[P]!=null&&lt.auto(r,ve))&&(B[Ke]=cr)}for(let Ke in N){let lt=N[Ke];B[Ke]==null&&lt.from!=null&&B[lt.from]!=null&&(B[Ke]=cr)}B[P]!=null&&ql(!0);let de={};for(let Ke in B){let lt=B[Ke];if(lt!=null){let St=de[Ke]=K1(N[Ke],Ahe);if(lt.min!=null)Ua(St,lt);else if(Ke!=P||i==2)if(bn==0&&St.from==null){let jt=St.range(r,null,null,Ke);St.min=jt[0],St.max=jt[1]}else St.min=ts,St.max=-ts}}if(bn>0){E.forEach((Ke,lt)=>{if(i==1){let St=Ke.scale,jt=B[St];if(jt==null)return;let Vt=de[St];if(lt==0){let Kt=Vt.range(r,Vt.min,Vt.max,St);Vt.min=Kt[0],Vt.max=Kt[1],Ln=Id(Vt.min,e[0]),Fn=Id(Vt.max,e[0]),Fn-Ln>1&&(e[0][Ln]<Vt.min&&Ln++,e[0][Fn]>Vt.max&&Fn--),Ke.min=ui[Ln],Ke.max=ui[Fn]}else Ke.show&&Ke.auto&&Jr(Vt,jt,Ke,e[lt],Ke.sorted);Ke.idxs[0]=Ln,Ke.idxs[1]=Fn}else if(lt>0&&Ke.show&&Ke.auto){let[St,jt]=Ke.facets,Vt=St.scale,Kt=jt.scale,[mn,vn]=e[lt],Sn=de[Vt],er=de[Kt];Sn!=null&&Jr(Sn,B[Vt],St,mn,St.sorted),er!=null&&Jr(er,B[Kt],jt,vn,jt.sorted),Ke.min=jt.min,Ke.max=jt.max}});for(let Ke in de){let lt=de[Ke],St=B[Ke];if(lt.from==null&&(St==null||St.min==null)){let jt=lt.range(r,lt.min==ts?null:lt.min,lt.max==-ts?null:lt.max,Ke);lt.min=jt[0],lt.max=jt[1]}}}for(let Ke in de){let lt=de[Ke];if(lt.from!=null){let St=de[lt.from];if(St.min==null)lt.min=lt.max=null;else{let jt=lt.range(r,St.min,St.max,Ke);lt.min=jt[0],lt.max=jt[1]}}}let Me={},Ge=!1;for(let Ke in de){let lt=de[Ke],St=N[Ke];if(St.min!=lt.min||St.max!=lt.max){St.min=lt.min,St.max=lt.max;let jt=St.distr;St._min=jt==3?ap(St.min):jt==4?QC(St.min,St.asinh):jt==100?St.fwd(St.min):St.min,St._max=jt==3?ap(St.max):jt==4?QC(St.max,St.asinh):jt==100?St.fwd(St.max):St.max,Me[Ke]=Ge=!0}}if(Ge){E.forEach((Ke,lt)=>{i==2?lt>0&&Me.y&&(Ke._paths=null):Me[Ke.scale]&&(Ke._paths=null)});for(let Ke in Me)dt=!0,Is("setScale",Ke);ne&&H.left>=0&&(Le=ft=!0)}for(let Ke in B)B[Ke]=null}function en(de){let Me=sR(Ln-1,0,bn-1),Ge=sR(Fn+1,0,bn-1);for(;de[Me]==null&&Me>0;)Me--;for(;de[Ge]==null&&Ge<bn-1;)Ge++;return[Me,Ge]}function ss(){if(bn>0){let de=E.some(Me=>Me._focus)&&on!=bt.alpha;de&&(h.globalAlpha=on=bt.alpha),E.forEach((Me,Ge)=>{if(Ge>0&&Me.show&&(Rn(Ge,!1),Rn(Ge,!0),Me._paths==null)){let Ke=on;on!=Me.alpha&&(h.globalAlpha=on=Me.alpha);let lt=i==2?[0,e[Ge][0].length-1]:en(e[Ge]);Me._paths=Me.paths(r,Ge,lt[0],lt[1]),on!=Ke&&(h.globalAlpha=on=Ke)}}),E.forEach((Me,Ge)=>{if(Ge>0&&Me.show){let Ke=on;on!=Me.alpha&&(h.globalAlpha=on=Me.alpha),Me._paths!=null&&gs(Ge,!1);{let lt=Me._paths!=null?Me._paths.gaps:null,St=Me.points.show(r,Ge,Ln,Fn,lt),jt=Me.points.filter(r,Ge,St,lt);(St||jt)&&(Me.points._paths=Me.points.paths(r,Ge,Ln,Fn,jt),gs(Ge,!0))}on!=Ke&&(h.globalAlpha=on=Ke),Is("drawSeries",Ge)}}),de&&(h.globalAlpha=on=1)}}function Rn(de,Me){let Ge=Me?E[de].points:E[de];Ge._stroke=Ge.stroke(r,de),Ge._fill=Ge.fill(r,de)}function gs(de,Me){let Ge=Me?E[de].points:E[de],{stroke:Ke,fill:lt,clip:St,flags:jt,_stroke:Vt=Ge._stroke,_fill:Kt=Ge._fill,_width:mn=Ge.width}=Ge._paths;mn=ns(mn*Ni,3);let vn=null,Sn=mn%2/2;Me&&Kt==null&&(Kt=mn>0?"#fff":Vt);let er=Ge.pxAlign==1&&Sn>0;if(er&&h.translate(Sn,Sn),!Me){let Yr=We-mn/2,tr=De-mn/2,ur=Be+mn,Vn=qe+mn;vn=new Path2D,vn.rect(Yr,tr,ur,Vn)}Me?vs(Vt,mn,Ge.dash,Ge.cap,Kt,Ke,lt,jt,St):Rs(de,Vt,mn,Ge.dash,Ge.cap,Kt,Ke,lt,jt,vn,St),er&&h.translate(-Sn,-Sn)}function Rs(de,Me,Ge,Ke,lt,St,jt,Vt,Kt,mn,vn){let Sn=!1;Kt!=0&&D.forEach((er,Yr)=>{if(er.series[0]==de){let tr=E[er.series[1]],ur=e[er.series[1]],Vn=(tr._paths||N_).band;C0(Vn)&&(Vn=er.dir==1?Vn[0]:Vn[1]);let An,qn=null;tr.show&&Vn&&_he(ur,Ln,Fn)?(qn=er.fill(r,Yr)||St,An=tr._paths.clip):Vn=null,vs(Me,Ge,Ke,lt,qn,jt,Vt,Kt,mn,vn,An,Vn),Sn=!0}}),Sn||vs(Me,Ge,Ke,lt,St,jt,Vt,Kt,mn,vn)}const Pi=Z1|lR;function vs(de,Me,Ge,Ke,lt,St,jt,Vt,Kt,mn,vn,Sn){ir(de,Me,Ge,Ke,lt),(Kt||mn||Sn)&&(h.save(),Kt&&h.clip(Kt),mn&&h.clip(mn)),Sn?(Vt&Pi)==Pi?(h.clip(Sn),vn&&h.clip(vn),di(lt,jt),pr(de,St,Me)):Vt&lR?(di(lt,jt),h.clip(Sn),pr(de,St,Me)):Vt&Z1&&(h.save(),h.clip(Sn),vn&&h.clip(vn),di(lt,jt),h.restore(),pr(de,St,Me)):(di(lt,jt),pr(de,St,Me)),(Kt||mn||Sn)&&h.restore()}function pr(de,Me,Ge){Ge>0&&(Me instanceof Map?Me.forEach((Ke,lt)=>{h.strokeStyle=yt=lt,h.stroke(Ke)}):Me!=null&&de&&h.stroke(Me))}function di(de,Me){Me instanceof Map?Me.forEach((Ge,Ke)=>{h.fillStyle=vt=Ke,h.fill(Ge)}):Me!=null&&de&&h.fill(Me)}function ks(de,Me,Ge,Ke){let lt=A[de],St;if(Ke<=0)St=[0,0];else{let jt=lt._space=lt.space(r,de,Me,Ge,Ke),Vt=lt._incrs=lt.incrs(r,de,Me,Ge,Ke,jt);St=Hpe(Me,Ge,Vt,Ke,jt)}return lt._found=St}function Ii(de,Me,Ge,Ke,lt,St,jt,Vt,Kt,mn){let vn=jt%2/2;_==1&&h.translate(vn,vn),ir(Vt,jt,Kt,mn,Vt),h.beginPath();let Sn,er,Yr,tr,ur=lt+(Ke==0||Ke==3?-St:St);Ge==0?(er=lt,tr=ur):(Sn=lt,Yr=ur);for(let Vn=0;Vn<de.length;Vn++)Me[Vn]!=null&&(Ge==0?Sn=Yr=de[Vn]:er=tr=de[Vn],h.moveTo(Sn,er),h.lineTo(Yr,tr));h.stroke(),_==1&&h.translate(-vn,-vn)}function $a(de){let Me=!0;return A.forEach((Ge,Ke)=>{if(!Ge.show)return;let lt=N[Ge.scale];if(lt.min==null){Ge._show&&(Me=!1,Ge._show=!1,ql(!1));return}else Ge._show||(Me=!1,Ge._show=!0,ql(!1));let St=Ge.side,jt=St%2,{min:Vt,max:Kt}=lt,[mn,vn]=ks(Ke,Vt,Kt,jt==0?te:be);if(vn==0)return;let Sn=lt.distr==2,er=Ge._splits=Ge.splits(r,Ke,Vt,Kt,mn,vn,Sn),Yr=lt.distr==2?er.map(An=>ui[An]):er,tr=lt.distr==2?ui[er[1]]-ui[er[0]]:mn,ur=Ge._values=Ge.values(r,Ge.filter(r,Yr,Ke,vn,tr),Ke,vn,tr);Ge._rotate=St==2?Ge.rotate(r,ur,Ke,vn):0;let Vn=Ge._size;Ge._size=Fu(Ge.size(r,ur,Ke,de)),Vn!=null&&Ge._size!=Vn&&(Me=!1)}),Me}function co(de){let Me=!0;return In.forEach((Ge,Ke)=>{let lt=Ge(r,Ke,Bt,de);lt!=Nn[Ke]&&(Me=!1),Nn[Ke]=lt}),Me}function So(){for(let de=0;de<A.length;de++){let Me=A[de];if(!Me.show||!Me._show)continue;let Ge=Me.side,Ke=Ge%2,lt,St,jt=Me.stroke(r,de),Vt=Ge==0||Ge==3?-1:1,[Kt,mn]=Me._found;if(Me.label!=null){let aa=Me.labelGap*Vt,xa=to((Me._lpos+aa)*Ni);Xr(Me.labelFont[0],jt,"center",Ge==2?Gb:AD),h.save(),Ke==1?(lt=St=0,h.translate(xa,to(De+qe/2)),h.rotate((Ge==3?-LM:LM)/2)):(lt=to(We+Be/2),St=xa);let Oc=wW(Me.label)?Me.label(r,de,Kt,mn):Me.label;h.fillText(Oc,lt,St),h.restore()}if(mn==0)continue;let vn=N[Me.scale],Sn=Ke==0?Be:qe,er=Ke==0?We:De,Yr=Me._splits,tr=vn.distr==2?Yr.map(aa=>ui[aa]):Yr,ur=vn.distr==2?ui[Yr[1]]-ui[Yr[0]]:Kt,Vn=Me.ticks,An=Me.border,qn=Vn.show?Vn.size:0,Ji=to(qn*Ni),Ds=to((Me.alignTo==2?Me._size-qn-Me.gap:Me.gap)*Ni),pi=Me._rotate*-LM/180,si=w(Me._pos*Ni),as=(Ji+Ds)*Vt,Os=si+as;St=Ke==0?Os:0,lt=Ke==1?Os:0;let Ya=Me.font[0],Na=Me.align==1?Tx:Me.align==2?YC:pi>0?Tx:pi<0?YC:Ke==0?"center":Ge==3?YC:Tx,Hi=pi||Ke==1?"middle":Ge==2?Gb:AD;Xr(Ya,jt,Na,Hi);let Gs=Me.font[1]*Me.lineGap,Ra=Yr.map(aa=>w(o(aa,vn,Sn,er))),Eo=Me._values;for(let aa=0;aa<Eo.length;aa++){let xa=Eo[aa];if(xa!=null){Ke==0?lt=Ra[aa]:St=Ra[aa],xa=""+xa;let Oc=xa.indexOf(`
`)==-1?[xa]:xa.split(/\n/gm);for(let ka=0;ka<Oc.length;ka++){let Rv=Oc[ka];pi?(h.save(),h.translate(lt,St+ka*Gs),h.rotate(pi),h.fillText(Rv,0,0),h.restore()):h.fillText(Rv,lt,St+ka*Gs)}}}Vn.show&&Ii(Ra,Vn.filter(r,tr,de,mn,ur),Ke,Ge,si,Ji,ns(Vn.width*Ni,3),Vn.stroke(r,de),Vn.dash,Vn.cap);let sa=Me.grid;sa.show&&Ii(Ra,sa.filter(r,tr,de,mn,ur),Ke,Ke==0?2:1,Ke==0?De:We,Ke==0?qe:Be,ns(sa.width*Ni,3),sa.stroke(r,de),sa.dash,sa.cap),An.show&&Ii([si],[1],Ke==0?1:0,Ke==0?1:2,Ke==1?De:We,Ke==1?qe:Be,ns(An.width*Ni,3),An.stroke(r,de),An.dash,An.cap)}Is("drawAxes")}function ql(de){E.forEach((Me,Ge)=>{Ge>0&&(Me._paths=null,de&&(i==1?(Me.min=null,Me.max=null):Me.facets.forEach(Ke=>{Ke.min=null,Ke.max=null})))})}let xl=!1,uo=!1,Ps=[];function Xl(){uo=!1;for(let de=0;de<Ps.length;de++)Is(...Ps[de]);Ps.length=0}function Go(){xl||(Ohe(Mo),xl=!0)}function wo(de,Me=!1){xl=!0,uo=Me,de(r),Mo(),Me&&Ps.length>0&&queueMicrotask(Xl)}r.batch=wo;function Mo(){if(Se&&(Nr(),Se=!1),dt&&(ze(),dt=!1),Ye){if(As(v,Tx,me),As(v,Gb,ge),As(v,m_,te),As(v,g_,be),As(b,Tx,me),As(b,Gb,ge),As(b,m_,te),As(b,g_,be),As(g,m_,Ze),As(g,g_,ae),d.width=to(Ze*Ni),d.height=to(ae*Ni),A.forEach(({_el:de,_show:Me,_size:Ge,_pos:Ke,side:lt})=>{if(de!=null)if(Me){let St=lt===3||lt===0?Ge:0,jt=lt%2==1;As(de,jt?"left":"top",Ke-St),As(de,jt?"width":"height",Ge),As(de,jt?"top":"left",jt?ge:me),As(de,jt?"height":"width",jt?be:te),rR(de,Ag)}else Gc(de,Ag)}),yt=vt=Yt=sn=Zt=Mn=Un=$n=rn=null,on=1,ad(!0),me!=ke||ge!=Xe||te!=Ae||be!=je){ql(!1);let de=te/Ae,Me=be/je;if(ne&&!Le&&H.left>=0){H.left*=de,H.top*=Me,qa&&Ef(qa,to(H.left),0,te,be),ia&&Ef(ia,0,to(H.top),te,be);for(let Ge=0;Ge<$e.length;Ge++){let Ke=$e[Ge];Ke!=null&&(Tt[Ge]*=de,Et[Ge]*=Me,Ef(Ke,Fu(Tt[Ge]),Fu(Et[Ge]),te,be))}}if(Wr.show&&!st&&Wr.left>=0&&Wr.width>0){Wr.left*=de,Wr.width*=de,Wr.top*=Me,Wr.height*=Me;for(let Ge in wm)As(To,Ge,Wr[Ge])}ke=me,Xe=ge,Ae=te,je=be}Is("setSize"),Ye=!1}Ze>0&&ae>0&&(h.clearRect(0,0,d.width,d.height),Is("drawClear"),R.forEach(de=>de()),Is("draw")),Wr.show&&st&&(bl(Wr),st=!1),ne&&Le&&(Zl(null,!0,!1),Le=!1),X.show&&X.live&&ft&&(Cp(),ft=!1),l||(l=!0,r.status=1,Is("ready")),ve=!1,xl=!1}r.redraw=(de,Me)=>{dt=Me||!1,de!==!1?ga(P,F.min,F.max):Go()};function kc(de,Me){let Ge=N[de];if(Ge.from==null){if(bn==0){let Ke=Ge.range(r,Me.min,Me.max,de);Me.min=Ke[0],Me.max=Ke[1]}if(Me.min>Me.max){let Ke=Me.min;Me.min=Me.max,Me.max=Ke}if(bn>1&&Me.min!=null&&Me.max!=null&&Me.max-Me.min<1e-16)return;de==P&&Ge.distr==2&&bn>0&&(Me.min=Id(Me.min,e[0]),Me.max=Id(Me.max,e[0]),Me.min==Me.max&&Me.max++),B[de]=Me,Se=!0,Go()}}r.setScale=kc;let Pc,Yl,qa,ia,Aa,yl,xs,Wo,$o,Ic,ei,zr,Xa=!1;const mr=H.drag;let bi=mr.x,Di=mr.y;ne&&(H.x&&(Pc=Du(she,b)),H.y&&(Yl=Du(ahe,b)),F.ori==0?(qa=Pc,ia=Yl):(qa=Yl,ia=Pc),ei=H.left,zr=H.top);const Wr=r.select=Ua({show:!0,over:!0,left:0,width:0,top:0,height:0},t.select),To=Wr.show?Du(ihe,Wr.over?b:v):null;function bl(de,Me){if(Wr.show){for(let Ge in de)Wr[Ge]=de[Ge],Ge in wm&&As(To,Ge,de[Ge]);Me!==!1&&Is("setSelect")}}r.setSelect=bl;function Kl(de){if(E[de].show)ie&&rR(we[de],Ag);else if(ie&&Gc(we[de],Ag),ne){let Ge=Pt?$e[0]:$e[de];Ge!=null&&Ef(Ge,-10,-10,te,be)}}function ga(de,Me,Ge){kc(de,{min:Me,max:Ge})}function hi(de,Me,Ge,Ke){Me.focus!=null&&_l(de),Me.show!=null&&E.forEach((lt,St)=>{St>0&&(de==St||de==null)&&(lt.show=Me.show,Kl(St),i==2?(ga(lt.facets[0].scale,null,null),ga(lt.facets[1].scale,null,null)):ga(lt.scale,null,null),Go())}),Ge!==!1&&Is("setSeries",de,Me),Ke&&cd("setSeries",r,de,Me)}r.setSeries=hi;function vh(de,Me){Ua(D[de],Me)}function nd(de,Me){de.fill=ri(de.fill||null),de.dir=wi(de.dir,-1),Me=Me??D.length,D.splice(Me,0,de)}function rd(de){de==null?D.length=0:D.splice(de,1)}r.addBand=nd,r.setBand=vh,r.delBand=rd;function Qd(de,Me){E[de].alpha=Me,ne&&$e[de]!=null&&($e[de].style.opacity=Me),ie&&we[de]&&(we[de].style.opacity=Me)}let fo,Gi,Hs;const ys={focus:!0};function _l(de){if(de!=Hs){let Me=de==null,Ge=bt.alpha!=1;E.forEach((Ke,lt)=>{if(i==1||lt>0){let St=Me||lt==0||lt==de;Ke._focus=Me?null:St,Ge&&Qd(lt,St?1:bt.alpha)}}),Hs=de,Ge&&Go()}}ie&&wt&&Ee(PD,ue,de=>{H._lock||(ht(de),Hs!=null&&hi(null,ys,!0,bs.setSeries))});function va(de,Me,Ge){let Ke=N[Me];Ge&&(de=de/Ni-(Ke.ori==1?ge:me));let lt=te;Ke.ori==1&&(lt=be,de=lt-de),Ke.dir==-1&&(de=lt-de);let St=Ke._min,jt=Ke._max,Vt=de/lt,Kt=St+(jt-St)*Vt,mn=Ke.distr;return mn==3?X1(10,Kt):mn==4?whe(Kt,Ke.asinh):mn==100?Ke.bwd(Kt):Kt}function Tp(de,Me){let Ge=va(de,P,Me);return Id(Ge,e[0],Ln,Fn)}r.valToIdx=de=>Id(de,e[0]),r.posToIdx=Tp,r.posToVal=va,r.valToPos=(de,Me,Ge)=>N[Me].ori==0?s(de,N[Me],Ge?Be:te,Ge?We:0):a(de,N[Me],Ge?qe:be,Ge?De:0),r.setCursor=(de,Me,Ge)=>{ei=de.left,zr=de.top,Zl(null,Me,Ge)};function xh(de,Me){As(To,Tx,Wr.left=de),As(To,m_,Wr.width=Me)}function _m(de,Me){As(To,Gb,Wr.top=de),As(To,g_,Wr.height=Me)}let Jd=F.ori==0?xh:_m,id=F.ori==1?xh:_m;function Ep(){if(ie&&X.live)for(let de=i==2?1:0;de<E.length;de++){if(de==0&&Ve)continue;let Me=X.values[de],Ge=0;for(let Ke in Me)pe[de][Ge++].firstChild.nodeValue=Me[Ke]}}function Cp(de,Me){if(de!=null&&(de.idxs?de.idxs.forEach((Ge,Ke)=>{j[Ke]=Ge}):Che(de.idx)||j.fill(de.idx),X.idx=j[0]),ie&&X.live){for(let Ge=0;Ge<E.length;Ge++)(Ge>0||i==1&&!Ve)&&sd(Ge,j[Ge]);Ep()}ft=!1,Me!==!1&&Is("setLegend")}r.setLegend=Cp;function sd(de,Me){let Ge=E[de],Ke=de==0&&V==2?ui:e[de],lt;Ve?lt=Ge.values(r,de,Me)??ye:(lt=Ge.value(r,Me==null?null:Ke[Me],de,Me),lt=lt==null?ye:{_:lt}),X.values[de]=lt}function Zl(de,Me,Ge){$o=ei,Ic=zr,[ei,zr]=H.move(r,ei,zr),H.left=ei,H.top=zr,ne&&(qa&&Ef(qa,to(ei),0,te,be),ia&&Ef(ia,0,to(zr),te,be));let Ke,lt=Ln>Fn;fo=ts,Gi=null;let St=F.ori==0?te:be,jt=F.ori==1?te:be;if(ei<0||bn==0||lt){Ke=H.idx=null;for(let Vt=0;Vt<E.length;Vt++){let Kt=$e[Vt];Kt!=null&&Ef(Kt,-10,-10,te,be)}wt&&hi(null,ys,!0,de==null&&bs.setSeries),X.live&&(j.fill(Ke),ft=!0)}else{let Vt,Kt,mn;i==1&&(Vt=F.ori==0?ei:zr,Kt=va(Vt,P),Ke=H.idx=Id(Kt,e[0],Ln,Fn),mn=G(e[0][Ke],F,St,0));let vn=-10,Sn=-10,er=0,Yr=0,tr=!0,ur="",Vn="";for(let An=i==2?1:0;An<E.length;An++){let qn=E[An],Ji=j[An],Ds=Ji==null?null:i==1?e[An][Ji]:e[An][1][Ji],pi=H.dataIdx(r,An,Ke,Kt),si=pi==null?null:i==1?e[An][pi]:e[An][1][pi];if(ft=ft||si!=Ds||pi!=Ji,j[An]=pi,An>0&&qn.show){let as=pi==null?-10:pi==Ke?mn:G(i==1?e[0][pi]:e[An][0][pi],F,St,0),Os=si==null?-10:Z(si,i==1?N[qn.scale]:N[qn.facets[1].scale],jt,0);if(wt&&si!=null){let Ya=F.ori==1?ei:zr,Na=no(bt.dist(r,An,pi,Os,Ya));if(Na<fo){let Hi=bt.bias;if(Hi!=0){let Gs=va(Ya,qn.scale),Ra=si>=0?1:-1,Eo=Gs>=0?1:-1;Eo==Ra&&(Eo==1?Hi==1?si>=Gs:si<=Gs:Hi==1?si<=Gs:si>=Gs)&&(fo=Na,Gi=An)}else fo=Na,Gi=An}}if(ft||Pt){let Ya,Na;F.ori==0?(Ya=as,Na=Os):(Ya=Os,Na=as);let Hi,Gs,Ra,Eo,sa,aa,xa=!0,Oc=ct.bbox;if(Oc!=null){xa=!1;let ka=Oc(r,An);Ra=ka.left,Eo=ka.top,Hi=ka.width,Gs=ka.height}else Ra=Ya,Eo=Na,Hi=Gs=ct.size(r,An);if(aa=ct.fill(r,An),sa=ct.stroke(r,An),Pt)An==Gi&&fo<=bt.prox&&(vn=Ra,Sn=Eo,er=Hi,Yr=Gs,tr=xa,ur=aa,Vn=sa);else{let ka=$e[An];ka!=null&&(Tt[An]=Ra,Et[An]=Eo,FD(ka,Hi,Gs,xa),zD(ka,aa,sa),Ef(ka,Fu(Ra),Fu(Eo),te,be))}}}}if(Pt){let An=bt.prox,qn=Hs==null?fo<=An:fo>An||Gi!=Hs;if(ft||qn){let Ji=$e[0];Ji!=null&&(Tt[0]=vn,Et[0]=Sn,FD(Ji,er,Yr,tr),zD(Ji,ur,Vn),Ef(Ji,Fu(vn),Fu(Sn),te,be))}}}if(Wr.show&&Xa)if(de!=null){let[Vt,Kt]=bs.scales,[mn,vn]=bs.match,[Sn,er]=de.cursor.sync.scales,Yr=de.cursor.drag;if(bi=Yr._x,Di=Yr._y,bi||Di){let{left:tr,top:ur,width:Vn,height:An}=de.select,qn=de.scales[Sn].ori,Ji=de.posToVal,Ds,pi,si,as,Os,Ya=Vt!=null&&mn(Vt,Sn),Na=Kt!=null&&vn(Kt,er);Ya&&bi?(qn==0?(Ds=tr,pi=Vn):(Ds=ur,pi=An),si=N[Vt],as=G(Ji(Ds,Sn),si,St,0),Os=G(Ji(Ds+pi,Sn),si,St,0),Jd(Od(as,Os),no(Os-as))):Jd(0,St),Na&&Di?(qn==1?(Ds=tr,pi=Vn):(Ds=ur,pi=An),si=N[Kt],as=Z(Ji(Ds,er),si,jt,0),Os=Z(Ji(Ds+pi,er),si,jt,0),id(Od(as,Os),no(Os-as))):id(0,jt)}else Vs()}else{let Vt=no($o-Aa),Kt=no(Ic-yl);if(F.ori==1){let er=Vt;Vt=Kt,Kt=er}bi=mr.x&&Vt>=mr.dist,Di=mr.y&&Kt>=mr.dist;let mn=mr.uni;mn!=null?bi&&Di&&(bi=Vt>=mn,Di=Kt>=mn,!bi&&!Di&&(Kt>Vt?Di=!0:bi=!0)):mr.x&&mr.y&&(bi||Di)&&(bi=Di=!0);let vn,Sn;bi&&(F.ori==0?(vn=xs,Sn=ei):(vn=Wo,Sn=zr),Jd(Od(vn,Sn),no(Sn-vn)),Di||id(0,jt)),Di&&(F.ori==1?(vn=xs,Sn=ei):(vn=Wo,Sn=zr),id(Od(vn,Sn),no(Sn-vn)),bi||Jd(0,St)),!bi&&!Di&&(Jd(0,0),id(0,0))}if(mr._x=bi,mr._y=Di,de==null){if(Ge){if(kp!=null){let[Vt,Kt]=bs.scales;bs.values[0]=Vt!=null?va(F.ori==0?ei:zr,Vt):null,bs.values[1]=Kt!=null?va(F.ori==1?ei:zr,Kt):null}cd(KC,r,ei,zr,te,be,Ke)}if(wt){let Vt=Ge&&bs.setSeries,Kt=bt.prox;Hs==null?fo<=Kt&&hi(Gi,ys,!0,Vt):fo>Kt?hi(null,ys,!0,Vt):Gi!=Hs&&hi(Gi,ys,!0,Vt)}}ft&&(X.idx=Ke,Cp()),Me!==!1&&Is("setCursor")}let Ql=null;Object.defineProperty(r,"rect",{get(){return Ql==null&&ad(!1),Ql}});function ad(de=!1){de?Ql=null:(Ql=b.getBoundingClientRect(),Is("syncRect",Ql))}function Sm(de,Me,Ge,Ke,lt,St,jt){H._lock||Xa&&de!=null&&de.movementX==0&&de.movementY==0||(Ap(de,Me,Ge,Ke,lt,St,jt,!1,de!=null),de!=null?Zl(null,!0,!0):Zl(Me,!0,!1))}function Ap(de,Me,Ge,Ke,lt,St,jt,Vt,Kt){if(Ql==null&&ad(!1),ht(de),de!=null)Ge=de.clientX-Ql.left,Ke=de.clientY-Ql.top;else{if(Ge<0||Ke<0){ei=-10,zr=-10;return}let[mn,vn]=bs.scales,Sn=Me.cursor.sync,[er,Yr]=Sn.values,[tr,ur]=Sn.scales,[Vn,An]=bs.match,qn=Me.axes[0].side%2==1,Ji=F.ori==0?te:be,Ds=F.ori==1?te:be,pi=qn?St:lt,si=qn?lt:St,as=qn?Ke:Ge,Os=qn?Ge:Ke;if(tr!=null?Ge=Vn(mn,tr)?o(er,N[mn],Ji,0):-10:Ge=Ji*(as/pi),ur!=null?Ke=An(vn,ur)?o(Yr,N[vn],Ds,0):-10:Ke=Ds*(Os/si),F.ori==1){let Ya=Ge;Ge=Ke,Ke=Ya}}Kt&&(Me==null||Me.cursor.event.type==KC)&&((Ge<=1||Ge>=te-1)&&(Ge=wg(Ge,te)),(Ke<=1||Ke>=be-1)&&(Ke=wg(Ke,be))),Vt?(Aa=Ge,yl=Ke,[xs,Wo]=H.move(r,Ge,Ke)):(ei=Ge,zr=Ke)}const wm={width:0,height:0,left:0,top:0};function Vs(){bl(wm,!1)}let Mm,Tm,Em,Cm;function uu(de,Me,Ge,Ke,lt,St,jt){Xa=!0,bi=Di=mr._x=mr._y=!1,Ap(de,Me,Ge,Ke,lt,St,jt,!0,!1),de!=null&&(Ee(ZC,tR,od,!1),cd(RD,r,xs,Wo,te,be,null));let{left:Vt,top:Kt,width:mn,height:vn}=Wr;Mm=Vt,Tm=Kt,Em=mn,Cm=vn}function od(de,Me,Ge,Ke,lt,St,jt){Xa=mr._x=mr._y=!1,Ap(de,Me,Ge,Ke,lt,St,jt,!1,!0);let{left:Vt,top:Kt,width:mn,height:vn}=Wr,Sn=mn>0||vn>0,er=Mm!=Vt||Tm!=Kt||Em!=mn||Cm!=vn;if(Sn&&er&&bl(Wr),mr.setScale&&Sn&&er){let Yr=Vt,tr=mn,ur=Kt,Vn=vn;if(F.ori==1&&(Yr=Kt,tr=vn,ur=Vt,Vn=mn),bi&&ga(P,va(Yr,P),va(Yr+tr,P)),Di)for(let An in N){let qn=N[An];An!=P&&qn.from==null&&qn.min!=ts&&ga(An,va(ur+Vn,An),va(ur,An))}Vs()}else H.lock&&(H._lock=!H._lock,Zl(Me,!0,de!=null));de!=null&&(Pe(ZC,tR),cd(ZC,r,ei,zr,te,be,null))}function Np(de,Me,Ge,Ke,lt,St,jt){if(H._lock)return;ht(de);let Vt=Xa;if(Xa){let Kt=!0,mn=!0,vn=10,Sn,er;F.ori==0?(Sn=bi,er=Di):(Sn=Di,er=bi),Sn&&er&&(Kt=ei<=vn||ei>=te-vn,mn=zr<=vn||zr>=be-vn),Sn&&Kt&&(ei=ei<xs?0:te),er&&mn&&(zr=zr<Wo?0:be),Zl(null,!0,!0),Xa=!1}ei=-10,zr=-10,j.fill(null),Zl(null,!0,!0),Vt&&(Xa=Vt)}function Rp(de,Me,Ge,Ke,lt,St,jt){H._lock||(ht(de),_t(),Vs(),de!=null&&cd(ID,r,ei,zr,te,be,null))}function Am(){A.forEach(Vpe),mt(r.width,r.height,!0)}$g(g2,v1,Am);const Jl={};Jl.mousedown=uu,Jl.mousemove=Sm,Jl.mouseup=od,Jl.dblclick=Rp,Jl.setSeries=(de,Me,Ge,Ke)=>{let lt=bs.match[2];Ge=lt(r,Me,Ge),Ge!=-1&&hi(Ge,Ke,!0,!1)},ne&&(Ee(RD,b,uu),Ee(KC,b,Sm),Ee(kD,b,de=>{ht(de),ad(!1)}),Ee(PD,b,Np),Ee(ID,b,Rp),cR.add(r),r.syncRect=ad);const ld=r.hooks=t.hooks||{};function Is(de,Me,Ge){uo?Ps.push([de,Me,Ge]):de in ld&&ld[de].forEach(Ke=>{Ke.call(null,r,Me,Ge)})}(t.plugins||[]).forEach(de=>{for(let Me in de.hooks)ld[Me]=(ld[Me]||[]).concat(de.hooks[Me])});const du=(de,Me,Ge)=>Ge,bs=Ua({key:null,setSeries:!1,filters:{pub:GD,sub:GD},scales:[P,E[1]?E[1].scale:null],match:[WD,WD,du],values:[null,null]},H.sync);bs.match.length==2&&bs.match.push(du),H.sync=bs;const kp=bs.key,yh=qW(kp);function cd(de,Me,Ge,Ke,lt,St,jt){bs.filters.pub(de,Me,Ge,Ke,lt,St,jt)&&yh.pub(de,Me,Ge,Ke,lt,St,jt)}yh.sub(r);function Pp(de,Me,Ge,Ke,lt,St,jt){bs.filters.sub(de,Me,Ge,Ke,lt,St,jt)&&Jl[de](null,Me,Ge,Ke,lt,St,jt)}r.pub=Pp;function fu(){yh.unsub(r),cR.delete(r),Ue.clear(),iR(g2,v1,Am),c.remove(),ue==null||ue.remove(),Is("destroy")}r.destroy=fu;function Dc(){Is("init",t,e),ot(e||t.data,!1),B[P]?kc(P,B[P]):_t(),st=Wr.show&&(Wr.width>0||Wr.height>0),Le=ft=!0,mt(t.width,t.height)}return E.forEach(Gt),A.forEach(fn),n?n instanceof HTMLElement?(n.appendChild(c),Dc()):n(r,Dc):Dc(),r}ma.assign=Ua;ma.fmtNum=F8;ma.rangeNum=v2;ma.rangeLog=ST;ma.rangeAsinh=z8;ma.orient=Sv;ma.pxRatio=Ni;ma.join=Dhe;ma.fmtDate=B8,ma.tzDate=Whe;ma.sync=qW;{ma.addGap=Cpe,ma.clipGaps=TT;let t=ma.paths={points:JW};t.linear=t$,t.stepped=Rpe,t.bars=kpe,t.spline=Ipe}const s$=new Set(["timing_step_total","timing_step_active","timing_save_batch_total","timing_microbatch_count","timing_forward_total","timing_backward_total","timing_loss_computation_total","timing_compute_kl_total","timing_compute_entropy_total","timing_data_to_device_total","timing_prepare_tensors_total","timing_waiting_for_data","timing_weight_sync_trainer_total","timing_weight_sync_inference_total","timing_forward_microbatch_mean","timing_backward_microbatch_mean","timing_loss_computation_microbatch_mean","timing_compute_kl_microbatch_mean","timing_compute_entropy_microbatch_mean","timing_data_to_device_microbatch_mean","timing_prepare_tensors_microbatch_mean"]);function F0({label:t,onRemove:e}){return p.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[9px] bg-white border border-gray-300 text-gray-400 rounded-full cursor-pointer hover:bg-gray-50 transition-colors whitespace-nowrap shrink-0",onClick:n=>{n.stopPropagation(),e()},children:[t,p.jsx(Ju,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function a$(t){if(t.length<4)return null;const e=[...t].sort((c,d)=>c-d),n=e.length,r=(n-1)*.25,i=(n-1)*.75,s=e[Math.floor(r)]+r%1*(e[Math.ceil(r)]-e[Math.floor(r)]),a=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),o=a-s,l=6;return{lower:s-l*o,upper:a+l*o}}function o$(t){return t.split("/").pop()||t}function ov(t){var n;return((n=t.runName)==null?void 0:n.trim())||o$(t.runPath)}const Gpe=h1-1,hO="max-w-[190px]";function x_(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Wpe(t){const e=x_(t),{isTruncated:n,prefix:r,suffix:i}=LG(t,Gpe);return n?`<span class="inline-flex ${hO} min-w-0 items-center align-bottom" title="${e}"><span class="shrink-0">${x_(r)}</span><span class="shrink-0 px-0.5 text-muted-foreground/70">...</span><span class="shrink-0">${x_(i)}</span></span>`:`<span class="inline-block ${hO} truncate align-bottom" title="${e}">${x_(r)}</span>`}function X8(t){const e=Wpe(ov(t)),n=x_(o$(t.runPath));return`${e} <span class="text-muted-foreground/70">(${n})</span>`}function l$(t){const e=Math.abs(t);if(e>=60)return mT(t);if(e>0&&e<1){const n=t*1e3,r=Math.abs(n);return r<1?`${parseFloat(n.toFixed(2))}ms`:r<10?`${parseFloat(n.toFixed(1))}ms`:`${Math.round(n)}ms`}return nv(t)}const $pe=28;function qpe(t,e,n,r){if(!t||t.length===0||n<0||n>=t.length)return null;const i=Number(e[n]),s=c=>r==null?!0:Math.abs(Number(e[c])-i)<=r,a=t[n];if(a!=null)return s(n)?n:null;let o=n-1,l=n+1;for(;o>=0||l<t.length;){const c=o>=0?t[o]:void 0,d=l<t.length?t[l]:void 0,h=c!=null,g=d!=null;if(h&&g){const v=Math.abs(Number(e[o])-i),_=Math.abs(Number(e[l])-i)<v?l:o;return s(_)?_:null}if(h)return s(o)?o:null;if(g)return s(l)?l:null;o-=1,l+=1}return null}function o4(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const Xpe={reward:{title:"Reward",prefixes:[{prefix:"reward_sum",label:"Reward"}]},advantage:{title:"Advantage",prefixes:[{prefix:"advantage",label:"Advantage"}],showZeroLine:!0},rollouts:{title:"Rollouts",prefixes:[{prefix:"length_prompt",label:"Tokens (Prompt)"},{prefix:"length_completion",label:"Tokens (Completion)"},{prefix:"length_sum",label:"Tokens (Total)"}],unit:"tokens"}};function Ype(t){const e={...Xpe};if(t.length>0){const n=t.map(r=>({prefix:`reward_${r}`,label:Kpe(r)}));e.samples_metrics={title:"Samples Metrics",prefixes:n}}return e}function Kpe(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const c$=["mean","std","min","max"],u$={mean:"Mean",std:"Std",min:"Min",max:"Max"};function Y8(t,e){const n=typeof IntersectionObserver>"u",[r,i]=T.useState(n),[s,a]=T.useState(n),o=T.useRef(null),l=(e==null?void 0:e.root)??null,c=(e==null?void 0:e.rootMargin)??"0px",d=(e==null?void 0:e.threshold)??0;return T.useEffect(()=>{const h=t.current;if(!h||typeof IntersectionObserver>"u")return;const g=new IntersectionObserver(([v])=>{const b=v.isIntersecting;i(b),b?(o.current&&(clearTimeout(o.current),o.current=null),a(!0)):(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{a(!1),o.current=null},2e3))},{root:l,rootMargin:c,threshold:d});return g.observe(h),()=>{g.disconnect(),o.current&&clearTimeout(o.current)}},[t,l,c,d]),r||s}function Zpe({runs:t,shouldPoll:e,maxStep:n,maxTime:r,showEma:i=!1,emaSpan:s=10,hoveredRunId:a=null,availableRewardNames:o=[],customMetricSections:l={},xAxisMode:c="step",scrollRoot:d=null,evalsList:h=[]}){var be,me,ge,ke,Xe,Ae,je,We,De,Be,qe,Se,Ye,dt,Le,st,ft,mt,tt,Qe;const[g,v]=T.useState({}),[b,_]=T.useState(!0),[w,S]=T.useState(!0),[E,A]=T.useState(!0),[N,D]=T.useState(!0),[P,L]=T.useState({}),[R,O]=T.useState(!0),[W,F]=T.useState(!0),[V,G]=T.useState(!0),Z=T.useMemo(()=>Ype(o),[o]),B=c==="time",q=Or(((be=t[0])==null?void 0:be.runPath)||"",B&&!!t[0],e),K=Or(((me=t[1])==null?void 0:me.runPath)||"",B&&!!t[1],e),Y=Or(((ge=t[2])==null?void 0:ge.runPath)||"",B&&!!t[2],e),Q=Or(((ke=t[3])==null?void 0:ke.runPath)||"",B&&!!t[3],e),U=Or(((Xe=t[4])==null?void 0:Xe.runPath)||"",B&&!!t[4],e),j=Or(((Ae=t[5])==null?void 0:Ae.runPath)||"",B&&!!t[5],e),X=Or(((je=t[6])==null?void 0:je.runPath)||"",B&&!!t[6],e),H=Or(((We=t[7])==null?void 0:We.runPath)||"",B&&!!t[7],e),ie=Or(((De=t[8])==null?void 0:De.runPath)||"",B&&!!t[8],e),ne=Or(((Be=t[9])==null?void 0:Be.runPath)||"",B&&!!t[9],e),re=Or(((qe=t[10])==null?void 0:qe.runPath)||"",B&&!!t[10],e),ue=Or(((Se=t[11])==null?void 0:Se.runPath)||"",B&&!!t[11],e),le=Or(((Ye=t[12])==null?void 0:Ye.runPath)||"",B&&!!t[12],e),fe=Or(((dt=t[13])==null?void 0:dt.runPath)||"",B&&!!t[13],e),we=Or(((Le=t[14])==null?void 0:Le.runPath)||"",B&&!!t[14],e),pe=Or(((st=t[15])==null?void 0:st.runPath)||"",B&&!!t[15],e),xe=Or(((ft=t[16])==null?void 0:ft.runPath)||"",B&&!!t[16],e),Ve=Or(((mt=t[17])==null?void 0:mt.runPath)||"",B&&!!t[17],e),ye=Or(((tt=t[18])==null?void 0:tt.runPath)||"",B&&!!t[18],e),Oe=Or(((Qe=t[19])==null?void 0:Qe.runPath)||"",B&&!!t[19],e),{isStepTimesFetching:he,isStepTimesRefetching:Re}=T.useMemo(()=>{if(!B)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const ze=[q,K,Y,Q,U,j,X,H,ie,ne,re,ue,le,fe,we,pe,xe,Ve,ye,Oe],Te=ze.some(ht=>ht.isFetching),He=ze.filter(ht=>ht.isFetching),et=Te&&He.length>0&&He.every(ht=>!!ht.data);return{isStepTimesFetching:Te,isStepTimesRefetching:et}},[B,q,K,Y,Q,U,j,X,H,ie,ne,re,ue,le,fe,we,pe,xe,Ve,ye,Oe]),{stepTimesByRun:oe,firstStepTimesByRun:Ue}=T.useMemo(()=>{if(!B)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const ze=[q,K,Y,Q,U,j,X,H,ie,ne,re,ue,le,fe,we,pe,xe,Ve,ye,Oe],Te=new Map,He=new Map;return t.forEach((et,ht)=>{if(ht>=20)return;const bt=ze[ht].data;if(!bt||bt.first_step_time===null||bt.first_step_time===void 0||!bt.step_times||bt.step_times.length===0)return;const wt=new Map;bt.step_times.forEach(Pt=>{typeof Pt.time=="number"&&wt.set(Pt.step,Pt.time)}),wt.size>0&&(Te.set(et.runPath,wt),He.set(et.runPath,bt.first_step_time))}),{stepTimesByRun:Te,firstStepTimesByRun:He}},[t,B,q,K,Y,Q,U,j,X,H,ie,ne,re,ue,le,fe,we,pe,xe,Ve,ye,Oe]),Ee={xAxisMode:c,stepTimesByRun:oe,firstStepTimesByRun:Ue,isStepTimesFetching:he,isStepTimesRefetching:Re,scrollRoot:d,maxStepLimit:n,maxTimeLimit:r},Pe=T.useMemo(()=>Object.keys(l),[l]),Ze=T.useCallback(ze=>{v(Te=>({...Te,[ze]:!(Te[ze]??!0)}))},[]),ae=T.useCallback(ze=>{L(Te=>({...Te,[ze]:!(Te[ze]??!0)}))},[]),te=h.length>0;return p.jsxs("div",{className:"-mt-3",children:[Pe.map((ze,Te)=>{const He=g[ze]??!0,et=l[ze]??{},ht=Object.entries(et);return p.jsxs("div",{children:[Te>0&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:He,onOpenChange:()=>Ze(ze),children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!He&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:o4(ze)})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-4 mt-3 mb-4",children:ht.map(([ct,bt])=>p.jsxs("div",{children:[ct&&p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:o4(ct)}),p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:bt.map(wt=>p.jsx(Hr,{runs:t,shouldPoll:e,metricName:wt,label:o4(wt),showEma:i,emaSpan:s,hoveredRunId:a,...Ee},wt))})]},ct))})})]})]},ze)}),Pe.length>0&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:b,onOpenChange:_,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!b&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:Z.reward.title})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:Z.reward.prefixes.map(ze=>p.jsx(rg,{runs:t,shouldPoll:e,prefix:ze.prefix,label:ze.label,hideGroupLabel:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ee,extraCharts:ze.prefix==="reward_sum"?p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"reward_gini_mean",label:`${ze.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:a,...Ee}):void 0},ze.prefix))})})]}),Z.samples_metrics&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:w,onOpenChange:S,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!w&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:Z.samples_metrics.title})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:Z.samples_metrics.prefixes.map(ze=>p.jsx(rg,{runs:t,shouldPoll:e,prefix:ze.prefix,label:ze.label,showEma:i,emaSpan:s,hoveredRunId:a,...Ee,extraCharts:p.jsx(Hr,{runs:t,shouldPoll:e,metricName:`${ze.prefix}_gini_mean`,label:`${ze.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:a,...Ee})},ze.prefix))})})]})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:E,onOpenChange:A,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!E&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:Z.advantage.title})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:Z.advantage.prefixes.map(ze=>p.jsx(rg,{runs:t,shouldPoll:e,prefix:ze.prefix,label:ze.label,hideGroupLabel:!0,showZeroLine:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ee},ze.prefix))})})]}),te&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:N,onOpenChange:D,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!N&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"Evals"})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"mt-3 mb-4 space-y-4",children:h.map((ze,Te)=>{const He=ze.eval_name,et=ze.available_rollout_metric_names,ht=P[He]??!0;return p.jsxs("div",{children:[Te>0&&p.jsx("div",{className:"border-t border-gray-100 my-3"}),p.jsxs(Ki,{open:ht,onOpenChange:()=>ae(He),children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-3.5 w-3.5 text-muted-foreground transition-transform",!ht&&"-rotate-90")}),p.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:He})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3",children:[et.map(ct=>p.jsx(l4,{runs:t,shouldPoll:e,evalName:He,prefix:`reward_${ct}`,label:o4(ct),showEma:i,emaSpan:s,hoveredRunId:a,scrollRoot:d,xAxisMode:c,stepTimesByRun:Ee.stepTimesByRun,firstStepTimesByRun:Ee.firstStepTimesByRun,isStepTimesFetching:Ee.isStepTimesFetching,isStepTimesRefetching:Ee.isStepTimesRefetching,maxStepLimit:Ee.maxStepLimit,maxTimeLimit:Ee.maxTimeLimit},`${He}-reward_${ct}`)),p.jsx(l4,{runs:t,shouldPoll:e,evalName:He,prefix:"length_completion",label:"Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,scrollRoot:d,xAxisMode:c,stepTimesByRun:Ee.stepTimesByRun,firstStepTimesByRun:Ee.firstStepTimesByRun,isStepTimesFetching:Ee.isStepTimesFetching,isStepTimesRefetching:Ee.isStepTimesRefetching,maxStepLimit:Ee.maxStepLimit,maxTimeLimit:Ee.maxTimeLimit}),p.jsx(l4,{runs:t,shouldPoll:e,evalName:He,prefix:"length_prompt",label:"Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,scrollRoot:d,xAxisMode:c,stepTimesByRun:Ee.stepTimesByRun,firstStepTimesByRun:Ee.firstStepTimesByRun,isStepTimesFetching:Ee.isStepTimesFetching,isStepTimesRefetching:Ee.isStepTimesRefetching,maxStepLimit:Ee.maxStepLimit,maxTimeLimit:Ee.maxTimeLimit}),p.jsx(l4,{runs:t,shouldPoll:e,evalName:He,prefix:"length_sum",label:"Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,scrollRoot:d,xAxisMode:c,stepTimesByRun:Ee.stepTimesByRun,firstStepTimesByRun:Ee.firstStepTimesByRun,isStepTimesFetching:Ee.isStepTimesFetching,isStepTimesRefetching:Ee.isStepTimesRefetching,maxStepLimit:Ee.maxStepLimit,maxTimeLimit:Ee.maxTimeLimit})]})})]})]},He)})})})]})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:R,onOpenChange:O,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!R&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:Z.rollouts.title})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[Z.rollouts.prefixes.map(ze=>p.jsx(rg,{runs:t,shouldPoll:e,prefix:ze.prefix,label:ze.label,unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ee},ze.prefix)),p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"General"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:a,...Ee})]})]})]})})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:W,onOpenChange:F,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!W&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"Discarded Rollouts"})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Discarded Rollouts General"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_count",label:"Discarded Count",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_pct",label:"Zero Advantage %",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_max_async_pct",label:"Max Async %",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:a,...Ee})]})]}),p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Zero Advantage Breakdown"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_zero_pct",label:"Zero Advantage (All Reward = 0) %",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_positive_pct",label:"Zero Advantage (All Reward > 0) %",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_mean_reward",label:"Zero Advantage Mean Reward",showEma:i,emaSpan:s,hoveredRunId:a,...Ee})]})]}),p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Canceled"}),p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"canceled_count",label:"Canceled Count",showEma:i,emaSpan:s,hoveredRunId:a,...Ee})})]}),p.jsx(rg,{runs:t,shouldPoll:e,prefix:"discarded_length_prompt",label:"Discarded Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(rg,{runs:t,shouldPoll:e,prefix:"discarded_length_completion",label:"Discarded Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(rg,{runs:t,shouldPoll:e,prefix:"discarded_length_sum",label:"Discarded Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:a,...Ee})]})})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:V,onOpenChange:G,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!V&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"Timeline"})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Full Step (Total Time)"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_step_total",label:"Time per Step",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_step_active",label:"Time per Step Active (Excl. Wait)",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_save_batch_total",label:"Batch Completion (Save Batch)",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_microbatch_count",label:"Microbatches per Step",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_forward_total",label:"Forward",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_backward_total",label:"Backward",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_total",label:"Loss Computation",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_total",label:"Compute KL",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_total",label:"Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_total",label:"Data to Device",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_total",label:"Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_waiting_for_data",label:"Waiting for Data",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_trainer_total",label:"Weight Broadcast (Trainer)",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_inference_total",label:"Weight Broadcast (Inference)",showEma:i,emaSpan:s,hoveredRunId:a,...Ee})]})]}),p.jsxs("div",{children:[p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Microbatch (Mean Time per Microbatch)"}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_forward_microbatch_mean",label:"Forward",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_backward_microbatch_mean",label:"Backward",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_microbatch_mean",label:"Loss Computation",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_microbatch_mean",label:"Compute KL",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_microbatch_mean",label:"Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_microbatch_mean",label:"Data to Device",showEma:i,emaSpan:s,hoveredRunId:a,...Ee}),p.jsx(Hr,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_microbatch_mean",label:"Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:a,...Ee})]})]})]})})]})]})}const y2=100;function Qpe(t,e,n){const r=t.length;if(r<=y2)return{steps:t,counts:e};const i=Math.ceil(r/y2),s=[],a=[],o=n.length-1;for(let l=0;l<r;l+=i){const c=Math.min(l+i,r),d=Math.floor((l+c-1)/2);s.push(t[d]);const h=new Array(o).fill(0);for(let g=l;g<c;g++){const v=e[g];for(let b=0;b<o;b++)h[b]+=v[b]||0}a.push(h)}return{steps:s,counts:a}}function d$({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,shouldPoll:s,scrollRoot:a=null,headerPrefix:o,headerSuffix:l}){const c=T.useRef(null),d=T.useRef(null),h=T.useRef(null),g=T.useRef(null),v=T.useRef(null),b=Y8(c,{root:a,threshold:0}),{data:_,isFetching:w,isRefetching:S}=IG(t,e,b&&!!t&&!!e,s),E=_&&_.steps.length>0&&_.bin_edges.length>0,A=E&&_.steps.length>y2,N=T.useMemo(()=>!E||!_?null:A?Qpe(_.steps,_.counts,_.bin_edges):{steps:_.steps,counts:_.counts},[E,_,A]),D=T.useCallback(F=>F==null?"N/A":i?Math.round(F).toLocaleString():qu(F),[i]),P=T.useCallback(F=>Math.abs(F)>=1e3?`${parseFloat((F/1e3).toFixed(1))}k`:i?Math.round(F).toString():Number.isInteger(F)?F.toLocaleString():Math.abs(F)<.01&&F!==0?F.toExponential(1):String(parseFloat(F.toFixed(2))),[i]),L=T.useCallback(()=>{const F={top:8,right:8,bottom:24,left:40};if(!h.current||!_)return F;const V=h.current.getContext("2d");if(!V)return F;const G="10px system-ui, sans-serif",Z=5;let B=0;V.save(),V.setTransform(1,0,0,1,0,0),V.font=G;for(let q=0;q<Z;q++){const K=(_.global_min??0)+q/(Z-1)*((_.global_max??0)-(_.global_min??0)),Y=P(K);B=Math.max(B,V.measureText(Y).width)}return V.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(B)+12)}},[_,P]);T.useEffect(()=>{if(!d.current||!h.current||!E||!_||!N)return;const F=d.current,V=h.current,G=V.getContext("2d");if(!G)return;const Z=F.clientWidth,B=200,q="rgba(100, 100, 100, 0.9)",K="rgba(128, 128, 128, 0.15)",Y="10px system-ui, sans-serif",Q=window.devicePixelRatio||1;V.width=Z*Q,V.height=B*Q,V.style.width=`${Z}px`,V.style.height=`${B}px`,G.scale(Q,Q),G.font=Y,G.clearRect(0,0,Z,B);const U=L(),j=Z-U.left-U.right,X=B-U.top-U.bottom,H=N.steps,ie=_.bin_edges,ne=N.counts,re=H.length,ue=ie.length-1;if(re===0||ue===0)return;let le=0;for(const he of ne)for(const Re of he)Re>le&&(le=Re);const fe=Math.min(5,re),we=5,pe=j/Math.max(re,1),xe=he=>U.left+(he+.5)*pe,Ve=he=>{const Re=(_.global_max??1)-(_.global_min??0),oe=(he-(_.global_min??0))/(Re||1);return U.top+X-oe*X},ye=he=>he===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(he/le)*.75})`;G.strokeStyle=K,G.lineWidth=1;for(let he=0;he<fe;he++){const Re=Math.floor(he/Math.max(fe-1,1)*(re-1)),oe=xe(Re);G.beginPath(),G.moveTo(oe,U.top),G.lineTo(oe,B-U.bottom),G.stroke()}for(let he=0;he<we;he++){const Re=(_.global_min??0)+he/(we-1)*((_.global_max??0)-(_.global_min??0)),oe=Ve(Re);G.beginPath(),G.moveTo(U.left,oe),G.lineTo(Z-U.right,oe),G.stroke()}const Oe=pe;for(let he=0;he<re;he++){const Re=U.left+he*pe,oe=ne[he];for(let Ue=0;Ue<ue;Ue++){const Ee=oe[Ue];if(Ee===0)continue;const Pe=ie[Ue+1],Ze=ie[Ue],ae=Ve(Pe),te=Ve(Ze),be=Math.max(1,te-ae);G.fillStyle=ye(Ee),G.fillRect(Re,ae,Oe,be)}}if(r&&(_.global_min??0)<0&&(_.global_max??0)>0){const he=Ve(0);G.strokeStyle="rgba(128, 128, 128, 0.5)",G.lineWidth=1,G.setLineDash([5,5]),G.beginPath(),G.moveTo(U.left,he),G.lineTo(Z-U.right,he),G.stroke(),G.setLineDash([])}G.strokeStyle=q,G.lineWidth=1,G.beginPath(),G.moveTo(U.left,B-U.bottom),G.lineTo(Z-U.right,B-U.bottom),G.stroke(),G.beginPath(),G.moveTo(U.left,U.top),G.lineTo(U.left,B-U.bottom),G.stroke(),G.fillStyle=q,G.font=Y,G.textAlign="center";for(let he=0;he<fe;he++){const Re=Math.floor(he/Math.max(fe-1,1)*(re-1)),oe=H[Re],Ue=xe(Re),Ee=oe>=1e3?`${(oe/1e3).toFixed(0)}k`:oe.toString();G.fillText(Ee,Ue,B-6)}G.textAlign="right",G.textBaseline="middle";for(let he=0;he<we;he++){const Re=(_.global_min??0)+he/(we-1)*((_.global_max??0)-(_.global_min??0)),oe=Ve(Re);G.fillText(P(Re),U.left-4,oe)}},[_,N,E,r,P,L]),T.useEffect(()=>{if(!d.current)return;const F=d.current,V=new ResizeObserver(()=>{if(h.current&&d.current){const G=d.current.clientWidth;h.current.style.width=`${G}px`}});return V.observe(F),()=>{V.disconnect()}},[]);const R=T.useCallback(F=>{var Ee;if(!_||!N||!g.current||!h.current||!d.current)return;const V=h.current.getBoundingClientRect(),G=F.clientX-V.left,Z=F.clientY-V.top,B=d.current.clientWidth,q=200,K=L(),Y=B-K.left-K.right,Q=q-K.top-K.bottom;if(Y<=0||Q<=0){v.current&&(v.current.style.display="none");return}if(G<K.left||G>B-K.right||Z<K.top||Z>q-K.bottom){g.current.style.display="none",v.current&&(v.current.style.display="none");return}const U=(G-K.left)/Y,j=Math.min(N.steps.length-1,Math.max(0,Math.round(U*(N.steps.length-1)))),X=N.steps[j];if(v.current){const Pe=Y/Math.max(N.steps.length,1),Ze=K.left+(j+.5)*Pe;v.current.style.display="block",v.current.style.left=`${Ze}px`,v.current.style.top=`${K.top}px`,v.current.style.bottom=`${K.bottom}px`}const H=1-(Z-K.top)/Q,ie=_.bin_edges.length-1,ne=Math.min(ie-1,Math.max(0,Math.floor(H*ie))),re=_.bin_edges[ne],ue=_.bin_edges[ne+1],le=((Ee=N.counts[j])==null?void 0:Ee[ne])??0,we=(N.counts[j]??[]).reduce((Pe,Ze)=>Pe+Ze,0),pe=we>0?(le/we*100).toFixed(1):"0.0",Ve=A&&_.steps.length>y2?" (aggregated)":"";g.current.innerHTML=`
        <div class="font-medium mb-1">Step ${X.toLocaleString()}${Ve}</div>
        <div class="text-muted-foreground">Range: ${D(re)} to ${D(ue)}</div>
        <div class="text-muted-foreground">Count: ${le.toLocaleString()} (${pe}%)</div>
      `,g.current.style.display="block",g.current.style.left="0px",g.current.style.top="0px";const ye=g.current.getBoundingClientRect(),Oe=F.clientX;let he=Oe;he+ye.width+20>window.innerWidth&&(he=Oe-ye.width);const Re=Math.max(4,window.innerWidth-ye.width-4);he=Math.min(Math.max(4,he),Re);const oe=d.current.getBoundingClientRect();let Ue=oe.top-ye.height+20;Ue<4&&(Ue=oe.bottom-20),g.current.style.left=`${he-ye.left}px`,g.current.style.top=`${Ue-ye.top}px`},[_,N,D,L,A]),O=T.useCallback(()=>{g.current&&(g.current.style.display="none"),v.current&&(v.current.style.display="none")},[]),W=w&&!S;return p.jsxs("div",{ref:c,className:Rt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white",W&&"opacity-50"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-3",children:[o,p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:n,children:n})}),l&&p.jsx("div",{className:"flex items-center gap-2 shrink-0",children:l})]}),E?p.jsxs("div",{className:"h-[200px] relative bg-white rounded",ref:d,children:[p.jsx("canvas",{className:"block w-full h-full max-w-full",ref:h,onMouseMove:R,onMouseLeave:O}),p.jsx("div",{ref:v,className:"absolute z-[2] border-l border-dashed border-gray-500/70 pointer-events-none",style:{display:"none"}}),p.jsx("div",{ref:g,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),S&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"h-[200px] flex items-center justify-center text-muted-foreground text-xs rounded",children:w?"Loading...":"No data"})]})}function Jpe(t,e,n,r,i){const s=T.useMemo(()=>t.slice(0,20).map(l=>l.runPath).filter(Boolean),[t]),a=Sue(s,e,n?[n]:[],i&&s.length>0&&!!n,r);return{metricsByRunPath:T.useMemo(()=>{var c,d;const l=new Map;return(d=(c=a.data)==null?void 0:c.runs)==null||d.forEach(h=>{l.set(h.run_path,h.metrics??[])}),l},[a.data]),isFetching:a.isFetching,isRefetching:a.isFetching&&!!a.data}}function f$({runs:t,shouldPoll:e,evalName:n,metricName:r,label:i,unit:s,showZeroLine:a,statType:o,isTokenMetric:l,showEma:c=!1,emaSpan:d=10,hoveredRunId:h=null,xAxisMode:g="step",stepTimesByRun:v,firstStepTimesByRun:b,isStepTimesFetching:_=!1,isStepTimesRefetching:w=!1,scrollRoot:S=null,maxStepLimit:E,maxTimeLimit:A,headerPrefix:N,headerSuffix:D}){const P=T.useRef(null),L=T.useRef(null),R=T.useRef(null),O=T.useRef(null),[W,F]=cn(CG),V=T.useMemo(()=>`eval-metric-${n}-${r}`,[n,r]),G=T.useRef(!1),Z=T.useRef(!1);T.useEffect(()=>{const We=Be=>{(Be.key==="Control"||Be.key==="Meta")&&(Z.current=!0)},De=Be=>{(Be.key==="Control"||Be.key==="Meta")&&(Z.current=!1,F(null))};return window.addEventListener("keydown",We),window.addEventListener("keyup",De),()=>{window.removeEventListener("keydown",We),window.removeEventListener("keyup",De)}},[F]);const B=`eval/${n}/${r}`,[q,K]=cn(yG),Q=s$.has(r),U=q[B],j=(U==null?void 0:U.ignoreOutliers)??!1,X=(U==null?void 0:U.ignoreFirstStep)??Q,H=(U==null?void 0:U.minY)??null,ie=(U==null?void 0:U.maxY)??null,ne=T.useCallback(We=>{K(De=>{const Be={ignoreOutliers:!1,ignoreFirstStep:Q,minY:null,maxY:null},qe=De[B]??Be,Se=We(qe);if(Se.ignoreOutliers===Be.ignoreOutliers&&Se.ignoreFirstStep===Be.ignoreFirstStep&&Se.minY===Be.minY&&Se.maxY===Be.maxY){if(!Object.prototype.hasOwnProperty.call(De,B))return De;const dt={...De};return delete dt[B],dt}return{...De,[B]:Se}})},[B,K,Q]),re=T.useCallback(We=>{ne(De=>({...De,ignoreOutliers:We}))},[ne]),ue=T.useCallback(We=>{ne(De=>({...De,ignoreFirstStep:We}))},[ne]),le=T.useCallback(We=>{ne(De=>({...De,minY:We}))},[ne]),fe=T.useCallback(We=>{ne(De=>({...De,maxY:We}))},[ne]),we=Y8(P,{root:S,threshold:0}),pe=T.useMemo(()=>{const We=t.filter(Be=>!Be.isSelected),De=t.filter(Be=>Be.isSelected);return[...We,...De]},[t]),xe=T.useMemo(()=>pe.slice(0,20),[pe]),Ve=T.useMemo(()=>{const We=new Map;return xe.forEach((De,Be)=>{We.set(De.runPath,Be)}),We},[xe]),{metricsByRunPath:ye,isFetching:Oe,isRefetching:he}=Jpe(t,n,r,e,we),{uplotData:Re,seriesConfig:oe,isFetching:Ue,isRefetching:Ee,hasData:Pe,timeToStepByRun:Ze,outlierBounds:ae}=T.useMemo(()=>{const We=new Set,De=new Map,Be=new Map,qe=new Map,Se=g==="time"&&!!v&&!!b,Ye=Oe;pe.forEach((ze,Te)=>{if(Te>=20)return;const He=ye.get(ze.runPath)??[],et=new Map;if(He.forEach(ht=>{We.add(ht.step),et.set(ht.step,ht.value)}),De.set(Te,et),Se){const ht=v==null?void 0:v.get(ze.runPath),ct=b==null?void 0:b.get(ze.runPath);if(ht&&ct!==void 0){const bt=new Map,wt=new Map;ht.forEach((Pt,$e)=>{const Tt=Pt-ct;bt.set($e,Tt),wt.set(Tt,$e)}),Be.set(Te,bt),qe.set(Te,wt)}}});const dt=()=>!(!Ye&&!_||Ye&&!he||_&&!w);if(We.size===0)return{uplotData:null,seriesConfig:[],isFetching:Ye||_,isRefetching:dt(),hasData:!1,timeToStepByRun:qe,outlierBounds:null};let Le=Array.from(We).sort((ze,Te)=>ze-Te);E!=null&&!Se&&(Le=Le.filter(ze=>ze<=E));let st=Le;if(Se){const ze=new Set;if(De.forEach((He,et)=>{const ht=Be.get(et);ht&&He.forEach((ct,bt)=>{const wt=ht.get(bt);wt!==void 0&&ze.add(wt)})}),ze.size===0)return{uplotData:null,seriesConfig:[],isFetching:Ye||_,isRefetching:dt(),hasData:!1,timeToStepByRun:qe,outlierBounds:null};let Te=Array.from(ze).sort((He,et)=>He-et);A!=null&&(Te=Te.filter(He=>He<=A)),st=Te}let ft=null;if(j){const ze=[];De.forEach(Te=>{Te.forEach(He=>{ze.push(He)})}),ft=a$(ze)}const mt=new Float64Array(st),tt=[{label:Se?"Time (s)":"Step"}],Qe=[mt];return pe.forEach((ze,Te)=>{if(Te>=20)return;const He=De.get(Te)||new Map;let et;if(Se){const wt=Be.get(Te),Pt=new Map;wt&&He.forEach(($e,Tt)=>{const Et=wt.get(Tt);Et!==void 0&&Pt.set(Et,$e)}),et=st.map($e=>Pt.get($e)??null)}else et=Le.map(wt=>He.get(wt)??null);const ht=h===ze.runPath,bt=h!==null&&!ht?.1:c?.3:1;Qe.push(et),tt.push({label:ov(ze),stroke:ze.color,width:1,alpha:bt,spanGaps:!0,points:{show:!1}})}),c&&pe.forEach((ze,Te)=>{if(Te>=20)return;const He=De.get(Te)||new Map,et=2/(d+1);let ht=null,ct;if(Se){const $e=Be.get(Te),Tt=new Map;Le.forEach(Et=>{const Ot=He.get(Et);if(Ot!==void 0){ht=ht===null?Ot:et*Ot+(1-et)*ht;const Gt=$e==null?void 0:$e.get(Et);Gt!==void 0&&ht!==null&&Tt.set(Gt,ht)}}),ct=st.map(Et=>Tt.get(Et)??null)}else{const $e=[];Le.forEach(Tt=>{const Et=He.get(Tt);Et!==void 0?(ht=ht===null?Et:et*Et+(1-et)*ht,$e.push(ht)):$e.push(null)}),ct=$e}const bt=h===ze.runPath,Pt=h!==null&&!bt?.1:1;Qe.push(ct),tt.push({label:`${ov(ze)} (EMA)`,stroke:ze.color,width:1.5,alpha:Pt,spanGaps:!0,points:{show:!1}})}),{uplotData:Qe,seriesConfig:tt,isFetching:Ye||_,isRefetching:dt(),hasData:!0,timeToStepByRun:qe,outlierBounds:ft}},[pe,ye,Oe,he,c,d,h,g,v,b,_,w,E,A,j]),te=o||r.split("_").pop()||"",be=g==="time",me=T.useCallback(We=>We==null?"N/A":l&&(te==="min"||te==="max")?Math.round(We).toLocaleString():qu(We),[l,te]),ge=T.useCallback(We=>Math.abs(We)>=1e3?`${parseFloat((We/1e3).toFixed(1))}k`:l?te==="min"||te==="max"?Math.round(We).toString():String(parseFloat(We.toFixed(1))):Number.isInteger(We)?We.toLocaleString():Math.abs(We)<.01&&We!==0?We.toExponential(1):String(parseFloat(We.toFixed(2))),[l,te]),ke=T.useCallback(We=>be?nv(We):We>=1e3?`${(We/1e3).toFixed(0)}k`:We.toString(),[be]);T.useEffect(()=>{if(!L.current||!Re||!Pe)return;const We=L.current,De=We.clientWidth,Be=We.clientHeight||192;let qe=1/0,Se=-1/0;for(let ht=1;ht<Re.length;ht++){const ct=Re[ht];for(let bt=0;bt<ct.length;bt++){if(X&&bt===0)continue;const wt=ct[bt];wt!=null&&(j&&ae?wt>=ae.lower&&wt<=ae.upper&&(wt<qe&&(qe=wt),wt>Se&&(Se=wt)):(wt<qe&&(qe=wt),wt>Se&&(Se=wt)))}}qe===1/0&&ae&&(qe=ae.lower,Se=ae.upper);const Ye=Se-qe,dt=Math.max(Math.abs(Se),Math.abs(qe)),Le=Math.max(dt*.05,1e-10),st=Math.max(Ye*.1,Le);let ft,mt;a?(ft=Math.min(qe-st,0),mt=Math.max(Se+st,0)):(ft=qe-st,mt=Se+st),H!==null&&(ft=H),ie!==null&&(mt=ie);const tt="rgba(128, 128, 128, 0.15)",Qe="rgba(100, 100, 100, 0.9)",Te={width:De,height:Be,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[ft,mt]}},axes:[{stroke:Qe,grid:{stroke:tt,width:1},ticks:{stroke:tt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(ht,ct)=>ct.map(ke)},{stroke:Qe,grid:{stroke:tt,width:1},ticks:{stroke:tt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(ht,ct)=>{if(!ct||ct.length===0)return 40;const bt=Math.max(...ct.map(wt=>wt.length));return Math.max(40,bt*7+14)},values:(ht,ct)=>ct.map(ge)}],series:oe,hooks:{draw:[ht=>{var $e,Tt;if(!Re)return;const ct=Re[0],bt=Math.min(pe.length,20),wt=ht.series.length,Pt=ht.ctx;Pt.save();for(let Et=1;Et<wt;Et++){const Ot=Re[Et];if(!Ot)continue;let Gt=-1;for(let bn=Ot.length-1;bn>=0;bn--)if(Ot[bn]!==null&&Ot[bn]!==void 0){Gt=bn;break}if(Gt===-1)continue;const an=ct[Gt],On=Ot[Gt];if(an===void 0||On===void 0||On===null)continue;const Bt=ht.valToPos(Number(an),"x",!0),fn=ht.valToPos(Number(On),"y",!0);if(!Number.isFinite(Bt)||!Number.isFinite(fn))continue;const Ht=ht.series[Et],In=typeof(Ht==null?void 0:Ht.alpha)=="number"?Ht.alpha:1;let Nn=typeof(Ht==null?void 0:Ht.stroke)=="string"?Ht.stroke:void 0;if(!Nn){const bn=Et-1;if(bn<bt)Nn=($e=pe[bn])==null?void 0:$e.color;else if(c){const Ln=bn-bt;Ln>=0&&Ln<bt&&(Nn=(Tt=pe[Ln])==null?void 0:Tt.color)}}Nn&&(Pt.globalAlpha=In,Pt.fillStyle=Nn,Pt.beginPath(),Pt.arc(Bt,fn,4,0,Math.PI*2),Pt.fill())}Pt.restore()}],setCursor:[ht=>{if(!O.current)return;const{left:ct,top:bt,idx:wt}=ht.cursor;if(wt==null||ct===void 0||bt===void 0||ct<0){O.current.style.display="none";return}const Pt=Re[0][wt];if(Pt===void 0){O.current.style.display="none";return}Z.current&&!G.current&&F({xValue:Number(Pt),sourceChartId:V});let Tt=`<div class="font-medium mb-1">${be?`Time ${l$(Number(Pt))}`:`Step ${Number(Pt).toLocaleString()}`}</div>`;const Et=xe.length;t.forEach(Bt=>{var Ln;const fn=Ve.get(Bt.runPath);if(fn===void 0)return;const Ht=fn+1,In=Re[Ht];if(!In)return;const Nn=In[wt];let bn;if(c){const Fn=Et+fn+1;bn=(Ln=Re[Fn])==null?void 0:Ln[wt]}Nn!=null&&(Tt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Bt.color}"></div>
                    <span>${X8(Bt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${c?.7:1}">${me(Nn)}${s?` ${s}`:""}</span>
                    ${c&&bn!==void 0&&bn!==null?`<span class="text-muted-foreground">(EMA: ${me(bn)})</span>`:""}
                  </div>
                </div>
              `)}),O.current.innerHTML=Tt,O.current.style.display="block";const Ot=L.current.getBoundingClientRect(),Gt=O.current.getBoundingClientRect();let an=Ot.left+ct+15;an+Gt.width+20>window.innerWidth&&(an=Ot.left+ct-Gt.width-15+ht.bbox.left),an=Math.max(4,an);let On=Ot.top-Gt.height+20;On<4&&(On=Ot.bottom-20),O.current.style.left=`${an}px`,O.current.style.top=`${On}px`}]}};R.current&&R.current.destroy();const He=new ma(Te,Re,We);R.current=He;const et=new ResizeObserver(ht=>{for(const ct of ht){const{width:bt,height:wt}=ct.contentRect;He&&bt>0&&wt>0&&He.setSize({width:bt,height:wt})}});return et.observe(We),()=>{et.disconnect(),He.destroy(),R.current=null}},[Re,oe,Pe,ke,ge,me,be,Ze,pe,h,c,a,s,t,xe,Ve,V,F,j,X,ae,H,ie]),T.useEffect(()=>{if(!W){O.current&&(O.current.style.display="none");return}if(W.sourceChartId===V||!R.current||!Re)return;const We=R.current,De=Re[0];if(!De||De.length===0)return;const Be=W.xValue;let qe=0,Se=1/0;for(let dt=0;dt<De.length;dt++){const Le=Math.abs(Number(De[dt])-Be);Le<Se&&(Se=Le,qe=dt)}const Ye=We.valToPos(Number(De[qe]),"x");Ye>=0&&Ye<=We.width&&(G.current=!0,We.setCursor({left:Ye,top:0}),G.current=!1)},[W,V,Re]);const Xe=T.useCallback(()=>{O.current&&(O.current.style.display="none"),(W==null?void 0:W.sourceChartId)===V&&F(null)},[W,V,F]),Ae=Ue&&!Ee,je=i||(te?`${te.charAt(0).toUpperCase()}${te.slice(1)}`:r);return p.jsxs("div",{ref:P,className:Rt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white h-[246px] flex flex-col",Ae&&"opacity-50"),children:[p.jsxs("div",{className:"shrink-0 mb-2",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[N,p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:je})]}),p.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:p.jsx(aw,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(vi,{checked:j,onCheckedChange:re,children:"Ignore Outliers"}),p.jsx(vi,{checked:X,onCheckedChange:ue,children:"Ignore First Step"}),p.jsx(Hl,{}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),p.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:H??"",onChange:We=>{const De=We.target.value;le(De===""?null:Number(De))},onClick:We=>We.stopPropagation(),onKeyDown:We=>We.stopPropagation()})]}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),p.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:ie??"",onChange:We=>{const De=We.target.value;fe(De===""?null:Number(De))},onClick:We=>We.stopPropagation(),onKeyDown:We=>We.stopPropagation()})]})]})]}),D]})]}),(j||X||H!==null||ie!==null)&&p.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[j&&p.jsx(F0,{label:"Ignore Outliers",onRemove:()=>re(!1)}),X&&p.jsx(F0,{label:"Ignore First Step",onRemove:()=>ue(!1)}),H!==null&&p.jsx(F0,{label:`Min Y: ${H}`,onRemove:()=>le(null)}),ie!==null&&p.jsx(F0,{label:`Max Y: ${ie}`,onRemove:()=>fe(null)})]})]}),Pe?p.jsxs("div",{className:"flex-1 min-h-0 relative bg-white rounded",ref:L,onMouseLeave:Xe,children:[p.jsx("div",{ref:O,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),Ee&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:Ue?"Loading...":"No data"})]})}function l4({runs:t,shouldPoll:e,evalName:n,prefix:r,label:i,unit:s,showZeroLine:a,isTokenMetric:o,showEma:l,emaSpan:c,hoveredRunId:d,xAxisMode:h,stepTimesByRun:g,firstStepTimesByRun:v,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:w,maxStepLimit:S,maxTimeLimit:E}){return p.jsxs("div",{children:[p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:i}),p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:c$.map(A=>p.jsx(f$,{runs:t,shouldPoll:e,evalName:n,metricName:`${r}_${A}`,label:`${i} ${u$[A]}`,unit:s,showZeroLine:a,statType:A,isTokenMetric:o,showEma:l,emaSpan:c,hoveredRunId:d,xAxisMode:h,stepTimesByRun:g,firstStepTimesByRun:v,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:w,maxStepLimit:S,maxTimeLimit:E},`${n}-${r}_${A}`))})]})}function rg({runs:t,shouldPoll:e,prefix:n,label:r,unit:i,showZeroLine:s,isTokenMetric:a,showEma:o,emaSpan:l,hoveredRunId:c,xAxisMode:d,stepTimesByRun:h,firstStepTimesByRun:g,isStepTimesFetching:v,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:w,maxTimeLimit:S,extraCharts:E,hideGroupLabel:A}){const N=t.find(D=>D.isSelected)??t[0];return p.jsxs("div",{children:[!A&&p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:r}),p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[c$.map(D=>p.jsx(Hr,{runs:t,shouldPoll:e,metricName:`${n}_${D}`,label:`${r} ${u$[D]}`,unit:i,showZeroLine:s,statType:D,isTokenMetric:a,showEma:o,emaSpan:l,hoveredRunId:c,xAxisMode:d,stepTimesByRun:h,firstStepTimesByRun:g,isStepTimesFetching:v,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:w,maxTimeLimit:S},`${n}_${D}`)),E,N&&p.jsx(d$,{runPath:N.runPath,metricType:n,label:`${r} (Dist. Over Time)`,showZeroLine:s,isTokenMetric:a,shouldPoll:e,scrollRoot:_})]})]})}function e0e(t,e,n,r){const i=T.useMemo(()=>t.slice(0,20).map(l=>l.runPath).filter(Boolean),[t]),s=T.useMemo(()=>e?[e]:[],[e]),a=bue(i,s,r&&i.length>0&&s.length>0,n);return{metricsByRunPath:T.useMemo(()=>{var c,d;const l=new Map;return(d=(c=a.data)==null?void 0:c.runs)==null||d.forEach(h=>{l.set(h.run_path,h.metrics??[])}),l},[a.data]),isFetching:a.isFetching,isRefetching:a.isFetching&&!!a.data}}function Hr({runs:t,shouldPoll:e,metricName:n,label:r,unit:i,showZeroLine:s,statType:a,isTokenMetric:o,showEma:l=!1,emaSpan:c=10,hoveredRunId:d=null,xAxisMode:h="step",stepTimesByRun:g,firstStepTimesByRun:v,isStepTimesFetching:b=!1,isStepTimesRefetching:_=!1,scrollRoot:w=null,defaultIgnoreOutliers:S,maxStepLimit:E,maxTimeLimit:A,headerPrefix:N,headerSuffix:D}){const P=T.useRef(null),L=T.useRef(null),R=T.useRef(null),O=T.useRef(null),[W,F]=cn(CG),[V,G]=cn(yG),Z=T.useMemo(()=>`metric-${n}`,[n]),B=T.useRef(!1),q=T.useRef(!1);T.useEffect(()=>{const De=qe=>{(qe.key==="Control"||qe.key==="Meta")&&(q.current=!0)},Be=qe=>{(qe.key==="Control"||qe.key==="Meta")&&(q.current=!1,F(null))};return window.addEventListener("keydown",De),window.addEventListener("keyup",Be),()=>{window.removeEventListener("keydown",De),window.removeEventListener("keyup",Be)}},[F]);const K=S??!1,Q=s$.has(n),U=V[n],j=(U==null?void 0:U.ignoreOutliers)??K,X=(U==null?void 0:U.ignoreFirstStep)??Q,H=(U==null?void 0:U.minY)??null,ie=(U==null?void 0:U.maxY)??null,ne=T.useCallback(De=>{G(Be=>{const qe={ignoreOutliers:K,ignoreFirstStep:Q,minY:null,maxY:null},Se=Be[n]??qe,Ye=De(Se);if(Ye.ignoreOutliers===qe.ignoreOutliers&&Ye.ignoreFirstStep===qe.ignoreFirstStep&&Ye.minY===qe.minY&&Ye.maxY===qe.maxY){if(!Object.prototype.hasOwnProperty.call(Be,n))return Be;const Le={...Be};return delete Le[n],Le}return{...Be,[n]:Ye}})},[n,G,K,Q]),re=T.useCallback(De=>{ne(Be=>({...Be,ignoreOutliers:De}))},[ne]),ue=T.useCallback(De=>{ne(Be=>({...Be,ignoreFirstStep:De}))},[ne]),le=T.useCallback(De=>{ne(Be=>({...Be,minY:De}))},[ne]),fe=T.useCallback(De=>{ne(Be=>({...Be,maxY:De}))},[ne]),we=Y8(P,{root:w,threshold:0}),pe=T.useMemo(()=>{const De=t.filter(qe=>!qe.isSelected),Be=t.filter(qe=>qe.isSelected);return[...De,...Be]},[t]),xe=T.useMemo(()=>pe.slice(0,20),[pe]),Ve=T.useMemo(()=>{const De=new Map;return xe.forEach((Be,qe)=>{De.set(Be.runPath,qe)}),De},[xe]),{metricsByRunPath:ye,isFetching:Oe,isRefetching:he}=e0e(t,n,e,we),{uplotData:Re,seriesConfig:oe,isFetching:Ue,isRefetching:Ee,hasData:Pe,timeToStepByRun:Ze,outlierBounds:ae}=T.useMemo(()=>{const De=new Set,Be=new Map,qe=new Map,Se=new Map,Ye=h==="time"&&!!g&&!!v,dt=Oe;pe.forEach((He,et)=>{if(et>=20)return;const ht=ye.get(He.runPath)??[],ct=new Map;if(ht.forEach(bt=>{De.add(bt.step),ct.set(bt.step,bt.value)}),Be.set(et,ct),Ye){const bt=g==null?void 0:g.get(He.runPath),wt=v==null?void 0:v.get(He.runPath);if(bt&&wt!==void 0){const Pt=new Map,$e=new Map;bt.forEach((Tt,Et)=>{const Ot=Tt-wt;Pt.set(Et,Ot),$e.set(Ot,Et)}),qe.set(et,Pt),Se.set(et,$e)}}});const Le=()=>!(!dt&&!b||dt&&!he||b&&!_);if(De.size===0)return{uplotData:null,seriesConfig:[],isFetching:dt||b,isRefetching:Le(),hasData:!1,timeToStepByRun:Se,outlierBounds:null,minStep:null};const st=Math.min(...Array.from(De));let ft=Array.from(De).sort((He,et)=>He-et);E!=null&&!Ye&&(ft=ft.filter(He=>He<=E));let mt=ft;if(Ye){const He=new Set;if(Be.forEach((ht,ct)=>{const bt=qe.get(ct);bt&&ht.forEach((wt,Pt)=>{const $e=bt.get(Pt);$e!==void 0&&He.add($e)})}),He.size===0)return{uplotData:null,seriesConfig:[],isFetching:dt||b,isRefetching:Le(),hasData:!1,timeToStepByRun:Se,outlierBounds:null,minStep:null};let et=Array.from(He).sort((ht,ct)=>ht-ct);A!=null&&(et=et.filter(ht=>ht<=A)),mt=et}let tt=null;if(j){const He=[];Be.forEach(et=>{et.forEach(ht=>{He.push(ht)})}),tt=a$(He)}const Qe=new Float64Array(mt),ze=[{label:Ye?"Time (s)":"Step"}],Te=[Qe];return pe.forEach((He,et)=>{if(et>=20)return;const ht=Be.get(et)||new Map;let ct;if(Ye){const $e=qe.get(et),Tt=new Map;$e&&ht.forEach((Et,Ot)=>{const Gt=$e.get(Ot);Gt!==void 0&&Tt.set(Gt,Et)}),ct=mt.map(Et=>Tt.get(Et)??null)}else ct=ft.map($e=>ht.get($e)??null);const bt=d===He.runPath,wt=d!==null;let Pt;wt&&!bt?Pt=.1:Pt=l?.3:1,Te.push(ct),ze.push({label:ov(He),stroke:He.color,width:1,alpha:Pt,spanGaps:!0,points:{show:!1}})}),l&&pe.forEach((He,et)=>{if(et>=20)return;const ht=Be.get(et)||new Map,ct=2/(c+1);let bt=null,wt;if(Ye){const Et=qe.get(et),Ot=new Map;ft.forEach(Gt=>{const an=ht.get(Gt);if(an!==void 0){!(tt&&(an<tt.lower||an>tt.upper))&&!(X&&Gt===st)&&(bt=bt===null?an:ct*an+(1-ct)*bt);const fn=Et==null?void 0:Et.get(Gt);fn!==void 0&&bt!==null&&Ot.set(fn,bt)}}),wt=mt.map(Gt=>Ot.get(Gt)??null)}else{const Et=[];ft.forEach(Ot=>{const Gt=ht.get(Ot);Gt!==void 0?(!(tt&&(Gt<tt.lower||Gt>tt.upper))&&!(X&&Ot===st)&&(bt===null?bt=Gt:bt=ct*Gt+(1-ct)*bt),Et.push(bt)):Et.push(null)}),wt=Et}const Pt=d===He.runPath,$e=d!==null;let Tt;$e&&!Pt?Tt=.1:Tt=1,Te.push(wt),ze.push({label:`${ov(He)} (EMA)`,stroke:He.color,width:1.5,alpha:Tt,spanGaps:!0,points:{show:!1}})}),{uplotData:Te,seriesConfig:ze,isFetching:dt||b,isRefetching:Le(),hasData:!0,timeToStepByRun:Se,outlierBounds:tt,minStep:st}},[pe,ye,Oe,he,l,c,d,h,g,v,b,_,j,X,E,A]),te=a||n.split("_").pop()||"",be=h==="time",me=n.startsWith("timing_")&&n!=="timing_microbatch_count",ge=T.useCallback(De=>De==null?"N/A":o&&(te==="min"||te==="max")?Math.round(De).toLocaleString():qu(De),[o,te]),ke=T.useCallback(De=>me?nv(De):Math.abs(De)>=1e3?`${parseFloat((De/1e3).toFixed(1))}k`:o?te==="min"||te==="max"?Math.round(De).toString():String(parseFloat(De.toFixed(1))):Number.isInteger(De)?De.toLocaleString():Math.abs(De)<.01&&De!==0?De.toExponential(1):String(parseFloat(De.toFixed(2))),[o,me,te]),Xe=T.useCallback(De=>be?nv(De):De>=1e3?`${(De/1e3).toFixed(0)}k`:De.toString(),[be]);T.useEffect(()=>{if(!L.current||!Re||!Pe)return;const De=L.current,Be=De.clientWidth,qe=De.clientHeight||192;let Se=1/0,Ye=-1/0;for(let ct=1;ct<Re.length;ct++){const bt=Re[ct];for(let wt=0;wt<bt.length;wt++){if(X&&wt===0)continue;const Pt=bt[wt];Pt!=null&&(j&&ae?Pt>=ae.lower&&Pt<=ae.upper&&(Pt<Se&&(Se=Pt),Pt>Ye&&(Ye=Pt)):(Pt<Se&&(Se=Pt),Pt>Ye&&(Ye=Pt)))}}Se===1/0&&ae&&(Se=ae.lower,Ye=ae.upper);const dt=Ye-Se,Le=Math.max(Math.abs(Ye),Math.abs(Se)),st=Math.max(Le*.05,1e-10),ft=Math.max(dt*.1,st);let mt,tt;s?(mt=Math.min(Se-ft,0),tt=Math.max(Ye+ft,0)):(mt=Se-ft,tt=Ye+ft),H!==null&&(mt=H),ie!==null&&(tt=ie);const Qe="rgba(128, 128, 128, 0.15)",ze="rgba(100, 100, 100, 0.9)",He={width:Be,height:qe,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[mt,tt]}},axes:[{stroke:ze,grid:{stroke:Qe,width:1},ticks:{stroke:Qe,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(ct,bt)=>bt.map(Xe)},{stroke:ze,grid:{stroke:Qe,width:1},ticks:{stroke:Qe,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(ct,bt)=>{if(!bt||bt.length===0)return 40;const wt=Math.max(...bt.map(Pt=>Pt.length));return Math.max(40,wt*7+14)},values:(ct,bt)=>bt.map(ke)}],series:oe,hooks:{draw:[ct=>{var Tt,Et;if(!Re)return;const bt=Re[0],wt=Math.min(pe.length,20),Pt=ct.series.length,$e=ct.ctx;$e.save();for(let Ot=1;Ot<Pt;Ot++){const Gt=Re[Ot];if(!Gt)continue;let an=-1;for(let Ln=Gt.length-1;Ln>=0;Ln--){const Fn=Gt[Ln];if(Fn!=null){an=Ln;break}}if(an===-1)continue;const On=bt[an],Bt=Gt[an];if(On===void 0||Bt===void 0||Bt===null)continue;const fn=ct.valToPos(Number(On),"x",!0),Ht=ct.valToPos(Number(Bt),"y",!0);if(!Number.isFinite(fn)||!Number.isFinite(Ht))continue;const In=ct.series[Ot],Nn=typeof(In==null?void 0:In.alpha)=="number"?In.alpha:1;let bn=typeof(In==null?void 0:In.stroke)=="string"?In.stroke:void 0;if(!bn){const Ln=Ot-1;if(Ln<wt)bn=(Tt=pe[Ln])==null?void 0:Tt.color;else if(l){const Fn=Ln-wt;Fn>=0&&Fn<wt&&(bn=(Et=pe[Fn])==null?void 0:Et.color)}}bn&&($e.globalAlpha=Nn,$e.fillStyle=bn,$e.beginPath(),$e.arc(fn,Ht,4,0,Math.PI*2),$e.fill())}$e.restore()}],setCursor:[ct=>{if(!O.current)return;const{left:bt,top:wt,idx:Pt}=ct.cursor;if(Pt==null||bt===void 0||wt===void 0||bt<0){O.current.style.display="none";return}const $e=Re[0][Pt];if($e===void 0){O.current.style.display="none";return}q.current&&!B.current&&F({xValue:Number($e),sourceChartId:Z});const Tt=(()=>{var Bi,ui;if(!be||!Ze)return null;const Nn=Number($e);if(d){const ve=pe.findIndex(ot=>ot.runPath===d);if(ve>=0){const ot=(Bi=Ze.get(ve))==null?void 0:Bi.get(Nn);if(ot!==void 0)return ot}}const bn=pe.findIndex(ve=>ve.isSelected);if(bn>=0){const ve=(ui=Ze.get(bn))==null?void 0:ui.get(Nn);if(ve!==void 0)return ve}let Ln=null;const Fn=new Set;return pe.forEach((ve,ot)=>{var yt;const _t=(yt=Ze.get(ot))==null?void 0:yt.get(Nn);_t!==void 0&&(Fn.add(_t),Ln===null&&(Ln=_t))}),Fn.size===1,Ln})();let Ot=`<div class="font-medium mb-1">${be?`Time ${l$(Number($e))}${Tt!==null?` <span class="text-muted-foreground">(Step ${Number(Tt).toLocaleString()})</span>`:""}`:`Step ${Number($e).toLocaleString()}`}</div>`;const Gt=xe.length,an=Re[0],On=(()=>{if(!be)return null;const Nn=ct.scales.x,bn=Number(Nn.min),Ln=Number(Nn.max);if(!Number.isFinite(bn)||!Number.isFinite(Ln))return null;const Fn=Math.abs(Ln-bn);if(Fn<=0)return null;const Bi=Math.max(1,ct.bbox.width);return Fn*$pe/Bi})();t.forEach(Nn=>{const bn=Ve.get(Nn.runPath);if(bn===void 0)return;const Ln=bn+1,Fn=Re[Ln];if(!Fn)return;const Bi=be?qpe(Fn,an,Pt,On):Pt;if(Bi===null)return;const ui=Fn[Bi];let ve;if(l){const ot=Gt+bn+1,_t=Re[ot];ve=_t==null?void 0:_t[Bi]}ui!=null&&(Ot+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Nn.color}"></div>
                    <span>${X8(Nn)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${l?.7:1}">${me?rD(ui):`${ge(ui)}${i?` ${i}`:""}`}</span>
                    ${l&&ve!==void 0&&ve!==null?`<span class="text-muted-foreground">(EMA: ${me?rD(ve):ge(ve)})</span>`:""}
                  </div>
                </div>
              `)}),O.current.innerHTML=Ot,O.current.style.display="block";const Bt=L.current.getBoundingClientRect(),fn=O.current.getBoundingClientRect();let Ht=Bt.left+bt+15;Ht+fn.width+20>window.innerWidth&&(Ht=Bt.left+bt-fn.width-15+ct.bbox.left),Ht=Math.max(4,Ht);let In=Bt.top-fn.height+20;In<4&&(In=Bt.bottom-20),O.current.style.left=`${Ht}px`,O.current.style.top=`${In}px`}]}};R.current&&R.current.destroy();const et=new ma(He,Re,De);R.current=et;const ht=new ResizeObserver(ct=>{for(const bt of ct){const{width:wt,height:Pt}=bt.contentRect;et&&wt>0&&Pt>0&&et.setSize({width:wt,height:Pt})}});return ht.observe(De),()=>{ht.disconnect(),et.destroy(),R.current=null}},[Re,oe,Pe,Xe,ke,ge,be,Ze,pe,d,l,s,i,j,ae,X,H,ie,t,xe,Ve,Z,me,F]),T.useEffect(()=>{if(!W){O.current&&(O.current.style.display="none");return}if(W.sourceChartId===Z||!R.current||!Re)return;const De=R.current,Be=Re[0];if(!Be||Be.length===0)return;const qe=W.xValue;let Se=0,Ye=1/0;for(let Le=0;Le<Be.length;Le++){const st=Math.abs(Number(Be[Le])-qe);st<Ye&&(Ye=st,Se=Le)}const dt=De.valToPos(Number(Be[Se]),"x");dt>=0&&dt<=De.width&&(B.current=!0,De.setCursor({left:dt,top:0}),B.current=!1)},[W,Z,Re]);const Ae=T.useCallback(()=>{O.current&&(O.current.style.display="none"),(W==null?void 0:W.sourceChartId)===Z&&F(null)},[W,Z,F]),je=Ue&&!Ee,We=r||(te?`${te.charAt(0).toUpperCase()}${te.slice(1)}`:n);return p.jsxs("div",{ref:P,className:Rt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white h-[246px] flex flex-col",je&&"opacity-50"),children:[p.jsxs("div",{className:"shrink-0 mb-2",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[N,p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:n,children:We})]}),p.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:p.jsx(aw,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(vi,{checked:j,onCheckedChange:re,children:"Ignore Outliers"}),p.jsx(vi,{checked:X,onCheckedChange:ue,children:"Ignore First Step"}),p.jsx(Hl,{}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),p.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:H??"",onChange:De=>{const Be=De.target.value;le(Be===""?null:Number(Be))},onClick:De=>De.stopPropagation(),onKeyDown:De=>De.stopPropagation()})]}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),p.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:ie??"",onChange:De=>{const Be=De.target.value;fe(Be===""?null:Number(Be))},onClick:De=>De.stopPropagation(),onKeyDown:De=>De.stopPropagation()})]})]})]}),D]})]}),(j||X||H!==null||ie!==null)&&p.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[j&&p.jsx(F0,{label:"Ignore Outliers",onRemove:()=>re(!1)}),X&&p.jsx(F0,{label:"Ignore First Step",onRemove:()=>ue(!1)}),H!==null&&p.jsx(F0,{label:`Min Y: ${H}`,onRemove:()=>le(null)}),ie!==null&&p.jsx(F0,{label:`Max Y: ${ie}`,onRemove:()=>fe(null)})]})]}),Pe?p.jsxs("div",{className:"flex-1 min-h-0 relative bg-white rounded",ref:L,onMouseLeave:Ae,children:[p.jsx("div",{ref:O,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),Ee&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:Ue?"Loading...":"No data"})]})}const ig=["mean","std","min","max"],sg={mean:"Mean",std:"Std",min:"Min",max:"Max"};function b2(){return Math.random().toString(36).slice(2,10)}function t1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function h$(t,e,n){const r=[];for(const[i,s]of Object.entries(t)){const a=t1(i);for(const[o,l]of Object.entries(s)){const c=o?t1(o):void 0;for(const d of l)r.push({section:a,group:c,metricKey:d,label:t1(d),plotType:"step_metric",simple:!0})}}for(const i of ig)r.push({section:"Reward",metricKey:`reward_sum_${i}`,label:`Reward ${sg[i]}`,plotType:"step_metric"});r.push({section:"Reward",metricKey:"reward_gini_mean",label:"Reward Sparsity (Gini)",plotType:"step_metric",simple:!0}),r.push({section:"Reward",metricKey:"reward_sum_distribution_over_time",label:"Reward Dist. Over Time",plotType:"distribution_over_time",distMetricType:"reward_sum"});for(const i of e){const s=t1(i);for(const a of ig)r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_${a}`,label:`${s} ${sg[a]}`,plotType:"step_metric"});r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_gini_mean`,label:`${s} Sparsity (Gini)`,plotType:"step_metric",simple:!0}),r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_distribution_over_time`,label:`${s} Dist. Over Time`,plotType:"distribution_over_time",distMetricType:`reward_${i}`})}for(const i of ig)r.push({section:"Advantage",metricKey:`advantage_${i}`,label:`Advantage ${sg[i]}`,plotType:"step_metric"});r.push({section:"Advantage",metricKey:"advantage_distribution_over_time",label:"Advantage Dist. Over Time",plotType:"distribution_over_time",distMetricType:"advantage"});for(const i of n){const s=i.eval_name;for(const a of i.available_rollout_metric_names){const o=t1(a);for(const l of ig)r.push({section:"Evals",group:`${s} / ${o}`,metricKey:`reward_${a}_${l}`,label:`${s} ${o} ${sg[l]}`,plotType:"eval_metric",evalName:s})}for(const a of["length_completion","length_prompt","length_sum"]){const o=a==="length_completion"?"Tokens Completion":a==="length_prompt"?"Tokens Prompt":"Tokens Total";for(const l of ig)r.push({section:"Evals",group:`${s} / ${o}`,metricKey:`${a}_${l}`,label:`${s} ${o} ${sg[l]}`,plotType:"eval_metric",evalName:s})}}for(const i of["length_prompt","length_completion","length_sum"]){const s=i==="length_prompt"?"Tokens Prompt":i==="length_completion"?"Tokens Completion":"Tokens Total";for(const a of ig)r.push({section:"Rollouts",group:s,metricKey:`${i}_${a}`,label:`${s} ${sg[a]}`,plotType:"step_metric"});r.push({section:"Rollouts",group:s,metricKey:`${i}_distribution_over_time`,label:`${s} Dist. Over Time`,plotType:"distribution_over_time",distMetricType:i})}for(const i of[{key:"stop_reason_length_pct",label:"% Stop Reason = Length"},{key:"group_length_gini_mean",label:"Group Completion Length Gini"},{key:"group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median"}])r.push({section:"Rollouts",group:"General",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"discarded_count",label:"Discarded Count"},{key:"discarded_zero_advantage_pct",label:"Zero Advantage %"},{key:"discarded_max_async_pct",label:"Max Async %"},{key:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length"},{key:"discarded_group_length_gini_mean",label:"Group Completion Length Gini"},{key:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median"},{key:"discarded_zero_advantage_all_zero_pct",label:"Zero Adv (All Reward = 0) %"},{key:"discarded_zero_advantage_all_positive_pct",label:"Zero Adv (All Reward > 0) %"},{key:"discarded_zero_advantage_mean_reward",label:"Zero Adv Mean Reward"}])r.push({section:"Discarded Rollouts",group:"General",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});r.push({section:"Discarded Rollouts",group:"Canceled",metricKey:"canceled_count",label:"Canceled Count",plotType:"step_metric",simple:!0});for(const i of["discarded_length_prompt","discarded_length_completion","discarded_length_sum"]){const s=i.includes("prompt")?"Discarded Tokens Prompt":i.includes("completion")?"Discarded Tokens Completion":"Discarded Tokens Total";for(const a of ig)r.push({section:"Discarded Rollouts",group:s,metricKey:`${i}_${a}`,label:`${s} ${sg[a]}`,plotType:"step_metric"});r.push({section:"Discarded Rollouts",group:s,metricKey:`${i}_distribution_over_time`,label:`${s} Dist. Over Time`,plotType:"distribution_over_time",distMetricType:i})}for(const i of[{key:"timing_step_total",label:"Time per Step"},{key:"timing_step_active",label:"Time per Step Active"},{key:"timing_save_batch_total",label:"Batch Completion (Save Batch)"},{key:"timing_microbatch_count",label:"Microbatches per Step"},{key:"timing_forward_total",label:"Timing Forward"},{key:"timing_backward_total",label:"Timing Backward"},{key:"timing_loss_computation_total",label:"Timing Loss Computation"},{key:"timing_compute_kl_total",label:"Timing Compute KL"},{key:"timing_compute_entropy_total",label:"Timing Compute Entropy"},{key:"timing_data_to_device_total",label:"Timing Data to Device"},{key:"timing_prepare_tensors_total",label:"Timing Prepare Tensors"},{key:"timing_waiting_for_data",label:"Timing Waiting for Data"},{key:"timing_weight_sync_trainer_total",label:"Timing Weight Broadcast (Trainer)"},{key:"timing_weight_sync_inference_total",label:"Timing Weight Broadcast (Inference)"}])r.push({section:"Timeline",group:"Full Step (Total Time)",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"timing_forward_microbatch_mean",label:"Microbatch Timing Forward"},{key:"timing_backward_microbatch_mean",label:"Microbatch Timing Backward"},{key:"timing_loss_computation_microbatch_mean",label:"Microbatch Timing Loss Computation"},{key:"timing_compute_kl_microbatch_mean",label:"Microbatch Timing Compute KL"},{key:"timing_compute_entropy_microbatch_mean",label:"Microbatch Timing Compute Entropy"},{key:"timing_data_to_device_microbatch_mean",label:"Microbatch Timing Data to Device"},{key:"timing_prepare_tensors_microbatch_mean",label:"Microbatch Timing Prepare Tensors"}])r.push({section:"Timeline",group:"Microbatch (Mean Time)",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});return r}async function pO(t){await fetch(`${Ar}/custom-metrics-layout`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:t})})}function _2({open:t,onOpenChange:e,title:n,existingNames:r,initialValue:i="",onSubmit:s}){const[a,o]=T.useState(i),[l,c]=T.useState(""),d=T.useRef(null),h=v=>{v&&(o(i),c(""),setTimeout(()=>{var b;return(b=d.current)==null?void 0:b.focus()},50)),e(v)},g=()=>{const v=a.trim();if(!v){c("Name cannot be empty");return}if(r.some(b=>b.toLowerCase()===v.toLowerCase())&&v.toLowerCase()!==i.toLowerCase()){c("Name already exists");return}s(v),e(!1)};return p.jsx($f,{open:t,onOpenChange:h,children:p.jsxs(qf,{className:"sm:max-w-[340px]",children:[p.jsx(jd,{children:p.jsx(Fd,{children:n})}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(W0,{ref:d,value:a,onChange:v=>{o(v.target.value),c("")},onKeyDown:v=>{v.key==="Enter"&&g()},placeholder:"Name..."}),l&&p.jsx("p",{className:"text-xs text-destructive",children:l})]}),p.jsx(m8,{children:p.jsx(Tn,{size:"sm",onClick:g,children:i?"Rename":"Create"})})]})})}function mO(t){return`${t.plotType}|${t.evalName||""}|${t.metricKey}`}function Q1({catalog:t,onSelect:e,existingPlots:n,children:r}){const i=T.useMemo(()=>new Set((n??[]).map(mO)),[n]),[s,a]=T.useState(!1),[o,l]=T.useState(""),c=T.useMemo(()=>{const d=o.toLowerCase(),h=d?t.filter(v=>{var b;return v.label.toLowerCase().includes(d)||v.metricKey.toLowerCase().includes(d)||v.section.toLowerCase().includes(d)||(((b=v.group)==null?void 0:b.toLowerCase().includes(d))??!1)}):t,g=[];for(const v of h){let b=g.find(S=>S.section===v.section);b||(b={section:v.section,groups:[]},g.push(b));const _=v.group||"";let w=b.groups.find(S=>S.group===_);w||(w={group:_,items:[]},b.groups.push(w)),w.items.push(v)}return g},[t,o]);return p.jsxs(aT,{open:s,onOpenChange:a,children:[p.jsx(oT,{asChild:!0,children:r}),p.jsxs(lT,{align:"start",className:"w-[320px] p-0",onClick:d=>d.stopPropagation(),children:[p.jsx("div",{className:"p-2 border-b",children:p.jsx(W0,{value:o,onChange:d=>l(d.target.value),placeholder:"Search metrics...",className:"h-7 text-xs"})}),p.jsxs("div",{className:"max-h-[50vh] overflow-y-auto p-1.5",children:[c.length===0&&p.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No metrics found"}),c.map(d=>p.jsxs("div",{className:"mb-2",children:[p.jsx("div",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider px-1.5 py-1",children:d.section}),d.groups.map(h=>p.jsxs("div",{children:[h.group&&p.jsx("div",{className:"text-[10px] font-medium text-muted-foreground/70 px-3 py-0.5",children:h.group}),h.items.map(g=>{const v=i.has(mO(g));return p.jsx("button",{type:"button",disabled:v,className:Rt("flex w-full items-center gap-1.5 rounded px-3 py-0.5 text-xs text-left transition-colors",v?"text-muted-foreground/50 cursor-default":"hover:bg-accent hover:text-accent-foreground"),onClick:()=>{v||(e(g),a(!1),l(""))},children:g.label},`${g.plotType}-${g.evalName||""}-${g.metricKey}`)})]},`${d.section}-${h.group}`))]},d.section))]})]})]})}function p$({open:t,onOpenChange:e,title:n,description:r,onConfirm:i}){return p.jsx(FN,{open:t,onOpenChange:e,children:p.jsxs(UN,{children:[p.jsxs(BN,{children:[p.jsx(VN,{children:n}),p.jsx(GN,{children:r})]}),p.jsxs(HN,{children:[p.jsx($N,{children:"Cancel"}),p.jsx(WN,{variant:"destructive",onClick:i,children:"Delete"})]})]})})}function K8({plot:t,onRemove:e,chartProps:n}){const{attributes:r,listeners:i,setNodeRef:s,transform:a,transition:o,isDragging:l}=k8({id:t.id}),c={transform:a?`translate3d(${Math.round(a.x)}px, ${Math.round(a.y)}px, 0)`:void 0,transition:o,opacity:l?.4:1,position:"relative",zIndex:l?50:void 0},d=t.label||t1(t.metricKey),h=p.jsx("button",{...r,...i,className:"-ml-1.5 cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-muted transition-all shrink-0 opacity-0 group-hover/chart:opacity-100",children:p.jsx(p8,{className:"h-3 w-3 text-muted-foreground"})}),g=p.jsx("button",{onClick:e,className:"-mr-1 h-5 px-1.5 rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:p.jsx(Ju,{className:"h-3 w-3"})});return p.jsx("div",{ref:s,style:c,children:t.plotType==="distribution_over_time"&&t.distMetricType?(()=>{const v=n.runs.find(b=>b.isSelected)??n.runs[0];return v?p.jsx(d$,{runPath:v.runPath,metricType:t.distMetricType,label:d,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,headerPrefix:h,headerSuffix:g}):null})():t.plotType==="eval_metric"&&t.evalName?p.jsx(f$,{runs:n.runs,shouldPoll:n.shouldPoll,evalName:t.evalName,metricName:t.metricKey,label:d,showEma:n.showEma,emaSpan:n.emaSpan,hoveredRunId:n.hoveredRunId,xAxisMode:n.xAxisMode,stepTimesByRun:n.stepTimesByRun,firstStepTimesByRun:n.firstStepTimesByRun,isStepTimesFetching:n.isStepTimesFetching,isStepTimesRefetching:n.isStepTimesRefetching,scrollRoot:n.scrollRoot,maxStepLimit:n.maxStep,maxTimeLimit:n.maxTime,headerPrefix:h,headerSuffix:g}):p.jsx(Hr,{runs:n.runs,shouldPoll:n.shouldPoll,metricName:t.metricKey,label:d,showEma:n.showEma,emaSpan:n.emaSpan,hoveredRunId:n.hoveredRunId,xAxisMode:n.xAxisMode,stepTimesByRun:n.stepTimesByRun,firstStepTimesByRun:n.firstStepTimesByRun,isStepTimesFetching:n.isStepTimesFetching,isStepTimesRefetching:n.isStepTimesRefetching,scrollRoot:n.scrollRoot,maxStepLimit:n.maxStep,maxTimeLimit:n.maxTime,headerPrefix:h,headerSuffix:g})})}function t0e({group:t,catalog:e,groupNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[a,o]=T.useState(!0),[l,c]=T.useState(!1),[d,h]=T.useState(!1),[g,v]=T.useState(!1),{attributes:b,listeners:_,setNodeRef:w,transform:S,transition:E,isDragging:A}=k8({id:t.id}),N={transform:$1.Transform.toString(S),transition:E,opacity:A?.4:1},D=W=>{const F={id:b2(),metricKey:W.metricKey,label:W.label,plotType:W.plotType,evalName:W.evalName,distMetricType:W.distMetricType};r({...t,plots:[...t.plots,F]})},P=W=>{r({...t,plots:t.plots.filter(F=>F.id!==W)})},L=W=>{r({...t,name:W})},R=sS(Xf(iv,{activationConstraint:{distance:5}}),Xf(rv,{coordinateGetter:uS})),O=W=>{const{active:F,over:V}=W;if(!V||F.id===V.id)return;const G=t.plots.findIndex(B=>B.id===F.id),Z=t.plots.findIndex(B=>B.id===V.id);G===-1||Z===-1||r({...t,plots:sv(t.plots,G,Z)})};return p.jsxs("div",{ref:w,style:N,children:[p.jsxs(Ki,{open:a,onOpenChange:o,children:[p.jsxs("div",{className:"flex items-center gap-1 h-8",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"flex items-center gap-1.5 py-1 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors shrink-0",children:[p.jsx(Vr,{className:Rt("h-3.5 w-3.5 text-muted-foreground transition-transform shrink-0",!a&&"-rotate-90")}),p.jsx("h4",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:t.name})]})}),p.jsx("button",{...b,..._,className:Rt("cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-muted transition-all shrink-0",l?"opacity-100":"opacity-0 pointer-events-none"),children:p.jsx(p8,{className:"h-3.5 w-3.5 text-muted-foreground"})}),p.jsxs("div",{className:Rt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[p.jsx(Q1,{catalog:e,onSelect:D,existingPlots:t.plots,children:p.jsxs("button",{className:"flex items-center gap-0.5 h-6 px-2 text-[10px] rounded-md border border-input hover:bg-accent transition-colors",children:[p.jsx(ip,{className:"h-3 w-3"}),"New Plot"]})}),p.jsx("button",{onClick:()=>h(!0),className:"h-6 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",title:"Rename group",children:p.jsx(uG,{className:"h-3 w-3 text-muted-foreground"})}),p.jsx("button",{onClick:()=>v(!0),className:"h-6 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",children:p.jsx(Ju,{className:"h-3 w-3 text-muted-foreground"})})]})]}),p.jsx(Qi,{children:p.jsx(lS,{sensors:R,collisionDetection:aS,onDragEnd:O,children:p.jsx(cS,{items:t.plots.map(W=>W.id),strategy:uw,children:p.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mt-3 mb-4",children:[t.plots.map(W=>p.jsx(K8,{plot:W,onRemove:()=>P(W.id),chartProps:s},W.id)),t.plots.length===0&&p.jsx(Q1,{catalog:e,onSelect:D,existingPlots:t.plots,children:p.jsxs("button",{className:"h-32 rounded-lg border-2 border-dashed border-gray-200 hover:border-gray-300 hover:bg-gray-50/50 transition-colors flex items-center justify-center text-xs text-muted-foreground gap-1",children:[p.jsx(ip,{className:"h-3.5 w-3.5"}),"Add a plot"]})})]})})})})]}),p.jsx(_2,{open:d,onOpenChange:h,title:"Rename Group",existingNames:n.filter(W=>W!==t.name),onSubmit:L,initialValue:t.name}),p.jsx(p$,{open:g,onOpenChange:v,title:"Delete Group",description:`Delete "${t.name}" and all its plots?`,onConfirm:i})]})}function n0e({section:t,catalog:e,allSectionNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[a,o]=T.useState(!0),[l,c]=T.useState(!1),[d,h]=T.useState(!1),[g,v]=T.useState(!1),[b,_]=T.useState(!1),{attributes:w,listeners:S,setNodeRef:E,transform:A,transition:N,isDragging:D}=k8({id:t.id}),P={transform:$1.Transform.toString(A),transition:N,opacity:D?.4:1},L=t.groups.map(Y=>Y.name),R=Y=>{const Q={id:b2(),name:Y,plots:[]};r({...t,groups:[...t.groups,Q]})},O=(Y,Q)=>{r({...t,groups:t.groups.map(U=>U.id===Y?Q:U)})},W=Y=>{r({...t,groups:t.groups.filter(Q=>Q.id!==Y)})},F=Y=>{const Q={id:b2(),metricKey:Y.metricKey,label:Y.label,plotType:Y.plotType,evalName:Y.evalName,distMetricType:Y.distMetricType};r({...t,plots:[...t.plots,Q]})},V=Y=>{r({...t,plots:t.plots.filter(Q=>Q.id!==Y)})},G=Y=>{r({...t,name:Y})},Z=sS(Xf(iv,{activationConstraint:{distance:5}}),Xf(rv,{coordinateGetter:uS})),B=Y=>{const{active:Q,over:U}=Y;if(!U||Q.id===U.id)return;const j=t.groups.findIndex(H=>H.id===Q.id),X=t.groups.findIndex(H=>H.id===U.id);j===-1||X===-1||r({...t,groups:sv(t.groups,j,X)})},q=sS(Xf(iv,{activationConstraint:{distance:5}}),Xf(rv,{coordinateGetter:uS})),K=Y=>{const{active:Q,over:U}=Y;if(!U||Q.id===U.id)return;const j=t.plots.findIndex(H=>H.id===Q.id),X=t.plots.findIndex(H=>H.id===U.id);j===-1||X===-1||r({...t,plots:sv(t.plots,j,X)})};return p.jsxs("div",{ref:E,style:P,children:[p.jsxs(Ki,{open:a,onOpenChange:o,children:[p.jsxs("div",{className:"flex items-center gap-1.5 h-9",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform shrink-0",!a&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:t.name})]})}),p.jsx("button",{...w,...S,className:Rt("cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-muted transition-all shrink-0",l?"opacity-100":"opacity-0 pointer-events-none"),children:p.jsx(p8,{className:"h-4 w-4 text-muted-foreground"})}),p.jsxs("div",{className:Rt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[p.jsxs("button",{onClick:()=>h(!0),className:"flex items-center gap-0.5 h-7 px-2 text-xs rounded-md border border-input hover:bg-accent transition-colors",children:[p.jsx(ip,{className:"h-3 w-3"}),"New Group"]}),p.jsx(Q1,{catalog:e,onSelect:F,existingPlots:t.plots,children:p.jsxs("button",{className:"flex items-center gap-0.5 h-7 px-2 text-xs rounded-md border border-input hover:bg-accent transition-colors",children:[p.jsx(ip,{className:"h-3 w-3"}),"New Plot"]})}),p.jsx("button",{onClick:()=>v(!0),className:"h-7 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",title:"Rename section",children:p.jsx(uG,{className:"h-3.5 w-3.5 text-muted-foreground"})}),p.jsx("button",{onClick:()=>_(!0),className:"h-7 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",children:p.jsx(Ju,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),p.jsxs(Qi,{children:[t.plots.length>0&&p.jsx(lS,{sensors:q,collisionDetection:aS,onDragEnd:K,children:p.jsx(cS,{items:t.plots.map(Y=>Y.id),strategy:uw,children:p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 mt-3 mb-4",children:t.plots.map(Y=>p.jsx(K8,{plot:Y,onRemove:()=>V(Y.id),chartProps:s},Y.id))})})}),p.jsx(lS,{sensors:Z,collisionDetection:aS,onDragEnd:B,children:p.jsx(cS,{items:t.groups.map(Y=>Y.id),strategy:sW,children:p.jsx("div",{className:"space-y-2",children:t.groups.map(Y=>p.jsx(t0e,{group:Y,catalog:e,groupNames:L,onUpdate:Q=>O(Y.id,Q),onRemove:()=>W(Y.id),chartProps:s},Y.id))})})}),t.plots.length===0&&t.groups.length===0&&p.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[p.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"No plots yet. Add a group or a plot."}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs(Tn,{size:"sm",variant:"outline",onClick:()=>h(!0),children:[p.jsx(ip,{className:"h-3.5 w-3.5 mr-1"}),"New Group"]}),p.jsx(Q1,{catalog:e,onSelect:F,existingPlots:t.plots,children:p.jsxs(Tn,{size:"sm",variant:"outline",children:[p.jsx(ip,{className:"h-3.5 w-3.5 mr-1"}),"New Plot"]})})]})]})]})]}),p.jsx(_2,{open:d,onOpenChange:h,title:"New Group",existingNames:L,onSubmit:R}),p.jsx(_2,{open:g,onOpenChange:v,title:"Rename Section",existingNames:n.filter(Y=>Y!==t.name),onSubmit:G,initialValue:t.name}),p.jsx(p$,{open:b,onOpenChange:_,title:"Delete Section",description:`Delete "${t.name}" and all its groups and plots?`,onConfirm:i})]})}function r0e({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,availableRewardNames:s,customMetricSections:a,xAxisMode:o,scrollRoot:l,maxStep:c,maxTime:d,evalsList:h,newSectionTrigger:g}){var be,me,ge,ke,Xe,Ae,je,We,De,Be,qe,Se,Ye,dt,Le,st,ft,mt,tt,Qe;const v=my(),{data:b,isLoading:_}=DG(),[w,S]=T.useState({sections:[]}),[E,A]=T.useState(!1),[N,D]=T.useState(!1);!N&&b&&(D(!0),b.layout&&S(b.layout));const[P,L]=T.useState(g);g!==P&&(L(g),A(!0));const R=T.useRef(null),O=T.useRef(null),W=T.useCallback(ze=>{S(ze),v.setQueryData(["custom-metrics-layout"],{layout:ze}),O.current=ze,R.current&&clearTimeout(R.current),R.current=setTimeout(async()=>{O.current&&(await pO(O.current),O.current=null)},500)},[v]);T.useEffect(()=>()=>{R.current&&clearTimeout(R.current),O.current&&(pO(O.current),O.current=null)},[]);const F=T.useMemo(()=>h$(a,s,h),[a,s,h]),V=o==="time",G=Or(((be=t[0])==null?void 0:be.runPath)||"",V&&!!t[0],e),Z=Or(((me=t[1])==null?void 0:me.runPath)||"",V&&!!t[1],e),B=Or(((ge=t[2])==null?void 0:ge.runPath)||"",V&&!!t[2],e),q=Or(((ke=t[3])==null?void 0:ke.runPath)||"",V&&!!t[3],e),K=Or(((Xe=t[4])==null?void 0:Xe.runPath)||"",V&&!!t[4],e),Y=Or(((Ae=t[5])==null?void 0:Ae.runPath)||"",V&&!!t[5],e),Q=Or(((je=t[6])==null?void 0:je.runPath)||"",V&&!!t[6],e),U=Or(((We=t[7])==null?void 0:We.runPath)||"",V&&!!t[7],e),j=Or(((De=t[8])==null?void 0:De.runPath)||"",V&&!!t[8],e),X=Or(((Be=t[9])==null?void 0:Be.runPath)||"",V&&!!t[9],e),H=Or(((qe=t[10])==null?void 0:qe.runPath)||"",V&&!!t[10],e),ie=Or(((Se=t[11])==null?void 0:Se.runPath)||"",V&&!!t[11],e),ne=Or(((Ye=t[12])==null?void 0:Ye.runPath)||"",V&&!!t[12],e),re=Or(((dt=t[13])==null?void 0:dt.runPath)||"",V&&!!t[13],e),ue=Or(((Le=t[14])==null?void 0:Le.runPath)||"",V&&!!t[14],e),le=Or(((st=t[15])==null?void 0:st.runPath)||"",V&&!!t[15],e),fe=Or(((ft=t[16])==null?void 0:ft.runPath)||"",V&&!!t[16],e),we=Or(((mt=t[17])==null?void 0:mt.runPath)||"",V&&!!t[17],e),pe=Or(((tt=t[18])==null?void 0:tt.runPath)||"",V&&!!t[18],e),xe=Or(((Qe=t[19])==null?void 0:Qe.runPath)||"",V&&!!t[19],e),Ve=T.useMemo(()=>[G,Z,B,q,K,Y,Q,U,j,X,H,ie,ne,re,ue,le,fe,we,pe,xe],[G,Z,B,q,K,Y,Q,U,j,X,H,ie,ne,re,ue,le,fe,we,pe,xe]),{isStepTimesFetching:ye,isStepTimesRefetching:Oe}=T.useMemo(()=>{if(!V)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const ze=Ve.some(et=>et.isFetching),Te=Ve.filter(et=>et.isFetching),He=ze&&Te.length>0&&Te.every(et=>!!et.data);return{isStepTimesFetching:ze,isStepTimesRefetching:He}},[V,Ve]),{stepTimesByRun:he,firstStepTimesByRun:Re}=T.useMemo(()=>{if(!V)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const ze=new Map,Te=new Map;return t.forEach((He,et)=>{if(et>=20)return;const ct=Ve[et].data;if(!ct||ct.first_step_time===null||ct.first_step_time===void 0||!ct.step_times||ct.step_times.length===0)return;const bt=new Map;ct.step_times.forEach(wt=>{typeof wt.time=="number"&&bt.set(wt.step,wt.time)}),bt.size>0&&(ze.set(He.runPath,bt),Te.set(He.runPath,ct.first_step_time))}),{stepTimesByRun:ze,firstStepTimesByRun:Te}},[t,V,Ve]),oe=T.useMemo(()=>({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,xAxisMode:o,scrollRoot:l,maxStep:c,maxTime:d,stepTimesByRun:he,firstStepTimesByRun:Re,isStepTimesFetching:ye,isStepTimesRefetching:Oe}),[t,e,n,r,i,o,l,c,d,he,Re,ye,Oe]),Ue=w.sections.map(ze=>ze.name),Ee=ze=>{const Te={id:b2(),name:ze,groups:[],plots:[]};W({sections:[...w.sections,Te]})},Pe=(ze,Te)=>{W({sections:w.sections.map(He=>He.id===ze?Te:He)})},Ze=ze=>{W({sections:w.sections.filter(Te=>Te.id!==ze)})},ae=sS(Xf(iv,{activationConstraint:{distance:8}}),Xf(rv,{coordinateGetter:uS})),te=ze=>{const{active:Te,over:He}=ze;if(!He||Te.id===He.id)return;const et=w.sections.findIndex(ct=>ct.id===Te.id),ht=w.sections.findIndex(ct=>ct.id===He.id);et===-1||ht===-1||W({sections:sv(w.sections,et,ht)})};return p.jsxs("div",{className:"-mt-3",children:[p.jsx(lS,{sensors:ae,collisionDetection:aS,onDragEnd:te,children:p.jsx(cS,{items:w.sections.map(ze=>ze.id),strategy:sW,children:w.sections.map((ze,Te)=>p.jsxs("div",{children:[Te>0&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsx(n0e,{section:ze,catalog:F,allSectionNames:Ue,onUpdate:He=>Pe(ze.id,He),onRemove:()=>Ze(ze.id),chartProps:oe})]},ze.id))})}),w.sections.length===0&&_&&p.jsxs("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:[p.jsx(Kd,{className:"h-4 w-4 animate-spin mr-2"}),p.jsx("span",{className:"text-sm",children:"Loading..."})]}),w.sections.length===0&&!_&&p.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[p.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No custom sections yet. Create one to start building your dashboard."}),p.jsxs(Tn,{size:"sm",variant:"outline",onClick:()=>A(!0),children:[p.jsx(ip,{className:"h-3.5 w-3.5 mr-1"}),"New Section"]})]}),p.jsx(_2,{open:E,onOpenChange:A,title:"New Section",existingNames:Ue,onSubmit:Ee})]})}const gO=100;function m$({current:t,total:e,fillClassName:n,activeBorderClassName:r}){const i=e/gO;return p.jsx("div",{className:"flex gap-[2px]",children:Array.from({length:gO}).map((s,a)=>{const o=a*i,l=(a+1)*i;let c=0;t>=l?c=1:t>o&&(c=(t-o)/i);const d=c>0&&r?r:"border-muted-foreground/50";return p.jsx("div",{className:`relative flex-1 h-8 border ${d} rounded-[2px] overflow-hidden bg-background`,children:c>0&&p.jsx("div",{className:`absolute top-0 left-0 bottom-0 transition-all duration-200 ${n}`,style:{width:`${c*100}%`}})},a)})})}function vO(t){const e=Math.floor(t/86400),n=Math.floor(t%86400/3600),r=Math.floor(t%3600/60),i=Math.floor(t%60);return e>0?`${e}d ${n}h ${r}m`:n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function i0e(t,e){const[n,r]=T.useState(null);if(T.useEffect(()=>{if(!t||!e)return;const a=setTimeout(()=>r(Date.now()),0),o=setInterval(()=>{r(Date.now())},1e3);return()=>{clearTimeout(a),clearInterval(o)}},[t,e]),!t||!e||n===null)return null;const i=new Date(t).getTime();return isNaN(i)?null:(n-i)/1e3}function s0e(t){const e=new Date(t);if(isNaN(e.getTime()))return t;const n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),i=e.getFullYear(),s=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0");return`${n}/${r}/${i} ${s}:${a}:${o}`}function a0e(t){const e=o=>o&&typeof o=="object"&&"value"in o?o.value:o,n=e(t.model),r=typeof n=="string"?n:null,i=e(t.environments);let s=[],a=i;if(typeof a=="string")try{a=JSON.parse(a)}catch{}return a&&typeof a=="object"&&!Array.isArray(a)?s=Object.keys(a):Array.isArray(a)&&(s=a.map(o=>typeof o=="string"?o:o&&typeof o=="object"&&"name"in o?String(o.name):String(o))),{model:r,envNames:s}}function $b(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const e=Number(t);if(Number.isFinite(e))return e}return null}function o0e(t,e,n){if(t.length===0||e>=n)return null;const i=[...t].sort((g,v)=>g.step-v.step).slice(-50);if(i.length===0)return null;const a=Math.pow(.5,1/10),o=i.length;let l=0,c=0;for(let g=0;g<o;g++){const v=Math.pow(a,o-1-g);l+=i[g].value*v,c+=v}const d=l/c,h=n-e;return d*h}function l0e({currentStep:t,totalSteps:e,runtimeSeconds:n,estimatedSecondsToFinish:r}){const i=t>=0?t+1:0,s=e>0?i/e*100:0,a=Math.min(s,100);return p.jsxs("div",{className:"space-y-1.5",children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Training Progress"}),p.jsxs("div",{className:"flex items-baseline gap-1.5 flex-wrap",children:[p.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[a.toFixed(2),"%"]}),p.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[i," / ",e," Steps"]}),n!==null&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),p.jsx("span",{className:"text-sm text-muted-foreground tabular-nums",children:vO(n)})]}),r!==null&&r>0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),p.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:["ETA: ",vO(r)]})]})]}),p.jsx(m$,{current:i,total:e,fillClassName:"bg-foreground",activeBorderClassName:"border-foreground"})]})}function c0e({groupsDone:t,totalGroups:e,step:n,waitingBuckets:r}){const i=e>0?t/e*100:0,s=Math.min(i,100),a=(r==null?void 0:r.length)??0;return p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["Trainer Bucket",n!==null?` (Step ${n})`:"",a>0&&p.jsxs("span",{className:"ml-2 font-normal",children:["· ",a," batch",a!==1?"es":""," waiting for trainer"," · ",p.jsxs("span",{className:"tabular-nums",children:["steps ",r.join(", ")]})]})]}),p.jsxs("div",{className:"flex items-baseline gap-1.5",children:[p.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[s.toFixed(2),"%"]}),p.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[t," / ",e," Groups"]})]}),p.jsx(m$,{current:t,total:e,fillClassName:"bg-muted-foreground/40"})]})}function u0e(){var oe,Ue,Ee,Pe,Ze,ae,te,be,me,ge,ke;const t=ki(ml),e=ki(cT),n=ki(fT),r=zd(gG),i=zd(vG),[s,a]=T.useState(!0),[o,l]=T.useState(!0),[c,d]=T.useState("custom"),[h,g]=T.useState(0),[v,b]=T.useState(0),[_,w]=cn(xce),[S,E]=cn(yce),[A,N]=T.useState(String(S)),[D,P]=cn(bce),[L,R]=cn(xG),[O,W]=cn(Sce),F=D?n:null,{data:V,isLoading:G,error:Z}=ed(t||"",!!t,!0),{data:B}=pm(),q=T.useMemo(()=>{const Xe=(B==null?void 0:B.runs)||[],Ae=new Set(e);return t&&Ae.add(t),Xe.filter(je=>Ae.has(je.run_id)).map(je=>({runPath:je.run_id,runName:je.name,color:je.color,isSelected:je.run_id===t}))},[t,e,B==null?void 0:B.runs]);T.useEffect(()=>{V&&(r(V.is_tracking),i(V.is_syncing))},[V,r,i]);const K=typeof((oe=V==null?void 0:V.config)==null?void 0:oe.number_of_steps)=="number"?V.config.number_of_steps:null,Y=typeof((Ue=V==null?void 0:V.config)==null?void 0:Ue.prompts_batch_size_for_trainer)=="number"?V.config.prompts_batch_size_for_trainer:typeof((Ee=V==null?void 0:V.config)==null?void 0:Ee.batch_size_for_trainer)=="number"?V.config.batch_size_for_trainer:null,Q=(Pe=V==null?void 0:V.summary)!=null&&Pe.steps&&typeof V.summary.steps=="object"?V.summary.steps:null,U=$b((Ze=V==null?void 0:V.summary)==null?void 0:Ze["steps/last_training_step"])??$b(Q==null?void 0:Q.last_training_step)??$b((ae=V==null?void 0:V.trainer_info)==null?void 0:ae.last_training_step)??$b((te=V==null?void 0:V.rollout_info)==null?void 0:te.last_training_step)??$b(V==null?void 0:V.last_rollout_step)??-1,j=V==null?void 0:V.trainer_bucket_info,X=((be=V==null?void 0:V.step_metrics_info)==null?void 0:be.local_steps)??0,H=((me=V==null?void 0:V.step_metrics_info)==null?void 0:me.custom_metric_sections)??{},ie=(V==null?void 0:V.available_rollout_metric_names)??[],ne=((ge=V==null?void 0:V.eval_info)==null?void 0:ge.evals)??[],re=T.useMemo(()=>h$(H,ie,ne),[H,ie,ne]),ue=T.useMemo(()=>{if(D)return q;const Xe=q.find(Ae=>Ae.isSelected);return Xe?[Xe]:q.slice(0,1)},[D,q]),le=sS(Xf(iv,{activationConstraint:{distance:5}}),Xf(rv,{coordinateGetter:uS})),fe=T.useCallback(Xe=>{const{active:Ae,over:je}=Xe;!je||Ae.id===je.id||W(We=>{const De=We.findIndex(qe=>qe.id===Ae.id),Be=We.findIndex(qe=>qe.id===je.id);return De===-1||Be===-1?We:sv(We,De,Be)})},[W]),we=T.useMemo(()=>({runs:ue,shouldPoll:!0,showEma:_,emaSpan:S,hoveredRunId:F,xAxisMode:"step",scrollRoot:null}),[ue,_,S,F]),pe=T.useMemo(()=>!t||!(B!=null&&B.runs)?null:B.runs.find(Xe=>Xe.run_id===t)??null,[t,B]),xe=((ke=pe==null?void 0:pe.state)==null?void 0:ke.toLowerCase())==="running",Ve=i0e((pe==null?void 0:pe.created_at)??null,xe),ye=T.useMemo(()=>{var je,We,De;if(xe)return null;const Xe=(je=V==null?void 0:V.summary)==null?void 0:je._runtime;if(typeof Xe=="number")return Xe;const Ae=(De=(We=V==null?void 0:V.summary)==null?void 0:We._wandb)==null?void 0:De.runtime;return typeof Ae=="number"?Ae:null},[xe,V==null?void 0:V.summary]),Oe=xe?Ve:ye,{data:he}=PG(t||"","timing_step_total",!!t&&!!K&&U>0,!0),Re=T.useMemo(()=>{if(!(he!=null&&he.metrics)||!K||U<=0)return null;const Xe=he.metrics.filter(We=>We.metric_name==="timing_step_total").map(We=>({step:We.step,value:We.value}));if(Xe.length===0)return null;const Ae=Math.min(...Xe.map(We=>We.step)),je=Xe.filter(We=>We.step!==Ae);return o0e(je,U,K)},[he,K,U]);return t?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:p.jsx("div",{className:"py-2.5 px-6",children:p.jsx("div",{className:"max-w-7xl mx-auto flex items-center gap-2.5 h-7",children:pe&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:pe.color}}),p.jsx("span",{className:"text-sm font-semibold truncate",children:pe.name||pe.run_id.split("/").pop()}),p.jsx("span",{className:"text-sm text-muted-foreground truncate",children:pe.run_id}),pe.created_at&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),p.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums whitespace-nowrap",children:["Created at ",s0e(pe.created_at)]})]})]})})})}),p.jsx("div",{className:L?"flex-1 min-h-0 overflow-hidden":"flex-1 overflow-auto p-6",children:L?p.jsx(Xfe,{runPath:t,onBack:()=>R(!1)},t):p.jsxs("div",{className:"max-w-7xl mx-auto space-y-6",children:[G?p.jsxs("div",{className:"space-y-3",children:[p.jsx(Zh,{className:"h-4 w-32"}),p.jsx(Zh,{className:"h-8 w-64"}),p.jsx(Zh,{className:"h-8 w-full"})]}):Z?p.jsx($u,{className:"border-destructive",children:p.jsx(eh,{className:"pt-6",children:p.jsx("p",{className:"text-destructive",children:"Failed to load run summary. Make sure the run has been synced."})})}):p.jsxs("div",{className:"space-y-5",children:[K!==null?p.jsx(l0e,{currentStep:U,totalSteps:K,runtimeSeconds:Oe??null,estimatedSecondsToFinish:Re}):p.jsxs("div",{className:"space-y-1.5",children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Training Progress"}),p.jsx("div",{className:"flex items-baseline gap-1.5",children:p.jsx("span",{className:"text-sm text-muted-foreground",children:"Waiting for data…"})})]}),Y!==null&&j&&p.jsx(c0e,{groupsDone:j.groups_done,totalGroups:Y,step:j.step,waitingBuckets:V==null?void 0:V.waiting_buckets})]}),X>0&&q.length>0&&p.jsx("div",{children:s?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a(!1),children:"Hide Plots"}),p.jsx(dS,{label:"EMA",variant:"selecting",size:"sm",enabled:_,onEnabledChange:w,value:A,onValueChange:N,onValueCommit:Xe=>{const Ae=parseInt(Xe,10);!isNaN(Ae)&&Ae>=2&&Ae<=100?(E(Ae),N(Ae.toString())):N(S.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),p.jsx(g1,{variant:"selecting",size:"sm",pressed:D,onPressedChange:P,className:"text-xs px-2",children:"All selected runs"}),p.jsx(Q1,{catalog:re,existingPlots:O,onSelect:Xe=>{const Ae=Math.random().toString(36).slice(2,10);W(je=>[...je,{id:Ae,metricKey:Xe.metricKey,label:Xe.label,plotType:Xe.plotType,evalName:Xe.evalName}])},children:p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Plots"})})]}),p.jsx(lS,{sensors:le,collisionDetection:aS,onDragEnd:fe,children:p.jsx(cS,{items:O.map(Xe=>Xe.id),strategy:uw,children:p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:O.map(Xe=>p.jsx(K8,{plot:Xe,onRemove:()=>W(Ae=>Ae.filter(je=>je.id!==Xe.id)),chartProps:we},Xe.id))})})})]}):p.jsxs("button",{onClick:()=>a(!0),className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors flex items-center gap-1.5",children:[p.jsx("svg",{className:"h-4 w-4 text-muted-foreground -rotate-90",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"m6 9 6 6 6-6"})}),p.jsx("span",{className:"text-sm font-semibold",children:"Plots"})]})}),(V==null?void 0:V.config)&&(()=>{const{model:Xe,envNames:Ae}=a0e(V.config);return!Xe&&Ae.length===0?null:p.jsxs("div",{className:"flex items-center gap-3 text-sm mb-4",children:[Xe&&p.jsx("span",{className:"font-semibold",children:Xe}),Ae.map(je=>p.jsx("span",{className:"text-muted-foreground",children:je},je))]})})(),(V==null?void 0:V.config)&&Object.keys(V.config).length>0&&p.jsx("div",{children:o?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[p.jsx("span",{className:"text-sm font-semibold",children:"Run Configuration"}),V.custom_config&&p.jsxs(Z0,{type:"single",value:c,onValueChange:Xe=>{Xe&&d(Xe)},variant:"outline",size:"sm",children:[p.jsx(Uo,{value:"custom",className:"text-xs px-3 h-7",children:"Custom"}),p.jsx(Uo,{value:"all",className:"text-xs px-3 h-7",children:"All"})]}),p.jsx(Pfe,{currentRunId:t,currentConfig:V.config}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{g(Xe=>Xe+1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{b(Xe=>Xe+1)},children:"Expand All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>R(!0),children:"Code"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>l(!1),children:"Hide Configs"})]}),p.jsx(jG,{config:c==="custom"&&V.custom_config?V.custom_config:V.config,collapseAllSignal:h,expandAllSignal:v})]}):p.jsxs("button",{onClick:()=>l(!0),className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors flex items-center gap-1.5",children:[p.jsx("svg",{className:"h-4 w-4 text-muted-foreground -rotate-90",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"m6 9 6 6 6-6"})}),p.jsx("span",{className:"text-sm font-semibold",children:"Run Configuration"})]})})]})})]}):p.jsx(mm,{description:"Select a run from the sidebar or add a new one to get started."})}const c4=gT;function d0e(t){const e=t.trim();if(!e)return null;const n=/^(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?$/i,r=e.match(n);if(r&&(r[1]||r[2]||r[3])){const s=parseInt(r[1]||"0",10),a=parseInt(r[2]||"0",10),o=parseInt(r[3]||"0",10),l=s*3600+a*60+o;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function f0e(){var ie;const[t,e]=T.useState(null),n=T.useRef(0),[r,i]=cn(Nce),s=ki(ml),a=ki(cT),o=ki(fT),[l,c]=cn(Rce),[d,h]=T.useState(0),[g,v]=cn(wce),[b,_]=cn(Mce),[w,S]=T.useState(b.toString()),[E,A]=cn(Tce),[N,D]=cn(Ece),[P,L]=cn(Cce),[R,O]=cn(Ace),[W,F]=T.useState(P.toString()),[V,G]=T.useState(c4(R));T.useEffect(()=>{F(P.toString())},[P]),T.useEffect(()=>{G(c4(R))},[R]),DG();const Z=!0;T.useEffect(()=>{t&&(t.scrollTop=r,n.current=r)},[t]),T.useEffect(()=>{if(!t)return;const ne=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",ne,{passive:!0}),()=>{t.removeEventListener("scroll",ne),i(n.current)}},[t]);const{data:B}=pm(),q=T.useMemo(()=>{const ne=(B==null?void 0:B.runs)||[],re=new Set(a);return s&&re.add(s),ne.filter(ue=>re.has(ue.run_id)).map(ue=>({runPath:ue.run_id,runName:ue.name,color:ue.color,isSelected:ue.run_id===s}))},[s,a,B==null?void 0:B.runs]),{data:K,error:Y}=ed(s||"",!!s,Z),Q=K==null?void 0:K.step_metrics_info,U=(Q==null?void 0:Q.local_steps)??0,j=(K==null?void 0:K.available_rollout_metric_names)??[],X=(Q==null?void 0:Q.custom_metric_sections)??{},H=((ie=K==null?void 0:K.eval_info)==null?void 0:ie.evals)??[];return s?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center justify-start gap-2 h-7",children:[p.jsxs(Z0,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:ne=>{ne&&c(ne)},children:[p.jsx(Uo,{value:"all",className:"text-xs px-2 py-1 h-7",children:"All"}),p.jsx(Uo,{value:"custom",className:"text-xs px-2 py-1 h-7",children:"Custom"})]}),l==="custom"&&p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>h(ne=>ne+1),children:[p.jsx(ip,{className:"h-3 w-3 mr-1"}),"New Section"]}),p.jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),p.jsxs(Z0,{type:"single",variant:"outline",size:"sm",value:E,onValueChange:ne=>{ne&&A(ne)},children:[p.jsx(Uo,{value:"step",className:"text-xs px-2 py-1 h-7",children:"Step"}),p.jsx(Uo,{value:"time",className:"text-xs px-2 py-1 h-7",children:"Time"})]}),p.jsx(dS,{label:"EMA",variant:"selecting",size:"sm",enabled:g,onEnabledChange:v,value:w,onValueChange:S,onValueCommit:ne=>{const re=parseInt(ne,10);!isNaN(re)&&re>=2&&re<=100?(_(re),S(re.toString())):S(b.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),p.jsx(dS,{label:E==="step"?"Max Step":"Max Time",variant:"selecting",size:"sm",enabled:N,onEnabledChange:D,value:E==="step"?W:V,inputType:E==="step"?"number":"text",onValueChange:ne=>{E==="step"?F(ne):G(ne)},onValueCommit:ne=>{if(E==="step"){const re=parseInt(ne,10);!isNaN(re)&&re>=1?(L(re),F(re.toString())):F(P.toString())}else{const re=d0e(ne);re!==null?(O(re),G(c4(re))):G(c4(R))}},inputMin:1,inputWidth:"w-16"})]})})}),p.jsx("div",{className:"flex-1 overflow-auto p-6",ref:e,children:p.jsxs("div",{className:"max-w-7xl mx-auto",children:[Y&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",Y instanceof Error?Y.message:"Unknown error"]})})}),l==="all"?p.jsx(Zpe,{runs:q,shouldPoll:Z,totalSteps:U,showEma:g,emaSpan:b,hoveredRunId:o,availableRewardNames:j,customMetricSections:X,xAxisMode:E,scrollRoot:t,maxStep:N&&E==="step"?P:void 0,maxTime:N&&E==="time"?R:void 0,evalsList:H}):p.jsx(r0e,{runs:q,shouldPoll:Z,showEma:g,emaSpan:b,hoveredRunId:o,availableRewardNames:j,customMetricSections:X,xAxisMode:E,scrollRoot:t,maxStep:N&&E==="step"?P:void 0,maxTime:N&&E==="time"?R:void 0,evalsList:H,newSectionTrigger:d})]})})]}):p.jsx(mm,{description:"Select a run from the sidebar to view training metrics."})}function Z8({...t}){return p.jsx(Rae,{"data-slot":"select",...t})}function Q8({...t}){return p.jsx(Pae,{"data-slot":"select-value",...t})}function J8({className:t,size:e="default",children:n,...r}){return p.jsxs(kae,{"data-slot":"select-trigger","data-size":e,className:Rt("border-input data-[placeholder]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-[3px] aria-invalid:ring-[3px] data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r,children:[n,p.jsx(Iae,{asChild:!0,children:p.jsx(Vr,{className:"text-muted-foreground size-4 pointer-events-none"})})]})}function ek({className:t,children:e,position:n="item-aligned",align:r="center",...i}){return p.jsx(Dae,{children:p.jsxs(Oae,{"data-slot":"select-content",className:Rt("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 relative z-50 max-h-(--radix-select-content-available-height) origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,align:r,...i,children:[p.jsx(h0e,{}),p.jsx(Lae,{"data-position":n,className:Rt("data-[position=popper]:h-[var(--radix-select-trigger-height)] data-[position=popper]:w-full data-[position=popper]:min-w-[var(--radix-select-trigger-width)]",n==="popper"&&""),children:e}),p.jsx(p0e,{})]})})}function tk({className:t,children:e,...n}){return p.jsxs(zae,{"data-slot":"select-item",className:Rt("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...n,children:[p.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:p.jsx(Fae,{children:p.jsx(bv,{className:"pointer-events-none"})})}),p.jsx(jae,{children:e})]})}function h0e({className:t,...e}){return p.jsx(Uae,{"data-slot":"select-scroll-up-button",className:Rt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:p.jsx(h8,{})})}function p0e({className:t,...e}){return p.jsx(Bae,{"data-slot":"select-scroll-down-button",className:Rt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:p.jsx(Vr,{})})}const u4=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],NT={gpu_memory_used_gb:{label:"Memory Used",unit:"GB"},gpu_memory_total_gb:{label:"Memory Total",unit:"GB"},gpu_memory_free_gb:{label:"Memory Free",unit:"GB"},gpu_temperature_c:{label:"Temperature",unit:"degC"},gpu_power_w:{label:"Power",unit:"W"},gpu_power_limit_w:{label:"Power Limit",unit:"W"},gpu_utilization_percent:{label:"GPU Utilization",unit:"%"},gpu_memory_used_percent:{label:"Memory Capacity Used",unit:"%"},gpu_memory_bandwidth_utilization_percent:{label:"Memory Bandwidth Utilization",unit:"%"},gpu_clock_sm_mhz:{label:"SM Clock",unit:"MHz"},gpu_clock_mem_mhz:{label:"Memory Clock",unit:"MHz"},gpu_fan_speed_percent:{label:"Fan Speed",unit:"%"},torch_allocated_gb:{label:"Torch Memory Allocated",unit:"GB"},torch_reserved_gb:{label:"Torch Memory Reserved",unit:"GB"},torch_max_allocated_gb:{label:"Torch Max Memory Allocated",unit:"GB"},cpu_utilization_percent:{label:"CPU Utilization",unit:"%"},system_memory_total_gb:{label:"Memory Total",unit:"GB"},system_memory_used_gb:{label:"Memory Used",unit:"GB"},system_memory_available_gb:{label:"Memory Available",unit:"GB"},system_memory_percent:{label:"Memory Usage",unit:"%"},requests_running:{label:"Requests Running",unit:""},requests_waiting:{label:"Requests Waiting",unit:""},cache_usage:{label:"KV Cache Usage",unit:"%"},cache_hit_rate:{label:"KV Cache Hit Rate",unit:"%"},requests_total:{label:"Requests Total",unit:""},prompt_tokens_total:{label:"Prompt Tokens Total",unit:""},rollout_tokens_total:{label:"Rollout Tokens Total",unit:""},preemptions_total:{label:"Preemptions Total",unit:""},cache_hits_total:{label:"Cache Hits Total",unit:""},cache_queries_total:{label:"Cache Queries Total",unit:""},ttft_mean:{label:"TTFT (Mean)",unit:"s"},e2e_latency_mean:{label:"E2E Latency (Mean)",unit:"s"},itl_mean:{label:"ITL (Mean)",unit:"s"}};function m0e(t){const e=Math.abs(t);if(e>=60)return mT(t);if(e>0&&e<1){const n=t*1e3,r=Math.abs(n);return r<1?`${parseFloat(n.toFixed(2))}ms`:r<10?`${parseFloat(n.toFixed(1))}ms`:`${Math.round(n)}ms`}return nv(t)}const g0e=28;function v0e(t,e,n,r){if(!t||t.length===0||n<0||n>=t.length)return null;const i=Number(e[n]),s=c=>r==null?!0:Math.abs(Number(e[c])-i)<=r,a=t[n];if(a!=null)return s(n)?n:null;let o=n-1,l=n+1;for(;o>=0||l<t.length;){const c=o>=0?t[o]:void 0,d=l<t.length?t[l]:void 0,h=c!=null,g=d!=null;if(h&&g){const v=Math.abs(Number(e[o])-i),_=Math.abs(Number(e[l])-i)<v?l:o;return s(_)?_:null}if(h)return s(o)?o:null;if(g)return s(l)?l:null;o-=1,l+=1}return null}function x0e(t){if(t.length<4)return null;const e=[...t].sort((c,d)=>c-d),n=e.length,r=(n-1)*.25,i=(n-1)*.75,s=e[Math.floor(r)]+r%1*(e[Math.ceil(r)]-e[Math.floor(r)]),a=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),o=a-s,l=6;return{lower:s-l*o,upper:a+l*o}}function nA({label:t,onRemove:e}){return p.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] bg-white border border-gray-400 text-gray-600 rounded-full cursor-pointer hover:bg-gray-50 transition-colors",onClick:n=>{n.stopPropagation(),e()},children:[t,p.jsx(Ju,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function d4(t){return typeof t=="number"&&Number.isFinite(t)}function y0e(t,e){if(t.startsWith("#")){const i=t.slice(1),s=i.length===3?i.split("").map(a=>a+a).join(""):i;if(s.length===6){const a=Number.parseInt(s.slice(0,2),16),o=Number.parseInt(s.slice(2,4),16),l=Number.parseInt(s.slice(4,6),16);return`rgba(${a}, ${o}, ${l}, ${e})`}}const n=t.match(/^rgb\(([^)]+)\)$/i);if(n)return`rgba(${n[1]}, ${e})`;const r=t.match(/^rgba\(([^)]+)\)$/i);return r?`rgba(${r[1].split(",").slice(0,3).join(",")}, ${e})`:t}function g$({metricName:t,data:e,gpuIndices:n,intervalStart:r,intervalEnd:i,variant:s="default",strokeColor:a,gpuDisplayNames:o,isLoading:l,seriesMode:c="gpu",showLegend:d,seriesRoles:h,activeSeriesKeys:g=null,xOffset:v=0,xAxisMode:b="elapsed",xAxisTicks:_="auto",isRefetching:w=!1}){const S=T.useRef(null),E=T.useRef(null),A=T.useRef(null),[N,D]=T.useState(!1),[P,L]=T.useState(null),[R,O]=T.useState(null),W=NT[t]||{label:t.replace(/_/g," "),unit:""},F=s==="timeline",V=b==="clock"&&_==="bounds",G=T.useMemo(()=>{if(c==="node_gpu"){const H=new Map,ie=[...e].sort((ne,re)=>{const ue=d4(ne.node_id)?ne.node_id:Number.MAX_SAFE_INTEGER,le=d4(re.node_id)?re.node_id:Number.MAX_SAFE_INTEGER;return ue!==le?ue-le:ne.gpu_index-re.gpu_index});for(const ne of ie){const re=d4(ne.node_id)?ne.node_id:null,ue=`${re??"?"}:${ne.gpu_index}`;if(H.has(ue))continue;const le=re===null?"Node ?":`Node ${re}`,fe=H.size;H.set(ue,{key:ue,label:`${le} GPU ${ne.gpu_index}`,stroke:a||u4[fe%u4.length],gpuIndex:ne.gpu_index,nodeId:re})}return Array.from(H.values())}return(n.length>0?Array.from(new Set(n)).sort((H,ie)=>H-ie):Array.from(new Set(e.map(H=>H.gpu_index))).sort((H,ie)=>H-ie)).map(H=>({key:`gpu:${H}`,label:(o==null?void 0:o[H])??`GPU ${H}`,stroke:a||u4[H%u4.length],gpuIndex:H,nodeId:null}))},[c,e,n,o,a]),Z=T.useMemo(()=>new Set(G.map(X=>X.key)),[G]),{uplotData:B,seriesConfig:q,hasData:K,outlierBounds:Y}=T.useMemo(()=>{if(e.length===0||G.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const X={},H=new Set,ie=[];for(const fe of e){const we=c==="node_gpu"?`${d4(fe.node_id)?fe.node_id:"?"}:${fe.gpu_index}`:`gpu:${fe.gpu_index}`;Z.has(we)&&(H.add(fe.timestamp),X[fe.timestamp]||(X[fe.timestamp]={}),X[fe.timestamp][we]=fe.value,ie.push(fe.value))}const ne=Array.from(H).sort((fe,we)=>fe-we);if(ne.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const re=ne.map(fe=>fe-r),ue=[{label:"Time"}],le=[re];for(const fe of G){const we=ne.map(xe=>{var Ve;return((Ve=X[xe])==null?void 0:Ve[fe.key])??null}),pe=g!==null&&g.size>0&&!g.has(fe.key);le.push(we),ue.push({label:fe.label,stroke:pe?y0e(fe.stroke,.25):fe.stroke,width:pe?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:le,seriesConfig:ue,hasData:!0,outlierBounds:x0e(ie)}},[e,r,G,c,Z,g]),Q=d??(!F&&G.length>1),U=T.useCallback(X=>Math.abs(X)>=1e3?`${parseFloat((X/1e3).toFixed(1))}k`:Number.isInteger(X)?X.toLocaleString():Math.abs(X)<.01&&X!==0?X.toExponential(1):String(parseFloat(X.toFixed(2))),[]);T.useEffect(()=>{if(!S.current||!B||!K)return;const X=S.current,H=X.clientWidth,ie=192;let ne=Number.POSITIVE_INFINITY,re=Number.NEGATIVE_INFINITY;for(let oe=1;oe<B.length;oe+=1){const Ue=B[oe];for(let Ee=0;Ee<Ue.length;Ee+=1){const Pe=Ue[Ee];Pe!=null&&(N&&Y?Pe>=Y.lower&&Pe<=Y.upper&&(Pe<ne&&(ne=Pe),Pe>re&&(re=Pe)):(Pe<ne&&(ne=Pe),Pe>re&&(re=Pe)))}}ne===Number.POSITIVE_INFINITY&&Y&&(ne=Y.lower,re=Y.upper);const ue=re-ne,le=Math.max(Math.abs(re),Math.abs(ne)),fe=Math.max(le*.05,1e-10),we=Math.max(ue*.1,fe),pe=[P!==null?P:Math.max(0,ne-we),R!==null?R:re+we],xe="rgba(128, 128, 128, 0.15)",Ve="rgba(100, 100, 100, 0.9)",Oe={width:H,height:ie,padding:F?[0,0,0,0]:V?[4,24,0,4]:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!F,y:!1}},legend:{show:Q},...F?{}:{select:{show:!0,left:0,top:0,width:0,height:0}},scales:{x:{time:!1,range:(oe,Ue,Ee)=>{const Pe=i-r;return Pe>0?[0,Pe]:[Ue,Ee]}},y:{range:pe}},axes:F?[{show:!1,size:0},{show:!1,size:0}]:[{stroke:Ve,grid:{stroke:xe,width:1},ticks:{stroke:xe,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:_==="bounds"?(oe,Ue,Ee,Pe)=>[Ee,Pe]:void 0,values:(oe,Ue)=>Ue.map(Ee=>b==="clock"?K0(r+Number(Ee),i-r):nv(Number(Ee)+v))},{stroke:Ve,grid:{stroke:xe,width:1},ticks:{stroke:xe,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(oe,Ue)=>{if(!Ue||Ue.length===0)return 40;const Ee=Math.max(...Ue.map(Pe=>Pe.length));return Math.max(40,Ee*7+14)},values:(oe,Ue)=>Ue.map(U)}],series:q,hooks:{setCursor:[oe=>{if(!A.current||!S.current)return;const{left:Ue,idx:Ee}=oe.cursor;if(Ee==null||Ue===void 0||Ue<0){A.current.style.display="none";return}const Pe=B[0][Ee];if(Pe===void 0){A.current.style.display="none";return}const Ze=B[0],ae=(()=>{const qe=oe.scales.x,Se=Number(qe.min),Ye=Number(qe.max);if(!Number.isFinite(Se)||!Number.isFinite(Ye))return null;const dt=Math.abs(Ye-Se);if(dt<=0)return null;const Le=Math.max(1,oe.bbox.width);return dt*g0e/Le})(),te=m0e(Number(Pe)+v),be=r+Number(Pe),me=K0(be,i-r);let ge="";F||(ge+=`<div class="font-medium mb-1">${me}</div>`,ge+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${te}</div>`,ge+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${be.toFixed(3)}</div>`);const ke=[];for(let qe=0;qe<G.length;qe+=1){const Se=G[qe],Ye=B[qe+1],dt=v0e(Ye,Ze,Ee,ae);if(dt===null)continue;const Le=Ye==null?void 0:Ye[dt];Le!=null&&ke.push({entry:Se,formatted:qu(Le),role:(h==null?void 0:h[Se.key])??null})}const Xe=ke.length>0;if(ke.some(qe=>qe.role!==null)&&!F){const qe={Trainer:0,Inference:1},Se=[];for(const Ye of ke){const dt=Ye.role??"Other";Se.includes(dt)||Se.push(dt)}Se.sort((Ye,dt)=>(qe[Ye]??99)-(qe[dt]??99));for(const Ye of Se){ge+=`<div class="text-[10px] font-medium text-muted-foreground mt-1 mb-0.5">${Ye}</div>`;for(const dt of ke)(dt.role??"Other")===Ye&&(ge+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${dt.entry.stroke}"></div>
                      <span class="text-muted-foreground">${dt.entry.label}:</span>
                      <span class="font-medium">${dt.formatted} ${W.unit}</span>
                    </div>
                  `)}}else for(const qe of ke)F?ge+=`
                    <div class="flex items-center gap-2">
                      <span class="text-muted-foreground">${qe.entry.label}:</span>
                      <span class="font-medium">${qe.formatted} ${W.unit}</span>
                    </div>
                  `:ge+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${qe.entry.stroke}"></div>
                      <span class="text-muted-foreground">${qe.entry.label}:</span>
                      <span class="font-medium">${qe.formatted} ${W.unit}</span>
                    </div>
                  `;if(!Xe){A.current.style.display="none";return}F&&(ge+=`<div class="text-muted-foreground mt-1">Time: ${te}</div>`),A.current.innerHTML=ge,A.current.style.display="block";const je=S.current.getBoundingClientRect(),We=A.current.getBoundingClientRect();let De=je.left+Ue+15;De+We.width+20>window.innerWidth&&(De=je.left+Ue-We.width-15+oe.bbox.left),De=Math.max(4,De);let Be=je.top-We.height+20;Be<4&&(Be=je.bottom-20),A.current.style.left=`${De}px`,A.current.style.top=`${Be}px`}]}};E.current&&E.current.destroy();const he=new ma(Oe,B,X);E.current=he;const Re=new ResizeObserver(oe=>{for(const Ue of oe){const{width:Ee}=Ue.contentRect;he&&Ee>0&&he.setSize({width:Ee,height:ie})}});return Re.observe(X),()=>{Re.disconnect(),he.destroy(),E.current=null}},[B,K,q,t,r,i,v,b,_,V,F,W.unit,Q,G,h,U,N,Y,P,R]);const j=T.useCallback(()=>{A.current&&(A.current.style.display="none")},[]);return!K&&F?p.jsx("div",{className:"h-48 bg-muted/30 rounded-lg border border-border/50 opacity-50 transition-opacity duration-200"}):p.jsxs("div",{className:Rt("rounded-lg border transition-opacity",F?"overflow-hidden":"group/chart border-gray-200 p-3 bg-white",l&&"opacity-60"),children:[!F&&p.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h4",{className:"text-xs font-medium truncate",title:t,children:W.label}),N&&p.jsx(nA,{label:"Ignore Outliers",onRemove:()=>D(!1)}),P!==null&&p.jsx(nA,{label:`Min Y: ${P}`,onRemove:()=>L(null)}),R!==null&&p.jsx(nA,{label:`Max Y: ${R}`,onRemove:()=>O(null)})]}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:p.jsx(aw,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(vi,{checked:N,onCheckedChange:D,children:"Ignore Outliers"}),p.jsx(Hl,{}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),p.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:P??"",onChange:X=>{const H=X.target.value;L(H===""?null:Number(H))},onClick:X=>X.stopPropagation(),onKeyDown:X=>X.stopPropagation()})]}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),p.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:R??"",onChange:X=>{const H=X.target.value;O(H===""?null:Number(H))},onClick:X=>X.stopPropagation(),onKeyDown:X=>X.stopPropagation()})]})]})]})})]}),K?p.jsxs("div",{className:"h-48 relative bg-white rounded",ref:S,onMouseLeave:j,children:[!F&&w&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"}),p.jsx("div",{ref:A,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}})]}):p.jsx("div",{className:"h-48 flex items-center justify-center text-muted-foreground text-xs rounded",children:l?"Loading...":`No data for ${W.label}`})]})}function xO(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const a=n.slice(i,r).trim();(a||!s)&&e.push(a),i=r+1,r=n.indexOf(",",i)}return e}function b0e(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const _0e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,S0e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,w0e={};function yO(t,e){return(w0e.jsx?S0e:_0e).test(t)}const M0e=/[ \t\n\f\r]/g;function T0e(t){return typeof t=="object"?t.type==="text"?bO(t.value):!1:bO(t)}function bO(t){return t.replace(M0e,"")===""}class dw{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}dw.prototype.normal={};dw.prototype.property={};dw.prototype.space=void 0;function v$(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new dw(n,r,e)}function hS(t){return t.toLowerCase()}class Ac{constructor(e,n){this.attribute=n,this.property=e}}Ac.prototype.attribute="";Ac.prototype.booleanish=!1;Ac.prototype.boolean=!1;Ac.prototype.commaOrSpaceSeparated=!1;Ac.prototype.commaSeparated=!1;Ac.prototype.defined=!1;Ac.prototype.mustUseProperty=!1;Ac.prototype.number=!1;Ac.prototype.overloadedBoolean=!1;Ac.prototype.property="";Ac.prototype.spaceSeparated=!1;Ac.prototype.space=void 0;let E0e=0;const kr=wv(),Fa=wv(),dR=wv(),nn=wv(),ds=wv(),x1=wv(),Vc=wv();function wv(){return 2**++E0e}const fR=Object.freeze(Object.defineProperty({__proto__:null,boolean:kr,booleanish:Fa,commaOrSpaceSeparated:Vc,commaSeparated:x1,number:nn,overloadedBoolean:dR,spaceSeparated:ds},Symbol.toStringTag,{value:"Module"})),rA=Object.keys(fR);class nk extends Ac{constructor(e,n,r,i){let s=-1;if(super(e,n),_O(this,"space",i),typeof r=="number")for(;++s<rA.length;){const a=rA[s];_O(this,rA[s],(r&fR[a])===fR[a])}}}nk.prototype.defined=!0;function _O(t,e,n){n&&(t[e]=n)}function Cy(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new nk(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[hS(r)]=r,n[hS(s.attribute)]=r}return new dw(e,n,t.space)}const x$=Cy({properties:{ariaActiveDescendant:null,ariaAtomic:Fa,ariaAutoComplete:null,ariaBusy:Fa,ariaChecked:Fa,ariaColCount:nn,ariaColIndex:nn,ariaColSpan:nn,ariaControls:ds,ariaCurrent:null,ariaDescribedBy:ds,ariaDetails:null,ariaDisabled:Fa,ariaDropEffect:ds,ariaErrorMessage:null,ariaExpanded:Fa,ariaFlowTo:ds,ariaGrabbed:Fa,ariaHasPopup:null,ariaHidden:Fa,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ds,ariaLevel:nn,ariaLive:null,ariaModal:Fa,ariaMultiLine:Fa,ariaMultiSelectable:Fa,ariaOrientation:null,ariaOwns:ds,ariaPlaceholder:null,ariaPosInSet:nn,ariaPressed:Fa,ariaReadOnly:Fa,ariaRelevant:null,ariaRequired:Fa,ariaRoleDescription:ds,ariaRowCount:nn,ariaRowIndex:nn,ariaRowSpan:nn,ariaSelected:Fa,ariaSetSize:nn,ariaSort:null,ariaValueMax:nn,ariaValueMin:nn,ariaValueNow:nn,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function y$(t,e){return e in t?t[e]:e}function b$(t,e){return y$(t,e.toLowerCase())}const C0e=Cy({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:x1,acceptCharset:ds,accessKey:ds,action:null,allow:null,allowFullScreen:kr,allowPaymentRequest:kr,allowUserMedia:kr,alt:null,as:null,async:kr,autoCapitalize:null,autoComplete:ds,autoFocus:kr,autoPlay:kr,blocking:ds,capture:null,charSet:null,checked:kr,cite:null,className:ds,cols:nn,colSpan:null,content:null,contentEditable:Fa,controls:kr,controlsList:ds,coords:nn|x1,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kr,defer:kr,dir:null,dirName:null,disabled:kr,download:dR,draggable:Fa,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kr,formTarget:null,headers:ds,height:nn,hidden:dR,high:nn,href:null,hrefLang:null,htmlFor:ds,httpEquiv:ds,id:null,imageSizes:null,imageSrcSet:null,inert:kr,inputMode:null,integrity:null,is:null,isMap:kr,itemId:null,itemProp:ds,itemRef:ds,itemScope:kr,itemType:ds,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kr,low:nn,manifest:null,max:null,maxLength:nn,media:null,method:null,min:null,minLength:nn,multiple:kr,muted:kr,name:null,nonce:null,noModule:kr,noValidate:kr,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:kr,optimum:nn,pattern:null,ping:ds,placeholder:null,playsInline:kr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kr,referrerPolicy:null,rel:ds,required:kr,reversed:kr,rows:nn,rowSpan:nn,sandbox:ds,scope:null,scoped:kr,seamless:kr,selected:kr,shadowRootClonable:kr,shadowRootDelegatesFocus:kr,shadowRootMode:null,shape:null,size:nn,sizes:null,slot:null,span:nn,spellCheck:Fa,src:null,srcDoc:null,srcLang:null,srcSet:null,start:nn,step:null,style:null,tabIndex:nn,target:null,title:null,translate:null,type:null,typeMustMatch:kr,useMap:null,value:Fa,width:nn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ds,axis:null,background:null,bgColor:null,border:nn,borderColor:null,bottomMargin:nn,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kr,declare:kr,event:null,face:null,frame:null,frameBorder:null,hSpace:nn,leftMargin:nn,link:null,longDesc:null,lowSrc:null,marginHeight:nn,marginWidth:nn,noResize:kr,noHref:kr,noShade:kr,noWrap:kr,object:null,profile:null,prompt:null,rev:null,rightMargin:nn,rules:null,scheme:null,scrolling:Fa,standby:null,summary:null,text:null,topMargin:nn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:nn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kr,disableRemotePlayback:kr,prefix:null,property:null,results:nn,security:null,unselectable:null},space:"html",transform:b$}),A0e=Cy({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Vc,accentHeight:nn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:nn,amplitude:nn,arabicForm:null,ascent:nn,attributeName:null,attributeType:null,azimuth:nn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:nn,by:null,calcMode:null,capHeight:nn,className:ds,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:nn,diffuseConstant:nn,direction:null,display:null,dur:null,divisor:nn,dominantBaseline:null,download:kr,dx:null,dy:null,edgeMode:null,editable:null,elevation:nn,enableBackground:null,end:null,event:null,exponent:nn,externalResourcesRequired:null,fill:null,fillOpacity:nn,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:x1,g2:x1,glyphName:x1,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:nn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:nn,horizOriginX:nn,horizOriginY:nn,id:null,ideographic:nn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:nn,k:nn,k1:nn,k2:nn,k3:nn,k4:nn,kernelMatrix:Vc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:nn,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:nn,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:nn,overlineThickness:nn,paintOrder:null,panose1:null,path:null,pathLength:nn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ds,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:nn,pointsAtY:nn,pointsAtZ:nn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Vc,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Vc,rev:Vc,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Vc,requiredFeatures:Vc,requiredFonts:Vc,requiredFormats:Vc,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:nn,specularExponent:nn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:nn,strikethroughThickness:nn,string:null,stroke:null,strokeDashArray:Vc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:nn,strokeOpacity:nn,strokeWidth:null,style:null,surfaceScale:nn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Vc,tabIndex:nn,tableValues:null,target:null,targetX:nn,targetY:nn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Vc,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:nn,underlineThickness:nn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:nn,values:null,vAlphabetic:nn,vMathematical:nn,vectorEffect:null,vHanging:nn,vIdeographic:nn,version:null,vertAdvY:nn,vertOriginX:nn,vertOriginY:nn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:nn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:y$}),_$=Cy({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),S$=Cy({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:b$}),w$=Cy({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),N0e={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},R0e=/[A-Z]/g,SO=/-[a-z]/g,k0e=/^data[-\w.:]+$/i;function M$(t,e){const n=hS(e);let r=e,i=Ac;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&k0e.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(SO,I0e);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!SO.test(s)){let a=s.replace(R0e,P0e);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}i=nk}return new i(r,e)}function P0e(t){return"-"+t.toLowerCase()}function I0e(t){return t.charAt(1).toUpperCase()}const T$=v$([x$,C0e,_$,S$,w$],"html"),RT=v$([x$,A0e,_$,S$,w$],"svg");function wO(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function D0e(t){return t.join(" ").trim()}var Ex={},iA,MO;function O0e(){if(MO)return iA;MO=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,l=`
`,c="/",d="*",h="",g="comment",v="declaration";function b(w,S){if(typeof w!="string")throw new TypeError("First argument must be a string");if(!w)return[];S=S||{};var E=1,A=1;function N(Z){var B=Z.match(e);B&&(E+=B.length);var q=Z.lastIndexOf(l);A=~q?Z.length-q:A+Z.length}function D(){var Z={line:E,column:A};return function(B){return B.position=new P(Z),O(),B}}function P(Z){this.start=Z,this.end={line:E,column:A},this.source=S.source}P.prototype.content=w;function L(Z){var B=new Error(S.source+":"+E+":"+A+": "+Z);if(B.reason=Z,B.filename=S.source,B.line=E,B.column=A,B.source=w,!S.silent)throw B}function R(Z){var B=Z.exec(w);if(B){var q=B[0];return N(q),w=w.slice(q.length),B}}function O(){R(n)}function W(Z){var B;for(Z=Z||[];B=F();)B!==!1&&Z.push(B);return Z}function F(){var Z=D();if(!(c!=w.charAt(0)||d!=w.charAt(1))){for(var B=2;h!=w.charAt(B)&&(d!=w.charAt(B)||c!=w.charAt(B+1));)++B;if(B+=2,h===w.charAt(B-1))return L("End of comment missing");var q=w.slice(2,B-2);return A+=2,N(q),w=w.slice(B),A+=2,Z({type:g,comment:q})}}function V(){var Z=D(),B=R(r);if(B){if(F(),!R(i))return L("property missing ':'");var q=R(s),K=Z({type:v,property:_(B[0].replace(t,h)),value:q?_(q[0].replace(t,h)):h});return R(a),K}}function G(){var Z=[];W(Z);for(var B;B=V();)B!==!1&&(Z.push(B),W(Z));return Z}return O(),G()}function _(w){return w?w.replace(o,h):h}return iA=b,iA}var TO;function L0e(){if(TO)return Ex;TO=1;var t=Ex&&Ex.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ex,"__esModule",{value:!0}),Ex.default=n;const e=t(O0e());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const a=(0,e.default)(r),o=typeof i=="function";return a.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:d}=l;o?i(c,d,l):d&&(s=s||{},s[c]=d)}),s}return Ex}var qb={},EO;function z0e(){if(EO)return qb;EO=1,Object.defineProperty(qb,"__esModule",{value:!0}),qb.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,s=function(c){return!c||n.test(c)||t.test(c)},a=function(c,d){return d.toUpperCase()},o=function(c,d){return"".concat(d,"-")},l=function(c,d){return d===void 0&&(d={}),s(c)?c:(c=c.toLowerCase(),d.reactCompat?c=c.replace(i,o):c=c.replace(r,o),c.replace(e,a))};return qb.camelCase=l,qb}var Xb,CO;function j0e(){if(CO)return Xb;CO=1;var t=Xb&&Xb.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(L0e()),n=z0e();function r(i,s){var a={};return!i||typeof i!="string"||(0,e.default)(i,function(o,l){o&&l&&(a[(0,n.camelCase)(o,s)]=l)}),a}return r.default=r,Xb=r,Xb}var F0e=j0e();const U0e=dy(F0e),E$=C$("end"),rk=C$("start");function C$(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function B0e(t){const e=rk(t),n=E$(t);if(e&&n)return{start:e,end:n}}function R_(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?AO(t.position):"start"in t||"end"in t?AO(t):"line"in t||"column"in t?hR(t):""}function hR(t){return NO(t&&t.line)+":"+NO(t&&t.column)}function AO(t){return hR(t&&t.start)+"-"+hR(t&&t.end)}function NO(t){return t&&typeof t=="number"?t:1}class gl extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},a=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(a=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const o=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=o?o.line:void 0,this.name=R_(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}gl.prototype.file="";gl.prototype.name="";gl.prototype.reason="";gl.prototype.message="";gl.prototype.stack="";gl.prototype.column=void 0;gl.prototype.line=void 0;gl.prototype.ancestors=void 0;gl.prototype.cause=void 0;gl.prototype.fatal=void 0;gl.prototype.place=void 0;gl.prototype.ruleId=void 0;gl.prototype.source=void 0;const ik={}.hasOwnProperty,H0e=new Map,V0e=/[A-Z]/g,G0e=new Set(["table","tbody","thead","tfoot","tr"]),W0e=new Set(["td","th"]),A$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function $0e(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=eme(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=J0e(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?RT:T$,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=N$(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function N$(t,e,n){if(e.type==="element")return q0e(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return X0e(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return K0e(t,e,n);if(e.type==="mdxjsEsm")return Y0e(t,e);if(e.type==="root")return Z0e(t,e,n);if(e.type==="text")return Q0e(t,e)}function q0e(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=RT,t.schema=i),t.ancestors.push(e);const s=k$(t,e.tagName,!1),a=tme(t,e);let o=ak(t,e);return G0e.has(e.tagName)&&(o=o.filter(function(l){return typeof l=="string"?!T0e(l):!0})),R$(t,a,s,e),sk(a,o),t.ancestors.pop(),t.schema=r,t.create(e,s,a,n)}function X0e(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}pS(t,e.position)}function Y0e(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);pS(t,e.position)}function K0e(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=RT,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:k$(t,e.name,!0),a=nme(t,e),o=ak(t,e);return R$(t,a,s,e),sk(a,o),t.ancestors.pop(),t.schema=r,t.create(e,s,a,n)}function Z0e(t,e,n){const r={};return sk(r,ak(t,e)),t.create(e,t.Fragment,r,n)}function Q0e(t,e){return e.value}function R$(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function sk(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function J0e(t,e,n){return r;function r(i,s,a,o){const c=Array.isArray(a.children)?n:e;return o?c(s,a,o):c(s,a)}}function eme(t,e){return n;function n(r,i,s,a){const o=Array.isArray(s.children),l=rk(r);return e(i,s,a,o,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function tme(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&ik.call(e.properties,i)){const s=rme(t,i,e.properties[i]);if(s){const[a,o]=s;t.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&W0e.has(e.tagName)?r=o:n[a]=o}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function nme(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,t.evaluater.evaluateExpression(o.argument))}else pS(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const o=r.value.data.estree.body[0];o.type,s=t.evaluater.evaluateExpression(o.expression)}else pS(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function ak(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:H0e;for(;++r<e.children.length;){const s=e.children[r];let a;if(t.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;a=l+"-"+c,i.set(l,c+1)}}const o=N$(t,s,a);o!==void 0&&n.push(o)}return n}function rme(t,e,n){const r=M$(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?b0e(n):D0e(n)),r.property==="style"){let i=typeof n=="object"?n:ime(t,String(n));return t.stylePropertyNameCase==="css"&&(i=sme(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?N0e[r.property]||r.property:r.attribute,n]}}function ime(t,e){try{return U0e(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new gl("Cannot parse `style` attribute",{ancestors:t.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=t.filePath||void 0,i.url=A$+"#cannot-parse-style-attribute",i}}function k$(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,a;for(;++s<i.length;){const o=yO(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};a=a?{type:"MemberExpression",object:a,property:o,computed:!!(s&&o.type==="Literal"),optional:!1}:o}r=a}else r=yO(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return ik.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);pS(t)}function pS(t,e){const n=new gl("Cannot handle MDX estrees without `createEvaluater`",{ancestors:t.ancestors,place:e,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=t.filePath||void 0,n.url=A$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function sme(t){const e={};let n;for(n in t)ik.call(t,n)&&(e[ame(n)]=t[n]);return e}function ame(t){let e=t.replace(V0e,ome);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function ome(t){return"-"+t.toLowerCase()}const sA={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},lme={};function cme(t,e){const n=lme,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return P$(t,r,i)}function P$(t,e,n){if(ume(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return RO(t.children,e,n)}return Array.isArray(t)?RO(t,e,n):""}function RO(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=P$(t[i],e,n);return r.join("")}function ume(t){return!!(t&&typeof t=="object")}const kO=document.createElement("i");function ok(t){const e="&"+t+";";kO.innerHTML=e;const n=kO.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function ih(t,e,n,r){const i=t.length;let s=0,a;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);s<r.length;)a=r.slice(s,s+1e4),a.unshift(e,0),t.splice(...a),s+=1e4,e+=1e4}function Uu(t,e){return t.length>0?(ih(t,t.length,0,e),t):e}const PO={}.hasOwnProperty;function dme(t){const e={};let n=-1;for(;++n<t.length;)fme(e,t[n]);return e}function fme(t,e){let n;for(n in e){const i=(PO.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let a;if(s)for(a in s){PO.call(i,a)||(i[a]=[]);const o=s[a];hme(i[a],Array.isArray(o)?o:o?[o]:[])}}}function hme(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);ih(t,0,0,r)}function I$(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function y1(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Vf=gm(/[A-Za-z]/),Yc=gm(/[\dA-Za-z]/),pme=gm(/[#-'*+\--9=?A-Z^-~]/);function pR(t){return t!==null&&(t<32||t===127)}const mR=gm(/\d/),mme=gm(/[\dA-Fa-f]/),gme=gm(/[!-/:-@[-`{-~]/);function Yn(t){return t!==null&&t<-2}function Ec(t){return t!==null&&(t<0||t===32)}function Ri(t){return t===-2||t===-1||t===32}const vme=gm(new RegExp("\\p{P}|\\p{S}","u")),xme=gm(/\s/);function gm(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ay(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let a="";if(s===37&&Yc(t.charCodeAt(n+1))&&Yc(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const o=t.charCodeAt(n+1);s<56320&&o>56319&&o<57344?(a=String.fromCharCode(s,o),i=1):a="�"}else a=String.fromCharCode(s);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+i+1,a=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Fi(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(l){return Ri(l)?(t.enter(n),o(l)):e(l)}function o(l){return Ri(l)&&s++<i?(t.consume(l),o):(t.exit(n),e(l))}}const yme={tokenize:bme};function bme(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(o){if(o===null){t.consume(o);return}return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Fi(t,e,"linePrefix")}function i(o){return t.enter("paragraph"),s(o)}function s(o){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,a(o)}function a(o){if(o===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(o);return}return Yn(o)?(t.consume(o),t.exit("chunkText"),s):(t.consume(o),a)}}const _me={tokenize:Sme},IO={tokenize:wme};function Sme(t){const e=this,n=[];let r=0,i,s,a;return o;function o(A){if(r<n.length){const N=n[r];return e.containerState=N[1],t.attempt(N[0].continuation,l,c)(A)}return c(A)}function l(A){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&E();const N=e.events.length;let D=N,P;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){P=e.events[D][1].end;break}S(r);let L=N;for(;L<e.events.length;)e.events[L][1].end={...P},L++;return ih(e.events,D+1,0,e.events.slice(N)),e.events.length=L,c(A)}return o(A)}function c(A){if(r===n.length){if(!i)return g(A);if(i.currentConstruct&&i.currentConstruct.concrete)return b(A);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(IO,d,h)(A)}function d(A){return i&&E(),S(r),g(A)}function h(A){return e.parser.lazy[e.now().line]=r!==n.length,a=e.now().offset,b(A)}function g(A){return e.containerState={},t.attempt(IO,v,b)(A)}function v(A){return r++,n.push([e.currentConstruct,e.containerState]),g(A)}function b(A){if(A===null){i&&E(),S(0),t.consume(A);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),_(A)}function _(A){if(A===null){w(t.exit("chunkFlow"),!0),S(0),t.consume(A);return}return Yn(A)?(t.consume(A),w(t.exit("chunkFlow")),r=0,e.interrupt=void 0,o):(t.consume(A),_)}function w(A,N){const D=e.sliceStream(A);if(N&&D.push(null),A.previous=s,s&&(s.next=A),s=A,i.defineSkip(A.start),i.write(D),e.parser.lazy[A.start.line]){let P=i.events.length;for(;P--;)if(i.events[P][1].start.offset<a&&(!i.events[P][1].end||i.events[P][1].end.offset>a))return;const L=e.events.length;let R=L,O,W;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){if(O){W=e.events[R][1].end;break}O=!0}for(S(r),P=L;P<e.events.length;)e.events[P][1].end={...W},P++;ih(e.events,R+1,0,e.events.slice(L)),e.events.length=P}}function S(A){let N=n.length;for(;N-- >A;){const D=n[N];e.containerState=D[1],D[0].exit.call(e,t)}n.length=A}function E(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function wme(t,e,n){return Fi(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function DO(t){if(t===null||Ec(t)||xme(t))return 1;if(vme(t))return 2}function lk(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const gR={name:"attention",resolveAll:Mme,tokenize:Tme};function Mme(t,e){let n=-1,r,i,s,a,o,l,c,d;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[r][1].end},g={...t[n][1].start};OO(h,-l),OO(g,l),a={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},o={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},s={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},t[r][1].end={...a.start},t[n][1].start={...o.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=Uu(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=Uu(c,[["enter",i,e],["enter",a,e],["exit",a,e],["enter",s,e]]),c=Uu(c,lk(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=Uu(c,[["exit",s,e],["enter",o,e],["exit",o,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(d=2,c=Uu(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,ih(t,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function Tme(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=DO(r);let s;return a;function a(l){return s=l,t.enter("attentionSequence"),o(l)}function o(l){if(l===s)return t.consume(l),o;const c=t.exit("attentionSequence"),d=DO(l),h=!d||d===2&&i||n.includes(l),g=!i||i===2&&d||n.includes(r);return c._open=!!(s===42?h:h&&(i||!g)),c._close=!!(s===42?g:g&&(d||!h)),e(l)}}function OO(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const Eme={name:"autolink",tokenize:Cme};function Cme(t,e,n){let r=0;return i;function i(v){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(v){return Vf(v)?(t.consume(v),a):v===64?n(v):c(v)}function a(v){return v===43||v===45||v===46||Yc(v)?(r=1,o(v)):c(v)}function o(v){return v===58?(t.consume(v),r=0,l):(v===43||v===45||v===46||Yc(v))&&r++<32?(t.consume(v),o):(r=0,c(v))}function l(v){return v===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),e):v===null||v===32||v===60||pR(v)?n(v):(t.consume(v),l)}function c(v){return v===64?(t.consume(v),d):pme(v)?(t.consume(v),c):n(v)}function d(v){return Yc(v)?h(v):n(v)}function h(v){return v===46?(t.consume(v),r=0,d):v===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(v),t.exit("autolinkMarker"),t.exit("autolink"),e):g(v)}function g(v){if((v===45||Yc(v))&&r++<63){const b=v===45?g:h;return t.consume(v),b}return n(v)}}const kT={partial:!0,tokenize:Ame};function Ame(t,e,n){return r;function r(s){return Ri(s)?Fi(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||Yn(s)?e(s):n(s)}}const D$={continuation:{tokenize:Rme},exit:kme,name:"blockQuote",tokenize:Nme};function Nme(t,e,n){const r=this;return i;function i(a){if(a===62){const o=r.containerState;return o.open||(t.enter("blockQuote",{_container:!0}),o.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(a),t.exit("blockQuoteMarker"),s}return n(a)}function s(a){return Ri(a)?(t.enter("blockQuotePrefixWhitespace"),t.consume(a),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(a))}}function Rme(t,e,n){const r=this;return i;function i(a){return Ri(a)?Fi(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return t.attempt(D$,e,n)(a)}}function kme(t){t.exit("blockQuote")}const O$={name:"characterEscape",tokenize:Pme};function Pme(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return gme(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const L$={name:"characterReference",tokenize:Ime};function Ime(t,e,n){const r=this;let i=0,s,a;return o;function o(h){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),l}function l(h){return h===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(h),t.exit("characterReferenceMarkerNumeric"),c):(t.enter("characterReferenceValue"),s=31,a=Yc,d(h))}function c(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,a=mme,d):(t.enter("characterReferenceValue"),s=7,a=mR,d(h))}function d(h){if(h===59&&i){const g=t.exit("characterReferenceValue");return a===Yc&&!ok(r.sliceSerialize(g))?n(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return a(h)&&i++<s?(t.consume(h),d):n(h)}}const LO={partial:!0,tokenize:Ome},zO={concrete:!0,name:"codeFenced",tokenize:Dme};function Dme(t,e,n){const r=this,i={partial:!0,tokenize:D};let s=0,a=0,o;return l;function l(P){return c(P)}function c(P){const L=r.events[r.events.length-1];return s=L&&L[1].type==="linePrefix"?L[2].sliceSerialize(L[1],!0).length:0,o=P,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(P)}function d(P){return P===o?(a++,t.consume(P),d):a<3?n(P):(t.exit("codeFencedFenceSequence"),Ri(P)?Fi(t,h,"whitespace")(P):h(P))}function h(P){return P===null||Yn(P)?(t.exit("codeFencedFence"),r.interrupt?e(P):t.check(LO,_,N)(P)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),g(P))}function g(P){return P===null||Yn(P)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(P)):Ri(P)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Fi(t,v,"whitespace")(P)):P===96&&P===o?n(P):(t.consume(P),g)}function v(P){return P===null||Yn(P)?h(P):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),b(P))}function b(P){return P===null||Yn(P)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(P)):P===96&&P===o?n(P):(t.consume(P),b)}function _(P){return t.attempt(i,N,w)(P)}function w(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),S}function S(P){return s>0&&Ri(P)?Fi(t,E,"linePrefix",s+1)(P):E(P)}function E(P){return P===null||Yn(P)?t.check(LO,_,N)(P):(t.enter("codeFlowValue"),A(P))}function A(P){return P===null||Yn(P)?(t.exit("codeFlowValue"),E(P)):(t.consume(P),A)}function N(P){return t.exit("codeFenced"),e(P)}function D(P,L,R){let O=0;return W;function W(B){return P.enter("lineEnding"),P.consume(B),P.exit("lineEnding"),F}function F(B){return P.enter("codeFencedFence"),Ri(B)?Fi(P,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):V(B)}function V(B){return B===o?(P.enter("codeFencedFenceSequence"),G(B)):R(B)}function G(B){return B===o?(O++,P.consume(B),G):O>=a?(P.exit("codeFencedFenceSequence"),Ri(B)?Fi(P,Z,"whitespace")(B):Z(B)):R(B)}function Z(B){return B===null||Yn(B)?(P.exit("codeFencedFence"),L(B)):R(B)}}}function Ome(t,e,n){const r=this;return i;function i(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const aA={name:"codeIndented",tokenize:zme},Lme={partial:!0,tokenize:jme};function zme(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Fi(t,s,"linePrefix",5)(c)}function s(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(c):n(c)}function a(c){return c===null?l(c):Yn(c)?t.attempt(Lme,a,l)(c):(t.enter("codeFlowValue"),o(c))}function o(c){return c===null||Yn(c)?(t.exit("codeFlowValue"),a(c)):(t.consume(c),o)}function l(c){return t.exit("codeIndented"),e(c)}}function jme(t,e,n){const r=this;return i;function i(a){return r.parser.lazy[r.now().line]?n(a):Yn(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):Fi(t,s,"linePrefix",5)(a)}function s(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(a):Yn(a)?i(a):n(a)}}const Fme={name:"codeText",previous:Bme,resolve:Ume,tokenize:Hme};function Ume(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function Bme(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Hme(t,e,n){let r=0,i,s;return a;function a(h){return t.enter("codeText"),t.enter("codeTextSequence"),o(h)}function o(h){return h===96?(t.consume(h),r++,o):(t.exit("codeTextSequence"),l(h))}function l(h){return h===null?n(h):h===32?(t.enter("space"),t.consume(h),t.exit("space"),l):h===96?(s=t.enter("codeTextSequence"),i=0,d(h)):Yn(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),l):(t.enter("codeTextData"),c(h))}function c(h){return h===null||h===32||h===96||Yn(h)?(t.exit("codeTextData"),l(h)):(t.consume(h),c)}function d(h){return h===96?(t.consume(h),i++,d):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(s.type="codeTextData",c(h))}}class Vme{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Yb(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Yb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Yb(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);Yb(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Yb(this.left,n.reverse())}}}function Yb(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function z$(t){const e={};let n=-1,r,i,s,a,o,l,c;const d=new Vme(t);for(;++n<d.length;){for(;n in e;)n=e[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,Gme(d,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(a=d.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),a[1].type="lineEnding",i=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},o=d.slice(i,n),o.unshift(r),d.splice(i,n-i+1,o))}}return ih(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function Gme(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const o=a.events,l=[],c={};let d,h,g=-1,v=n,b=0,_=0;const w=[_];for(;v;){for(;t.get(++i)[1]!==v;);s.push(i),v._tokenizer||(d=r.sliceStream(v),v.next||d.push(null),h&&a.defineSkip(v.start),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),v._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),h=v,v=v.next}for(v=n;++g<o.length;)o[g][0]==="exit"&&o[g-1][0]==="enter"&&o[g][1].type===o[g-1][1].type&&o[g][1].start.line!==o[g][1].end.line&&(_=g+1,w.push(_),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(a.events=[],v?(v._tokenizer=void 0,v.previous=void 0):w.pop(),g=w.length;g--;){const S=o.slice(w[g],w[g+1]),E=s.pop();l.push([E,E+S.length-1]),t.splice(E,2,S)}for(l.reverse(),g=-1;++g<l.length;)c[b+l[g][0]]=b+l[g][1],b+=l[g][1]-l[g][0]-1;return c}const Wme={resolve:qme,tokenize:Xme},$me={partial:!0,tokenize:Yme};function qme(t){return z$(t),t}function Xme(t,e){let n;return r;function r(o){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(o)}function i(o){return o===null?s(o):Yn(o)?t.check($me,a,s)(o):(t.consume(o),i)}function s(o){return t.exit("chunkContent"),t.exit("content"),e(o)}function a(o){return t.consume(o),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function Yme(t,e,n){const r=this;return i;function i(a){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Fi(t,s,"linePrefix")}function s(a){if(a===null||Yn(a))return n(a);const o=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function j$(t,e,n,r,i,s,a,o,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(S){return S===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(S),t.exit(s),g):S===null||S===32||S===41||pR(S)?n(S):(t.enter(r),t.enter(a),t.enter(o),t.enter("chunkString",{contentType:"string"}),_(S))}function g(S){return S===62?(t.enter(s),t.consume(S),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(o),t.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(t.exit("chunkString"),t.exit(o),g(S)):S===null||S===60||Yn(S)?n(S):(t.consume(S),S===92?b:v)}function b(S){return S===60||S===62||S===92?(t.consume(S),v):v(S)}function _(S){return!d&&(S===null||S===41||Ec(S))?(t.exit("chunkString"),t.exit(o),t.exit(a),t.exit(r),e(S)):d<c&&S===40?(t.consume(S),d++,_):S===41?(t.consume(S),d--,_):S===null||S===32||S===40||pR(S)?n(S):(t.consume(S),S===92?w:_)}function w(S){return S===40||S===41||S===92?(t.consume(S),_):_(S)}}function F$(t,e,n,r,i,s){const a=this;let o=0,l;return c;function c(v){return t.enter(r),t.enter(i),t.consume(v),t.exit(i),t.enter(s),d}function d(v){return o>999||v===null||v===91||v===93&&!l||v===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(v):v===93?(t.exit(s),t.enter(i),t.consume(v),t.exit(i),t.exit(r),e):Yn(v)?(t.enter("lineEnding"),t.consume(v),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),h(v))}function h(v){return v===null||v===91||v===93||Yn(v)||o++>999?(t.exit("chunkString"),d(v)):(t.consume(v),l||(l=!Ri(v)),v===92?g:h)}function g(v){return v===91||v===92||v===93?(t.consume(v),o++,h):h(v)}}function U$(t,e,n,r,i,s){let a;return o;function o(g){return g===34||g===39||g===40?(t.enter(r),t.enter(i),t.consume(g),t.exit(i),a=g===40?41:g,l):n(g)}function l(g){return g===a?(t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):(t.enter(s),c(g))}function c(g){return g===a?(t.exit(s),l(a)):g===null?n(g):Yn(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Fi(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===a||g===null||Yn(g)?(t.exit("chunkString"),c(g)):(t.consume(g),g===92?h:d)}function h(g){return g===a||g===92?(t.consume(g),d):d(g)}}function k_(t,e){let n;return r;function r(i){return Yn(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ri(i)?Fi(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const Kme={name:"definition",tokenize:Qme},Zme={partial:!0,tokenize:Jme};function Qme(t,e,n){const r=this;let i;return s;function s(v){return t.enter("definition"),a(v)}function a(v){return F$.call(r,t,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function o(v){return i=y1(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),v===58?(t.enter("definitionMarker"),t.consume(v),t.exit("definitionMarker"),l):n(v)}function l(v){return Ec(v)?k_(t,c)(v):c(v)}function c(v){return j$(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function d(v){return t.attempt(Zme,h,h)(v)}function h(v){return Ri(v)?Fi(t,g,"whitespace")(v):g(v)}function g(v){return v===null||Yn(v)?(t.exit("definition"),r.parser.defined.push(i),e(v)):n(v)}}function Jme(t,e,n){return r;function r(o){return Ec(o)?k_(t,i)(o):n(o)}function i(o){return U$(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function s(o){return Ri(o)?Fi(t,a,"whitespace")(o):a(o)}function a(o){return o===null||Yn(o)?e(o):n(o)}}const ege={name:"hardBreakEscape",tokenize:tge};function tge(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Yn(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const nge={name:"headingAtx",resolve:rge,tokenize:ige};function rge(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ih(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function ige(t,e,n){let r=0;return i;function i(d){return t.enter("atxHeading"),s(d)}function s(d){return t.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(t.consume(d),a):d===null||Ec(d)?(t.exit("atxHeadingSequence"),o(d)):n(d)}function o(d){return d===35?(t.enter("atxHeadingSequence"),l(d)):d===null||Yn(d)?(t.exit("atxHeading"),e(d)):Ri(d)?Fi(t,o,"whitespace")(d):(t.enter("atxHeadingText"),c(d))}function l(d){return d===35?(t.consume(d),l):(t.exit("atxHeadingSequence"),o(d))}function c(d){return d===null||d===35||Ec(d)?(t.exit("atxHeadingText"),o(d)):(t.consume(d),c)}}const sge=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],jO=["pre","script","style","textarea"],age={concrete:!0,name:"htmlFlow",resolveTo:cge,tokenize:uge},oge={partial:!0,tokenize:fge},lge={partial:!0,tokenize:dge};function cge(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function uge(t,e,n){const r=this;let i,s,a,o,l;return c;function c(H){return d(H)}function d(H){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(H),h}function h(H){return H===33?(t.consume(H),g):H===47?(t.consume(H),s=!0,_):H===63?(t.consume(H),i=3,r.interrupt?e:U):Vf(H)?(t.consume(H),a=String.fromCharCode(H),w):n(H)}function g(H){return H===45?(t.consume(H),i=2,v):H===91?(t.consume(H),i=5,o=0,b):Vf(H)?(t.consume(H),i=4,r.interrupt?e:U):n(H)}function v(H){return H===45?(t.consume(H),r.interrupt?e:U):n(H)}function b(H){const ie="CDATA[";return H===ie.charCodeAt(o++)?(t.consume(H),o===ie.length?r.interrupt?e:V:b):n(H)}function _(H){return Vf(H)?(t.consume(H),a=String.fromCharCode(H),w):n(H)}function w(H){if(H===null||H===47||H===62||Ec(H)){const ie=H===47,ne=a.toLowerCase();return!ie&&!s&&jO.includes(ne)?(i=1,r.interrupt?e(H):V(H)):sge.includes(a.toLowerCase())?(i=6,ie?(t.consume(H),S):r.interrupt?e(H):V(H)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(H):s?E(H):A(H))}return H===45||Yc(H)?(t.consume(H),a+=String.fromCharCode(H),w):n(H)}function S(H){return H===62?(t.consume(H),r.interrupt?e:V):n(H)}function E(H){return Ri(H)?(t.consume(H),E):W(H)}function A(H){return H===47?(t.consume(H),W):H===58||H===95||Vf(H)?(t.consume(H),N):Ri(H)?(t.consume(H),A):W(H)}function N(H){return H===45||H===46||H===58||H===95||Yc(H)?(t.consume(H),N):D(H)}function D(H){return H===61?(t.consume(H),P):Ri(H)?(t.consume(H),D):A(H)}function P(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(t.consume(H),l=H,L):Ri(H)?(t.consume(H),P):R(H)}function L(H){return H===l?(t.consume(H),l=null,O):H===null||Yn(H)?n(H):(t.consume(H),L)}function R(H){return H===null||H===34||H===39||H===47||H===60||H===61||H===62||H===96||Ec(H)?D(H):(t.consume(H),R)}function O(H){return H===47||H===62||Ri(H)?A(H):n(H)}function W(H){return H===62?(t.consume(H),F):n(H)}function F(H){return H===null||Yn(H)?V(H):Ri(H)?(t.consume(H),F):n(H)}function V(H){return H===45&&i===2?(t.consume(H),q):H===60&&i===1?(t.consume(H),K):H===62&&i===4?(t.consume(H),j):H===63&&i===3?(t.consume(H),U):H===93&&i===5?(t.consume(H),Q):Yn(H)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(oge,X,G)(H)):H===null||Yn(H)?(t.exit("htmlFlowData"),G(H)):(t.consume(H),V)}function G(H){return t.check(lge,Z,X)(H)}function Z(H){return t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),B}function B(H){return H===null||Yn(H)?G(H):(t.enter("htmlFlowData"),V(H))}function q(H){return H===45?(t.consume(H),U):V(H)}function K(H){return H===47?(t.consume(H),a="",Y):V(H)}function Y(H){if(H===62){const ie=a.toLowerCase();return jO.includes(ie)?(t.consume(H),j):V(H)}return Vf(H)&&a.length<8?(t.consume(H),a+=String.fromCharCode(H),Y):V(H)}function Q(H){return H===93?(t.consume(H),U):V(H)}function U(H){return H===62?(t.consume(H),j):H===45&&i===2?(t.consume(H),U):V(H)}function j(H){return H===null||Yn(H)?(t.exit("htmlFlowData"),X(H)):(t.consume(H),j)}function X(H){return t.exit("htmlFlow"),e(H)}}function dge(t,e,n){const r=this;return i;function i(a){return Yn(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):n(a)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function fge(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(kT,e,n)}}const hge={name:"htmlText",tokenize:pge};function pge(t,e,n){const r=this;let i,s,a;return o;function o(U){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(U),l}function l(U){return U===33?(t.consume(U),c):U===47?(t.consume(U),D):U===63?(t.consume(U),A):Vf(U)?(t.consume(U),R):n(U)}function c(U){return U===45?(t.consume(U),d):U===91?(t.consume(U),s=0,b):Vf(U)?(t.consume(U),E):n(U)}function d(U){return U===45?(t.consume(U),v):n(U)}function h(U){return U===null?n(U):U===45?(t.consume(U),g):Yn(U)?(a=h,K(U)):(t.consume(U),h)}function g(U){return U===45?(t.consume(U),v):h(U)}function v(U){return U===62?q(U):U===45?g(U):h(U)}function b(U){const j="CDATA[";return U===j.charCodeAt(s++)?(t.consume(U),s===j.length?_:b):n(U)}function _(U){return U===null?n(U):U===93?(t.consume(U),w):Yn(U)?(a=_,K(U)):(t.consume(U),_)}function w(U){return U===93?(t.consume(U),S):_(U)}function S(U){return U===62?q(U):U===93?(t.consume(U),S):_(U)}function E(U){return U===null||U===62?q(U):Yn(U)?(a=E,K(U)):(t.consume(U),E)}function A(U){return U===null?n(U):U===63?(t.consume(U),N):Yn(U)?(a=A,K(U)):(t.consume(U),A)}function N(U){return U===62?q(U):A(U)}function D(U){return Vf(U)?(t.consume(U),P):n(U)}function P(U){return U===45||Yc(U)?(t.consume(U),P):L(U)}function L(U){return Yn(U)?(a=L,K(U)):Ri(U)?(t.consume(U),L):q(U)}function R(U){return U===45||Yc(U)?(t.consume(U),R):U===47||U===62||Ec(U)?O(U):n(U)}function O(U){return U===47?(t.consume(U),q):U===58||U===95||Vf(U)?(t.consume(U),W):Yn(U)?(a=O,K(U)):Ri(U)?(t.consume(U),O):q(U)}function W(U){return U===45||U===46||U===58||U===95||Yc(U)?(t.consume(U),W):F(U)}function F(U){return U===61?(t.consume(U),V):Yn(U)?(a=F,K(U)):Ri(U)?(t.consume(U),F):O(U)}function V(U){return U===null||U===60||U===61||U===62||U===96?n(U):U===34||U===39?(t.consume(U),i=U,G):Yn(U)?(a=V,K(U)):Ri(U)?(t.consume(U),V):(t.consume(U),Z)}function G(U){return U===i?(t.consume(U),i=void 0,B):U===null?n(U):Yn(U)?(a=G,K(U)):(t.consume(U),G)}function Z(U){return U===null||U===34||U===39||U===60||U===61||U===96?n(U):U===47||U===62||Ec(U)?O(U):(t.consume(U),Z)}function B(U){return U===47||U===62||Ec(U)?O(U):n(U)}function q(U){return U===62?(t.consume(U),t.exit("htmlTextData"),t.exit("htmlText"),e):n(U)}function K(U){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(U),t.exit("lineEnding"),Y}function Y(U){return Ri(U)?Fi(t,Q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):Q(U)}function Q(U){return t.enter("htmlTextData"),a(U)}}const ck={name:"labelEnd",resolveAll:xge,resolveTo:yge,tokenize:bge},mge={tokenize:_ge},gge={tokenize:Sge},vge={tokenize:wge};function xge(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&ih(t,0,t.length,n),t}function yge(t,e){let n=t.length,r=0,i,s,a,o;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(a){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(a=n);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},c={type:"label",start:{...t[s][1].start},end:{...t[a][1].end}},d={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[a-2][1].start}};return o=[["enter",l,e],["enter",c,e]],o=Uu(o,t.slice(s+1,s+r+3)),o=Uu(o,[["enter",d,e]]),o=Uu(o,lk(e.parser.constructs.insideSpan.null,t.slice(s+r+4,a-3),e)),o=Uu(o,[["exit",d,e],t[a-2],t[a-1],["exit",c,e]]),o=Uu(o,t.slice(a+1)),o=Uu(o,[["exit",l,e]]),ih(t,s,t.length,o),t}function bge(t,e,n){const r=this;let i=r.events.length,s,a;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return o;function o(g){return s?s._inactive?h(g):(a=r.parser.defined.includes(y1(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(g),t.exit("labelMarker"),t.exit("labelEnd"),l):n(g)}function l(g){return g===40?t.attempt(mge,d,a?d:h)(g):g===91?t.attempt(gge,d,a?c:h)(g):a?d(g):h(g)}function c(g){return t.attempt(vge,d,h)(g)}function d(g){return e(g)}function h(g){return s._balanced=!0,n(g)}}function _ge(t,e,n){return r;function r(h){return t.enter("resource"),t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),i}function i(h){return Ec(h)?k_(t,s)(h):s(h)}function s(h){return h===41?d(h):j$(t,a,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function a(h){return Ec(h)?k_(t,l)(h):d(h)}function o(h){return n(h)}function l(h){return h===34||h===39||h===40?U$(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return Ec(h)?k_(t,d)(h):d(h)}function d(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):n(h)}}function Sge(t,e,n){const r=this;return i;function i(o){return F$.call(r,t,s,a,"reference","referenceMarker","referenceString")(o)}function s(o){return r.parser.defined.includes(y1(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(o):n(o)}function a(o){return n(o)}}function wge(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const Mge={name:"labelStartImage",resolveAll:ck.resolveAll,tokenize:Tge};function Tge(t,e,n){const r=this;return i;function i(o){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(o),t.exit("labelImageMarker"),s}function s(o){return o===91?(t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelImage"),a):n(o)}function a(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const Ege={name:"labelStartLink",resolveAll:ck.resolveAll,tokenize:Cge};function Cge(t,e,n){const r=this;return i;function i(a){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const oA={name:"lineEnding",tokenize:Age};function Age(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Fi(t,e,"linePrefix")}}const zM={name:"thematicBreak",tokenize:Nge};function Nge(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),a(c)}function a(c){return i=c,o(c)}function o(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||Yn(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Ri(c)?Fi(t,o,"whitespace")(c):o(c))}}const xc={continuation:{tokenize:Ige},exit:Oge,name:"list",tokenize:Pge},Rge={partial:!0,tokenize:Lge},kge={partial:!0,tokenize:Dge};function Pge(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,a=0;return o;function o(v){const b=r.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||v===r.containerState.marker:mR(v)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),v===42||v===45?t.check(zM,n,c)(v):c(v);if(!r.interrupt||v===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(v)}return n(v)}function l(v){return mR(v)&&++a<10?(t.consume(v),l):(!r.interrupt||a<2)&&(r.containerState.marker?v===r.containerState.marker:v===41||v===46)?(t.exit("listItemValue"),c(v)):n(v)}function c(v){return t.enter("listItemMarker"),t.consume(v),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||v,t.check(kT,r.interrupt?n:d,t.attempt(Rge,g,h))}function d(v){return r.containerState.initialBlankLine=!0,s++,g(v)}function h(v){return Ri(v)?(t.enter("listItemPrefixWhitespace"),t.consume(v),t.exit("listItemPrefixWhitespace"),g):n(v)}function g(v){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(v)}}function Ige(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(kT,i,s);function i(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Fi(t,e,"listItemIndent",r.containerState.size+1)(o)}function s(o){return r.containerState.furtherBlankLines||!Ri(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(kge,e,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Fi(t,t.attempt(xc,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function Dge(t,e,n){const r=this;return Fi(t,i,"listItemIndent",r.containerState.size+1);function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(s):n(s)}}function Oge(t){t.exit(this.containerState.type)}function Lge(t,e,n){const r=this;return Fi(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const a=r.events[r.events.length-1];return!Ri(s)&&a&&a[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const FO={name:"setextUnderline",resolveTo:zge,tokenize:jge};function zge(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",a,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function jge(t,e,n){const r=this;let i;return s;function s(c){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(t.enter("setextHeadingLine"),i=c,a(c)):n(c)}function a(c){return t.enter("setextHeadingLineSequence"),o(c)}function o(c){return c===i?(t.consume(c),o):(t.exit("setextHeadingLineSequence"),Ri(c)?Fi(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Yn(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const Fge={tokenize:Uge};function Uge(t){const e=this,n=t.attempt(kT,r,t.attempt(this.parser.constructs.flowInitial,i,Fi(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Wme,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const Bge={resolveAll:H$()},Hge=B$("string"),Vge=B$("text");function B$(t){return{resolveAll:H$(t==="text"?Gge:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,a,o);return a;function a(d){return c(d)?s(d):o(d)}function o(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),s(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const h=i[d];let g=-1;if(h)for(;++g<h.length;){const v=h[g];if(!v.previous||v.previous.call(r,r.previous))return!0}return!1}}}function H$(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function Gge(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,a=-1,o=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(a=c.length;c.charCodeAt(a-1)===32;)o++,a--;if(a)break;a=-1}else if(c===-2)l=!0,o++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(o=0),o){const c={type:n===t.length||l||o<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-o,offset:r.end.offset-o},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(t.splice(n,0,["enter",c,e],["exit",c,e]),n+=2)}n++}return t}const Wge={42:xc,43:xc,45:xc,48:xc,49:xc,50:xc,51:xc,52:xc,53:xc,54:xc,55:xc,56:xc,57:xc,62:D$},$ge={91:Kme},qge={[-2]:aA,[-1]:aA,32:aA},Xge={35:nge,42:zM,45:[FO,zM],60:age,61:FO,95:zM,96:zO,126:zO},Yge={38:L$,92:O$},Kge={[-5]:oA,[-4]:oA,[-3]:oA,33:Mge,38:L$,42:gR,60:[Eme,hge],91:Ege,92:[ege,O$],93:ck,95:gR,96:Fme},Zge={null:[gR,Bge]},Qge={null:[42,95]},Jge={null:[]},eve=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Qge,contentInitial:$ge,disable:Jge,document:Wge,flow:Xge,flowInitial:qge,insideSpan:Zge,string:Yge,text:Kge},Symbol.toStringTag,{value:"Module"}));function tve(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let a=[],o=[];const l={attempt:L(D),check:L(P),consume:E,enter:A,exit:N,interrupt:L(P,{interrupt:!0})},c={code:null,containerState:{},defineSkip:_,events:[],now:b,parser:t,previous:null,sliceSerialize:g,sliceStream:v,write:h};let d=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function h(F){return a=Uu(a,F),w(),a[a.length-1]!==null?[]:(R(e,0),c.events=lk(s,c.events,c),c.events)}function g(F,V){return rve(v(F),V)}function v(F){return nve(a,F)}function b(){const{_bufferIndex:F,_index:V,line:G,column:Z,offset:B}=r;return{_bufferIndex:F,_index:V,line:G,column:Z,offset:B}}function _(F){i[F.line]=F.column,W()}function w(){let F;for(;r._index<a.length;){const V=a[r._index];if(typeof V=="string")for(F=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===F&&r._bufferIndex<V.length;)S(V.charCodeAt(r._bufferIndex));else S(V)}}function S(F){d=d(F)}function E(F){Yn(F)?(r.line++,r.column=1,r.offset+=F===-3?2:1,W()):F!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=F}function A(F,V){const G=V||{};return G.type=F,G.start=b(),c.events.push(["enter",G,c]),o.push(G),G}function N(F){const V=o.pop();return V.end=b(),c.events.push(["exit",V,c]),V}function D(F,V){R(F,V.from)}function P(F,V){V.restore()}function L(F,V){return G;function G(Z,B,q){let K,Y,Q,U;return Array.isArray(Z)?X(Z):"tokenize"in Z?X([Z]):j(Z);function j(re){return ue;function ue(le){const fe=le!==null&&re[le],we=le!==null&&re.null,pe=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(we)?we:we?[we]:[]];return X(pe)(le)}}function X(re){return K=re,Y=0,re.length===0?q:H(re[Y])}function H(re){return ue;function ue(le){return U=O(),Q=re,re.partial||(c.currentConstruct=re),re.name&&c.parser.constructs.disable.null.includes(re.name)?ne():re.tokenize.call(V?Object.assign(Object.create(c),V):c,l,ie,ne)(le)}}function ie(re){return F(Q,U),B}function ne(re){return U.restore(),++Y<K.length?H(K[Y]):q}}}function R(F,V){F.resolveAll&&!s.includes(F)&&s.push(F),F.resolve&&ih(c.events,V,c.events.length-V,F.resolve(c.events.slice(V),c)),F.resolveTo&&(c.events=F.resolveTo(c.events,c))}function O(){const F=b(),V=c.previous,G=c.currentConstruct,Z=c.events.length,B=Array.from(o);return{from:Z,restore:q};function q(){r=F,c.previous=V,c.currentConstruct=G,c.events.length=Z,o=B,W()}}function W(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function nve(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let a;if(n===i)a=[t[n].slice(r,s)];else{if(a=t.slice(n,i),r>-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}s>0&&a.push(t[i].slice(0,s))}return a}function rve(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=`
`;break}case-3:{a=`\r
`;break}case-2:{a=e?" ":"	";break}case-1:{if(!e&&i)continue;a=" ";break}default:a=String.fromCharCode(s)}i=s===-2,r.push(a)}return r.join("")}function ive(t){const r={constructs:dme([eve,...(t||{}).extensions||[]]),content:i(yme),defined:[],document:i(_me),flow:i(Fge),lazy:{},string:i(Hge),text:i(Vge)};return r;function i(s){return a;function a(o){return tve(r,s,o)}}}function sve(t){for(;!z$(t););return t}const UO=/[\0\t\n\r]/g;function ave(){let t=1,e="",n=!0,r;return i;function i(s,a,o){const l=[];let c,d,h,g,v;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),h=0,e="",n&&(s.charCodeAt(0)===65279&&h++,n=void 0);h<s.length;){if(UO.lastIndex=h,c=UO.exec(s),g=c&&c.index!==void 0?c.index:s.length,v=s.charCodeAt(g),!c){e=s.slice(h);break}if(v===10&&h===g&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<g&&(l.push(s.slice(h,g)),t+=g-h),v){case 0:{l.push(65533),t++;break}case 9:{for(d=Math.ceil(t/4)*4,l.push(-2);t++<d;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}h=g+1}return o&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const ove=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function lve(t){return t.replace(ove,cve)}function cve(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return I$(n.slice(s?2:1),s?16:10)}return ok(n)||t}const V$={}.hasOwnProperty;function uve(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),dve(n)(sve(ive(n).document().write(ave()(t,e,!0))))}function dve(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ue),autolinkProtocol:O,autolinkEmail:O,atxHeading:s(Oe),blockQuote:s(we),characterEscape:O,characterReference:O,codeFenced:s(pe),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(pe,a),codeText:s(xe,a),codeTextData:O,data:O,codeFlowValue:O,definition:s(Ve),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(ye),hardBreakEscape:s(he),hardBreakTrailing:s(he),htmlFlow:s(Re,a),htmlFlowData:O,htmlText:s(Re,a),htmlTextData:O,image:s(oe),label:a,link:s(Ue),listItem:s(Pe),listItemValue:g,listOrdered:s(Ee,h),listUnordered:s(Ee),paragraph:s(Ze),reference:H,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(Oe),strong:s(ae),thematicBreak:s(be)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:fe,autolinkProtocol:le,blockQuote:l(),characterEscapeValue:W,characterReferenceMarkerHexadecimal:ne,characterReferenceMarkerNumeric:ne,characterReferenceValue:re,characterReference:ue,codeFenced:l(w),codeFencedFence:_,codeFencedFenceInfo:v,codeFencedFenceMeta:b,codeFlowValue:W,codeIndented:l(S),codeText:l(B),codeTextData:W,data:W,definition:l(),definitionDestinationString:N,definitionLabelString:E,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(V),hardBreakTrailing:l(V),htmlFlow:l(G),htmlFlowData:W,htmlText:l(Z),htmlTextData:W,image:l(K),label:Q,labelText:Y,lineEnding:F,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ie,resourceDestinationString:U,resourceTitleString:j,resource:X,setextHeading:l(R),setextHeadingLineSequence:L,setextHeadingText:P,strong:l(),thematicBreak:l()}};G$(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(me){let ge={type:"root",children:[]};const ke={stack:[ge],tokenStack:[],config:e,enter:o,exit:c,buffer:a,resume:d,data:n},Xe=[];let Ae=-1;for(;++Ae<me.length;)if(me[Ae][1].type==="listOrdered"||me[Ae][1].type==="listUnordered")if(me[Ae][0]==="enter")Xe.push(Ae);else{const je=Xe.pop();Ae=i(me,je,Ae)}for(Ae=-1;++Ae<me.length;){const je=e[me[Ae][0]];V$.call(je,me[Ae][1].type)&&je[me[Ae][1].type].call(Object.assign({sliceSerialize:me[Ae][2].sliceSerialize},ke),me[Ae][1])}if(ke.tokenStack.length>0){const je=ke.tokenStack[ke.tokenStack.length-1];(je[1]||BO).call(ke,void 0,je[0])}for(ge.position={start:f0(me.length>0?me[0][1].start:{line:1,column:1,offset:0}),end:f0(me.length>0?me[me.length-2][1].end:{line:1,column:1,offset:0})},Ae=-1;++Ae<e.transforms.length;)ge=e.transforms[Ae](ge)||ge;return ge}function i(me,ge,ke){let Xe=ge-1,Ae=-1,je=!1,We,De,Be,qe;for(;++Xe<=ke;){const Se=me[Xe];switch(Se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Se[0]==="enter"?Ae++:Ae--,qe=void 0;break}case"lineEndingBlank":{Se[0]==="enter"&&(We&&!qe&&!Ae&&!Be&&(Be=Xe),qe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:qe=void 0}if(!Ae&&Se[0]==="enter"&&Se[1].type==="listItemPrefix"||Ae===-1&&Se[0]==="exit"&&(Se[1].type==="listUnordered"||Se[1].type==="listOrdered")){if(We){let Ye=Xe;for(De=void 0;Ye--;){const dt=me[Ye];if(dt[1].type==="lineEnding"||dt[1].type==="lineEndingBlank"){if(dt[0]==="exit")continue;De&&(me[De][1].type="lineEndingBlank",je=!0),dt[1].type="lineEnding",De=Ye}else if(!(dt[1].type==="linePrefix"||dt[1].type==="blockQuotePrefix"||dt[1].type==="blockQuotePrefixWhitespace"||dt[1].type==="blockQuoteMarker"||dt[1].type==="listItemIndent"))break}Be&&(!De||Be<De)&&(We._spread=!0),We.end=Object.assign({},De?me[De][1].start:Se[1].end),me.splice(De||Xe,0,["exit",We,Se[2]]),Xe++,ke++}if(Se[1].type==="listItemPrefix"){const Ye={type:"listItem",_spread:!1,start:Object.assign({},Se[1].start),end:void 0};We=Ye,me.splice(Xe,0,["enter",Ye,Se[2]]),Xe++,ke++,Be=void 0,qe=!0}}}return me[ge][1]._spread=je,ke}function s(me,ge){return ke;function ke(Xe){o.call(this,me(Xe),Xe),ge&&ge.call(this,Xe)}}function a(){this.stack.push({type:"fragment",children:[]})}function o(me,ge,ke){this.stack[this.stack.length-1].children.push(me),this.stack.push(me),this.tokenStack.push([ge,ke||void 0]),me.position={start:f0(ge.start),end:void 0}}function l(me){return ge;function ge(ke){me&&me.call(this,ke),c.call(this,ke)}}function c(me,ge){const ke=this.stack.pop(),Xe=this.tokenStack.pop();if(Xe)Xe[0].type!==me.type&&(ge?ge.call(this,me,Xe[0]):(Xe[1]||BO).call(this,me,Xe[0]));else throw new Error("Cannot close `"+me.type+"` ("+R_({start:me.start,end:me.end})+"): it’s not open");ke.position.end=f0(me.end)}function d(){return cme(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(me){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(me),10),this.data.expectingFirstListItemValue=void 0}}function v(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=me}function b(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=me}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.value=me.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.value=me.replace(/(\r?\n|\r)$/g,"")}function E(me){const ge=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ge,ke.identifier=y1(this.sliceSerialize(me)).toLowerCase()}function A(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.title=me}function N(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.url=me}function D(me){const ge=this.stack[this.stack.length-1];if(!ge.depth){const ke=this.sliceSerialize(me).length;ge.depth=ke}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function L(me){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(me).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function O(me){const ke=this.stack[this.stack.length-1].children;let Xe=ke[ke.length-1];(!Xe||Xe.type!=="text")&&(Xe=te(),Xe.position={start:f0(me.start),end:void 0},ke.push(Xe)),this.stack.push(Xe)}function W(me){const ge=this.stack.pop();ge.value+=this.sliceSerialize(me),ge.position.end=f0(me.end)}function F(me){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ke=ge.children[ge.children.length-1];ke.position.end=f0(me.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(ge.type)&&(O.call(this,me),W.call(this,me))}function V(){this.data.atHardBreak=!0}function G(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.value=me}function Z(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.value=me}function B(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.value=me}function q(){const me=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";me.type+="Reference",me.referenceType=ge,delete me.url,delete me.title}else delete me.identifier,delete me.label;this.data.referenceType=void 0}function K(){const me=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";me.type+="Reference",me.referenceType=ge,delete me.url,delete me.title}else delete me.identifier,delete me.label;this.data.referenceType=void 0}function Y(me){const ge=this.sliceSerialize(me),ke=this.stack[this.stack.length-2];ke.label=lve(ge),ke.identifier=y1(ge).toLowerCase()}function Q(){const me=this.stack[this.stack.length-1],ge=this.resume(),ke=this.stack[this.stack.length-1];if(this.data.inReference=!0,ke.type==="link"){const Xe=me.children;ke.children=Xe}else ke.alt=ge}function U(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.url=me}function j(){const me=this.resume(),ge=this.stack[this.stack.length-1];ge.title=me}function X(){this.data.inReference=void 0}function H(){this.data.referenceType="collapsed"}function ie(me){const ge=this.resume(),ke=this.stack[this.stack.length-1];ke.label=ge,ke.identifier=y1(this.sliceSerialize(me)).toLowerCase(),this.data.referenceType="full"}function ne(me){this.data.characterReferenceType=me.type}function re(me){const ge=this.sliceSerialize(me),ke=this.data.characterReferenceType;let Xe;ke?(Xe=I$(ge,ke==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Xe=ok(ge);const Ae=this.stack[this.stack.length-1];Ae.value+=Xe}function ue(me){const ge=this.stack.pop();ge.position.end=f0(me.end)}function le(me){W.call(this,me);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(me)}function fe(me){W.call(this,me);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(me)}function we(){return{type:"blockquote",children:[]}}function pe(){return{type:"code",lang:null,meta:null,value:""}}function xe(){return{type:"inlineCode",value:""}}function Ve(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ye(){return{type:"emphasis",children:[]}}function Oe(){return{type:"heading",depth:0,children:[]}}function he(){return{type:"break"}}function Re(){return{type:"html",value:""}}function oe(){return{type:"image",title:null,url:"",alt:null}}function Ue(){return{type:"link",title:null,url:"",children:[]}}function Ee(me){return{type:"list",ordered:me.type==="listOrdered",start:null,spread:me._spread,children:[]}}function Pe(me){return{type:"listItem",spread:me._spread,checked:null,children:[]}}function Ze(){return{type:"paragraph",children:[]}}function ae(){return{type:"strong",children:[]}}function te(){return{type:"text",value:""}}function be(){return{type:"thematicBreak"}}}function f0(t){return{line:t.line,column:t.column,offset:t.offset}}function G$(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?G$(t,r):fve(t,r)}}function fve(t,e){let n;for(n in e)if(V$.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function BO(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+R_({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+R_({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+R_({start:e.start,end:e.end})+") is still open")}function hve(t){const e=this;e.parser=n;function n(r){return uve(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function pve(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function mve(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
`}]}function gve(t,e){const n=e.value?e.value+`
`:"",r={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function vve(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function xve(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function yve(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Ay(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let a,o=t.footnoteCounts.get(r);o===void 0?(o=0,t.footnoteOrder.push(r),a=t.footnoteOrder.length):a=s+1,o+=1,t.footnoteCounts.set(r,o);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(o>1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function bve(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function _ve(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function W$(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const a=i[i.length-1];return a&&a.type==="text"?a.value+=r:i.push({type:"text",value:r}),i}function Sve(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return W$(t,e);const i={src:Ay(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function wve(t,e){const n={src:Ay(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Mve(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Tve(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return W$(t,e);const i={href:Ay(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function Eve(t,e){const n={href:Ay(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Cve(t,e,n){const r=t.all(e),i=n?Ave(n):$$(e),s={},a=[];if(typeof e.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let o=-1;for(;++o<r.length;){const d=r[o];(i||o!==0||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!i?a.push(...d.children):a.push(d)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&a.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:s,children:a};return t.patch(e,c),t.applyData(e,c)}function Ave(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=$$(n[r])}return e}function $$(t){const e=t.spread;return e??t.children.length>1}function Nve(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<r.length;){const a=r[i];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)}function Rve(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function kve(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function Pve(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Ive(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],a),i.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},o=rk(e.children[1]),l=E$(e.children[e.children.length-1]);o&&l&&(a.position={start:o,end:l}),i.push(a)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function Dve(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:e.children.length;let l=-1;const c=[];for(;++l<o;){const h=e.children[l],g={},v=a?a[l]:void 0;v&&(g.align=v);let b={type:"element",tagName:s,properties:g,children:[]};h&&(b.children=t.all(h),t.patch(h,b),b=t.applyData(h,b)),c.push(b)}const d={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,d),t.applyData(e,d)}function Ove(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const HO=9,VO=32;function Lve(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(GO(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(GO(e.slice(i),i>0,!1)),s.join("")}function GO(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===HO||s===VO;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===HO||s===VO;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function zve(t,e){const n={type:"text",value:Lve(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function jve(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const Fve={blockquote:pve,break:mve,code:gve,delete:vve,emphasis:xve,footnoteReference:yve,heading:bve,html:_ve,imageReference:Sve,image:wve,inlineCode:Mve,linkReference:Tve,link:Eve,listItem:Cve,list:Nve,paragraph:Rve,root:kve,strong:Pve,table:Ive,tableCell:Ove,tableRow:Dve,text:zve,thematicBreak:jve,toml:f4,yaml:f4,definition:f4,footnoteDefinition:f4};function f4(){}const q$=-1,PT=0,P_=1,S2=2,uk=3,dk=4,fk=5,hk=6,X$=7,Y$=8,WO=typeof self=="object"?self:globalThis,Uve=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,a]=e[i];switch(s){case PT:case q$:return n(a,i);case P_:{const o=n([],i);for(const l of a)o.push(r(l));return o}case S2:{const o=n({},i);for(const[l,c]of a)o[r(l)]=r(c);return o}case uk:return n(new Date(a),i);case dk:{const{source:o,flags:l}=a;return n(new RegExp(o,l),i)}case fk:{const o=n(new Map,i);for(const[l,c]of a)o.set(r(l),r(c));return o}case hk:{const o=n(new Set,i);for(const l of a)o.add(r(l));return o}case X$:{const{name:o,message:l}=a;return n(new WO[o](l),i)}case Y$:return n(BigInt(a),i);case"BigInt":return n(Object(BigInt(a)),i);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new WO[s](a),i)};return r},$O=t=>Uve(new Map,t)(0),Cx="",{toString:Bve}={},{keys:Hve}=Object,Kb=t=>{const e=typeof t;if(e!=="object"||!t)return[PT,e];const n=Bve.call(t).slice(8,-1);switch(n){case"Array":return[P_,Cx];case"Object":return[S2,Cx];case"Date":return[uk,Cx];case"RegExp":return[dk,Cx];case"Map":return[fk,Cx];case"Set":return[hk,Cx];case"DataView":return[P_,n]}return n.includes("Array")?[P_,n]:n.includes("Error")?[X$,n]:[S2,n]},h4=([t,e])=>t===PT&&(e==="function"||e==="symbol"),Vve=(t,e,n,r)=>{const i=(a,o)=>{const l=r.push(a)-1;return n.set(o,l),l},s=a=>{if(n.has(a))return n.get(a);let[o,l]=Kb(a);switch(o){case PT:{let d=a;switch(l){case"bigint":o=Y$,d=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return i([q$],a)}return i([o,d],a)}case P_:{if(l){let g=a;return l==="DataView"?g=new Uint8Array(a.buffer):l==="ArrayBuffer"&&(g=new Uint8Array(a)),i([l,[...g]],a)}const d=[],h=i([o,d],a);for(const g of a)d.push(s(g));return h}case S2:{if(l)switch(l){case"BigInt":return i([l,a.toString()],a);case"Boolean":case"Number":case"String":return i([l,a.valueOf()],a)}if(e&&"toJSON"in a)return s(a.toJSON());const d=[],h=i([o,d],a);for(const g of Hve(a))(t||!h4(Kb(a[g])))&&d.push([s(g),s(a[g])]);return h}case uk:return i([o,a.toISOString()],a);case dk:{const{source:d,flags:h}=a;return i([o,{source:d,flags:h}],a)}case fk:{const d=[],h=i([o,d],a);for(const[g,v]of a)(t||!(h4(Kb(g))||h4(Kb(v))))&&d.push([s(g),s(v)]);return h}case hk:{const d=[],h=i([o,d],a);for(const g of a)(t||!h4(Kb(g)))&&d.push(s(g));return h}}const{message:c}=a;return i([o,{name:l,message:c}],a)};return s},qO=(t,{json:e,lossy:n}={})=>{const r=[];return Vve(!(e||n),!!e,new Map,r)(t),r},w2=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?$O(qO(t,e)):structuredClone(t):(t,e)=>$O(qO(t,e));function Gve(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function Wve(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function $ve(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Gve,r=t.options.footnoteBackLabel||Wve,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let l=-1;for(;++l<t.footnoteOrder.length;){const c=t.footnoteById.get(t.footnoteOrder[l]);if(!c)continue;const d=t.all(c),h=String(c.identifier).toUpperCase(),g=Ay(h.toLowerCase());let v=0;const b=[],_=t.footnoteCounts.get(h);for(;_!==void 0&&++v<=_;){b.length>0&&b.push({type:"text",value:" "});let E=typeof n=="string"?n:n(l,v);typeof E=="string"&&(E={type:"text",value:E}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,v),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const E=w.children[w.children.length-1];E&&E.type==="text"?E.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...b)}else d.push(...b);const S={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(d,!0)};t.patch(c,S),o.push(S)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...w2(a),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(o,!0)},{type:"text",value:`
`}]}}const pk=(function(t){if(t==null)return Kve;if(typeof t=="function")return IT(t);if(typeof t=="object")return Array.isArray(t)?qve(t):Xve(t);if(typeof t=="string")return Yve(t);throw new Error("Expected function, string, or object as test")});function qve(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=pk(t[n]);return IT(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function Xve(t){const e=t;return IT(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function Yve(t){return IT(e);function e(n){return n&&n.type===t}}function IT(t){return e;function e(n,r,i){return!!(Zve(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Kve(){return!0}function Zve(t){return t!==null&&typeof t=="object"&&"type"in t}const K$=[],Qve=!0,XO=!1,Z$="skip";function Q$(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=pk(i),a=r?-1:1;o(t,void 0,[])();function o(l,c,d){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const v=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(g,"name",{value:"node ("+(l.type+(v?"<"+v+">":""))+")"})}return g;function g(){let v=K$,b,_,w;if((!e||s(l,c,d[d.length-1]||void 0))&&(v=Jve(n(l,d)),v[0]===XO))return v;if("children"in l&&l.children){const S=l;if(S.children&&v[0]!==Z$)for(_=(r?S.children.length:-1)+a,w=d.concat(S);_>-1&&_<S.children.length;){const E=S.children[_];if(b=o(E,_,w)(),b[0]===XO)return b;_=typeof b[1]=="number"?b[1]:_+a}}return v}}}function Jve(t){return Array.isArray(t)?t:typeof t=="number"?[Qve,t]:t==null?K$:[t]}function J$(t,e,n,r){let i,s,a;typeof e=="function"&&typeof n!="function"?(s=void 0,a=e,i=n):(s=e,a=n,i=r),Q$(t,s,o,i);function o(l,c){const d=c[c.length-1],h=d?d.children.indexOf(l):void 0;return a(l,h,d)}}const vR={}.hasOwnProperty,exe={};function txe(t,e){const n=e||exe,r=new Map,i=new Map,s=new Map,a={...Fve,...n.handlers},o={all:c,applyData:rxe,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:a,one:l,options:n,patch:nxe,wrap:sxe};return J$(t,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:i,g=String(d.identifier).toUpperCase();h.has(g)||h.set(g,d)}}),o;function l(d,h){const g=d.type,v=o.handlers[g];if(vR.call(o.handlers,g)&&v)return v(o,d,h);if(o.options.passThrough&&o.options.passThrough.includes(g)){if("children"in d){const{children:_,...w}=d,S=w2(w);return S.children=o.all(d),S}return w2(d)}return(o.options.unknownHandler||ixe)(o,d,h)}function c(d){const h=[];if("children"in d){const g=d.children;let v=-1;for(;++v<g.length;){const b=o.one(g[v],d);if(b){if(v&&g[v-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=YO(b.value)),!Array.isArray(b)&&b.type==="element")){const _=b.children[0];_&&_.type==="text"&&(_.value=YO(_.value))}Array.isArray(b)?h.push(...b):h.push(b)}}}return h}}function nxe(t,e){t.position&&(e.position=B0e(t))}function rxe(t,e){let n=e;if(t&&t.data){const r=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&s&&Object.assign(n.properties,w2(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function ixe(t,e){const n=e.data||{},r="value"in e&&!(vR.call(n,"hProperties")||vR.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function sxe(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
`});++r<t.length;)r&&n.push({type:"text",value:`
`}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
`}),n}function YO(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function KO(t,e){const n=txe(t,e),r=n.one(t,void 0),i=$ve(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
`},i),s}function axe(t,e){return t&&"run"in t?async function(n,r){const i=KO(n,{file:r,...e});await t.run(i,r)}:function(n,r){return KO(n,{file:r,...t||e})}}function ZO(t){if(t)throw t}var lA,QO;function oxe(){if(QO)return lA;QO=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(c){return typeof Array.isArray=="function"?Array.isArray(c):e.call(c)==="[object Array]"},s=function(c){if(!c||e.call(c)!=="[object Object]")return!1;var d=t.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!d&&!h)return!1;var g;for(g in c);return typeof g>"u"||t.call(c,g)},a=function(c,d){n&&d.name==="__proto__"?n(c,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):c[d.name]=d.newValue},o=function(c,d){if(d==="__proto__")if(t.call(c,d)){if(r)return r(c,d).value}else return;return c[d]};return lA=function l(){var c,d,h,g,v,b,_=arguments[0],w=1,S=arguments.length,E=!1;for(typeof _=="boolean"&&(E=_,_=arguments[1]||{},w=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});w<S;++w)if(c=arguments[w],c!=null)for(d in c)h=o(_,d),g=o(c,d),_!==g&&(E&&g&&(s(g)||(v=i(g)))?(v?(v=!1,b=h&&i(h)?h:[]):b=h&&s(h)?h:{},a(_,{name:d,newValue:l(E,b,g)})):typeof g<"u"&&a(_,{name:d,newValue:g}));return _},lA}var lxe=oxe();const cA=dy(lxe);function xR(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function cxe(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const a=i.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);o(null,...i);function o(l,...c){const d=t[++s];let h=-1;if(l){a(l);return}for(;++h<i.length;)(c[h]===null||c[h]===void 0)&&(c[h]=i[h]);i=c,d?uxe(d,o)(...c):a(null,...c)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function uxe(t,e){let n;return r;function r(...a){const o=t.length>a.length;let l;o&&a.push(i);try{l=t.apply(this,a)}catch(c){const d=c;if(o&&n)throw d;return i(d)}o||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(a,...o){n||(n=!0,e(a,...o))}function s(a){i(null,a)}}const Lf={basename:dxe,dirname:fxe,extname:hxe,join:pxe,sep:"/"};function dxe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');fw(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,o=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else a<0&&(s=!0,a=i+1),o>-1&&(t.codePointAt(i)===e.codePointAt(o--)?o<0&&(r=i):(o=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function fxe(t){if(fw(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function hxe(t){fw(t);let e=t.length,n=-1,r=0,i=-1,s=0,a;for(;e--;){const o=t.codePointAt(e);if(o===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),o===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function pxe(...t){let e=-1,n;for(;++e<t.length;)fw(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":mxe(n)}function mxe(t){fw(t);const e=t.codePointAt(0)===47;let n=gxe(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function gxe(t,e){let n="",r=0,i=-1,s=0,a=-1,o,l;for(;++a<=t.length;){if(a<t.length)o=t.codePointAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||s===1))if(i!==a-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=a,s=0;continue}}else if(n.length>0){n="",r=0,i=a,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,a):n=t.slice(i+1,a),r=a-i-1;i=a,s=0}else o===46&&s>-1?s++:s=-1}return n}function fw(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const vxe={cwd:xxe};function xxe(){return"/"}function yR(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function yxe(t){if(typeof t=="string")t=new URL(t);else if(!yR(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return bxe(t)}function bxe(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const uA=["history","path","basename","stem","extname","dirname"];class eq{constructor(e){let n;e?yR(e)?n={path:e}:typeof e=="string"||_xe(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":vxe.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<uA.length;){const s=uA[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)uA.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Lf.basename(this.path):void 0}set basename(e){fA(e,"basename"),dA(e,"basename"),this.path=Lf.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Lf.dirname(this.path):void 0}set dirname(e){JO(this.basename,"dirname"),this.path=Lf.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Lf.extname(this.path):void 0}set extname(e){if(dA(e,"extname"),JO(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Lf.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){yR(e)&&(e=yxe(e)),fA(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Lf.basename(this.path,this.extname):void 0}set stem(e){fA(e,"stem"),dA(e,"stem"),this.path=Lf.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new gl(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function dA(t,e){if(t&&t.includes(Lf.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Lf.sep+"`")}function fA(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function JO(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function _xe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Sxe=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),wxe={}.hasOwnProperty;class mk extends Sxe{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=cxe()}copy(){const e=new mk;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(cA(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(mA("data",this.frozen),this.namespace[e]=n,this):wxe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(mA("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=p4(e),r=this.parser||this.Parser;return hA("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),hA("process",this.parser||this.Parser),pA("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,a){const o=p4(e),l=r.parse(o);r.run(l,o,function(d,h,g){if(d||!h||!g)return c(d);const v=h,b=r.stringify(v,g);Exe(b)?g.value=b:g.result=b,c(d,g)});function c(d,h){d||!h?a(d):s?s(h):n(void 0,h)}}}processSync(e){let n=!1,r;return this.freeze(),hA("processSync",this.parser||this.Parser),pA("processSync",this.compiler||this.Compiler),this.process(e,i),tL("processSync","process",n),r;function i(s,a){n=!0,ZO(s),r=a}}run(e,n,r){eL(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(a,o){const l=p4(n);i.run(e,l,c);function c(d,h,g){const v=h||e;d?o(d):a?a(v):r(void 0,v,g)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),tL("runSync","run",r),i;function s(a,o){ZO(a),i=o,r=!0}}stringify(e,n){this.freeze();const r=p4(n),i=this.compiler||this.Compiler;return pA("stringify",i),eL(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(mA("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?o(e):a(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[d,...h]=c;l(d,h)}else a(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function a(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(c.plugins),c.settings&&(i.settings=cA(!0,i.settings,c.settings))}function o(c){let d=-1;if(c!=null)if(Array.isArray(c))for(;++d<c.length;){const h=c[d];s(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,d){let h=-1,g=-1;for(;++h<r.length;)if(r[h][0]===c){g=h;break}if(g===-1)r.push([c,...d]);else if(d.length>0){let[v,...b]=d;const _=r[g][1];xR(_)&&xR(v)&&(v=cA(!0,_,v)),r[g]=[c,v,...b]}}}}const Mxe=new mk().freeze();function hA(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function pA(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function mA(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function eL(t){if(!xR(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function tL(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function p4(t){return Txe(t)?t:new eq(t)}function Txe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Exe(t){return typeof t=="string"||Cxe(t)}function Cxe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Axe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",nL=[],rL={allowDangerousHtml:!0},Nxe=/^(https?|ircs?|mailto|xmpp)$/i,Rxe=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function kxe(t){const e=Pxe(t),n=Ixe(t);return Dxe(e.runSync(e.parse(n),n),t)}function Pxe(t){const e=t.rehypePlugins||nL,n=t.remarkPlugins||nL,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...rL}:rL;return Mxe().use(hve).use(n).use(axe,r).use(e)}function Ixe(t){const e=t.children||"",n=new eq;return typeof e=="string"&&(n.value=e),n}function Dxe(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,a=e.skipHtml,o=e.unwrapDisallowed,l=e.urlTransform||Oxe;for(const d of Rxe)Object.hasOwn(e,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Axe+d.id,void 0);return J$(t,c),$0e(t,{Fragment:p.Fragment,components:i,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function c(d,h,g){if(d.type==="raw"&&g&&typeof h=="number")return a?g.children.splice(h,1):g.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let v;for(v in sA)if(Object.hasOwn(sA,v)&&Object.hasOwn(d.properties,v)){const b=d.properties[v],_=sA[v];(_===null||_.includes(d.tagName))&&(d.properties[v]=l(String(b||""),v,d))}}if(d.type==="element"){let v=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!v&&r&&typeof h=="number"&&(v=!r(d,h,g)),v&&g&&typeof h=="number")return o&&d.children?g.children.splice(h,1,...d.children):g.children.splice(h,1),h}}}function Oxe(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||r!==-1&&e>r||Nxe.test(t.slice(0,e))?t:""}function Lxe(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,a=0;for(;r!==-1;)r===i?++s>a&&(a=s):s=1,i=r+e.length,r=n.indexOf(e,i);return a}function zxe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:o,mathText:a,mathTextData:o}};function t(l){const c={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[c]}},l)}function e(){this.buffer()}function n(){const l=this.resume(),c=this.stack[this.stack.length-1];c.type,c.meta=l}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(l){const c=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c;const h=d.data.hChildren[0];h.type,h.tagName,h.children.push({type:"text",value:c}),this.data.mathFlowInside=void 0}function s(l){this.enter({type:"inlineMath",value:"",data:{hName:"code",hProperties:{className:["language-math","math-inline"]},hChildren:[]}},l),this.buffer()}function a(l){const c=this.resume(),d=this.stack[this.stack.length-1];d.type,this.exit(l),d.value=c,d.data.hChildren.push({type:"text",value:c})}function o(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function jxe(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=i,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:`
`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(s,a,o,l){const c=s.value||"",d=o.createTracker(l),h="$".repeat(Math.max(Lxe(c,"$")+1,2)),g=o.enter("mathFlow");let v=d.move(h);if(s.meta){const b=o.enter("mathFlowMeta");v+=d.move(o.safe(s.meta,{after:`
`,before:v,encode:["$"],...d.current()})),b()}return v+=d.move(`
`),c&&(v+=d.move(c+`
`)),v+=d.move(h),g(),v}function r(s,a,o){let l=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const d="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let h=-1;for(;++h<o.unsafe.length;){const g=o.unsafe[h];if(!g.atBreak)continue;const v=o.compilePattern(g);let b;for(;b=v.exec(l);){let _=b.index;l.codePointAt(_)===10&&l.codePointAt(_-1)===13&&_--,l=l.slice(0,_)+" "+l.slice(b.index+1)}}return d+l+d}function i(){return"$"}}const Fxe={tokenize:Uxe,concrete:!0,name:"mathFlow"},iL={tokenize:Bxe,partial:!0};function Uxe(t,e,n){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let a=0;return o;function o(E){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),l(E)}function l(E){return E===36?(t.consume(E),a++,l):a<2?n(E):(t.exit("mathFlowFenceSequence"),Fi(t,c,"whitespace")(E))}function c(E){return E===null||Yn(E)?h(E):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),d(E))}function d(E){return E===null||Yn(E)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),h(E)):E===36?n(E):(t.consume(E),d)}function h(E){return t.exit("mathFlowFence"),r.interrupt?e(E):t.attempt(iL,g,w)(E)}function g(E){return t.attempt({tokenize:S,partial:!0},w,v)(E)}function v(E){return(s?Fi(t,b,"linePrefix",s+1):b)(E)}function b(E){return E===null?w(E):Yn(E)?t.attempt(iL,g,w)(E):(t.enter("mathFlowValue"),_(E))}function _(E){return E===null||Yn(E)?(t.exit("mathFlowValue"),b(E)):(t.consume(E),_)}function w(E){return t.exit("mathFlow"),e(E)}function S(E,A,N){let D=0;return Fi(E,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function P(O){return E.enter("mathFlowFence"),E.enter("mathFlowFenceSequence"),L(O)}function L(O){return O===36?(D++,E.consume(O),L):D<a?N(O):(E.exit("mathFlowFenceSequence"),Fi(E,R,"whitespace")(O))}function R(O){return O===null||Yn(O)?(E.exit("mathFlowFence"),A(O)):N(O)}}}function Bxe(t,e,n){const r=this;return i;function i(a){return a===null?e(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Hxe(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:Vxe,previous:Gxe,name:"mathText"};function r(i,s,a){let o=0,l,c;return d;function d(_){return i.enter("mathText"),i.enter("mathTextSequence"),h(_)}function h(_){return _===36?(i.consume(_),o++,h):o<2&&!n?a(_):(i.exit("mathTextSequence"),g(_))}function g(_){return _===null?a(_):_===36?(c=i.enter("mathTextSequence"),l=0,b(_)):_===32?(i.enter("space"),i.consume(_),i.exit("space"),g):Yn(_)?(i.enter("lineEnding"),i.consume(_),i.exit("lineEnding"),g):(i.enter("mathTextData"),v(_))}function v(_){return _===null||_===32||_===36||Yn(_)?(i.exit("mathTextData"),g(_)):(i.consume(_),v)}function b(_){return _===36?(i.consume(_),l++,b):l===o?(i.exit("mathTextSequence"),i.exit("mathText"),s(_)):(c.type="mathTextData",v(_))}}}function Vxe(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="mathTextData"){t[e][1].type="mathTextPadding",t[n][1].type="mathTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="mathTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function Gxe(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function Wxe(t){return{flow:{36:Fxe},text:{36:Hxe(t)}}}class wc{constructor(e,n,r){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=n,this.end=r}static range(e,n){return n?!e||!e.loc||!n.loc||e.loc.lexer!==n.loc.lexer?null:new wc(e.loc.lexer,e.loc.start,n.loc.end):e&&e.loc}}class tu{constructor(e,n){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=n}range(e,n){return new tu(n,wc.range(this,e))}}class Qt{constructor(e,n){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var r="KaTeX parse error: "+e,i,s,a=n&&n.loc;if(a&&a.start<=a.end){var o=a.lexer.input;i=a.start,s=a.end,i===o.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var l=o.slice(i,s).replace(/[^]/g,"$&̲"),c;i>15?c="…"+o.slice(i-15,i):c=o.slice(0,i);var d;s+15<o.length?d=o.slice(s,s+15)+"…":d=o.slice(s),r+=c+l+d}var h=new Error(r);return h.name="ParseError",h.__proto__=Qt.prototype,h.position=i,i!=null&&s!=null&&(h.length=s-i),h.rawMessage=e,h}}Qt.prototype.__proto__=Error.prototype;var $xe=/([A-Z])/g,gk=t=>t.replace($xe,"-$1").toLowerCase(),qxe={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},Xxe=/[&><"']/g,dl=t=>String(t).replace(Xxe,e=>qxe[e]),I_=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?I_(t.body[0]):t:t.type==="font"?I_(t.body):t,Yxe=new Set(["mathord","textord","atom"]),bp=t=>Yxe.has(I_(t).type),Kxe=t=>{var e=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(t);return e?e[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(e[1])?null:e[1].toLowerCase():"_relative"},jM={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:t=>"#"+t},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:t=>Math.max(0,t),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:t=>Math.max(0,t),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:t=>Math.max(0,t),cli:"-e, --max-expand <n>",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Zxe(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class vk{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e=e||{};for(var n in jM)if(jM.hasOwnProperty(n)){var r=jM[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Zxe(r)}}reportNonstrict(e,n,r){var i=this.strict;if(typeof i=="function"&&(i=i(e,n,r)),!(!i||i==="ignore")){if(i===!0||i==="error")throw new Qt("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);i==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var i=this.strict;if(typeof i=="function")try{i=i(e,n,r)}catch{i="error"}return!i||i==="ignore"?!1:i===!0||i==="error"?!0:i==="warn"?(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+i+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=Kxe(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class h0{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return Uf[Qxe[this.id]]}sub(){return Uf[Jxe[this.id]]}fracNum(){return Uf[e1e[this.id]]}fracDen(){return Uf[t1e[this.id]]}cramp(){return Uf[n1e[this.id]]}text(){return Uf[r1e[this.id]]}isTight(){return this.size>=2}}var xk=0,M2=1,b1=2,lp=3,mS=4,Bu=5,J1=6,Ul=7,Uf=[new h0(xk,0,!1),new h0(M2,0,!0),new h0(b1,1,!1),new h0(lp,1,!0),new h0(mS,2,!1),new h0(Bu,2,!0),new h0(J1,3,!1),new h0(Ul,3,!0)],Qxe=[mS,Bu,mS,Bu,J1,Ul,J1,Ul],Jxe=[Bu,Bu,Bu,Bu,Ul,Ul,Ul,Ul],e1e=[b1,lp,mS,Bu,J1,Ul,J1,Ul],t1e=[lp,lp,Bu,Bu,Ul,Ul,Ul,Ul],n1e=[M2,M2,lp,lp,Bu,Bu,Ul,Ul],r1e=[xk,M2,b1,lp,b1,lp,b1,lp],hr={DISPLAY:Uf[xk],TEXT:Uf[b1],SCRIPT:Uf[mS],SCRIPTSCRIPT:Uf[J1]},bR=[{name:"latin",blocks:[[256,591],[768,879]]},{name:"cyrillic",blocks:[[1024,1279]]},{name:"armenian",blocks:[[1328,1423]]},{name:"brahmic",blocks:[[2304,4255]]},{name:"georgian",blocks:[[4256,4351]]},{name:"cjk",blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:"hangul",blocks:[[44032,55215]]}];function i1e(t){for(var e=0;e<bR.length;e++)for(var n=bR[e],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(t>=i[0]&&t<=i[1])return n.name}return null}var FM=[];bR.forEach(t=>t.blocks.forEach(e=>FM.push(...e)));function tq(t){for(var e=0;e<FM.length;e+=2)if(t>=FM[e]&&t<=FM[e+1])return!0;return!1}var Ax=80,s1e=function(e,n){return"M95,"+(622+e+n)+`
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429
c69,-144,104.5,-217.7,106.5,-221
l`+e/2.075+" -"+e+`
c5.3,-9.3,12,-14,20,-14
H400000v`+(40+e)+`H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},a1e=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
c340,-704.7,510.7,-1060.3,512,-1067
l`+e/2.084+" -"+e+`
c4.7,-7.3,11,-11,19,-11
H40000v`+(40+e)+`H1012.3
s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},o1e=function(e,n){return"M983 "+(10+e+n)+`
l`+e/3.13+" -"+e+`
c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744
c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},l1e=function(e,n){return"M424,"+(2398+e+n)+`
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081
l`+e/4.223+" -"+e+`c4,-6.7,10,-10,18,-10 H400000
v`+(40+e)+`H1014.6
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+n+`
h400000v`+(40+e)+"h-400000z"},c1e=function(e,n){return"M473,"+(2713+e+n)+`
c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+`
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},u1e=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},d1e=function(e,n,r){var i=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+`
H742v`+i+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},f1e=function(e,n,r){n=1e3*n;var i="";switch(e){case"sqrtMain":i=s1e(n,Ax);break;case"sqrtSize1":i=a1e(n,Ax);break;case"sqrtSize2":i=o1e(n,Ax);break;case"sqrtSize3":i=l1e(n,Ax);break;case"sqrtSize4":i=c1e(n,Ax);break;case"sqrtTall":i=d1e(n,Ax,r)}return i},h1e=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},sL={doubleleftarrow:`M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5
 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87
-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7
-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z
m8 0v40h399730v-40zm0 194v40h399730v-40z`,doublerightarrow:`M399738 392l
-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5
 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88
-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68
-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18
-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782
c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3
-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`,leftarrow:`M400000 241H110l3-3c68.7-52.7 113.7-120
 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8
-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247
c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208
 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3
 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202
 l-3-3h399890zM100 241v40h399900v-40z`,leftbrace:`M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117
-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7
 5-6 9-10 13-.7 1-7.3 1-20 1H6z`,leftbraceunder:`M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13
 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688
 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7
-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`,leftgroup:`M400000 80
H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0
 435 0h399565z`,leftgroupunder:`M400000 262
H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219
 435 219h399565z`,leftharpoon:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3
-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5
-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7
-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`,leftharpoonplus:`M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5
 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3
-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7
-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z
m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333
 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5
 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667
-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`,leftharpoondownplus:`M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12
 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7
-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
 71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:`M40 281 V428 H0 V94 H40 V241 H400000 v40z
M40 281 V428 H0 V94 H40 V241 H400000 v40z`,leftmapsto:`M40 281 V448H0V74H40V241H400000v40z
M40 281 V448H0V74H40V241H400000v40z`,leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:`M0 50 h400000 v40H0z m0 194h40000v40H0z
M0 50 h400000 v40H0z m0 194h40000v40H0z`,midbrace:`M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`,midbraceunder:`M199572 214
c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14
 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3
 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0
-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`,oiintSize1:`M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6
-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z
m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8
60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`,oiintSize2:`M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8
-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z
m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2
c0 110 84 276 504 276s502.4-166 502.4-276z`,oiiintSize1:`M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6
-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z
m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0
85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`,oiiintSize2:`M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8
-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z
m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1
c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`,rightarrow:`M0 241v40h399891c-47.3 35.3-84 78-110 128
-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20
 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7
 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85
-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
 151.7 139 205zm0 0v40h399900v-40z`,rightbrace:`M400000 542l
-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5
s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1
c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`,rightbraceunder:`M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3
 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237
-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`,rightgroup:`M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0
 3-1 3-3v-38c-76-158-257-219-435-219H0z`,rightgroupunder:`M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18
 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`,rightharpoon:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3
-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2
-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58
 69.2 92 94.5zm0 0v40h399900v-40z`,rightharpoonplus:`M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11
-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7
 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z
m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown:`M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8
 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5
-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95
-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`,rightharpoondownplus:`M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8
 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3
 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3
-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z
M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`,rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69
-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3
-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19
-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101
 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`,twoheadrightarrow:`M400000 167
c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3
 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42
 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333
-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70
 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`,tilde1:`M200 55.538c-77 0-168 73.953-177 73.953-3 0-7
-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0
 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0
 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128
-68.267.847-113-73.952-191-73.952z`,tilde2:`M344 55.266c-142 0-300.638 81.316-311.5 86.418
-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9
 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114
c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751
 181.476 676 181.476c-149 0-189-126.21-332-126.21z`,tilde3:`M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457
-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0
 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697
 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696
 -338 0-409-156.573-744-156.573z`,tilde4:`M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345
-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409
 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9
 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409
 -175.236-744-175.236z`,vec:`M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5
3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11
10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63
-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1
-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59
H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359
c-16-25.333-24-45-24-59z`,widehat1:`M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22
c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`,widehat2:`M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat3:`M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widehat4:`M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10
-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`,widecheck1:`M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1,
-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`,widecheck2:`M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck3:`M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,widecheck4:`M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10,
-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`,baraboveleftarrow:`M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202
c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5
c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130
s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47
121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6
s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11
c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z
M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`,rightarrowabovebar:`M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32
-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0
13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39
-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5
-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5
-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67
151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`,baraboveshortleftharpoon:`M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17
c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21
c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40
c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z
M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`,rightharpoonaboveshortbar:`M0,241 l0,40c399126,0,399993,0,399993,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`,shortbaraboveleftharpoon:`M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11
c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9,
1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7,
-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z
M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`,shortrightharpoonabovebar:`M53,241l0,40c398570,0,399437,0,399437,0
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},p1e=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84
H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z
M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+" v585 h43z";case"doublevert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v`+n+` v585 h43z
M367 15 v585 v`+n+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15
c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v`+n+" v585 h43z";case"lfloor":return"M319 602 V0 H403 V602 v"+n+` v1715 h263 v84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"rfloor":return"M319 602 V0 H403 V602 v"+n+` v1799 H0 v-84 H319z
MM319 602 V0 H403 V602 v`+n+" v1715 H319z";case"lceil":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v602 h84z
M403 1759 V0 H319 V1759 v`+n+" v602 h84z";case"rceil":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v602 h84z
M347 1759 V0 h-84 V1759 v`+n+" v602 h84z";case"lparen":return`M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1
c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349,
-36,557 l0,`+(n+84)+`c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210,
949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9
c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5,
-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189
l0,-`+(n+92)+`c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3,
-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`;case"rparen":return`M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3,
63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5
c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,`+(n+9)+`
c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664
c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw new Error("Unknown stretchy delimiter.")}};let hw=class{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;n<this.children.length;n++)e.appendChild(this.children[n].toNode());return e}toMarkup(){for(var e="",n=0;n<this.children.length;n++)e+=this.children[n].toMarkup();return e}toText(){var e=n=>n.toText();return this.children.map(e).join("")}};var Yf={"AMS-Regular":{32:[0,0,0,0,.25],65:[0,.68889,0,0,.72222],66:[0,.68889,0,0,.66667],67:[0,.68889,0,0,.72222],68:[0,.68889,0,0,.72222],69:[0,.68889,0,0,.66667],70:[0,.68889,0,0,.61111],71:[0,.68889,0,0,.77778],72:[0,.68889,0,0,.77778],73:[0,.68889,0,0,.38889],74:[.16667,.68889,0,0,.5],75:[0,.68889,0,0,.77778],76:[0,.68889,0,0,.66667],77:[0,.68889,0,0,.94445],78:[0,.68889,0,0,.72222],79:[.16667,.68889,0,0,.77778],80:[0,.68889,0,0,.61111],81:[.16667,.68889,0,0,.77778],82:[0,.68889,0,0,.72222],83:[0,.68889,0,0,.55556],84:[0,.68889,0,0,.66667],85:[0,.68889,0,0,.72222],86:[0,.68889,0,0,.72222],87:[0,.68889,0,0,1],88:[0,.68889,0,0,.72222],89:[0,.68889,0,0,.72222],90:[0,.68889,0,0,.66667],107:[0,.68889,0,0,.55556],160:[0,0,0,0,.25],165:[0,.675,.025,0,.75],174:[.15559,.69224,0,0,.94666],240:[0,.68889,0,0,.55556],295:[0,.68889,0,0,.54028],710:[0,.825,0,0,2.33334],732:[0,.9,0,0,2.33334],770:[0,.825,0,0,2.33334],771:[0,.9,0,0,2.33334],989:[.08167,.58167,0,0,.77778],1008:[0,.43056,.04028,0,.66667],8245:[0,.54986,0,0,.275],8463:[0,.68889,0,0,.54028],8487:[0,.68889,0,0,.72222],8498:[0,.68889,0,0,.55556],8502:[0,.68889,0,0,.66667],8503:[0,.68889,0,0,.44445],8504:[0,.68889,0,0,.66667],8513:[0,.68889,0,0,.63889],8592:[-.03598,.46402,0,0,.5],8594:[-.03598,.46402,0,0,.5],8602:[-.13313,.36687,0,0,1],8603:[-.13313,.36687,0,0,1],8606:[.01354,.52239,0,0,1],8608:[.01354,.52239,0,0,1],8610:[.01354,.52239,0,0,1.11111],8611:[.01354,.52239,0,0,1.11111],8619:[0,.54986,0,0,1],8620:[0,.54986,0,0,1],8621:[-.13313,.37788,0,0,1.38889],8622:[-.13313,.36687,0,0,1],8624:[0,.69224,0,0,.5],8625:[0,.69224,0,0,.5],8630:[0,.43056,0,0,1],8631:[0,.43056,0,0,1],8634:[.08198,.58198,0,0,.77778],8635:[.08198,.58198,0,0,.77778],8638:[.19444,.69224,0,0,.41667],8639:[.19444,.69224,0,0,.41667],8642:[.19444,.69224,0,0,.41667],8643:[.19444,.69224,0,0,.41667],8644:[.1808,.675,0,0,1],8646:[.1808,.675,0,0,1],8647:[.1808,.675,0,0,1],8648:[.19444,.69224,0,0,.83334],8649:[.1808,.675,0,0,1],8650:[.19444,.69224,0,0,.83334],8651:[.01354,.52239,0,0,1],8652:[.01354,.52239,0,0,1],8653:[-.13313,.36687,0,0,1],8654:[-.13313,.36687,0,0,1],8655:[-.13313,.36687,0,0,1],8666:[.13667,.63667,0,0,1],8667:[.13667,.63667,0,0,1],8669:[-.13313,.37788,0,0,1],8672:[-.064,.437,0,0,1.334],8674:[-.064,.437,0,0,1.334],8705:[0,.825,0,0,.5],8708:[0,.68889,0,0,.55556],8709:[.08167,.58167,0,0,.77778],8717:[0,.43056,0,0,.42917],8722:[-.03598,.46402,0,0,.5],8724:[.08198,.69224,0,0,.77778],8726:[.08167,.58167,0,0,.77778],8733:[0,.69224,0,0,.77778],8736:[0,.69224,0,0,.72222],8737:[0,.69224,0,0,.72222],8738:[.03517,.52239,0,0,.72222],8739:[.08167,.58167,0,0,.22222],8740:[.25142,.74111,0,0,.27778],8741:[.08167,.58167,0,0,.38889],8742:[.25142,.74111,0,0,.5],8756:[0,.69224,0,0,.66667],8757:[0,.69224,0,0,.66667],8764:[-.13313,.36687,0,0,.77778],8765:[-.13313,.37788,0,0,.77778],8769:[-.13313,.36687,0,0,.77778],8770:[-.03625,.46375,0,0,.77778],8774:[.30274,.79383,0,0,.77778],8776:[-.01688,.48312,0,0,.77778],8778:[.08167,.58167,0,0,.77778],8782:[.06062,.54986,0,0,.77778],8783:[.06062,.54986,0,0,.77778],8785:[.08198,.58198,0,0,.77778],8786:[.08198,.58198,0,0,.77778],8787:[.08198,.58198,0,0,.77778],8790:[0,.69224,0,0,.77778],8791:[.22958,.72958,0,0,.77778],8796:[.08198,.91667,0,0,.77778],8806:[.25583,.75583,0,0,.77778],8807:[.25583,.75583,0,0,.77778],8808:[.25142,.75726,0,0,.77778],8809:[.25142,.75726,0,0,.77778],8812:[.25583,.75583,0,0,.5],8814:[.20576,.70576,0,0,.77778],8815:[.20576,.70576,0,0,.77778],8816:[.30274,.79383,0,0,.77778],8817:[.30274,.79383,0,0,.77778],8818:[.22958,.72958,0,0,.77778],8819:[.22958,.72958,0,0,.77778],8822:[.1808,.675,0,0,.77778],8823:[.1808,.675,0,0,.77778],8828:[.13667,.63667,0,0,.77778],8829:[.13667,.63667,0,0,.77778],8830:[.22958,.72958,0,0,.77778],8831:[.22958,.72958,0,0,.77778],8832:[.20576,.70576,0,0,.77778],8833:[.20576,.70576,0,0,.77778],8840:[.30274,.79383,0,0,.77778],8841:[.30274,.79383,0,0,.77778],8842:[.13597,.63597,0,0,.77778],8843:[.13597,.63597,0,0,.77778],8847:[.03517,.54986,0,0,.77778],8848:[.03517,.54986,0,0,.77778],8858:[.08198,.58198,0,0,.77778],8859:[.08198,.58198,0,0,.77778],8861:[.08198,.58198,0,0,.77778],8862:[0,.675,0,0,.77778],8863:[0,.675,0,0,.77778],8864:[0,.675,0,0,.77778],8865:[0,.675,0,0,.77778],8872:[0,.69224,0,0,.61111],8873:[0,.69224,0,0,.72222],8874:[0,.69224,0,0,.88889],8876:[0,.68889,0,0,.61111],8877:[0,.68889,0,0,.61111],8878:[0,.68889,0,0,.72222],8879:[0,.68889,0,0,.72222],8882:[.03517,.54986,0,0,.77778],8883:[.03517,.54986,0,0,.77778],8884:[.13667,.63667,0,0,.77778],8885:[.13667,.63667,0,0,.77778],8888:[0,.54986,0,0,1.11111],8890:[.19444,.43056,0,0,.55556],8891:[.19444,.69224,0,0,.61111],8892:[.19444,.69224,0,0,.61111],8901:[0,.54986,0,0,.27778],8903:[.08167,.58167,0,0,.77778],8905:[.08167,.58167,0,0,.77778],8906:[.08167,.58167,0,0,.77778],8907:[0,.69224,0,0,.77778],8908:[0,.69224,0,0,.77778],8909:[-.03598,.46402,0,0,.77778],8910:[0,.54986,0,0,.76042],8911:[0,.54986,0,0,.76042],8912:[.03517,.54986,0,0,.77778],8913:[.03517,.54986,0,0,.77778],8914:[0,.54986,0,0,.66667],8915:[0,.54986,0,0,.66667],8916:[0,.69224,0,0,.66667],8918:[.0391,.5391,0,0,.77778],8919:[.0391,.5391,0,0,.77778],8920:[.03517,.54986,0,0,1.33334],8921:[.03517,.54986,0,0,1.33334],8922:[.38569,.88569,0,0,.77778],8923:[.38569,.88569,0,0,.77778],8926:[.13667,.63667,0,0,.77778],8927:[.13667,.63667,0,0,.77778],8928:[.30274,.79383,0,0,.77778],8929:[.30274,.79383,0,0,.77778],8934:[.23222,.74111,0,0,.77778],8935:[.23222,.74111,0,0,.77778],8936:[.23222,.74111,0,0,.77778],8937:[.23222,.74111,0,0,.77778],8938:[.20576,.70576,0,0,.77778],8939:[.20576,.70576,0,0,.77778],8940:[.30274,.79383,0,0,.77778],8941:[.30274,.79383,0,0,.77778],8994:[.19444,.69224,0,0,.77778],8995:[.19444,.69224,0,0,.77778],9416:[.15559,.69224,0,0,.90222],9484:[0,.69224,0,0,.5],9488:[0,.69224,0,0,.5],9492:[0,.37788,0,0,.5],9496:[0,.37788,0,0,.5],9585:[.19444,.68889,0,0,.88889],9586:[.19444,.74111,0,0,.88889],9632:[0,.675,0,0,.77778],9633:[0,.675,0,0,.77778],9650:[0,.54986,0,0,.72222],9651:[0,.54986,0,0,.72222],9654:[.03517,.54986,0,0,.77778],9660:[0,.54986,0,0,.72222],9661:[0,.54986,0,0,.72222],9664:[.03517,.54986,0,0,.77778],9674:[.11111,.69224,0,0,.66667],9733:[.19444,.69224,0,0,.94445],10003:[0,.69224,0,0,.83334],10016:[0,.69224,0,0,.83334],10731:[.11111,.69224,0,0,.66667],10846:[.19444,.75583,0,0,.61111],10877:[.13667,.63667,0,0,.77778],10878:[.13667,.63667,0,0,.77778],10885:[.25583,.75583,0,0,.77778],10886:[.25583,.75583,0,0,.77778],10887:[.13597,.63597,0,0,.77778],10888:[.13597,.63597,0,0,.77778],10889:[.26167,.75726,0,0,.77778],10890:[.26167,.75726,0,0,.77778],10891:[.48256,.98256,0,0,.77778],10892:[.48256,.98256,0,0,.77778],10901:[.13667,.63667,0,0,.77778],10902:[.13667,.63667,0,0,.77778],10933:[.25142,.75726,0,0,.77778],10934:[.25142,.75726,0,0,.77778],10935:[.26167,.75726,0,0,.77778],10936:[.26167,.75726,0,0,.77778],10937:[.26167,.75726,0,0,.77778],10938:[.26167,.75726,0,0,.77778],10949:[.25583,.75583,0,0,.77778],10950:[.25583,.75583,0,0,.77778],10955:[.28481,.79383,0,0,.77778],10956:[.28481,.79383,0,0,.77778],57350:[.08167,.58167,0,0,.22222],57351:[.08167,.58167,0,0,.38889],57352:[.08167,.58167,0,0,.77778],57353:[0,.43056,.04028,0,.66667],57356:[.25142,.75726,0,0,.77778],57357:[.25142,.75726,0,0,.77778],57358:[.41951,.91951,0,0,.77778],57359:[.30274,.79383,0,0,.77778],57360:[.30274,.79383,0,0,.77778],57361:[.41951,.91951,0,0,.77778],57366:[.25142,.75726,0,0,.77778],57367:[.25142,.75726,0,0,.77778],57368:[.25142,.75726,0,0,.77778],57369:[.25142,.75726,0,0,.77778],57370:[.13597,.63597,0,0,.77778],57371:[.13597,.63597,0,0,.77778]},"Caligraphic-Regular":{32:[0,0,0,0,.25],65:[0,.68333,0,.19445,.79847],66:[0,.68333,.03041,.13889,.65681],67:[0,.68333,.05834,.13889,.52653],68:[0,.68333,.02778,.08334,.77139],69:[0,.68333,.08944,.11111,.52778],70:[0,.68333,.09931,.11111,.71875],71:[.09722,.68333,.0593,.11111,.59487],72:[0,.68333,.00965,.11111,.84452],73:[0,.68333,.07382,0,.54452],74:[.09722,.68333,.18472,.16667,.67778],75:[0,.68333,.01445,.05556,.76195],76:[0,.68333,0,.13889,.68972],77:[0,.68333,0,.13889,1.2009],78:[0,.68333,.14736,.08334,.82049],79:[0,.68333,.02778,.11111,.79611],80:[0,.68333,.08222,.08334,.69556],81:[.09722,.68333,0,.11111,.81667],82:[0,.68333,0,.08334,.8475],83:[0,.68333,.075,.13889,.60556],84:[0,.68333,.25417,0,.54464],85:[0,.68333,.09931,.08334,.62583],86:[0,.68333,.08222,0,.61278],87:[0,.68333,.08222,.08334,.98778],88:[0,.68333,.14643,.13889,.7133],89:[.09722,.68333,.08222,.08334,.66834],90:[0,.68333,.07944,.13889,.72473],160:[0,0,0,0,.25]},"Fraktur-Regular":{32:[0,0,0,0,.25],33:[0,.69141,0,0,.29574],34:[0,.69141,0,0,.21471],38:[0,.69141,0,0,.73786],39:[0,.69141,0,0,.21201],40:[.24982,.74947,0,0,.38865],41:[.24982,.74947,0,0,.38865],42:[0,.62119,0,0,.27764],43:[.08319,.58283,0,0,.75623],44:[0,.10803,0,0,.27764],45:[.08319,.58283,0,0,.75623],46:[0,.10803,0,0,.27764],47:[.24982,.74947,0,0,.50181],48:[0,.47534,0,0,.50181],49:[0,.47534,0,0,.50181],50:[0,.47534,0,0,.50181],51:[.18906,.47534,0,0,.50181],52:[.18906,.47534,0,0,.50181],53:[.18906,.47534,0,0,.50181],54:[0,.69141,0,0,.50181],55:[.18906,.47534,0,0,.50181],56:[0,.69141,0,0,.50181],57:[.18906,.47534,0,0,.50181],58:[0,.47534,0,0,.21606],59:[.12604,.47534,0,0,.21606],61:[-.13099,.36866,0,0,.75623],63:[0,.69141,0,0,.36245],65:[0,.69141,0,0,.7176],66:[0,.69141,0,0,.88397],67:[0,.69141,0,0,.61254],68:[0,.69141,0,0,.83158],69:[0,.69141,0,0,.66278],70:[.12604,.69141,0,0,.61119],71:[0,.69141,0,0,.78539],72:[.06302,.69141,0,0,.7203],73:[0,.69141,0,0,.55448],74:[.12604,.69141,0,0,.55231],75:[0,.69141,0,0,.66845],76:[0,.69141,0,0,.66602],77:[0,.69141,0,0,1.04953],78:[0,.69141,0,0,.83212],79:[0,.69141,0,0,.82699],80:[.18906,.69141,0,0,.82753],81:[.03781,.69141,0,0,.82699],82:[0,.69141,0,0,.82807],83:[0,.69141,0,0,.82861],84:[0,.69141,0,0,.66899],85:[0,.69141,0,0,.64576],86:[0,.69141,0,0,.83131],87:[0,.69141,0,0,1.04602],88:[0,.69141,0,0,.71922],89:[.18906,.69141,0,0,.83293],90:[.12604,.69141,0,0,.60201],91:[.24982,.74947,0,0,.27764],93:[.24982,.74947,0,0,.27764],94:[0,.69141,0,0,.49965],97:[0,.47534,0,0,.50046],98:[0,.69141,0,0,.51315],99:[0,.47534,0,0,.38946],100:[0,.62119,0,0,.49857],101:[0,.47534,0,0,.40053],102:[.18906,.69141,0,0,.32626],103:[.18906,.47534,0,0,.5037],104:[.18906,.69141,0,0,.52126],105:[0,.69141,0,0,.27899],106:[0,.69141,0,0,.28088],107:[0,.69141,0,0,.38946],108:[0,.69141,0,0,.27953],109:[0,.47534,0,0,.76676],110:[0,.47534,0,0,.52666],111:[0,.47534,0,0,.48885],112:[.18906,.52396,0,0,.50046],113:[.18906,.47534,0,0,.48912],114:[0,.47534,0,0,.38919],115:[0,.47534,0,0,.44266],116:[0,.62119,0,0,.33301],117:[0,.47534,0,0,.5172],118:[0,.52396,0,0,.5118],119:[0,.52396,0,0,.77351],120:[.18906,.47534,0,0,.38865],121:[.18906,.47534,0,0,.49884],122:[.18906,.47534,0,0,.39054],160:[0,0,0,0,.25],8216:[0,.69141,0,0,.21471],8217:[0,.69141,0,0,.21471],58112:[0,.62119,0,0,.49749],58113:[0,.62119,0,0,.4983],58114:[.18906,.69141,0,0,.33328],58115:[.18906,.69141,0,0,.32923],58116:[.18906,.47534,0,0,.50343],58117:[0,.69141,0,0,.33301],58118:[0,.62119,0,0,.33409],58119:[0,.47534,0,0,.50073]},"Main-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.35],34:[0,.69444,0,0,.60278],35:[.19444,.69444,0,0,.95833],36:[.05556,.75,0,0,.575],37:[.05556,.75,0,0,.95833],38:[0,.69444,0,0,.89444],39:[0,.69444,0,0,.31944],40:[.25,.75,0,0,.44722],41:[.25,.75,0,0,.44722],42:[0,.75,0,0,.575],43:[.13333,.63333,0,0,.89444],44:[.19444,.15556,0,0,.31944],45:[0,.44444,0,0,.38333],46:[0,.15556,0,0,.31944],47:[.25,.75,0,0,.575],48:[0,.64444,0,0,.575],49:[0,.64444,0,0,.575],50:[0,.64444,0,0,.575],51:[0,.64444,0,0,.575],52:[0,.64444,0,0,.575],53:[0,.64444,0,0,.575],54:[0,.64444,0,0,.575],55:[0,.64444,0,0,.575],56:[0,.64444,0,0,.575],57:[0,.64444,0,0,.575],58:[0,.44444,0,0,.31944],59:[.19444,.44444,0,0,.31944],60:[.08556,.58556,0,0,.89444],61:[-.10889,.39111,0,0,.89444],62:[.08556,.58556,0,0,.89444],63:[0,.69444,0,0,.54305],64:[0,.69444,0,0,.89444],65:[0,.68611,0,0,.86944],66:[0,.68611,0,0,.81805],67:[0,.68611,0,0,.83055],68:[0,.68611,0,0,.88194],69:[0,.68611,0,0,.75555],70:[0,.68611,0,0,.72361],71:[0,.68611,0,0,.90416],72:[0,.68611,0,0,.9],73:[0,.68611,0,0,.43611],74:[0,.68611,0,0,.59444],75:[0,.68611,0,0,.90138],76:[0,.68611,0,0,.69166],77:[0,.68611,0,0,1.09166],78:[0,.68611,0,0,.9],79:[0,.68611,0,0,.86388],80:[0,.68611,0,0,.78611],81:[.19444,.68611,0,0,.86388],82:[0,.68611,0,0,.8625],83:[0,.68611,0,0,.63889],84:[0,.68611,0,0,.8],85:[0,.68611,0,0,.88472],86:[0,.68611,.01597,0,.86944],87:[0,.68611,.01597,0,1.18888],88:[0,.68611,0,0,.86944],89:[0,.68611,.02875,0,.86944],90:[0,.68611,0,0,.70277],91:[.25,.75,0,0,.31944],92:[.25,.75,0,0,.575],93:[.25,.75,0,0,.31944],94:[0,.69444,0,0,.575],95:[.31,.13444,.03194,0,.575],97:[0,.44444,0,0,.55902],98:[0,.69444,0,0,.63889],99:[0,.44444,0,0,.51111],100:[0,.69444,0,0,.63889],101:[0,.44444,0,0,.52708],102:[0,.69444,.10903,0,.35139],103:[.19444,.44444,.01597,0,.575],104:[0,.69444,0,0,.63889],105:[0,.69444,0,0,.31944],106:[.19444,.69444,0,0,.35139],107:[0,.69444,0,0,.60694],108:[0,.69444,0,0,.31944],109:[0,.44444,0,0,.95833],110:[0,.44444,0,0,.63889],111:[0,.44444,0,0,.575],112:[.19444,.44444,0,0,.63889],113:[.19444,.44444,0,0,.60694],114:[0,.44444,0,0,.47361],115:[0,.44444,0,0,.45361],116:[0,.63492,0,0,.44722],117:[0,.44444,0,0,.63889],118:[0,.44444,.01597,0,.60694],119:[0,.44444,.01597,0,.83055],120:[0,.44444,0,0,.60694],121:[.19444,.44444,.01597,0,.60694],122:[0,.44444,0,0,.51111],123:[.25,.75,0,0,.575],124:[.25,.75,0,0,.31944],125:[.25,.75,0,0,.575],126:[.35,.34444,0,0,.575],160:[0,0,0,0,.25],163:[0,.69444,0,0,.86853],168:[0,.69444,0,0,.575],172:[0,.44444,0,0,.76666],176:[0,.69444,0,0,.86944],177:[.13333,.63333,0,0,.89444],184:[.17014,0,0,0,.51111],198:[0,.68611,0,0,1.04166],215:[.13333,.63333,0,0,.89444],216:[.04861,.73472,0,0,.89444],223:[0,.69444,0,0,.59722],230:[0,.44444,0,0,.83055],247:[.13333,.63333,0,0,.89444],248:[.09722,.54167,0,0,.575],305:[0,.44444,0,0,.31944],338:[0,.68611,0,0,1.16944],339:[0,.44444,0,0,.89444],567:[.19444,.44444,0,0,.35139],710:[0,.69444,0,0,.575],711:[0,.63194,0,0,.575],713:[0,.59611,0,0,.575],714:[0,.69444,0,0,.575],715:[0,.69444,0,0,.575],728:[0,.69444,0,0,.575],729:[0,.69444,0,0,.31944],730:[0,.69444,0,0,.86944],732:[0,.69444,0,0,.575],733:[0,.69444,0,0,.575],915:[0,.68611,0,0,.69166],916:[0,.68611,0,0,.95833],920:[0,.68611,0,0,.89444],923:[0,.68611,0,0,.80555],926:[0,.68611,0,0,.76666],928:[0,.68611,0,0,.9],931:[0,.68611,0,0,.83055],933:[0,.68611,0,0,.89444],934:[0,.68611,0,0,.83055],936:[0,.68611,0,0,.89444],937:[0,.68611,0,0,.83055],8211:[0,.44444,.03194,0,.575],8212:[0,.44444,.03194,0,1.14999],8216:[0,.69444,0,0,.31944],8217:[0,.69444,0,0,.31944],8220:[0,.69444,0,0,.60278],8221:[0,.69444,0,0,.60278],8224:[.19444,.69444,0,0,.51111],8225:[.19444,.69444,0,0,.51111],8242:[0,.55556,0,0,.34444],8407:[0,.72444,.15486,0,.575],8463:[0,.69444,0,0,.66759],8465:[0,.69444,0,0,.83055],8467:[0,.69444,0,0,.47361],8472:[.19444,.44444,0,0,.74027],8476:[0,.69444,0,0,.83055],8501:[0,.69444,0,0,.70277],8592:[-.10889,.39111,0,0,1.14999],8593:[.19444,.69444,0,0,.575],8594:[-.10889,.39111,0,0,1.14999],8595:[.19444,.69444,0,0,.575],8596:[-.10889,.39111,0,0,1.14999],8597:[.25,.75,0,0,.575],8598:[.19444,.69444,0,0,1.14999],8599:[.19444,.69444,0,0,1.14999],8600:[.19444,.69444,0,0,1.14999],8601:[.19444,.69444,0,0,1.14999],8636:[-.10889,.39111,0,0,1.14999],8637:[-.10889,.39111,0,0,1.14999],8640:[-.10889,.39111,0,0,1.14999],8641:[-.10889,.39111,0,0,1.14999],8656:[-.10889,.39111,0,0,1.14999],8657:[.19444,.69444,0,0,.70277],8658:[-.10889,.39111,0,0,1.14999],8659:[.19444,.69444,0,0,.70277],8660:[-.10889,.39111,0,0,1.14999],8661:[.25,.75,0,0,.70277],8704:[0,.69444,0,0,.63889],8706:[0,.69444,.06389,0,.62847],8707:[0,.69444,0,0,.63889],8709:[.05556,.75,0,0,.575],8711:[0,.68611,0,0,.95833],8712:[.08556,.58556,0,0,.76666],8715:[.08556,.58556,0,0,.76666],8722:[.13333,.63333,0,0,.89444],8723:[.13333,.63333,0,0,.89444],8725:[.25,.75,0,0,.575],8726:[.25,.75,0,0,.575],8727:[-.02778,.47222,0,0,.575],8728:[-.02639,.47361,0,0,.575],8729:[-.02639,.47361,0,0,.575],8730:[.18,.82,0,0,.95833],8733:[0,.44444,0,0,.89444],8734:[0,.44444,0,0,1.14999],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.31944],8741:[.25,.75,0,0,.575],8743:[0,.55556,0,0,.76666],8744:[0,.55556,0,0,.76666],8745:[0,.55556,0,0,.76666],8746:[0,.55556,0,0,.76666],8747:[.19444,.69444,.12778,0,.56875],8764:[-.10889,.39111,0,0,.89444],8768:[.19444,.69444,0,0,.31944],8771:[.00222,.50222,0,0,.89444],8773:[.027,.638,0,0,.894],8776:[.02444,.52444,0,0,.89444],8781:[.00222,.50222,0,0,.89444],8801:[.00222,.50222,0,0,.89444],8804:[.19667,.69667,0,0,.89444],8805:[.19667,.69667,0,0,.89444],8810:[.08556,.58556,0,0,1.14999],8811:[.08556,.58556,0,0,1.14999],8826:[.08556,.58556,0,0,.89444],8827:[.08556,.58556,0,0,.89444],8834:[.08556,.58556,0,0,.89444],8835:[.08556,.58556,0,0,.89444],8838:[.19667,.69667,0,0,.89444],8839:[.19667,.69667,0,0,.89444],8846:[0,.55556,0,0,.76666],8849:[.19667,.69667,0,0,.89444],8850:[.19667,.69667,0,0,.89444],8851:[0,.55556,0,0,.76666],8852:[0,.55556,0,0,.76666],8853:[.13333,.63333,0,0,.89444],8854:[.13333,.63333,0,0,.89444],8855:[.13333,.63333,0,0,.89444],8856:[.13333,.63333,0,0,.89444],8857:[.13333,.63333,0,0,.89444],8866:[0,.69444,0,0,.70277],8867:[0,.69444,0,0,.70277],8868:[0,.69444,0,0,.89444],8869:[0,.69444,0,0,.89444],8900:[-.02639,.47361,0,0,.575],8901:[-.02639,.47361,0,0,.31944],8902:[-.02778,.47222,0,0,.575],8968:[.25,.75,0,0,.51111],8969:[.25,.75,0,0,.51111],8970:[.25,.75,0,0,.51111],8971:[.25,.75,0,0,.51111],8994:[-.13889,.36111,0,0,1.14999],8995:[-.13889,.36111,0,0,1.14999],9651:[.19444,.69444,0,0,1.02222],9657:[-.02778,.47222,0,0,.575],9661:[.19444,.69444,0,0,1.02222],9667:[-.02778,.47222,0,0,.575],9711:[.19444,.69444,0,0,1.14999],9824:[.12963,.69444,0,0,.89444],9825:[.12963,.69444,0,0,.89444],9826:[.12963,.69444,0,0,.89444],9827:[.12963,.69444,0,0,.89444],9837:[0,.75,0,0,.44722],9838:[.19444,.69444,0,0,.44722],9839:[.19444,.69444,0,0,.44722],10216:[.25,.75,0,0,.44722],10217:[.25,.75,0,0,.44722],10815:[0,.68611,0,0,.9],10927:[.19667,.69667,0,0,.89444],10928:[.19667,.69667,0,0,.89444],57376:[.19444,.69444,0,0,0]},"Main-BoldItalic":{32:[0,0,0,0,.25],33:[0,.69444,.11417,0,.38611],34:[0,.69444,.07939,0,.62055],35:[.19444,.69444,.06833,0,.94444],37:[.05556,.75,.12861,0,.94444],38:[0,.69444,.08528,0,.88555],39:[0,.69444,.12945,0,.35555],40:[.25,.75,.15806,0,.47333],41:[.25,.75,.03306,0,.47333],42:[0,.75,.14333,0,.59111],43:[.10333,.60333,.03306,0,.88555],44:[.19444,.14722,0,0,.35555],45:[0,.44444,.02611,0,.41444],46:[0,.14722,0,0,.35555],47:[.25,.75,.15806,0,.59111],48:[0,.64444,.13167,0,.59111],49:[0,.64444,.13167,0,.59111],50:[0,.64444,.13167,0,.59111],51:[0,.64444,.13167,0,.59111],52:[.19444,.64444,.13167,0,.59111],53:[0,.64444,.13167,0,.59111],54:[0,.64444,.13167,0,.59111],55:[.19444,.64444,.13167,0,.59111],56:[0,.64444,.13167,0,.59111],57:[0,.64444,.13167,0,.59111],58:[0,.44444,.06695,0,.35555],59:[.19444,.44444,.06695,0,.35555],61:[-.10889,.39111,.06833,0,.88555],63:[0,.69444,.11472,0,.59111],64:[0,.69444,.09208,0,.88555],65:[0,.68611,0,0,.86555],66:[0,.68611,.0992,0,.81666],67:[0,.68611,.14208,0,.82666],68:[0,.68611,.09062,0,.87555],69:[0,.68611,.11431,0,.75666],70:[0,.68611,.12903,0,.72722],71:[0,.68611,.07347,0,.89527],72:[0,.68611,.17208,0,.8961],73:[0,.68611,.15681,0,.47166],74:[0,.68611,.145,0,.61055],75:[0,.68611,.14208,0,.89499],76:[0,.68611,0,0,.69777],77:[0,.68611,.17208,0,1.07277],78:[0,.68611,.17208,0,.8961],79:[0,.68611,.09062,0,.85499],80:[0,.68611,.0992,0,.78721],81:[.19444,.68611,.09062,0,.85499],82:[0,.68611,.02559,0,.85944],83:[0,.68611,.11264,0,.64999],84:[0,.68611,.12903,0,.7961],85:[0,.68611,.17208,0,.88083],86:[0,.68611,.18625,0,.86555],87:[0,.68611,.18625,0,1.15999],88:[0,.68611,.15681,0,.86555],89:[0,.68611,.19803,0,.86555],90:[0,.68611,.14208,0,.70888],91:[.25,.75,.1875,0,.35611],93:[.25,.75,.09972,0,.35611],94:[0,.69444,.06709,0,.59111],95:[.31,.13444,.09811,0,.59111],97:[0,.44444,.09426,0,.59111],98:[0,.69444,.07861,0,.53222],99:[0,.44444,.05222,0,.53222],100:[0,.69444,.10861,0,.59111],101:[0,.44444,.085,0,.53222],102:[.19444,.69444,.21778,0,.4],103:[.19444,.44444,.105,0,.53222],104:[0,.69444,.09426,0,.59111],105:[0,.69326,.11387,0,.35555],106:[.19444,.69326,.1672,0,.35555],107:[0,.69444,.11111,0,.53222],108:[0,.69444,.10861,0,.29666],109:[0,.44444,.09426,0,.94444],110:[0,.44444,.09426,0,.64999],111:[0,.44444,.07861,0,.59111],112:[.19444,.44444,.07861,0,.59111],113:[.19444,.44444,.105,0,.53222],114:[0,.44444,.11111,0,.50167],115:[0,.44444,.08167,0,.48694],116:[0,.63492,.09639,0,.385],117:[0,.44444,.09426,0,.62055],118:[0,.44444,.11111,0,.53222],119:[0,.44444,.11111,0,.76777],120:[0,.44444,.12583,0,.56055],121:[.19444,.44444,.105,0,.56166],122:[0,.44444,.13889,0,.49055],126:[.35,.34444,.11472,0,.59111],160:[0,0,0,0,.25],168:[0,.69444,.11473,0,.59111],176:[0,.69444,0,0,.94888],184:[.17014,0,0,0,.53222],198:[0,.68611,.11431,0,1.02277],216:[.04861,.73472,.09062,0,.88555],223:[.19444,.69444,.09736,0,.665],230:[0,.44444,.085,0,.82666],248:[.09722,.54167,.09458,0,.59111],305:[0,.44444,.09426,0,.35555],338:[0,.68611,.11431,0,1.14054],339:[0,.44444,.085,0,.82666],567:[.19444,.44444,.04611,0,.385],710:[0,.69444,.06709,0,.59111],711:[0,.63194,.08271,0,.59111],713:[0,.59444,.10444,0,.59111],714:[0,.69444,.08528,0,.59111],715:[0,.69444,0,0,.59111],728:[0,.69444,.10333,0,.59111],729:[0,.69444,.12945,0,.35555],730:[0,.69444,0,0,.94888],732:[0,.69444,.11472,0,.59111],733:[0,.69444,.11472,0,.59111],915:[0,.68611,.12903,0,.69777],916:[0,.68611,0,0,.94444],920:[0,.68611,.09062,0,.88555],923:[0,.68611,0,0,.80666],926:[0,.68611,.15092,0,.76777],928:[0,.68611,.17208,0,.8961],931:[0,.68611,.11431,0,.82666],933:[0,.68611,.10778,0,.88555],934:[0,.68611,.05632,0,.82666],936:[0,.68611,.10778,0,.88555],937:[0,.68611,.0992,0,.82666],8211:[0,.44444,.09811,0,.59111],8212:[0,.44444,.09811,0,1.18221],8216:[0,.69444,.12945,0,.35555],8217:[0,.69444,.12945,0,.35555],8220:[0,.69444,.16772,0,.62055],8221:[0,.69444,.07939,0,.62055]},"Main-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.12417,0,.30667],34:[0,.69444,.06961,0,.51444],35:[.19444,.69444,.06616,0,.81777],37:[.05556,.75,.13639,0,.81777],38:[0,.69444,.09694,0,.76666],39:[0,.69444,.12417,0,.30667],40:[.25,.75,.16194,0,.40889],41:[.25,.75,.03694,0,.40889],42:[0,.75,.14917,0,.51111],43:[.05667,.56167,.03694,0,.76666],44:[.19444,.10556,0,0,.30667],45:[0,.43056,.02826,0,.35778],46:[0,.10556,0,0,.30667],47:[.25,.75,.16194,0,.51111],48:[0,.64444,.13556,0,.51111],49:[0,.64444,.13556,0,.51111],50:[0,.64444,.13556,0,.51111],51:[0,.64444,.13556,0,.51111],52:[.19444,.64444,.13556,0,.51111],53:[0,.64444,.13556,0,.51111],54:[0,.64444,.13556,0,.51111],55:[.19444,.64444,.13556,0,.51111],56:[0,.64444,.13556,0,.51111],57:[0,.64444,.13556,0,.51111],58:[0,.43056,.0582,0,.30667],59:[.19444,.43056,.0582,0,.30667],61:[-.13313,.36687,.06616,0,.76666],63:[0,.69444,.1225,0,.51111],64:[0,.69444,.09597,0,.76666],65:[0,.68333,0,0,.74333],66:[0,.68333,.10257,0,.70389],67:[0,.68333,.14528,0,.71555],68:[0,.68333,.09403,0,.755],69:[0,.68333,.12028,0,.67833],70:[0,.68333,.13305,0,.65277],71:[0,.68333,.08722,0,.77361],72:[0,.68333,.16389,0,.74333],73:[0,.68333,.15806,0,.38555],74:[0,.68333,.14028,0,.525],75:[0,.68333,.14528,0,.76888],76:[0,.68333,0,0,.62722],77:[0,.68333,.16389,0,.89666],78:[0,.68333,.16389,0,.74333],79:[0,.68333,.09403,0,.76666],80:[0,.68333,.10257,0,.67833],81:[.19444,.68333,.09403,0,.76666],82:[0,.68333,.03868,0,.72944],83:[0,.68333,.11972,0,.56222],84:[0,.68333,.13305,0,.71555],85:[0,.68333,.16389,0,.74333],86:[0,.68333,.18361,0,.74333],87:[0,.68333,.18361,0,.99888],88:[0,.68333,.15806,0,.74333],89:[0,.68333,.19383,0,.74333],90:[0,.68333,.14528,0,.61333],91:[.25,.75,.1875,0,.30667],93:[.25,.75,.10528,0,.30667],94:[0,.69444,.06646,0,.51111],95:[.31,.12056,.09208,0,.51111],97:[0,.43056,.07671,0,.51111],98:[0,.69444,.06312,0,.46],99:[0,.43056,.05653,0,.46],100:[0,.69444,.10333,0,.51111],101:[0,.43056,.07514,0,.46],102:[.19444,.69444,.21194,0,.30667],103:[.19444,.43056,.08847,0,.46],104:[0,.69444,.07671,0,.51111],105:[0,.65536,.1019,0,.30667],106:[.19444,.65536,.14467,0,.30667],107:[0,.69444,.10764,0,.46],108:[0,.69444,.10333,0,.25555],109:[0,.43056,.07671,0,.81777],110:[0,.43056,.07671,0,.56222],111:[0,.43056,.06312,0,.51111],112:[.19444,.43056,.06312,0,.51111],113:[.19444,.43056,.08847,0,.46],114:[0,.43056,.10764,0,.42166],115:[0,.43056,.08208,0,.40889],116:[0,.61508,.09486,0,.33222],117:[0,.43056,.07671,0,.53666],118:[0,.43056,.10764,0,.46],119:[0,.43056,.10764,0,.66444],120:[0,.43056,.12042,0,.46389],121:[.19444,.43056,.08847,0,.48555],122:[0,.43056,.12292,0,.40889],126:[.35,.31786,.11585,0,.51111],160:[0,0,0,0,.25],168:[0,.66786,.10474,0,.51111],176:[0,.69444,0,0,.83129],184:[.17014,0,0,0,.46],198:[0,.68333,.12028,0,.88277],216:[.04861,.73194,.09403,0,.76666],223:[.19444,.69444,.10514,0,.53666],230:[0,.43056,.07514,0,.71555],248:[.09722,.52778,.09194,0,.51111],338:[0,.68333,.12028,0,.98499],339:[0,.43056,.07514,0,.71555],710:[0,.69444,.06646,0,.51111],711:[0,.62847,.08295,0,.51111],713:[0,.56167,.10333,0,.51111],714:[0,.69444,.09694,0,.51111],715:[0,.69444,0,0,.51111],728:[0,.69444,.10806,0,.51111],729:[0,.66786,.11752,0,.30667],730:[0,.69444,0,0,.83129],732:[0,.66786,.11585,0,.51111],733:[0,.69444,.1225,0,.51111],915:[0,.68333,.13305,0,.62722],916:[0,.68333,0,0,.81777],920:[0,.68333,.09403,0,.76666],923:[0,.68333,0,0,.69222],926:[0,.68333,.15294,0,.66444],928:[0,.68333,.16389,0,.74333],931:[0,.68333,.12028,0,.71555],933:[0,.68333,.11111,0,.76666],934:[0,.68333,.05986,0,.71555],936:[0,.68333,.11111,0,.76666],937:[0,.68333,.10257,0,.71555],8211:[0,.43056,.09208,0,.51111],8212:[0,.43056,.09208,0,1.02222],8216:[0,.69444,.12417,0,.30667],8217:[0,.69444,.12417,0,.30667],8220:[0,.69444,.1685,0,.51444],8221:[0,.69444,.06961,0,.51444],8463:[0,.68889,0,0,.54028]},"Main-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.27778],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.77778],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.19444,.10556,0,0,.27778],45:[0,.43056,0,0,.33333],46:[0,.10556,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.64444,0,0,.5],49:[0,.64444,0,0,.5],50:[0,.64444,0,0,.5],51:[0,.64444,0,0,.5],52:[0,.64444,0,0,.5],53:[0,.64444,0,0,.5],54:[0,.64444,0,0,.5],55:[0,.64444,0,0,.5],56:[0,.64444,0,0,.5],57:[0,.64444,0,0,.5],58:[0,.43056,0,0,.27778],59:[.19444,.43056,0,0,.27778],60:[.0391,.5391,0,0,.77778],61:[-.13313,.36687,0,0,.77778],62:[.0391,.5391,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.77778],65:[0,.68333,0,0,.75],66:[0,.68333,0,0,.70834],67:[0,.68333,0,0,.72222],68:[0,.68333,0,0,.76389],69:[0,.68333,0,0,.68056],70:[0,.68333,0,0,.65278],71:[0,.68333,0,0,.78472],72:[0,.68333,0,0,.75],73:[0,.68333,0,0,.36111],74:[0,.68333,0,0,.51389],75:[0,.68333,0,0,.77778],76:[0,.68333,0,0,.625],77:[0,.68333,0,0,.91667],78:[0,.68333,0,0,.75],79:[0,.68333,0,0,.77778],80:[0,.68333,0,0,.68056],81:[.19444,.68333,0,0,.77778],82:[0,.68333,0,0,.73611],83:[0,.68333,0,0,.55556],84:[0,.68333,0,0,.72222],85:[0,.68333,0,0,.75],86:[0,.68333,.01389,0,.75],87:[0,.68333,.01389,0,1.02778],88:[0,.68333,0,0,.75],89:[0,.68333,.025,0,.75],90:[0,.68333,0,0,.61111],91:[.25,.75,0,0,.27778],92:[.25,.75,0,0,.5],93:[.25,.75,0,0,.27778],94:[0,.69444,0,0,.5],95:[.31,.12056,.02778,0,.5],97:[0,.43056,0,0,.5],98:[0,.69444,0,0,.55556],99:[0,.43056,0,0,.44445],100:[0,.69444,0,0,.55556],101:[0,.43056,0,0,.44445],102:[0,.69444,.07778,0,.30556],103:[.19444,.43056,.01389,0,.5],104:[0,.69444,0,0,.55556],105:[0,.66786,0,0,.27778],106:[.19444,.66786,0,0,.30556],107:[0,.69444,0,0,.52778],108:[0,.69444,0,0,.27778],109:[0,.43056,0,0,.83334],110:[0,.43056,0,0,.55556],111:[0,.43056,0,0,.5],112:[.19444,.43056,0,0,.55556],113:[.19444,.43056,0,0,.52778],114:[0,.43056,0,0,.39167],115:[0,.43056,0,0,.39445],116:[0,.61508,0,0,.38889],117:[0,.43056,0,0,.55556],118:[0,.43056,.01389,0,.52778],119:[0,.43056,.01389,0,.72222],120:[0,.43056,0,0,.52778],121:[.19444,.43056,.01389,0,.52778],122:[0,.43056,0,0,.44445],123:[.25,.75,0,0,.5],124:[.25,.75,0,0,.27778],125:[.25,.75,0,0,.5],126:[.35,.31786,0,0,.5],160:[0,0,0,0,.25],163:[0,.69444,0,0,.76909],167:[.19444,.69444,0,0,.44445],168:[0,.66786,0,0,.5],172:[0,.43056,0,0,.66667],176:[0,.69444,0,0,.75],177:[.08333,.58333,0,0,.77778],182:[.19444,.69444,0,0,.61111],184:[.17014,0,0,0,.44445],198:[0,.68333,0,0,.90278],215:[.08333,.58333,0,0,.77778],216:[.04861,.73194,0,0,.77778],223:[0,.69444,0,0,.5],230:[0,.43056,0,0,.72222],247:[.08333,.58333,0,0,.77778],248:[.09722,.52778,0,0,.5],305:[0,.43056,0,0,.27778],338:[0,.68333,0,0,1.01389],339:[0,.43056,0,0,.77778],567:[.19444,.43056,0,0,.30556],710:[0,.69444,0,0,.5],711:[0,.62847,0,0,.5],713:[0,.56778,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.66786,0,0,.27778],730:[0,.69444,0,0,.75],732:[0,.66786,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.68333,0,0,.625],916:[0,.68333,0,0,.83334],920:[0,.68333,0,0,.77778],923:[0,.68333,0,0,.69445],926:[0,.68333,0,0,.66667],928:[0,.68333,0,0,.75],931:[0,.68333,0,0,.72222],933:[0,.68333,0,0,.77778],934:[0,.68333,0,0,.72222],936:[0,.68333,0,0,.77778],937:[0,.68333,0,0,.72222],8211:[0,.43056,.02778,0,.5],8212:[0,.43056,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5],8224:[.19444,.69444,0,0,.44445],8225:[.19444,.69444,0,0,.44445],8230:[0,.123,0,0,1.172],8242:[0,.55556,0,0,.275],8407:[0,.71444,.15382,0,.5],8463:[0,.68889,0,0,.54028],8465:[0,.69444,0,0,.72222],8467:[0,.69444,0,.11111,.41667],8472:[.19444,.43056,0,.11111,.63646],8476:[0,.69444,0,0,.72222],8501:[0,.69444,0,0,.61111],8592:[-.13313,.36687,0,0,1],8593:[.19444,.69444,0,0,.5],8594:[-.13313,.36687,0,0,1],8595:[.19444,.69444,0,0,.5],8596:[-.13313,.36687,0,0,1],8597:[.25,.75,0,0,.5],8598:[.19444,.69444,0,0,1],8599:[.19444,.69444,0,0,1],8600:[.19444,.69444,0,0,1],8601:[.19444,.69444,0,0,1],8614:[.011,.511,0,0,1],8617:[.011,.511,0,0,1.126],8618:[.011,.511,0,0,1.126],8636:[-.13313,.36687,0,0,1],8637:[-.13313,.36687,0,0,1],8640:[-.13313,.36687,0,0,1],8641:[-.13313,.36687,0,0,1],8652:[.011,.671,0,0,1],8656:[-.13313,.36687,0,0,1],8657:[.19444,.69444,0,0,.61111],8658:[-.13313,.36687,0,0,1],8659:[.19444,.69444,0,0,.61111],8660:[-.13313,.36687,0,0,1],8661:[.25,.75,0,0,.61111],8704:[0,.69444,0,0,.55556],8706:[0,.69444,.05556,.08334,.5309],8707:[0,.69444,0,0,.55556],8709:[.05556,.75,0,0,.5],8711:[0,.68333,0,0,.83334],8712:[.0391,.5391,0,0,.66667],8715:[.0391,.5391,0,0,.66667],8722:[.08333,.58333,0,0,.77778],8723:[.08333,.58333,0,0,.77778],8725:[.25,.75,0,0,.5],8726:[.25,.75,0,0,.5],8727:[-.03472,.46528,0,0,.5],8728:[-.05555,.44445,0,0,.5],8729:[-.05555,.44445,0,0,.5],8730:[.2,.8,0,0,.83334],8733:[0,.43056,0,0,.77778],8734:[0,.43056,0,0,1],8736:[0,.69224,0,0,.72222],8739:[.25,.75,0,0,.27778],8741:[.25,.75,0,0,.5],8743:[0,.55556,0,0,.66667],8744:[0,.55556,0,0,.66667],8745:[0,.55556,0,0,.66667],8746:[0,.55556,0,0,.66667],8747:[.19444,.69444,.11111,0,.41667],8764:[-.13313,.36687,0,0,.77778],8768:[.19444,.69444,0,0,.27778],8771:[-.03625,.46375,0,0,.77778],8773:[-.022,.589,0,0,.778],8776:[-.01688,.48312,0,0,.77778],8781:[-.03625,.46375,0,0,.77778],8784:[-.133,.673,0,0,.778],8801:[-.03625,.46375,0,0,.77778],8804:[.13597,.63597,0,0,.77778],8805:[.13597,.63597,0,0,.77778],8810:[.0391,.5391,0,0,1],8811:[.0391,.5391,0,0,1],8826:[.0391,.5391,0,0,.77778],8827:[.0391,.5391,0,0,.77778],8834:[.0391,.5391,0,0,.77778],8835:[.0391,.5391,0,0,.77778],8838:[.13597,.63597,0,0,.77778],8839:[.13597,.63597,0,0,.77778],8846:[0,.55556,0,0,.66667],8849:[.13597,.63597,0,0,.77778],8850:[.13597,.63597,0,0,.77778],8851:[0,.55556,0,0,.66667],8852:[0,.55556,0,0,.66667],8853:[.08333,.58333,0,0,.77778],8854:[.08333,.58333,0,0,.77778],8855:[.08333,.58333,0,0,.77778],8856:[.08333,.58333,0,0,.77778],8857:[.08333,.58333,0,0,.77778],8866:[0,.69444,0,0,.61111],8867:[0,.69444,0,0,.61111],8868:[0,.69444,0,0,.77778],8869:[0,.69444,0,0,.77778],8872:[.249,.75,0,0,.867],8900:[-.05555,.44445,0,0,.5],8901:[-.05555,.44445,0,0,.27778],8902:[-.03472,.46528,0,0,.5],8904:[.005,.505,0,0,.9],8942:[.03,.903,0,0,.278],8943:[-.19,.313,0,0,1.172],8945:[-.1,.823,0,0,1.282],8968:[.25,.75,0,0,.44445],8969:[.25,.75,0,0,.44445],8970:[.25,.75,0,0,.44445],8971:[.25,.75,0,0,.44445],8994:[-.14236,.35764,0,0,1],8995:[-.14236,.35764,0,0,1],9136:[.244,.744,0,0,.412],9137:[.244,.745,0,0,.412],9651:[.19444,.69444,0,0,.88889],9657:[-.03472,.46528,0,0,.5],9661:[.19444,.69444,0,0,.88889],9667:[-.03472,.46528,0,0,.5],9711:[.19444,.69444,0,0,1],9824:[.12963,.69444,0,0,.77778],9825:[.12963,.69444,0,0,.77778],9826:[.12963,.69444,0,0,.77778],9827:[.12963,.69444,0,0,.77778],9837:[0,.75,0,0,.38889],9838:[.19444,.69444,0,0,.38889],9839:[.19444,.69444,0,0,.38889],10216:[.25,.75,0,0,.38889],10217:[.25,.75,0,0,.38889],10222:[.244,.744,0,0,.412],10223:[.244,.745,0,0,.412],10229:[.011,.511,0,0,1.609],10230:[.011,.511,0,0,1.638],10231:[.011,.511,0,0,1.859],10232:[.024,.525,0,0,1.609],10233:[.024,.525,0,0,1.638],10234:[.024,.525,0,0,1.858],10236:[.011,.511,0,0,1.638],10815:[0,.68333,0,0,.75],10927:[.13597,.63597,0,0,.77778],10928:[.13597,.63597,0,0,.77778],57376:[.19444,.69444,0,0,0]},"Math-BoldItalic":{32:[0,0,0,0,.25],48:[0,.44444,0,0,.575],49:[0,.44444,0,0,.575],50:[0,.44444,0,0,.575],51:[.19444,.44444,0,0,.575],52:[.19444,.44444,0,0,.575],53:[.19444,.44444,0,0,.575],54:[0,.64444,0,0,.575],55:[.19444,.44444,0,0,.575],56:[0,.64444,0,0,.575],57:[.19444,.44444,0,0,.575],65:[0,.68611,0,0,.86944],66:[0,.68611,.04835,0,.8664],67:[0,.68611,.06979,0,.81694],68:[0,.68611,.03194,0,.93812],69:[0,.68611,.05451,0,.81007],70:[0,.68611,.15972,0,.68889],71:[0,.68611,0,0,.88673],72:[0,.68611,.08229,0,.98229],73:[0,.68611,.07778,0,.51111],74:[0,.68611,.10069,0,.63125],75:[0,.68611,.06979,0,.97118],76:[0,.68611,0,0,.75555],77:[0,.68611,.11424,0,1.14201],78:[0,.68611,.11424,0,.95034],79:[0,.68611,.03194,0,.83666],80:[0,.68611,.15972,0,.72309],81:[.19444,.68611,0,0,.86861],82:[0,.68611,.00421,0,.87235],83:[0,.68611,.05382,0,.69271],84:[0,.68611,.15972,0,.63663],85:[0,.68611,.11424,0,.80027],86:[0,.68611,.25555,0,.67778],87:[0,.68611,.15972,0,1.09305],88:[0,.68611,.07778,0,.94722],89:[0,.68611,.25555,0,.67458],90:[0,.68611,.06979,0,.77257],97:[0,.44444,0,0,.63287],98:[0,.69444,0,0,.52083],99:[0,.44444,0,0,.51342],100:[0,.69444,0,0,.60972],101:[0,.44444,0,0,.55361],102:[.19444,.69444,.11042,0,.56806],103:[.19444,.44444,.03704,0,.5449],104:[0,.69444,0,0,.66759],105:[0,.69326,0,0,.4048],106:[.19444,.69326,.0622,0,.47083],107:[0,.69444,.01852,0,.6037],108:[0,.69444,.0088,0,.34815],109:[0,.44444,0,0,1.0324],110:[0,.44444,0,0,.71296],111:[0,.44444,0,0,.58472],112:[.19444,.44444,0,0,.60092],113:[.19444,.44444,.03704,0,.54213],114:[0,.44444,.03194,0,.5287],115:[0,.44444,0,0,.53125],116:[0,.63492,0,0,.41528],117:[0,.44444,0,0,.68102],118:[0,.44444,.03704,0,.56666],119:[0,.44444,.02778,0,.83148],120:[0,.44444,0,0,.65903],121:[.19444,.44444,.03704,0,.59028],122:[0,.44444,.04213,0,.55509],160:[0,0,0,0,.25],915:[0,.68611,.15972,0,.65694],916:[0,.68611,0,0,.95833],920:[0,.68611,.03194,0,.86722],923:[0,.68611,0,0,.80555],926:[0,.68611,.07458,0,.84125],928:[0,.68611,.08229,0,.98229],931:[0,.68611,.05451,0,.88507],933:[0,.68611,.15972,0,.67083],934:[0,.68611,0,0,.76666],936:[0,.68611,.11653,0,.71402],937:[0,.68611,.04835,0,.8789],945:[0,.44444,0,0,.76064],946:[.19444,.69444,.03403,0,.65972],947:[.19444,.44444,.06389,0,.59003],948:[0,.69444,.03819,0,.52222],949:[0,.44444,0,0,.52882],950:[.19444,.69444,.06215,0,.50833],951:[.19444,.44444,.03704,0,.6],952:[0,.69444,.03194,0,.5618],953:[0,.44444,0,0,.41204],954:[0,.44444,0,0,.66759],955:[0,.69444,0,0,.67083],956:[.19444,.44444,0,0,.70787],957:[0,.44444,.06898,0,.57685],958:[.19444,.69444,.03021,0,.50833],959:[0,.44444,0,0,.58472],960:[0,.44444,.03704,0,.68241],961:[.19444,.44444,0,0,.6118],962:[.09722,.44444,.07917,0,.42361],963:[0,.44444,.03704,0,.68588],964:[0,.44444,.13472,0,.52083],965:[0,.44444,.03704,0,.63055],966:[.19444,.44444,0,0,.74722],967:[.19444,.44444,0,0,.71805],968:[.19444,.69444,.03704,0,.75833],969:[0,.44444,.03704,0,.71782],977:[0,.69444,0,0,.69155],981:[.19444,.69444,0,0,.7125],982:[0,.44444,.03194,0,.975],1009:[.19444,.44444,0,0,.6118],1013:[0,.44444,0,0,.48333],57649:[0,.44444,0,0,.39352],57911:[.19444,.44444,0,0,.43889]},"Math-Italic":{32:[0,0,0,0,.25],48:[0,.43056,0,0,.5],49:[0,.43056,0,0,.5],50:[0,.43056,0,0,.5],51:[.19444,.43056,0,0,.5],52:[.19444,.43056,0,0,.5],53:[.19444,.43056,0,0,.5],54:[0,.64444,0,0,.5],55:[.19444,.43056,0,0,.5],56:[0,.64444,0,0,.5],57:[.19444,.43056,0,0,.5],65:[0,.68333,0,.13889,.75],66:[0,.68333,.05017,.08334,.75851],67:[0,.68333,.07153,.08334,.71472],68:[0,.68333,.02778,.05556,.82792],69:[0,.68333,.05764,.08334,.7382],70:[0,.68333,.13889,.08334,.64306],71:[0,.68333,0,.08334,.78625],72:[0,.68333,.08125,.05556,.83125],73:[0,.68333,.07847,.11111,.43958],74:[0,.68333,.09618,.16667,.55451],75:[0,.68333,.07153,.05556,.84931],76:[0,.68333,0,.02778,.68056],77:[0,.68333,.10903,.08334,.97014],78:[0,.68333,.10903,.08334,.80347],79:[0,.68333,.02778,.08334,.76278],80:[0,.68333,.13889,.08334,.64201],81:[.19444,.68333,0,.08334,.79056],82:[0,.68333,.00773,.08334,.75929],83:[0,.68333,.05764,.08334,.6132],84:[0,.68333,.13889,.08334,.58438],85:[0,.68333,.10903,.02778,.68278],86:[0,.68333,.22222,0,.58333],87:[0,.68333,.13889,0,.94445],88:[0,.68333,.07847,.08334,.82847],89:[0,.68333,.22222,0,.58056],90:[0,.68333,.07153,.08334,.68264],97:[0,.43056,0,0,.52859],98:[0,.69444,0,0,.42917],99:[0,.43056,0,.05556,.43276],100:[0,.69444,0,.16667,.52049],101:[0,.43056,0,.05556,.46563],102:[.19444,.69444,.10764,.16667,.48959],103:[.19444,.43056,.03588,.02778,.47697],104:[0,.69444,0,0,.57616],105:[0,.65952,0,0,.34451],106:[.19444,.65952,.05724,0,.41181],107:[0,.69444,.03148,0,.5206],108:[0,.69444,.01968,.08334,.29838],109:[0,.43056,0,0,.87801],110:[0,.43056,0,0,.60023],111:[0,.43056,0,.05556,.48472],112:[.19444,.43056,0,.08334,.50313],113:[.19444,.43056,.03588,.08334,.44641],114:[0,.43056,.02778,.05556,.45116],115:[0,.43056,0,.05556,.46875],116:[0,.61508,0,.08334,.36111],117:[0,.43056,0,.02778,.57246],118:[0,.43056,.03588,.02778,.48472],119:[0,.43056,.02691,.08334,.71592],120:[0,.43056,0,.02778,.57153],121:[.19444,.43056,.03588,.05556,.49028],122:[0,.43056,.04398,.05556,.46505],160:[0,0,0,0,.25],915:[0,.68333,.13889,.08334,.61528],916:[0,.68333,0,.16667,.83334],920:[0,.68333,.02778,.08334,.76278],923:[0,.68333,0,.16667,.69445],926:[0,.68333,.07569,.08334,.74236],928:[0,.68333,.08125,.05556,.83125],931:[0,.68333,.05764,.08334,.77986],933:[0,.68333,.13889,.05556,.58333],934:[0,.68333,0,.08334,.66667],936:[0,.68333,.11,.05556,.61222],937:[0,.68333,.05017,.08334,.7724],945:[0,.43056,.0037,.02778,.6397],946:[.19444,.69444,.05278,.08334,.56563],947:[.19444,.43056,.05556,0,.51773],948:[0,.69444,.03785,.05556,.44444],949:[0,.43056,0,.08334,.46632],950:[.19444,.69444,.07378,.08334,.4375],951:[.19444,.43056,.03588,.05556,.49653],952:[0,.69444,.02778,.08334,.46944],953:[0,.43056,0,.05556,.35394],954:[0,.43056,0,0,.57616],955:[0,.69444,0,0,.58334],956:[.19444,.43056,0,.02778,.60255],957:[0,.43056,.06366,.02778,.49398],958:[.19444,.69444,.04601,.11111,.4375],959:[0,.43056,0,.05556,.48472],960:[0,.43056,.03588,0,.57003],961:[.19444,.43056,0,.08334,.51702],962:[.09722,.43056,.07986,.08334,.36285],963:[0,.43056,.03588,0,.57141],964:[0,.43056,.1132,.02778,.43715],965:[0,.43056,.03588,.02778,.54028],966:[.19444,.43056,0,.08334,.65417],967:[.19444,.43056,0,.05556,.62569],968:[.19444,.69444,.03588,.11111,.65139],969:[0,.43056,.03588,0,.62245],977:[0,.69444,0,.08334,.59144],981:[.19444,.69444,0,.08334,.59583],982:[0,.43056,.02778,0,.82813],1009:[.19444,.43056,0,.08334,.51702],1013:[0,.43056,0,.05556,.4059],57649:[0,.43056,0,.02778,.32246],57911:[.19444,.43056,0,.08334,.38403]},"SansSerif-Bold":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.36667],34:[0,.69444,0,0,.55834],35:[.19444,.69444,0,0,.91667],36:[.05556,.75,0,0,.55],37:[.05556,.75,0,0,1.02912],38:[0,.69444,0,0,.83056],39:[0,.69444,0,0,.30556],40:[.25,.75,0,0,.42778],41:[.25,.75,0,0,.42778],42:[0,.75,0,0,.55],43:[.11667,.61667,0,0,.85556],44:[.10556,.13056,0,0,.30556],45:[0,.45833,0,0,.36667],46:[0,.13056,0,0,.30556],47:[.25,.75,0,0,.55],48:[0,.69444,0,0,.55],49:[0,.69444,0,0,.55],50:[0,.69444,0,0,.55],51:[0,.69444,0,0,.55],52:[0,.69444,0,0,.55],53:[0,.69444,0,0,.55],54:[0,.69444,0,0,.55],55:[0,.69444,0,0,.55],56:[0,.69444,0,0,.55],57:[0,.69444,0,0,.55],58:[0,.45833,0,0,.30556],59:[.10556,.45833,0,0,.30556],61:[-.09375,.40625,0,0,.85556],63:[0,.69444,0,0,.51945],64:[0,.69444,0,0,.73334],65:[0,.69444,0,0,.73334],66:[0,.69444,0,0,.73334],67:[0,.69444,0,0,.70278],68:[0,.69444,0,0,.79445],69:[0,.69444,0,0,.64167],70:[0,.69444,0,0,.61111],71:[0,.69444,0,0,.73334],72:[0,.69444,0,0,.79445],73:[0,.69444,0,0,.33056],74:[0,.69444,0,0,.51945],75:[0,.69444,0,0,.76389],76:[0,.69444,0,0,.58056],77:[0,.69444,0,0,.97778],78:[0,.69444,0,0,.79445],79:[0,.69444,0,0,.79445],80:[0,.69444,0,0,.70278],81:[.10556,.69444,0,0,.79445],82:[0,.69444,0,0,.70278],83:[0,.69444,0,0,.61111],84:[0,.69444,0,0,.73334],85:[0,.69444,0,0,.76389],86:[0,.69444,.01528,0,.73334],87:[0,.69444,.01528,0,1.03889],88:[0,.69444,0,0,.73334],89:[0,.69444,.0275,0,.73334],90:[0,.69444,0,0,.67223],91:[.25,.75,0,0,.34306],93:[.25,.75,0,0,.34306],94:[0,.69444,0,0,.55],95:[.35,.10833,.03056,0,.55],97:[0,.45833,0,0,.525],98:[0,.69444,0,0,.56111],99:[0,.45833,0,0,.48889],100:[0,.69444,0,0,.56111],101:[0,.45833,0,0,.51111],102:[0,.69444,.07639,0,.33611],103:[.19444,.45833,.01528,0,.55],104:[0,.69444,0,0,.56111],105:[0,.69444,0,0,.25556],106:[.19444,.69444,0,0,.28611],107:[0,.69444,0,0,.53056],108:[0,.69444,0,0,.25556],109:[0,.45833,0,0,.86667],110:[0,.45833,0,0,.56111],111:[0,.45833,0,0,.55],112:[.19444,.45833,0,0,.56111],113:[.19444,.45833,0,0,.56111],114:[0,.45833,.01528,0,.37222],115:[0,.45833,0,0,.42167],116:[0,.58929,0,0,.40417],117:[0,.45833,0,0,.56111],118:[0,.45833,.01528,0,.5],119:[0,.45833,.01528,0,.74445],120:[0,.45833,0,0,.5],121:[.19444,.45833,.01528,0,.5],122:[0,.45833,0,0,.47639],126:[.35,.34444,0,0,.55],160:[0,0,0,0,.25],168:[0,.69444,0,0,.55],176:[0,.69444,0,0,.73334],180:[0,.69444,0,0,.55],184:[.17014,0,0,0,.48889],305:[0,.45833,0,0,.25556],567:[.19444,.45833,0,0,.28611],710:[0,.69444,0,0,.55],711:[0,.63542,0,0,.55],713:[0,.63778,0,0,.55],728:[0,.69444,0,0,.55],729:[0,.69444,0,0,.30556],730:[0,.69444,0,0,.73334],732:[0,.69444,0,0,.55],733:[0,.69444,0,0,.55],915:[0,.69444,0,0,.58056],916:[0,.69444,0,0,.91667],920:[0,.69444,0,0,.85556],923:[0,.69444,0,0,.67223],926:[0,.69444,0,0,.73334],928:[0,.69444,0,0,.79445],931:[0,.69444,0,0,.79445],933:[0,.69444,0,0,.85556],934:[0,.69444,0,0,.79445],936:[0,.69444,0,0,.85556],937:[0,.69444,0,0,.79445],8211:[0,.45833,.03056,0,.55],8212:[0,.45833,.03056,0,1.10001],8216:[0,.69444,0,0,.30556],8217:[0,.69444,0,0,.30556],8220:[0,.69444,0,0,.55834],8221:[0,.69444,0,0,.55834]},"SansSerif-Italic":{32:[0,0,0,0,.25],33:[0,.69444,.05733,0,.31945],34:[0,.69444,.00316,0,.5],35:[.19444,.69444,.05087,0,.83334],36:[.05556,.75,.11156,0,.5],37:[.05556,.75,.03126,0,.83334],38:[0,.69444,.03058,0,.75834],39:[0,.69444,.07816,0,.27778],40:[.25,.75,.13164,0,.38889],41:[.25,.75,.02536,0,.38889],42:[0,.75,.11775,0,.5],43:[.08333,.58333,.02536,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,.01946,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,.13164,0,.5],48:[0,.65556,.11156,0,.5],49:[0,.65556,.11156,0,.5],50:[0,.65556,.11156,0,.5],51:[0,.65556,.11156,0,.5],52:[0,.65556,.11156,0,.5],53:[0,.65556,.11156,0,.5],54:[0,.65556,.11156,0,.5],55:[0,.65556,.11156,0,.5],56:[0,.65556,.11156,0,.5],57:[0,.65556,.11156,0,.5],58:[0,.44444,.02502,0,.27778],59:[.125,.44444,.02502,0,.27778],61:[-.13,.37,.05087,0,.77778],63:[0,.69444,.11809,0,.47222],64:[0,.69444,.07555,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,.08293,0,.66667],67:[0,.69444,.11983,0,.63889],68:[0,.69444,.07555,0,.72223],69:[0,.69444,.11983,0,.59722],70:[0,.69444,.13372,0,.56945],71:[0,.69444,.11983,0,.66667],72:[0,.69444,.08094,0,.70834],73:[0,.69444,.13372,0,.27778],74:[0,.69444,.08094,0,.47222],75:[0,.69444,.11983,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,.08094,0,.875],78:[0,.69444,.08094,0,.70834],79:[0,.69444,.07555,0,.73611],80:[0,.69444,.08293,0,.63889],81:[.125,.69444,.07555,0,.73611],82:[0,.69444,.08293,0,.64584],83:[0,.69444,.09205,0,.55556],84:[0,.69444,.13372,0,.68056],85:[0,.69444,.08094,0,.6875],86:[0,.69444,.1615,0,.66667],87:[0,.69444,.1615,0,.94445],88:[0,.69444,.13372,0,.66667],89:[0,.69444,.17261,0,.66667],90:[0,.69444,.11983,0,.61111],91:[.25,.75,.15942,0,.28889],93:[.25,.75,.08719,0,.28889],94:[0,.69444,.0799,0,.5],95:[.35,.09444,.08616,0,.5],97:[0,.44444,.00981,0,.48056],98:[0,.69444,.03057,0,.51667],99:[0,.44444,.08336,0,.44445],100:[0,.69444,.09483,0,.51667],101:[0,.44444,.06778,0,.44445],102:[0,.69444,.21705,0,.30556],103:[.19444,.44444,.10836,0,.5],104:[0,.69444,.01778,0,.51667],105:[0,.67937,.09718,0,.23889],106:[.19444,.67937,.09162,0,.26667],107:[0,.69444,.08336,0,.48889],108:[0,.69444,.09483,0,.23889],109:[0,.44444,.01778,0,.79445],110:[0,.44444,.01778,0,.51667],111:[0,.44444,.06613,0,.5],112:[.19444,.44444,.0389,0,.51667],113:[.19444,.44444,.04169,0,.51667],114:[0,.44444,.10836,0,.34167],115:[0,.44444,.0778,0,.38333],116:[0,.57143,.07225,0,.36111],117:[0,.44444,.04169,0,.51667],118:[0,.44444,.10836,0,.46111],119:[0,.44444,.10836,0,.68334],120:[0,.44444,.09169,0,.46111],121:[.19444,.44444,.10836,0,.46111],122:[0,.44444,.08752,0,.43472],126:[.35,.32659,.08826,0,.5],160:[0,0,0,0,.25],168:[0,.67937,.06385,0,.5],176:[0,.69444,0,0,.73752],184:[.17014,0,0,0,.44445],305:[0,.44444,.04169,0,.23889],567:[.19444,.44444,.04169,0,.26667],710:[0,.69444,.0799,0,.5],711:[0,.63194,.08432,0,.5],713:[0,.60889,.08776,0,.5],714:[0,.69444,.09205,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,.09483,0,.5],729:[0,.67937,.07774,0,.27778],730:[0,.69444,0,0,.73752],732:[0,.67659,.08826,0,.5],733:[0,.69444,.09205,0,.5],915:[0,.69444,.13372,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,.07555,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,.12816,0,.66667],928:[0,.69444,.08094,0,.70834],931:[0,.69444,.11983,0,.72222],933:[0,.69444,.09031,0,.77778],934:[0,.69444,.04603,0,.72222],936:[0,.69444,.09031,0,.77778],937:[0,.69444,.08293,0,.72222],8211:[0,.44444,.08616,0,.5],8212:[0,.44444,.08616,0,1],8216:[0,.69444,.07816,0,.27778],8217:[0,.69444,.07816,0,.27778],8220:[0,.69444,.14205,0,.5],8221:[0,.69444,.00316,0,.5]},"SansSerif-Regular":{32:[0,0,0,0,.25],33:[0,.69444,0,0,.31945],34:[0,.69444,0,0,.5],35:[.19444,.69444,0,0,.83334],36:[.05556,.75,0,0,.5],37:[.05556,.75,0,0,.83334],38:[0,.69444,0,0,.75834],39:[0,.69444,0,0,.27778],40:[.25,.75,0,0,.38889],41:[.25,.75,0,0,.38889],42:[0,.75,0,0,.5],43:[.08333,.58333,0,0,.77778],44:[.125,.08333,0,0,.27778],45:[0,.44444,0,0,.33333],46:[0,.08333,0,0,.27778],47:[.25,.75,0,0,.5],48:[0,.65556,0,0,.5],49:[0,.65556,0,0,.5],50:[0,.65556,0,0,.5],51:[0,.65556,0,0,.5],52:[0,.65556,0,0,.5],53:[0,.65556,0,0,.5],54:[0,.65556,0,0,.5],55:[0,.65556,0,0,.5],56:[0,.65556,0,0,.5],57:[0,.65556,0,0,.5],58:[0,.44444,0,0,.27778],59:[.125,.44444,0,0,.27778],61:[-.13,.37,0,0,.77778],63:[0,.69444,0,0,.47222],64:[0,.69444,0,0,.66667],65:[0,.69444,0,0,.66667],66:[0,.69444,0,0,.66667],67:[0,.69444,0,0,.63889],68:[0,.69444,0,0,.72223],69:[0,.69444,0,0,.59722],70:[0,.69444,0,0,.56945],71:[0,.69444,0,0,.66667],72:[0,.69444,0,0,.70834],73:[0,.69444,0,0,.27778],74:[0,.69444,0,0,.47222],75:[0,.69444,0,0,.69445],76:[0,.69444,0,0,.54167],77:[0,.69444,0,0,.875],78:[0,.69444,0,0,.70834],79:[0,.69444,0,0,.73611],80:[0,.69444,0,0,.63889],81:[.125,.69444,0,0,.73611],82:[0,.69444,0,0,.64584],83:[0,.69444,0,0,.55556],84:[0,.69444,0,0,.68056],85:[0,.69444,0,0,.6875],86:[0,.69444,.01389,0,.66667],87:[0,.69444,.01389,0,.94445],88:[0,.69444,0,0,.66667],89:[0,.69444,.025,0,.66667],90:[0,.69444,0,0,.61111],91:[.25,.75,0,0,.28889],93:[.25,.75,0,0,.28889],94:[0,.69444,0,0,.5],95:[.35,.09444,.02778,0,.5],97:[0,.44444,0,0,.48056],98:[0,.69444,0,0,.51667],99:[0,.44444,0,0,.44445],100:[0,.69444,0,0,.51667],101:[0,.44444,0,0,.44445],102:[0,.69444,.06944,0,.30556],103:[.19444,.44444,.01389,0,.5],104:[0,.69444,0,0,.51667],105:[0,.67937,0,0,.23889],106:[.19444,.67937,0,0,.26667],107:[0,.69444,0,0,.48889],108:[0,.69444,0,0,.23889],109:[0,.44444,0,0,.79445],110:[0,.44444,0,0,.51667],111:[0,.44444,0,0,.5],112:[.19444,.44444,0,0,.51667],113:[.19444,.44444,0,0,.51667],114:[0,.44444,.01389,0,.34167],115:[0,.44444,0,0,.38333],116:[0,.57143,0,0,.36111],117:[0,.44444,0,0,.51667],118:[0,.44444,.01389,0,.46111],119:[0,.44444,.01389,0,.68334],120:[0,.44444,0,0,.46111],121:[.19444,.44444,.01389,0,.46111],122:[0,.44444,0,0,.43472],126:[.35,.32659,0,0,.5],160:[0,0,0,0,.25],168:[0,.67937,0,0,.5],176:[0,.69444,0,0,.66667],184:[.17014,0,0,0,.44445],305:[0,.44444,0,0,.23889],567:[.19444,.44444,0,0,.26667],710:[0,.69444,0,0,.5],711:[0,.63194,0,0,.5],713:[0,.60889,0,0,.5],714:[0,.69444,0,0,.5],715:[0,.69444,0,0,.5],728:[0,.69444,0,0,.5],729:[0,.67937,0,0,.27778],730:[0,.69444,0,0,.66667],732:[0,.67659,0,0,.5],733:[0,.69444,0,0,.5],915:[0,.69444,0,0,.54167],916:[0,.69444,0,0,.83334],920:[0,.69444,0,0,.77778],923:[0,.69444,0,0,.61111],926:[0,.69444,0,0,.66667],928:[0,.69444,0,0,.70834],931:[0,.69444,0,0,.72222],933:[0,.69444,0,0,.77778],934:[0,.69444,0,0,.72222],936:[0,.69444,0,0,.77778],937:[0,.69444,0,0,.72222],8211:[0,.44444,.02778,0,.5],8212:[0,.44444,.02778,0,1],8216:[0,.69444,0,0,.27778],8217:[0,.69444,0,0,.27778],8220:[0,.69444,0,0,.5],8221:[0,.69444,0,0,.5]},"Script-Regular":{32:[0,0,0,0,.25],65:[0,.7,.22925,0,.80253],66:[0,.7,.04087,0,.90757],67:[0,.7,.1689,0,.66619],68:[0,.7,.09371,0,.77443],69:[0,.7,.18583,0,.56162],70:[0,.7,.13634,0,.89544],71:[0,.7,.17322,0,.60961],72:[0,.7,.29694,0,.96919],73:[0,.7,.19189,0,.80907],74:[.27778,.7,.19189,0,1.05159],75:[0,.7,.31259,0,.91364],76:[0,.7,.19189,0,.87373],77:[0,.7,.15981,0,1.08031],78:[0,.7,.3525,0,.9015],79:[0,.7,.08078,0,.73787],80:[0,.7,.08078,0,1.01262],81:[0,.7,.03305,0,.88282],82:[0,.7,.06259,0,.85],83:[0,.7,.19189,0,.86767],84:[0,.7,.29087,0,.74697],85:[0,.7,.25815,0,.79996],86:[0,.7,.27523,0,.62204],87:[0,.7,.27523,0,.80532],88:[0,.7,.26006,0,.94445],89:[0,.7,.2939,0,.70961],90:[0,.7,.24037,0,.8212],160:[0,0,0,0,.25]},"Size1-Regular":{32:[0,0,0,0,.25],40:[.35001,.85,0,0,.45834],41:[.35001,.85,0,0,.45834],47:[.35001,.85,0,0,.57778],91:[.35001,.85,0,0,.41667],92:[.35001,.85,0,0,.57778],93:[.35001,.85,0,0,.41667],123:[.35001,.85,0,0,.58334],125:[.35001,.85,0,0,.58334],160:[0,0,0,0,.25],710:[0,.72222,0,0,.55556],732:[0,.72222,0,0,.55556],770:[0,.72222,0,0,.55556],771:[0,.72222,0,0,.55556],8214:[-99e-5,.601,0,0,.77778],8593:[1e-5,.6,0,0,.66667],8595:[1e-5,.6,0,0,.66667],8657:[1e-5,.6,0,0,.77778],8659:[1e-5,.6,0,0,.77778],8719:[.25001,.75,0,0,.94445],8720:[.25001,.75,0,0,.94445],8721:[.25001,.75,0,0,1.05556],8730:[.35001,.85,0,0,1],8739:[-.00599,.606,0,0,.33333],8741:[-.00599,.606,0,0,.55556],8747:[.30612,.805,.19445,0,.47222],8748:[.306,.805,.19445,0,.47222],8749:[.306,.805,.19445,0,.47222],8750:[.30612,.805,.19445,0,.47222],8896:[.25001,.75,0,0,.83334],8897:[.25001,.75,0,0,.83334],8898:[.25001,.75,0,0,.83334],8899:[.25001,.75,0,0,.83334],8968:[.35001,.85,0,0,.47222],8969:[.35001,.85,0,0,.47222],8970:[.35001,.85,0,0,.47222],8971:[.35001,.85,0,0,.47222],9168:[-99e-5,.601,0,0,.66667],10216:[.35001,.85,0,0,.47222],10217:[.35001,.85,0,0,.47222],10752:[.25001,.75,0,0,1.11111],10753:[.25001,.75,0,0,1.11111],10754:[.25001,.75,0,0,1.11111],10756:[.25001,.75,0,0,.83334],10758:[.25001,.75,0,0,.83334]},"Size2-Regular":{32:[0,0,0,0,.25],40:[.65002,1.15,0,0,.59722],41:[.65002,1.15,0,0,.59722],47:[.65002,1.15,0,0,.81111],91:[.65002,1.15,0,0,.47222],92:[.65002,1.15,0,0,.81111],93:[.65002,1.15,0,0,.47222],123:[.65002,1.15,0,0,.66667],125:[.65002,1.15,0,0,.66667],160:[0,0,0,0,.25],710:[0,.75,0,0,1],732:[0,.75,0,0,1],770:[0,.75,0,0,1],771:[0,.75,0,0,1],8719:[.55001,1.05,0,0,1.27778],8720:[.55001,1.05,0,0,1.27778],8721:[.55001,1.05,0,0,1.44445],8730:[.65002,1.15,0,0,1],8747:[.86225,1.36,.44445,0,.55556],8748:[.862,1.36,.44445,0,.55556],8749:[.862,1.36,.44445,0,.55556],8750:[.86225,1.36,.44445,0,.55556],8896:[.55001,1.05,0,0,1.11111],8897:[.55001,1.05,0,0,1.11111],8898:[.55001,1.05,0,0,1.11111],8899:[.55001,1.05,0,0,1.11111],8968:[.65002,1.15,0,0,.52778],8969:[.65002,1.15,0,0,.52778],8970:[.65002,1.15,0,0,.52778],8971:[.65002,1.15,0,0,.52778],10216:[.65002,1.15,0,0,.61111],10217:[.65002,1.15,0,0,.61111],10752:[.55001,1.05,0,0,1.51112],10753:[.55001,1.05,0,0,1.51112],10754:[.55001,1.05,0,0,1.51112],10756:[.55001,1.05,0,0,1.11111],10758:[.55001,1.05,0,0,1.11111]},"Size3-Regular":{32:[0,0,0,0,.25],40:[.95003,1.45,0,0,.73611],41:[.95003,1.45,0,0,.73611],47:[.95003,1.45,0,0,1.04445],91:[.95003,1.45,0,0,.52778],92:[.95003,1.45,0,0,1.04445],93:[.95003,1.45,0,0,.52778],123:[.95003,1.45,0,0,.75],125:[.95003,1.45,0,0,.75],160:[0,0,0,0,.25],710:[0,.75,0,0,1.44445],732:[0,.75,0,0,1.44445],770:[0,.75,0,0,1.44445],771:[0,.75,0,0,1.44445],8730:[.95003,1.45,0,0,1],8968:[.95003,1.45,0,0,.58334],8969:[.95003,1.45,0,0,.58334],8970:[.95003,1.45,0,0,.58334],8971:[.95003,1.45,0,0,.58334],10216:[.95003,1.45,0,0,.75],10217:[.95003,1.45,0,0,.75]},"Size4-Regular":{32:[0,0,0,0,.25],40:[1.25003,1.75,0,0,.79167],41:[1.25003,1.75,0,0,.79167],47:[1.25003,1.75,0,0,1.27778],91:[1.25003,1.75,0,0,.58334],92:[1.25003,1.75,0,0,1.27778],93:[1.25003,1.75,0,0,.58334],123:[1.25003,1.75,0,0,.80556],125:[1.25003,1.75,0,0,.80556],160:[0,0,0,0,.25],710:[0,.825,0,0,1.8889],732:[0,.825,0,0,1.8889],770:[0,.825,0,0,1.8889],771:[0,.825,0,0,1.8889],8730:[1.25003,1.75,0,0,1],8968:[1.25003,1.75,0,0,.63889],8969:[1.25003,1.75,0,0,.63889],8970:[1.25003,1.75,0,0,.63889],8971:[1.25003,1.75,0,0,.63889],9115:[.64502,1.155,0,0,.875],9116:[1e-5,.6,0,0,.875],9117:[.64502,1.155,0,0,.875],9118:[.64502,1.155,0,0,.875],9119:[1e-5,.6,0,0,.875],9120:[.64502,1.155,0,0,.875],9121:[.64502,1.155,0,0,.66667],9122:[-99e-5,.601,0,0,.66667],9123:[.64502,1.155,0,0,.66667],9124:[.64502,1.155,0,0,.66667],9125:[-99e-5,.601,0,0,.66667],9126:[.64502,1.155,0,0,.66667],9127:[1e-5,.9,0,0,.88889],9128:[.65002,1.15,0,0,.88889],9129:[.90001,0,0,0,.88889],9130:[0,.3,0,0,.88889],9131:[1e-5,.9,0,0,.88889],9132:[.65002,1.15,0,0,.88889],9133:[.90001,0,0,0,.88889],9143:[.88502,.915,0,0,1.05556],10216:[1.25003,1.75,0,0,.80556],10217:[1.25003,1.75,0,0,.80556],57344:[-.00499,.605,0,0,1.05556],57345:[-.00499,.605,0,0,1.05556],57680:[0,.12,0,0,.45],57681:[0,.12,0,0,.45],57682:[0,.12,0,0,.45],57683:[0,.12,0,0,.45]},"Typewriter-Regular":{32:[0,0,0,0,.525],33:[0,.61111,0,0,.525],34:[0,.61111,0,0,.525],35:[0,.61111,0,0,.525],36:[.08333,.69444,0,0,.525],37:[.08333,.69444,0,0,.525],38:[0,.61111,0,0,.525],39:[0,.61111,0,0,.525],40:[.08333,.69444,0,0,.525],41:[.08333,.69444,0,0,.525],42:[0,.52083,0,0,.525],43:[-.08056,.53055,0,0,.525],44:[.13889,.125,0,0,.525],45:[-.08056,.53055,0,0,.525],46:[0,.125,0,0,.525],47:[.08333,.69444,0,0,.525],48:[0,.61111,0,0,.525],49:[0,.61111,0,0,.525],50:[0,.61111,0,0,.525],51:[0,.61111,0,0,.525],52:[0,.61111,0,0,.525],53:[0,.61111,0,0,.525],54:[0,.61111,0,0,.525],55:[0,.61111,0,0,.525],56:[0,.61111,0,0,.525],57:[0,.61111,0,0,.525],58:[0,.43056,0,0,.525],59:[.13889,.43056,0,0,.525],60:[-.05556,.55556,0,0,.525],61:[-.19549,.41562,0,0,.525],62:[-.05556,.55556,0,0,.525],63:[0,.61111,0,0,.525],64:[0,.61111,0,0,.525],65:[0,.61111,0,0,.525],66:[0,.61111,0,0,.525],67:[0,.61111,0,0,.525],68:[0,.61111,0,0,.525],69:[0,.61111,0,0,.525],70:[0,.61111,0,0,.525],71:[0,.61111,0,0,.525],72:[0,.61111,0,0,.525],73:[0,.61111,0,0,.525],74:[0,.61111,0,0,.525],75:[0,.61111,0,0,.525],76:[0,.61111,0,0,.525],77:[0,.61111,0,0,.525],78:[0,.61111,0,0,.525],79:[0,.61111,0,0,.525],80:[0,.61111,0,0,.525],81:[.13889,.61111,0,0,.525],82:[0,.61111,0,0,.525],83:[0,.61111,0,0,.525],84:[0,.61111,0,0,.525],85:[0,.61111,0,0,.525],86:[0,.61111,0,0,.525],87:[0,.61111,0,0,.525],88:[0,.61111,0,0,.525],89:[0,.61111,0,0,.525],90:[0,.61111,0,0,.525],91:[.08333,.69444,0,0,.525],92:[.08333,.69444,0,0,.525],93:[.08333,.69444,0,0,.525],94:[0,.61111,0,0,.525],95:[.09514,0,0,0,.525],96:[0,.61111,0,0,.525],97:[0,.43056,0,0,.525],98:[0,.61111,0,0,.525],99:[0,.43056,0,0,.525],100:[0,.61111,0,0,.525],101:[0,.43056,0,0,.525],102:[0,.61111,0,0,.525],103:[.22222,.43056,0,0,.525],104:[0,.61111,0,0,.525],105:[0,.61111,0,0,.525],106:[.22222,.61111,0,0,.525],107:[0,.61111,0,0,.525],108:[0,.61111,0,0,.525],109:[0,.43056,0,0,.525],110:[0,.43056,0,0,.525],111:[0,.43056,0,0,.525],112:[.22222,.43056,0,0,.525],113:[.22222,.43056,0,0,.525],114:[0,.43056,0,0,.525],115:[0,.43056,0,0,.525],116:[0,.55358,0,0,.525],117:[0,.43056,0,0,.525],118:[0,.43056,0,0,.525],119:[0,.43056,0,0,.525],120:[0,.43056,0,0,.525],121:[.22222,.43056,0,0,.525],122:[0,.43056,0,0,.525],123:[.08333,.69444,0,0,.525],124:[.08333,.69444,0,0,.525],125:[.08333,.69444,0,0,.525],126:[0,.61111,0,0,.525],127:[0,.61111,0,0,.525],160:[0,0,0,0,.525],176:[0,.61111,0,0,.525],184:[.19445,0,0,0,.525],305:[0,.43056,0,0,.525],567:[.22222,.43056,0,0,.525],711:[0,.56597,0,0,.525],713:[0,.56555,0,0,.525],714:[0,.61111,0,0,.525],715:[0,.61111,0,0,.525],728:[0,.61111,0,0,.525],730:[0,.61111,0,0,.525],770:[0,.61111,0,0,.525],771:[0,.61111,0,0,.525],776:[0,.61111,0,0,.525],915:[0,.61111,0,0,.525],916:[0,.61111,0,0,.525],920:[0,.61111,0,0,.525],923:[0,.61111,0,0,.525],926:[0,.61111,0,0,.525],928:[0,.61111,0,0,.525],931:[0,.61111,0,0,.525],933:[0,.61111,0,0,.525],934:[0,.61111,0,0,.525],936:[0,.61111,0,0,.525],937:[0,.61111,0,0,.525],8216:[0,.61111,0,0,.525],8217:[0,.61111,0,0,.525],8242:[0,.61111,0,0,.525],9251:[.11111,.21944,0,0,.525]}},m4={slant:[.25,.25,.25],space:[0,0,0],stretch:[0,0,0],shrink:[0,0,0],xHeight:[.431,.431,.431],quad:[1,1.171,1.472],extraSpace:[0,0,0],num1:[.677,.732,.925],num2:[.394,.384,.387],num3:[.444,.471,.504],denom1:[.686,.752,1.025],denom2:[.345,.344,.532],sup1:[.413,.503,.504],sup2:[.363,.431,.404],sup3:[.289,.286,.294],sub1:[.15,.143,.2],sub2:[.247,.286,.4],supDrop:[.386,.353,.494],subDrop:[.05,.071,.1],delim1:[2.39,1.7,1.98],delim2:[1.01,1.157,1.42],axisHeight:[.25,.25,.25],defaultRuleThickness:[.04,.049,.049],bigOpSpacing1:[.111,.111,.111],bigOpSpacing2:[.166,.166,.166],bigOpSpacing3:[.2,.2,.2],bigOpSpacing4:[.6,.611,.611],bigOpSpacing5:[.1,.143,.143],sqrtRuleThickness:[.04,.04,.04],ptPerEm:[10,10,10],doubleRuleSep:[.2,.2,.2],arrayRuleWidth:[.04,.04,.04],fboxsep:[.3,.3,.3],fboxrule:[.04,.04,.04]},aL={Å:"A",Ð:"D",Þ:"o",å:"a",ð:"d",þ:"o",А:"A",Б:"B",В:"B",Г:"F",Д:"A",Е:"E",Ж:"K",З:"3",И:"N",Й:"N",К:"K",Л:"N",М:"M",Н:"H",О:"O",П:"N",Р:"P",С:"C",Т:"T",У:"y",Ф:"O",Х:"X",Ц:"U",Ч:"h",Ш:"W",Щ:"W",Ъ:"B",Ы:"X",Ь:"B",Э:"3",Ю:"X",Я:"R",а:"a",б:"b",в:"a",г:"r",д:"y",е:"e",ж:"m",з:"e",и:"n",й:"n",к:"n",л:"n",м:"m",н:"n",о:"o",п:"n",р:"p",с:"c",т:"o",у:"y",ф:"b",х:"x",ц:"n",ч:"n",ш:"w",щ:"w",ъ:"a",ы:"m",ь:"a",э:"e",ю:"m",я:"r"};function m1e(t,e){Yf[t]=e}function yk(t,e,n){if(!Yf[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),i=Yf[e][r];if(!i&&t[0]in aL&&(r=aL[t[0]].charCodeAt(0),i=Yf[e][r]),!i&&n==="text"&&tq(r)&&(i=Yf[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var gA={};function g1e(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!gA[e]){var n=gA[e]={cssEmPerMu:m4.quad[e]/18};for(var r in m4)m4.hasOwnProperty(r)&&(n[r]=m4[r][e])}return gA[e]}var v1e=[[1,1,1],[2,1,1],[3,1,1],[4,2,1],[5,2,1],[6,3,1],[7,4,2],[8,6,3],[9,7,6],[10,8,7],[11,10,9]],oL=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],lL=function(e,n){return n.size<2?e:v1e[e-1][n.size-1]};class Qh{constructor(e){this.style=void 0,this.color=void 0,this.size=void 0,this.textSize=void 0,this.phantom=void 0,this.font=void 0,this.fontFamily=void 0,this.fontWeight=void 0,this.fontShape=void 0,this.sizeMultiplier=void 0,this.maxSize=void 0,this.minRuleThickness=void 0,this._fontMetrics=void 0,this.style=e.style,this.color=e.color,this.size=e.size||Qh.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=oL[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={style:this.style,size:this.size,textSize:this.textSize,color:this.color,phantom:this.phantom,font:this.font,fontFamily:this.fontFamily,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize,minRuleThickness:this.minRuleThickness};for(var r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new Qh(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:lL(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:oL[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=lL(Qh.BASESIZE,e);return this.size===n&&this.textSize===Qh.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Qh.BASESIZE?["sizing","reset-size"+this.size,"size"+Qh.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=g1e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Qh.BASESIZE=6;var _R={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},x1e={ex:!0,em:!0,mu:!0},nq=function(e){return typeof e!="string"&&(e=e.unit),e in _R||e in x1e||e==="ex"},Js=function(e,n){var r;if(e.unit in _R)r=_R[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var i;if(n.style.isTight()?i=n.havingStyle(n.style.text()):i=n,e.unit==="ex")r=i.fontMetrics().xHeight;else if(e.unit==="em")r=i.fontMetrics().quad;else throw new Qt("Invalid unit: '"+e.unit+"'");i!==n&&(r*=i.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},dn=function(e){return+e.toFixed(4)+"em"},J0=function(e){return e.filter(n=>n).join(" ")},rq=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var i=n.getColor();i&&(this.style.color=i)}},iq=function(e){var n=document.createElement(e);n.className=J0(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var i in this.attributes)this.attributes.hasOwnProperty(i)&&n.setAttribute(i,this.attributes[i]);for(var s=0;s<this.children.length;s++)n.appendChild(this.children[s].toNode());return n},y1e=/[\s"'>/=\x00-\x1f]/,sq=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+dl(J0(this.classes))+'"');var r="";for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=gk(i)+":"+this.style[i]+";");r&&(n+=' style="'+dl(r)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(y1e.test(s))throw new Qt("Invalid attribute name '"+s+"'");n+=" "+s+'="'+dl(this.attributes[s])+'"'}n+=">";for(var a=0;a<this.children.length;a++)n+=this.children[a].toMarkup();return n+="</"+e+">",n};class pw{constructor(e,n,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,rq.call(this,e,r,i),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return iq.call(this,"span")}toMarkup(){return sq.call(this,"span")}}class bk{constructor(e,n,r,i){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,rq.call(this,n,i),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return iq.call(this,"a")}toMarkup(){return sq.call(this,"a")}}class b1e{constructor(e,n,r){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e='<img src="'+dl(this.src)+'"'+(' alt="'+dl(this.alt)+'"'),n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=gk(r)+":"+this.style[r]+";");return n&&(e+=' style="'+dl(n)+'"'),e+="'/>",e}}var _1e={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Xu{constructor(e,n,r,i,s,a,o,l){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=n||0,this.depth=r||0,this.italic=i||0,this.skew=s||0,this.width=a||0,this.classes=o||[],this.style=l||{},this.maxFontSize=0;var c=i1e(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=_1e[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),n=null;this.italic>0&&(n=document.createElement("span"),n.style.marginRight=dn(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=J0(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="<span";this.classes.length&&(e=!0,n+=' class="',n+=dl(J0(this.classes)),n+='"');var r="";this.italic>0&&(r+="margin-right:"+this.italic+"em;");for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=gk(i)+":"+this.style[i]+";");r&&(e=!0,n+=' style="'+dl(r)+'"');var s=dl(this.text);return e?(n+=">",n+=s,n+="</span>",n):s}}class hp{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var i=0;i<this.children.length;i++)n.appendChild(this.children[i].toNode());return n}toMarkup(){var e='<svg xmlns="http://www.w3.org/2000/svg"';for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="'+dl(this.attributes[n])+'"');e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class em{constructor(e,n){this.pathName=void 0,this.alternate=void 0,this.pathName=e,this.alternate=n}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"path");return this.alternate?n.setAttribute("d",this.alternate):n.setAttribute("d",sL[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+dl(this.alternate)+'"/>':'<path d="'+dl(sL[this.pathName])+'"/>'}}class SR{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e="<line";for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="'+dl(this.attributes[n])+'"');return e+="/>",e}}function cL(t){if(t instanceof Xu)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function S1e(t){if(t instanceof pw)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var w1e={bin:1,close:1,inner:1,open:1,punct:1,rel:1},M1e={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},hs={math:{},text:{}};function J(t,e,n,r,i,s){hs[t][i]={font:e,group:n,replace:r},s&&r&&(hs[t][r]=hs[t][i])}var se="math",$t="text",_e="main",Je="ams",Bs="accent-token",En="bin",Wl="close",Ny="inner",Qn="mathord",Wa="op-token",cu="open",DT="punct",nt="rel",_p="spacing",pt="textord";J(se,_e,nt,"≡","\\equiv",!0);J(se,_e,nt,"≺","\\prec",!0);J(se,_e,nt,"≻","\\succ",!0);J(se,_e,nt,"∼","\\sim",!0);J(se,_e,nt,"⊥","\\perp");J(se,_e,nt,"⪯","\\preceq",!0);J(se,_e,nt,"⪰","\\succeq",!0);J(se,_e,nt,"≃","\\simeq",!0);J(se,_e,nt,"∣","\\mid",!0);J(se,_e,nt,"≪","\\ll",!0);J(se,_e,nt,"≫","\\gg",!0);J(se,_e,nt,"≍","\\asymp",!0);J(se,_e,nt,"∥","\\parallel");J(se,_e,nt,"⋈","\\bowtie",!0);J(se,_e,nt,"⌣","\\smile",!0);J(se,_e,nt,"⊑","\\sqsubseteq",!0);J(se,_e,nt,"⊒","\\sqsupseteq",!0);J(se,_e,nt,"≐","\\doteq",!0);J(se,_e,nt,"⌢","\\frown",!0);J(se,_e,nt,"∋","\\ni",!0);J(se,_e,nt,"∝","\\propto",!0);J(se,_e,nt,"⊢","\\vdash",!0);J(se,_e,nt,"⊣","\\dashv",!0);J(se,_e,nt,"∋","\\owns");J(se,_e,DT,".","\\ldotp");J(se,_e,DT,"⋅","\\cdotp");J(se,_e,pt,"#","\\#");J($t,_e,pt,"#","\\#");J(se,_e,pt,"&","\\&");J($t,_e,pt,"&","\\&");J(se,_e,pt,"ℵ","\\aleph",!0);J(se,_e,pt,"∀","\\forall",!0);J(se,_e,pt,"ℏ","\\hbar",!0);J(se,_e,pt,"∃","\\exists",!0);J(se,_e,pt,"∇","\\nabla",!0);J(se,_e,pt,"♭","\\flat",!0);J(se,_e,pt,"ℓ","\\ell",!0);J(se,_e,pt,"♮","\\natural",!0);J(se,_e,pt,"♣","\\clubsuit",!0);J(se,_e,pt,"℘","\\wp",!0);J(se,_e,pt,"♯","\\sharp",!0);J(se,_e,pt,"♢","\\diamondsuit",!0);J(se,_e,pt,"ℜ","\\Re",!0);J(se,_e,pt,"♡","\\heartsuit",!0);J(se,_e,pt,"ℑ","\\Im",!0);J(se,_e,pt,"♠","\\spadesuit",!0);J(se,_e,pt,"§","\\S",!0);J($t,_e,pt,"§","\\S");J(se,_e,pt,"¶","\\P",!0);J($t,_e,pt,"¶","\\P");J(se,_e,pt,"†","\\dag");J($t,_e,pt,"†","\\dag");J($t,_e,pt,"†","\\textdagger");J(se,_e,pt,"‡","\\ddag");J($t,_e,pt,"‡","\\ddag");J($t,_e,pt,"‡","\\textdaggerdbl");J(se,_e,Wl,"⎱","\\rmoustache",!0);J(se,_e,cu,"⎰","\\lmoustache",!0);J(se,_e,Wl,"⟯","\\rgroup",!0);J(se,_e,cu,"⟮","\\lgroup",!0);J(se,_e,En,"∓","\\mp",!0);J(se,_e,En,"⊖","\\ominus",!0);J(se,_e,En,"⊎","\\uplus",!0);J(se,_e,En,"⊓","\\sqcap",!0);J(se,_e,En,"∗","\\ast");J(se,_e,En,"⊔","\\sqcup",!0);J(se,_e,En,"◯","\\bigcirc",!0);J(se,_e,En,"∙","\\bullet",!0);J(se,_e,En,"‡","\\ddagger");J(se,_e,En,"≀","\\wr",!0);J(se,_e,En,"⨿","\\amalg");J(se,_e,En,"&","\\And");J(se,_e,nt,"⟵","\\longleftarrow",!0);J(se,_e,nt,"⇐","\\Leftarrow",!0);J(se,_e,nt,"⟸","\\Longleftarrow",!0);J(se,_e,nt,"⟶","\\longrightarrow",!0);J(se,_e,nt,"⇒","\\Rightarrow",!0);J(se,_e,nt,"⟹","\\Longrightarrow",!0);J(se,_e,nt,"↔","\\leftrightarrow",!0);J(se,_e,nt,"⟷","\\longleftrightarrow",!0);J(se,_e,nt,"⇔","\\Leftrightarrow",!0);J(se,_e,nt,"⟺","\\Longleftrightarrow",!0);J(se,_e,nt,"↦","\\mapsto",!0);J(se,_e,nt,"⟼","\\longmapsto",!0);J(se,_e,nt,"↗","\\nearrow",!0);J(se,_e,nt,"↩","\\hookleftarrow",!0);J(se,_e,nt,"↪","\\hookrightarrow",!0);J(se,_e,nt,"↘","\\searrow",!0);J(se,_e,nt,"↼","\\leftharpoonup",!0);J(se,_e,nt,"⇀","\\rightharpoonup",!0);J(se,_e,nt,"↙","\\swarrow",!0);J(se,_e,nt,"↽","\\leftharpoondown",!0);J(se,_e,nt,"⇁","\\rightharpoondown",!0);J(se,_e,nt,"↖","\\nwarrow",!0);J(se,_e,nt,"⇌","\\rightleftharpoons",!0);J(se,Je,nt,"≮","\\nless",!0);J(se,Je,nt,"","\\@nleqslant");J(se,Je,nt,"","\\@nleqq");J(se,Je,nt,"⪇","\\lneq",!0);J(se,Je,nt,"≨","\\lneqq",!0);J(se,Je,nt,"","\\@lvertneqq");J(se,Je,nt,"⋦","\\lnsim",!0);J(se,Je,nt,"⪉","\\lnapprox",!0);J(se,Je,nt,"⊀","\\nprec",!0);J(se,Je,nt,"⋠","\\npreceq",!0);J(se,Je,nt,"⋨","\\precnsim",!0);J(se,Je,nt,"⪹","\\precnapprox",!0);J(se,Je,nt,"≁","\\nsim",!0);J(se,Je,nt,"","\\@nshortmid");J(se,Je,nt,"∤","\\nmid",!0);J(se,Je,nt,"⊬","\\nvdash",!0);J(se,Je,nt,"⊭","\\nvDash",!0);J(se,Je,nt,"⋪","\\ntriangleleft");J(se,Je,nt,"⋬","\\ntrianglelefteq",!0);J(se,Je,nt,"⊊","\\subsetneq",!0);J(se,Je,nt,"","\\@varsubsetneq");J(se,Je,nt,"⫋","\\subsetneqq",!0);J(se,Je,nt,"","\\@varsubsetneqq");J(se,Je,nt,"≯","\\ngtr",!0);J(se,Je,nt,"","\\@ngeqslant");J(se,Je,nt,"","\\@ngeqq");J(se,Je,nt,"⪈","\\gneq",!0);J(se,Je,nt,"≩","\\gneqq",!0);J(se,Je,nt,"","\\@gvertneqq");J(se,Je,nt,"⋧","\\gnsim",!0);J(se,Je,nt,"⪊","\\gnapprox",!0);J(se,Je,nt,"⊁","\\nsucc",!0);J(se,Je,nt,"⋡","\\nsucceq",!0);J(se,Je,nt,"⋩","\\succnsim",!0);J(se,Je,nt,"⪺","\\succnapprox",!0);J(se,Je,nt,"≆","\\ncong",!0);J(se,Je,nt,"","\\@nshortparallel");J(se,Je,nt,"∦","\\nparallel",!0);J(se,Je,nt,"⊯","\\nVDash",!0);J(se,Je,nt,"⋫","\\ntriangleright");J(se,Je,nt,"⋭","\\ntrianglerighteq",!0);J(se,Je,nt,"","\\@nsupseteqq");J(se,Je,nt,"⊋","\\supsetneq",!0);J(se,Je,nt,"","\\@varsupsetneq");J(se,Je,nt,"⫌","\\supsetneqq",!0);J(se,Je,nt,"","\\@varsupsetneqq");J(se,Je,nt,"⊮","\\nVdash",!0);J(se,Je,nt,"⪵","\\precneqq",!0);J(se,Je,nt,"⪶","\\succneqq",!0);J(se,Je,nt,"","\\@nsubseteqq");J(se,Je,En,"⊴","\\unlhd");J(se,Je,En,"⊵","\\unrhd");J(se,Je,nt,"↚","\\nleftarrow",!0);J(se,Je,nt,"↛","\\nrightarrow",!0);J(se,Je,nt,"⇍","\\nLeftarrow",!0);J(se,Je,nt,"⇏","\\nRightarrow",!0);J(se,Je,nt,"↮","\\nleftrightarrow",!0);J(se,Je,nt,"⇎","\\nLeftrightarrow",!0);J(se,Je,nt,"△","\\vartriangle");J(se,Je,pt,"ℏ","\\hslash");J(se,Je,pt,"▽","\\triangledown");J(se,Je,pt,"◊","\\lozenge");J(se,Je,pt,"Ⓢ","\\circledS");J(se,Je,pt,"®","\\circledR");J($t,Je,pt,"®","\\circledR");J(se,Je,pt,"∡","\\measuredangle",!0);J(se,Je,pt,"∄","\\nexists");J(se,Je,pt,"℧","\\mho");J(se,Je,pt,"Ⅎ","\\Finv",!0);J(se,Je,pt,"⅁","\\Game",!0);J(se,Je,pt,"‵","\\backprime");J(se,Je,pt,"▲","\\blacktriangle");J(se,Je,pt,"▼","\\blacktriangledown");J(se,Je,pt,"■","\\blacksquare");J(se,Je,pt,"⧫","\\blacklozenge");J(se,Je,pt,"★","\\bigstar");J(se,Je,pt,"∢","\\sphericalangle",!0);J(se,Je,pt,"∁","\\complement",!0);J(se,Je,pt,"ð","\\eth",!0);J($t,_e,pt,"ð","ð");J(se,Je,pt,"╱","\\diagup");J(se,Je,pt,"╲","\\diagdown");J(se,Je,pt,"□","\\square");J(se,Je,pt,"□","\\Box");J(se,Je,pt,"◊","\\Diamond");J(se,Je,pt,"¥","\\yen",!0);J($t,Je,pt,"¥","\\yen",!0);J(se,Je,pt,"✓","\\checkmark",!0);J($t,Je,pt,"✓","\\checkmark");J(se,Je,pt,"ℶ","\\beth",!0);J(se,Je,pt,"ℸ","\\daleth",!0);J(se,Je,pt,"ℷ","\\gimel",!0);J(se,Je,pt,"ϝ","\\digamma",!0);J(se,Je,pt,"ϰ","\\varkappa");J(se,Je,cu,"┌","\\@ulcorner",!0);J(se,Je,Wl,"┐","\\@urcorner",!0);J(se,Je,cu,"└","\\@llcorner",!0);J(se,Je,Wl,"┘","\\@lrcorner",!0);J(se,Je,nt,"≦","\\leqq",!0);J(se,Je,nt,"⩽","\\leqslant",!0);J(se,Je,nt,"⪕","\\eqslantless",!0);J(se,Je,nt,"≲","\\lesssim",!0);J(se,Je,nt,"⪅","\\lessapprox",!0);J(se,Je,nt,"≊","\\approxeq",!0);J(se,Je,En,"⋖","\\lessdot");J(se,Je,nt,"⋘","\\lll",!0);J(se,Je,nt,"≶","\\lessgtr",!0);J(se,Je,nt,"⋚","\\lesseqgtr",!0);J(se,Je,nt,"⪋","\\lesseqqgtr",!0);J(se,Je,nt,"≑","\\doteqdot");J(se,Je,nt,"≓","\\risingdotseq",!0);J(se,Je,nt,"≒","\\fallingdotseq",!0);J(se,Je,nt,"∽","\\backsim",!0);J(se,Je,nt,"⋍","\\backsimeq",!0);J(se,Je,nt,"⫅","\\subseteqq",!0);J(se,Je,nt,"⋐","\\Subset",!0);J(se,Je,nt,"⊏","\\sqsubset",!0);J(se,Je,nt,"≼","\\preccurlyeq",!0);J(se,Je,nt,"⋞","\\curlyeqprec",!0);J(se,Je,nt,"≾","\\precsim",!0);J(se,Je,nt,"⪷","\\precapprox",!0);J(se,Je,nt,"⊲","\\vartriangleleft");J(se,Je,nt,"⊴","\\trianglelefteq");J(se,Je,nt,"⊨","\\vDash",!0);J(se,Je,nt,"⊪","\\Vvdash",!0);J(se,Je,nt,"⌣","\\smallsmile");J(se,Je,nt,"⌢","\\smallfrown");J(se,Je,nt,"≏","\\bumpeq",!0);J(se,Je,nt,"≎","\\Bumpeq",!0);J(se,Je,nt,"≧","\\geqq",!0);J(se,Je,nt,"⩾","\\geqslant",!0);J(se,Je,nt,"⪖","\\eqslantgtr",!0);J(se,Je,nt,"≳","\\gtrsim",!0);J(se,Je,nt,"⪆","\\gtrapprox",!0);J(se,Je,En,"⋗","\\gtrdot");J(se,Je,nt,"⋙","\\ggg",!0);J(se,Je,nt,"≷","\\gtrless",!0);J(se,Je,nt,"⋛","\\gtreqless",!0);J(se,Je,nt,"⪌","\\gtreqqless",!0);J(se,Je,nt,"≖","\\eqcirc",!0);J(se,Je,nt,"≗","\\circeq",!0);J(se,Je,nt,"≜","\\triangleq",!0);J(se,Je,nt,"∼","\\thicksim");J(se,Je,nt,"≈","\\thickapprox");J(se,Je,nt,"⫆","\\supseteqq",!0);J(se,Je,nt,"⋑","\\Supset",!0);J(se,Je,nt,"⊐","\\sqsupset",!0);J(se,Je,nt,"≽","\\succcurlyeq",!0);J(se,Je,nt,"⋟","\\curlyeqsucc",!0);J(se,Je,nt,"≿","\\succsim",!0);J(se,Je,nt,"⪸","\\succapprox",!0);J(se,Je,nt,"⊳","\\vartriangleright");J(se,Je,nt,"⊵","\\trianglerighteq");J(se,Je,nt,"⊩","\\Vdash",!0);J(se,Je,nt,"∣","\\shortmid");J(se,Je,nt,"∥","\\shortparallel");J(se,Je,nt,"≬","\\between",!0);J(se,Je,nt,"⋔","\\pitchfork",!0);J(se,Je,nt,"∝","\\varpropto");J(se,Je,nt,"◀","\\blacktriangleleft");J(se,Je,nt,"∴","\\therefore",!0);J(se,Je,nt,"∍","\\backepsilon");J(se,Je,nt,"▶","\\blacktriangleright");J(se,Je,nt,"∵","\\because",!0);J(se,Je,nt,"⋘","\\llless");J(se,Je,nt,"⋙","\\gggtr");J(se,Je,En,"⊲","\\lhd");J(se,Je,En,"⊳","\\rhd");J(se,Je,nt,"≂","\\eqsim",!0);J(se,_e,nt,"⋈","\\Join");J(se,Je,nt,"≑","\\Doteq",!0);J(se,Je,En,"∔","\\dotplus",!0);J(se,Je,En,"∖","\\smallsetminus");J(se,Je,En,"⋒","\\Cap",!0);J(se,Je,En,"⋓","\\Cup",!0);J(se,Je,En,"⩞","\\doublebarwedge",!0);J(se,Je,En,"⊟","\\boxminus",!0);J(se,Je,En,"⊞","\\boxplus",!0);J(se,Je,En,"⋇","\\divideontimes",!0);J(se,Je,En,"⋉","\\ltimes",!0);J(se,Je,En,"⋊","\\rtimes",!0);J(se,Je,En,"⋋","\\leftthreetimes",!0);J(se,Je,En,"⋌","\\rightthreetimes",!0);J(se,Je,En,"⋏","\\curlywedge",!0);J(se,Je,En,"⋎","\\curlyvee",!0);J(se,Je,En,"⊝","\\circleddash",!0);J(se,Je,En,"⊛","\\circledast",!0);J(se,Je,En,"⋅","\\centerdot");J(se,Je,En,"⊺","\\intercal",!0);J(se,Je,En,"⋒","\\doublecap");J(se,Je,En,"⋓","\\doublecup");J(se,Je,En,"⊠","\\boxtimes",!0);J(se,Je,nt,"⇢","\\dashrightarrow",!0);J(se,Je,nt,"⇠","\\dashleftarrow",!0);J(se,Je,nt,"⇇","\\leftleftarrows",!0);J(se,Je,nt,"⇆","\\leftrightarrows",!0);J(se,Je,nt,"⇚","\\Lleftarrow",!0);J(se,Je,nt,"↞","\\twoheadleftarrow",!0);J(se,Je,nt,"↢","\\leftarrowtail",!0);J(se,Je,nt,"↫","\\looparrowleft",!0);J(se,Je,nt,"⇋","\\leftrightharpoons",!0);J(se,Je,nt,"↶","\\curvearrowleft",!0);J(se,Je,nt,"↺","\\circlearrowleft",!0);J(se,Je,nt,"↰","\\Lsh",!0);J(se,Je,nt,"⇈","\\upuparrows",!0);J(se,Je,nt,"↿","\\upharpoonleft",!0);J(se,Je,nt,"⇃","\\downharpoonleft",!0);J(se,_e,nt,"⊶","\\origof",!0);J(se,_e,nt,"⊷","\\imageof",!0);J(se,Je,nt,"⊸","\\multimap",!0);J(se,Je,nt,"↭","\\leftrightsquigarrow",!0);J(se,Je,nt,"⇉","\\rightrightarrows",!0);J(se,Je,nt,"⇄","\\rightleftarrows",!0);J(se,Je,nt,"↠","\\twoheadrightarrow",!0);J(se,Je,nt,"↣","\\rightarrowtail",!0);J(se,Je,nt,"↬","\\looparrowright",!0);J(se,Je,nt,"↷","\\curvearrowright",!0);J(se,Je,nt,"↻","\\circlearrowright",!0);J(se,Je,nt,"↱","\\Rsh",!0);J(se,Je,nt,"⇊","\\downdownarrows",!0);J(se,Je,nt,"↾","\\upharpoonright",!0);J(se,Je,nt,"⇂","\\downharpoonright",!0);J(se,Je,nt,"⇝","\\rightsquigarrow",!0);J(se,Je,nt,"⇝","\\leadsto");J(se,Je,nt,"⇛","\\Rrightarrow",!0);J(se,Je,nt,"↾","\\restriction");J(se,_e,pt,"‘","`");J(se,_e,pt,"$","\\$");J($t,_e,pt,"$","\\$");J($t,_e,pt,"$","\\textdollar");J(se,_e,pt,"%","\\%");J($t,_e,pt,"%","\\%");J(se,_e,pt,"_","\\_");J($t,_e,pt,"_","\\_");J($t,_e,pt,"_","\\textunderscore");J(se,_e,pt,"∠","\\angle",!0);J(se,_e,pt,"∞","\\infty",!0);J(se,_e,pt,"′","\\prime");J(se,_e,pt,"△","\\triangle");J(se,_e,pt,"Γ","\\Gamma",!0);J(se,_e,pt,"Δ","\\Delta",!0);J(se,_e,pt,"Θ","\\Theta",!0);J(se,_e,pt,"Λ","\\Lambda",!0);J(se,_e,pt,"Ξ","\\Xi",!0);J(se,_e,pt,"Π","\\Pi",!0);J(se,_e,pt,"Σ","\\Sigma",!0);J(se,_e,pt,"Υ","\\Upsilon",!0);J(se,_e,pt,"Φ","\\Phi",!0);J(se,_e,pt,"Ψ","\\Psi",!0);J(se,_e,pt,"Ω","\\Omega",!0);J(se,_e,pt,"A","Α");J(se,_e,pt,"B","Β");J(se,_e,pt,"E","Ε");J(se,_e,pt,"Z","Ζ");J(se,_e,pt,"H","Η");J(se,_e,pt,"I","Ι");J(se,_e,pt,"K","Κ");J(se,_e,pt,"M","Μ");J(se,_e,pt,"N","Ν");J(se,_e,pt,"O","Ο");J(se,_e,pt,"P","Ρ");J(se,_e,pt,"T","Τ");J(se,_e,pt,"X","Χ");J(se,_e,pt,"¬","\\neg",!0);J(se,_e,pt,"¬","\\lnot");J(se,_e,pt,"⊤","\\top");J(se,_e,pt,"⊥","\\bot");J(se,_e,pt,"∅","\\emptyset");J(se,Je,pt,"∅","\\varnothing");J(se,_e,Qn,"α","\\alpha",!0);J(se,_e,Qn,"β","\\beta",!0);J(se,_e,Qn,"γ","\\gamma",!0);J(se,_e,Qn,"δ","\\delta",!0);J(se,_e,Qn,"ϵ","\\epsilon",!0);J(se,_e,Qn,"ζ","\\zeta",!0);J(se,_e,Qn,"η","\\eta",!0);J(se,_e,Qn,"θ","\\theta",!0);J(se,_e,Qn,"ι","\\iota",!0);J(se,_e,Qn,"κ","\\kappa",!0);J(se,_e,Qn,"λ","\\lambda",!0);J(se,_e,Qn,"μ","\\mu",!0);J(se,_e,Qn,"ν","\\nu",!0);J(se,_e,Qn,"ξ","\\xi",!0);J(se,_e,Qn,"ο","\\omicron",!0);J(se,_e,Qn,"π","\\pi",!0);J(se,_e,Qn,"ρ","\\rho",!0);J(se,_e,Qn,"σ","\\sigma",!0);J(se,_e,Qn,"τ","\\tau",!0);J(se,_e,Qn,"υ","\\upsilon",!0);J(se,_e,Qn,"ϕ","\\phi",!0);J(se,_e,Qn,"χ","\\chi",!0);J(se,_e,Qn,"ψ","\\psi",!0);J(se,_e,Qn,"ω","\\omega",!0);J(se,_e,Qn,"ε","\\varepsilon",!0);J(se,_e,Qn,"ϑ","\\vartheta",!0);J(se,_e,Qn,"ϖ","\\varpi",!0);J(se,_e,Qn,"ϱ","\\varrho",!0);J(se,_e,Qn,"ς","\\varsigma",!0);J(se,_e,Qn,"φ","\\varphi",!0);J(se,_e,En,"∗","*",!0);J(se,_e,En,"+","+");J(se,_e,En,"−","-",!0);J(se,_e,En,"⋅","\\cdot",!0);J(se,_e,En,"∘","\\circ",!0);J(se,_e,En,"÷","\\div",!0);J(se,_e,En,"±","\\pm",!0);J(se,_e,En,"×","\\times",!0);J(se,_e,En,"∩","\\cap",!0);J(se,_e,En,"∪","\\cup",!0);J(se,_e,En,"∖","\\setminus",!0);J(se,_e,En,"∧","\\land");J(se,_e,En,"∨","\\lor");J(se,_e,En,"∧","\\wedge",!0);J(se,_e,En,"∨","\\vee",!0);J(se,_e,pt,"√","\\surd");J(se,_e,cu,"⟨","\\langle",!0);J(se,_e,cu,"∣","\\lvert");J(se,_e,cu,"∥","\\lVert");J(se,_e,Wl,"?","?");J(se,_e,Wl,"!","!");J(se,_e,Wl,"⟩","\\rangle",!0);J(se,_e,Wl,"∣","\\rvert");J(se,_e,Wl,"∥","\\rVert");J(se,_e,nt,"=","=");J(se,_e,nt,":",":");J(se,_e,nt,"≈","\\approx",!0);J(se,_e,nt,"≅","\\cong",!0);J(se,_e,nt,"≥","\\ge");J(se,_e,nt,"≥","\\geq",!0);J(se,_e,nt,"←","\\gets");J(se,_e,nt,">","\\gt",!0);J(se,_e,nt,"∈","\\in",!0);J(se,_e,nt,"","\\@not");J(se,_e,nt,"⊂","\\subset",!0);J(se,_e,nt,"⊃","\\supset",!0);J(se,_e,nt,"⊆","\\subseteq",!0);J(se,_e,nt,"⊇","\\supseteq",!0);J(se,Je,nt,"⊈","\\nsubseteq",!0);J(se,Je,nt,"⊉","\\nsupseteq",!0);J(se,_e,nt,"⊨","\\models");J(se,_e,nt,"←","\\leftarrow",!0);J(se,_e,nt,"≤","\\le");J(se,_e,nt,"≤","\\leq",!0);J(se,_e,nt,"<","\\lt",!0);J(se,_e,nt,"→","\\rightarrow",!0);J(se,_e,nt,"→","\\to");J(se,Je,nt,"≱","\\ngeq",!0);J(se,Je,nt,"≰","\\nleq",!0);J(se,_e,_p," ","\\ ");J(se,_e,_p," ","\\space");J(se,_e,_p," ","\\nobreakspace");J($t,_e,_p," ","\\ ");J($t,_e,_p," "," ");J($t,_e,_p," ","\\space");J($t,_e,_p," ","\\nobreakspace");J(se,_e,_p,null,"\\nobreak");J(se,_e,_p,null,"\\allowbreak");J(se,_e,DT,",",",");J(se,_e,DT,";",";");J(se,Je,En,"⊼","\\barwedge",!0);J(se,Je,En,"⊻","\\veebar",!0);J(se,_e,En,"⊙","\\odot",!0);J(se,_e,En,"⊕","\\oplus",!0);J(se,_e,En,"⊗","\\otimes",!0);J(se,_e,pt,"∂","\\partial",!0);J(se,_e,En,"⊘","\\oslash",!0);J(se,Je,En,"⊚","\\circledcirc",!0);J(se,Je,En,"⊡","\\boxdot",!0);J(se,_e,En,"△","\\bigtriangleup");J(se,_e,En,"▽","\\bigtriangledown");J(se,_e,En,"†","\\dagger");J(se,_e,En,"⋄","\\diamond");J(se,_e,En,"⋆","\\star");J(se,_e,En,"◃","\\triangleleft");J(se,_e,En,"▹","\\triangleright");J(se,_e,cu,"{","\\{");J($t,_e,pt,"{","\\{");J($t,_e,pt,"{","\\textbraceleft");J(se,_e,Wl,"}","\\}");J($t,_e,pt,"}","\\}");J($t,_e,pt,"}","\\textbraceright");J(se,_e,cu,"{","\\lbrace");J(se,_e,Wl,"}","\\rbrace");J(se,_e,cu,"[","\\lbrack",!0);J($t,_e,pt,"[","\\lbrack",!0);J(se,_e,Wl,"]","\\rbrack",!0);J($t,_e,pt,"]","\\rbrack",!0);J(se,_e,cu,"(","\\lparen",!0);J(se,_e,Wl,")","\\rparen",!0);J($t,_e,pt,"<","\\textless",!0);J($t,_e,pt,">","\\textgreater",!0);J(se,_e,cu,"⌊","\\lfloor",!0);J(se,_e,Wl,"⌋","\\rfloor",!0);J(se,_e,cu,"⌈","\\lceil",!0);J(se,_e,Wl,"⌉","\\rceil",!0);J(se,_e,pt,"\\","\\backslash");J(se,_e,pt,"∣","|");J(se,_e,pt,"∣","\\vert");J($t,_e,pt,"|","\\textbar",!0);J(se,_e,pt,"∥","\\|");J(se,_e,pt,"∥","\\Vert");J($t,_e,pt,"∥","\\textbardbl");J($t,_e,pt,"~","\\textasciitilde");J($t,_e,pt,"\\","\\textbackslash");J($t,_e,pt,"^","\\textasciicircum");J(se,_e,nt,"↑","\\uparrow",!0);J(se,_e,nt,"⇑","\\Uparrow",!0);J(se,_e,nt,"↓","\\downarrow",!0);J(se,_e,nt,"⇓","\\Downarrow",!0);J(se,_e,nt,"↕","\\updownarrow",!0);J(se,_e,nt,"⇕","\\Updownarrow",!0);J(se,_e,Wa,"∐","\\coprod");J(se,_e,Wa,"⋁","\\bigvee");J(se,_e,Wa,"⋀","\\bigwedge");J(se,_e,Wa,"⨄","\\biguplus");J(se,_e,Wa,"⋂","\\bigcap");J(se,_e,Wa,"⋃","\\bigcup");J(se,_e,Wa,"∫","\\int");J(se,_e,Wa,"∫","\\intop");J(se,_e,Wa,"∬","\\iint");J(se,_e,Wa,"∭","\\iiint");J(se,_e,Wa,"∏","\\prod");J(se,_e,Wa,"∑","\\sum");J(se,_e,Wa,"⨂","\\bigotimes");J(se,_e,Wa,"⨁","\\bigoplus");J(se,_e,Wa,"⨀","\\bigodot");J(se,_e,Wa,"∮","\\oint");J(se,_e,Wa,"∯","\\oiint");J(se,_e,Wa,"∰","\\oiiint");J(se,_e,Wa,"⨆","\\bigsqcup");J(se,_e,Wa,"∫","\\smallint");J($t,_e,Ny,"…","\\textellipsis");J(se,_e,Ny,"…","\\mathellipsis");J($t,_e,Ny,"…","\\ldots",!0);J(se,_e,Ny,"…","\\ldots",!0);J(se,_e,Ny,"⋯","\\@cdots",!0);J(se,_e,Ny,"⋱","\\ddots",!0);J(se,_e,pt,"⋮","\\varvdots");J($t,_e,pt,"⋮","\\varvdots");J(se,_e,Bs,"ˊ","\\acute");J(se,_e,Bs,"ˋ","\\grave");J(se,_e,Bs,"¨","\\ddot");J(se,_e,Bs,"~","\\tilde");J(se,_e,Bs,"ˉ","\\bar");J(se,_e,Bs,"˘","\\breve");J(se,_e,Bs,"ˇ","\\check");J(se,_e,Bs,"^","\\hat");J(se,_e,Bs,"⃗","\\vec");J(se,_e,Bs,"˙","\\dot");J(se,_e,Bs,"˚","\\mathring");J(se,_e,Qn,"","\\@imath");J(se,_e,Qn,"","\\@jmath");J(se,_e,pt,"ı","ı");J(se,_e,pt,"ȷ","ȷ");J($t,_e,pt,"ı","\\i",!0);J($t,_e,pt,"ȷ","\\j",!0);J($t,_e,pt,"ß","\\ss",!0);J($t,_e,pt,"æ","\\ae",!0);J($t,_e,pt,"œ","\\oe",!0);J($t,_e,pt,"ø","\\o",!0);J($t,_e,pt,"Æ","\\AE",!0);J($t,_e,pt,"Œ","\\OE",!0);J($t,_e,pt,"Ø","\\O",!0);J($t,_e,Bs,"ˊ","\\'");J($t,_e,Bs,"ˋ","\\`");J($t,_e,Bs,"ˆ","\\^");J($t,_e,Bs,"˜","\\~");J($t,_e,Bs,"ˉ","\\=");J($t,_e,Bs,"˘","\\u");J($t,_e,Bs,"˙","\\.");J($t,_e,Bs,"¸","\\c");J($t,_e,Bs,"˚","\\r");J($t,_e,Bs,"ˇ","\\v");J($t,_e,Bs,"¨",'\\"');J($t,_e,Bs,"˝","\\H");J($t,_e,Bs,"◯","\\textcircled");var aq={"--":!0,"---":!0,"``":!0,"''":!0};J($t,_e,pt,"–","--",!0);J($t,_e,pt,"–","\\textendash");J($t,_e,pt,"—","---",!0);J($t,_e,pt,"—","\\textemdash");J($t,_e,pt,"‘","`",!0);J($t,_e,pt,"‘","\\textquoteleft");J($t,_e,pt,"’","'",!0);J($t,_e,pt,"’","\\textquoteright");J($t,_e,pt,"“","``",!0);J($t,_e,pt,"“","\\textquotedblleft");J($t,_e,pt,"”","''",!0);J($t,_e,pt,"”","\\textquotedblright");J(se,_e,pt,"°","\\degree",!0);J($t,_e,pt,"°","\\degree");J($t,_e,pt,"°","\\textdegree",!0);J(se,_e,pt,"£","\\pounds");J(se,_e,pt,"£","\\mathsterling",!0);J($t,_e,pt,"£","\\pounds");J($t,_e,pt,"£","\\textsterling",!0);J(se,Je,pt,"✠","\\maltese");J($t,Je,pt,"✠","\\maltese");var uL='0123456789/@."';for(var vA=0;vA<uL.length;vA++){var dL=uL.charAt(vA);J(se,_e,pt,dL,dL)}var fL='0123456789!@*()-=+";:?/.,';for(var xA=0;xA<fL.length;xA++){var hL=fL.charAt(xA);J($t,_e,pt,hL,hL)}var T2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var yA=0;yA<T2.length;yA++){var g4=T2.charAt(yA);J(se,_e,Qn,g4,g4),J($t,_e,pt,g4,g4)}J(se,Je,pt,"C","ℂ");J($t,Je,pt,"C","ℂ");J(se,Je,pt,"H","ℍ");J($t,Je,pt,"H","ℍ");J(se,Je,pt,"N","ℕ");J($t,Je,pt,"N","ℕ");J(se,Je,pt,"P","ℙ");J($t,Je,pt,"P","ℙ");J(se,Je,pt,"Q","ℚ");J($t,Je,pt,"Q","ℚ");J(se,Je,pt,"R","ℝ");J($t,Je,pt,"R","ℝ");J(se,Je,pt,"Z","ℤ");J($t,Je,pt,"Z","ℤ");J(se,_e,Qn,"h","ℎ");J($t,_e,Qn,"h","ℎ");var lr="";for(var kl=0;kl<T2.length;kl++){var da=T2.charAt(kl);lr=String.fromCharCode(55349,56320+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr),lr=String.fromCharCode(55349,56372+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr),lr=String.fromCharCode(55349,56424+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr),lr=String.fromCharCode(55349,56580+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr),lr=String.fromCharCode(55349,56684+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr),lr=String.fromCharCode(55349,56736+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr),lr=String.fromCharCode(55349,56788+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr),lr=String.fromCharCode(55349,56840+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr),lr=String.fromCharCode(55349,56944+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr),kl<26&&(lr=String.fromCharCode(55349,56632+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr),lr=String.fromCharCode(55349,56476+kl),J(se,_e,Qn,da,lr),J($t,_e,pt,da,lr))}lr="𝕜";J(se,_e,Qn,"k",lr);J($t,_e,pt,"k",lr);for(var ag=0;ag<10;ag++){var p0=ag.toString();lr=String.fromCharCode(55349,57294+ag),J(se,_e,Qn,p0,lr),J($t,_e,pt,p0,lr),lr=String.fromCharCode(55349,57314+ag),J(se,_e,Qn,p0,lr),J($t,_e,pt,p0,lr),lr=String.fromCharCode(55349,57324+ag),J(se,_e,Qn,p0,lr),J($t,_e,pt,p0,lr),lr=String.fromCharCode(55349,57334+ag),J(se,_e,Qn,p0,lr),J($t,_e,pt,p0,lr)}var wR="ÐÞþ";for(var bA=0;bA<wR.length;bA++){var v4=wR.charAt(bA);J(se,_e,Qn,v4,v4),J($t,_e,pt,v4,v4)}var x4=[["mathbf","textbf","Main-Bold"],["mathbf","textbf","Main-Bold"],["mathnormal","textit","Math-Italic"],["mathnormal","textit","Math-Italic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["boldsymbol","boldsymbol","Main-BoldItalic"],["mathscr","textscr","Script-Regular"],["","",""],["","",""],["","",""],["mathfrak","textfrak","Fraktur-Regular"],["mathfrak","textfrak","Fraktur-Regular"],["mathbb","textbb","AMS-Regular"],["mathbb","textbb","AMS-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathboldfrak","textboldfrak","Fraktur-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathitsf","textitsf","SansSerif-Italic"],["mathitsf","textitsf","SansSerif-Italic"],["","",""],["","",""],["mathtt","texttt","Typewriter-Regular"],["mathtt","texttt","Typewriter-Regular"]],pL=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],T1e=function(e,n){var r=e.charCodeAt(0),i=e.charCodeAt(1),s=(r-55296)*1024+(i-56320)+65536,a=n==="math"?0:1;if(119808<=s&&s<120484){var o=Math.floor((s-119808)/26);return[x4[o][2],x4[o][a]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[pL[l][2],pL[l][a]]}else{if(s===120485||s===120486)return[x4[0][2],x4[0][a]];if(120486<s&&s<120782)return["",""];throw new Qt("Unsupported character: "+e)}},OT=function(e,n,r){return hs[r][e]&&hs[r][e].replace&&(e=hs[r][e].replace),{value:e,metrics:yk(e,n,r)}},Ll=function(e,n,r,i,s){var a=OT(e,n,r),o=a.metrics;e=a.value;var l;if(o){var c=o.italic;(r==="text"||i&&i.font==="mathit")&&(c=0),l=new Xu(e,o.height,o.depth,c,o.skew,o.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+n+"' and mode '"+r+"'")),l=new Xu(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var d=i.getColor();d&&(l.style.color=d)}return l},_k=function(e,n,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&OT(e,"Main-Bold",n).metrics?Ll(e,"Main-Bold",n,r,i.concat(["mathbf"])):e==="\\"||hs[n][e].font==="main"?Ll(e,"Main-Regular",n,r,i):Ll(e,"AMS-Regular",n,r,i.concat(["amsrm"]))},E1e=function(e,n,r,i,s){return s!=="textord"&&OT(e,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},LT=function(e,n,r){var i=e.mode,s=e.text,a=["mord"],o=i==="math"||i==="text"&&n.font,l=o?n.font:n.fontFamily,c="",d="";if(s.charCodeAt(0)===55349&&([c,d]=T1e(s,i)),c.length>0)return Ll(s,c,i,n,a.concat(d));if(l){var h,g;if(l==="boldsymbol"){var v=E1e(s,i,n,a,r);h=v.fontName,g=[v.fontClass]}else o?(h=MR[l].fontName,g=[l]):(h=y4(l,n.fontWeight,n.fontShape),g=[l,n.fontWeight,n.fontShape]);if(OT(s,h,i).metrics)return Ll(s,h,i,n,a.concat(g));if(aq.hasOwnProperty(s)&&h.slice(0,10)==="Typewriter"){for(var b=[],_=0;_<s.length;_++)b.push(Ll(s[_],h,i,n,a.concat(g)));return Sp(b)}}if(r==="mathord")return Ll(s,"Math-Italic",i,n,a.concat(["mathnormal"]));if(r==="textord"){var w=hs[i][s]&&hs[i][s].font;if(w==="ams"){var S=y4("amsrm",n.fontWeight,n.fontShape);return Ll(s,S,i,n,a.concat("amsrm",n.fontWeight,n.fontShape))}else if(w==="main"||!w){var E=y4("textrm",n.fontWeight,n.fontShape);return Ll(s,E,i,n,a.concat(n.fontWeight,n.fontShape))}else{var A=y4(w,n.fontWeight,n.fontShape);return Ll(s,A,i,n,a.concat(A,n.fontWeight,n.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},C1e=(t,e)=>{if(J0(t.classes)!==J0(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize||t.italic!==0&&t.hasClass("mathnormal"))return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var i in e.style)if(e.style.hasOwnProperty(i)&&t.style[i]!==e.style[i])return!1;return!0},oq=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof Xu&&r instanceof Xu&&C1e(n,r)&&(n.text+=r.text,n.height=Math.max(n.height,r.height),n.depth=Math.max(n.depth,r.depth),n.italic=r.italic,t.splice(e+1,1),e--)}return t},Sk=function(e){for(var n=0,r=0,i=0,s=0;s<e.children.length;s++){var a=e.children[s];a.height>n&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>i&&(i=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=i},Xt=function(e,n,r,i){var s=new pw(e,n,r,i);return Sk(s),s},tm=(t,e,n,r)=>new pw(t,e,n,r),ey=function(e,n,r){var i=Xt([e],[],n);return i.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),i.style.borderBottomWidth=dn(i.height),i.maxFontSize=1,i},A1e=function(e,n,r,i){var s=new bk(e,n,r,i);return Sk(s),s},Sp=function(e){var n=new hw(e);return Sk(n),n},ty=function(e,n){return e instanceof hw?Xt([],[e],n):e},N1e=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],i=-n[0].shift-n[0].elem.depth,s=i,a=1;a<n.length;a++){var o=-n[a].shift-s-n[a].elem.depth,l=o-(n[a-1].elem.height+n[a-1].elem.depth);s=s+o,r.push({type:"kern",size:l}),r.push(n[a])}return{children:r,depth:i}}var c;if(e.positionType==="top"){for(var d=e.positionData,h=0;h<e.children.length;h++){var g=e.children[h];d-=g.type==="kern"?g.size:g.elem.height+g.elem.depth}c=d}else if(e.positionType==="bottom")c=-e.positionData;else{var v=e.children[0];if(v.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-v.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-v.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},Mi=function(e,n){for(var{children:r,depth:i}=N1e(e),s=0,a=0;a<r.length;a++){var o=r[a];if(o.type==="elem"){var l=o.elem;s=Math.max(s,l.maxFontSize,l.height)}}s+=2;var c=Xt(["pstrut"],[]);c.style.height=dn(s);for(var d=[],h=i,g=i,v=i,b=0;b<r.length;b++){var _=r[b];if(_.type==="kern")v+=_.size;else{var w=_.elem,S=_.wrapperClasses||[],E=_.wrapperStyle||{},A=Xt(S,[c,w],void 0,E);A.style.top=dn(-s-v-w.depth),_.marginLeft&&(A.style.marginLeft=_.marginLeft),_.marginRight&&(A.style.marginRight=_.marginRight),d.push(A),v+=w.height+w.depth}h=Math.min(h,v),g=Math.max(g,v)}var N=Xt(["vlist"],d);N.style.height=dn(g);var D;if(h<0){var P=Xt([],[]),L=Xt(["vlist"],[P]);L.style.height=dn(-h);var R=Xt(["vlist-s"],[new Xu("​")]);D=[Xt(["vlist-r"],[N,R]),Xt(["vlist-r"],[L])]}else D=[Xt(["vlist-r"],[N])];var O=Xt(["vlist-t"],D);return D.length===2&&O.classes.push("vlist-t2"),O.height=g,O.depth=-h,O},lq=(t,e)=>{var n=Xt(["mspace"],[],e),r=Js(t,e);return n.style.marginRight=dn(r),n},y4=function(e,n,r){var i="";switch(e){case"amsrm":i="AMS";break;case"textrm":i="Main";break;case"textsf":i="SansSerif";break;case"texttt":i="Typewriter";break;default:i=e}var s;return n==="textbf"&&r==="textit"?s="BoldItalic":n==="textbf"?s="Bold":n==="textit"?s="Italic":s="Regular",i+"-"+s},MR={mathbf:{variant:"bold",fontName:"Main-Bold"},mathrm:{variant:"normal",fontName:"Main-Regular"},textit:{variant:"italic",fontName:"Main-Italic"},mathit:{variant:"italic",fontName:"Main-Italic"},mathnormal:{variant:"italic",fontName:"Math-Italic"},mathsfit:{variant:"sans-serif-italic",fontName:"SansSerif-Italic"},mathbb:{variant:"double-struck",fontName:"AMS-Regular"},mathcal:{variant:"script",fontName:"Caligraphic-Regular"},mathfrak:{variant:"fraktur",fontName:"Fraktur-Regular"},mathscr:{variant:"script",fontName:"Script-Regular"},mathsf:{variant:"sans-serif",fontName:"SansSerif-Regular"},mathtt:{variant:"monospace",fontName:"Typewriter-Regular"}},cq={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},uq=function(e,n){var[r,i,s]=cq[e],a=new em(r),o=new hp([a],{width:dn(i),height:dn(s),style:"width:"+dn(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=tm(["overlay"],[o],n);return l.height=s,l.style.height=dn(s),l.style.width=dn(i),l},Zs={number:3,unit:"mu"},og={number:4,unit:"mu"},Vh={number:5,unit:"mu"},R1e={mord:{mop:Zs,mbin:og,mrel:Vh,minner:Zs},mop:{mord:Zs,mop:Zs,mrel:Vh,minner:Zs},mbin:{mord:og,mop:og,mopen:og,minner:og},mrel:{mord:Vh,mop:Vh,mopen:Vh,minner:Vh},mopen:{},mclose:{mop:Zs,mbin:og,mrel:Vh,minner:Zs},mpunct:{mord:Zs,mop:Zs,mrel:Vh,mopen:Zs,mclose:Zs,mpunct:Zs,minner:Zs},minner:{mord:Zs,mop:Zs,mbin:og,mrel:Vh,mopen:Zs,mpunct:Zs,minner:Zs}},k1e={mord:{mop:Zs},mop:{mord:Zs,mop:Zs},mbin:{},mrel:{},mopen:{},mclose:{mop:Zs},mpunct:{},minner:{mop:Zs}},dq={},E2={},C2={};function _n(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:i},l=0;l<n.length;++l)dq[n[l]]=o;e&&(s&&(E2[e]=s),a&&(C2[e]=a))}function Mv(t){var{type:e,htmlBuilder:n,mathmlBuilder:r}=t;_n({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var A2=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},Ta=function(e){return e.type==="ordgroup"?e.body:[e]},P1e=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),I1e=new Set(["rightmost","mrel","mclose","mpunct"]),D1e={display:hr.DISPLAY,text:hr.TEXT,script:hr.SCRIPT,scriptscript:hr.SCRIPTSCRIPT},O1e={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},so=function(e,n,r,i){i===void 0&&(i=[null,null]);for(var s=[],a=0;a<e.length;a++){var o=xi(e[a],n);if(o instanceof hw){var l=o.children;s.push(...l)}else s.push(o)}if(oq(s),!r)return s;var c=n;if(e.length===1){var d=e[0];d.type==="sizing"?c=n.havingSize(d.size):d.type==="styling"&&(c=n.havingStyle(D1e[d.style]))}var h=Xt([i[0]||"leftmost"],[],n),g=Xt([i[1]||"rightmost"],[],n),v=r==="root";return mL(s,(b,_)=>{var w=_.classes[0],S=b.classes[0];w==="mbin"&&I1e.has(S)?_.classes[0]="mord":S==="mbin"&&P1e.has(w)&&(b.classes[0]="mord")},{node:h},g,v),mL(s,(b,_)=>{var w=TR(_),S=TR(b),E=w&&S?b.hasClass("mtight")?k1e[w][S]:R1e[w][S]:null;if(E)return lq(E,c)},{node:h},g,v),s},mL=function t(e,n,r,i,s){i&&e.push(i);for(var a=0;a<e.length;a++){var o=e[a],l=fq(o);if(l){t(l.children,n,r,null,s);continue}var c=!o.hasClass("mspace");if(c){var d=n(o,r.node);d&&(r.insertAfter?r.insertAfter(d):(e.unshift(d),a++))}c?r.node=o:s&&o.hasClass("newline")&&(r.node=Xt(["leftmost"])),r.insertAfter=(h=>g=>{e.splice(h+1,0,g),a++})(a)}i&&e.pop()},fq=function(e){return e instanceof hw||e instanceof bk||e instanceof pw&&e.hasClass("enclosing")?e:null},L1e=function t(e,n){var r=fq(e);if(r){var i=r.children;if(i.length){if(n==="right")return t(i[i.length-1],"right");if(n==="left")return t(i[0],"left")}}return e},TR=function(e,n){return e?(n&&(e=L1e(e,n)),O1e[e.classes[0]]||null):null},gS=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return Xt(n.concat(r))},xi=function(e,n,r){if(!e)return Xt();if(E2[e.type]){var i=E2[e.type](e,n);if(r&&n.size!==r.size){i=Xt(n.sizingClasses(r),[i],n);var s=n.sizeMultiplier/r.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new Qt("Got group of unknown type: '"+e.type+"'")};function b4(t,e){var n=Xt(["base"],t,e),r=Xt(["strut"]);return r.style.height=dn(n.height+n.depth),n.depth&&(r.style.verticalAlign=dn(-n.depth)),n.children.unshift(r),n}function ER(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=so(t,e,"root"),i;r.length===2&&r[1].hasClass("tag")&&(i=r.pop());for(var s=[],a=[],o=0;o<r.length;o++)if(a.push(r[o]),r[o].hasClass("mbin")||r[o].hasClass("mrel")||r[o].hasClass("allowbreak")){for(var l=!1;o<r.length-1&&r[o+1].hasClass("mspace")&&!r[o+1].hasClass("newline");)o++,a.push(r[o]),r[o].hasClass("nobreak")&&(l=!0);l||(s.push(b4(a,e)),a=[])}else r[o].hasClass("newline")&&(a.pop(),a.length>0&&(s.push(b4(a,e)),a=[]),s.push(r[o]));a.length>0&&s.push(b4(a,e));var c;n?(c=b4(so(n,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var d=Xt(["katex-html"],s);if(d.setAttribute("aria-hidden","true"),c){var h=c.children[0];h.style.height=dn(d.height+d.depth),d.depth&&(h.style.verticalAlign=dn(-d.depth))}return d}function hq(t){return new hw(t)}class Jt{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=J0(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Ha&&this.children[r+1]instanceof Ha){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Ha;)i+=this.children[++r].toText();e.appendChild(new Ha(i).toNode())}else e.appendChild(this.children[r].toNode());return e}toMarkup(){var e="<"+this.type;for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&(e+=" "+n+'="',e+=dl(this.attributes[n]),e+='"');this.classes.length>0&&(e+=' class ="'+dl(J0(this.classes))+'"'),e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</"+this.type+">",e}toText(){return this.children.map(e=>e.toText()).join("")}}class Ha{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return dl(this.toText())}toText(){return this.text}}class pq{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",dn(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+dn(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var z1e=new Set(["\\imath","\\jmath"]),j1e=new Set(["mrow","mtable"]),Yu=function(e,n,r){return hs[n][e]&&hs[n][e].replace&&e.charCodeAt(0)!==55349&&!(aq.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=hs[n][e].replace),new Ha(e)},wk=function(e){return e.length===1?e[0]:new Jt("mrow",e)},Mk=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var i=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var s=e.text;if(z1e.has(s))return null;hs[i][s]&&hs[i][s].replace&&(s=hs[i][s].replace);var a=MR[r].fontName;return yk(s,a,i)?MR[r].variant:null};function _A(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Ha&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof Ha&&n.text===","}else return!1}var Nc=function(e,n,r){if(e.length===1){var i=is(e[0],n);return r&&i instanceof Jt&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],a,o=0;o<e.length;o++){var l=is(e[o],n);if(l instanceof Jt&&a instanceof Jt){if(l.type==="mtext"&&a.type==="mtext"&&l.getAttribute("mathvariant")===a.getAttribute("mathvariant")){a.children.push(...l.children);continue}else if(l.type==="mn"&&a.type==="mn"){a.children.push(...l.children);continue}else if(_A(l)&&a.type==="mn"){a.children.push(...l.children);continue}else if(l.type==="mn"&&_A(a))l.children=[...a.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(a.type==="mn"||_A(a))){var c=l.children[0];c instanceof Jt&&c.type==="mn"&&(c.children=[...a.children,...c.children],s.pop())}else if(a.type==="mi"&&a.children.length===1){var d=a.children[0];if(d instanceof Ha&&d.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var h=l.children[0];h instanceof Ha&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),s.pop())}}}s.push(l),a=l}return s},nm=function(e,n,r){return wk(Nc(e,n,r))},is=function(e,n){if(!e)return new Jt("mrow");if(C2[e.type]){var r=C2[e.type](e,n);return r}else throw new Qt("Got group of unknown type: '"+e.type+"'")};function gL(t,e,n,r,i){var s=Nc(t,n),a;s.length===1&&s[0]instanceof Jt&&j1e.has(s[0].type)?a=s[0]:a=new Jt("mrow",s);var o=new Jt("annotation",[new Ha(e)]);o.setAttribute("encoding","application/x-tex");var l=new Jt("semantics",[a,o]),c=new Jt("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var d=i?"katex":"katex-mathml";return Xt([d],[c])}var mq=function(e){return new Qh({style:e.displayMode?hr.DISPLAY:hr.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},gq=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=Xt(r,[e])}return e},F1e=function(e,n,r){var i=mq(r),s;if(r.output==="mathml")return gL(e,n,i,r.displayMode,!0);if(r.output==="html"){var a=ER(e,i);s=Xt(["katex"],[a])}else{var o=gL(e,n,i,r.displayMode,!1),l=ER(e,i);s=Xt(["katex"],[o,l])}return gq(s,r)},U1e=function(e,n,r){var i=mq(r),s=ER(e,i),a=Xt(["katex"],[s]);return gq(a,r)},B1e={widehat:"^",widecheck:"ˇ",widetilde:"~",utilde:"~",overleftarrow:"←",underleftarrow:"←",xleftarrow:"←",overrightarrow:"→",underrightarrow:"→",xrightarrow:"→",underbrace:"⏟",overbrace:"⏞",overgroup:"⏠",undergroup:"⏡",overleftrightarrow:"↔",underleftrightarrow:"↔",xleftrightarrow:"↔",Overrightarrow:"⇒",xRightarrow:"⇒",overleftharpoon:"↼",xleftharpoonup:"↼",overrightharpoon:"⇀",xrightharpoonup:"⇀",xLeftarrow:"⇐",xLeftrightarrow:"⇔",xhookleftarrow:"↩",xhookrightarrow:"↪",xmapsto:"↦",xrightharpoondown:"⇁",xleftharpoondown:"↽",xrightleftharpoons:"⇌",xleftrightharpoons:"⇋",xtwoheadleftarrow:"↞",xtwoheadrightarrow:"↠",xlongequal:"=",xtofrom:"⇄",xrightleftarrows:"⇄",xrightequilibrium:"⇌",xleftequilibrium:"⇋","\\cdrightarrow":"→","\\cdleftarrow":"←","\\cdlongequal":"="},zT=function(e){var n=new Jt("mo",[new Ha(B1e[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},H1e={overrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],overleftarrow:[["leftarrow"],.888,522,"xMinYMin"],underrightarrow:[["rightarrow"],.888,522,"xMaxYMin"],underleftarrow:[["leftarrow"],.888,522,"xMinYMin"],xrightarrow:[["rightarrow"],1.469,522,"xMaxYMin"],"\\cdrightarrow":[["rightarrow"],3,522,"xMaxYMin"],xleftarrow:[["leftarrow"],1.469,522,"xMinYMin"],"\\cdleftarrow":[["leftarrow"],3,522,"xMinYMin"],Overrightarrow:[["doublerightarrow"],.888,560,"xMaxYMin"],xRightarrow:[["doublerightarrow"],1.526,560,"xMaxYMin"],xLeftarrow:[["doubleleftarrow"],1.526,560,"xMinYMin"],overleftharpoon:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoonup:[["leftharpoon"],.888,522,"xMinYMin"],xleftharpoondown:[["leftharpoondown"],.888,522,"xMinYMin"],overrightharpoon:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoonup:[["rightharpoon"],.888,522,"xMaxYMin"],xrightharpoondown:[["rightharpoondown"],.888,522,"xMaxYMin"],xlongequal:[["longequal"],.888,334,"xMinYMin"],"\\cdlongequal":[["longequal"],3,334,"xMinYMin"],xtwoheadleftarrow:[["twoheadleftarrow"],.888,334,"xMinYMin"],xtwoheadrightarrow:[["twoheadrightarrow"],.888,334,"xMaxYMin"],overleftrightarrow:[["leftarrow","rightarrow"],.888,522],overbrace:[["leftbrace","midbrace","rightbrace"],1.6,548],underbrace:[["leftbraceunder","midbraceunder","rightbraceunder"],1.6,548],underleftrightarrow:[["leftarrow","rightarrow"],.888,522],xleftrightarrow:[["leftarrow","rightarrow"],1.75,522],xLeftrightarrow:[["doubleleftarrow","doublerightarrow"],1.75,560],xrightleftharpoons:[["leftharpoondownplus","rightharpoonplus"],1.75,716],xleftrightharpoons:[["leftharpoonplus","rightharpoondownplus"],1.75,716],xhookleftarrow:[["leftarrow","righthook"],1.08,522],xhookrightarrow:[["lefthook","rightarrow"],1.08,522],overlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],underlinesegment:[["leftlinesegment","rightlinesegment"],.888,522],overgroup:[["leftgroup","rightgroup"],.888,342],undergroup:[["leftgroupunder","rightgroupunder"],.888,342],xmapsto:[["leftmapsto","rightarrow"],1.5,522],xtofrom:[["leftToFrom","rightToFrom"],1.75,528],xrightleftarrows:[["baraboveleftarrow","rightarrowabovebar"],1.75,901],xrightequilibrium:[["baraboveshortleftharpoon","rightharpoonaboveshortbar"],1.75,716],xleftequilibrium:[["shortbaraboveleftharpoon","shortrightharpoonabovebar"],1.75,716]},V1e=new Set(["widehat","widecheck","widetilde","utilde"]),jT=function(e,n){function r(){var o=4e5,l=e.label.slice(1);if(V1e.has(l)){var c=e,d=c.base.type==="ordgroup"?c.base.body.length:1,h,g,v;if(d>5)l==="widehat"||l==="widecheck"?(h=420,o=2364,v=.42,g=l+"4"):(h=312,o=2340,v=.34,g="tilde4");else{var b=[1,1,2,2,3,3][d];l==="widehat"||l==="widecheck"?(o=[0,1062,2364,2364,2364][b],h=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],g=l+b):(o=[0,600,1033,2339,2340][b],h=[0,260,286,306,312][b],v=[0,.26,.286,.3,.306,.34][b],g="tilde"+b)}var _=new em(g),w=new hp([_],{width:"100%",height:dn(v),viewBox:"0 0 "+o+" "+h,preserveAspectRatio:"none"});return{span:tm([],[w],n),minWidth:0,height:v}}else{var S=[],E=H1e[l],[A,N,D]=E,P=D/1e3,L=A.length,R,O;if(L===1){var W=E[3];R=["hide-tail"],O=[W]}else if(L===2)R=["halfarrow-left","halfarrow-right"],O=["xMinYMin","xMaxYMin"];else if(L===3)R=["brace-left","brace-center","brace-right"],O=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+L+" children.");for(var F=0;F<L;F++){var V=new em(A[F]),G=new hp([V],{width:"400em",height:dn(P),viewBox:"0 0 "+o+" "+D,preserveAspectRatio:O[F]+" slice"}),Z=tm([R[F]],[G],n);if(L===1)return{span:Z,minWidth:N,height:P};Z.style.height=dn(P),S.push(Z)}return{span:Xt(["stretchy"],S,n),minWidth:N,height:P}}}var{span:i,minWidth:s,height:a}=r();return i.height=a,i.style.height=dn(a),s>0&&(i.style.minWidth=dn(s)),i},G1e=function(e,n,r,i,s){var a,o=e.height+e.depth+r+i;if(/fbox|color|angl/.test(n)){if(a=Xt(["stretchy",n],[],s),n==="fbox"){var l=s.color&&s.getColor();l&&(a.style.borderColor=l)}}else{var c=[];/^[bx]cancel$/.test(n)&&c.push(new SR({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new SR({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var d=new hp(c,{width:"100%",height:dn(o)});a=tm([],[d],s)}return a.height=o,a.style.height=dn(o),a};function Pr(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function Tk(t){var e=FT(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function FT(t){return t&&(t.type==="atom"||M1e.hasOwnProperty(t.type))?t:null}var Ek=(t,e)=>{var n,r,i;t&&t.type==="supsub"?(r=Pr(t.base,"accent"),n=r.base,t.base=n,i=S1e(xi(t,e)),t.base=r):(r=Pr(t,"accent"),n=r.base);var s=xi(n,e.havingCrampedStyle()),a=r.isShifty&&bp(n),o=0;if(a){var l=I_(n),c=xi(l,e.havingCrampedStyle());o=cL(c).skew}var d=r.label==="\\c",h=d?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),g;if(r.isStretchy)g=jT(r,e),g=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+dn(2*o)+")",marginLeft:dn(2*o)}:void 0}]});else{var v,b;r.label==="\\vec"?(v=uq("vec",e),b=cq.vec[1]):(v=LT({mode:r.mode,text:r.label},e,"textord"),v=cL(v),v.italic=0,b=v.width,d&&(h+=v.depth)),g=Xt(["accent-body"],[v]);var _=r.label==="\\textcircled";_&&(g.classes.push("accent-full"),h=s.height);var w=o;_||(w-=b/2),g.style.left=dn(w),r.label==="\\textcircled"&&(g.style.top=".2em"),g=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-h},{type:"elem",elem:g}]})}var S=Xt(["mord","accent"],[g],e);return i?(i.children[0]=S,i.height=Math.max(S.height,i.height),i.classes[0]="mord",i):S},vq=(t,e)=>{var n=t.isStretchy?zT(t.label):new Jt("mo",[Yu(t.label,t.mode)]),r=new Jt("mover",[is(t.base,e),n]);return r.setAttribute("accent","true"),r},W1e=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));_n({type:"accent",names:["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring","\\widecheck","\\widehat","\\widetilde","\\overrightarrow","\\overleftarrow","\\Overrightarrow","\\overleftrightarrow","\\overgroup","\\overlinesegment","\\overleftharpoon","\\overrightharpoon"],props:{numArgs:1},handler:(t,e)=>{var n=A2(e[0]),r=!W1e.test(t.funcName),i=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:Ek,mathmlBuilder:vq});_n({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:Ek,mathmlBuilder:vq});_n({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:i}},htmlBuilder:(t,e)=>{var n=xi(t.base,e),r=jT(t,e),i=t.label==="\\utilde"?.12:0,s=Mi({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]});return Xt(["mord","accentunder"],[s],e)},mathmlBuilder:(t,e)=>{var n=zT(t.label),r=new Jt("munder",[is(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var _4=t=>{var e=new Jt("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};_n({type:"xArrow",names:["\\xleftarrow","\\xrightarrow","\\xLeftarrow","\\xRightarrow","\\xleftrightarrow","\\xLeftrightarrow","\\xhookleftarrow","\\xhookrightarrow","\\xmapsto","\\xrightharpoondown","\\xrightharpoonup","\\xleftharpoondown","\\xleftharpoonup","\\xrightleftharpoons","\\xleftrightharpoons","\\xlongequal","\\xtwoheadrightarrow","\\xtwoheadleftarrow","\\xtofrom","\\xrightleftarrows","\\xrightequilibrium","\\xleftequilibrium","\\\\cdrightarrow","\\\\cdleftarrow","\\\\cdlongequal"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r,funcName:i}=t;return{type:"xArrow",mode:r.mode,label:i,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),i=ty(xi(t.body,r,e),e),s=t.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var a;t.below&&(r=e.havingStyle(n.sub()),a=ty(xi(t.below,r,e),e),a.classes.push(s+"-arrow-pad"));var o=jT(t,e),l=-e.fontMetrics().axisHeight+.5*o.height,c=-e.fontMetrics().axisHeight-.5*o.height-.111;(i.depth>.25||t.label==="\\xleftequilibrium")&&(c-=i.depth);var d;if(a){var h=-e.fontMetrics().axisHeight+a.height+.5*o.height+.111;d=Mi({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:o,shift:l},{type:"elem",elem:a,shift:h}]})}else d=Mi({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:o,shift:l}]});return d.children[0].children[0].children[1].classes.push("svg-align"),Xt(["mrel","x-arrow"],[d],e)},mathmlBuilder(t,e){var n=zT(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var i=_4(is(t.body,e));if(t.below){var s=_4(is(t.below,e));r=new Jt("munderover",[n,s,i])}else r=new Jt("mover",[n,i])}else if(t.below){var a=_4(is(t.below,e));r=new Jt("munder",[n,a])}else r=_4(),r=new Jt("mover",[n,r]);return r}});function xq(t,e){var n=so(t.body,e,!0);return Xt([t.mclass],n,e)}function yq(t,e){var n,r=Nc(t.body,e);return t.mclass==="minner"?n=new Jt("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Jt("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Jt("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}_n({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:Ta(i),isCharacterBox:bp(i)}},htmlBuilder:xq,mathmlBuilder:yq});var UT=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};_n({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:UT(e[0]),body:Ta(e[1]),isCharacterBox:bp(e[1])}}});_n({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,i=e[1],s=e[0],a;r!=="\\stackrel"?a=UT(i):a="mrel";var o={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Ta(i)},l={type:"supsub",mode:s.mode,base:o,sup:r==="\\underset"?null:s,sub:r==="\\underset"?s:null};return{type:"mclass",mode:n.mode,mclass:a,body:[l],isCharacterBox:bp(l)}},htmlBuilder:xq,mathmlBuilder:yq});_n({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:UT(e[0]),body:Ta(e[0])}},htmlBuilder(t,e){var n=so(t.body,e,!0),r=Xt([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Nc(t.body,e),r=new Jt("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var $1e={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},vL=()=>({type:"styling",body:[],mode:"math",style:"display"}),xL=t=>t.type==="textord"&&t.text==="@",q1e=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function X1e(t,e,n){var r=$1e[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var i=n.callFunction("\\\\cdleft",[e[0]],[]),s={type:"atom",text:r,mode:"math",family:"rel"},a=n.callFunction("\\Big",[s],[]),o=n.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,a,o]};return n.callFunction("\\\\cdparent",[l],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var c={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[c],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Y1e(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new Qt("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var a=e[s],o=vL(),l=0;l<a.length;l++)if(!xL(a[l]))o.body.push(a[l]);else{r.push(o),l+=1;var c=Tk(a[l]).text,d=new Array(2);if(d[0]={type:"ordgroup",mode:"math",body:[]},d[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var h=0;h<2;h++){for(var g=!0,v=l+1;v<a.length;v++){if(q1e(a[v],c)){g=!1,l=v;break}if(xL(a[v]))throw new Qt("Missing a "+c+" character to complete a CD arrow.",a[v]);d[h].body.push(a[v])}if(g)throw new Qt("Missing a "+c+" character to complete a CD arrow.",a[l])}else throw new Qt('Expected one of "<>AV=|." after @',a[l]);var b=X1e(c,d,t),_={type:"styling",body:[b],mode:"math",style:"display"};r.push(_),o=vL()}s%2===0?r.push(o):r.shift(),r=[],i.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var w=new Array(i[0].length).fill({type:"align",align:"c",pregap:.25,postgap:.25});return{type:"array",mode:"math",body:i,arraystretch:1,addJot:!0,rowGaps:[null],cols:w,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}_n({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=ty(xi(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=dn(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Jt("mrow",[is(t.label,e)]);return n=new Jt("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Jt("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});_n({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=ty(xi(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Jt("mrow",[is(t.fragment,e)])}});_n({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Pr(e[0],"ordgroup"),i=r.body,s="",a=0;a<i.length;a++){var o=Pr(i[a],"textord");s+=o.text}var l=parseInt(s),c;if(isNaN(l))throw new Qt("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new Qt("\\@char with invalid code point "+s);return l<=65535?c=String.fromCharCode(l):(l-=65536,c=String.fromCharCode((l>>10)+55296,(l&1023)+56320)),{type:"textord",mode:n.mode,text:c}}});var bq=(t,e)=>{var n=so(t.body,e.withColor(t.color),!1);return Sp(n)},_q=(t,e)=>{var n=Nc(t.body,e.withColor(t.color)),r=new Jt("mstyle",n);return r.setAttribute("mathcolor",t.color),r};_n({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Pr(e[0],"color-token").color,i=e[1];return{type:"color",mode:n.mode,color:r,body:Ta(i)}},htmlBuilder:bq,mathmlBuilder:_q});_n({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,i=Pr(e[0],"color-token").color;n.gullet.macros.set("\\current@color",i);var s=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:i,body:s}},htmlBuilder:bq,mathmlBuilder:_q});_n({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,i=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,s=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:s,size:i&&Pr(i,"size").value}},htmlBuilder(t,e){var n=Xt(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=dn(Js(t.size,e)))),n},mathmlBuilder(t,e){var n=new Jt("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",dn(Js(t.size,e)))),n}});var CR={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},Sq=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new Qt("Expected a control sequence",t);return e},K1e=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},wq=(t,e,n,r)=>{var i=t.gullet.macros.get(n.text);i==null&&(n.noexpand=!0,i={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,i,r)};_n({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(CR[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=CR[r.text]),Pr(e.parseFunction(),"internal");throw new Qt("Invalid token after macro prefix",r)}});_n({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),i=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(i))throw new Qt("Expected a control sequence",r);for(var s=0,a,o=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),o[s].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Qt('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new Qt('Argument number "'+r.text+'" out of order');s++,o.push([])}else{if(r.text==="EOF")throw new Qt("Expected a macro definition");o[s].push(r.text)}var{tokens:l}=e.gullet.consumeArg();return a&&l.unshift(a),(n==="\\edef"||n==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:o},n===CR[n]),{type:"internal",mode:e.mode}}});_n({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=Sq(e.gullet.popToken());e.gullet.consumeSpaces();var i=K1e(e);return wq(e,r,i,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});_n({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=Sq(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return wq(e,r,s,n==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var y_=function(e,n,r){var i=hs.math[e]&&hs.math[e].replace,s=yk(i||e,n,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return s},Ck=function(e,n,r,i){var s=r.havingBaseStyle(n),a=Xt(i.concat(s.sizingClasses(r)),[e],r),o=s.sizeMultiplier/r.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=s.sizeMultiplier,a},Mq=function(e,n,r){var i=n.havingBaseStyle(r),s=(1-n.sizeMultiplier/i.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=dn(s),e.height-=s,e.depth+=s},Z1e=function(e,n,r,i,s,a){var o=Ll(e,"Main-Regular",s,i),l=Ck(o,n,i,a);return Mq(l,i,n),l},Q1e=function(e,n,r,i){return Ll(e,"Size"+n+"-Regular",r,i)},Tq=function(e,n,r,i,s,a){var o=Q1e(e,n,s,i),l=Ck(Xt(["delimsizing","size"+n],[o],i),hr.TEXT,i,a);return r&&Mq(l,i,hr.TEXT),l},SA=function(e,n,r){var i;n==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=Xt(["delimsizinginner",i],[Xt([],[Ll(e,n,r)])]);return{type:"elem",elem:s}},wA=function(e,n,r){var i=Yf["Size4-Regular"][e.charCodeAt(0)]?Yf["Size4-Regular"][e.charCodeAt(0)][4]:Yf["Size1-Regular"][e.charCodeAt(0)][4],s=new em("inner",h1e(e,Math.round(1e3*n))),a=new hp([s],{width:dn(i),height:dn(n),style:"width:"+dn(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),o=tm([],[a],r);return o.height=n,o.style.height=dn(n),o.style.width=dn(i),{type:"elem",elem:o}},AR=.008,S4={type:"kern",size:-1*AR},J1e=new Set(["|","\\lvert","\\rvert","\\vert"]),eye=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),Eq=function(e,n,r,i,s,a){var o,l,c,d,h="",g=0;o=c=d=e,l=null;var v="Size1-Regular";e==="\\uparrow"?c=d="⏐":e==="\\Uparrow"?c=d="‖":e==="\\downarrow"?o=c="⏐":e==="\\Downarrow"?o=c="‖":e==="\\updownarrow"?(o="\\uparrow",c="⏐",d="\\downarrow"):e==="\\Updownarrow"?(o="\\Uparrow",c="‖",d="\\Downarrow"):J1e.has(e)?(c="∣",h="vert",g=333):eye.has(e)?(c="∥",h="doublevert",g=556):e==="["||e==="\\lbrack"?(o="⎡",c="⎢",d="⎣",v="Size4-Regular",h="lbrack",g=667):e==="]"||e==="\\rbrack"?(o="⎤",c="⎥",d="⎦",v="Size4-Regular",h="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(c=o="⎢",d="⎣",v="Size4-Regular",h="lfloor",g=667):e==="\\lceil"||e==="⌈"?(o="⎡",c=d="⎢",v="Size4-Regular",h="lceil",g=667):e==="\\rfloor"||e==="⌋"?(c=o="⎥",d="⎦",v="Size4-Regular",h="rfloor",g=667):e==="\\rceil"||e==="⌉"?(o="⎤",c=d="⎥",v="Size4-Regular",h="rceil",g=667):e==="("||e==="\\lparen"?(o="⎛",c="⎜",d="⎝",v="Size4-Regular",h="lparen",g=875):e===")"||e==="\\rparen"?(o="⎞",c="⎟",d="⎠",v="Size4-Regular",h="rparen",g=875):e==="\\{"||e==="\\lbrace"?(o="⎧",l="⎨",d="⎩",c="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(o="⎫",l="⎬",d="⎭",c="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(o="⎧",d="⎩",c="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(o="⎫",d="⎭",c="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(o="⎧",d="⎭",c="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(o="⎫",d="⎩",c="⎪",v="Size4-Regular");var b=y_(o,v,s),_=b.height+b.depth,w=y_(c,v,s),S=w.height+w.depth,E=y_(d,v,s),A=E.height+E.depth,N=0,D=1;if(l!==null){var P=y_(l,v,s);N=P.height+P.depth,D=2}var L=_+A+N,R=Math.max(0,Math.ceil((n-L)/(D*S))),O=L+R*D*S,W=i.fontMetrics().axisHeight;r&&(W*=i.sizeMultiplier);var F=O/2-W,V=[];if(h.length>0){var G=O-_-A,Z=Math.round(O*1e3),B=p1e(h,Math.round(G*1e3)),q=new em(h,B),K=(g/1e3).toFixed(3)+"em",Y=(Z/1e3).toFixed(3)+"em",Q=new hp([q],{width:K,height:Y,viewBox:"0 0 "+g+" "+Z}),U=tm([],[Q],i);U.height=Z/1e3,U.style.width=K,U.style.height=Y,V.push({type:"elem",elem:U})}else{if(V.push(SA(d,v,s)),V.push(S4),l===null){var j=O-_-A+2*AR;V.push(wA(c,j,i))}else{var X=(O-_-A-N)/2+2*AR;V.push(wA(c,X,i)),V.push(S4),V.push(SA(l,v,s)),V.push(S4),V.push(wA(c,X,i))}V.push(S4),V.push(SA(o,v,s))}var H=i.havingBaseStyle(hr.TEXT),ie=Mi({positionType:"bottom",positionData:F,children:V});return Ck(Xt(["delimsizing","mult"],[ie],H),hr.TEXT,i,a)},MA=80,TA=.08,EA=function(e,n,r,i,s){var a=f1e(e,i,r),o=new em(e,a),l=new hp([o],{width:"400em",height:dn(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return tm(["hide-tail"],[l],s)},tye=function(e,n){var r=n.havingBaseSizing(),i=kq("\\surd",e*r.sizeMultiplier,Rq,r),s=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),o,l=0,c=0,d=0,h;return i.type==="small"?(d=1e3+1e3*a+MA,e<1?s=1:e<1.4&&(s=.7),l=(1+a+TA)/s,c=(1+a)/s,o=EA("sqrtMain",l,d,a,n),o.style.minWidth="0.853em",h=.833/s):i.type==="large"?(d=(1e3+MA)*D_[i.size],c=(D_[i.size]+a)/s,l=(D_[i.size]+a+TA)/s,o=EA("sqrtSize"+i.size,l,d,a,n),o.style.minWidth="1.02em",h=1/s):(l=e+a+TA,c=e+a,d=Math.floor(1e3*e+a)+MA,o=EA("sqrtTall",l,d,a,n),o.style.minWidth="0.742em",h=1.056),o.height=c,o.style.height=dn(l),{span:o,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*s}},Cq=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),nye=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),Aq=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),D_=[0,1.2,1.8,2.4,3],Nq=function(e,n,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),Cq.has(e)||Aq.has(e))return Tq(e,n,!1,r,i,s);if(nye.has(e))return Eq(e,D_[n],!1,r,i,s);throw new Qt("Illegal delimiter: '"+e+"'")},rye=[{type:"small",style:hr.SCRIPTSCRIPT},{type:"small",style:hr.SCRIPT},{type:"small",style:hr.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],iye=[{type:"small",style:hr.SCRIPTSCRIPT},{type:"small",style:hr.SCRIPT},{type:"small",style:hr.TEXT},{type:"stack"}],Rq=[{type:"small",style:hr.SCRIPTSCRIPT},{type:"small",style:hr.SCRIPT},{type:"small",style:hr.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],sye=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},kq=function(e,n,r,i){for(var s=Math.min(2,3-i.style.size),a=s;a<r.length&&r[a].type!=="stack";a++){var o=y_(e,sye(r[a]),"math"),l=o.height+o.depth;if(r[a].type==="small"){var c=i.havingBaseStyle(r[a].style);l*=c.sizeMultiplier}if(l>n)return r[a]}return r[r.length-1]},NR=function(e,n,r,i,s,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var o;Aq.has(e)?o=rye:Cq.has(e)?o=Rq:o=iye;var l=kq(e,n,o,i);return l.type==="small"?Z1e(e,l.style,r,i,s,a):l.type==="large"?Tq(e,l.size,r,i,s,a):Eq(e,n,r,i,s,a)},CA=function(e,n,r,i,s,a){var o=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,c=5/i.fontMetrics().ptPerEm,d=Math.max(n-o,r+o),h=Math.max(d/500*l,2*d-c);return NR(e,h,!0,i,s,a)},yL={"\\bigl":{mclass:"mopen",size:1},"\\Bigl":{mclass:"mopen",size:2},"\\biggl":{mclass:"mopen",size:3},"\\Biggl":{mclass:"mopen",size:4},"\\bigr":{mclass:"mclose",size:1},"\\Bigr":{mclass:"mclose",size:2},"\\biggr":{mclass:"mclose",size:3},"\\Biggr":{mclass:"mclose",size:4},"\\bigm":{mclass:"mrel",size:1},"\\Bigm":{mclass:"mrel",size:2},"\\biggm":{mclass:"mrel",size:3},"\\Biggm":{mclass:"mrel",size:4},"\\big":{mclass:"mord",size:1},"\\Big":{mclass:"mord",size:2},"\\bigg":{mclass:"mord",size:3},"\\Bigg":{mclass:"mord",size:4}},aye=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","<",">","\\langle","⟨","\\rangle","⟩","\\lt","\\gt","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱","/","\\backslash","|","\\vert","\\|","\\Vert","\\uparrow","\\Uparrow","\\downarrow","\\Downarrow","\\updownarrow","\\Updownarrow","."]);function BT(t,e){var n=FT(t);if(n&&aye.has(n.text))return n;throw n?new Qt("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new Qt("Invalid delimiter type '"+t.type+"'",t)}_n({type:"delimsizing",names:["\\bigl","\\Bigl","\\biggl","\\Biggl","\\bigr","\\Bigr","\\biggr","\\Biggr","\\bigm","\\Bigm","\\biggm","\\Biggm","\\big","\\Big","\\bigg","\\Bigg"],props:{numArgs:1,argTypes:["primitive"]},handler:(t,e)=>{var n=BT(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:yL[t.funcName].size,mclass:yL[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?Xt([t.mclass]):Nq(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Yu(t.delim,t.mode));var n=new Jt("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=dn(D_[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function bL(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}_n({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Qt("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:BT(e[0],t).text,color:n}}});_n({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=BT(e[0],t),r=t.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=Pr(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:s.delim,rightColor:s.color}},htmlBuilder:(t,e)=>{bL(t);for(var n=so(t.body,e,!0,["mopen","mclose"]),r=0,i=0,s=!1,a=0;a<n.length;a++)n[a].isMiddle?s=!0:(r=Math.max(n[a].height,r),i=Math.max(n[a].depth,i));r*=e.sizeMultiplier,i*=e.sizeMultiplier;var o;if(t.left==="."?o=gS(e,["mopen"]):o=CA(t.left,r,i,e,t.mode,["mopen"]),n.unshift(o),s)for(var l=1;l<n.length;l++){var c=n[l],d=c.isMiddle;d&&(n[l]=CA(d.delim,r,i,d.options,t.mode,[]))}var h;if(t.right===".")h=gS(e,["mclose"]);else{var g=t.rightColor?e.withColor(t.rightColor):e;h=CA(t.right,r,i,g,t.mode,["mclose"])}return n.push(h),Xt(["minner"],n,e)},mathmlBuilder:(t,e)=>{bL(t);var n=Nc(t.body,e);if(t.left!=="."){var r=new Jt("mo",[Yu(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var i=new Jt("mo",[Yu(t.right,t.mode)]);i.setAttribute("fence","true"),t.rightColor&&i.setAttribute("mathcolor",t.rightColor),n.push(i)}return wk(n)}});_n({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=BT(e[0],t);if(!t.parser.leftrightDepth)throw new Qt("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=gS(e,[]);else{n=Nq(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?Yu("|","text"):Yu(t.delim,t.mode),r=new Jt("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Ak=(t,e)=>{var n=ty(xi(t.body,e),e),r=t.label.slice(1),i=e.sizeMultiplier,s,a=0,o=bp(t.body);if(r==="sout")s=Xt(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var l=Js({number:.6,unit:"pt"},e),c=Js({number:.35,unit:"ex"},e),d=e.havingBaseSizing();i=i/d.sizeMultiplier;var h=n.height+n.depth+l+c;n.style.paddingLeft=dn(h/2+l);var g=Math.floor(1e3*h*i),v=u1e(g),b=new hp([new em("phase",v)],{width:"400em",height:dn(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});s=tm(["hide-tail"],[b],e),s.style.height=dn(h),a=n.depth+l+c}else{/cancel/.test(r)?o||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var _=0,w=0,S=0;/box/.test(r)?(S=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),_=e.fontMetrics().fboxsep+(r==="colorbox"?0:S),w=_):r==="angl"?(S=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),_=4*S,w=Math.max(0,.25-n.depth)):(_=o?.2:0,w=_),s=G1e(n,r,_,w,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=dn(S)):r==="angl"&&S!==.049&&(s.style.borderTopWidth=dn(S),s.style.borderRightWidth=dn(S)),a=n.depth+w,t.backgroundColor&&(s.style.backgroundColor=t.backgroundColor,t.borderColor&&(s.style.borderColor=t.borderColor))}var E;if(t.backgroundColor)E=Mi({positionType:"individualShift",children:[{type:"elem",elem:s,shift:a},{type:"elem",elem:n,shift:0}]});else{var A=/cancel|phase/.test(r)?["svg-align"]:[];E=Mi({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:s,shift:a,wrapperClasses:A}]})}return/cancel/.test(r)&&(E.height=n.height,E.depth=n.depth),/cancel/.test(r)&&!o?Xt(["mord","cancel-lap"],[E],e):Xt(["mord"],[E],e)},Nk=(t,e)=>{var n=0,r=new Jt(t.label.includes("colorbox")?"mpadded":"menclose",[is(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var i=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+i+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};_n({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Pr(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,body:a}},htmlBuilder:Ak,mathmlBuilder:Nk});_n({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Pr(e[0],"color-token").color,a=Pr(e[1],"color-token").color,o=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:a,borderColor:s,body:o}},htmlBuilder:Ak,mathmlBuilder:Nk});_n({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});_n({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"enclose",mode:n.mode,label:r,body:i}},htmlBuilder:Ak,mathmlBuilder:Nk});_n({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var Pq={};function fh(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<n.length;++l)Pq[n[l]]=o;s&&(E2[e]=s),a&&(C2[e]=a)}var Iq={};function Ie(t,e){Iq[t]=e}function _L(t){var e=[];t.consumeSpaces();var n=t.fetch().text;for(n==="\\relax"&&(t.consume(),t.consumeSpaces(),n=t.fetch().text);n==="\\hline"||n==="\\hdashline";)t.consume(),e.push(n==="\\hdashline"),t.consumeSpaces(),n=t.fetch().text;return e}var HT=t=>{var e=t.parser.settings;if(!e.displayMode)throw new Qt("{"+t.envName+"} can be used only in display mode.")},oye=new Set(["gather","gather*"]);function Rk(t){if(!t.includes("ed"))return!t.includes("*")}function vm(t,e,n){var{hskipBeforeAndAfter:r,addJot:i,cols:s,arraystretch:a,colSeparationType:o,autoTag:l,singleRow:c,emptySingleRow:d,maxNumCols:h,leqno:g}=e;if(t.gullet.beginGroup(),c||t.gullet.macros.set("\\cr","\\\\\\relax"),!a){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)a=1;else if(a=parseFloat(v),!a||a<0)throw new Qt("Invalid \\arraystretch: "+v)}t.gullet.beginGroup();var b=[],_=[b],w=[],S=[],E=l!=null?[]:void 0;function A(){l&&t.gullet.macros.set("\\@eqnsw","1",!0)}function N(){E&&(t.gullet.macros.get("\\df@tag")?(E.push(t.subparse([new tu("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):E.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),S.push(_L(t));;){var D=t.parseExpression(!1,c?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var P=t.fetch().text;if(P==="&"){if(h&&b.length===h){if(c||o)throw new Qt("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(P==="\\end"){N(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(_.length>1||!d)&&_.pop(),S.length<_.length+1&&S.push([]);break}else if(P==="\\\\"){t.consume();var L=void 0;t.gullet.future().text!==" "&&(L=t.parseSizeGroup(!0)),w.push(L?L.value:null),N(),S.push(_L(t)),b=[],_.push(b),A()}else throw new Qt("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:i,arraystretch:a,body:_,cols:s,rowGaps:w,hskipBeforeAndAfter:r,hLinesBeforeRow:S,colSeparationType:o,tags:E,leqno:g}}function kk(t){return t.slice(0,1)==="d"?"display":"text"}var hh=function(e,n){var r,i,s=e.body.length,a=e.hLinesBeforeRow,o=0,l=new Array(s),c=[],d=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),h=1/n.fontMetrics().ptPerEm,g=5*h;if(e.colSeparationType&&e.colSeparationType==="small"){var v=n.havingStyle(hr.SCRIPT).sizeMultiplier;g=.2778*(v/n.sizeMultiplier)}var b=e.colSeparationType==="CD"?Js({number:3,unit:"ex"},n):12*h,_=3*h,w=e.arraystretch*b,S=.7*w,E=.3*w,A=0;function N(Ee){for(var Pe=0;Pe<Ee.length;++Pe)Pe>0&&(A+=.25),c.push({pos:A,isDashed:Ee[Pe]})}for(N(a[0]),r=0;r<e.body.length;++r){var D=e.body[r],P=S,L=E;o<D.length&&(o=D.length);var R=new Array(D.length);for(i=0;i<D.length;++i){var O=xi(D[i],n);L<O.depth&&(L=O.depth),P<O.height&&(P=O.height),R[i]=O}var W=e.rowGaps[r],F=0;W&&(F=Js(W,n),F>0&&(F+=E,L<F&&(L=F),F=0)),e.addJot&&(L+=_),R.height=P,R.depth=L,A+=P,R.pos=A,A+=L+F,l[r]=R,N(a[r+1])}var V=A/2+n.fontMetrics().axisHeight,G=e.cols||[],Z=[],B,q,K=[];if(e.tags&&e.tags.some(Ee=>Ee))for(r=0;r<s;++r){var Y=l[r],Q=Y.pos-V,U=e.tags[r],j=void 0;U===!0?j=Xt(["eqn-num"],[],n):U===!1?j=Xt([],[],n):j=Xt([],so(U,n,!0),n),j.depth=Y.depth,j.height=Y.height,K.push({type:"elem",elem:j,shift:Q})}for(i=0,q=0;i<o||q<G.length;++i,++q){for(var X=G[q]||{},H=!0;X.type==="separator";){if(H||(B=Xt(["arraycolsep"],[]),B.style.width=dn(n.fontMetrics().doubleRuleSep),Z.push(B)),X.separator==="|"||X.separator===":"){var ie=X.separator==="|"?"solid":"dashed",ne=Xt(["vertical-separator"],[],n);ne.style.height=dn(A),ne.style.borderRightWidth=dn(d),ne.style.borderRightStyle=ie,ne.style.margin="0 "+dn(-d/2);var re=A-V;re&&(ne.style.verticalAlign=dn(-re)),Z.push(ne)}else throw new Qt("Invalid separator type: "+X.separator);q++,X=G[q]||{},H=!1}if(!(i>=o)){var ue=void 0;if(i>0||e.hskipBeforeAndAfter){var le;ue=(le=X.pregap)!=null?le:g,ue!==0&&(B=Xt(["arraycolsep"],[]),B.style.width=dn(ue),Z.push(B))}var fe=[];for(r=0;r<s;++r){var we=l[r],pe=we[i];if(pe){var xe=we.pos-V;pe.depth=we.depth,pe.height=we.height,fe.push({type:"elem",elem:pe,shift:xe})}}if(fe=Mi({positionType:"individualShift",children:fe}),fe=Xt(["col-align-"+(X.align||"c")],[fe]),Z.push(fe),i<o-1||e.hskipBeforeAndAfter){var Ve;ue=(Ve=X.postgap)!=null?Ve:g,ue!==0&&(B=Xt(["arraycolsep"],[]),B.style.width=dn(ue),Z.push(B))}}}if(l=Xt(["mtable"],Z),c.length>0){for(var ye=ey("hline",n,d),Oe=ey("hdashline",n,d),he=[{type:"elem",elem:l,shift:0}];c.length>0;){var Re=c.pop(),oe=Re.pos-V;Re.isDashed?he.push({type:"elem",elem:Oe,shift:oe}):he.push({type:"elem",elem:ye,shift:oe})}l=Mi({positionType:"individualShift",children:he})}if(K.length===0)return Xt(["mord"],[l],n);var Ue=Mi({positionType:"individualShift",children:K});return Ue=Xt(["tag"],[Ue],n),Sp([l,Ue])},lye={c:"center ",l:"left ",r:"right "},ph=function(e,n){for(var r=[],i=new Jt("mtd",[],["mtr-glue"]),s=new Jt("mtd",[],["mml-eqn-num"]),a=0;a<e.body.length;a++){for(var o=e.body[a],l=[],c=0;c<o.length;c++)l.push(new Jt("mtd",[is(o[c],n)]));e.tags&&e.tags[a]&&(l.unshift(i),l.push(i),e.leqno?l.unshift(s):l.push(s)),r.push(new Jt("mtr",l))}var d=new Jt("mtable",r),h=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);d.setAttribute("rowspacing",dn(h));var g="",v="";if(e.cols&&e.cols.length>0){var b=e.cols,_="",w=!1,S=0,E=b.length;b[0].type==="separator"&&(g+="top ",S=1),b[b.length-1].type==="separator"&&(g+="bottom ",E-=1);for(var A=S;A<E;A++)b[A].type==="align"?(v+=lye[b[A].align],w&&(_+="none "),w=!0):b[A].type==="separator"&&w&&(_+=b[A].separator==="|"?"solid ":"dashed ",w=!1);d.setAttribute("columnalign",v.trim()),/[sd]/.test(_)&&d.setAttribute("columnlines",_.trim())}if(e.colSeparationType==="align"){for(var N=e.cols||[],D="",P=1;P<N.length;P++)D+=P%2?"0em ":"1em ";d.setAttribute("columnspacing",D.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?d.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?d.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?d.setAttribute("columnspacing","0.5em"):d.setAttribute("columnspacing","1em");var L="",R=e.hLinesBeforeRow;g+=R[0].length>0?"left ":"",g+=R[R.length-1].length>0?"right ":"";for(var O=1;O<R.length-1;O++)L+=R[O].length===0?"none ":R[O][0]?"dashed ":"solid ";return/[sd]/.test(L)&&d.setAttribute("rowlines",L.trim()),g!==""&&(d=new Jt("menclose",[d]),d.setAttribute("notation",g.trim())),e.arraystretch&&e.arraystretch<1&&(d=new Jt("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},Dq=function(e,n){e.envName.includes("ed")||HT(e);var r=[],i=e.envName.includes("at")?"alignat":"align",s=e.envName==="split",a=vm(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:Rk(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),o,l=0,c={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var d="",h=0;h<n[0].body.length;h++){var g=Pr(n[0].body[h],"textord");d+=g.text}o=Number(d),l=o*2}var v=!l;a.body.forEach(function(S){for(var E=1;E<S.length;E+=2){var A=Pr(S[E],"styling"),N=Pr(A.body[0],"ordgroup");N.body.unshift(c)}if(v)l<S.length&&(l=S.length);else{var D=S.length/2;if(o<D)throw new Qt("Too many math in a row: "+("expected "+o+", but got "+D),S[0])}});for(var b=0;b<l;++b){var _="r",w=0;b%2===1?_="l":b>0&&v&&(w=1),r[b]={type:"align",align:_,pregap:w,postgap:0}}return a.colSeparationType=v?"align":"alignat",a};fh({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=FT(e[0]),r=n?[e[0]]:Pr(e[0],"ordgroup").body,i=r.map(function(a){var o=Tk(a),l=o.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new Qt("Unknown column alignment: "+l,a)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return vm(t.parser,s,kk(t.envName))},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var i=t.parser;if(i.consumeSpaces(),i.fetch().text==="["){if(i.consume(),i.consumeSpaces(),n=i.fetch().text,!"lcr".includes(n))throw new Qt("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var s=vm(t.parser,r,kk(t.envName)),a=Math.max(0,...s.body.map(o=>o.length));return s.cols=new Array(a).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=vm(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=FT(e[0]),r=n?[e[0]]:Pr(e[0],"ordgroup").body,i=r.map(function(a){var o=Tk(a),l=o.text;if("lc".includes(l))return{type:"align",align:l};throw new Qt("Unknown column alignment: "+l,a)});if(i.length>1)throw new Qt("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=vm(t.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new Qt("{subarray} can contain only one column");return s},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=vm(t.parser,e,kk(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:Dq,htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){oye.has(t.envName)&&HT(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:Rk(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return vm(t.parser,e,"display")},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:Dq,htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){HT(t);var e={autoTag:Rk(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return vm(t.parser,e,"display")},htmlBuilder:hh,mathmlBuilder:ph});fh({type:"array",names:["CD"],props:{numArgs:0},handler(t){return HT(t),Y1e(t.parser)},htmlBuilder:hh,mathmlBuilder:ph});Ie("\\nonumber","\\gdef\\@eqnsw{0}");Ie("\\notag","\\nonumber");_n({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new Qt(t.funcName+" valid only within array environment")}});var SL=Pq;_n({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];if(i.type!=="ordgroup")throw new Qt("Invalid environment name",i);for(var s="",a=0;a<i.body.length;++a)s+=Pr(i.body[a],"textord").text;if(r==="\\begin"){if(!SL.hasOwnProperty(s))throw new Qt("No such environment: "+s,i);var o=SL[s],{args:l,optArgs:c}=n.parseArguments("\\begin{"+s+"}",o),d={mode:n.mode,envName:s,parser:n},h=o.handler(d,l,c);n.expect("\\end",!1);var g=n.nextToken,v=Pr(n.parseFunction(),"environment");if(v.name!==s)throw new Qt("Mismatch: \\begin{"+s+"} matched by \\end{"+v.name+"}",g);return h}return{type:"environment",mode:n.mode,name:s,nameGroup:i}}});var Oq=(t,e)=>{var n=t.font,r=e.withFont(n);return xi(t.body,r)},Lq=(t,e)=>{var n=t.font,r=e.withFont(n);return is(t.body,r)},wL={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};_n({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=A2(e[0]),s=r;return s in wL&&(s=wL[s]),{type:"font",mode:n.mode,font:s.slice(1),body:i}},htmlBuilder:Oq,mathmlBuilder:Lq});_n({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"mclass",mode:n.mode,mclass:UT(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:bp(r)}}});_n({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:i}=t,{mode:s}=n,a=n.parseExpression(!0,i),o="math"+r.slice(1);return{type:"font",mode:s,font:o,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:Oq,mathmlBuilder:Lq});var cye=(t,e)=>{var n=e.style,r=n.fracNum(),i=n.fracDen(),s;s=e.havingStyle(r);var a=xi(t.numer,s,e);if(t.continued){var o=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;a.height=a.height<o?o:a.height,a.depth=a.depth<l?l:a.depth}s=e.havingStyle(i);var c=xi(t.denom,s,e),d,h,g;t.hasBarLine?(t.barSize?(h=Js(t.barSize,e),d=ey("frac-line",e,h)):d=ey("frac-line",e),h=d.height,g=d.height):(d=null,h=0,g=e.fontMetrics().defaultRuleThickness);var v,b,_;n.size===hr.DISPLAY.size?(v=e.fontMetrics().num1,h>0?b=3*g:b=7*g,_=e.fontMetrics().denom1):(h>0?(v=e.fontMetrics().num2,b=g):(v=e.fontMetrics().num3,b=3*g),_=e.fontMetrics().denom2);var w;if(d){var E=e.fontMetrics().axisHeight;v-a.depth-(E+.5*h)<b&&(v+=b-(v-a.depth-(E+.5*h))),E-.5*h-(c.height-_)<b&&(_+=b-(E-.5*h-(c.height-_)));var A=-(E-.5*h);w=Mi({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:d,shift:A},{type:"elem",elem:a,shift:-v}]})}else{var S=v-a.depth-(c.height-_);S<b&&(v+=.5*(b-S),_+=.5*(b-S)),w=Mi({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:a,shift:-v}]})}s=e.havingStyle(n),w.height*=s.sizeMultiplier/e.sizeMultiplier,w.depth*=s.sizeMultiplier/e.sizeMultiplier;var N;n.size===hr.DISPLAY.size?N=e.fontMetrics().delim1:n.size===hr.SCRIPTSCRIPT.size?N=e.havingStyle(hr.SCRIPT).fontMetrics().delim2:N=e.fontMetrics().delim2;var D,P;return t.leftDelim==null?D=gS(e,["mopen"]):D=NR(t.leftDelim,N,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?P=Xt([]):t.rightDelim==null?P=gS(e,["mclose"]):P=NR(t.rightDelim,N,!0,e.havingStyle(n),t.mode,["mclose"]),Xt(["mord"].concat(s.sizingClasses(e)),[D,Xt(["mfrac"],[w]),P],e)},uye=(t,e)=>{var n=new Jt("mfrac",[is(t.numer,e),is(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=Js(t.barSize,e);n.setAttribute("linethickness",dn(r))}if(t.leftDelim!=null||t.rightDelim!=null){var i=[];if(t.leftDelim!=null){var s=new Jt("mo",[new Ha(t.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}if(i.push(n),t.rightDelim!=null){var a=new Jt("mo",[new Ha(t.rightDelim.replace("\\",""))]);a.setAttribute("fence","true"),i.push(a)}return wk(i)}return n},zq=(t,e)=>{if(!e)return t;var n={type:"styling",mode:t.mode,style:e,body:[t]};return n};_n({type:"genfrac",names:["\\cfrac","\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=e[1],a,o=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,o="(",l=")";break;case"\\\\bracefrac":a=!1,o="\\{",l="\\}";break;case"\\\\brackfrac":a=!1,o="[",l="]";break;default:throw new Error("Unrecognized genfrac command")}var c=r==="\\cfrac",d=null;return c||r.startsWith("\\d")?d="display":r.startsWith("\\t")&&(d="text"),zq({type:"genfrac",mode:n.mode,numer:i,denom:s,continued:c,hasBarLine:a,leftDelim:o,rightDelim:l,barSize:null},d)},htmlBuilder:cye,mathmlBuilder:uye});_n({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,i;switch(n){case"\\over":i="\\frac";break;case"\\choose":i="\\binom";break;case"\\atop":i="\\\\atopfrac";break;case"\\brace":i="\\\\bracefrac";break;case"\\brack":i="\\\\brackfrac";break;default:throw new Error("Unrecognized infix genfrac command")}return{type:"infix",mode:e.mode,replaceWith:i,token:r}}});var ML=["display","text","script","scriptscript"],TL=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};_n({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],i=e[5],s=A2(e[0]),a=s.type==="atom"&&s.family==="open"?TL(s.text):null,o=A2(e[1]),l=o.type==="atom"&&o.family==="close"?TL(o.text):null,c=Pr(e[2],"size"),d,h=null;c.isBlank?d=!0:(h=c.value,d=h.number>0);var g=null,v=e[3];if(v.type==="ordgroup"){if(v.body.length>0){var b=Pr(v.body[0],"textord");g=ML[Number(b.text)]}}else v=Pr(v,"textord"),g=ML[Number(v.text)];return zq({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:d,barSize:h,leftDelim:a,rightDelim:l},g)}});_n({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:i}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Pr(e[0],"size").value,token:i}}});_n({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=Pr(e[1],"infix").size;if(!s)throw new Error("\\\\abovefrac expected size, but got "+String(s));var a=e[2],o=s.number>0;return{type:"genfrac",mode:n.mode,numer:i,denom:a,continued:!1,hasBarLine:o,barSize:s,leftDelim:null,rightDelim:null}}});var jq=(t,e)=>{var n=e.style,r,i;t.type==="supsub"?(r=t.sup?xi(t.sup,e.havingStyle(n.sup()),e):xi(t.sub,e.havingStyle(n.sub()),e),i=Pr(t.base,"horizBrace")):i=Pr(t,"horizBrace");var s=xi(i.base,e.havingBaseStyle(hr.DISPLAY)),a=jT(i,e),o;if(i.isOver?(o=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:a}]}),o.children[0].children[0].children[1].classes.push("svg-align")):(o=Mi({positionType:"bottom",positionData:s.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:s}]}),o.children[0].children[0].children[0].classes.push("svg-align")),r){var l=Xt(["mord",i.isOver?"mover":"munder"],[o],e);i.isOver?o=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):o=Mi({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Xt(["mord",i.isOver?"mover":"munder"],[o],e)},dye=(t,e)=>{var n=zT(t.label);return new Jt(t.isOver?"mover":"munder",[is(t.base,e),n])};_n({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:jq,mathmlBuilder:dye});_n({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],i=Pr(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:Ta(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=so(t.body,e,!1);return A1e(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=nm(t.body,e);return n instanceof Jt||(n=new Jt("mrow",[n])),n.setAttribute("href",t.href),n}});_n({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Pr(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var i=[],s=0;s<r.length;s++){var a=r[s];a==="~"&&(a="\\textasciitilde"),i.push({type:"textord",mode:"text",text:a})}var o={type:"text",mode:n.mode,font:"\\texttt",body:i};return{type:"href",mode:n.mode,href:r,body:Ta(o)}}});_n({type:"hbox",names:["\\hbox"],props:{numArgs:1,argTypes:["text"],allowedInText:!0,primitive:!0},handler(t,e){var{parser:n}=t;return{type:"hbox",mode:n.mode,body:Ta(e[0])}},htmlBuilder(t,e){var n=so(t.body,e,!1);return Sp(n)},mathmlBuilder(t,e){return new Jt("mrow",Nc(t.body,e))}});_n({type:"html",names:["\\htmlClass","\\htmlId","\\htmlStyle","\\htmlData"],props:{numArgs:2,argTypes:["raw","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,token:i}=t,s=Pr(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,l={};switch(r){case"\\htmlClass":l.class=s,o={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,o={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,o={command:"\\htmlStyle",style:s};break;case"\\htmlData":{for(var c=s.split(","),d=0;d<c.length;d++){var h=c[d],g=h.indexOf("=");if(g<0)throw new Qt("\\htmlData key/value '"+h+"' missing equals sign");var v=h.slice(0,g),b=h.slice(g+1);l["data-"+v.trim()]=b}o={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(o)?{type:"html",mode:n.mode,attributes:l,body:Ta(a)}:n.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var n=so(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var i=Xt(r,n,e);for(var s in t.attributes)s!=="class"&&t.attributes.hasOwnProperty(s)&&i.setAttribute(s,t.attributes[s]);return i},mathmlBuilder:(t,e)=>nm(t.body,e)});_n({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInArgument:!0,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:Ta(e[0]),mathml:Ta(e[1])}},htmlBuilder:(t,e)=>{var n=so(t.html,e,!1);return Sp(n)},mathmlBuilder:(t,e)=>nm(t.mathml,e)});var AA=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new Qt("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!nq(r))throw new Qt("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};_n({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,i={number:0,unit:"em"},s={number:.9,unit:"em"},a={number:0,unit:"em"},o="";if(n[0])for(var l=Pr(n[0],"raw").string,c=l.split(","),d=0;d<c.length;d++){var h=c[d].split("=");if(h.length===2){var g=h[1].trim();switch(h[0].trim()){case"alt":o=g;break;case"width":i=AA(g);break;case"height":s=AA(g);break;case"totalheight":a=AA(g);break;default:throw new Qt("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var v=Pr(e[0],"url").url;return o===""&&(o=v,o=o.replace(/^.*[\\/]/,""),o=o.substring(0,o.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:v})?{type:"includegraphics",mode:r.mode,alt:o,width:i,height:s,totalheight:a,src:v}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var n=Js(t.height,e),r=0;t.totalheight.number>0&&(r=Js(t.totalheight,e)-n);var i=0;t.width.number>0&&(i=Js(t.width,e));var s={height:dn(n+r)};i>0&&(s.width=dn(i)),r>0&&(s.verticalAlign=dn(-r));var a=new b1e(t.src,t.alt,s);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new Jt("mglyph",[]);n.setAttribute("alt",t.alt);var r=Js(t.height,e),i=0;if(t.totalheight.number>0&&(i=Js(t.totalheight,e)-r,n.setAttribute("valign",dn(-i))),n.setAttribute("height",dn(r+i)),t.width.number>0){var s=Js(t.width,e);n.setAttribute("width",dn(s))}return n.setAttribute("src",t.src),n}});_n({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,i=Pr(e[0],"size");if(n.settings.strict){var s=r[1]==="m",a=i.value.unit==="mu";s?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+i.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:i.value}},htmlBuilder(t,e){return lq(t.dimension,e)},mathmlBuilder(t,e){var n=Js(t.dimension,e);return new pq(n)}});_n({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:i}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=Xt([],[xi(t.body,e)]),n=Xt(["inner"],[n],e)):n=Xt(["inner"],[xi(t.body,e)]);var r=Xt(["fix"],[]),i=Xt([t.alignment],[n,r],e),s=Xt(["strut"]);return s.style.height=dn(i.height+i.depth),i.depth&&(s.style.verticalAlign=dn(-i.depth)),i.children.unshift(s),i=Xt(["thinbox"],[i],e),Xt(["mord","vbox"],[i],e)},mathmlBuilder:(t,e)=>{var n=new Jt("mpadded",[is(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});_n({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,i=r.mode;r.switchMode("math");var s=n==="\\("?"\\)":"$",a=r.parseExpression(!1,s);return r.expect(s),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",body:a}}});_n({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new Qt("Mismatched "+t.funcName)}});var EL=(t,e)=>{switch(e.style.size){case hr.DISPLAY.size:return t.display;case hr.TEXT.size:return t.text;case hr.SCRIPT.size:return t.script;case hr.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};_n({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:Ta(e[0]),text:Ta(e[1]),script:Ta(e[2]),scriptscript:Ta(e[3])}},htmlBuilder:(t,e)=>{var n=EL(t,e),r=so(n,e,!1);return Sp(r)},mathmlBuilder:(t,e)=>{var n=EL(t,e);return nm(n,e)}});var Fq=(t,e,n,r,i,s,a)=>{t=Xt([],[t]);var o=n&&bp(n),l,c;if(e){var d=xi(e,r.havingStyle(i.sup()),r);c={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=xi(n,r.havingStyle(i.sub()),r);l={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-h.height)}}var g;if(c&&l){var v=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+t.depth+a;g=Mi({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:dn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:dn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var b=t.height-a;g=Mi({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:dn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(c){var _=t.depth+a;g=Mi({positionType:"bottom",positionData:_,children:[{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:dn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return t;var w=[g];if(l&&s!==0&&!o){var S=Xt(["mspace"],[],r);S.style.marginRight=dn(s),w.unshift(S)}return Xt(["mop","op-limits"],w,r)},Uq=new Set(["\\smallint"]),Ry=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Pr(t.base,"op"),i=!0):s=Pr(t,"op");var a=e.style,o=!1;a.size===hr.DISPLAY.size&&s.symbol&&!Uq.has(s.name)&&(o=!0);var l;if(s.symbol){var c=o?"Size2-Regular":"Size1-Regular",d="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(d=s.name.slice(1),s.name=d==="oiint"?"\\iint":"\\iiint"),l=Ll(s.name,c,"math",e,["mop","op-symbol",o?"large-op":"small-op"]),d.length>0){var h=l.italic,g=uq(d+"Size"+(o?"2":"1"),e);l=Mi({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:g,shift:o?.08:0}]}),s.name="\\"+d,l.classes.unshift("mop"),l.italic=h}}else if(s.body){var v=so(s.body,e,!0);v.length===1&&v[0]instanceof Xu?(l=v[0],l.classes[0]="mop"):l=Xt(["mop"],v,e)}else{for(var b=[],_=1;_<s.name.length;_++)b.push(_k(s.name[_],s.mode,e));l=Xt(["mop"],b,e)}var w=0,S=0;return(l instanceof Xu||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(w=(l.height-l.depth)/2-e.fontMetrics().axisHeight,S=l.italic),i?Fq(l,n,r,e,a,S,w):(w&&(l.style.position="relative",l.style.top=dn(w)),l)},mw=(t,e)=>{var n;if(t.symbol)n=new Jt("mo",[Yu(t.name,t.mode)]),Uq.has(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Jt("mo",Nc(t.body,e));else{n=new Jt("mi",[new Ha(t.name.slice(1))]);var r=new Jt("mo",[Yu("⁡","text")]);t.parentIsSupSub?n=new Jt("mrow",[n,r]):n=hq([n,r])}return n},fye={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};_n({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=r;return i.length===1&&(i=fye[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Ry,mathmlBuilder:mw});_n({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:Ta(r)}},htmlBuilder:Ry,mathmlBuilder:mw});var hye={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};_n({type:"op",names:["\\arcsin","\\arccos","\\arctan","\\arctg","\\arcctg","\\arg","\\ch","\\cos","\\cosec","\\cosh","\\cot","\\cotg","\\coth","\\csc","\\ctg","\\cth","\\deg","\\dim","\\exp","\\hom","\\ker","\\lg","\\ln","\\log","\\sec","\\sin","\\sinh","\\sh","\\tan","\\tanh","\\tg","\\th"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Ry,mathmlBuilder:mw});_n({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Ry,mathmlBuilder:mw});_n({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0,allowedInArgument:!0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=hye[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Ry,mathmlBuilder:mw});var Bq=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Pr(t.base,"operatorname"),i=!0):s=Pr(t,"operatorname");var a;if(s.body.length>0){for(var o=s.body.map(h=>{var g=h.text;return typeof g=="string"?{type:"textord",mode:h.mode,text:g}:h}),l=so(o,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var d=l[c];d instanceof Xu&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}a=Xt(["mop"],l,e)}else a=Xt(["mop"],[],e);return i?Fq(a,n,r,e,e.style,0,0):a},pye=(t,e)=>{for(var n=Nc(t.body,e.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var s=n[i];if(!(s instanceof pq))if(s instanceof Jt)switch(s.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var a=s.children[0];s.children.length===1&&a instanceof Ha?a.text=a.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var o=n.map(d=>d.toText()).join("");n=[new Ha(o)]}var l=new Jt("mi",n);l.setAttribute("mathvariant","normal");var c=new Jt("mo",[Yu("⁡","text")]);return t.parentIsSupSub?new Jt("mrow",[l,c]):hq([l,c])};_n({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0];return{type:"operatorname",mode:n.mode,body:Ta(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Bq,mathmlBuilder:pye});Ie("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Mv({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?Sp(so(t.body,e,!1)):Xt(["mord"],so(t.body,e,!0),e)},mathmlBuilder(t,e){return nm(t.body,e,!0)}});_n({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=xi(t.body,e.havingCrampedStyle()),r=ey("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]});return Xt(["mord","overline"],[s],e)},mathmlBuilder(t,e){var n=new Jt("mo",[new Ha("‾")]);n.setAttribute("stretchy","true");var r=new Jt("mover",[is(t.body,e),n]);return r.setAttribute("accent","true"),r}});_n({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:Ta(r)}},htmlBuilder:(t,e)=>{var n=so(t.body,e.withPhantom(),!1);return Sp(n)},mathmlBuilder:(t,e)=>{var n=Nc(t.body,e);return new Jt("mphantom",n)}});_n({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=Xt([],[xi(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r<n.children.length;r++)n.children[r].height=0,n.children[r].depth=0;return n=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:n}]}),Xt(["mord"],[n],e)},mathmlBuilder:(t,e)=>{var n=Nc(Ta(t.body),e),r=new Jt("mphantom",n),i=new Jt("mpadded",[r]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});_n({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=Xt(["inner"],[xi(t.body,e.withPhantom())]),r=Xt(["fix"],[]);return Xt(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Nc(Ta(t.body),e),r=new Jt("mphantom",n),i=new Jt("mpadded",[r]);return i.setAttribute("width","0px"),i}});_n({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Pr(e[0],"size").value,i=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:i}},htmlBuilder(t,e){var n=xi(t.body,e),r=Js(t.dy,e);return Mi({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new Jt("mpadded",[is(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});_n({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});_n({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,i=n[0],s=Pr(e[0],"size"),a=Pr(e[1],"size");return{type:"rule",mode:r.mode,shift:i&&Pr(i,"size").value,width:s.value,height:a.value}},htmlBuilder(t,e){var n=Xt(["mord","rule"],[],e),r=Js(t.width,e),i=Js(t.height,e),s=t.shift?Js(t.shift,e):0;return n.style.borderRightWidth=dn(r),n.style.borderTopWidth=dn(i),n.style.bottom=dn(s),n.width=r,n.height=i+s,n.depth=-s,n.maxFontSize=i*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=Js(t.width,e),r=Js(t.height,e),i=t.shift?Js(t.shift,e):0,s=e.color&&e.getColor()||"black",a=new Jt("mspace");a.setAttribute("mathbackground",s),a.setAttribute("width",dn(n)),a.setAttribute("height",dn(r));var o=new Jt("mpadded",[a]);return i>=0?o.setAttribute("height",dn(i)):(o.setAttribute("height",dn(i)),o.setAttribute("depth",dn(-i))),o.setAttribute("voffset",dn(i)),o}});function Hq(t,e,n){for(var r=so(t,e,!1),i=e.sizeMultiplier/n.sizeMultiplier,s=0;s<r.length;s++){var a=r[s].classes.indexOf("sizing");a<0?Array.prototype.push.apply(r[s].classes,e.sizingClasses(n)):r[s].classes[a+1]==="reset-size"+e.size&&(r[s].classes[a+1]="reset-size"+n.size),r[s].height*=i,r[s].depth*=i}return Sp(r)}var CL=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],mye=(t,e)=>{var n=e.havingSize(t.size);return Hq(t.body,n,e)};_n({type:"sizing",names:CL,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:i}=t,s=i.parseExpression(!1,n);return{type:"sizing",mode:i.mode,size:CL.indexOf(r)+1,body:s}},htmlBuilder:mye,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Nc(t.body,n),i=new Jt("mstyle",r);return i.setAttribute("mathsize",dn(n.sizeMultiplier)),i}});_n({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,i=!1,s=!1,a=n[0]&&Pr(n[0],"ordgroup");if(a)for(var o="",l=0;l<a.body.length;++l){var c=a.body[l];if(o=c.text,o==="t")i=!0;else if(o==="b")s=!0;else{i=!1,s=!1;break}}else i=!0,s=!0;var d=e[0];return{type:"smash",mode:r.mode,body:d,smashHeight:i,smashDepth:s}},htmlBuilder:(t,e)=>{var n=Xt([],[xi(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r<n.children.length;r++)n.children[r].height=0;if(t.smashDepth&&(n.depth=0,n.children))for(var i=0;i<n.children.length;i++)n.children[i].depth=0;var s=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Xt(["mord"],[s],e)},mathmlBuilder:(t,e)=>{var n=new Jt("mpadded",[is(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});_n({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,i=n[0],s=e[0];return{type:"sqrt",mode:r.mode,body:s,index:i}},htmlBuilder(t,e){var n=xi(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=ty(n,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<hr.TEXT.id&&(s=e.fontMetrics().xHeight);var a=i+s/4,o=n.height+n.depth+a+i,{span:l,ruleWidth:c,advanceWidth:d}=tye(o,e),h=l.height-c;h>n.height+n.depth+a&&(a=(a+h-n.height-n.depth)/2);var g=l.height-n.height-a-c;n.style.paddingLeft=dn(d);var v=Mi({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:l},{type:"kern",size:c}]});if(t.index){var b=e.havingStyle(hr.SCRIPTSCRIPT),_=xi(t.index,b,e),w=.6*(v.height-v.depth),S=Mi({positionType:"shift",positionData:-w,children:[{type:"elem",elem:_}]}),E=Xt(["root"],[S]);return Xt(["mord","sqrt"],[E,v],e)}else return Xt(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Jt("mroot",[is(n,e),is(r,e)]):new Jt("msqrt",[is(n,e)])}});var AL={display:hr.DISPLAY,text:hr.TEXT,script:hr.SCRIPT,scriptscript:hr.SCRIPTSCRIPT};_n({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:i}=t,s=i.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:i.mode,style:a,body:s}},htmlBuilder(t,e){var n=AL[t.style],r=e.havingStyle(n).withFont("");return Hq(t.body,r,e)},mathmlBuilder(t,e){var n=AL[t.style],r=e.havingStyle(n),i=Nc(t.body,r),s=new Jt("mstyle",i),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=a[t.style];return s.setAttribute("scriptlevel",o[0]),s.setAttribute("displaystyle",o[1]),s}});var gye=function(e,n){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(n.style.size===hr.DISPLAY.size||r.alwaysHandleSupSub);return i?Ry:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(n.style.size===hr.DISPLAY.size||r.limits);return s?Bq:null}else{if(r.type==="accent")return bp(r.base)?Ek:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?jq:null}else return null}else return null};Mv({type:"supsub",htmlBuilder(t,e){var n=gye(t,e);if(n)return n(t,e);var{base:r,sup:i,sub:s}=t,a=xi(r,e),o,l,c=e.fontMetrics(),d=0,h=0,g=r&&bp(r);if(i){var v=e.havingStyle(e.style.sup());o=xi(i,v,e),g||(d=a.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(s){var b=e.havingStyle(e.style.sub());l=xi(s,b,e),g||(h=a.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var _;e.style===hr.DISPLAY?_=c.sup1:e.style.cramped?_=c.sup3:_=c.sup2;var w=e.sizeMultiplier,S=dn(.5/c.ptPerEm/w),E=null;if(l){var A=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof Xu||A)&&(E=dn(-a.italic))}var N;if(o&&l){d=Math.max(d,_,o.depth+.25*c.xHeight),h=Math.max(h,c.sub2);var D=c.defaultRuleThickness,P=4*D;if(d-o.depth-(l.height-h)<P){h=P-(d-o.depth)+l.height;var L=.8*c.xHeight-(d-o.depth);L>0&&(d+=L,h-=L)}var R=[{type:"elem",elem:l,shift:h,marginRight:S,marginLeft:E},{type:"elem",elem:o,shift:-d,marginRight:S}];N=Mi({positionType:"individualShift",children:R})}else if(l){h=Math.max(h,c.sub1,l.height-.8*c.xHeight);var O=[{type:"elem",elem:l,marginLeft:E,marginRight:S}];N=Mi({positionType:"shift",positionData:h,children:O})}else if(o)d=Math.max(d,_,o.depth+.25*c.xHeight),N=Mi({positionType:"shift",positionData:-d,children:[{type:"elem",elem:o,marginRight:S}]});else throw new Error("supsub must have either sup or sub.");var W=TR(a,"right")||"mord";return Xt([W],[a,Xt(["msupsub"],[N])],e)},mathmlBuilder(t,e){var n=!1,r,i;t.base&&t.base.type==="horizBrace"&&(i=!!t.sup,i===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var s=[is(t.base,e)];t.sub&&s.push(is(t.sub,e)),t.sup&&s.push(is(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var c=t.base;c&&c.type==="op"&&c.limits&&e.style===hr.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===hr.DISPLAY||c.limits)?a="munderover":a="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===hr.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===hr.DISPLAY)?a="munder":a="msub"}else{var o=t.base;o&&o.type==="op"&&o.limits&&(e.style===hr.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||e.style===hr.DISPLAY)?a="mover":a="msup"}return new Jt(a,s)}});Mv({type:"atom",htmlBuilder(t,e){return _k(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Jt("mo",[Yu(t.text,t.mode)]);if(t.family==="bin"){var r=Mk(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var Vq={mi:"italic",mn:"normal",mtext:"normal"};Mv({type:"mathord",htmlBuilder(t,e){return LT(t,e,"mathord")},mathmlBuilder(t,e){var n=new Jt("mi",[Yu(t.text,t.mode,e)]),r=Mk(t,e)||"italic";return r!==Vq[n.type]&&n.setAttribute("mathvariant",r),n}});Mv({type:"textord",htmlBuilder(t,e){return LT(t,e,"textord")},mathmlBuilder(t,e){var n=Yu(t.text,t.mode,e),r=Mk(t,e)||"normal",i;return t.mode==="text"?i=new Jt("mtext",[n]):/[0-9]/.test(t.text)?i=new Jt("mn",[n]):t.text==="\\prime"?i=new Jt("mo",[n]):i=new Jt("mi",[n]),r!==Vq[i.type]&&i.setAttribute("mathvariant",r),i}});var NA={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},RA={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Mv({type:"spacing",htmlBuilder(t,e){if(RA.hasOwnProperty(t.text)){var n=RA[t.text].className||"";if(t.mode==="text"){var r=LT(t,e,"textord");return r.classes.push(n),r}else return Xt(["mspace",n],[_k(t.text,t.mode,e)],e)}else{if(NA.hasOwnProperty(t.text))return Xt(["mspace",NA[t.text]],[],e);throw new Qt('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(RA.hasOwnProperty(t.text))n=new Jt("mtext",[new Ha(" ")]);else{if(NA.hasOwnProperty(t.text))return new Jt("mspace");throw new Qt('Unknown type of space "'+t.text+'"')}return n}});var NL=()=>{var t=new Jt("mtd",[]);return t.setAttribute("width","50%"),t};Mv({type:"tag",mathmlBuilder(t,e){var n=new Jt("mtable",[new Jt("mtr",[NL(),new Jt("mtd",[nm(t.body,e)]),NL(),new Jt("mtd",[nm(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var RL={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},kL={"\\textbf":"textbf","\\textmd":"textmd"},vye={"\\textit":"textit","\\textup":"textup"},PL=(t,e)=>{var n=t.font;if(n){if(RL[n])return e.withTextFontFamily(RL[n]);if(kL[n])return e.withTextFontWeight(kL[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(vye[n])};_n({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,i=e[0];return{type:"text",mode:n.mode,body:Ta(i),font:r}},htmlBuilder(t,e){var n=PL(t,e),r=so(t.body,n,!0);return Xt(["mord","text"],r,n)},mathmlBuilder(t,e){var n=PL(t,e);return nm(t.body,n)}});_n({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=xi(t.body,e),r=ey("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Mi({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]});return Xt(["mord","underline"],[s],e)},mathmlBuilder(t,e){var n=new Jt("mo",[new Ha("‾")]);n.setAttribute("stretchy","true");var r=new Jt("munder",[is(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});_n({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=xi(t.body,e),r=e.fontMetrics().axisHeight,i=.5*(n.height-r-(n.depth+r));return Mi({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){return new Jt("mpadded",[is(t.body,e)],["vcenter"])}});_n({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new Qt("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=IL(t),r=[],i=e.havingStyle(e.style.text()),s=0;s<n.length;s++){var a=n[s];a==="~"&&(a="\\textasciitilde"),r.push(Ll(a,"Typewriter-Regular",t.mode,i,["mord","texttt"]))}return Xt(["mord","text"].concat(i.sizingClasses(e)),oq(r),i)},mathmlBuilder(t,e){var n=new Ha(IL(t)),r=new Jt("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var IL=t=>t.body.replace(/ /g,t.star?"␣":" "),U0=dq,Gq=`[ \r
	]`,xye="\\\\[a-zA-Z@]+",yye="\\\\[^\uD800-\uDFFF]",bye="("+xye+")"+Gq+"*",_ye=`\\\\(
|[ \r	]+
?)[ \r	]*`,RR="[̀-ͯ]",Sye=new RegExp(RR+"+$"),wye="("+Gq+"+)|"+(_ye+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(RR+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(RR+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+bye)+("|"+yye+")");class DL{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(wye,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new tu("EOF",new wc(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new Qt("Unexpected character: '"+e[n]+"'",new tu(e[n],new wc(this,n,n+1)));var i=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[i]===14){var s=e.indexOf(`
`,this.tokenRegex.lastIndex);return s===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict("commentAtEnd","% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")):this.tokenRegex.lastIndex=s+1,this.lex()}return new tu(i,new wc(this,n,this.tokenRegex.lastIndex))}}class Mye{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Qt("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var i=0;i<this.undefStack.length;i++)delete this.undefStack[i][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var s=this.undefStack[this.undefStack.length-1];s&&!s.hasOwnProperty(e)&&(s[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var Tye=Iq;Ie("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});Ie("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});Ie("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});Ie("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});Ie("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});Ie("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Ie("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var OL={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Ie("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new Qt("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=OL[e.text],r==null||r>=n)throw new Qt("Invalid base-"+n+" digit "+e.text);for(var i;(i=OL[t.future().text])!=null&&i<n;)r*=n,r+=i,t.popToken()}return"\\@char{"+r+"}"});var Pk=(t,e,n,r)=>{var i=t.consumeArg().tokens;if(i.length!==1)throw new Qt("\\newcommand's first argument must be a macro name");var s=i[0].text,a=t.isDefined(s);if(a&&!e)throw new Qt("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!a&&!n)throw new Qt("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var o=0;if(i=t.consumeArg().tokens,i.length===1&&i[0].text==="["){for(var l="",c=t.expandNextToken();c.text!=="]"&&c.text!=="EOF";)l+=c.text,c=t.expandNextToken();if(!l.match(/^\s*[0-9]+\s*$/))throw new Qt("Invalid number of arguments: "+l);o=parseInt(l),i=t.consumeArg().tokens}return a&&r||t.macros.set(s,{tokens:i,numArgs:o}),""};Ie("\\newcommand",t=>Pk(t,!1,!0,!1));Ie("\\renewcommand",t=>Pk(t,!0,!1,!1));Ie("\\providecommand",t=>Pk(t,!0,!0,!0));Ie("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});Ie("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});Ie("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),U0[n],hs.math[n],hs.text[n]),""});Ie("\\bgroup","{");Ie("\\egroup","}");Ie("~","\\nobreakspace");Ie("\\lq","`");Ie("\\rq","'");Ie("\\aa","\\r a");Ie("\\AA","\\r A");Ie("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Ie("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Ie("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Ie("ℬ","\\mathscr{B}");Ie("ℰ","\\mathscr{E}");Ie("ℱ","\\mathscr{F}");Ie("ℋ","\\mathscr{H}");Ie("ℐ","\\mathscr{I}");Ie("ℒ","\\mathscr{L}");Ie("ℳ","\\mathscr{M}");Ie("ℛ","\\mathscr{R}");Ie("ℭ","\\mathfrak{C}");Ie("ℌ","\\mathfrak{H}");Ie("ℨ","\\mathfrak{Z}");Ie("\\Bbbk","\\Bbb{k}");Ie("·","\\cdotp");Ie("\\llap","\\mathllap{\\textrm{#1}}");Ie("\\rlap","\\mathrlap{\\textrm{#1}}");Ie("\\clap","\\mathclap{\\textrm{#1}}");Ie("\\mathstrut","\\vphantom{(}");Ie("\\underbar","\\underline{\\text{#1}}");Ie("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');Ie("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Ie("\\ne","\\neq");Ie("≠","\\neq");Ie("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Ie("∉","\\notin");Ie("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Ie("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Ie("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Ie("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Ie("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Ie("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Ie("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Ie("⟂","\\perp");Ie("‼","\\mathclose{!\\mkern-0.8mu!}");Ie("∌","\\notni");Ie("⌜","\\ulcorner");Ie("⌝","\\urcorner");Ie("⌞","\\llcorner");Ie("⌟","\\lrcorner");Ie("©","\\copyright");Ie("®","\\textregistered");Ie("️","\\textregistered");Ie("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Ie("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Ie("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Ie("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Ie("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Ie("⋮","\\vdots");Ie("\\varGamma","\\mathit{\\Gamma}");Ie("\\varDelta","\\mathit{\\Delta}");Ie("\\varTheta","\\mathit{\\Theta}");Ie("\\varLambda","\\mathit{\\Lambda}");Ie("\\varXi","\\mathit{\\Xi}");Ie("\\varPi","\\mathit{\\Pi}");Ie("\\varSigma","\\mathit{\\Sigma}");Ie("\\varUpsilon","\\mathit{\\Upsilon}");Ie("\\varPhi","\\mathit{\\Phi}");Ie("\\varPsi","\\mathit{\\Psi}");Ie("\\varOmega","\\mathit{\\Omega}");Ie("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Ie("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Ie("\\boxed","\\fbox{$\\displaystyle{#1}$}");Ie("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Ie("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Ie("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Ie("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Ie("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var LL={",":"\\dotsc","\\not":"\\dotsb","+":"\\dotsb","=":"\\dotsb","<":"\\dotsb",">":"\\dotsb","-":"\\dotsb","*":"\\dotsb",":":"\\dotsb","\\DOTSB":"\\dotsb","\\coprod":"\\dotsb","\\bigvee":"\\dotsb","\\bigwedge":"\\dotsb","\\biguplus":"\\dotsb","\\bigcap":"\\dotsb","\\bigcup":"\\dotsb","\\prod":"\\dotsb","\\sum":"\\dotsb","\\bigotimes":"\\dotsb","\\bigoplus":"\\dotsb","\\bigodot":"\\dotsb","\\bigsqcup":"\\dotsb","\\And":"\\dotsb","\\longrightarrow":"\\dotsb","\\Longrightarrow":"\\dotsb","\\longleftarrow":"\\dotsb","\\Longleftarrow":"\\dotsb","\\longleftrightarrow":"\\dotsb","\\Longleftrightarrow":"\\dotsb","\\mapsto":"\\dotsb","\\longmapsto":"\\dotsb","\\hookrightarrow":"\\dotsb","\\doteq":"\\dotsb","\\mathbin":"\\dotsb","\\mathrel":"\\dotsb","\\relbar":"\\dotsb","\\Relbar":"\\dotsb","\\xrightarrow":"\\dotsb","\\xleftarrow":"\\dotsb","\\DOTSI":"\\dotsi","\\int":"\\dotsi","\\oint":"\\dotsi","\\iint":"\\dotsi","\\iiint":"\\dotsi","\\iiiint":"\\dotsi","\\idotsint":"\\dotsi","\\DOTSX":"\\dotsx"},Eye=new Set(["bin","rel"]);Ie("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in LL?e=LL[n]:(n.slice(0,4)==="\\not"||n in hs.math&&Eye.has(hs.math[n].group))&&(e="\\dotsb"),e});var Ik={")":!0,"]":!0,"\\rbrack":!0,"\\}":!0,"\\rbrace":!0,"\\rangle":!0,"\\rceil":!0,"\\rfloor":!0,"\\rgroup":!0,"\\rmoustache":!0,"\\right":!0,"\\bigr":!0,"\\biggr":!0,"\\Bigr":!0,"\\Biggr":!0,$:!0,";":!0,".":!0,",":!0};Ie("\\dotso",function(t){var e=t.future().text;return e in Ik?"\\ldots\\,":"\\ldots"});Ie("\\dotsc",function(t){var e=t.future().text;return e in Ik&&e!==","?"\\ldots\\,":"\\ldots"});Ie("\\cdots",function(t){var e=t.future().text;return e in Ik?"\\@cdots\\,":"\\@cdots"});Ie("\\dotsb","\\cdots");Ie("\\dotsm","\\cdots");Ie("\\dotsi","\\!\\cdots");Ie("\\dotsx","\\ldots\\,");Ie("\\DOTSI","\\relax");Ie("\\DOTSB","\\relax");Ie("\\DOTSX","\\relax");Ie("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Ie("\\,","\\tmspace+{3mu}{.1667em}");Ie("\\thinspace","\\,");Ie("\\>","\\mskip{4mu}");Ie("\\:","\\tmspace+{4mu}{.2222em}");Ie("\\medspace","\\:");Ie("\\;","\\tmspace+{5mu}{.2777em}");Ie("\\thickspace","\\;");Ie("\\!","\\tmspace-{3mu}{.1667em}");Ie("\\negthinspace","\\!");Ie("\\negmedspace","\\tmspace-{4mu}{.2222em}");Ie("\\negthickspace","\\tmspace-{5mu}{.277em}");Ie("\\enspace","\\kern.5em ");Ie("\\enskip","\\hskip.5em\\relax");Ie("\\quad","\\hskip1em\\relax");Ie("\\qquad","\\hskip2em\\relax");Ie("\\tag","\\@ifstar\\tag@literal\\tag@paren");Ie("\\tag@paren","\\tag@literal{({#1})}");Ie("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new Qt("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Ie("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Ie("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Ie("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Ie("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Ie("\\newline","\\\\\\relax");Ie("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var Wq=dn(Yf["Main-Regular"][84][1]-.7*Yf["Main-Regular"][65][1]);Ie("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Wq+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Ie("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Wq+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Ie("\\hspace","\\@ifstar\\@hspacer\\@hspace");Ie("\\@hspace","\\hskip #1\\relax");Ie("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Ie("\\ordinarycolon",":");Ie("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Ie("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Ie("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Ie("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Ie("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Ie("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Ie("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Ie("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Ie("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Ie("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Ie("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Ie("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Ie("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Ie("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Ie("∷","\\dblcolon");Ie("∹","\\eqcolon");Ie("≔","\\coloneqq");Ie("≕","\\eqqcolon");Ie("⩴","\\Coloneqq");Ie("\\ratio","\\vcentcolon");Ie("\\coloncolon","\\dblcolon");Ie("\\colonequals","\\coloneqq");Ie("\\coloncolonequals","\\Coloneqq");Ie("\\equalscolon","\\eqqcolon");Ie("\\equalscoloncolon","\\Eqqcolon");Ie("\\colonminus","\\coloneq");Ie("\\coloncolonminus","\\Coloneq");Ie("\\minuscolon","\\eqcolon");Ie("\\minuscoloncolon","\\Eqcolon");Ie("\\coloncolonapprox","\\Colonapprox");Ie("\\coloncolonsim","\\Colonsim");Ie("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ie("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ie("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Ie("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Ie("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Ie("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Ie("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Ie("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Ie("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Ie("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Ie("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Ie("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Ie("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Ie("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Ie("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Ie("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Ie("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Ie("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Ie("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Ie("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Ie("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Ie("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Ie("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Ie("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Ie("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Ie("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Ie("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Ie("\\imath","\\html@mathml{\\@imath}{ı}");Ie("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Ie("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Ie("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Ie("⟦","\\llbracket");Ie("⟧","\\rrbracket");Ie("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Ie("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Ie("⦃","\\lBrace");Ie("⦄","\\rBrace");Ie("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Ie("⦵","\\minuso");Ie("\\darr","\\downarrow");Ie("\\dArr","\\Downarrow");Ie("\\Darr","\\Downarrow");Ie("\\lang","\\langle");Ie("\\rang","\\rangle");Ie("\\uarr","\\uparrow");Ie("\\uArr","\\Uparrow");Ie("\\Uarr","\\Uparrow");Ie("\\N","\\mathbb{N}");Ie("\\R","\\mathbb{R}");Ie("\\Z","\\mathbb{Z}");Ie("\\alef","\\aleph");Ie("\\alefsym","\\aleph");Ie("\\Alpha","\\mathrm{A}");Ie("\\Beta","\\mathrm{B}");Ie("\\bull","\\bullet");Ie("\\Chi","\\mathrm{X}");Ie("\\clubs","\\clubsuit");Ie("\\cnums","\\mathbb{C}");Ie("\\Complex","\\mathbb{C}");Ie("\\Dagger","\\ddagger");Ie("\\diamonds","\\diamondsuit");Ie("\\empty","\\emptyset");Ie("\\Epsilon","\\mathrm{E}");Ie("\\Eta","\\mathrm{H}");Ie("\\exist","\\exists");Ie("\\harr","\\leftrightarrow");Ie("\\hArr","\\Leftrightarrow");Ie("\\Harr","\\Leftrightarrow");Ie("\\hearts","\\heartsuit");Ie("\\image","\\Im");Ie("\\infin","\\infty");Ie("\\Iota","\\mathrm{I}");Ie("\\isin","\\in");Ie("\\Kappa","\\mathrm{K}");Ie("\\larr","\\leftarrow");Ie("\\lArr","\\Leftarrow");Ie("\\Larr","\\Leftarrow");Ie("\\lrarr","\\leftrightarrow");Ie("\\lrArr","\\Leftrightarrow");Ie("\\Lrarr","\\Leftrightarrow");Ie("\\Mu","\\mathrm{M}");Ie("\\natnums","\\mathbb{N}");Ie("\\Nu","\\mathrm{N}");Ie("\\Omicron","\\mathrm{O}");Ie("\\plusmn","\\pm");Ie("\\rarr","\\rightarrow");Ie("\\rArr","\\Rightarrow");Ie("\\Rarr","\\Rightarrow");Ie("\\real","\\Re");Ie("\\reals","\\mathbb{R}");Ie("\\Reals","\\mathbb{R}");Ie("\\Rho","\\mathrm{P}");Ie("\\sdot","\\cdot");Ie("\\sect","\\S");Ie("\\spades","\\spadesuit");Ie("\\sub","\\subset");Ie("\\sube","\\subseteq");Ie("\\supe","\\supseteq");Ie("\\Tau","\\mathrm{T}");Ie("\\thetasym","\\vartheta");Ie("\\weierp","\\wp");Ie("\\Zeta","\\mathrm{Z}");Ie("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Ie("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Ie("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Ie("\\bra","\\mathinner{\\langle{#1}|}");Ie("\\ket","\\mathinner{|{#1}\\rangle}");Ie("\\braket","\\mathinner{\\langle{#1}\\rangle}");Ie("\\Bra","\\left\\langle#1\\right|");Ie("\\Ket","\\left|#1\\right\\rangle");var $q=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,a=e.macros.get("|"),o=e.macros.get("\\|");e.macros.beginGroup();var l=h=>g=>{t&&(g.macros.set("|",a),i.length&&g.macros.set("\\|",o));var v=h;if(!h&&i.length){var b=g.future();b.text==="|"&&(g.popToken(),v=!0)}return{tokens:v?i:r,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var c=e.consumeArg().tokens,d=e.expandTokens([...s,...c,...n]);return e.macros.endGroup(),{tokens:d.reverse(),numArgs:0}};Ie("\\bra@ket",$q(!1));Ie("\\bra@set",$q(!0));Ie("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Ie("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Ie("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Ie("\\angln","{\\angl n}");Ie("\\blue","\\textcolor{##6495ed}{#1}");Ie("\\orange","\\textcolor{##ffa500}{#1}");Ie("\\pink","\\textcolor{##ff00af}{#1}");Ie("\\red","\\textcolor{##df0030}{#1}");Ie("\\green","\\textcolor{##28ae7b}{#1}");Ie("\\gray","\\textcolor{gray}{#1}");Ie("\\purple","\\textcolor{##9d38bd}{#1}");Ie("\\blueA","\\textcolor{##ccfaff}{#1}");Ie("\\blueB","\\textcolor{##80f6ff}{#1}");Ie("\\blueC","\\textcolor{##63d9ea}{#1}");Ie("\\blueD","\\textcolor{##11accd}{#1}");Ie("\\blueE","\\textcolor{##0c7f99}{#1}");Ie("\\tealA","\\textcolor{##94fff5}{#1}");Ie("\\tealB","\\textcolor{##26edd5}{#1}");Ie("\\tealC","\\textcolor{##01d1c1}{#1}");Ie("\\tealD","\\textcolor{##01a995}{#1}");Ie("\\tealE","\\textcolor{##208170}{#1}");Ie("\\greenA","\\textcolor{##b6ffb0}{#1}");Ie("\\greenB","\\textcolor{##8af281}{#1}");Ie("\\greenC","\\textcolor{##74cf70}{#1}");Ie("\\greenD","\\textcolor{##1fab54}{#1}");Ie("\\greenE","\\textcolor{##0d923f}{#1}");Ie("\\goldA","\\textcolor{##ffd0a9}{#1}");Ie("\\goldB","\\textcolor{##ffbb71}{#1}");Ie("\\goldC","\\textcolor{##ff9c39}{#1}");Ie("\\goldD","\\textcolor{##e07d10}{#1}");Ie("\\goldE","\\textcolor{##a75a05}{#1}");Ie("\\redA","\\textcolor{##fca9a9}{#1}");Ie("\\redB","\\textcolor{##ff8482}{#1}");Ie("\\redC","\\textcolor{##f9685d}{#1}");Ie("\\redD","\\textcolor{##e84d39}{#1}");Ie("\\redE","\\textcolor{##bc2612}{#1}");Ie("\\maroonA","\\textcolor{##ffbde0}{#1}");Ie("\\maroonB","\\textcolor{##ff92c6}{#1}");Ie("\\maroonC","\\textcolor{##ed5fa6}{#1}");Ie("\\maroonD","\\textcolor{##ca337c}{#1}");Ie("\\maroonE","\\textcolor{##9e034e}{#1}");Ie("\\purpleA","\\textcolor{##ddd7ff}{#1}");Ie("\\purpleB","\\textcolor{##c6b9fc}{#1}");Ie("\\purpleC","\\textcolor{##aa87ff}{#1}");Ie("\\purpleD","\\textcolor{##7854ab}{#1}");Ie("\\purpleE","\\textcolor{##543b78}{#1}");Ie("\\mintA","\\textcolor{##f5f9e8}{#1}");Ie("\\mintB","\\textcolor{##edf2df}{#1}");Ie("\\mintC","\\textcolor{##e0e5cc}{#1}");Ie("\\grayA","\\textcolor{##f6f7f7}{#1}");Ie("\\grayB","\\textcolor{##f0f1f2}{#1}");Ie("\\grayC","\\textcolor{##e3e5e6}{#1}");Ie("\\grayD","\\textcolor{##d6d8da}{#1}");Ie("\\grayE","\\textcolor{##babec2}{#1}");Ie("\\grayF","\\textcolor{##888d93}{#1}");Ie("\\grayG","\\textcolor{##626569}{#1}");Ie("\\grayH","\\textcolor{##3b3e40}{#1}");Ie("\\grayI","\\textcolor{##21242c}{#1}");Ie("\\kaBlue","\\textcolor{##314453}{#1}");Ie("\\kaGreen","\\textcolor{##71B307}{#1}");var qq={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Cye{constructor(e,n,r){this.settings=void 0,this.expansionCount=void 0,this.lexer=void 0,this.macros=void 0,this.stack=void 0,this.mode=void 0,this.settings=n,this.expansionCount=0,this.feed(e),this.macros=new Mye(Tye,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new DL(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}endGroups(){this.macros.endGroups()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,i;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:i,end:r}=this.consumeArg(["]"])}else({tokens:i,start:n,end:r}=this.consumeArg());return this.pushToken(new tu("EOF",r.loc)),this.pushTokens(i),new tu("",wc.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var i=this.future(),s,a=0,o=0;do{if(s=this.popToken(),n.push(s),s.text==="{")++a;else if(s.text==="}"){if(--a,a===-1)throw new Qt("Extra }",s)}else if(s.text==="EOF")throw new Qt("Unexpected end of input in a macro argument, expected '"+(e&&r?e[o]:"}")+"'",s);if(e&&r)if((a===0||a===1&&e[o]==="{")&&s.text===e[o]){if(++o,o===e.length){n.splice(-o,o);break}}else o=0}while(a!==0||r);return i.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:i,end:s}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new Qt("The length of delimiters doesn't match the number of args!");for(var r=n[0],i=0;i<r.length;i++){var s=this.popToken();if(r[i]!==s.text)throw new Qt("Use of the macro doesn't match its definition",s)}}for(var a=[],o=0;o<e;o++)a.push(this.consumeArg(n&&n[o+1]).tokens);return a}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new Qt("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,i=n.noexpand?null:this._getExpansion(r);if(i==null||e&&i.unexpandable){if(e&&i==null&&r[0]==="\\"&&!this.isDefined(r))throw new Qt("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var s=i.tokens,a=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var o=s.length-1;o>=0;--o){var l=s[o];if(l.text==="#"){if(o===0)throw new Qt("Incomplete placeholder at end of macro body",l);if(l=s[--o],l.text==="#")s.splice(o+1,1);else if(/^[1-9]$/.test(l.text))s.splice(o,2,...a[+l.text-1]);else throw new Qt("Not a valid argument number",l)}}}return this.pushTokens(s),s.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){var e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new tu(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var i=this.stack.pop();i.treatAsRelax&&(i.noexpand=!1,i.treatAsRelax=!1),n.push(i)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var i=typeof n=="function"?n(this):n;if(typeof i=="string"){var s=0;if(i.includes("#"))for(var a=i.replace(/##/g,"");a.includes("#"+(s+1));)++s;for(var o=new DL(i,this.settings),l=[],c=o.lex();c.text!=="EOF";)l.push(c),c=o.lex();l.reverse();var d={tokens:l,numArgs:s};return d}return i}isDefined(e){return this.macros.has(e)||U0.hasOwnProperty(e)||hs.math.hasOwnProperty(e)||hs.text.hasOwnProperty(e)||qq.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:U0.hasOwnProperty(e)&&!U0[e].primitive}}var zL=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,w4=Object.freeze({"₊":"+","₋":"-","₌":"=","₍":"(","₎":")","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9","ₐ":"a","ₑ":"e","ₕ":"h","ᵢ":"i","ⱼ":"j","ₖ":"k","ₗ":"l","ₘ":"m","ₙ":"n","ₒ":"o","ₚ":"p","ᵣ":"r","ₛ":"s","ₜ":"t","ᵤ":"u","ᵥ":"v","ₓ":"x","ᵦ":"β","ᵧ":"γ","ᵨ":"ρ","ᵩ":"ϕ","ᵪ":"χ","⁺":"+","⁻":"-","⁼":"=","⁽":"(","⁾":")","⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","ᴬ":"A","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ⱽ":"V","ᵂ":"W","ᵃ":"a","ᵇ":"b","ᶜ":"c","ᵈ":"d","ᵉ":"e","ᶠ":"f","ᵍ":"g",ʰ:"h","ⁱ":"i",ʲ:"j","ᵏ":"k",ˡ:"l","ᵐ":"m",ⁿ:"n","ᵒ":"o","ᵖ":"p",ʳ:"r",ˢ:"s","ᵗ":"t","ᵘ":"u","ᵛ":"v",ʷ:"w",ˣ:"x",ʸ:"y","ᶻ":"z","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),kA={"́":{text:"\\'",math:"\\acute"},"̀":{text:"\\`",math:"\\grave"},"̈":{text:'\\"',math:"\\ddot"},"̃":{text:"\\~",math:"\\tilde"},"̄":{text:"\\=",math:"\\bar"},"̆":{text:"\\u",math:"\\breve"},"̌":{text:"\\v",math:"\\check"},"̂":{text:"\\^",math:"\\hat"},"̇":{text:"\\.",math:"\\dot"},"̊":{text:"\\r",math:"\\mathring"},"̋":{text:"\\H"},"̧":{text:"\\c"}},jL={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class VT{constructor(e,n){this.mode=void 0,this.gullet=void 0,this.settings=void 0,this.leftrightDepth=void 0,this.nextToken=void 0,this.mode="math",this.gullet=new Cye(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new Qt("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new tu("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var i=this.fetch();if(VT.endOfExpression.has(i.text)||n&&i.text===n||e&&U0[i.text]&&U0[i.text].infix)break;var s=this.parseAtom(n);if(s){if(s.type==="internal")continue}else break;r.push(s)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,i=0;i<e.length;i++)if(e[i].type==="infix"){if(n!==-1)throw new Qt("only one infix operator per group",e[i].token);n=i,r=e[i].replaceWith}if(n!==-1&&r){var s,a,o=e.slice(0,n),l=e.slice(n+1);o.length===1&&o[0].type==="ordgroup"?s=o[0]:s={type:"ordgroup",mode:this.mode,body:o},l.length===1&&l[0].type==="ordgroup"?a=l[0]:a={type:"ordgroup",mode:this.mode,body:l};var c;return r==="\\\\abovefrac"?c=this.callFunction(r,[s,e[n],a],[]):c=this.callFunction(r,[s,a],[]),[c]}else return e}handleSupSubscript(e){var n=this.fetch(),r=n.text;this.consume(),this.consumeSpaces();var i;do{var s;i=this.parseGroup(e)}while(((s=i)==null?void 0:s.type)==="internal");if(!i)throw new Qt("Expected group after '"+r+"'",n);return i}formatUnsupportedCmd(e){for(var n=[],r=0;r<e.length;r++)n.push({type:"textord",mode:"text",text:e[r]});var i={type:"text",mode:this.mode,body:n},s={type:"color",mode:this.mode,color:this.settings.errorColor,body:[i]};return s}parseAtom(e){var n=this.parseGroup("atom",e);if((n==null?void 0:n.type)==="internal"||this.mode==="text")return n;for(var r,i;;){this.consumeSpaces();var s=this.fetch();if(s.text==="\\limits"||s.text==="\\nolimits"){if(n&&n.type==="op"){var a=s.text==="\\limits";n.limits=a,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=s.text==="\\limits");else throw new Qt("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new Qt("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new Qt("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new Qt("Double superscript",s);var o={type:"textord",mode:this.mode,text:"\\prime"},l=[o];for(this.consume();this.fetch().text==="'";)l.push(o),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:l}}else if(w4[s.text]){var c=zL.test(s.text),d=[];for(d.push(new tu(w4[s.text])),this.consume();;){var h=this.fetch().text;if(!w4[h]||zL.test(h)!==c)break;d.unshift(new tu(w4[h])),this.consume()}var g=this.subparse(d);c?i={type:"ordgroup",mode:"math",body:g}:r={type:"ordgroup",mode:"math",body:g}}else break}return r||i?{type:"supsub",mode:this.mode,base:n,sup:r,sub:i}:n}parseFunction(e,n){var r=this.fetch(),i=r.text,s=U0[i];if(!s)return null;if(this.consume(),n&&n!=="atom"&&!s.allowedInArgument)throw new Qt("Got function '"+i+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!s.allowedInText)throw new Qt("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new Qt("Can't use function '"+i+"' in math mode",r);var{args:a,optArgs:o}=this.parseArguments(i,s);return this.callFunction(i,a,o,r,e)}callFunction(e,n,r,i,s){var a={funcName:e,parser:this,token:i,breakOnTokenText:s},o=U0[e];if(o&&o.handler)return o.handler(a,n,r);throw new Qt("No function handler for "+e)}parseArguments(e,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var i=[],s=[],a=0;a<r;a++){var o=n.argTypes&&n.argTypes[a],l=a<n.numOptionalArgs;(n.primitive&&o==null||n.type==="sqrt"&&a===1&&s[0]==null)&&(o="primitive");var c=this.parseGroupOfType("argument to '"+e+"'",o,l);if(l)s.push(c);else if(c!=null)i.push(c);else throw new Qt("Null argument, please report this as a bug")}return{args:i,optArgs:s}}parseGroupOfType(e,n,r){switch(n){case"color":return this.parseColorGroup(r);case"size":return this.parseSizeGroup(r);case"url":return this.parseUrlGroup(r);case"math":case"text":return this.parseArgumentGroup(r,n);case"hbox":{var i=this.parseArgumentGroup(r,"text");return i!=null?{type:"styling",mode:i.mode,body:[i],style:"text"}:null}case"raw":{var s=this.parseStringGroup("raw",r);return s!=null?{type:"raw",mode:"text",string:s.text}:null}case"primitive":{if(r)throw new Qt("A primitive argument cannot be optional");var a=this.parseGroup(e);if(a==null)throw new Qt("Expected group as "+e,this.fetch());return a}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new Qt("Unknown group type as "+e,this.fetch())}}consumeSpaces(){for(;this.fetch().text===" ";)this.consume()}parseStringGroup(e,n){var r=this.gullet.scanArgument(n);if(r==null)return null;for(var i="",s;(s=this.fetch()).text!=="EOF";)i+=s.text,this.consume();return this.consume(),r.text=i,r}parseRegexGroup(e,n){for(var r=this.fetch(),i=r,s="",a;(a=this.fetch()).text!=="EOF"&&e.test(s+a.text);)i=a,s+=i.text,this.consume();if(s==="")throw new Qt("Invalid "+n+": '"+r.text+"'",r);return r.range(i,s)}parseColorGroup(e){var n=this.parseStringGroup("color",e);if(n==null)return null;var r=/^(#[a-f0-9]{3,4}|#[a-f0-9]{6}|#[a-f0-9]{8}|[a-f0-9]{6}|[a-z]+)$/i.exec(n.text);if(!r)throw new Qt("Invalid color: '"+n.text+"'",n);var i=r[0];return/^[0-9a-f]{6}$/i.test(i)&&(i="#"+i),{type:"color-token",mode:this.mode,color:i}}parseSizeGroup(e){var n,r=!1;if(this.gullet.consumeSpaces(),!e&&this.gullet.future().text!=="{"?n=this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,"size"):n=this.parseStringGroup("size",e),!n)return null;!e&&n.text.length===0&&(n.text="0pt",r=!0);var i=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(n.text);if(!i)throw new Qt("Invalid size: '"+n.text+"'",n);var s={number:+(i[1]+i[2]),unit:i[3]};if(!nq(s))throw new Qt("Invalid unit: '"+s.unit+"'",n);return{type:"size",mode:this.mode,value:s,isBlank:r}}parseUrlGroup(e){this.gullet.lexer.setCatcode("%",13),this.gullet.lexer.setCatcode("~",12);var n=this.parseStringGroup("url",e);if(this.gullet.lexer.setCatcode("%",14),this.gullet.lexer.setCatcode("~",13),n==null)return null;var r=n.text.replace(/\\([#$%&~_^{}])/g,"$1");return{type:"url",mode:this.mode,url:r}}parseArgumentGroup(e,n){var r=this.gullet.scanArgument(e);if(r==null)return null;var i=this.mode;n&&this.switchMode(n),this.gullet.beginGroup();var s=this.parseExpression(!1,"EOF");this.expect("EOF"),this.gullet.endGroup();var a={type:"ordgroup",mode:this.mode,loc:r.loc,body:s};return n&&this.switchMode(i),a}parseGroup(e,n){var r=this.fetch(),i=r.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var a=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var o=this.parseExpression(!1,a),l=this.fetch();this.expect(a),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:wc.range(r,l),body:o,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(n,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!qq.hasOwnProperty(i)){if(this.settings.throwOnError)throw new Qt("Undefined control sequence: "+i,r);s=this.formatUnsupportedCmd(i),this.consume()}return s}formLigatures(e){for(var n=e.length-1,r=0;r<n;++r){var i=e[r],s=i.text;s==="-"&&e[r+1].text==="-"&&(r+1<n&&e[r+2].text==="-"?(e.splice(r,3,{type:"textord",mode:"text",loc:wc.range(i,e[r+2]),text:"---"}),n-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:wc.range(i,e[r+1]),text:"--"}),n-=1)),(s==="'"||s==="`")&&e[r+1].text===s&&(e.splice(r,2,{type:"textord",mode:"text",loc:wc.range(i,e[r+1]),text:s+s}),n-=1)}}parseSymbol(){var e=this.fetch(),n=e.text;if(/^\\verb[^a-zA-Z]/.test(n)){this.consume();var r=n.slice(5),i=r.charAt(0)==="*";if(i&&(r=r.slice(1)),r.length<2||r.charAt(0)!==r.slice(-1))throw new Qt(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}jL.hasOwnProperty(n[0])&&!hs[this.mode][n[0]]&&(this.settings.strict&&this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Accented Unicode text character "'+n[0]+'" used in math mode',e),n=jL[n[0]]+n.slice(1));var s=Sye.exec(n);s&&(n=n.substring(0,s.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var a;if(hs[this.mode][n]){this.settings.strict&&this.mode==="math"&&wR.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var o=hs[this.mode][n].group,l=wc.range(e),c;if(w1e.hasOwnProperty(o)){var d=o;c={type:"atom",mode:this.mode,family:d,loc:l,text:n}}else c={type:o,mode:this.mode,loc:l,text:n};a=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&(tq(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),a={type:"textord",mode:"text",loc:wc.range(e),text:n};else return null;if(this.consume(),s)for(var h=0;h<s[0].length;h++){var g=s[0][h];if(!kA[g])throw new Qt("Unknown accent ' "+g+"'",e);var v=kA[g][this.mode]||kA[g].text;if(!v)throw new Qt("Accent "+g+" unsupported in "+this.mode+" mode",e);a={type:"accent",mode:this.mode,loc:wc.range(e),label:v,isStretchy:!1,isShifty:!0,base:a}}return a}}VT.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Dk=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new VT(e,n);delete r.gullet.macros.current["\\df@tag"];var i=r.parse();if(delete r.gullet.macros.current["\\current@color"],delete r.gullet.macros.current["\\color"],r.gullet.macros.get("\\df@tag")){if(!n.displayMode)throw new Qt("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new tu("\\df@tag")])}]}return i},Xq=function(e,n,r){n.textContent="";var i=Ok(e,r).toNode();n.appendChild(i)};typeof document<"u"&&document.compatMode!=="CSS1Compat"&&(typeof console<"u"&&console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."),Xq=function(){throw new Qt("KaTeX doesn't work in quirks mode.")});var Aye=function(e,n){var r=Ok(e,n).toMarkup();return r},Nye=function(e,n){var r=new vk(n);return Dk(e,r)},Yq=function(e,n,r){if(r.throwOnError||!(e instanceof Qt))throw e;var i=Xt(["katex-error"],[new Xu(n)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},Ok=function(e,n){var r=new vk(n);try{var i=Dk(e,r);return F1e(i,e,r)}catch(s){return Yq(s,e,r)}},Rye=function(e,n){var r=new vk(n);try{var i=Dk(e,r);return U1e(i,e,r)}catch(s){return Yq(s,e,r)}},kye="0.16.33",Pye={Span:pw,Anchor:bk,SymbolNode:Xu,SvgNode:hp,PathNode:em,LineNode:SR},kR={version:kye,render:Xq,renderToString:Aye,ParseError:Qt,SETTINGS_SCHEMA:jM,__parse:Nye,__renderToDomTree:Ok,__renderToHTMLTree:Rye,__setFontMetrics:m1e,__defineSymbol:J,__defineFunction:_n,__defineMacro:Ie,__domTree:Pye};const Iye={};function Dye(t){const e=this,n=t||Iye,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Wxe(n)),s.push(zxe()),a.push(jxe(n))}const FL=/[#.]/g;function Oye(t,e){const n=t||"",r={};let i=0,s,a;for(;i<n.length;){FL.lastIndex=i;const o=FL.exec(n),l=n.slice(i,o?o.index:n.length);l&&(s?s==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:a=l,i+=l.length),o&&(s=o[0],i++)}return{type:"element",tagName:a||e||"div",properties:r,children:[]}}function Kq(t,e,n){const r=n?Fye(n):void 0;function i(s,a,...o){let l;if(s==null){l={type:"root",children:[]};const c=a;o.unshift(c)}else{l=Oye(s,e);const c=l.tagName.toLowerCase(),d=r?r.get(c):void 0;if(l.tagName=d||c,Lye(a))o.unshift(a);else for(const[h,g]of Object.entries(a))zye(t,l.properties,h,g)}for(const c of o)PR(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function Lye(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const i=e[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const a of s)if(typeof a!="number"&&typeof a!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function zye(t,e,n,r){const i=M$(t,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=wO(r):i.commaSeparated?s=xO(r):i.commaOrSpaceSeparated?s=wO(xO(r).join(" ")):s=UL(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?jye(r):String(r);if(Array.isArray(s)){const a=[];for(const o of s)a.push(UL(i,i.property,o));s=a}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function PR(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)PR(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?PR(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function UL(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||hS(n)===hS(e)))return!0}return n}function jye(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function Fye(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const Uye=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],Bye=Kq(T$,"div"),Hye=Kq(RT,"g",Uye),PA={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Vye(t,e){return Zq(t,{})||{type:"root",children:[]}}function Zq(t,e){const n=Gye(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function Gye(t,e){switch(t.nodeType){case 1:return Xye(t,e);case 3:return $ye(t);case 8:return qye(t);case 9:return BL(t,e);case 10:return Wye();case 11:return BL(t,e);default:return}}function BL(t,e){return{type:"root",children:Qq(t,e)}}function Wye(){return{type:"doctype"}}function $ye(t){return{type:"text",value:t.nodeValue||""}}function qye(t){return{type:"comment",value:t.nodeValue||""}}function Xye(t,e){const n=t.namespaceURI,r=n===PA.svg?Hye:Bye,i=n===PA.html?t.tagName.toLowerCase():t.tagName,s=n===PA.html&&i==="template"?t.content:t,a=t.getAttributeNames(),o={};let l=-1;for(;++l<a.length;)o[a[l]]=t.getAttribute(a[l])||"";return r(i,o,Qq(s,e))}function Qq(t,e){const n=t.childNodes,r=[];let i=-1;for(;++i<n.length;){const s=Zq(n[i],e);s!==void 0&&r.push(s)}return r}new DOMParser;function Yye(t,e){const n=Kye(t);return Vye(n)}function Kye(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const HL=(function(t,e,n){const r=pk(n);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(e=t.children.indexOf(e),e<0)throw new Error("Expected child node or index");for(;++e<t.children.length;)if(r(t.children[e],e,t))return t.children[e]}),Tv=(function(t){if(t==null)return Jye;if(typeof t=="string")return Qye(t);if(typeof t=="object")return Zye(t);if(typeof t=="function")return Lk(t);throw new Error("Expected function, string, or array as `test`")});function Zye(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Tv(t[n]);return Lk(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function Qye(t){return Lk(e);function e(n){return n.tagName===t}}function Lk(t){return e;function e(n,r,i){return!!(ebe(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Jye(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function ebe(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const VL=/\n/g,GL=/[\t ]+/g,IR=Tv("br"),WL=Tv(lbe),tbe=Tv("p"),$L=Tv("tr"),nbe=Tv(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",obe,cbe]),Jq=Tv(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function rbe(t,e){const n=e||{},r="children"in t?t.children:[],i=Jq(t),s=nX(t,{whitespace:n.whitespace||"normal"}),a=[];(t.type==="text"||t.type==="comment")&&a.push(...tX(t,{breakBefore:!0,breakAfter:!0}));let o=-1;for(;++o<r.length;)a.push(...eX(r[o],t,{whitespace:s,breakBefore:o?void 0:i,breakAfter:o<r.length-1?IR(r[o+1]):i}));const l=[];let c;for(o=-1;++o<a.length;){const d=a[o];typeof d=="number"?c!==void 0&&d>c&&(c=d):d&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(d))}return l.join("")}function eX(t,e,n){return t.type==="element"?ibe(t,e,n):t.type==="text"?n.whitespace==="normal"?tX(t,n):sbe(t):[]}function ibe(t,e,n){const r=nX(t,n),i=t.children||[];let s=-1,a=[];if(nbe(t))return a;let o,l;for(IR(t)||$L(t)&&HL(e,t,$L)?l=`
`:tbe(t)?(o=2,l=2):Jq(t)&&(o=1,l=1);++s<i.length;)a=a.concat(eX(i[s],t,{whitespace:r,breakBefore:s?void 0:o,breakAfter:s<i.length-1?IR(i[s+1]):l}));return WL(t)&&HL(e,t,WL)&&a.push("	"),o&&a.unshift(o),l&&a.push(l),a}function tX(t,e){const n=String(t.value),r=[],i=[];let s=0;for(;s<=n.length;){VL.lastIndex=s;const l=VL.exec(n),c=l&&"index"in l?l.index:n.length;r.push(abe(n.slice(s,c).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),s===0?e.breakBefore:!0,c===n.length?e.breakAfter:!0)),s=c+1}let a=-1,o;for(;++a<r.length;)r[a].charCodeAt(r[a].length-1)===8203||a<r.length-1&&r[a+1].charCodeAt(0)===8203?(i.push(r[a]),o=void 0):r[a]?(typeof o=="number"&&i.push(o),i.push(r[a]),o=0):(a===0||a===r.length-1)&&i.push(0);return i}function sbe(t){return[String(t.value)]}function abe(t,e,n){const r=[];let i=0,s;for(;i<t.length;){GL.lastIndex=i;const a=GL.exec(t);s=a?a.index:t.length,!i&&!s&&a&&!e&&r.push(""),i!==s&&r.push(t.slice(i,s)),i=a?s+a[0].length:s}return i!==s&&!n&&r.push(""),r.join(" ")}function nX(t,e){if(t.type==="element"){const n=t.properties||{};switch(t.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}function obe(t){return!!(t.properties||{}).hidden}function lbe(t){return t.tagName==="td"||t.tagName==="th"}function cbe(t){return t.tagName==="dialog"&&!(t.properties||{}).open}const ube={},dbe=[];function fbe(t){const e=t||ube;return function(n,r){Q$(n,"element",function(i,s){const a=Array.isArray(i.properties.className)?i.properties.className:dbe,o=a.includes("language-math"),l=a.includes("math-display"),c=a.includes("math-inline");let d=l;if(!o&&!l&&!c)return;let h=s[s.length-1],g=i;if(i.tagName==="code"&&o&&h&&h.type==="element"&&h.tagName==="pre"&&(g=h,h=s[s.length-2],d=!0),!h)return;const v=rbe(g,{whitespace:"pre"});let b;try{b=kR.renderToString(v,{...e,displayMode:d,throwOnError:!0})}catch(w){const S=w,E=S.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...s,i],cause:S,place:i.position,ruleId:E,source:"rehype-katex"});try{b=kR.renderToString(v,{...e,displayMode:d,strict:"ignore",throwOnError:!1})}catch{b=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(e.errorColor||"#cc0000"),title:String(w)},children:[{type:"text",value:v}]}]}}typeof b=="string"&&(b=Yye(b).children);const _=h.children.indexOf(g);return h.children.splice(_,1,...b),Z$})}}function zk(t){let e=t;if(typeof e=="object"&&e!==null&&"value"in e&&(e=e.value),typeof e=="string")try{e=JSON.parse(e)}catch{return[]}return Array.isArray(e)?e:e?[e]:[]}function gw(t){const e=new Map,n=zk(t);for(const r of n){const i=r;typeof(i==null?void 0:i.name)=="string"&&typeof(i==null?void 0:i.reward_min)=="number"&&typeof(i==null?void 0:i.reward_max)=="number"&&e.set(i.name,{min:i.reward_min,max:i.reward_max})}return e}function pp(t){const e=new Map,n=zk(t);for(const r of n){const i=r;if(typeof(i==null?void 0:i.name)!="string")continue;const s=i.metrics_ranges;if(s&&typeof s=="object"){const a=new Map;for(const[o,l]of Object.entries(s)){const c=l;if(typeof(c==null?void 0:c.min)=="number"&&typeof(c==null?void 0:c.max)=="number"){const d={min:c.min,max:c.max};c.invert===!0&&(d.invert=!0),a.set(o,d)}}a.size>0&&e.set(i.name,a)}}return e}function vw(t){const e=new Map;if(!t)return e;for(const[n,r]of Object.entries(t)){const i=new Map;for(const[s,a]of Object.entries(r))if(typeof(a==null?void 0:a.min)=="number"&&typeof(a==null?void 0:a.max)=="number"){const o={min:a.min,max:a.max};a.invert===!0&&(o.invert=!0),i.set(s,o)}i.size>0&&e.set(n,i)}return e}function mp(t,e){const n=new Map;for(const[r,i]of e)n.set(r,new Map(i));for(const[r,i]of t){const s=n.get(r)??new Map;for(const[a,o]of i)s.set(a,o);n.set(r,s)}return n}function _1({prompts:t,data:e,samplesData:n,rolloutMetrics:r,goldenAnswers:i,infoTurns:s,isLoading:a,step:o,scrollToSampleId:l=null,showGoTo:c=!1,goToBasePath:d="/rollouts",goToStepParam:h="step",filterGroupId:g=null,filterSampleIdx:v=null,lastValidSampleAtom:b=TG,collapseAllSignal:_=0,expandAllSignal:w=0,defaultSectionsOpen:S=!0,envRewardRanges:E,envMetricRanges:A,advantageRange:N,renderOptions:D=[],formatThinkBlocks:P=!0}){var le;const L=T.useMemo(()=>{if(!r)return new Map;const fe=new Map;for(const we of r){const pe=fe.get(we.sample_idx)||[];pe.push(we),fe.set(we.sample_idx,pe)}return fe},[r]),R=T.useMemo(()=>{if(!r)return[];const fe=new Set;for(const we of r)fe.add(we.metric_name);return[...fe].sort()},[r]),O=T.useMemo(()=>{if(!i)return new Map;const fe=new Map;for(const we of i){const pe=fe.get(we.sample_idx)||[];pe.push(we),fe.set(we.sample_idx,pe)}return fe},[i]),W=T.useMemo(()=>{if(!s)return new Map;const fe=new Map;for(const we of s){const pe=fe.get(we.sample_idx)||[];pe.push(we),fe.set(we.sample_idx,pe)}return fe},[s]),F=T.useMemo(()=>{if(!t)return new Map;const fe=new Map;for(const we of t)fe.set(we.group_id,we);return fe},[t]),V=T.useMemo(()=>{if(!n)return new Map;const fe=new Map;for(const we of n)fe.set(we.sample_idx,we);return fe},[n]),G=T.useMemo(()=>{if(!e)return[];const fe=new Map,we=new Map;for(const Ve of e){const ye=fe.get(Ve.sample_idx)||[];ye.push(Ve),fe.set(Ve.sample_idx,ye),we.set(Ve.sample_idx,Ve.group_id)}const pe=[];for(const[Ve,ye]of fe){const Oe=[...ye].sort((Ue,Ee)=>Ue.turn_order-Ee.turn_order),he=we.get(Ve)??-1,Re=F.get(he)??null,oe=V.get(Ve);pe.push({sample_idx:Ve,group_id:he,prompt:Re,turns:Oe,reward:(oe==null?void 0:oe.reward)??null,advantage:(oe==null?void 0:oe.advantage)??null,total_tokens:(oe==null?void 0:oe.total_tokens)??null,raw_string:(oe==null?void 0:oe.raw_string)??null})}let xe=pe.sort((Ve,ye)=>Ve.sample_idx-ye.sample_idx);return g!==null&&(xe=xe.filter(Ve=>Ve.group_id===g)),v!==null&&(xe=xe.filter(Ve=>Ve.sample_idx===v)),xe},[e,F,V,g,v]),[Z,B]=cn(b),q=G[0],K=(q==null?void 0:q.sample_idx)??null,Y=T.useMemo(()=>K!==null?L.get(K)??[]:[],[L,K]),Q=T.useMemo(()=>K!==null?O.get(K)??[]:[],[O,K]),U=T.useMemo(()=>K!==null?W.get(K)??[]:[],[W,K]);T.useEffect(()=>{!q||v===null||B({sample:q,rolloutMetrics:Y,goldenAnswers:Q})},[q,Y,Q,v,B]);const j=v!==null&&(Z==null?void 0:Z.sample.sample_idx)===v?Z:null,X=q||(j==null?void 0:j.sample),H=q?Y:(j==null?void 0:j.rolloutMetrics)||[],ie=q?Q:(j==null?void 0:j.goldenAnswers)||[],ne=q?U:[],re=T.useRef(null);T.useEffect(()=>{if(l==null||re.current===l)return;const fe=document.getElementById(`sample-${l}`);fe&&(fe.scrollIntoView({behavior:"smooth",block:"start"}),re.current=l)},[l,G]);const ue=o!==void 0?o:(le=e==null?void 0:e[0])==null?void 0:le.step;return v===null?p.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground text-sm",children:p.jsx("p",{children:"Select a sample from the sidebar to view"})}):!X&&!a?p.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground",children:p.jsx("p",{children:"No rollouts data available"})}):X?p.jsx("div",{className:"space-y-4 min-w-0",children:p.jsx(hbe,{sample:X,rolloutMetrics:H,goldenAnswers:ie,infoTurns:ne,availableMetricNames:R,showGoTo:c,goToStep:ue,goToBasePath:d,goToStepParam:h,collapseAllSignal:_,expandAllSignal:w,defaultSectionsOpen:S,envRewardRanges:E,envMetricRanges:A,advantageRange:N,renderOptions:D,formatThinkBlocks:P},X.sample_idx)}):null}function hbe({sample:t,rolloutMetrics:e,goldenAnswers:n,infoTurns:r,availableMetricNames:i,showGoTo:s,goToStep:a,goToBasePath:o="/rollouts",goToStepParam:l="step",collapseAllSignal:c=0,expandAllSignal:d=0,defaultSectionsOpen:h=!0,envRewardRanges:g,envMetricRanges:v,advantageRange:b,renderOptions:_=[],formatThinkBlocks:w=!0}){var xe,Ve;const[S,E]=cn(Vce),A=S.length===0,N=S.length===1&&S[0]==="__none__",D=ye=>A?!0:N?!1:S.includes(ye),P=ye=>{E(Oe=>{if(Oe.length===0)return i.filter(oe=>oe!==ye);const he=Oe.filter(oe=>oe!=="__none__");if(he.length===0)return[ye];if(he.includes(ye)){const oe=he.filter(Ue=>Ue!==ye);return oe.length===0?["__none__"]:oe}const Re=[...he,ye];return i.length>0&&Re.length>=i.length?[]:Re})},L=T.useMemo(()=>[...e].sort((ye,Oe)=>ye.metric_name.localeCompare(Oe.metric_name)),[e]),R=T.useMemo(()=>S.length===0?L:L.filter(ye=>S.includes(ye.metric_name)),[L,S]),O=T.useMemo(()=>n.filter(ye=>ye.value!=null&&ye.value!==""),[n]),W=((xe=t.prompt)==null?void 0:xe.env)??null,F=k5(),V=()=>{a!=null&&F(`${o}?${l}=${a}&group=${t.group_id}&sample=${t.sample_idx}`)},G=T.useMemo(()=>{if(!r||r.length===0)return new Map;const ye=new Map;for(const Oe of r){const he=ye.get(Oe.turn_order)||[];he.push(Oe),ye.set(Oe.turn_order,he)}return ye},[r]),[Z,B]=T.useState(!1),[q,K]=T.useState(!1),[Y,Q]=T.useState(h),[U,j]=T.useState({}),[X,H]=T.useState(c),[ie,ne]=T.useState(d),re=t.turns.length;if(c!==X){H(c),B(!1),K(!1),Q(!1);const ye={};for(let Oe=0;Oe<re;Oe++)ye[Oe]=!1;j(ye)}if(d!==ie){ne(d),B(!0),K(!0),Q(!0);const ye={};for(let Oe=0;Oe<re;Oe++)ye[Oe]=!0;j(ye)}const ue=ye=>{j(Oe=>({...Oe,[ye]:!Oe[ye]}))},le=W?g==null?void 0:g.get(W):void 0,fe=[];W&&fe.push({label:"Env",value:W});const we=t.turns.filter(ye=>ye.turn_type==="model").length;if(we>1&&fe.push({label:"Turns",value:String(we)}),t.reward!==null){const ye=LA(t.reward,(le==null?void 0:le.min)??null,(le==null?void 0:le.max)??null);fe.push({label:"Reward",value:t.reward.toFixed(2),rangeColor:ye})}if(t.advantage!==null){const ye=LA(t.advantage,(b==null?void 0:b.min)??null,(b==null?void 0:b.max)??null);fe.push({label:"Advantage",value:t.advantage.toFixed(2),rangeColor:ye})}const pe=[];for(const ye of R){const Oe=ye.env??W,he=Mbe(v,Oe,ye.metric_name),Re=LA(ye.value,(he==null?void 0:he.min)??null,(he==null?void 0:he.max)??null,he==null?void 0:he.invert);pe.push({label:M4(ye.metric_name),value:wbe(ye.value),highlight:Re?void 0:ye.value===1?"positive":ye.value===0?"negative":void 0,rangeColor:Re})}return p.jsxs("div",{id:`sample-${t.sample_idx}`,children:[(fe.length>0||pe.length>0||s)&&p.jsxs("div",{className:"mb-2 space-y-0.5",children:[(fe.length>0||s||i.length>0)&&p.jsxs("div",{className:"flex items-center gap-2 text-sm min-w-0 flex-wrap",children:[s&&p.jsx(Tn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs mr-1",onClick:V,disabled:a==null,children:"Go to"}),fe.map((ye,Oe)=>p.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[Oe>0&&p.jsx("span",{className:"text-foreground/20",children:"·"}),p.jsx("span",{className:"text-muted-foreground",children:ye.label}),p.jsx("span",{className:"font-medium tabular-nums text-foreground/80",style:ye.rangeColor?{color:ye.rangeColor}:void 0,children:ye.value})]},ye.label)),i.length>0&&p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs("button",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:underline cursor-pointer",children:["Sample Metrics",p.jsx(Vr,{className:"h-3 w-3"})]})}),p.jsxs(pl,{align:"start",className:"w-max max-w-[400px]",children:[p.jsx(_c,{onSelect:ye=>{ye.preventDefault(),E([])},children:"Select All"}),p.jsx(_c,{onSelect:ye=>{ye.preventDefault(),E(["__none__"])},children:"Unselect All"}),p.jsx(Hl,{}),i.map(ye=>p.jsx(vi,{checked:D(ye),onCheckedChange:()=>P(ye),onSelect:Oe=>Oe.preventDefault(),children:M4(ye)},ye))]})]})]}),pe.length>0&&p.jsx("div",{className:"flex items-center gap-1.5 text-xs min-w-0 flex-wrap",children:pe.map((ye,Oe)=>p.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[p.jsx("span",{className:"text-muted-foreground",children:ye.label}),p.jsx("span",{className:Rt("font-medium tabular-nums",!ye.rangeColor&&ye.highlight==="positive"&&"text-emerald-600 dark:text-emerald-400",!ye.rangeColor&&ye.highlight==="negative"&&"text-red-500 dark:text-red-400",!ye.rangeColor&&!ye.highlight&&"text-foreground/80"),style:ye.rangeColor?{color:ye.rangeColor}:void 0,children:ye.value}),Oe<pe.length-1&&p.jsx("span",{className:"text-foreground/20",children:"·"})]},ye.label))})]}),O.length>0&&p.jsxs(Ki,{open:Z,onOpenChange:B,className:"mb-2",children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-amber-500/[0.03] hover:bg-amber-500/[0.07] rounded transition-colors overflow-hidden",children:p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/70 font-medium text-[11px] uppercase tracking-wide shrink-0",children:"Golden"}),!Z&&p.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:O.map(ye=>`${M4(ye.key)}: ${ye.value}`).join(" · ")}),p.jsx("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!Z&&"-rotate-90")})})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"py-2 px-2 -mx-2 bg-amber-500/[0.03] rounded-b",children:p.jsx("div",{className:"flex items-baseline gap-2 text-xs min-w-0 flex-wrap",children:O.map((ye,Oe)=>p.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[Oe>0&&p.jsx("span",{className:"text-foreground/20",children:"·"}),p.jsx("span",{className:"text-muted-foreground",children:M4(ye.key)}),p.jsx("span",{className:"font-medium text-foreground/80 whitespace-pre-wrap break-words",children:_.length>0&&ye.value?p.jsx(N2,{content:ye.value,renderOptions:_}):ye.value})]},ye.key))})})})]}),((Ve=t.prompt)==null?void 0:Ve.system_prompt)&&p.jsxs(Ki,{open:q,onOpenChange:K,className:"mb-2",children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:"System"}),!q&&p.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:IA(t.prompt.system_prompt,60,w)}),p.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[t.prompt.tokens_system_prompt!=null&&p.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[t.prompt.tokens_system_prompt.toLocaleString()," ","tokens"]}),p.jsx(OA,{text:t.prompt.system_prompt}),p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!q&&"-rotate-90")})]})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"py-2",children:p.jsx(DA,{content:t.prompt.system_prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.prompt&&p.jsxs(Ki,{open:Y,onOpenChange:Q,className:"mb-2",children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:"User"}),!Y&&p.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:IA(t.prompt.prompt,60,w)}),p.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[t.prompt.tokens_prompt!=null&&p.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[t.prompt.tokens_prompt.toLocaleString()," tokens"]}),p.jsx(OA,{text:t.prompt.prompt}),p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!Y&&"-rotate-90")})]})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"py-2",children:p.jsx(DA,{content:t.prompt.prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.turns.map((ye,Oe)=>{const he=U[Oe]??h,Re=ye.turn_type==="model"?t.turns.slice(0,Oe).filter(oe=>oe.turn_type==="model").length:null;return p.jsxs(Ki,{open:he,onOpenChange:()=>ue(Oe),className:"mb-2",children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:mbe(ye.turn_type)}),!he&&p.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:IA(ye.content,60,ye.turn_type==="model"&&w)}),p.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[ye.tokens!=null&&p.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[ye.tokens.toLocaleString()," tokens"]}),Re!==null&&p.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:["Turn ",Re]}),p.jsx(OA,{text:ye.content}),p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!he&&"-rotate-90")})]})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"py-2",children:[p.jsx(DA,{content:ye.content,renderOptions:_,enableThinkBlocks:ye.turn_type==="model"&&w}),(()=>{const oe=G.get(ye.turn_order);return!oe||oe.length===0?null:p.jsx("div",{className:"mt-2 space-y-1",children:oe.map((Ue,Ee)=>p.jsx(pbe,{info:Ue,renderOptions:_},`${Ue.info_key}-${Ee}`))})})()]})})]},`${ye.sample_idx}-${ye.turn_order}`)})]})}function pbe({info:t,renderOptions:e=[]}){const[n,r]=T.useState(!1);return p.jsxs(Ki,{open:n,onOpenChange:r,children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"py-1 px-2 -mx-2 cursor-pointer bg-accent/40 hover:bg-accent/60 rounded transition-colors flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-3 w-3 text-muted-foreground transition-transform shrink-0",!n&&"-rotate-90")}),p.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:t.info_key}),!n&&t.info_value&&p.jsxs("span",{className:"text-xs text-muted-foreground/50 truncate min-w-0",children:[t.info_value.slice(0,80),t.info_value.length>80?"…":""]})]})}),p.jsx(Qi,{children:p.jsx("div",{className:"py-1.5 px-2 text-xs bg-accent/20 rounded mt-0.5",children:e.length>0&&t.info_value?p.jsx(N2,{content:t.info_value,renderOptions:e}):p.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:t.info_value})})})]})}function mbe(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function gbe(t){return t.replace(/<think>[\s\S]*?<\/think>\s*/g,"").trimStart()}function IA(t,e=60,n=!0){if(!t)return"";const i=(n?gbe(t):t).replace(/\s+/g," ").trim();return i.length<=e?i:i.slice(0,e)+"…"}function vbe(t){const e=[],n=/<think>([\s\S]*?)<\/think>/g;let r=0,i;for(;(i=n.exec(t))!==null;)i.index>r&&e.push({type:"text",value:t.slice(r,i.index)}),e.push({type:"think",value:i[1].replace(/^\n/,"")}),r=n.lastIndex;return r<t.length&&e.push({type:"text",value:t.slice(r)}),e}function xbe(t,e=80){const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"…"}function qL({content:t}){const[e,n]=T.useState(!0);return p.jsxs("span",{className:"block",children:[p.jsxs("span",{className:"cursor-pointer select-none inline-flex items-center gap-0.5 text-foreground/40 hover:text-foreground/60 transition-colors",onClick:()=>n(r=>!r),children:["<think>",!e&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-foreground/40 italic text-xs ml-1",children:xbe(t)}),p.jsx("span",{children:"</think>"}),p.jsx(f1,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&p.jsx(Vr,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&p.jsxs("span",{className:"block text-foreground/70",children:[t,p.jsx("span",{className:"cursor-pointer select-none inline-flex items-center gap-0.5 text-foreground/40 hover:text-foreground/60 transition-colors",onClick:()=>n(!1),children:"</think>"})]})]})}function ybe(t){const e=[],n=/(\$\$[\s\S]*?\$\$|\\\[[\s\S]*?\\\]|\$(?!\$)(?:[^$\\]|\\.)+?\$|\\\((?:[^\\]|\\.)*?\\\))/g;let r=0,i;for(;(i=n.exec(t))!==null;){i.index>r&&e.push({type:"text",value:t.slice(r,i.index)});const s=i[1];s.startsWith("$$")?e.push({type:"display",value:s.slice(2,-2)}):s.startsWith("\\[")?e.push({type:"display",value:s.slice(2,-2)}):s.startsWith("\\(")?e.push({type:"inline",value:s.slice(2,-2)}):e.push({type:"inline",value:s.slice(1,-1)}),r=n.lastIndex}return r<t.length&&e.push({type:"text",value:t.slice(r)}),e}function bbe(t){const e=[],n=/^```(\w*)\n([\s\S]*?)^```\s*$/gm;let r=0,i;for(;(i=n.exec(t))!==null;)i.index>r&&e.push({type:"text",value:t.slice(r,i.index)}),e.push({type:"code",value:i[2].replace(/\n$/,""),language:i[1]||void 0}),r=n.lastIndex;return r<t.length&&e.push({type:"text",value:t.slice(r)}),e.length===0&&e.push({type:"text",value:t}),e}function _be({code:t,language:e}){const[n,r]=T.useState(!1),i=async s=>{s.stopPropagation(),await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)};return p.jsxs("div",{className:"my-2 rounded-md border bg-muted/50 overflow-hidden",children:[e&&p.jsxs("div",{className:"flex items-center justify-between px-3 py-1 text-xs text-muted-foreground border-b bg-muted/30",children:[p.jsx("span",{children:e}),p.jsx("button",{onClick:i,className:"hover:text-foreground transition-colors",title:"Copy code",children:n?p.jsx(bv,{className:"h-3 w-3"}):p.jsx(iT,{className:"h-3 w-3"})})]}),p.jsx("pre",{className:"p-3 text-sm font-sans whitespace-pre-wrap break-words overflow-x-auto",children:p.jsx("code",{children:t})})]})}function Sbe({content:t}){const e="katex-scroll",n=ybe(t);return p.jsx("div",{className:Rt("whitespace-pre-wrap break-words [&_.katex]:text-sm",e),children:n.map((r,i)=>{if(r.type==="text")return p.jsx("span",{children:r.value},i);try{const s=kR.renderToString(r.value,{displayMode:r.type==="display",throwOnError:!1});return p.jsx("span",{dangerouslySetInnerHTML:{__html:s}},i)}catch{return p.jsx("span",{children:r.type==="display"?`$$${r.value}$$`:`$${r.value}$`},i)}})})}function XL({content:t,renderMarkdown:e,renderLatex:n}){const r="katex-scroll";if(e){const i=[],s=[];return n&&(i.push(Dye),s.push(fbe)),p.jsx("div",{className:Rt("prose prose-sm dark:prose-invert max-w-none break-words [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&>*+*]:mt-[0.75em]",n&&r),children:p.jsx(kxe,{remarkPlugins:i,rehypePlugins:s,children:t})})}return n?p.jsx(Sbe,{content:t}):p.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})}function N2({content:t,renderOptions:e=[]}){const n=e.includes("markdown"),r=e.includes("latex"),i=e.includes("code");if(!n&&!r&&!i)return p.jsx(p.Fragment,{children:t});if(i){const s=bbe(t);if(s.some(a=>a.type==="code"))return p.jsx(p.Fragment,{children:s.map((a,o)=>a.type==="code"?p.jsx(_be,{code:a.value,language:a.language},o):p.jsx(XL,{content:a.value,renderMarkdown:n,renderLatex:r},o))})}return p.jsx(XL,{content:t,renderMarkdown:n,renderLatex:r})}function DA({content:t,renderOptions:e=[],enableThinkBlocks:n=!0}){const r=T.useMemo(()=>n?vbe(t):[{type:"text",value:t}],[t,n]),i=e.length>0;return r.length===1&&r[0].type==="text"?i?p.jsx("div",{className:"text-sm text-foreground/90",children:p.jsx(N2,{content:t,renderOptions:e})}):p.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:t}):i?p.jsx("div",{className:"text-sm text-foreground/90",children:r.map((s,a)=>s.type==="text"?p.jsx(N2,{content:s.value,renderOptions:e},a):p.jsx(qL,{content:s.value},a))}):p.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:r.map((s,a)=>s.type==="text"?p.jsx("span",{children:s.value},a):p.jsx(qL,{content:s.value},a))})}function OA({text:t}){const[e,n]=T.useState(!1),r=async i=>{i.stopPropagation(),await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),2e3)};return p.jsx("button",{onClick:r,className:"p-0.5 rounded hover:bg-muted-foreground/10 transition-colors",title:e?"Copied!":"Copy to clipboard",children:e?p.jsx(bv,{className:"h-3.5 w-3.5 text-foreground/30"}):p.jsx(iT,{className:"h-3.5 w-3.5 text-foreground/30"})})}function M4(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function wbe(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function Mbe(t,e,n){var r;if(t){if(e){const i=(r=t.get(e))==null?void 0:r.get(n);if(i)return i}for(const i of t.values()){const s=i.get(n);if(s)return s}}}function LA(t,e,n,r){if(e==null||n==null||e>=n)return;let i=Math.max(0,Math.min(1,(t-e)/(n-e)));return r&&(i=1-i),`hsl(${(i*120).toFixed(0)} 80% 38%)`}function GT({rawString:t,totalTokens:e,turns:n}){const[r,i]=T.useState(!1),[s,a]=T.useState(!1),o=async()=>{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),2e3)},l=c=>{const d=c.split(`
`);return d.map((h,g)=>p.jsxs("span",{children:[h,g<d.length-1&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"text-muted-foreground/50",children:"\\n"}),`
`]})]},g))};return p.jsxs($f,{children:[p.jsx(sT,{asChild:!0,children:p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Raw Text"})}),p.jsxs(qf,{className:"sm:max-w-[75vw] max-h-[80vh]",children:[p.jsx(jd,{children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Fd,{children:"Raw Text"}),p.jsxs("span",{className:"text-xs text-muted-foreground",children:[e!=null&&p.jsxs(p.Fragment,{children:[e.toLocaleString()," tokens"]}),e!=null&&n!=null&&n>0&&" • ",n!=null&&n>0&&p.jsxs(p.Fragment,{children:[n," ",n===1?"turn":"turns"]})]}),p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:o,children:[r?p.jsx(bv,{className:"size-3"}):p.jsx(iT,{className:"size-3"}),r?"Copied":"Copy"]}),p.jsx(g1,{variant:"outline",size:"sm",pressed:s,onPressedChange:a,className:"text-xs",children:"Line breaks"})]})}),p.jsx(_v,{className:"h-[60vh] w-full rounded-md border bg-background p-4",children:p.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words font-sans",children:s?l(t):t})})]})]})}function Tbe(t){switch(t){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}}function Ebe(t){switch(t){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}}function Cbe(t){const e=T.useMemo(()=>{if(t!=null&&t.prompts)return t.prompts.map(o=>({step:o.trainer_step,group_id:o.group_id,env:o.env,system_prompt:o.system_prompt,tokens_system_prompt:o.tokens_system_prompt,prompt:o.prompt,tokens_prompt:o.tokens_prompt}))},[t]),n=T.useMemo(()=>{if(t!=null&&t.rollouts)return t.rollouts.map(o=>({step:o.trainer_step,group_id:o.group_id,sample_idx:o.sample_idx,turn_order:o.turn_order,turn_type:o.turn_type,content:o.content,tokens:o.tokens}))},[t]),r=T.useMemo(()=>{if(t!=null&&t.samples_data)return t.samples_data.map(o=>({step:o.trainer_step,group_id:o.group_id,sample_idx:o.sample_idx,reward:o.reward,advantage:o.advantage,turns:o.turns,total_tokens:o.total_tokens,raw_string:o.raw_string}))},[t]),i=T.useMemo(()=>{if(!(t!=null&&t.rollout_metrics))return;const o=t.trainer_step??0;return t.rollout_metrics.map(l=>({step:o,sample_idx:l.sample_idx,env:l.env,metric_name:l.metric_name,value:l.value}))},[t]),s=T.useMemo(()=>{if(!(t!=null&&t.golden_answers))return;const o=t.trainer_step??0;return t.golden_answers.map(l=>({step:o,sample_idx:l.sample_idx,env:l.env,key:l.key,value:l.value}))},[t]),a=T.useMemo(()=>{if(!(t!=null&&t.info_turns))return;const o=t.trainer_step??0;return t.info_turns.map(l=>({step:o,sample_idx:l.sample_idx,turn_order:l.turn_order,env:l.env,info_key:l.info_key,info_value:l.info_value,info_type:l.info_type}))},[t]);return{mappedPrompts:e,mappedRollouts:n,mappedSamplesData:r,mappedRolloutMetrics:i,mappedGoldenAnswers:s,mappedInfoTurns:a}}function Abe({runPath:t,groupId:e,sampleId:n,isEval:r,isCanceled:i,children:s}){var ue,le,fe,we,pe;const[a,o]=T.useState(!1),{data:l,isLoading:c,error:d}=kG(t,e,n,a,r),{data:h}=ed(t,a&&!!t,!1),g=r?((ue=h==null?void 0:h.summary)==null?void 0:ue.eval_env_details)??((le=h==null?void 0:h.config)==null?void 0:le.eval_env_details):(fe=h==null?void 0:h.config)==null?void 0:fe.environments,v=r||(we=h==null?void 0:h.summary)==null?void 0:we.env_details,b=T.useMemo(()=>gw(g),[g]),_=T.useMemo(()=>{const xe=pp(g),Ve=pp(v),ye=vw(h==null?void 0:h.data_metric_ranges);return mp(mp(xe,Ve),ye)},[g,v,h==null?void 0:h.data_metric_ranges]),w=T.useMemo(()=>{var Oe;const xe=(Oe=h==null?void 0:h.config)==null?void 0:Oe.group_size,Ve=typeof xe=="object"&&xe!==null&&"value"in xe?Number(xe.value):Number(xe);if(!Ve||isNaN(Ve)||Ve<=1)return null;const ye=Math.sqrt(Ve-1);return{min:-ye,max:ye}},[(pe=h==null?void 0:h.config)==null?void 0:pe.group_size]),S=(l==null?void 0:l.kind)==="rollouts_discarded"?l:null,{mappedPrompts:E,mappedRollouts:A,mappedSamplesData:N,mappedRolloutMetrics:D,mappedGoldenAnswers:P,mappedInfoTurns:L}=Cbe(S),R=T.useMemo(()=>{var Ve;if(!l||l.kind!=="eval")return null;const xe=(Ve=l.samples_data)==null?void 0:Ve[0];return xe?{groupId:xe.group_id,sampleIdx:xe.sample_idx}:null},[l]),O=(l==null?void 0:l.kind)==="rollouts_discarded"?"Discarded":(l==null?void 0:l.kind)==="rollouts"?"Kept":(l==null?void 0:l.kind)==="eval"?"Eval":null,W=k5(),F=T.useMemo(()=>l?l.kind==="rollouts"?`/rollouts?step=${l.step}&group=${e}&sample=${n}`:l.kind==="rollouts_discarded"?`/rollouts-discarded?trainer_step=${l.trainer_step}&group=${e}&sample=${n}`:l.kind==="eval"?`/evals?step=${l.step}&eval_name=${encodeURIComponent(l.eval_name)}&group=${e}&sample=${n}`:null:null,[l,e,n]),V=()=>{F&&(o(!1),W(F))},[G,Z]=T.useState(0),[B,q]=T.useState(0),[K,Y]=T.useState(!0),[Q,U]=cn(hT),[j,X]=cn(pT),H=Q.length+(j?1:0),ie=xe=>{U(Ve=>Ve.includes(xe)?Ve.filter(ye=>ye!==xe):[...Ve,xe])},ne=T.useMemo(()=>{if(!l)return null;const xe=l.kind==="rollouts"?l.samples_data:l.kind==="rollouts_discarded"?N:l.kind==="eval"?l.samples_data:null;if(!xe)return null;const Ve=l.kind==="eval"?(R==null?void 0:R.sampleIdx)??n:n;return xe.find(ye=>ye.sample_idx===Ve)??null},[l,N,n,R]),re=!c&&!d&&l&&l.kind!==null;return p.jsxs($f,{open:a,onOpenChange:o,children:[p.jsx(sT,{asChild:!0,children:s??p.jsx(Tn,{variant:"outline",size:"sm",className:"h-6 px-2 text-[10px]",children:"Check"})}),p.jsxs(qf,{className:"sm:max-w-[85vw] max-h-[85vh] overflow-auto",children:[p.jsx(jd,{children:p.jsxs(Fd,{className:"flex items-center gap-2 flex-wrap",children:[p.jsx("span",{children:(l==null?void 0:l.kind)==="eval"?`Completion ${n} / Sample ${e}`:`Sample ${n} / Group ${e}`}),O&&p.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[O,(l==null?void 0:l.kind)==="eval"&&l.eval_name&&` — ${l.eval_name}`]}),(S==null?void 0:S.discard_reason)&&p.jsx(q1,{variant:Ebe(S.discard_reason),className:"text-xs",children:Tbe(S.discard_reason)}),F&&p.jsx(Tn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:V,children:"Go to"}),re&&p.jsxs(p.Fragment,{children:[(ne==null?void 0:ne.raw_string)&&p.jsx(GT,{rawString:ne.raw_string,totalTokens:ne.total_tokens,turns:ne.turns??void 0}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{Z(xe=>xe+1),Y(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{q(xe=>xe+1),Y(!0)},children:"Expand All"}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",H>0&&` (${H})`]})}),p.jsxs(pl,{align:"start",className:"w-auto",children:[p.jsx(vi,{checked:j,onCheckedChange:xe=>X(!!xe),onSelect:xe=>xe.preventDefault(),children:"Format Think"}),p.jsx(vi,{checked:Q.includes("markdown"),onCheckedChange:()=>ie("markdown"),onSelect:xe=>xe.preventDefault(),children:"Markdown"}),p.jsx(vi,{checked:Q.includes("latex"),onCheckedChange:()=>ie("latex"),onSelect:xe=>xe.preventDefault(),children:"LaTeX"}),p.jsx(vi,{checked:Q.includes("code"),onCheckedChange:()=>ie("code"),onSelect:xe=>xe.preventDefault(),children:"Code"})]})]})]})]})}),d&&p.jsx($u,{className:"border-destructive",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-sm text-destructive",children:["Error: ",d instanceof Error?d.message:"Unknown error"]})})}),c&&!d&&p.jsx($u,{children:p.jsxs(eh,{className:"pt-6 space-y-3",children:[p.jsx(Zh,{className:"h-5 w-40"}),p.jsx(Zh,{className:"h-32 w-full"}),p.jsx(Zh,{className:"h-24 w-full"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(Zh,{className:"h-6 w-20"}),p.jsx(Zh,{className:"h-6 w-20"}),p.jsx(Zh,{className:"h-6 w-20"})]})]})}),!c&&!d&&(l==null?void 0:l.kind)==="rollouts"&&p.jsx(_1,{prompts:l.prompts,data:l.rollouts,samplesData:l.samples_data,rolloutMetrics:l.rollout_metrics,goldenAnswers:l.golden_answers,infoTurns:l.info_turns,step:l.step,filterGroupId:e,filterSampleIdx:n,envRewardRanges:b,envMetricRanges:_,advantageRange:w,collapseAllSignal:G,expandAllSignal:B,defaultSectionsOpen:K,renderOptions:Q,formatThinkBlocks:j}),!c&&!d&&(l==null?void 0:l.kind)==="rollouts_discarded"&&p.jsx(_1,{prompts:E,data:A,samplesData:N,rolloutMetrics:D,goldenAnswers:P,infoTurns:L,step:l.trainer_step,goToBasePath:"/rollouts-discarded",goToStepParam:"trainer_step",filterGroupId:e,filterSampleIdx:n,envRewardRanges:b,envMetricRanges:_,advantageRange:w,collapseAllSignal:G,expandAllSignal:B,defaultSectionsOpen:K,renderOptions:Q,formatThinkBlocks:j}),!c&&!d&&(l==null?void 0:l.kind)==="eval"&&p.jsx(_1,{prompts:l.prompts,data:l.rollouts,samplesData:l.samples_data,rolloutMetrics:l.rollout_metrics,goldenAnswers:l.golden_answers,infoTurns:l.info_turns,step:l.step,filterGroupId:(R==null?void 0:R.groupId)??e,filterSampleIdx:(R==null?void 0:R.sampleIdx)??n,envRewardRanges:b,envMetricRanges:_,advantageRange:w,collapseAllSignal:G,expandAllSignal:B,defaultSectionsOpen:K,renderOptions:Q,formatThinkBlocks:j}),!c&&!d&&(l==null?void 0:l.kind)===null&&p.jsx($u,{children:p.jsx(eh,{className:"pt-6",children:p.jsx("p",{className:"text-sm text-muted-foreground",children:i?"Sample canceled due to async policy.":"Sample not found in rollouts or discarded rollouts."})})})]})]})}const Nbe=.005;function Rbe(t){const e=t*2;if(e<=0)return{thresholdSeconds:.005,displayLabel:"5ms"};const n=Math.pow(10,Math.floor(Math.log10(e))),r=e/n;let i;r<1.5?i=1:r<3.5?i=2:r<7.5?i=5:i=10;const s=i*n,a=s>=1?`${s}ms`:`${Number(s.toPrecision(2))}ms`;return{thresholdSeconds:s/1e3,displayLabel:a}}function Ns(t){const e=Math.abs(t);if(e<1)return`${t.toFixed(2)}ms`;if(e<10)return`${t.toFixed(1)}ms`;if(e<1e3)return`${Math.round(t)}ms`;const n=t/1e3;if(e<6e4)return`${n.toFixed(2)}s`;const r=n/60;return e<36e5?`${r.toFixed(1)}min`:`${(r/60).toFixed(1)}h`}function zA(t){return t.toLocaleString("en-US")}function rX(t,e,n=[]){return[{label:"Duration",value:Ns(e)},...t.prompt_tokens!==void 0?[{label:"Prompt tokens",value:zA(t.prompt_tokens)}]:[],...t.rollout_tokens!==void 0?[{label:"Rollout tokens",value:zA(t.rollout_tokens)}]:[],...t.max_tokens!==void 0&&t.max_tokens!==null?[{label:"Max tokens",value:zA(t.max_tokens)}]:[],...n,...t.queue_time!==void 0&&t.queue_time!==null?[{label:"Queue time",value:Ns(t.queue_time*1e3)}]:[],...t.time_to_first_token!==void 0&&t.time_to_first_token!==null?[{label:"TTFT",value:Ns(t.time_to_first_token*1e3)}]:[],...t.prefill_time!==void 0&&t.prefill_time!==null?[{label:"Prefill time",value:Ns(t.prefill_time*1e3)}]:[],...t.decode_time!==void 0&&t.decode_time!==null?[{label:"Decode time",value:Ns(t.decode_time*1e3)}]:[],...t.inference_time!==void 0&&t.inference_time!==null?[{label:"Inference time",value:Ns(t.inference_time*1e3)}]:[],...t.e2e_latency!==void 0&&t.e2e_latency!==null?[{label:"E2E latency",value:Ns(t.e2e_latency*1e3)}]:[],...t.off_policy_steps!==void 0&&t.off_policy_steps!==null?[{label:"Off-policy steps",value:String(t.off_policy_steps)}]:[]]}function kbe(t,e){const n=t.replace("#",""),r=parseInt(n.substring(0,2),16),i=parseInt(n.substring(2,4),16),s=parseInt(n.substring(4,6),16),a=Math.round(r+(255-r)*e),o=Math.round(i+(255-i)*e),l=Math.round(s+(255-s)*e);return`#${a.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}`}const Pbe=new Set;function iX(t){var n;const e=(n=NT[t])==null?void 0:n.label;return e||t.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function Ibe(t,e=Nbe){if(t.length===0)return{sortedEvents:[],windowByOriginalIndex:new Map};const n=t.map((l,c)=>({event:l,originalIndex:c})).sort((l,c)=>l.event.timestamp-c.event.timestamp),r=new Array(n.length),i=new Array(n.length);let s=0,a=0;for(let l=0;l<n.length;l++){const c=n[l].event.timestamp;for(;c-n[s].event.timestamp>e;)s++;for(a<l&&(a=l);a+1<n.length&&n[a+1].event.timestamp-c<=e;)a++;r[l]=s,i[l]=a}const o=new Map;return n.forEach((l,c)=>{o.set(l.originalIndex,{start:r[c],end:i[c],sortedIndex:c})}),{sortedEvents:n,windowByOriginalIndex:o}}function Dbe({orchestratorData:t,trainerData:e,inferenceData:n,isLoading:r,intervalStart:i,intervalEnd:s,trainerGpuMetricsByGpuIndex:a,trainerGpuMetricsByRank:o,trainerGpuMetricsIsLoading:l=!1,trainerAvailableGpuMetrics:c=[],selectedTrainerGpuMetrics:d=[],onSelectedTrainerGpuMetricsChange:h,trainerSystemGpuIndices:g,trainerRankInfoByRank:v,totalSetupNodes:b,inferenceServerNodeMap:_,numInferenceServers:w=0,maxConcurrentPrompts:S=12,groupSize:E=1}){const A=ki(dT),N=T.useMemo(()=>{const B=(g??[]).filter(K=>Number.isFinite(K));return B.length>0?B:a?Object.keys(a).map(Number).filter(K=>Number.isFinite(K)).sort((K,Y)=>K-Y):[]},[g,a]),D=s-i,P=T.useMemo(()=>!t||t.length===0?[]:t.filter(B=>B.timestamp>=i&&B.timestamp<s),[t,i,s]),L=T.useMemo(()=>!e||e.length===0?[]:e.filter(B=>B.start_time<s&&B.end_time>i),[e,i,s]),R=T.useMemo(()=>!n||n.length===0?[]:n.filter(B=>{const q=B.end_time+(B.environment_response_time??0)+(B.compute_reward_time??0);return B.start_time<s&&q>i}),[n,i,s]),{eventsByRank:O,ranks:W}=T.useMemo(()=>{const B={};L.forEach(K=>{B[K.rank]||(B[K.rank]=[]),B[K.rank].push(K)});const q=Object.keys(B).map(Number).sort((K,Y)=>K-Y);return{eventsByRank:B,ranks:q}},[L]),{eventsByServer:F,servers:V}=T.useMemo(()=>{const B={};R.forEach(K=>{B[K.server]||(B[K.server]=[]),B[K.server].push(K)});const q=Object.keys(B).map(Number).sort((K,Y)=>K-Y);return{eventsByServer:B,servers:q}},[R]),G=w>0?w:Math.max(1,V.length),Z=Math.max(1,Math.floor(S/G*E));return p.jsx("div",{className:`transition-opacity duration-200 overflow-visible ${r&&!A?"opacity-50":""}`,children:p.jsxs("div",{className:"space-y-6",children:[(V.length>0||w>0)&&p.jsx(jbe,{servers:V.length>0?V:Array.from({length:w},(B,q)=>q),eventsByServer:F,intervalStart:i,intervalDuration:D,lanesPerServer:Z,inferenceServerNodeMap:_,totalSetupNodes:b,isLoading:r}),p.jsx(Obe,{events:P,intervalStart:i,intervalDuration:D,isLoading:r}),p.jsx(e_e,{ranks:W,eventsByRank:O,intervalStart:i,intervalDuration:D,intervalEnd:s,trainerGpuMetricsByGpuIndex:a,trainerGpuMetricsByRank:o,trainerGpuMetricsIsLoading:l,trainerAvailableGpuMetrics:c,selectedMetricNames:d,onSelectedMetricNamesChange:h,trainerSystemGpuIndices:N,trainerRankInfoByRank:v,totalSetupNodes:b,isLoading:r})]})})}function Obe({events:t,intervalStart:e,intervalDuration:n,isLoading:r}){const[i,s]=T.useState(!0),[a,o]=T.useState(null),[l,c]=T.useState(null),d=l??a,{thresholdSeconds:h,displayLabel:g}=T.useMemo(()=>Rbe(n),[n]),{sortedEvents:v,windowByOriginalIndex:b}=T.useMemo(()=>Ibe(t,h),[t,h]),_=T.useMemo(()=>{const w=[],S=new Map;return t.forEach(E=>{const A=S8(E.event_type),N=S.get(A);N!==void 0?w[N].count++:(S.set(A,w.length),w.push({displayName:A,color:_8(E.event_type),count:1}))}),w},[t]);return p.jsxs(Ki,{open:i,onOpenChange:s,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!i&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Orchestrator"}),r&&p.jsx(ll,{className:"size-3.5 text-muted-foreground"})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"mt-3",children:[_.length>0&&p.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 mb-6 text-xs",children:_.map(({displayName:w,color:S,count:E})=>{const A=d===w,N=d!==null&&!A;return p.jsxs("div",{className:`flex items-center gap-1.5 cursor-pointer select-none transition-opacity duration-150 ${A?"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5":""}`,style:{opacity:N?.3:1},onPointerEnter:()=>o(w),onPointerLeave:()=>o(null),onClick:()=>c(D=>D===w?null:w),children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:S}}),p.jsx("span",{className:"capitalize text-muted-foreground",children:w}),p.jsx("span",{className:"text-muted-foreground/50",children:E})]},w)})}),p.jsx("div",{className:"relative",children:p.jsxs("div",{className:"relative h-32 bg-white rounded-lg border border-border/50",children:[p.jsxs("div",{className:"absolute bottom-0 left-0 right-0 h-8 flex items-center justify-between px-2 text-xs text-muted-foreground border-t border-border/50",children:[p.jsx("span",{children:sp(0)}),p.jsx("span",{children:sp(n/2)}),p.jsx("span",{children:sp(n)})]}),p.jsx("div",{className:"absolute top-0 left-0 right-0 h-24",children:t.map((w,S)=>p.jsx(Lbe,{event:w,intervalStart:e,intervalDuration:n,sortedEvents:v,closeEventWindow:b.get(S),thresholdLabel:g,highlightedDisplayName:d},`${w.timestamp}-${S}`))})]})})]})})]})}function Lbe({event:t,intervalStart:e,intervalDuration:n,sortedEvents:r,closeEventWindow:i,thresholdLabel:s,highlightedDisplayName:a}){const l=(t.timestamp-e)/n*100;if(l<0||l>100)return null;const c=_8(t.event_type),h=(i?Math.max(0,i.end-i.start):0)>0,g=S8(t.event_type),v=a===null?null:g===a;return p.jsx(Kc,{className:"absolute top-0 bottom-0 w-0.5 group cursor-pointer",style:{left:`${l}%`,backgroundColor:v===!1?kbe(c,.8):c,zIndex:v===!0?20:1},interactive:h,tooltip:p.jsx(zbe,{event:t,sortedEvents:r,closeEventWindow:i,thresholdLabel:s})})}function zbe({event:t,sortedEvents:e,closeEventWindow:n,thresholdLabel:r}){const i=o=>{const l=S8(o.event_type).split(" ").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ");return(o.event_type==="weight_update"||o.event_type==="save_batch")&&o.step!==-1?`${l} ${o.step}`:l},s=T.useMemo(()=>!n||e.length===0?[t]:e.slice(n.start,n.end+1).map(l=>l.event),[n,e,t]),a=s.length>1;return p.jsxs("div",{className:"bg-popover text-popover-foreground text-xs rounded-lg shadow-xl whitespace-nowrap border border-border min-w-[220px] max-h-[60vh] overflow-y-auto",children:[a&&p.jsxs("div",{className:"flex items-center gap-1.5 px-3 pt-2 pb-2 border-b border-border/50 sticky top-0 bg-popover z-10",children:[p.jsx("div",{className:"w-1 h-1 rounded-full bg-amber-500 flex-shrink-0"}),p.jsxs("span",{className:"text-amber-500 font-medium text-[10px]",children:[s.length," events within ",r]})]}),p.jsx("div",{className:`px-3 ${a?"pt-2 pb-2 space-y-3":"py-2"}`,children:s.map((o,l)=>{const c=_8(o.event_type),d=i(o);return p.jsxs("div",{className:a&&l>0?"pt-2 border-t border-border/30":"",children:[p.jsxs("div",{className:"font-semibold mb-1.5 flex items-center gap-2",children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:c}}),p.jsx("span",{children:d})]}),p.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[o.step!==-1&&p.jsxs("div",{children:["Step: ",o.step]}),p.jsxs("div",{children:["Time:"," ",new Date(o.timestamp*1e3).toISOString().slice(11,23)]})]})]},`${o.timestamp}-${l}`)})})]})}function jbe({servers:t,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i,inferenceServerNodeMap:s,totalSetupNodes:a,isLoading:o}){var me;const[g,v]=T.useState(!0),[b,_]=cn(Lce),[w,S]=cn(dT),[E,A]=cn(Oce),[N,D]=cn(bG),[P,L]=cn(zce),[R,O]=cn(jce),[W,F]=cn(Ice),[V,G]=cn(SG),Z=ki(ml),B=8,q=t.length>B,K=T.useMemo(()=>{if(!q)return[];const ge=[];for(let ke=0;ke<t.length;ke+=B){const Xe=t.slice(ke,ke+B),Ae=ke,je=Math.min(ke+B,t.length)-1;ge.push({label:`${Ae} – ${je}`,servers:Xe})}return ge},[t,q]),Y=q?Math.min(W,Math.max(0,K.length-1)):0;T.useEffect(()=>{q&&W!==Y&&F(Y)},[q,W,Y,F]);const Q=q?((me=K[Y])==null?void 0:me.servers)??t.slice(0,B):t,U=T.useMemo(()=>typeof a=="number"&&Number.isFinite(a)?a>1:s?new Set(Object.values(s).filter(ke=>ke!==null)).size>1:!1,[s,a]),j=T.useMemo(()=>{const ge=new Set,ke=[];for(const Xe of Object.values(e))for(const Ae of Xe){if(Ae.event_type!=="request"||Ae.sample_id==null||Ae.group_id==null)continue;const je=`${Ae.group_id}:${Ae.sample_id}`;ge.has(je)||(ge.add(je),ke.push({group_id:Ae.group_id,sample_idx:Ae.sample_id}))}return ke},[e]),{data:X}=w8(Z??"",j,!!Z&&j.length>0&&w),H=!w||j.length===0||!!X,ie=!w||H,ne=T.useMemo(()=>{const ge=new Map;return X==null||X.statuses.forEach(ke=>{ge.set(`${ke.group_id}:${ke.sample_idx}`,ke.kind)}),ge},[X]),re=T.useMemo(()=>{let ge=i;for(const ke of Object.values(e))for(const Xe of ke)Xe.event_type==="request"&&Xe.lane!=null&&Xe.lane+1>ge&&(ge=Xe.lane+1);return ge},[e,i]),ue=Math.max(1,t.length),le=Math.max(1,Math.floor(R/ue)),fe=re,we=Math.max(1,Math.ceil(fe/le)),pe=Math.min(P,Math.max(0,we-1));T.useEffect(()=>{P!==pe&&L(pe)},[P,pe,L]);const xe=pe*le,Ve=le,ye=Math.min(xe+le-1,fe-1),Oe=T.useMemo(()=>{let ge=0;for(const ke of Object.values(e))ge+=ke.length;return ge},[e]),he=T.useMemo(()=>({servers:Q,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i}),[Q,e,n,r,i]),Re=T.useMemo(()=>`${n}:${r}:${Q.join(",")}:${Oe}:${w}`,[n,r,Q,Oe,w]),[oe,Ue]=T.useState(null),[Ee,Pe]=T.useState(null),[Ze,ae]=T.useState(null);ie&&(oe!==he||Ee!==ne||Ze!==Re)&&(Ue(he),Pe(ne),ae(Re));const te=w&&Ze!==null&&Re!==Ze,be=T.useCallback(ge=>{if(ge.event_type==="request"&&!(ge.sample_id===void 0||ge.group_id===void 0)){if((V==null?void 0:V.sampleId)===ge.sample_id){G(null);return}G({sampleId:ge.sample_id,groupId:ge.group_id,isEval:ge.is_eval})}},[V,G]);return p.jsxs(Ki,{open:g,onOpenChange:v,children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!g&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Inference Servers"}),p.jsx("div",{className:"w-6 flex items-center justify-center shrink-0",children:o&&p.jsx(ll,{className:"size-3.5 text-muted-foreground"})})]})}),g&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center rounded-md border border-input",children:[p.jsx("button",{className:"flex items-center justify-center h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-l-md transition-colors disabled:opacity-50 disabled:pointer-events-none",onClick:()=>_(ge=>Math.max(2,ge-4)),disabled:b<=2,children:p.jsx($le,{className:"h-3 w-3"})}),p.jsx("button",{className:"flex items-center justify-center h-7 px-2 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground border-x border-input transition-colors",onClick:()=>_(14),children:"Reset"}),p.jsx("button",{className:"flex items-center justify-center h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-r-md transition-colors disabled:opacity-50 disabled:pointer-events-none",onClick:()=>_(ge=>Math.min(42,ge+4)),disabled:b>=42,children:p.jsx(ip,{className:"h-3 w-3"})})]}),p.jsxs("div",{className:"flex items-center rounded-md border border-input",children:[p.jsx("button",{className:"flex items-center justify-center h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-l-md transition-colors disabled:opacity-50 disabled:pointer-events-none",onClick:()=>L(ge=>Math.max(0,ge-1)),disabled:pe<=0,children:p.jsx(h8,{className:"h-3 w-3"})}),p.jsx("span",{className:"flex items-center justify-center h-7 px-2 text-xs text-muted-foreground border-x border-input tabular-nums whitespace-nowrap select-none",children:fe===0?"0":`${xe}–${ye}`}),p.jsx("button",{className:"flex items-center justify-center h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-r-md transition-colors disabled:opacity-50 disabled:pointer-events-none",onClick:()=>L(ge=>Math.min(we-1,ge+1)),disabled:pe>=we-1,children:p.jsx(Vr,{className:"h-3 w-3"})})]}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx("button",{className:"flex items-center justify-center h-7 w-7 text-muted-foreground hover:bg-accent hover:text-accent-foreground rounded-md border border-input transition-colors",children:p.jsx(dG,{className:"h-3.5 w-3.5"})})}),p.jsxs(pl,{align:"end",children:[p.jsx(nS,{children:"Max Lanes"}),p.jsx(Hl,{}),[64,128,256,512,1024].map(ge=>p.jsx(vi,{checked:R===ge,onCheckedChange:()=>{O(ge),L(0)},children:ge},ge))]})]}),q&&p.jsxs(Z8,{value:String(Y),onValueChange:ge=>F(Number(ge)),children:[p.jsx(J8,{size:"sm",className:"text-xs h-7 gap-1",children:p.jsx(Q8,{})}),p.jsx(ek,{children:K.map((ge,ke)=>p.jsxs(tk,{value:String(ke),children:["Servers ",ge.label]},ke))})]}),p.jsx(g1,{variant:"selecting",size:"sm",pressed:w,onPressedChange:S,className:"text-xs px-2 h-7",children:"Highlight Discarded"}),p.jsx(g1,{variant:"selecting",size:"sm",pressed:E,onPressedChange:A,className:"text-xs px-2 h-7",children:"Show Weight Update"}),p.jsx(g1,{variant:"selecting",size:"sm",pressed:N,onPressedChange:D,className:"text-xs px-2 h-7",children:"Show Compute Reward"})]})]}),p.jsxs(Qi,{children:[p.jsx("div",{className:"space-y-4",children:t.length>0?(()=>{const ge=oe??(ie?he:null),ke=Ee??(ie?ne:null);if(!ge||!ke)return null;const Xe=te?!0:H;return p.jsx("div",{className:`transition-opacity ${te?"opacity-60":"opacity-100"}`,children:p.jsx("div",{className:"space-y-3",children:ge.servers.map(Ae=>p.jsx(Kbe,{server:Ae,nodeId:(s==null?void 0:s[Ae])??null,showNodeLabel:U,events:ge.eventsByServer[Ae]||[],intervalStart:ge.intervalStart,intervalDuration:ge.intervalDuration,numLanes:ge.lanesPerServer,selectedRequest:V,sampleStatusByKey:ke,highlightDiscarded:w,discardStatusReady:Xe,onEventClick:be,showWeightUpdate:E,showComputeReward:N,laneHeight:b,laneStart:xe,maxLanesToShow:Ve},Ae))})})})():p.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground bg-muted/30 rounded-lg border border-border/50",children:"No inference events in this interval"})}),p.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[p.jsx("span",{children:sp(0)}),p.jsx("span",{children:sp(r/2)}),p.jsx("span",{children:sp(r)})]})]})]})}const Fbe="#075985",Ube="#047857",sX="#0284c7",aX="#10b981",oX="#a1a1a1",lX="#b0b0b0",Bbe="#0c4a6e",Hbe="#065f46",cX="#8a8a8a",Vbe="#0ea5e9",Gbe="#ababab",Wbe="#0ea5e9",$be="#ababab",qbe="#34d399",Xbe="#ababab",uX="#0369a1",dX="#0369a1",fX="#047857",hX="#0284c7",pX="#0284c7",mX="#10b981",gX="#b3b3b3",vX="#b3b3b3",xX="#b3b3b3";function Ybe({eventsBySampleId:t,selectedSampleId:e,timeBounds:n,groupId:r,runPath:i,envResponseTimesBySample:s,computeRewardTimeBySample:a,onSampleClick:o,showNodeLabel:l,isEval:c}){const d=Object.keys(t).map(Number).sort((L,R)=>L-R),h=ki(dT),g=T.useMemo(()=>d.map(L=>({group_id:r,sample_idx:L})),[r,d.join(",")]),{data:v}=w8(i,g,!!i&&g.length>0&&h),b=!h||g.length===0||!!v,_=T.useMemo(()=>!h||!(v!=null&&v.statuses)?!1:v.statuses.some(L=>L.kind==="rollouts_discarded"),[h,v]),w=T.useMemo(()=>{for(const L of Object.values(t))if(L.some(R=>R.is_eval))return!0;return!1},[t]),S=T.useMemo(()=>{for(const L of Object.values(t))if(L.some(R=>R.is_canceled))return!0;return!1},[t]),E=S?lX:_?oX:w?aX:sX,A=16,N=3,D=d.length*A+(d.length-1)*N,P=48;return b?p.jsxs("div",{className:"px-3 pb-2",children:[p.jsxs("div",{className:"flex items-start",children:[p.jsx("div",{className:"flex flex-col pr-2",style:{width:P,gap:N},children:d.map(L=>{const R=L===e;return p.jsx(Abe,{runPath:i,groupId:r,sampleId:L,isEval:c,isCanceled:S,children:p.jsx("button",{className:`text-[10px] font-semibold text-center rounded transition-colors flex items-center justify-center ${R?S?"text-gray-500 bg-gray-400/15 hover:bg-gray-400/25":_?"text-gray-600 bg-gray-500/15 hover:bg-gray-500/25":w?"text-emerald-800 bg-emerald-500/15 hover:bg-emerald-500/25":"text-sky-900 bg-sky-500/15 hover:bg-sky-500/25":S?"text-gray-400 bg-gray-400/10 hover:bg-gray-400/20":_?"text-gray-500 bg-gray-500/10 hover:bg-gray-500/20":w?"text-emerald-600 bg-emerald-500/10 hover:bg-emerald-500/20":"text-sky-700 bg-sky-500/10 hover:bg-sky-500/20"}`,style:{height:A,width:34},children:L})},L)})}),p.jsx("div",{className:"relative flex-1 bg-muted/30 rounded-lg border border-border/50",style:{height:D},children:d.map((L,R)=>{const O=t[L],W=L===e,F=R*(A+N),V=W?S?cX:_?"#6b7280":w?Hbe:Bbe:E,G=[...O].sort((Y,Q)=>Y.start_time-Q.start_time),Z=(s==null?void 0:s[L])??[],B=(a==null?void 0:a[L])??0,q=[];for(let Y=0;Y<G.length&&Y<Z.length;Y++){const Q=Z[Y].time;Q>0&&q.push({start:G[Y].end_time,duration:Q,idx:Y})}let K=0;if(B>0&&G.length>0&&(K=G[G.length-1].end_time,Z.length>=G.length)){const Q=Z[G.length-1];Q&&Q.time>0&&(K+=Q.time)}return p.jsxs("div",{className:"absolute left-0 right-0",style:{top:F,height:A},children:[O.map((Y,Q)=>{const j=(Y.start_time-n.start)/n.duration*100,X=Y.end_time-Y.start_time,H=X*1e3,ie=Math.max(.5,X/n.duration*100);return p.jsx(Kc,{className:`absolute top-px bottom-px group ${o?"cursor-pointer":""}`,style:{left:`${j}%`,width:`${Math.min(ie,100-j)}%`,backgroundColor:V,borderRadius:"1px",border:S?"1px solid rgba(0, 0, 0, 0.12)":"1px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},onClick:o?()=>o(L):void 0,tooltip:p.jsx(Hu,{title:Y.sample_id!==void 0?`Sample ${Y.sample_id}`:Y.group_id!==void 0?`Group ${Y.group_id}`:"Request",titleSecondary:Y.group_id!==void 0?`Group ${Y.group_id}`:null,color:V,statusLabel:S?{text:"Canceled",className:"text-gray-500"}:_?{text:"Discarded",className:"text-red-700"}:null,details:rX(Y,H,[{label:"Server",value:String(Y.server)},...l&&Y.node_id!==null&&Y.node_id!==void 0?[{label:"Node",value:String(Y.node_id)}]:[]]),startTime:Y.start_time,endTime:Y.end_time})},`req-${Q}`)}),q.map(Y=>{const U=(Y.start-n.start)/n.duration*100,j=Math.max(.3,Y.duration/n.duration*100),X=Y.duration*1e3,H=W?_?"#6b7280":uX:_?gX:hX;return p.jsx(Kc,{className:`absolute top-px bottom-px group ${o?"cursor-pointer":""}`,style:{left:`${U}%`,width:`${Math.min(j,100-U)}%`,backgroundColor:H,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:.85},onClick:o?()=>o(L):void 0,tooltip:p.jsx(Hu,{title:"Env Response",titleSecondary:`Turn ${Y.idx}`,color:H,details:[{label:"Duration",value:Ns(X)}]})},`env-${Y.idx}`)}),B>0&&G.length>0&&(()=>{const Q=(K-n.start)/n.duration*100,U=Math.max(.3,B/n.duration*100),j=B*1e3,X=W?_?"#6b7280":c?fX:dX:_?c?xX:vX:c?mX:pX;return p.jsx(Kc,{className:`absolute top-px bottom-px group ${o?"cursor-pointer":""}`,style:{left:`${Q}%`,width:`${Math.min(U,100-Q)}%`,backgroundColor:X,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:.85},onClick:o?()=>o(L):void 0,tooltip:p.jsx(Hu,{title:c?"Compute Metrics":"Compute Reward",color:X,details:[{label:"Duration",value:Ns(j)}]})})})()]},L)})})]}),p.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",style:{marginLeft:P},children:[p.jsx("span",{children:Ns(0)}),p.jsx("span",{children:Ns(n.duration/2*1e3)}),p.jsx("span",{children:Ns(n.duration*1e3)})]})]}):p.jsx("div",{className:"px-3 pb-2 flex items-center justify-center",style:{height:D+24},children:p.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"})})}function Kbe({server:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,numLanes:a,selectedRequest:o,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:d,onEventClick:h,showWeightUpdate:g=!0,showComputeReward:v=!1,laneHeight:b=14,laneStart:_=0,maxLanesToShow:w}){const S=n&&e!==null&&e!==void 0?e:void 0,E=T.useMemo(()=>r.filter(Z=>Z.event_type==="weight_broadcast"),[r]),A=T.useMemo(()=>r.filter(Z=>Z.event_type==="request"),[r]),{assignedEvents:N,actualNumLanes:D}=T.useMemo(()=>{const Z=[],B=[];for(const K of A)K.lane!=null&&K.lane>=0?Z.push({...K,lane:K.lane}):B.push(K);if(B.length>0){const K=[...B].sort((Q,U)=>Q.start_time-U.start_time),Y=[];for(const Q of K){let U=!1;for(let j=0;j<Y.length;j++)if(Y[j]<=Q.start_time){Y[j]=Q.end_time+(Q.environment_response_time??0)+(Q.compute_reward_time??0),Z.push({...Q,lane:j}),U=!0;break}if(!U){const j=Y.length;Y.push(Q.end_time+(Q.environment_response_time??0)+(Q.compute_reward_time??0)),Z.push({...Q,lane:j})}}}const q=Z.reduce((K,Y)=>Math.max(K,Y.lane),-1);return{assignedEvents:Z,actualNumLanes:Math.max(a,q+1)}},[A,a]),P=i+s,L=b,R=w!==void 0?Math.min(_+w,D):D,O=Math.max(0,R-_),W=O*L+Math.max(0,O-1)*2,F=T.useMemo(()=>Array.from({length:O},(Z,B)=>B),[O]),{laneEventsByIndex:V,idlePeriodsByLane:G}=T.useMemo(()=>{const Z=Array.from({length:D},()=>[]);for(const q of N){const K=q.lane;Z[K]&&Z[K].push(q)}const B=Z.map(q=>{const K=[];if(q.length>0){q[0].start_time>i&&K.push({start:i,end:q[0].start_time,duration:q[0].start_time-i});for(let Q=0;Q<q.length-1;Q++){const U=q[Q].end_time,j=q[Q+1].start_time;U<j&&K.push({start:U,end:j,duration:j-U})}const Y=q[q.length-1];Y.end_time<P&&K.push({start:Y.end_time,end:P,duration:P-Y.end_time})}else K.push({start:i,end:P,duration:s});return K});return{laneEventsByIndex:Z,idlePeriodsByLane:B}},[N,i,P,s,D]);return p.jsxs("div",{children:[p.jsxs("div",{className:"text-xs font-medium text-muted-foreground mb-0.5 flex items-center gap-1.5",children:[p.jsxs("span",{children:["Server ",t]}),n&&e!==null&&e!==void 0&&p.jsxs("span",{className:"text-[10px] text-muted-foreground/80",children:["Node ",e]})]}),p.jsx("div",{className:"relative",children:p.jsxs("div",{className:"relative bg-muted/30 rounded-lg border border-border/50",style:{height:W},children:[F.map(Z=>{const B=Z+_,q=Z*(L+2),K=V[B]||[],Y=G[B]||[];return p.jsxs("div",{className:"absolute left-0 right-0",style:{top:q,height:L},children:[Y.map((Q,U)=>{const j=Math.max(Q.start,i),X=Math.min(Q.end,P),H=X-j,ie=(j-i)/s*100,ne=H/s*100;return ne<.5||ie>=100||X<=j?null:p.jsx(Kc,{className:"absolute top-0 bottom-0 group",style:{left:`${ie}%`,width:`${Math.min(ne,100-ie)}%`,backgroundColor:G1,borderRadius:"1px"},tooltip:p.jsx(Hu,{title:"Idle",color:G1,details:[{label:"Duration",value:Ns(Q.duration*1e3)},{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[],{label:"Lane",value:String(B)}]})},`idle-${U}`)}),K.map((Q,U)=>{const j=Q.environment_response_time,X=Q.compute_reward_time,H=YL(Q,"env",o,l,c,d),ie=YL(Q,"reward",o,l,c,d);return p.jsxs(T.Fragment,{children:[p.jsx(Jbe,{event:Q,server:t,nodeId:S,lane:B,intervalStart:i,intervalDuration:s,selectedRequest:o,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:d,onClick:()=>h(Q)}),j!=null&&j>0&&(()=>{const ne=i+s,re=Q.end_time,ue=re+j;if(re>=ne||ue<=i)return null;const le=Math.max(re,i),fe=Math.min(ue,ne),we=Math.max(0,(le-i)/s*100),pe=Math.max(.3,(fe-le)/s*100),xe=j*1e3;return p.jsx(Kc,{className:"absolute top-0 bottom-0 group cursor-pointer",style:{left:`${we}%`,width:`${Math.min(pe,100-we)}%`,backgroundColor:H.color,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:H.opacity},onClick:()=>h(Q),tooltip:p.jsx(Hu,{title:"Env Response",titleSecondary:Q.sample_id!==void 0?`Sample ${Q.sample_id}`:void 0,color:H.color,details:[{label:"Duration",value:Ns(xe)},...Q.group_id!==void 0?[{label:"Group",value:String(Q.group_id)}]:[],{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[],{label:"Lane",value:String(B)}]})})})(),v&&X!=null&&X>0&&(()=>{const ne=i+s,re=Q.end_time+(j!=null&&j>0?j:0),ue=re+X;if(re>=ne||ue<=i)return null;const le=Math.max(re,i),fe=Math.min(ue,ne),we=Math.max(0,(le-i)/s*100),pe=Math.max(.3,(fe-le)/s*100),xe=X*1e3;return p.jsx(Kc,{className:"absolute top-0 bottom-0 group cursor-pointer",style:{left:`${we}%`,width:`${Math.min(pe,100-we)}%`,backgroundColor:ie.color,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:ie.opacity},onClick:()=>h(Q),tooltip:p.jsx(Hu,{title:Q.is_eval?"Compute Metrics":"Compute Reward",titleSecondary:Q.sample_id!==void 0?`Sample ${Q.sample_id}`:void 0,color:ie.color,details:[{label:"Duration",value:Ns(xe)},...Q.group_id!==void 0?[{label:"Group",value:String(Q.group_id)}]:[],{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[],{label:"Lane",value:String(B)}]})})})()]},`event-${U}`)})]},B)}),g&&E.map((Z,B)=>{const q=Z.start_time-i,K=Math.max(0,q/s*100),Q=(Z.end_time-Z.start_time)*1e3,U=Math.max(Z.start_time,i),j=Z.end_time-U,X=Math.max(.5,j/s*100),H=NG(Z.event_type);return p.jsx(Kc,{className:"absolute group cursor-default",style:{top:0,left:`${K}%`,width:`${Math.min(X,100-K)}%`,height:W,backgroundColor:H,borderRadius:"2px",border:"1.5px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:.6},tooltip:p.jsx(Hu,{title:"Weight Broadcast",color:H,details:[...Z.step!=null?[{label:"Step",value:String(Z.step)}]:[],{label:"Duration",value:Ns(Q)},{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[]],startTime:Z.start_time,endTime:Z.end_time})},`wb-${B}`)})]})})]})}function Zbe(t,e,n=!0,r=!0){if(t.event_type!=="request")return NG(t.event_type);if(t.is_canceled)return AG;if(!n)return t.is_eval?BC:DM;if(!r)return qN;if(!e||t.sample_id==null||t.group_id==null)return t.is_eval?BC:DM;const i=`${t.group_id}:${t.sample_id}`;return e.get(i)==="rollouts_discarded"?qN:t.is_eval?BC:DM}function Qbe(t,e,n,r=!0,i=!0){const s=Zbe(t,n,r,i);if(!e)return{color:s,opacity:1};const a=s===qN,o=s===AG;return t.sample_id===e.sampleId?o?{color:cX,opacity:1}:a?{color:"#6b7280",opacity:1}:{color:t.is_eval?Ube:Fbe,opacity:1}:t.group_id===e.groupId?o?{color:lX,opacity:1}:a?{color:oX,opacity:1}:{color:t.is_eval?aX:sX,opacity:1}:{color:s,opacity:.55}}function YL(t,e,n,r,i,s){const a=e==="reward"&&t.is_eval,o=(()=>{if(!i)return!1;if(!s)return!0;if(t.sample_id==null||t.group_id==null)return!1;const c=`${t.group_id}:${t.sample_id}`;return r.get(c)==="rollouts_discarded"})(),l=o?e==="env"?Gbe:a?Xbe:$be:e==="env"?Vbe:a?qbe:Wbe;return n?t.sample_id===n.sampleId?o?{color:"#6b7280",opacity:1}:{color:e==="env"?uX:a?fX:dX,opacity:1}:t.group_id===n.groupId?{color:o?e==="env"?gX:a?xX:vX:e==="env"?hX:a?mX:pX,opacity:1}:{color:l,opacity:.35}:{color:l,opacity:.85}}function Jbe({event:t,server:e,nodeId:n,lane:r,intervalStart:i,intervalDuration:s,selectedRequest:a,sampleStatusByKey:o,highlightDiscarded:l,discardStatusReady:c,onClick:d}){const h=i+s;if(t.end_time<=i||t.start_time>=h)return null;const g=t.start_time-i,v=Math.max(0,g/s*100),_=(t.end_time-t.start_time)*1e3,w=Math.max(t.start_time,i),E=(t.end_time-w)/s*100,{color:A,opacity:N}=Qbe(t,a,o,l,c),D=t.event_type==="request"&&t.sample_id!==void 0,P=(()=>{if(t.event_type!=="request")return null;if(t.is_canceled)return{text:"Canceled",className:"text-gray-500"};if(l&&c&&t.sample_id!=null&&t.group_id!=null){const L=`${t.group_id}:${t.sample_id}`;if(o.get(L)==="rollouts_discarded")return{text:"Discarded",className:"text-red-700"}}return null})();return p.jsx(Kc,{className:`absolute top-0 bottom-0 group ${D?"cursor-pointer":"cursor-default"}`,style:{left:`${v}%`,width:`${Math.min(E,100-v)}%`,minWidth:"1px",backgroundColor:A,borderRadius:"1px",border:t.is_canceled?"1.5px solid rgba(0, 0, 0, 0.2)":"1.5px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box",opacity:N},onClick:D?d:void 0,tooltip:p.jsx(Hu,{title:t.event_type==="request"?t.sample_id!==void 0?`Sample ${t.sample_id}`:t.group_id!==void 0?`Group ${t.group_id}`:"Request":t.event_type,titleSecondary:t.event_type==="request"&&t.group_id!==void 0?`Group ${t.group_id}`:null,color:A,capitalize:!0,statusLabel:P,details:t.event_type==="request"?rX(t,_,[{label:"Server",value:String(e)},...n!=null?[{label:"Node",value:String(n)}]:[],{label:"Lane",value:String(r)}]):[{label:"Duration",value:Ns(_)},{label:"Server",value:String(e)},...n!=null?[{label:"Node",value:String(n)}]:[],{label:"Lane",value:String(r)}],startTime:t.start_time,endTime:t.end_time})})}function e_e({ranks:t,eventsByRank:e,intervalStart:n,intervalDuration:r,intervalEnd:i,trainerGpuMetricsByGpuIndex:s,trainerGpuMetricsByRank:a,trainerGpuMetricsIsLoading:o,trainerAvailableGpuMetrics:l,selectedMetricNames:c,onSelectedMetricNamesChange:d,trainerSystemGpuIndices:h,trainerRankInfoByRank:g,totalSetupNodes:v,isLoading:b}){var ue;const[_,w]=T.useState(!0),[S,E]=cn(_G),[A,N]=cn(Dce),D=T.useMemo(()=>{const le=new Set;return(l??[]).forEach(fe=>{typeof fe=="string"&&le.add(fe)}),Array.from(le)},[l]),[P,L]=T.useState([]),R=((h==null?void 0:h.length)??0)===0;R&&P.length>0?L([]):!R&&D.length>0&&P!==D&&L(D);const O=T.useMemo(()=>R?[]:D.length>0?D:P,[R,D,P]),W=T.useMemo(()=>Array.from(new Set((c??[]).filter(le=>typeof le=="string"&&le.trim().length>0))),[c]),F=T.useMemo(()=>O.length===0?W:W.filter(le=>O.includes(le)),[O,W]),V=T.useMemo(()=>{const le=Object.keys(g??{}).map(Number).filter(fe=>Number.isFinite(fe)).sort((fe,we)=>fe-we);return le.length>0?le:!h||h.length===0?[]:h.map((fe,we)=>we)},[g,h]),G=T.useMemo(()=>{const le=new Set;return t.forEach(fe=>le.add(fe)),V.forEach(fe=>le.add(fe)),Array.from(le).sort((fe,we)=>fe-we)},[t,V]),Z=8,B=G.length>Z,q=T.useMemo(()=>{if(!B)return[];const le=[];for(let fe=0;fe<G.length;fe+=Z){const we=G.slice(fe,fe+Z),pe=fe+1,xe=Math.min(fe+Z,G.length);le.push({label:`${pe} – ${xe}`,ranks:we})}return le},[G,B]),K=B?Math.min(A,Math.max(0,q.length-1)):0;T.useEffect(()=>{B&&A!==K&&N(K)},[B,A,K,N]);const Y=B?((ue=q[K])==null?void 0:ue.ranks)??G.slice(0,Z):G;T.useMemo(()=>new Set(Y),[Y]);const Q=T.useMemo(()=>{const le=new Map;return Object.entries(e).forEach(([fe,we])=>{const pe=new Set;we.forEach(xe=>{if(!xe.event_type.includes("/"))return;const Ve=xe.event_type.split("/")[0];pe.add(`${Ve}|${xe.step}`)}),le.set(Number(fe),pe)}),le},[e]),U=T.useMemo(()=>{const le=new Map;return Y.forEach(fe=>{var xe;const we=((xe=g==null?void 0:g[fe])==null?void 0:xe.node_id)??null,pe=we===null?"__unknown__":String(we);le.has(pe)||le.set(pe,{nodeId:we,ranks:[]}),le.get(pe).ranks.push(fe)}),Array.from(le.values()).map(fe=>({nodeId:fe.nodeId,ranks:fe.ranks.sort((we,pe)=>we-pe)})).sort((fe,we)=>fe.nodeId===null&&we.nodeId===null?0:fe.nodeId===null?1:we.nodeId===null?-1:fe.nodeId-we.nodeId)},[Y,g]),j=T.useMemo(()=>typeof v=="number"&&Number.isFinite(v)?v>1:U.filter(fe=>fe.nodeId!==null).length>1,[U,v]),X=T.useCallback(le=>{var we;le.event_type.includes("/")||!(((we=Q.get(le.rank))==null?void 0:we.has(`${le.event_type}|${le.step}`))??!1)||E(pe=>(pe==null?void 0:pe.eventType)===le.event_type&&(pe==null?void 0:pe.rank)===le.rank&&(pe==null?void 0:pe.step)===le.step?null:{eventType:le.event_type,rank:le.rank,step:le.step})},[Q,E]),H=T.useCallback((le,fe)=>{const we=F,xe=fe===!0?we.includes(le)?we:[...we,le]:we.filter(Ve=>Ve!==le);d==null||d(xe)},[F,d]),ie=T.useCallback(()=>d==null?void 0:d([...O]),[O,d]),ne=T.useCallback(()=>d==null?void 0:d([]),[d]),re=T.useCallback(le=>{const fe=g==null?void 0:g[le],we=(fe==null?void 0:fe.local_rank)??(h?h[le]:void 0),pe=(a==null?void 0:a[le])??(we!==void 0&&s?s[we]??[]:void 0);return p.jsx(n_e,{rank:le,nodeId:(fe==null?void 0:fe.node_id)??null,showNodeLabel:j,events:e[le]||[],intervalStart:n,intervalDuration:r,intervalEnd:i,selectedEvent:S,onEventClick:X,childEventKeys:Q.get(le)??Pbe,systemGpuIndex:we,gpuMetrics:pe,selectedMetricNames:F,gpuMetricsIsLoading:o??!1},le)},[Q,F,e,X,r,i,n,S,s,a,o,g,h,j]);return p.jsxs(Ki,{open:_,onOpenChange:w,children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!_&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Trainer GPUs"}),p.jsx("div",{className:"w-6 flex items-center justify-center shrink-0",children:b&&p.jsx(ll,{className:"size-3.5 text-muted-foreground"})})]})}),_&&p.jsxs(p.Fragment,{children:[B&&p.jsxs(Z8,{value:String(K),onValueChange:le=>N(Number(le)),children:[p.jsx(J8,{size:"sm",className:"text-xs h-7 gap-1",children:p.jsx(Q8,{})}),p.jsx(ek,{children:q.map((le,fe)=>p.jsxs(tk,{value:String(fe),children:["GPUs ",le.label]},fe))})]}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded-md border border-input bg-transparent px-2 h-7 text-xs hover:bg-accent transition-colors",children:["Plots",p.jsx("span",{className:"text-[10px] font-medium rounded bg-accent text-accent-foreground px-1.5 py-0.5",children:F.length}),p.jsx(Vr,{className:"h-3 w-3 text-muted-foreground"})]})}),p.jsxs(pl,{align:"start",className:"w-64",children:[p.jsx(nS,{children:"Trainer GPU Plots"}),p.jsx(Hl,{}),p.jsx(_c,{onSelect:le=>{le.preventDefault(),ie()},className:"text-xs",children:"Select All"}),p.jsx(_c,{onSelect:le=>{le.preventDefault(),ne()},className:"text-xs",children:"Unselect All"}),p.jsx(Hl,{}),O.length>0?O.map(le=>p.jsx(vi,{checked:F.includes(le),onCheckedChange:fe=>H(le,fe),onSelect:fe=>fe.preventDefault(),className:"text-xs",children:iX(le)},le)):p.jsx(_c,{disabled:!0,className:"text-xs text-muted-foreground",children:o?"Loading plots...":"No plots available"})]})]})]})]}),p.jsxs(Qi,{children:[p.jsx("div",{className:"space-y-4",children:Y.length>0?j?U.map(le=>p.jsx(t_e,{nodeId:le.nodeId,rankCount:le.ranks.length,children:le.ranks.map(fe=>re(fe))},le.nodeId===null?"__unknown__":String(le.nodeId))):Y.map(le=>re(le)):p.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground bg-muted/30 rounded-lg border border-border/50",children:"No trainer events in this interval"})}),p.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[p.jsx("span",{children:sp(0)}),p.jsx("span",{children:sp(r/2)}),p.jsx("span",{children:sp(r)})]})]})]})}function t_e({nodeId:t,rankCount:e,children:n}){const[r,i]=T.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return p.jsxs(Ki,{open:r,onOpenChange:i,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!r&&"-rotate-90")}),p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s}),p.jsxs("span",{className:"text-[11px] text-muted-foreground/80",children:[e," GPU",e!==1?"s":""]})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-4 mt-2",children:n})})]})}function n_e({rank:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,intervalEnd:a,selectedEvent:o,onEventClick:l,childEventKeys:c,systemGpuIndex:d,gpuMetrics:h,selectedMetricNames:g,gpuMetricsIsLoading:v}){const b=T.useMemo(()=>[...r.filter(D=>!D.event_type.includes("/"))].sort((D,P)=>D.start_time-P.start_time),[r]),_=T.useMemo(()=>yX(b,i,a),[b,i,a]),w=T.useMemo(()=>{if(!h||h.length===0)return{};const N={};return h.forEach(D=>{N[D.metric_name]||(N[D.metric_name]=[]),N[D.metric_name].push(D)}),N},[h]),S=T.useMemo(()=>{const N=new Set;return h==null||h.forEach(D=>{Number.isFinite(D.gpu_index)&&N.add(D.gpu_index)}),N.size>0?Array.from(N).sort((D,P)=>D-P):d!==void 0?[d]:[]},[h,d]),E=n&&e!==null&&e!==void 0?`Rank ${t} Node ${e}`:`Rank ${t}`,A=T.useMemo(()=>{if(S.length===0)return;const N={};return S.forEach(D=>{N[D]=E}),N},[S,E]);return p.jsxs("div",{children:[p.jsxs("div",{className:"text-xs font-medium text-muted-foreground mb-0.5 flex items-center gap-1.5",children:[p.jsxs("span",{children:["Rank ",t]}),n&&e!==null&&e!==void 0&&p.jsxs("span",{className:"text-[10px] text-muted-foreground/80",children:["Node ",e]})]}),p.jsxs("div",{className:"relative",children:[p.jsxs("div",{className:"relative h-12 bg-muted/30 rounded-lg border border-border/50",children:[_.map((N,D)=>p.jsx(r_e,{idle:N,rank:t,intervalStart:i,intervalDuration:s,dimmed:o!==null},`idle-${D}`)),b.map((N,D)=>{const P=(o==null?void 0:o.eventType)===N.event_type&&(o==null?void 0:o.rank)===N.rank&&(o==null?void 0:o.step)===N.step,L=c.has(`${N.event_type}|${N.step}`),R=o!==null&&!P;return p.jsx(i_e,{event:N,intervalStart:i,intervalDuration:s,isSelected:P,isDimmed:R,hasChildren:L,onClick:()=>l(N)},`${N.start_time}-${N.rank}-${D}`)})]}),S.length>0&&g.map(N=>p.jsxs("div",{className:`mt-2 transition-opacity duration-200 ${v?"opacity-50":""}`,children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-0.5",children:iX(N)}),p.jsx(g$,{metricName:N,data:w[N]??[],gpuIndices:S,intervalStart:i,intervalEnd:a,variant:"timeline",strokeColor:"#ef4444",gpuDisplayNames:A,isLoading:v})]},N))]})]})}function r_e({idle:t,rank:e,intervalStart:n,intervalDuration:r,dimmed:i=!1}){const a=(t.start-n)/r*100,o=t.duration/r*100;return o<.5||a<0||a>=100?null:p.jsx(Kc,{className:"absolute top-1 bottom-1 group cursor-pointer transition-opacity duration-200",style:{left:`${a}%`,width:`${Math.min(o,100-a)}%`,backgroundColor:G1,borderRadius:"2px",opacity:i?.3:1},tooltip:p.jsx(Hu,{title:"Idle",color:G1,details:[{label:"Duration",value:Ns(t.duration*1e3)},{label:"Rank",value:String(e)}],startTime:t.start,endTime:t.end})})}function i_e({event:t,intervalStart:e,intervalDuration:n,isSelected:r=!1,isDimmed:i=!1,hasChildren:s=!1,onClick:a}){const o=e+n;if(t.end_time<=e||t.start_time>=o)return null;const l=t.start_time-e,c=Math.max(0,l/n*100),h=(t.end_time-t.start_time)*1e3,g=Math.max(t.start_time,e),b=(t.end_time-g)/n*100,_=u2(t.event_type),w=RG(t.event_type,t.step,t.microbatch,t.minibatch);return p.jsx(Kc,{className:`absolute top-1 bottom-1 group transition-all duration-200 ${s?"cursor-pointer":"cursor-default"}`,style:{left:`${c}%`,width:`${Math.min(b,100-c)}%`,minWidth:"1px",backgroundColor:_,borderRadius:"2px",opacity:i?.3:1,boxShadow:r?`0 0 0 2px ${_}, 0 0 8px ${_}`:void 0,zIndex:r?10:1},onClick:s?a:void 0,tooltip:p.jsx(Hu,{title:w.primary,titleSecondary:w.secondary,color:_,details:[{label:"Duration",value:Ns(h)},{label:"Rank",value:String(t.rank)},...s?[{label:"Click",value:"to expand children"}]:[]],startTime:t.start_time,endTime:t.end_time})})}function s_e({parentEvent:t,childEvents:e}){const n=[...e].sort((o,l)=>o.start_time-l.start_time),r=t.start_time,i=t.end_time,s=i-r,a=yX(n,r,i);return p.jsxs("div",{className:"px-3 pb-2",children:[p.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2 text-xs",children:n.map(o=>{const l=u2(o.event_type),c=o.event_type.includes("/")?o.event_type.split("/").pop():o.event_type,d=o.end_time-o.start_time,h=s>0?(d/s*100).toFixed(0):"0";return p.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full",style:{backgroundColor:`${l}20`},children:[p.jsx("div",{className:"w-2 h-2 rounded-sm",style:{backgroundColor:l}}),p.jsx("span",{className:"capitalize text-muted-foreground",children:c}),p.jsx("span",{className:"font-medium",children:Ns(d*1e3)}),p.jsxs("span",{className:"text-muted-foreground",children:[h,"%"]})]},o.event_type)})}),p.jsx("div",{className:"relative",children:p.jsxs("div",{className:"relative h-7 bg-muted/30 rounded-lg border border-border/50",children:[a.map((o,l)=>{const d=(o.start-r)/s*100,h=o.duration/s*100;return h<.5||d<0||d>=100?null:p.jsx(Kc,{className:"absolute top-px bottom-px group",style:{left:`${d}%`,width:`${Math.min(h,100-d)}%`,backgroundColor:G1,borderRadius:"1px",opacity:.5},tooltip:p.jsx(Hu,{title:"Gap",color:G1,details:[{label:"Duration",value:Ns(o.duration*1e3)}]})},`child-idle-${l}`)}),n.map((o,l)=>{const c=o.start_time-r,d=Math.max(0,c/s*100),h=o.end_time-o.start_time,g=h*1e3,v=Math.max(.5,h/s*100),b=u2(o.event_type),_=o.event_type.includes("/")?o.event_type.split("/").pop():o.event_type;return p.jsx(Kc,{className:"absolute top-px bottom-px group cursor-default flex items-center justify-center",style:{left:`${d}%`,width:`${Math.min(v,100-d)}%`,backgroundColor:b,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},tooltip:p.jsx(Hu,{title:_||o.event_type,color:b,capitalize:!0,details:[{label:"Duration",value:Ns(g)},{label:"% of parent",value:`${(h/s*100).toFixed(1)}%`}],startTime:o.start_time,endTime:o.end_time}),children:v>8&&p.jsx("span",{className:"text-[9px] font-medium text-white truncate px-1 drop-shadow-sm pointer-events-none",children:_})},`child-${o.start_time}-${l}`)})]})}),p.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",children:[p.jsx("span",{children:Ns(0)}),p.jsx("span",{children:Ns(s/2*1e3)}),p.jsx("span",{children:Ns(s*1e3)})]})]})}function Hu({title:t,titleSecondary:e,color:n,details:r,capitalize:i=!1,timestamp:s,startTime:a,endTime:o,statusLabel:l}){return p.jsxs("div",{className:"bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl whitespace-nowrap pointer-events-none border border-border min-w-[200px]",children:[p.jsxs("div",{className:"font-semibold mb-1.5 flex items-center gap-2",children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:n}}),p.jsxs("span",{className:i?"capitalize":"",children:[t,e&&p.jsx("span",{className:"text-muted-foreground font-normal ml-1",children:e})]})]}),l&&p.jsx("div",{className:`font-semibold mb-1.5 ${l.className}`,children:l.text}),p.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[r.map(c=>p.jsxs("div",{children:[c.label,": ",c.value]},c.label)),s!==void 0&&p.jsxs("div",{children:["Time: ",new Date(s*1e3).toISOString().slice(11,23)]}),a!==void 0&&p.jsxs("div",{children:["Start: ",new Date(a*1e3).toISOString().slice(11,23)]}),o!==void 0&&p.jsxs("div",{children:["End: ",new Date(o*1e3).toISOString().slice(11,23)]})]})]})}function Kc({className:t,style:e,onClick:n,tooltip:r,children:i,interactive:s=!1}){const[a,o]=T.useState(!1),[l,c]=T.useState(!1),[d,h]=T.useState({x:0,y:0}),[g,v]=T.useState(null),b=T.useRef(null),_=T.useRef(null),w=a||l,S=l&&g?g:d;T.useLayoutEffect(()=>{const A=b.current;if(!w||!A)return;const N=A.getBoundingClientRect(),D=8;let P=S.x-N.width/2;P+N.width+D>window.innerWidth&&(P=window.innerWidth-N.width-D),P<D&&(P=D);let L=S.y-N.height-12;L<D&&(L=S.y+16),L+N.height+D>window.innerHeight&&(L=window.innerHeight-N.height-D),A.style.left=`${P}px`,A.style.top=`${L}px`,A.style.visibility="visible"},[w,S]),T.useEffect(()=>{if(!l)return;const A=D=>{var L,R;const P=D.target;(L=b.current)!=null&&L.contains(P)||(R=_.current)!=null&&R.contains(P)||(c(!1),v(null))},N=setTimeout(()=>{document.addEventListener("pointerdown",A)},0);return()=>{clearTimeout(N),document.removeEventListener("pointerdown",A)}},[l]);const E=T.useCallback(()=>{s&&c(A=>A?(v(null),!1):(v(d),!0)),n==null||n()},[s,n,d]);return p.jsxs("div",{ref:_,className:t,style:e,onClick:E,onPointerEnter:A=>{h({x:A.clientX,y:A.clientY}),o(!0)},onPointerLeave:()=>{o(!1)},onPointerMove:A=>{l||h({x:A.clientX,y:A.clientY})},children:[i,w?Ld.createPortal(p.jsx("div",{ref:b,className:"fixed",style:{left:S.x,top:S.y,zIndex:99999,visibility:"hidden",pointerEvents:l?"auto":"none"},children:r}),document.body):null]})}function yX(t,e,n){const r=[];t.length>0&&t[0].start_time>e&&r.push({start:e,end:t[0].start_time,duration:t[0].start_time-e});for(let i=0;i<t.length-1;i++){const s=t[i].end_time,a=t[i+1].start_time;s<a&&r.push({start:s,end:a,duration:a-s})}if(t.length>0){const i=t[t.length-1];i.end_time<n&&r.push({start:i.end_time,end:n,duration:n-i.end_time})}else r.push({start:e,end:n,duration:n-e});return r}function jk({currentPage:t,totalPages:e,onPageChange:n,disabled:r=!1,pageValues:i}){const s=(i==null?void 0:i[t])??t,a=(i==null?void 0:i[0])??0,o=i&&i.length>0?i[i.length-1]:Math.max(0,e-1),[l,c]=T.useState(s.toString());T.useEffect(()=>{c(s.toString())},[s]);const d=v=>{c(v.target.value)},h=v=>{if(v.key==="Enter"){const b=parseInt(l,10);if(isNaN(b)){c(s.toString());return}if(i&&i.length>0){const _=i.indexOf(b);_>=0?n(_):c(s.toString());return}b>=0&&b<e?n(b):c(s.toString())}},g=()=>{c(s.toString())};return p.jsxs("div",{className:"flex items-center gap-0.5",children:[p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(0),disabled:r||t===0,title:"First page",children:p.jsx(Mle,{className:"h-3.5 w-3.5"})}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t-1),disabled:r||t===0,title:"Previous page",children:p.jsx(f8,{className:"h-3.5 w-3.5"})}),p.jsxs("div",{className:"flex items-center gap-1 text-xs px-1",children:[p.jsx(W0,{type:"number",value:l,onChange:d,onKeyDown:h,onBlur:g,disabled:r,className:"w-12 h-6 text-center px-1 py-0 text-xs",min:a,max:o}),p.jsxs("span",{className:"text-muted-foreground",children:["/ ",o]})]}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t+1),disabled:r||t>=e-1,title:"Next page",children:p.jsx(f1,{className:"h-3.5 w-3.5"})}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(e-1),disabled:r||t>=e-1,title:"Last page",children:p.jsx(Ele,{className:"h-3.5 w-3.5"})})]})}/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const xw="183",Tg={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Eg={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},bX=0,DR=1,_X=2,a_e=3,SX=0,S1=1,O_=2,Pg=3,gp=0,Vl=1,Xc=2,th=0,qg=1,OR=2,LR=3,zR=4,wX=5,o_e=6,A0=100,MX=101,TX=102,EX=103,CX=104,AX=200,NX=201,RX=202,kX=203,R2=204,k2=205,PX=206,IX=207,DX=208,OX=209,LX=210,zX=211,jX=212,FX=213,UX=214,P2=0,I2=1,D2=2,lv=3,O2=4,L2=5,z2=6,j2=7,yw=0,BX=1,HX=2,nu=0,Fk=1,Uk=2,Bk=3,WT=4,Hk=5,Vk=6,Gk=7,jR="attached",VX="detached",$T=300,sh=301,rm=302,L_=303,z_=304,ky=306,vS=1e3,Tc=1001,xS=1002,Ea=1003,Wk=1004,l_e=1004,i1=1005,c_e=1005,rs=1006,j_=1007,u_e=1007,Kf=1008,d_e=1008,zl=1009,$k=1010,qk=1011,ny=1012,qT=1013,Ku=1014,Bl=1015,ah=1016,XT=1017,YT=1018,ry=1020,Xk=35902,Yk=35899,Kk=1021,Zk=1022,ul=1023,oh=1026,B0=1027,KT=1028,bw=1029,cv=1030,ZT=1031,f_e=1032,QT=1033,F_=33776,U_=33777,B_=33778,H_=33779,F2=35840,U2=35841,B2=35842,H2=35843,V2=36196,G2=37492,W2=37496,$2=37488,q2=37489,X2=37490,Y2=37491,K2=37808,Z2=37809,Q2=37810,J2=37811,e5=37812,t5=37813,n5=37814,r5=37815,i5=37816,s5=37817,a5=37818,o5=37819,l5=37820,c5=37821,u5=36492,d5=36494,f5=36495,h5=36283,p5=36284,m5=36285,g5=36286,GX=2200,WX=2201,$X=2202,yS=2300,v5=2301,UM=2302,FR=2303,Ig=2400,Dg=2401,bS=2402,JT=2500,Qk=2501,h_e=0,p_e=1,m_e=2,qX=3200,XX=3201,g_e=3202,v_e=3203,xm=0,YX=1,np="",cl="srgb",im="srgb-linear",_S="linear",ji="srgb",x_e="",y_e="rg",b_e="ga",__e=0,Cg=7680,S_e=7681,w_e=7682,M_e=7683,T_e=34055,E_e=34056,C_e=5386,A_e=512,N_e=513,R_e=514,k_e=515,P_e=516,I_e=517,D_e=518,UR=519,KX=512,ZX=513,QX=514,eE=515,JX=516,eY=517,tE=518,tY=519,SS=35044,O_e=35048,L_e=35040,z_e=35045,j_e=35049,F_e=35041,U_e=35046,B_e=35050,H_e=35042,V_e="100",BR="300 es",Zc=2e3,uv=2001,G_e={COMPUTE:"compute",RENDER:"render"},W_e={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},$_e={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},q_e={TEXTURE_COMPARE:"depthTextureCompare"};function X_e(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Y_e={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function s1(t,e){return new Y_e[t](e)}function nY(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function wS(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function rY(){const t=wS("canvas");return t.style.display="block",t}const KL={};let sm=null;function K_e(t){sm=t}function Z_e(){return sm}function MS(...t){const e="THREE."+t.shift();sm?sm("log",e,...t):console.log(e,...t)}function iY(t){const e=t[0];if(typeof e=="string"&&e.startsWith("TSL:")){const n=t[1];n&&n.isStackTrace?t[0]+=" "+n.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function hn(...t){t=iY(t);const e="THREE."+t.shift();if(sm)sm("warn",e,...t);else{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function Hn(...t){t=iY(t);const e="THREE."+t.shift();if(sm)sm("error",e,...t);else{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function TS(...t){const e=t.join(" ");e in KL||(KL[e]=!0,hn(...t))}function Q_e(t,e,n){return new Promise(function(r,i){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}}setTimeout(s,n)})}const J_e={[P2]:I2,[D2]:z2,[O2]:j2,[lv]:L2,[I2]:P2,[z2]:D2,[j2]:O2,[L2]:lv};let mh=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){const r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){const r=this._listeners;if(r===void 0)return;const i=r[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const r=n[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}};const il=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let ZL=1234567;const Xg=Math.PI/180,iy=180/Math.PI;function ru(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(il[t&255]+il[t>>8&255]+il[t>>16&255]+il[t>>24&255]+"-"+il[e&255]+il[e>>8&255]+"-"+il[e>>16&15|64]+il[e>>24&255]+"-"+il[n&63|128]+il[n>>8&255]+"-"+il[n>>16&255]+il[n>>24&255]+il[r&255]+il[r>>8&255]+il[r>>16&255]+il[r>>24&255]).toLowerCase()}function sr(t,e,n){return Math.max(e,Math.min(n,t))}function Jk(t,e){return(t%e+e)%e}function eSe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function tSe(t,e,n){return t!==e?(n-t)/(e-t):0}function V_(t,e,n){return(1-n)*t+n*e}function nSe(t,e,n,r){return V_(t,e,1-Math.exp(-n*r))}function rSe(t,e=1){return e-Math.abs(Jk(t,e*2)-e)}function iSe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function sSe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function aSe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function oSe(t,e){return t+Math.random()*(e-t)}function lSe(t){return t*(.5-Math.random())}function cSe(t){t!==void 0&&(ZL=t);let e=ZL+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function uSe(t){return t*Xg}function dSe(t){return t*iy}function fSe(t){return(t&t-1)===0&&t!==0}function hSe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function pSe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function mSe(t,e,n,r,i){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((e+r)/2),d=a((e+r)/2),h=s((e-r)/2),g=a((e-r)/2),v=s((r-e)/2),b=a((r-e)/2);switch(i){case"XYX":t.set(o*d,l*h,l*g,o*c);break;case"YZY":t.set(l*g,o*d,l*h,o*c);break;case"ZXZ":t.set(l*h,l*g,o*d,o*c);break;case"XZX":t.set(o*d,l*b,l*v,o*c);break;case"YXY":t.set(l*v,o*d,l*b,o*c);break;case"ZYZ":t.set(l*b,l*v,o*d,o*c);break;default:hn("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function jl(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Cr(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const sY={DEG2RAD:Xg,RAD2DEG:iy,generateUUID:ru,clamp:sr,euclideanModulo:Jk,mapLinear:eSe,inverseLerp:tSe,lerp:V_,damp:nSe,pingpong:rSe,smoothstep:iSe,smootherstep:sSe,randInt:aSe,randFloat:oSe,randFloatSpread:lSe,seededRandom:cSe,degToRad:uSe,radToDeg:dSe,isPowerOfTwo:fSe,ceilPowerOfTwo:hSe,floorPowerOfTwo:pSe,setQuaternionFromProperEuler:mSe,normalize:Cr,denormalize:jl};class zt{constructor(e=0,n=0){zt.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=sr(this.x,e.x,n.x),this.y=sr(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=sr(this.x,e,n),this.y=sr(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(sr(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(sr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,a=this.y-e.y;return this.x=s*r-a*i+e.x,this.y=s*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bo{constructor(e=0,n=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}static slerpFlat(e,n,r,i,s,a,o){let l=r[i+0],c=r[i+1],d=r[i+2],h=r[i+3],g=s[a+0],v=s[a+1],b=s[a+2],_=s[a+3];if(h!==_||l!==g||c!==v||d!==b){let w=l*g+c*v+d*b+h*_;w<0&&(g=-g,v=-v,b=-b,_=-_,w=-w);let S=1-o;if(w<.9995){const E=Math.acos(w),A=Math.sin(E);S=Math.sin(S*E)/A,o=Math.sin(o*E)/A,l=l*S+g*o,c=c*S+v*o,d=d*S+b*o,h=h*S+_*o}else{l=l*S+g*o,c=c*S+v*o,d=d*S+b*o,h=h*S+_*o;const E=1/Math.sqrt(l*l+c*c+d*d+h*h);l*=E,c*=E,d*=E,h*=E}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=h}static multiplyQuaternionsFlat(e,n,r,i,s,a){const o=r[i],l=r[i+1],c=r[i+2],d=r[i+3],h=s[a],g=s[a+1],v=s[a+2],b=s[a+3];return e[n]=o*b+d*h+l*v-c*g,e[n+1]=l*b+d*g+c*h-o*v,e[n+2]=c*b+d*v+o*g-l*h,e[n+3]=d*b-o*h-l*g-c*v,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(r/2),d=o(i/2),h=o(s/2),g=l(r/2),v=l(i/2),b=l(s/2);switch(a){case"XYZ":this._x=g*d*h+c*v*b,this._y=c*v*h-g*d*b,this._z=c*d*b+g*v*h,this._w=c*d*h-g*v*b;break;case"YXZ":this._x=g*d*h+c*v*b,this._y=c*v*h-g*d*b,this._z=c*d*b-g*v*h,this._w=c*d*h+g*v*b;break;case"ZXY":this._x=g*d*h-c*v*b,this._y=c*v*h+g*d*b,this._z=c*d*b+g*v*h,this._w=c*d*h-g*v*b;break;case"ZYX":this._x=g*d*h-c*v*b,this._y=c*v*h+g*d*b,this._z=c*d*b-g*v*h,this._w=c*d*h+g*v*b;break;case"YZX":this._x=g*d*h+c*v*b,this._y=c*v*h+g*d*b,this._z=c*d*b-g*v*h,this._w=c*d*h-g*v*b;break;case"XZY":this._x=g*d*h-c*v*b,this._y=c*v*h-g*d*b,this._z=c*d*b+g*v*h,this._w=c*d*h+g*v*b;break;default:hn("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],a=n[1],o=n[5],l=n[9],c=n[2],d=n[6],h=n[10],g=r+o+h;if(g>0){const v=.5/Math.sqrt(g+1);this._w=.25/v,this._x=(d-l)*v,this._y=(s-c)*v,this._z=(a-i)*v}else if(r>o&&r>h){const v=2*Math.sqrt(1+r-o-h);this._w=(d-l)/v,this._x=.25*v,this._y=(i+a)/v,this._z=(s+c)/v}else if(o>h){const v=2*Math.sqrt(1+o-r-h);this._w=(s-c)/v,this._x=(i+a)/v,this._y=.25*v,this._z=(l+d)/v}else{const v=2*Math.sqrt(1+h-r-o);this._w=(a-i)/v,this._x=(s+c)/v,this._y=(l+d)/v,this._z=.25*v}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(sr(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,s=e._z,a=e._w,o=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+a*o+i*c-s*l,this._y=i*d+a*l+s*o-r*c,this._z=s*d+a*c+r*l-i*o,this._w=a*d-r*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){let r=e._x,i=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(r=-r,i=-i,s=-s,a=-a,o=-o);let l=1-n;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,n=Math.sin(n*c)/d,this._x=this._x*l+r*n,this._y=this._y*l+i*n,this._z=this._z*l+s*n,this._w=this._w*l+a*n,this._onChangeCallback()}else this._x=this._x*l+r*n,this._y=this._y*l+i*n,this._z=this._z*l+s*n,this._w=this._w*l+a*n,this.normalize();return this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Fe{constructor(e=0,n=0,r=0){Fe.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(QL.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(QL.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,a=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*a,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*a,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*a,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*r),d=2*(o*n-s*i),h=2*(s*r-a*n);return this.x=n+l*c+a*h-o*d,this.y=r+l*d+o*c-s*h,this.z=i+l*h+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=sr(this.x,e.x,n.x),this.y=sr(this.y,e.y,n.y),this.z=sr(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=sr(this.x,e,n),this.y=sr(this.y,e,n),this.z=sr(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(sr(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,a=n.x,o=n.y,l=n.z;return this.x=i*l-s*o,this.y=s*a-r*l,this.z=r*o-i*a,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return jA.copy(this).projectOnVector(e),this.sub(jA)}reflect(e){return this.sub(jA.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(sr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const jA=new Fe,QL=new Bo;class yr{constructor(e,n,r,i,s,a,o,l,c){yr.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,o,l,c)}set(e,n,r,i,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=o,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,a=r[0],o=r[3],l=r[6],c=r[1],d=r[4],h=r[7],g=r[2],v=r[5],b=r[8],_=i[0],w=i[3],S=i[6],E=i[1],A=i[4],N=i[7],D=i[2],P=i[5],L=i[8];return s[0]=a*_+o*E+l*D,s[3]=a*w+o*A+l*P,s[6]=a*S+o*N+l*L,s[1]=c*_+d*E+h*D,s[4]=c*w+d*A+h*P,s[7]=c*S+d*N+h*L,s[2]=g*_+v*E+b*D,s[5]=g*w+v*A+b*P,s[8]=g*S+v*N+b*L,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return n*a*d-n*o*c-r*s*d+r*o*l+i*s*c-i*a*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],h=d*a-o*c,g=o*l-d*s,v=c*s-a*l,b=n*h+r*g+i*v;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/b;return e[0]=h*_,e[1]=(i*c-d*r)*_,e[2]=(o*r-i*a)*_,e[3]=g*_,e[4]=(d*n-i*l)*_,e[5]=(i*s-o*n)*_,e[6]=v*_,e[7]=(r*l-c*n)*_,e[8]=(a*n-r*s)*_,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(FA.makeScale(e,n)),this}rotate(e){return this.premultiply(FA.makeRotation(-e)),this}translate(e,n){return this.premultiply(FA.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const FA=new yr,JL=new yr().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ez=new yr().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function gSe(){const t={enabled:!0,workingColorSpace:im,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===ji&&(i.r=cp(i.r),i.g=cp(i.g),i.b=cp(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===ji&&(i.r=w1(i.r),i.g=w1(i.g),i.b=w1(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===np?_S:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return TS("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return TS("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[im]:{primaries:e,whitePoint:r,transfer:_S,toXYZ:JL,fromXYZ:ez,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:cl},outputColorSpaceConfig:{drawingBufferColorSpace:cl}},[cl]:{primaries:e,whitePoint:r,transfer:ji,toXYZ:JL,fromXYZ:ez,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:cl}}}),t}const ii=gSe();function cp(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function w1(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Nx;class aY{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{Nx===void 0&&(Nx=wS("canvas")),Nx.width=e.width,Nx.height=e.height;const i=Nx.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Nx}return r.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=wS("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=cp(s[a]/255)*255;return r.putImageData(i,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor(cp(n[r]/255)*255):n[r]=cp(n[r]);return{data:n,width:e.width,height:e.height}}else return hn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let vSe=0;class H0{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:vSe++}),this.uuid=ru(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const n=this.data;return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?e.set(n.videoWidth,n.videoHeight,0):typeof VideoFrame<"u"&&n instanceof VideoFrame?e.set(n.displayHeight,n.displayWidth,0):n!==null?e.set(n.width,n.height,n.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(UA(i[a].image)):s.push(UA(i[a]))}else s=UA(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function UA(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?aY.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(hn("Texture: Unable to serialize Texture."),{})}let xSe=0;const BA=new Fe;class ra extends mh{constructor(e=ra.DEFAULT_IMAGE,n=ra.DEFAULT_MAPPING,r=Tc,i=Tc,s=rs,a=Kf,o=ul,l=zl,c=ra.DEFAULT_ANISOTROPY,d=np){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:xSe++}),this.uuid=ru(),this.name="",this.source=new H0(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new zt(0,0),this.repeat=new zt(1,1),this.center=new zt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new yr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(BA).x}get height(){return this.source.getSize(BA).y}get depth(){return this.source.getSize(BA).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const r=e[n];if(r===void 0){hn(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){hn(`Texture.setValues(): property '${n}' does not exist.`);continue}i&&r&&i.isVector2&&r.isVector2||i&&r&&i.isVector3&&r.isVector3||i&&r&&i.isMatrix3&&r.isMatrix3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==$T)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case vS:e.x=e.x-Math.floor(e.x);break;case Tc:e.x=e.x<0?0:1;break;case xS:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case vS:e.y=e.y-Math.floor(e.y);break;case Tc:e.y=e.y<0?0:1;break;case xS:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}ra.DEFAULT_IMAGE=null;ra.DEFAULT_MAPPING=$T;ra.DEFAULT_ANISOTROPY=1;class ci{constructor(e=0,n=0,r=0,i=1){ci.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*n+a[4]*r+a[8]*i+a[12]*s,this.y=a[1]*n+a[5]*r+a[9]*i+a[13]*s,this.z=a[2]*n+a[6]*r+a[10]*i+a[14]*s,this.w=a[3]*n+a[7]*r+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],d=l[4],h=l[8],g=l[1],v=l[5],b=l[9],_=l[2],w=l[6],S=l[10];if(Math.abs(d-g)<.01&&Math.abs(h-_)<.01&&Math.abs(b-w)<.01){if(Math.abs(d+g)<.1&&Math.abs(h+_)<.1&&Math.abs(b+w)<.1&&Math.abs(c+v+S-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const A=(c+1)/2,N=(v+1)/2,D=(S+1)/2,P=(d+g)/4,L=(h+_)/4,R=(b+w)/4;return A>N&&A>D?A<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(A),i=P/r,s=L/r):N>D?N<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(N),r=P/i,s=R/i):D<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(D),r=L/s,i=R/s),this.set(r,i,s,n),this}let E=Math.sqrt((w-b)*(w-b)+(h-_)*(h-_)+(g-d)*(g-d));return Math.abs(E)<.001&&(E=1),this.x=(w-b)/E,this.y=(h-_)/E,this.z=(g-d)/E,this.w=Math.acos((c+v+S-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=sr(this.x,e.x,n.x),this.y=sr(this.y,e.y,n.y),this.z=sr(this.z,e.z,n.z),this.w=sr(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=sr(this.x,e,n),this.y=sr(this.y,e,n),this.z=sr(this.z,e,n),this.w=sr(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(sr(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class e9 extends mh{constructor(e=1,n=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:rs,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=r.depth,this.scissor=new ci(0,0,e,n),this.scissorTest=!1,this.viewport=new ci(0,0,e,n),this.textures=[];const i={width:e,height:n,depth:r.depth},s=new ra(i),a=r.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){const n={minFilter:rs,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(n.mapping=e.mapping),e.wrapS!==void 0&&(n.wrapS=e.wrapS),e.wrapT!==void 0&&(n.wrapT=e.wrapT),e.wrapR!==void 0&&(n.wrapR=e.wrapR),e.magFilter!==void 0&&(n.magFilter=e.magFilter),e.minFilter!==void 0&&(n.minFilter=e.minFilter),e.format!==void 0&&(n.format=e.format),e.type!==void 0&&(n.type=e.type),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(n.colorSpace=e.colorSpace),e.flipY!==void 0&&(n.flipY=e.flipY),e.generateMipmaps!==void 0&&(n.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(n.internalFormat=e.internalFormat);for(let r=0;r<this.textures.length;r++)this.textures[r].setValues(n)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=n,this.textures[i].image.depth=r,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const i=Object.assign({},e.textures[n].image);this.textures[n].source=new H0(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class iu extends e9{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class nE extends ra{constructor(e=null,n=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=Ea,this.minFilter=Ea,this.wrapR=Tc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class ySe extends iu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new nE(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class rE extends ra{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=Ea,this.minFilter=Ea,this.wrapR=Tc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class bSe extends iu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new rE(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class rr{constructor(e,n,r,i,s,a,o,l,c,d,h,g,v,b,_,w){rr.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,o,l,c,d,h,g,v,b,_,w)}set(e,n,r,i,s,a,o,l,c,d,h,g,v,b,_,w){const S=this.elements;return S[0]=e,S[4]=n,S[8]=r,S[12]=i,S[1]=s,S[5]=a,S[9]=o,S[13]=l,S[2]=c,S[6]=d,S[10]=h,S[14]=g,S[3]=v,S[7]=b,S[11]=_,S[15]=w,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new rr().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return this.determinant()===0?(e.set(1,0,0),n.set(0,1,0),r.set(0,0,1),this):(e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this)}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const n=this.elements,r=e.elements,i=1/Rx.setFromMatrixColumn(e,0).length(),s=1/Rx.setFromMatrixColumn(e,1).length(),a=1/Rx.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,a=Math.cos(r),o=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const g=a*d,v=a*h,b=o*d,_=o*h;n[0]=l*d,n[4]=-l*h,n[8]=c,n[1]=v+b*c,n[5]=g-_*c,n[9]=-o*l,n[2]=_-g*c,n[6]=b+v*c,n[10]=a*l}else if(e.order==="YXZ"){const g=l*d,v=l*h,b=c*d,_=c*h;n[0]=g+_*o,n[4]=b*o-v,n[8]=a*c,n[1]=a*h,n[5]=a*d,n[9]=-o,n[2]=v*o-b,n[6]=_+g*o,n[10]=a*l}else if(e.order==="ZXY"){const g=l*d,v=l*h,b=c*d,_=c*h;n[0]=g-_*o,n[4]=-a*h,n[8]=b+v*o,n[1]=v+b*o,n[5]=a*d,n[9]=_-g*o,n[2]=-a*c,n[6]=o,n[10]=a*l}else if(e.order==="ZYX"){const g=a*d,v=a*h,b=o*d,_=o*h;n[0]=l*d,n[4]=b*c-v,n[8]=g*c+_,n[1]=l*h,n[5]=_*c+g,n[9]=v*c-b,n[2]=-c,n[6]=o*l,n[10]=a*l}else if(e.order==="YZX"){const g=a*l,v=a*c,b=o*l,_=o*c;n[0]=l*d,n[4]=_-g*h,n[8]=b*h+v,n[1]=h,n[5]=a*d,n[9]=-o*d,n[2]=-c*d,n[6]=v*h+b,n[10]=g-_*h}else if(e.order==="XZY"){const g=a*l,v=a*c,b=o*l,_=o*c;n[0]=l*d,n[4]=-h,n[8]=c*d,n[1]=g*h+_,n[5]=a*d,n[9]=v*h-b,n[2]=b*h-v,n[6]=o*d,n[10]=_*h+g}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(_Se,e,SSe)}lookAt(e,n,r){const i=this.elements;return Bc.subVectors(e,n),Bc.lengthSq()===0&&(Bc.z=1),Bc.normalize(),m0.crossVectors(r,Bc),m0.lengthSq()===0&&(Math.abs(r.z)===1?Bc.x+=1e-4:Bc.z+=1e-4,Bc.normalize(),m0.crossVectors(r,Bc)),m0.normalize(),T4.crossVectors(Bc,m0),i[0]=m0.x,i[4]=T4.x,i[8]=Bc.x,i[1]=m0.y,i[5]=T4.y,i[9]=Bc.y,i[2]=m0.z,i[6]=T4.z,i[10]=Bc.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,a=r[0],o=r[4],l=r[8],c=r[12],d=r[1],h=r[5],g=r[9],v=r[13],b=r[2],_=r[6],w=r[10],S=r[14],E=r[3],A=r[7],N=r[11],D=r[15],P=i[0],L=i[4],R=i[8],O=i[12],W=i[1],F=i[5],V=i[9],G=i[13],Z=i[2],B=i[6],q=i[10],K=i[14],Y=i[3],Q=i[7],U=i[11],j=i[15];return s[0]=a*P+o*W+l*Z+c*Y,s[4]=a*L+o*F+l*B+c*Q,s[8]=a*R+o*V+l*q+c*U,s[12]=a*O+o*G+l*K+c*j,s[1]=d*P+h*W+g*Z+v*Y,s[5]=d*L+h*F+g*B+v*Q,s[9]=d*R+h*V+g*q+v*U,s[13]=d*O+h*G+g*K+v*j,s[2]=b*P+_*W+w*Z+S*Y,s[6]=b*L+_*F+w*B+S*Q,s[10]=b*R+_*V+w*q+S*U,s[14]=b*O+_*G+w*K+S*j,s[3]=E*P+A*W+N*Z+D*Y,s[7]=E*L+A*F+N*B+D*Q,s[11]=E*R+A*V+N*q+D*U,s[15]=E*O+A*G+N*K+D*j,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],h=e[6],g=e[10],v=e[14],b=e[3],_=e[7],w=e[11],S=e[15],E=l*v-c*g,A=o*v-c*h,N=o*g-l*h,D=a*v-c*d,P=a*g-l*d,L=a*h-o*d;return n*(_*E-w*A+S*N)-r*(b*E-w*D+S*P)+i*(b*A-_*D+S*L)-s*(b*N-_*P+w*L)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],h=e[9],g=e[10],v=e[11],b=e[12],_=e[13],w=e[14],S=e[15],E=n*o-r*a,A=n*l-i*a,N=n*c-s*a,D=r*l-i*o,P=r*c-s*o,L=i*c-s*l,R=d*_-h*b,O=d*w-g*b,W=d*S-v*b,F=h*w-g*_,V=h*S-v*_,G=g*S-v*w,Z=E*G-A*V+N*F+D*W-P*O+L*R;if(Z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/Z;return e[0]=(o*G-l*V+c*F)*B,e[1]=(i*V-r*G-s*F)*B,e[2]=(_*L-w*P+S*D)*B,e[3]=(g*P-h*L-v*D)*B,e[4]=(l*W-a*G-c*O)*B,e[5]=(n*G-i*W+s*O)*B,e[6]=(w*N-b*L-S*A)*B,e[7]=(d*L-g*N+v*A)*B,e[8]=(a*V-o*W+c*R)*B,e[9]=(r*W-n*V-s*R)*B,e[10]=(b*P-_*N+S*E)*B,e[11]=(h*N-d*P-v*E)*B,e[12]=(o*O-a*F-l*R)*B,e[13]=(n*F-r*O+i*R)*B,e[14]=(_*A-b*D-w*E)*B,e[15]=(d*D-h*A+g*E)*B,this}scale(e){const n=this.elements,r=e.x,i=e.y,s=e.z;return n[0]*=r,n[4]*=i,n[8]*=s,n[1]*=r,n[5]*=i,n[9]*=s,n[2]*=r,n[6]*=i,n[10]*=s,n[3]*=r,n[7]*=i,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),s=1-r,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+r,c*o-i*l,c*l+i*o,0,c*o+i*l,d*o+r,d*l-i*a,0,c*l-i*o,d*l+i*a,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,a){return this.set(1,r,s,0,e,1,a,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,a=n._y,o=n._z,l=n._w,c=s+s,d=a+a,h=o+o,g=s*c,v=s*d,b=s*h,_=a*d,w=a*h,S=o*h,E=l*c,A=l*d,N=l*h,D=r.x,P=r.y,L=r.z;return i[0]=(1-(_+S))*D,i[1]=(v+N)*D,i[2]=(b-A)*D,i[3]=0,i[4]=(v-N)*P,i[5]=(1-(g+S))*P,i[6]=(w+E)*P,i[7]=0,i[8]=(b+A)*L,i[9]=(w-E)*L,i[10]=(1-(g+_))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const s=this.determinant();if(s===0)return r.set(1,1,1),n.identity(),this;let a=Rx.set(i[0],i[1],i[2]).length();const o=Rx.set(i[4],i[5],i[6]).length(),l=Rx.set(i[8],i[9],i[10]).length();s<0&&(a=-a),Ed.copy(this);const c=1/a,d=1/o,h=1/l;return Ed.elements[0]*=c,Ed.elements[1]*=c,Ed.elements[2]*=c,Ed.elements[4]*=d,Ed.elements[5]*=d,Ed.elements[6]*=d,Ed.elements[8]*=h,Ed.elements[9]*=h,Ed.elements[10]*=h,n.setFromRotationMatrix(Ed),r.x=a,r.y=o,r.z=l,this}makePerspective(e,n,r,i,s,a,o=Zc,l=!1){const c=this.elements,d=2*s/(n-e),h=2*s/(r-i),g=(n+e)/(n-e),v=(r+i)/(r-i);let b,_;if(l)b=s/(a-s),_=a*s/(a-s);else if(o===Zc)b=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===uv)b=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=g,c[12]=0,c[1]=0,c[5]=h,c[9]=v,c[13]=0,c[2]=0,c[6]=0,c[10]=b,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,n,r,i,s,a,o=Zc,l=!1){const c=this.elements,d=2/(n-e),h=2/(r-i),g=-(n+e)/(n-e),v=-(r+i)/(r-i);let b,_;if(l)b=1/(a-s),_=a/(a-s);else if(o===Zc)b=-2/(a-s),_=-(a+s)/(a-s);else if(o===uv)b=-1/(a-s),_=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=g,c[1]=0,c[5]=h,c[9]=0,c[13]=v,c[2]=0,c[6]=0,c[10]=b,c[14]=_,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const Rx=new Fe,Ed=new rr,_Se=new Fe(0,0,0),SSe=new Fe(1,1,1),m0=new Fe,T4=new Fe,Bc=new Fe,tz=new rr,nz=new Bo;class su{constructor(e=0,n=0,r=0,i=su.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],d=i[9],h=i[2],g=i[6],v=i[10];switch(n){case"XYZ":this._y=Math.asin(sr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,v),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(g,c),this._z=0);break;case"YXZ":this._x=Math.asin(-sr(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,v),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(sr(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-h,v),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-sr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(g,v),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(sr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(o,v));break;case"XZY":this._z=Math.asin(-sr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(g,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,v),this._y=0);break;default:hn("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return tz.makeRotationFromQuaternion(e),this.setFromRotationMatrix(tz,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return nz.setFromEuler(this),this.setFromQuaternion(nz,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}su.DEFAULT_ORDER="XYZ";class sy{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let wSe=0;const rz=new Fe,kx=new Bo,Gh=new rr,E4=new Fe,Zb=new Fe,MSe=new Fe,TSe=new Bo,iz=new Fe(1,0,0),sz=new Fe(0,1,0),az=new Fe(0,0,1),oz={type:"added"},ESe={type:"removed"},Px={type:"childadded",child:null},HA={type:"childremoved",child:null};class yi extends mh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:wSe++}),this.uuid=ru(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=yi.DEFAULT_UP.clone();const e=new Fe,n=new su,r=new Bo,i=new Fe(1,1,1);function s(){r.setFromEuler(n,!1)}function a(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new rr},normalMatrix:{value:new yr}}),this.matrix=new rr,this.matrixWorld=new rr,this.matrixAutoUpdate=yi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=yi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new sy,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return kx.setFromAxisAngle(e,n),this.quaternion.multiply(kx),this}rotateOnWorldAxis(e,n){return kx.setFromAxisAngle(e,n),this.quaternion.premultiply(kx),this}rotateX(e){return this.rotateOnAxis(iz,e)}rotateY(e){return this.rotateOnAxis(sz,e)}rotateZ(e){return this.rotateOnAxis(az,e)}translateOnAxis(e,n){return rz.copy(e).applyQuaternion(this.quaternion),this.position.add(rz.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(iz,e)}translateY(e){return this.translateOnAxis(sz,e)}translateZ(e){return this.translateOnAxis(az,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Gh.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?E4.copy(e):E4.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),Zb.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Gh.lookAt(Zb,E4,this.up):Gh.lookAt(E4,Zb,this.up),this.quaternion.setFromRotationMatrix(Gh),i&&(Gh.extractRotation(i.matrixWorld),kx.setFromRotationMatrix(Gh),this.quaternion.premultiply(kx.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(Hn("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(oz),Px.child=e,this.dispatchEvent(Px),Px.child=null):Hn("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(ESe),HA.child=e,this.dispatchEvent(HA),HA.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Gh.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Gh.multiply(e.parent.matrixWorld)),e.applyMatrix4(Gh),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(oz),Px.child=e,this.dispatchEvent(Px),Px.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let r=0,i=this.children.length;r<i;r++){const a=this.children[r].getObjectByProperty(e,n);if(a!==void 0)return a}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Zb,e,MSe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Zb,TSe,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const n=e.x,r=e.y,i=e.z,s=this.matrix.elements;s[12]+=n-s[0]*n-s[4]*r-s[8]*i,s[13]+=r-s[1]*n-s[5]*r-s[9]*i,s[14]+=i-s[2]*n-s[6]*r-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].updateMatrixWorld(e)}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(n){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),h=a(e.shapes),g=a(e.skeletons),v=a(e.animations),b=a(e.nodes);o.length>0&&(r.geometries=o),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),h.length>0&&(r.shapes=h),g.length>0&&(r.skeletons=g),v.length>0&&(r.animations=v),b.length>0&&(r.nodes=b)}return r.object=i,r;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}yi.DEFAULT_UP=new Fe(0,1,0);yi.DEFAULT_MATRIX_AUTO_UPDATE=!0;yi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class a1 extends yi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const CSe={type:"move"};class BM{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new a1,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new a1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Fe,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Fe),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new a1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Fe,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Fe),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const w=n.getJointPose(_,r),S=this._getHandJoint(c,_);w!==null&&(S.matrix.fromArray(w.transform.matrix),S.matrix.decompose(S.position,S.rotation,S.scale),S.matrixWorldNeedsUpdate=!0,S.jointRadius=w.radius),S.visible=w!==null}const d=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],g=d.position.distanceTo(h.position),v=.02,b=.005;c.inputState.pinching&&g>v+b?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&g<=v-b&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(CSe)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new a1;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const oY={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},g0={h:0,s:0,l:0},C4={h:0,s:0,l:0};function VA(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class xn{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=cl){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ii.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=ii.workingColorSpace){return this.r=e,this.g=n,this.b=r,ii.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=ii.workingColorSpace){if(e=Jk(e,1),n=sr(n,0,1),r=sr(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,a=2*r-s;this.r=VA(a,s,e+1/3),this.g=VA(a,s,e),this.b=VA(a,s,e-1/3)}return ii.colorSpaceToWorking(this,i),this}setStyle(e,n=cl){function r(s){s!==void 0&&parseFloat(s)<1&&hn("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:hn("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(a===6)return this.setHex(parseInt(s,16),n);hn("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=cl){const r=oY[e.toLowerCase()];return r!==void 0?this.setHex(r,n):hn("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=cp(e.r),this.g=cp(e.g),this.b=cp(e.b),this}copyLinearToSRGB(e){return this.r=w1(e.r),this.g=w1(e.g),this.b=w1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=cl){return ii.workingToColorSpace(sl.copy(this),e),Math.round(sr(sl.r*255,0,255))*65536+Math.round(sr(sl.g*255,0,255))*256+Math.round(sr(sl.b*255,0,255))}getHexString(e=cl){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=ii.workingColorSpace){ii.workingToColorSpace(sl.copy(this),n);const r=sl.r,i=sl.g,s=sl.b,a=Math.max(r,i,s),o=Math.min(r,i,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=d<=.5?h/(a+o):h/(2-a-o),a){case r:l=(i-s)/h+(i<s?6:0);break;case i:l=(s-r)/h+2;break;case s:l=(r-i)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,n=ii.workingColorSpace){return ii.workingToColorSpace(sl.copy(this),n),e.r=sl.r,e.g=sl.g,e.b=sl.b,e}getStyle(e=cl){ii.workingToColorSpace(sl.copy(this),e);const n=sl.r,r=sl.g,i=sl.b;return e!==cl?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(g0),this.setHSL(g0.h+e,g0.s+n,g0.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(g0),e.getHSL(C4);const r=V_(g0.h,C4.h,n),i=V_(g0.s,C4.s,n),s=V_(g0.l,C4.l,n);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*n+s[3]*r+s[6]*i,this.g=s[1]*n+s[4]*r+s[7]*i,this.b=s[2]*n+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const sl=new xn;xn.NAMES=oY;class iE{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new xn(e),this.density=n}clone(){return new iE(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class sE{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new xn(e),this.near=n,this.far=r}clone(){return new sE(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let t9=class extends yi{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new su,this.environmentIntensity=1,this.environmentRotation=new su,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}};const Cd=new Fe,Wh=new Fe,GA=new Fe,$h=new Fe,Ix=new Fe,Dx=new Fe,lz=new Fe,WA=new Fe,$A=new Fe,qA=new Fe,XA=new ci,YA=new ci,KA=new ci;class Mc{constructor(e=new Fe,n=new Fe,r=new Fe){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Cd.subVectors(e,n),i.cross(Cd);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){Cd.subVectors(i,n),Wh.subVectors(r,n),GA.subVectors(e,n);const a=Cd.dot(Cd),o=Cd.dot(Wh),l=Cd.dot(GA),c=Wh.dot(Wh),d=Wh.dot(GA),h=a*c-o*o;if(h===0)return s.set(0,0,0),null;const g=1/h,v=(c*l-o*d)*g,b=(a*d-o*l)*g;return s.set(1-v-b,b,v)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,$h)===null?!1:$h.x>=0&&$h.y>=0&&$h.x+$h.y<=1}static getInterpolation(e,n,r,i,s,a,o,l){return this.getBarycoord(e,n,r,i,$h)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,$h.x),l.addScaledVector(a,$h.y),l.addScaledVector(o,$h.z),l)}static getInterpolatedAttribute(e,n,r,i,s,a){return XA.setScalar(0),YA.setScalar(0),KA.setScalar(0),XA.fromBufferAttribute(e,n),YA.fromBufferAttribute(e,r),KA.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(XA,s.x),a.addScaledVector(YA,s.y),a.addScaledVector(KA,s.z),a}static isFrontFacing(e,n,r,i){return Cd.subVectors(r,n),Wh.subVectors(e,n),Cd.cross(Wh).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Cd.subVectors(this.c,this.b),Wh.subVectors(this.a,this.b),Cd.cross(Wh).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Mc.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Mc.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Mc.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Mc.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Mc.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let a,o;Ix.subVectors(i,r),Dx.subVectors(s,r),WA.subVectors(e,r);const l=Ix.dot(WA),c=Dx.dot(WA);if(l<=0&&c<=0)return n.copy(r);$A.subVectors(e,i);const d=Ix.dot($A),h=Dx.dot($A);if(d>=0&&h<=d)return n.copy(i);const g=l*h-d*c;if(g<=0&&l>=0&&d<=0)return a=l/(l-d),n.copy(r).addScaledVector(Ix,a);qA.subVectors(e,s);const v=Ix.dot(qA),b=Dx.dot(qA);if(b>=0&&v<=b)return n.copy(s);const _=v*c-l*b;if(_<=0&&c>=0&&b<=0)return o=c/(c-b),n.copy(r).addScaledVector(Dx,o);const w=d*b-v*h;if(w<=0&&h-d>=0&&v-b>=0)return lz.subVectors(s,i),o=(h-d)/(h-d+(v-b)),n.copy(i).addScaledVector(lz,o);const S=1/(w+_+g);return a=_*S,o=g*S,n.copy(r).addScaledVector(Ix,a).addScaledVector(Dx,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Ca{constructor(e=new Fe(1/0,1/0,1/0),n=new Fe(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n+=3)this.expandByPoint(Ad.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Ad.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=Ad.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Ad):Ad.fromBufferAttribute(s,a),Ad.applyMatrix4(e.matrixWorld),this.expandByPoint(Ad);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),A4.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),A4.copy(r.boundingBox)),A4.applyMatrix4(e.matrixWorld),this.union(A4)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Ad),Ad.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Qb),N4.subVectors(this.max,Qb),Ox.subVectors(e.a,Qb),Lx.subVectors(e.b,Qb),zx.subVectors(e.c,Qb),v0.subVectors(Lx,Ox),x0.subVectors(zx,Lx),lg.subVectors(Ox,zx);let n=[0,-v0.z,v0.y,0,-x0.z,x0.y,0,-lg.z,lg.y,v0.z,0,-v0.x,x0.z,0,-x0.x,lg.z,0,-lg.x,-v0.y,v0.x,0,-x0.y,x0.x,0,-lg.y,lg.x,0];return!ZA(n,Ox,Lx,zx,N4)||(n=[1,0,0,0,1,0,0,0,1],!ZA(n,Ox,Lx,zx,N4))?!1:(R4.crossVectors(v0,x0),n=[R4.x,R4.y,R4.z],ZA(n,Ox,Lx,zx,N4))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ad).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ad).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(qh[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),qh[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),qh[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),qh[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),qh[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),qh[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),qh[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),qh[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(qh),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const qh=[new Fe,new Fe,new Fe,new Fe,new Fe,new Fe,new Fe,new Fe],Ad=new Fe,A4=new Ca,Ox=new Fe,Lx=new Fe,zx=new Fe,v0=new Fe,x0=new Fe,lg=new Fe,Qb=new Fe,N4=new Fe,R4=new Fe,cg=new Fe;function ZA(t,e,n,r,i){for(let s=0,a=t.length-3;s<=a;s+=3){cg.fromArray(t,s);const o=i.x*Math.abs(cg.x)+i.y*Math.abs(cg.y)+i.z*Math.abs(cg.z),l=e.dot(cg),c=n.dot(cg),d=r.dot(cg);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const rp=ASe();function ASe(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function yc(t){Math.abs(t)>65504&&hn("DataUtils.toHalfFloat(): Value out of range."),t=sr(t,-65504,65504),rp.floatView[0]=t;const e=rp.uint32View[0],n=e>>23&511;return rp.baseTable[n]+((e&8388607)>>rp.shiftTable[n])}function b_(t){const e=t>>10;return rp.uint32View[0]=rp.mantissaTable[rp.offsetTable[e]+(t&1023)]+rp.exponentTable[e],rp.floatView[0]}class NSe{static toHalfFloat(e){return yc(e)}static fromHalfFloat(e){return b_(e)}}const ja=new Fe,k4=new zt;let RSe=0;class Vi{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:RSe++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=SS,this.updateRanges=[],this.gpuType=Bl,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=n.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)k4.fromBufferAttribute(this,n),k4.applyMatrix3(e),this.setXY(n,k4.x,k4.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)ja.fromBufferAttribute(this,n),ja.applyMatrix3(e),this.setXYZ(n,ja.x,ja.y,ja.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)ja.fromBufferAttribute(this,n),ja.applyMatrix4(e),this.setXYZ(n,ja.x,ja.y,ja.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)ja.fromBufferAttribute(this,n),ja.applyNormalMatrix(e),this.setXYZ(n,ja.x,ja.y,ja.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)ja.fromBufferAttribute(this,n),ja.transformDirection(e),this.setXYZ(n,ja.x,ja.y,ja.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=jl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Cr(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=jl(n,this.array)),n}setX(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=jl(n,this.array)),n}setY(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=jl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=jl(n,this.array)),n}setW(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array),i=Cr(i,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array),i=Cr(i,this.array),s=Cr(s,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==SS&&(e.usage=this.usage),e}}class kSe extends Vi{constructor(e,n,r){super(new Int8Array(e),n,r)}}class PSe extends Vi{constructor(e,n,r){super(new Uint8Array(e),n,r)}}class ISe extends Vi{constructor(e,n,r){super(new Uint8ClampedArray(e),n,r)}}class DSe extends Vi{constructor(e,n,r){super(new Int16Array(e),n,r)}}class n9 extends Vi{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class OSe extends Vi{constructor(e,n,r){super(new Int32Array(e),n,r)}}class r9 extends Vi{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class LSe extends Vi{constructor(e,n,r){super(new Uint16Array(e),n,r),this.isFloat16BufferAttribute=!0}getX(e){let n=b_(this.array[e*this.itemSize]);return this.normalized&&(n=jl(n,this.array)),n}setX(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize]=yc(n),this}getY(e){let n=b_(this.array[e*this.itemSize+1]);return this.normalized&&(n=jl(n,this.array)),n}setY(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize+1]=yc(n),this}getZ(e){let n=b_(this.array[e*this.itemSize+2]);return this.normalized&&(n=jl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize+2]=yc(n),this}getW(e){let n=b_(this.array[e*this.itemSize+3]);return this.normalized&&(n=jl(n,this.array)),n}setW(e,n){return this.normalized&&(n=Cr(n,this.array)),this.array[e*this.itemSize+3]=yc(n),this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array)),this.array[e+0]=yc(n),this.array[e+1]=yc(r),this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array),i=Cr(i,this.array)),this.array[e+0]=yc(n),this.array[e+1]=yc(r),this.array[e+2]=yc(i),this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array),i=Cr(i,this.array),s=Cr(s,this.array)),this.array[e+0]=yc(n),this.array[e+1]=yc(r),this.array[e+2]=yc(i),this.array[e+3]=yc(s),this}}class Cn extends Vi{constructor(e,n,r){super(new Float32Array(e),n,r)}}const zSe=new Ca,Jb=new Fe,QA=new Fe;class Va{constructor(e=new Fe,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):zSe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const r=this.center.distanceToSquared(e);return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Jb.subVectors(e,this.center);const n=Jb.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(Jb,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(QA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Jb.copy(e.center).add(QA)),this.expandByPoint(Jb.copy(e.center).sub(QA))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let jSe=0;const Iu=new rr,JA=new yi,jx=new Fe,Hc=new Ca,e_=new Ca,go=new Fe;class br extends mh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:jSe++}),this.uuid=ru(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(X_e(e)?r9:n9)(e,1):this.index=e,this}setIndirect(e,n=0){return this.indirect=e,this.indirectOffset=n,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,r=0){this.groups.push({start:e,count:n,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const s=new yr().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Iu.makeRotationFromQuaternion(e),this.applyMatrix4(Iu),this}rotateX(e){return Iu.makeRotationX(e),this.applyMatrix4(Iu),this}rotateY(e){return Iu.makeRotationY(e),this.applyMatrix4(Iu),this}rotateZ(e){return Iu.makeRotationZ(e),this.applyMatrix4(Iu),this}translate(e,n,r){return Iu.makeTranslation(e,n,r),this.applyMatrix4(Iu),this}scale(e,n,r){return Iu.makeScale(e,n,r),this.applyMatrix4(Iu),this}lookAt(e){return JA.lookAt(e),JA.updateMatrix(),this.applyMatrix4(JA.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(jx).negate(),this.translate(jx.x,jx.y,jx.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const r=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];r.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Cn(r,3))}else{const r=Math.min(e.length,n.count);for(let i=0;i<r;i++){const s=e[i];n.setXYZ(i,s.x,s.y,s.z||0)}e.length>n.count&&hn("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ca);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Hn("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Fe(-1/0,-1/0,-1/0),new Fe(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,i=n.length;r<i;r++){const s=n[r];Hc.setFromBufferAttribute(s),this.morphTargetsRelative?(go.addVectors(this.boundingBox.min,Hc.min),this.boundingBox.expandByPoint(go),go.addVectors(this.boundingBox.max,Hc.max),this.boundingBox.expandByPoint(go)):(this.boundingBox.expandByPoint(Hc.min),this.boundingBox.expandByPoint(Hc.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Hn('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Va);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Hn("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Fe,1/0);return}if(e){const r=this.boundingSphere.center;if(Hc.setFromBufferAttribute(e),n)for(let s=0,a=n.length;s<a;s++){const o=n[s];e_.setFromBufferAttribute(o),this.morphTargetsRelative?(go.addVectors(Hc.min,e_.min),Hc.expandByPoint(go),go.addVectors(Hc.max,e_.max),Hc.expandByPoint(go)):(Hc.expandByPoint(e_.min),Hc.expandByPoint(e_.max))}Hc.getCenter(r);let i=0;for(let s=0,a=e.count;s<a;s++)go.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(go));if(n)for(let s=0,a=n.length;s<a;s++){const o=n[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)go.fromBufferAttribute(o,c),l&&(jx.fromBufferAttribute(e,c),go.add(jx)),i=Math.max(i,r.distanceToSquared(go))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Hn('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){Hn("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=n.position,i=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Vi(new Float32Array(4*r.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let R=0;R<r.count;R++)o[R]=new Fe,l[R]=new Fe;const c=new Fe,d=new Fe,h=new Fe,g=new zt,v=new zt,b=new zt,_=new Fe,w=new Fe;function S(R,O,W){c.fromBufferAttribute(r,R),d.fromBufferAttribute(r,O),h.fromBufferAttribute(r,W),g.fromBufferAttribute(s,R),v.fromBufferAttribute(s,O),b.fromBufferAttribute(s,W),d.sub(c),h.sub(c),v.sub(g),b.sub(g);const F=1/(v.x*b.y-b.x*v.y);isFinite(F)&&(_.copy(d).multiplyScalar(b.y).addScaledVector(h,-v.y).multiplyScalar(F),w.copy(h).multiplyScalar(v.x).addScaledVector(d,-b.x).multiplyScalar(F),o[R].add(_),o[O].add(_),o[W].add(_),l[R].add(w),l[O].add(w),l[W].add(w))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let R=0,O=E.length;R<O;++R){const W=E[R],F=W.start,V=W.count;for(let G=F,Z=F+V;G<Z;G+=3)S(e.getX(G+0),e.getX(G+1),e.getX(G+2))}const A=new Fe,N=new Fe,D=new Fe,P=new Fe;function L(R){D.fromBufferAttribute(i,R),P.copy(D);const O=o[R];A.copy(O),A.sub(D.multiplyScalar(D.dot(O))).normalize(),N.crossVectors(P,O);const F=N.dot(l[R])<0?-1:1;a.setXYZW(R,A.x,A.y,A.z,F)}for(let R=0,O=E.length;R<O;++R){const W=E[R],F=W.start,V=W.count;for(let G=F,Z=F+V;G<Z;G+=3)L(e.getX(G+0)),L(e.getX(G+1)),L(e.getX(G+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Vi(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let g=0,v=r.count;g<v;g++)r.setXYZ(g,0,0,0);const i=new Fe,s=new Fe,a=new Fe,o=new Fe,l=new Fe,c=new Fe,d=new Fe,h=new Fe;if(e)for(let g=0,v=e.count;g<v;g+=3){const b=e.getX(g+0),_=e.getX(g+1),w=e.getX(g+2);i.fromBufferAttribute(n,b),s.fromBufferAttribute(n,_),a.fromBufferAttribute(n,w),d.subVectors(a,s),h.subVectors(i,s),d.cross(h),o.fromBufferAttribute(r,b),l.fromBufferAttribute(r,_),c.fromBufferAttribute(r,w),o.add(d),l.add(d),c.add(d),r.setXYZ(b,o.x,o.y,o.z),r.setXYZ(_,l.x,l.y,l.z),r.setXYZ(w,c.x,c.y,c.z)}else for(let g=0,v=n.count;g<v;g+=3)i.fromBufferAttribute(n,g+0),s.fromBufferAttribute(n,g+1),a.fromBufferAttribute(n,g+2),d.subVectors(a,s),h.subVectors(i,s),d.cross(h),r.setXYZ(g+0,d.x,d.y,d.z),r.setXYZ(g+1,d.x,d.y,d.z),r.setXYZ(g+2,d.x,d.y,d.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)go.fromBufferAttribute(e,n),go.normalize(),e.setXYZ(n,go.x,go.y,go.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,h=o.normalized,g=new c.constructor(l.length*d);let v=0,b=0;for(let _=0,w=l.length;_<w;_++){o.isInterleavedBufferAttribute?v=l[_]*o.data.stride+o.offset:v=l[_]*d;for(let S=0;S<d;S++)g[b++]=c[v++]}return new Vi(g,d,h)}if(this.index===null)return hn("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new br,r=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,r);n.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,h=c.length;d<h;d++){const g=c[d],v=e(g,r);l.push(v)}n.morphAttributes[o]=l}n.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];n.addGroup(c.start,c.count,c.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let h=0,g=c.length;h<g;h++){const v=c[h];d.push(v.toJSON(e.data))}d.length>0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone());const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],h=s[c];for(let g=0,v=h.length;g<v;g++)d.push(h[g].clone(n));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const h=a[c];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class aE{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=SS,this.updateRanges=[],this.version=0,this.uuid=ru()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,r){e*=this.stride,r*=n.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=n.array[r+i];return this}set(e,n=0){return this.array.set(e,n),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ru()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const n=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(n,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=ru()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Pl=new Fe;class Qc{constructor(e,n,r,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=n,this.offset=r,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let n=0,r=this.data.count;n<r;n++)Pl.fromBufferAttribute(this,n),Pl.applyMatrix4(e),this.setXYZ(n,Pl.x,Pl.y,Pl.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Pl.fromBufferAttribute(this,n),Pl.applyNormalMatrix(e),this.setXYZ(n,Pl.x,Pl.y,Pl.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Pl.fromBufferAttribute(this,n),Pl.transformDirection(e),this.setXYZ(n,Pl.x,Pl.y,Pl.z);return this}getComponent(e,n){let r=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(r=jl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Cr(r,this.array)),this.data.array[e*this.data.stride+this.offset+n]=r,this}setX(e,n){return this.normalized&&(n=Cr(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Cr(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Cr(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Cr(n,this.array)),this.data.array[e*this.data.stride+this.offset+3]=n,this}getX(e){let n=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(n=jl(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=jl(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=jl(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=jl(n,this.array)),n}setXY(e,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this}setXYZ(e,n,r,i){return e=e*this.data.stride+this.offset,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array),i=Cr(i,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(n=Cr(n,this.array),r=Cr(r,this.array),i=Cr(i,this.array),s=Cr(s,this.array)),this.data.array[e+0]=n,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){MS("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let r=0;r<this.count;r++){const i=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[i+s])}return new Vi(new this.array.constructor(n),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Qc(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){MS("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const n=[];for(let r=0;r<this.count;r++){const i=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)n.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:n,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let FSe=0;class vl extends mh{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:FSe++}),this.uuid=ru(),this.name="",this.type="Material",this.blending=qg,this.side=gp,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=R2,this.blendDst=k2,this.blendEquation=A0,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new xn(0,0,0),this.blendAlpha=0,this.depthFunc=lv,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=UR,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Cg,this.stencilZFail=Cg,this.stencilZPass=Cg,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){hn(`Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){hn(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(r.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(r.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==qg&&(r.blending=this.blending),this.side!==gp&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==R2&&(r.blendSrc=this.blendSrc),this.blendDst!==k2&&(r.blendDst=this.blendDst),this.blendEquation!==A0&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==lv&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==UR&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Cg&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Cg&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Cg&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.allowOverride===!1&&(r.allowOverride=!1),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(n){const s=i(e.textures),a=i(e.images);s.length>0&&(r.textures=s),a.length>0&&(r.images=a)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class i9 extends vl{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new xn(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Fx;const t_=new Fe,Ux=new Fe,Bx=new Fe,Hx=new zt,n_=new zt,lY=new rr,P4=new Fe,r_=new Fe,I4=new Fe,cz=new zt,e6=new zt,uz=new zt;class cY extends yi{constructor(e=new i9){if(super(),this.isSprite=!0,this.type="Sprite",Fx===void 0){Fx=new br;const n=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new aE(n,5);Fx.setIndex([0,1,2,0,2,3]),Fx.setAttribute("position",new Qc(r,3,0,!1)),Fx.setAttribute("uv",new Qc(r,2,3,!1))}this.geometry=Fx,this.material=e,this.center=new zt(.5,.5),this.count=1}raycast(e,n){e.camera===null&&Hn('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ux.setFromMatrixScale(this.matrixWorld),lY.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Bx.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ux.multiplyScalar(-Bx.z);const r=this.material.rotation;let i,s;r!==0&&(s=Math.cos(r),i=Math.sin(r));const a=this.center;D4(P4.set(-.5,-.5,0),Bx,a,Ux,i,s),D4(r_.set(.5,-.5,0),Bx,a,Ux,i,s),D4(I4.set(.5,.5,0),Bx,a,Ux,i,s),cz.set(0,0),e6.set(1,0),uz.set(1,1);let o=e.ray.intersectTriangle(P4,r_,I4,!1,t_);if(o===null&&(D4(r_.set(-.5,.5,0),Bx,a,Ux,i,s),e6.set(0,1),o=e.ray.intersectTriangle(P4,I4,r_,!1,t_),o===null))return;const l=e.ray.origin.distanceTo(t_);l<e.near||l>e.far||n.push({distance:l,point:t_.clone(),uv:Mc.getInterpolation(t_,P4,r_,I4,cz,e6,uz,new zt),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function D4(t,e,n,r,i,s){Hx.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(n_.x=s*Hx.x-i*Hx.y,n_.y=i*Hx.x+s*Hx.y):n_.copy(Hx),t.copy(e),t.x+=n_.x,t.y+=n_.y,t.applyMatrix4(lY)}const O4=new Fe,dz=new Fe;class uY extends yi{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let r=0,i=n.length;r<i;r++){const s=n[r];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,n=0,r=0){n=Math.abs(n);const i=this.levels;let s;for(s=0;s<i.length&&!(n<i[s].distance);s++);return i.splice(s,0,{distance:n,hysteresis:r,object:e}),this.add(e),this}removeLevel(e){const n=this.levels;for(let r=0;r<n.length;r++)if(n[r].distance===e){const i=n.splice(r,1);return this.remove(i[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const n=this.levels;if(n.length>0){let r,i;for(r=1,i=n.length;r<i;r++){let s=n[r].distance;if(n[r].object.visible&&(s-=s*n[r].hysteresis),e<s)break}return n[r-1].object}return null}raycast(e,n){if(this.levels.length>0){O4.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(O4);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){O4.setFromMatrixPosition(e.matrixWorld),dz.setFromMatrixPosition(this.matrixWorld);const r=O4.distanceTo(dz)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i<s;i++){let a=n[i].distance;if(n[i].object.visible&&(a-=a*n[i].hysteresis),r>=a)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i<s;i++)n[i].object.visible=!1}}toJSON(e){const n=super.toJSON(e);this.autoUpdate===!1&&(n.object.autoUpdate=!1),n.object.levels=[];const r=this.levels;for(let i=0,s=r.length;i<s;i++){const a=r[i];n.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return n}}const Xh=new Fe,t6=new Fe,L4=new Fe,y0=new Fe,n6=new Fe,z4=new Fe,r6=new Fe;class Ev{constructor(e=new Fe,n=new Fe(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Xh)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Xh.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Xh.copy(this.origin).addScaledVector(this.direction,n),Xh.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){t6.copy(e).add(n).multiplyScalar(.5),L4.copy(n).sub(e).normalize(),y0.copy(this.origin).sub(t6);const s=e.distanceTo(n)*.5,a=-this.direction.dot(L4),o=y0.dot(this.direction),l=-y0.dot(L4),c=y0.lengthSq(),d=Math.abs(1-a*a);let h,g,v,b;if(d>0)if(h=a*l-o,g=a*o-l,b=s*d,h>=0)if(g>=-b)if(g<=b){const _=1/d;h*=_,g*=_,v=h*(h+a*g+2*o)+g*(a*h+g+2*l)+c}else g=s,h=Math.max(0,-(a*g+o)),v=-h*h+g*(g+2*l)+c;else g=-s,h=Math.max(0,-(a*g+o)),v=-h*h+g*(g+2*l)+c;else g<=-b?(h=Math.max(0,-(-a*s+o)),g=h>0?-s:Math.min(Math.max(-s,-l),s),v=-h*h+g*(g+2*l)+c):g<=b?(h=0,g=Math.min(Math.max(-s,-l),s),v=g*(g+2*l)+c):(h=Math.max(0,-(a*s+o)),g=h>0?s:Math.min(Math.max(-s,-l),s),v=-h*h+g*(g+2*l)+c);else g=a>0?-s:s,h=Math.max(0,-(a*g+o)),v=-h*h+g*(g+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(t6).addScaledVector(L4,g),v}intersectSphere(e,n){Xh.subVectors(e.center,this.origin);const r=Xh.dot(this.direction),i=Xh.dot(Xh)-r*r,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=r-a,l=r+a;return l<0?null:o<0?this.at(l,n):this.at(o,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,g=this.origin;return c>=0?(r=(e.min.x-g.x)*c,i=(e.max.x-g.x)*c):(r=(e.max.x-g.x)*c,i=(e.min.x-g.x)*c),d>=0?(s=(e.min.y-g.y)*d,a=(e.max.y-g.y)*d):(s=(e.max.y-g.y)*d,a=(e.min.y-g.y)*d),r>a||s>i||((s>r||isNaN(r))&&(r=s),(a<i||isNaN(i))&&(i=a),h>=0?(o=(e.min.z-g.z)*h,l=(e.max.z-g.z)*h):(o=(e.max.z-g.z)*h,l=(e.min.z-g.z)*h),r>l||o>i)||((o>r||r!==r)&&(r=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Xh)!==null}intersectTriangle(e,n,r,i,s){n6.subVectors(n,e),z4.subVectors(r,e),r6.crossVectors(n6,z4);let a=this.direction.dot(r6),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;y0.subVectors(this.origin,e);const l=o*this.direction.dot(z4.crossVectors(y0,z4));if(l<0)return null;const c=o*this.direction.dot(n6.cross(y0));if(c<0||l+c>a)return null;const d=-o*y0.dot(r6);return d<0?null:this.at(d/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class wp extends vl{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new xn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new su,this.combine=yw,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const fz=new rr,ug=new Ev,j4=new Va,hz=new Fe,F4=new Fe,U4=new Fe,B4=new Fe,i6=new Fe,H4=new Fe,pz=new Fe,V4=new Fe;class Us extends yi{constructor(e=new br,n=new wp){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,a=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){H4.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],h=s[l];d!==0&&(i6.fromBufferAttribute(h,e),a?H4.addScaledVector(i6,d):H4.addScaledVector(i6.sub(n),d))}n.add(H4)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),j4.copy(r.boundingSphere),j4.applyMatrix4(s),ug.copy(e.ray).recast(e.near),!(j4.containsPoint(ug.origin)===!1&&(ug.intersectSphere(j4,hz)===null||ug.origin.distanceToSquared(hz)>(e.far-e.near)**2))&&(fz.copy(s).invert(),ug.copy(e.ray).applyMatrix4(fz),!(r.boundingBox!==null&&ug.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,ug)))}_computeIntersections(e,n,r){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,h=s.attributes.normal,g=s.groups,v=s.drawRange;if(o!==null)if(Array.isArray(a))for(let b=0,_=g.length;b<_;b++){const w=g[b],S=a[w.materialIndex],E=Math.max(w.start,v.start),A=Math.min(o.count,Math.min(w.start+w.count,v.start+v.count));for(let N=E,D=A;N<D;N+=3){const P=o.getX(N),L=o.getX(N+1),R=o.getX(N+2);i=G4(this,S,e,r,c,d,h,P,L,R),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=w.materialIndex,n.push(i))}}else{const b=Math.max(0,v.start),_=Math.min(o.count,v.start+v.count);for(let w=b,S=_;w<S;w+=3){const E=o.getX(w),A=o.getX(w+1),N=o.getX(w+2);i=G4(this,a,e,r,c,d,h,E,A,N),i&&(i.faceIndex=Math.floor(w/3),n.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let b=0,_=g.length;b<_;b++){const w=g[b],S=a[w.materialIndex],E=Math.max(w.start,v.start),A=Math.min(l.count,Math.min(w.start+w.count,v.start+v.count));for(let N=E,D=A;N<D;N+=3){const P=N,L=N+1,R=N+2;i=G4(this,S,e,r,c,d,h,P,L,R),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=w.materialIndex,n.push(i))}}else{const b=Math.max(0,v.start),_=Math.min(l.count,v.start+v.count);for(let w=b,S=_;w<S;w+=3){const E=w,A=w+1,N=w+2;i=G4(this,a,e,r,c,d,h,E,A,N),i&&(i.faceIndex=Math.floor(w/3),n.push(i))}}}}function USe(t,e,n,r,i,s,a,o){let l;if(e.side===Vl?l=r.intersectTriangle(a,s,i,!0,o):l=r.intersectTriangle(i,s,a,e.side===gp,o),l===null)return null;V4.copy(o),V4.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(V4);return c<n.near||c>n.far?null:{distance:c,point:V4.clone(),object:t}}function G4(t,e,n,r,i,s,a,o,l,c){t.getVertexPosition(o,F4),t.getVertexPosition(l,U4),t.getVertexPosition(c,B4);const d=USe(t,e,n,r,F4,U4,B4,pz);if(d){const h=new Fe;Mc.getBarycoord(pz,F4,U4,B4,h),i&&(d.uv=Mc.getInterpolatedAttribute(i,o,l,c,h,new zt)),s&&(d.uv1=Mc.getInterpolatedAttribute(s,o,l,c,h,new zt)),a&&(d.normal=Mc.getInterpolatedAttribute(a,o,l,c,h,new Fe),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const g={a:o,b:l,c,normal:new Fe,materialIndex:0};Mc.getNormal(F4,U4,B4,g.normal),d.face=g,d.barycoord=h}return d}const mz=new Fe,gz=new ci,vz=new ci,BSe=new Fe,xz=new rr,W4=new Fe,s6=new Va,yz=new rr,a6=new Ev;class dY extends Us{constructor(e,n){super(e,n),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=jR,this.bindMatrix=new rr,this.bindMatrixInverse=new rr,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Ca),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,W4),this.boundingBox.expandByPoint(W4)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Va),this.boundingSphere.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,W4),this.boundingSphere.expandByPoint(W4)}copy(e,n){return super.copy(e,n),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,n){const r=this.material,i=this.matrixWorld;r!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),s6.copy(this.boundingSphere),s6.applyMatrix4(i),e.ray.intersectsSphere(s6)!==!1&&(yz.copy(i).invert(),a6.copy(e.ray).applyMatrix4(yz),!(this.boundingBox!==null&&a6.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,n,a6)))}getVertexPosition(e,n){return super.getVertexPosition(e,n),this.applyBoneTransform(e,n),n}bind(e,n){this.skeleton=e,n===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),n=this.matrixWorld),this.bindMatrix.copy(n),this.bindMatrixInverse.copy(n).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new ci,n=this.geometry.attributes.skinWeight;for(let r=0,i=n.count;r<i;r++){e.fromBufferAttribute(n,r);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),n.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===jR?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===VX?this.bindMatrixInverse.copy(this.bindMatrix).invert():hn("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,n){const r=this.skeleton,i=this.geometry;gz.fromBufferAttribute(i.attributes.skinIndex,e),vz.fromBufferAttribute(i.attributes.skinWeight,e),mz.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let s=0;s<4;s++){const a=vz.getComponent(s);if(a!==0){const o=gz.getComponent(s);xz.multiplyMatrices(r.bones[o].matrixWorld,r.boneInverses[o]),n.addScaledVector(BSe.copy(mz).applyMatrix4(xz),a)}}return n.applyMatrix4(this.bindMatrixInverse)}}class s9 extends yi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Bd extends ra{constructor(e=null,n=1,r=1,i,s,a,o,l,c=Ea,d=Ea,h,g){super(null,a,o,l,c,d,i,s,h,g),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const bz=new rr,HSe=new rr;class oE{constructor(e=[],n=[]){this.uuid=ru(),this.bones=e.slice(0),this.boneInverses=n,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,n=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),n.length===0)this.calculateInverses();else if(e.length!==n.length){hn("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let r=0,i=this.bones.length;r<i;r++)this.boneInverses.push(new rr)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,n=this.bones.length;e<n;e++){const r=new rr;this.bones[e]&&r.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(r)}}pose(){for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];r&&r.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,n=this.bones.length;e<n;e++){const r=this.bones[e];r&&(r.parent&&r.parent.isBone?(r.matrix.copy(r.parent.matrixWorld).invert(),r.matrix.multiply(r.matrixWorld)):r.matrix.copy(r.matrixWorld),r.matrix.decompose(r.position,r.quaternion,r.scale))}}update(){const e=this.bones,n=this.boneInverses,r=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:HSe;bz.multiplyMatrices(o,n[s]),bz.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new oE(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4);n.set(this.boneMatrices);const r=new Bd(n,e,e,ul,Bl);return r.needsUpdate=!0,this.boneMatrices=n,this.boneTexture=r,this}getBoneByName(e){for(let n=0,r=this.bones.length;n<r;n++){const i=this.bones[n];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,n){this.uuid=e.uuid;for(let r=0,i=e.bones.length;r<i;r++){const s=e.bones[r];let a=n[s];a===void 0&&(hn("Skeleton: No bone found with UUID:",s),a=new s9),this.bones.push(a),this.boneInverses.push(new rr().fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const n=this.bones,r=this.boneInverses;for(let i=0,s=n.length;i<s;i++){const a=n[i];e.bones.push(a.uuid);const o=r[i];e.boneInverses.push(o.toArray())}return e}}class dv extends Vi{constructor(e,n,r,i=1){super(e,n,r),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Vx=new rr,_z=new rr,$4=[],Sz=new Ca,VSe=new rr,i_=new Us,s_=new Va;class fY extends Us{constructor(e,n,r){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new dv(new Float32Array(r*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=r,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<r;i++)this.setMatrixAt(i,VSe)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new Ca),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Vx),Sz.copy(e.boundingBox).applyMatrix4(Vx),this.boundingBox.union(Sz)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new Va),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Vx),s_.copy(e.boundingSphere).applyMatrix4(Vx),this.boundingSphere.union(s_)}copy(e,n){return super.copy(e,n),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,n){n.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,n){n.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,n){const r=n.morphTargetInfluences,i=this.morphTexture.source.data.data,s=r.length+1,a=e*s+1;for(let o=0;o<r.length;o++)r[o]=i[a+o]}raycast(e,n){const r=this.matrixWorld,i=this.count;if(i_.geometry=this.geometry,i_.material=this.material,i_.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),s_.copy(this.boundingSphere),s_.applyMatrix4(r),e.ray.intersectsSphere(s_)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Vx),_z.multiplyMatrices(r,Vx),i_.matrixWorld=_z,i_.raycast(e,$4);for(let a=0,o=$4.length;a<o;a++){const l=$4[a];l.instanceId=s,l.object=this,n.push(l)}$4.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new dv(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),n.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,n){n.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,n){const r=n.morphTargetInfluences,i=r.length+1;this.morphTexture===null&&(this.morphTexture=new Bd(new Float32Array(i*this.count),i,this.count,KT,Bl));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<r.length;c++)a+=r[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=i*e;s[l]=o,s.set(r,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const o6=new Fe,GSe=new Fe,WSe=new yr;class Jh{constructor(e=new Fe(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=o6.subVectors(r,n).cross(GSe.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(o6),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const r=n||WSe.getNormalMatrix(e),i=this.coplanarPoint(o6).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const dg=new Va,$Se=new zt(.5,.5),q4=new Fe;class Py{constructor(e=new Jh,n=new Jh,r=new Jh,i=new Jh,s=new Jh,a=new Jh){this.planes=[e,n,r,i,s,a]}set(e,n,r,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(r),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Zc,r=!1){const i=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],d=s[4],h=s[5],g=s[6],v=s[7],b=s[8],_=s[9],w=s[10],S=s[11],E=s[12],A=s[13],N=s[14],D=s[15];if(i[0].setComponents(c-a,v-d,S-b,D-E).normalize(),i[1].setComponents(c+a,v+d,S+b,D+E).normalize(),i[2].setComponents(c+o,v+h,S+_,D+A).normalize(),i[3].setComponents(c-o,v-h,S-_,D-A).normalize(),r)i[4].setComponents(l,g,w,N).normalize(),i[5].setComponents(c-l,v-g,S-w,D-N).normalize();else if(i[4].setComponents(c-l,v-g,S-w,D-N).normalize(),n===Zc)i[5].setComponents(c+l,v+g,S+w,D+N).normalize();else if(n===uv)i[5].setComponents(l,g,w,N).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),dg.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),dg.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(dg)}intersectsSprite(e){dg.center.set(0,0,0);const n=$Se.distanceTo(e.center);return dg.radius=.7071067811865476+n,dg.applyMatrix4(e.matrixWorld),this.intersectsSphere(dg)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if(q4.x=i.normal.x>0?e.max.x:e.min.x,q4.y=i.normal.y>0?e.max.y:e.min.y,q4.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(q4)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const Cf=new rr,Af=new Py;class lE{constructor(){this.coordinateSystem=Zc}intersectsObject(e,n){if(!n.isArrayCamera||n.cameras.length===0)return!1;for(let r=0;r<n.cameras.length;r++){const i=n.cameras[r];if(Cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Af.setFromProjectionMatrix(Cf,i.coordinateSystem,i.reversedDepth),Af.intersectsObject(e))return!0}return!1}intersectsSprite(e,n){if(!n||!n.cameras||n.cameras.length===0)return!1;for(let r=0;r<n.cameras.length;r++){const i=n.cameras[r];if(Cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Af.setFromProjectionMatrix(Cf,i.coordinateSystem,i.reversedDepth),Af.intersectsSprite(e))return!0}return!1}intersectsSphere(e,n){if(!n||!n.cameras||n.cameras.length===0)return!1;for(let r=0;r<n.cameras.length;r++){const i=n.cameras[r];if(Cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Af.setFromProjectionMatrix(Cf,i.coordinateSystem,i.reversedDepth),Af.intersectsSphere(e))return!0}return!1}intersectsBox(e,n){if(!n||!n.cameras||n.cameras.length===0)return!1;for(let r=0;r<n.cameras.length;r++){const i=n.cameras[r];if(Cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Af.setFromProjectionMatrix(Cf,i.coordinateSystem,i.reversedDepth),Af.intersectsBox(e))return!0}return!1}containsPoint(e,n){if(!n||!n.cameras||n.cameras.length===0)return!1;for(let r=0;r<n.cameras.length;r++){const i=n.cameras[r];if(Cf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Af.setFromProjectionMatrix(Cf,i.coordinateSystem,i.reversedDepth),Af.containsPoint(e))return!0}return!1}clone(){return new lE}}function l6(t,e){return t-e}function qSe(t,e){return t.z-e.z}function XSe(t,e){return e.z-t.z}class YSe{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,n,r,i){const s=this.pool,a=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const o=s[this.index];a.push(o),this.index++,o.start=e,o.count=n,o.z=r,o.index=i}reset(){this.list.length=0,this.index=0}}const vc=new rr,KSe=new xn(1,1,1),wz=new Py,ZSe=new lE,X4=new Ca,fg=new Va,a_=new Fe,Mz=new Fe,QSe=new Fe,c6=new YSe,al=new Us,Y4=[];function JSe(t,e,n=0){const r=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const i=t.count;for(let s=0;s<i;s++)for(let a=0;a<r;a++)e.setComponent(s+n,a,t.getComponent(s,a))}else e.array.set(t.array,n*r);e.needsUpdate=!0}function hg(t,e){if(t.constructor!==e.constructor){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++)e[r]=t[r]}else{const n=Math.min(t.length,e.length);e.set(new t.constructor(t.buffer,0,n))}}class hY extends Us{constructor(e,n,r=n*2,i){super(new br,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=n,this._maxIndexCount=r,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4),r=new Bd(n,e,e,ul,Bl);this._matricesTexture=r}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Uint32Array(e*e),r=new Bd(n,e,e,bw,Ku);this._indirectTexture=r}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Float32Array(e*e*4).fill(1),r=new Bd(n,e,e,ul,Bl);r.colorSpace=ii.workingColorSpace,this._colorsTexture=r}_initializeGeometry(e){const n=this.geometry,r=this._maxVertexCount,i=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const a=e.getAttribute(s),{array:o,itemSize:l,normalized:c}=a,d=new o.constructor(r*l),h=new Vi(d,l,c);n.setAttribute(s,h)}if(e.getIndex()!==null){const s=r>65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new Vi(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const n=this.geometry;if(!!e.getIndex()!=!!n.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const r in n.attributes){if(!e.hasAttribute(r))throw new Error(`THREE.BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=n.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const n=this._instanceInfo;if(e<0||e>=n.length||n[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const n=this._geometryInfo;if(e<0||e>=n.length||n[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ca);const e=this.boundingBox,n=this._instanceInfo;e.makeEmpty();for(let r=0,i=n.length;r<i;r++){if(n[r].active===!1)continue;const s=n[r].geometryIndex;this.getMatrixAt(r,vc),this.getBoundingBoxAt(s,X4).applyMatrix4(vc),e.union(X4)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Va);const e=this.boundingSphere,n=this._instanceInfo;e.makeEmpty();for(let r=0,i=n.length;r<i;r++){if(n[r].active===!1)continue;const s=n[r].geometryIndex;this.getMatrixAt(r,vc),this.getBoundingSphereAt(s,fg).applyMatrix4(vc),e.union(fg)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(l6),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=r):(i=this._instanceInfo.length,this._instanceInfo.push(r));const s=this._matricesTexture;vc.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(KSe.toArray(a.image.data,i*4),a.needsUpdate=!0),this._visibilityChanged=!0,i}addGeometry(e,n=-1,r=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=n===-1?e.getAttribute("position").count:n;const a=e.getIndex();if(a!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=r===-1?a.count:r),i.indexStart!==-1&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(l6),l=this._availableGeometryIds.shift(),s[l]=i):(l=this._geometryCount,this._geometryCount++,s.push(i)),this.setGeometryAt(l,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,l}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),a=n.getIndex(),o=this._geometryInfo[e];if(i&&a.count>o.reservedIndexCount||n.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=n.getAttribute("position").count;for(const d in r.attributes){const h=n.getAttribute(d),g=r.getAttribute(d);JSe(h,g,l);const v=h.itemSize;for(let b=h.count,_=c;b<_;b++){const w=l+b;for(let S=0;S<v;S++)g.setComponent(w,S,0)}g.needsUpdate=!0,g.addUpdateRange(l*v,c*v)}if(i){const d=o.indexStart,h=o.reservedIndexCount;o.indexCount=n.getIndex().count;for(let g=0;g<a.count;g++)s.setX(d+g,l+a.getX(g));for(let g=a.count,v=h;g<v;g++)s.setX(d+g,l);s.needsUpdate=!0,s.addUpdateRange(d,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,n.boundingBox!==null&&(o.boundingBox=n.boundingBox.clone()),o.boundingSphere=null,n.boundingSphere!==null&&(o.boundingSphere=n.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const n=this._geometryInfo;if(e>=n.length||n[e].active===!1)return this;const r=this._instanceInfo;for(let i=0,s=r.length;i<s;i++)r[i].active&&r[i].geometryIndex===e&&this.deleteInstance(i);return n[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,n=0;const r=this._geometryInfo,i=r.map((a,o)=>o).sort((a,o)=>r[a].vertexStart-r[o].vertexStart),s=this.geometry;for(let a=0,o=r.length;a<o;a++){const l=i[a],c=r[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==n){const{indexStart:d,vertexStart:h,reservedIndexCount:g}=c,v=s.index,b=v.array,_=e-h;for(let w=d;w<d+g;w++)b[w]=b[w]+_;v.array.copyWithin(n,d,d+g),v.addUpdateRange(n,g),v.needsUpdate=!0,c.indexStart=n}n+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:d,reservedVertexCount:h}=c,g=s.attributes;for(const v in g){const b=g[v],{array:_,itemSize:w}=b;_.copyWithin(e*w,d*w,(d+h)*w),b.addUpdateRange(e*w,h*w),b.needsUpdate=!0}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart}}return this._nextIndexStart=n,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,n){if(e>=this._geometryCount)return null;const r=this.geometry,i=this._geometryInfo[e];if(i.boundingBox===null){const s=new Ca,a=r.index,o=r.attributes.position;for(let l=i.start,c=i.start+i.count;l<c;l++){let d=l;a&&(d=a.getX(d)),s.expandByPoint(a_.fromBufferAttribute(o,d))}i.boundingBox=s}return n.copy(i.boundingBox),n}getBoundingSphereAt(e,n){if(e>=this._geometryCount)return null;const r=this.geometry,i=this._geometryInfo[e];if(i.boundingSphere===null){const s=new Va;this.getBoundingBoxAt(e,X4),X4.getCenter(s.center);const a=r.index,o=r.attributes.position;let l=0;for(let c=i.start,d=i.start+i.count;c<d;c++){let h=c;a&&(h=a.getX(h)),a_.fromBufferAttribute(o,h),l=Math.max(l,s.center.distanceToSquared(a_))}s.radius=Math.sqrt(l),i.boundingSphere=s}return n.copy(i.boundingSphere),n}setMatrixAt(e,n){this.validateInstanceId(e);const r=this._matricesTexture,i=this._matricesTexture.image.data;return n.toArray(i,e*16),r.needsUpdate=!0,this}getMatrixAt(e,n){return this.validateInstanceId(e),n.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,n){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),n.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,n){return this.validateInstanceId(e),n.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,n){return this.validateInstanceId(e),this._instanceInfo[e].visible===n?this:(this._instanceInfo[e].visible=n,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,n){return this.validateInstanceId(e),this.validateGeometryId(n),this._instanceInfo[e].geometryIndex=n,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,n={}){this.validateGeometryId(e);const r=this._geometryInfo[e];return n.vertexStart=r.vertexStart,n.vertexCount=r.vertexCount,n.reservedVertexCount=r.reservedVertexCount,n.indexStart=r.indexStart,n.indexCount=r.indexCount,n.reservedIndexCount=r.reservedIndexCount,n.start=r.start,n.count=r.count,n}setInstanceCount(e){const n=this._availableInstanceIds,r=this._instanceInfo;for(n.sort(l6);n[n.length-1]===r.length-1;)r.pop(),n.pop();if(e<r.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),s=new Int32Array(e);hg(this._multiDrawCounts,i),hg(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const a=this._indirectTexture,o=this._matricesTexture,l=this._colorsTexture;a.dispose(),this._initIndirectTexture(),hg(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),hg(o.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),hg(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,n){const r=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...r.map(o=>o.vertexStart+o.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${n}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...r.map(l=>l.indexStart+l.reservedIndexCount))>n)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${n}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=n,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new br,this._initializeGeometry(s));const a=this.geometry;s.index&&hg(s.index.array,a.index.array);for(const o in s.attributes)hg(s.attributes[o].array,a.attributes[o].array)}raycast(e,n){const r=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,a=this.geometry;al.material=this.material,al.geometry.index=a.index,al.geometry.attributes=a.attributes,al.geometry.boundingBox===null&&(al.geometry.boundingBox=new Ca),al.geometry.boundingSphere===null&&(al.geometry.boundingSphere=new Va);for(let o=0,l=r.length;o<l;o++){if(!r[o].visible||!r[o].active)continue;const c=r[o].geometryIndex,d=i[c];al.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(o,al.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,al.geometry.boundingBox),this.getBoundingSphereAt(c,al.geometry.boundingSphere),al.raycast(e,Y4);for(let h=0,g=Y4.length;h<g;h++){const v=Y4[h];v.object=this,v.batchId=o,n.push(v)}Y4.length=0}al.material=null,al.geometry.index=null,al.geometry.attributes={},al.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(n=>({...n,boundingBox:n.boundingBox!==null?n.boundingBox.clone():null,boundingSphere:n.boundingSphere!==null?n.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(n=>({...n})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,n,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex();let o=a===null?1:a.array.BYTES_PER_ELEMENT,l=1;s.wireframe&&(l=2,o=i.attributes.position.count>65535?4:2);const c=this._instanceInfo,d=this._multiDrawStarts,h=this._multiDrawCounts,g=this._geometryInfo,v=this.perObjectFrustumCulled,b=this._indirectTexture,_=b.image.data,w=r.isArrayCamera?ZSe:wz;v&&!r.isArrayCamera&&(vc.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),wz.setFromProjectionMatrix(vc,r.coordinateSystem,r.reversedDepth));let S=0;if(this.sortObjects){vc.copy(this.matrixWorld).invert(),a_.setFromMatrixPosition(r.matrixWorld).applyMatrix4(vc),Mz.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(vc);for(let N=0,D=c.length;N<D;N++)if(c[N].visible&&c[N].active){const P=c[N].geometryIndex;this.getMatrixAt(N,vc),this.getBoundingSphereAt(P,fg).applyMatrix4(vc);let L=!1;if(v&&(L=!w.intersectsSphere(fg,r)),!L){const R=g[P],O=QSe.subVectors(fg.center,a_).dot(Mz);c6.push(R.start,R.count,O,N)}}const E=c6.list,A=this.customSort;A===null?E.sort(s.transparent?XSe:qSe):A.call(this,E,r);for(let N=0,D=E.length;N<D;N++){const P=E[N];d[S]=P.start*o*l,h[S]=P.count*l,_[S]=P.index,S++}c6.reset()}else for(let E=0,A=c.length;E<A;E++)if(c[E].visible&&c[E].active){const N=c[E].geometryIndex;let D=!1;if(v&&(this.getMatrixAt(E,vc),this.getBoundingSphereAt(N,fg).applyMatrix4(vc),D=!w.intersectsSphere(fg,r)),!D){const P=g[N];d[S]=P.start*o*l,h[S]=P.count*l,_[S]=E,S++}}b.needsUpdate=!0,this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(e,n,r,i,s,a){this.onBeforeRender(e,null,i,s,a)}}class $l extends vl{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new xn(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const x5=new Fe,y5=new Fe,Tz=new rr,o_=new Ev,K4=new Va,u6=new Fe,Ez=new Fe;let am=class extends yi{constructor(e=new br,n=new $l){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[0];for(let i=1,s=n.count;i<s;i++)x5.fromBufferAttribute(n,i-1),y5.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=x5.distanceTo(y5);e.setAttribute("lineDistance",new Cn(r,1))}else hn("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,n){const r=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),K4.copy(r.boundingSphere),K4.applyMatrix4(i),K4.radius+=s,e.ray.intersectsSphere(K4)===!1)return;Tz.copy(i).invert(),o_.copy(e.ray).applyMatrix4(Tz);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,d=r.index,g=r.attributes.position;if(d!==null){const v=Math.max(0,a.start),b=Math.min(d.count,a.start+a.count);for(let _=v,w=b-1;_<w;_+=c){const S=d.getX(_),E=d.getX(_+1),A=Z4(this,e,o_,l,S,E,_);A&&n.push(A)}if(this.isLineLoop){const _=d.getX(b-1),w=d.getX(v),S=Z4(this,e,o_,l,_,w,b-1);S&&n.push(S)}}else{const v=Math.max(0,a.start),b=Math.min(g.count,a.start+a.count);for(let _=v,w=b-1;_<w;_+=c){const S=Z4(this,e,o_,l,_,_+1,_);S&&n.push(S)}if(this.isLineLoop){const _=Z4(this,e,o_,l,b-1,v,b-1);_&&n.push(_)}}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}};function Z4(t,e,n,r,i,s,a){const o=t.geometry.attributes.position;if(x5.fromBufferAttribute(o,i),y5.fromBufferAttribute(o,s),n.distanceSqToSegment(x5,y5,u6,Ez)>r)return;u6.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(u6);if(!(c<e.near||c>e.far))return{distance:c,point:Ez.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}const Cz=new Fe,Az=new Fe;class gh extends am{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[];for(let i=0,s=n.count;i<s;i+=2)Cz.fromBufferAttribute(n,i),Az.fromBufferAttribute(n,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+Cz.distanceTo(Az);e.setAttribute("lineDistance",new Cn(r,1))}else hn("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class pY extends am{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class a9 extends vl{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new xn(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Nz=new rr,HR=new Ev,Q4=new Va,J4=new Fe;class mY extends yi{constructor(e=new br,n=new a9){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,n){const r=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Q4.copy(r.boundingSphere),Q4.applyMatrix4(i),Q4.radius+=s,e.ray.intersectsSphere(Q4)===!1)return;Nz.copy(i).invert(),HR.copy(e.ray).applyMatrix4(Nz);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=r.index,h=r.attributes.position;if(c!==null){const g=Math.max(0,a.start),v=Math.min(c.count,a.start+a.count);for(let b=g,_=v;b<_;b++){const w=c.getX(b);J4.fromBufferAttribute(h,w),Rz(J4,w,l,i,e,n,this)}}else{const g=Math.max(0,a.start),v=Math.min(h.count,a.start+a.count);for(let b=g,_=v;b<_;b++)J4.fromBufferAttribute(h,b),Rz(J4,b,l,i,e,n,this)}}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Rz(t,e,n,r,i,s,a){const o=HR.distanceSqToPoint(t);if(o<n){const l=new Fe;HR.closestPointToPoint(t,l),l.applyMatrix4(r);const c=i.ray.origin.distanceTo(l);if(c<i.near||c>i.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class gY extends ra{constructor(e,n,r,i,s=rs,a=rs,o,l,c){super(e,n,r,i,s,a,o,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const d=this;function h(){d.needsUpdate=!0,d._requestVideoFrameCallbackId=e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(h))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class ewe extends gY{constructor(e,n,r,i,s,a,o,l){super({},e,n,r,i,s,a,o,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class twe extends ra{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=Ea,this.minFilter=Ea,this.generateMipmaps=!1,this.needsUpdate=!0}}class cE extends ra{constructor(e,n,r,i,s,a,o,l,c,d,h,g){super(null,a,o,l,c,d,i,s,h,g),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class nwe extends cE{constructor(e,n,r,i,s,a){super(e,n,r,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Tc,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class rwe extends cE{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,sh),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class _w extends ra{constructor(e=[],n=sh,r,i,s,a,o,l,c,d){super(e,n,r,i,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class iwe extends ra{constructor(e,n,r,i,s,a,o,l,c){super(e,n,r,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ay extends ra{constructor(e,n,r=Ku,i,s,a,o=Ea,l=Ea,c,d=oh,h=1){if(d!==oh&&d!==B0)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const g={width:e,height:n,depth:h};super(g,i,s,a,o,l,d,r,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new H0(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class vY extends ay{constructor(e,n=Ku,r=sh,i,s,a=Ea,o=Ea,l,c=oh){const d={width:e,height:e,depth:1},h=[d,d,d,d,d,d];super(e,e,n,r,i,s,a,o,l,c),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class o9 extends ra{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Cv extends br{constructor(e=1,n=1,r=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],h=[];let g=0,v=0;b("z","y","x",-1,-1,r,n,e,a,s,0),b("z","y","x",1,-1,r,n,-e,a,s,1),b("x","z","y",1,1,e,r,n,i,a,2),b("x","z","y",1,-1,e,r,-n,i,a,3),b("x","y","z",1,-1,e,n,r,i,s,4),b("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new Cn(c,3)),this.setAttribute("normal",new Cn(d,3)),this.setAttribute("uv",new Cn(h,2));function b(_,w,S,E,A,N,D,P,L,R,O){const W=N/L,F=D/R,V=N/2,G=D/2,Z=P/2,B=L+1,q=R+1;let K=0,Y=0;const Q=new Fe;for(let U=0;U<q;U++){const j=U*F-G;for(let X=0;X<B;X++){const H=X*W-V;Q[_]=H*E,Q[w]=j*A,Q[S]=Z,c.push(Q.x,Q.y,Q.z),Q[_]=0,Q[w]=0,Q[S]=P>0?1:-1,d.push(Q.x,Q.y,Q.z),h.push(X/L),h.push(1-U/R),K+=1}}for(let U=0;U<R;U++)for(let j=0;j<L;j++){const X=g+j+B*U,H=g+j+B*(U+1),ie=g+(j+1)+B*(U+1),ne=g+(j+1)+B*U;l.push(X,H,ne),l.push(H,ie,ne),Y+=6}o.addGroup(v,Y,O),v+=Y,g+=K}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Cv(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class uE extends br{constructor(e=1,n=1,r=4,i=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:n,capSegments:r,radialSegments:i,heightSegments:s},n=Math.max(0,n),r=Math.max(1,Math.floor(r)),i=Math.max(3,Math.floor(i)),s=Math.max(1,Math.floor(s));const a=[],o=[],l=[],c=[],d=n/2,h=Math.PI/2*e,g=n,v=2*h+g,b=r*2+s,_=i+1,w=new Fe,S=new Fe;for(let E=0;E<=b;E++){let A=0,N=0,D=0,P=0;if(E<=r){const O=E/r,W=O*Math.PI/2;N=-d-e*Math.cos(W),D=e*Math.sin(W),P=-e*Math.cos(W),A=O*h}else if(E<=r+s){const O=(E-r)/s;N=-d+O*n,D=e,P=0,A=h+O*g}else{const O=(E-r-s)/r,W=O*Math.PI/2;N=d+e*Math.sin(W),D=e*Math.cos(W),P=e*Math.sin(W),A=h+g+O*h}const L=Math.max(0,Math.min(1,A/v));let R=0;E===0?R=.5/i:E===b&&(R=-.5/i);for(let O=0;O<=i;O++){const W=O/i,F=W*Math.PI*2,V=Math.sin(F),G=Math.cos(F);S.x=-D*G,S.y=N,S.z=D*V,o.push(S.x,S.y,S.z),w.set(-D*G,P,D*V),w.normalize(),l.push(w.x,w.y,w.z),c.push(W+R,L)}if(E>0){const O=(E-1)*_;for(let W=0;W<i;W++){const F=O+W,V=O+W+1,G=E*_+W,Z=E*_+W+1;a.push(F,V,G),a.push(V,Z,G)}}}this.setIndex(a),this.setAttribute("position",new Cn(o,3)),this.setAttribute("normal",new Cn(l,3)),this.setAttribute("uv",new Cn(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uE(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class dE extends br{constructor(e=1,n=32,r=0,i=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:n,thetaStart:r,thetaLength:i},n=Math.max(3,n);const s=[],a=[],o=[],l=[],c=new Fe,d=new zt;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let h=0,g=3;h<=n;h++,g+=3){const v=r+h/n*i;c.x=e*Math.cos(v),c.y=e*Math.sin(v),a.push(c.x,c.y,c.z),o.push(0,0,1),d.x=(a[g]/e+1)/2,d.y=(a[g+1]/e+1)/2,l.push(d.x,d.y)}for(let h=1;h<=n;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new Cn(a,3)),this.setAttribute("normal",new Cn(o,3)),this.setAttribute("uv",new Cn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dE(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Sw extends br{constructor(e=1,n=1,r=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const d=[],h=[],g=[],v=[];let b=0;const _=[],w=r/2;let S=0;E(),a===!1&&(e>0&&A(!0),n>0&&A(!1)),this.setIndex(d),this.setAttribute("position",new Cn(h,3)),this.setAttribute("normal",new Cn(g,3)),this.setAttribute("uv",new Cn(v,2));function E(){const N=new Fe,D=new Fe;let P=0;const L=(n-e)/r;for(let R=0;R<=s;R++){const O=[],W=R/s,F=W*(n-e)+e;for(let V=0;V<=i;V++){const G=V/i,Z=G*l+o,B=Math.sin(Z),q=Math.cos(Z);D.x=F*B,D.y=-W*r+w,D.z=F*q,h.push(D.x,D.y,D.z),N.set(B,L,q).normalize(),g.push(N.x,N.y,N.z),v.push(G,1-W),O.push(b++)}_.push(O)}for(let R=0;R<i;R++)for(let O=0;O<s;O++){const W=_[O][R],F=_[O+1][R],V=_[O+1][R+1],G=_[O][R+1];(e>0||O!==0)&&(d.push(W,F,G),P+=3),(n>0||O!==s-1)&&(d.push(F,V,G),P+=3)}c.addGroup(S,P,0),S+=P}function A(N){const D=b,P=new zt,L=new Fe;let R=0;const O=N===!0?e:n,W=N===!0?1:-1;for(let V=1;V<=i;V++)h.push(0,w*W,0),g.push(0,W,0),v.push(.5,.5),b++;const F=b;for(let V=0;V<=i;V++){const Z=V/i*l+o,B=Math.cos(Z),q=Math.sin(Z);L.x=O*q,L.y=w*W,L.z=O*B,h.push(L.x,L.y,L.z),g.push(0,W,0),P.x=B*.5+.5,P.y=q*.5*W+.5,v.push(P.x,P.y),b++}for(let V=0;V<i;V++){const G=D+V,Z=F+V;N===!0?d.push(Z,Z+1,G):d.push(Z+1,Z,G),R+=3}c.addGroup(S,R,N===!0?1:2),S+=R}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sw(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ww extends Sw{constructor(e=1,n=1,r=32,i=1,s=!1,a=0,o=Math.PI*2){super(0,e,n,r,i,s,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new ww(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class ym extends br{constructor(e=[],n=[],r=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:n,radius:r,detail:i};const s=[],a=[];o(i),c(r),d(),this.setAttribute("position",new Cn(s,3)),this.setAttribute("normal",new Cn(s.slice(),3)),this.setAttribute("uv",new Cn(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(E){const A=new Fe,N=new Fe,D=new Fe;for(let P=0;P<n.length;P+=3)v(n[P+0],A),v(n[P+1],N),v(n[P+2],D),l(A,N,D,E)}function l(E,A,N,D){const P=D+1,L=[];for(let R=0;R<=P;R++){L[R]=[];const O=E.clone().lerp(N,R/P),W=A.clone().lerp(N,R/P),F=P-R;for(let V=0;V<=F;V++)V===0&&R===P?L[R][V]=O:L[R][V]=O.clone().lerp(W,V/F)}for(let R=0;R<P;R++)for(let O=0;O<2*(P-R)-1;O++){const W=Math.floor(O/2);O%2===0?(g(L[R][W+1]),g(L[R+1][W]),g(L[R][W])):(g(L[R][W+1]),g(L[R+1][W+1]),g(L[R+1][W]))}}function c(E){const A=new Fe;for(let N=0;N<s.length;N+=3)A.x=s[N+0],A.y=s[N+1],A.z=s[N+2],A.normalize().multiplyScalar(E),s[N+0]=A.x,s[N+1]=A.y,s[N+2]=A.z}function d(){const E=new Fe;for(let A=0;A<s.length;A+=3){E.x=s[A+0],E.y=s[A+1],E.z=s[A+2];const N=w(E)/2/Math.PI+.5,D=S(E)/Math.PI+.5;a.push(N,1-D)}b(),h()}function h(){for(let E=0;E<a.length;E+=6){const A=a[E+0],N=a[E+2],D=a[E+4],P=Math.max(A,N,D),L=Math.min(A,N,D);P>.9&&L<.1&&(A<.2&&(a[E+0]+=1),N<.2&&(a[E+2]+=1),D<.2&&(a[E+4]+=1))}}function g(E){s.push(E.x,E.y,E.z)}function v(E,A){const N=E*3;A.x=e[N+0],A.y=e[N+1],A.z=e[N+2]}function b(){const E=new Fe,A=new Fe,N=new Fe,D=new Fe,P=new zt,L=new zt,R=new zt;for(let O=0,W=0;O<s.length;O+=9,W+=6){E.set(s[O+0],s[O+1],s[O+2]),A.set(s[O+3],s[O+4],s[O+5]),N.set(s[O+6],s[O+7],s[O+8]),P.set(a[W+0],a[W+1]),L.set(a[W+2],a[W+3]),R.set(a[W+4],a[W+5]),D.copy(E).add(A).add(N).divideScalar(3);const F=w(D);_(P,W+0,E,F),_(L,W+2,A,F),_(R,W+4,N,F)}}function _(E,A,N,D){D<0&&E.x===1&&(a[A]=E.x-1),N.x===0&&N.z===0&&(a[A]=D/2/Math.PI+.5)}function w(E){return Math.atan2(E.z,-E.x)}function S(E){return Math.atan2(-E.y,Math.sqrt(E.x*E.x+E.z*E.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ym(e.vertices,e.indices,e.radius,e.detail)}}class fE extends ym{constructor(e=1,n=0){const r=(1+Math.sqrt(5))/2,i=1/r,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,n),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new fE(e.radius,e.detail)}}const eM=new Fe,tM=new Fe,d6=new Fe,nM=new Mc;class l9 extends br{constructor(e=null,n=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:n},e!==null){const i=Math.pow(10,4),s=Math.cos(Xg*n),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],d=["a","b","c"],h=new Array(3),g={},v=[];for(let b=0;b<l;b+=3){a?(c[0]=a.getX(b),c[1]=a.getX(b+1),c[2]=a.getX(b+2)):(c[0]=b,c[1]=b+1,c[2]=b+2);const{a:_,b:w,c:S}=nM;if(_.fromBufferAttribute(o,c[0]),w.fromBufferAttribute(o,c[1]),S.fromBufferAttribute(o,c[2]),nM.getNormal(d6),h[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,h[1]=`${Math.round(w.x*i)},${Math.round(w.y*i)},${Math.round(w.z*i)}`,h[2]=`${Math.round(S.x*i)},${Math.round(S.y*i)},${Math.round(S.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let E=0;E<3;E++){const A=(E+1)%3,N=h[E],D=h[A],P=nM[d[E]],L=nM[d[A]],R=`${N}_${D}`,O=`${D}_${N}`;O in g&&g[O]?(d6.dot(g[O].normal)<=s&&(v.push(P.x,P.y,P.z),v.push(L.x,L.y,L.z)),g[O]=null):R in g||(g[R]={index0:c[E],index1:c[A],normal:d6.clone()})}}for(const b in g)if(g[b]){const{index0:_,index1:w}=g[b];eM.fromBufferAttribute(o,_),tM.fromBufferAttribute(o,w),v.push(eM.x,eM.y,eM.z),v.push(tM.x,tM.y,tM.z)}this.setAttribute("position",new Cn(v,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Zd{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){hn("Curve: .getPoint() not implemented.")}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),s=0;n.push(0);for(let a=1;a<=e;a++)r=this.getPoint(a/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n=null){const r=this.getLengths();let i=0;const s=r.length;let a;n?a=n:a=e*r[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=r[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===a)return i/(s-1);const d=r[i],g=r[i+1]-d,v=(a-d)/g;return(i+v)/(s-1)}getTangent(e,n){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),l=n||(a.isVector2?new zt:new Fe);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n=!1){const r=new Fe,i=[],s=[],a=[],o=new Fe,l=new rr;for(let v=0;v<=e;v++){const b=v/e;i[v]=this.getTangentAt(b,new Fe)}s[0]=new Fe,a[0]=new Fe;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),h=Math.abs(i[0].y),g=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),h<=c&&(c=h,r.set(0,1,0)),g<=c&&r.set(0,0,1),o.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let v=1;v<=e;v++){if(s[v]=s[v-1].clone(),a[v]=a[v-1].clone(),o.crossVectors(i[v-1],i[v]),o.length()>Number.EPSILON){o.normalize();const b=Math.acos(sr(i[v-1].dot(i[v]),-1,1));s[v].applyMatrix4(l.makeRotationAxis(o,b))}a[v].crossVectors(i[v],s[v])}if(n===!0){let v=Math.acos(sr(s[0].dot(s[e]),-1,1));v/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(v=-v);for(let b=1;b<=e;b++)s[b].applyMatrix4(l.makeRotationAxis(i[b],v*b)),a[b].crossVectors(i[b],s[b])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class hE extends Zd{constructor(e=0,n=0,r=1,i=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,n=new zt){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const d=Math.cos(this.aRotation),h=Math.sin(this.aRotation),g=l-this.aX,v=c-this.aY;l=g*d-v*h+this.aX,c=g*h+v*d+this.aY}return r.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class xY extends hE{constructor(e,n,r,i,s,a){super(e,n,r,r,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function c9(){let t=0,e=0,n=0,r=0;function i(s,a,o,l){t=s,e=o,n=-3*s+3*a-2*o-l,r=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){i(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,d,h){let g=(a-s)/c-(o-s)/(c+d)+(o-a)/d,v=(o-a)/d-(l-a)/(d+h)+(l-o)/h;g*=d,v*=d,i(a,o,g,v)},calc:function(s){const a=s*s,o=a*s;return t+e*s+n*a+r*o}}}const rM=new Fe,f6=new c9,h6=new c9,p6=new c9;class yY extends Zd{constructor(e=[],n=!1,r="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=n,this.curveType=r,this.tension=i}getPoint(e,n=new Fe){const r=n,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,d;this.closed||o>0?c=i[(o-1)%s]:(rM.subVectors(i[0],i[1]).add(i[0]),c=rM);const h=i[o%s],g=i[(o+1)%s];if(this.closed||o+2<s?d=i[(o+2)%s]:(rM.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=rM),this.curveType==="centripetal"||this.curveType==="chordal"){const v=this.curveType==="chordal"?.5:.25;let b=Math.pow(c.distanceToSquared(h),v),_=Math.pow(h.distanceToSquared(g),v),w=Math.pow(g.distanceToSquared(d),v);_<1e-4&&(_=1),b<1e-4&&(b=_),w<1e-4&&(w=_),f6.initNonuniformCatmullRom(c.x,h.x,g.x,d.x,b,_,w),h6.initNonuniformCatmullRom(c.y,h.y,g.y,d.y,b,_,w),p6.initNonuniformCatmullRom(c.z,h.z,g.z,d.z,b,_,w)}else this.curveType==="catmullrom"&&(f6.initCatmullRom(c.x,h.x,g.x,d.x,this.tension),h6.initCatmullRom(c.y,h.y,g.y,d.y,this.tension),p6.initCatmullRom(c.z,h.z,g.z,d.z,this.tension));return r.set(f6.calc(l),h6.calc(l),p6.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,r=this.points.length;n<r;n++){const i=this.points[n];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(new Fe().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function kz(t,e,n,r,i){const s=(r-e)*.5,a=(i-n)*.5,o=t*t,l=t*o;return(2*n-2*r+s+a)*l+(-3*n+3*r-2*s-a)*o+s*t+n}function swe(t,e){const n=1-t;return n*n*e}function awe(t,e){return 2*(1-t)*t*e}function owe(t,e){return t*t*e}function G_(t,e,n,r){return swe(t,e)+awe(t,n)+owe(t,r)}function lwe(t,e){const n=1-t;return n*n*n*e}function cwe(t,e){const n=1-t;return 3*n*n*t*e}function uwe(t,e){return 3*(1-t)*t*t*e}function dwe(t,e){return t*t*t*e}function W_(t,e,n,r,i){return lwe(t,e)+cwe(t,n)+uwe(t,r)+dwe(t,i)}class u9 extends Zd{constructor(e=new zt,n=new zt,r=new zt,i=new zt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new zt){const r=n,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return r.set(W_(e,i.x,s.x,a.x,o.x),W_(e,i.y,s.y,a.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class bY extends Zd{constructor(e=new Fe,n=new Fe,r=new Fe,i=new Fe){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new Fe){const r=n,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return r.set(W_(e,i.x,s.x,a.x,o.x),W_(e,i.y,s.y,a.y,o.y),W_(e,i.z,s.z,a.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class d9 extends Zd{constructor(e=new zt,n=new zt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new zt){const r=n;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new zt){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class _Y extends Zd{constructor(e=new Fe,n=new Fe){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new Fe){const r=n;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,n){return this.getPoint(e,n)}getTangent(e,n=new Fe){return n.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,n){return this.getTangent(e,n)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class f9 extends Zd{constructor(e=new zt,n=new zt,r=new zt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new zt){const r=n,i=this.v0,s=this.v1,a=this.v2;return r.set(G_(e,i.x,s.x,a.x),G_(e,i.y,s.y,a.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class h9 extends Zd{constructor(e=new Fe,n=new Fe,r=new Fe){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new Fe){const r=n,i=this.v0,s=this.v1,a=this.v2;return r.set(G_(e,i.x,s.x,a.x),G_(e,i.y,s.y,a.y),G_(e,i.z,s.z,a.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class p9 extends Zd{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new zt){const r=n,i=this.points,s=(i.length-1)*e,a=Math.floor(s),o=s-a,l=i[a===0?a:a-1],c=i[a],d=i[a>i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return r.set(kz(o,l.x,c.x,d.x,h.x),kz(o,l.y,c.y,d.y,h.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let n=0,r=this.points.length;n<r;n++){const i=this.points[n];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let n=0,r=e.points.length;n<r;n++){const i=e.points[n];this.points.push(new zt().fromArray(i))}return this}}var b5=Object.freeze({__proto__:null,ArcCurve:xY,CatmullRomCurve3:yY,CubicBezierCurve:u9,CubicBezierCurve3:bY,EllipseCurve:hE,LineCurve:d9,LineCurve3:_Y,QuadraticBezierCurve:f9,QuadraticBezierCurve3:h9,SplineCurve:p9});class SY extends Zd{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),n=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(n)){const r=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new b5[r](n,e))}return this}getPoint(e,n){const r=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=r){const a=i[s]-r,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;r<i;r++)n+=this.curves[r].getLength(),e.push(n);return this.cacheLengths=e,e}getSpacedPoints(e=40){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return this.autoClose&&n.push(n[0]),n}getPoints(e=12){const n=[];let r;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const d=l[c];r&&r.equals(d)||(n.push(d),r=d)}}return this.autoClose&&n.length>1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let n=0,r=this.curves.length;n<r;n++){const i=this.curves[n];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let n=0,r=e.curves.length;n<r;n++){const i=e.curves[n];this.curves.push(new b5[i.type]().fromJSON(i))}return this}}class _5 extends SY{constructor(e){super(),this.type="Path",this.currentPoint=new zt,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let n=1,r=e.length;n<r;n++)this.lineTo(e[n].x,e[n].y);return this}moveTo(e,n){return this.currentPoint.set(e,n),this}lineTo(e,n){const r=new d9(this.currentPoint.clone(),new zt(e,n));return this.curves.push(r),this.currentPoint.set(e,n),this}quadraticCurveTo(e,n,r,i){const s=new f9(this.currentPoint.clone(),new zt(e,n),new zt(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,n,r,i,s,a){const o=new u9(this.currentPoint.clone(),new zt(e,n),new zt(r,i),new zt(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new p9(n);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,n,r,i,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,n+l,r,i,s,a),this}absarc(e,n,r,i,s,a){return this.absellipse(e,n,r,r,i,s,a),this}ellipse(e,n,r,i,s,a,o,l){const c=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+c,n+d,r,i,s,a,o,l),this}absellipse(e,n,r,i,s,a,o,l){const c=new hE(e,n,r,i,s,a,o,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const d=c.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class $0 extends _5{constructor(e){super(e),this.uuid=ru(),this.type="Shape",this.holes=[]}getPointsHoles(e){const n=[];for(let r=0,i=this.holes.length;r<i;r++)n[r]=this.holes[r].getPoints(e);return n}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let n=0,r=e.holes.length;n<r;n++){const i=e.holes[n];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let n=0,r=this.holes.length;n<r;n++){const i=this.holes[n];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let n=0,r=e.holes.length;n<r;n++){const i=e.holes[n];this.holes.push(new _5().fromJSON(i))}return this}}function fwe(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=wY(t,0,i,n,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(r&&(s=vwe(t,e,s,n)),t.length>80*n){o=t[0],l=t[1];let d=o,h=l;for(let g=n;g<i;g+=n){const v=t[g],b=t[g+1];v<o&&(o=v),b<l&&(l=b),v>d&&(d=v),b>h&&(h=b)}c=Math.max(d-o,h-l),c=c!==0?32767/c:0}return ES(s,a,n,o,l,c,0),a}function wY(t,e,n,r,i){let s;if(i===Awe(t,e,n,r)>0)for(let a=e;a<n;a+=r)s=Pz(a/r|0,t[a],t[a+1],s);else for(let a=n-r;a>=e;a-=r)s=Pz(a/r|0,t[a],t[a+1],s);return s&&oy(s,s.next)&&(AS(s),s=s.next),s}function fv(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(oy(n,n.next)||ta(n.prev,n,n.next)===0)){if(AS(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function ES(t,e,n,r,i,s,a){if(!t)return;!a&&s&&Swe(t,r,i,s);let o=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?pwe(t,r,i,s):hwe(t)){e.push(l.i,t.i,c.i),AS(t),t=c.next,o=c.next;continue}if(t=c,t===o){a?a===1?(t=mwe(fv(t),e),ES(t,e,n,r,i,s,2)):a===2&&gwe(t,e,n,r,i,s):ES(fv(t),e,n,r,i,s,1);break}}}function hwe(t){const e=t.prev,n=t,r=t.next;if(ta(e,n,r)>=0)return!1;const i=e.x,s=n.x,a=r.x,o=e.y,l=n.y,c=r.y,d=Math.min(i,s,a),h=Math.min(o,l,c),g=Math.max(i,s,a),v=Math.max(o,l,c);let b=r.next;for(;b!==e;){if(b.x>=d&&b.x<=g&&b.y>=h&&b.y<=v&&__(i,o,s,l,a,c,b.x,b.y)&&ta(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function pwe(t,e,n,r){const i=t.prev,s=t,a=t.next;if(ta(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,d=i.y,h=s.y,g=a.y,v=Math.min(o,l,c),b=Math.min(d,h,g),_=Math.max(o,l,c),w=Math.max(d,h,g),S=VR(v,b,e,n,r),E=VR(_,w,e,n,r);let A=t.prevZ,N=t.nextZ;for(;A&&A.z>=S&&N&&N.z<=E;){if(A.x>=v&&A.x<=_&&A.y>=b&&A.y<=w&&A!==i&&A!==a&&__(o,d,l,h,c,g,A.x,A.y)&&ta(A.prev,A,A.next)>=0||(A=A.prevZ,N.x>=v&&N.x<=_&&N.y>=b&&N.y<=w&&N!==i&&N!==a&&__(o,d,l,h,c,g,N.x,N.y)&&ta(N.prev,N,N.next)>=0))return!1;N=N.nextZ}for(;A&&A.z>=S;){if(A.x>=v&&A.x<=_&&A.y>=b&&A.y<=w&&A!==i&&A!==a&&__(o,d,l,h,c,g,A.x,A.y)&&ta(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;N&&N.z<=E;){if(N.x>=v&&N.x<=_&&N.y>=b&&N.y<=w&&N!==i&&N!==a&&__(o,d,l,h,c,g,N.x,N.y)&&ta(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function mwe(t,e){let n=t;do{const r=n.prev,i=n.next.next;!oy(r,i)&&TY(r,n,n.next,i)&&CS(r,i)&&CS(i,r)&&(e.push(r.i,n.i,i.i),AS(n),AS(n.next),n=t=i),n=n.next}while(n!==t);return fv(n)}function gwe(t,e,n,r,i,s){let a=t;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Twe(a,o)){let l=EY(a,o);a=fv(a,a.next),l=fv(l,l.next),ES(a,e,n,r,i,s,0),ES(l,e,n,r,i,s,0);return}o=o.next}a=a.next}while(a!==t)}function vwe(t,e,n,r){const i=[];for(let s=0,a=e.length;s<a;s++){const o=e[s]*r,l=s<a-1?e[s+1]*r:t.length,c=wY(t,o,l,r,!1);c===c.next&&(c.steiner=!0),i.push(Mwe(c))}i.sort(xwe);for(let s=0;s<i.length;s++)n=ywe(i[s],n);return n}function xwe(t,e){let n=t.x-e.x;if(n===0&&(n=t.y-e.y,n===0)){const r=(t.next.y-t.y)/(t.next.x-t.x),i=(e.next.y-e.y)/(e.next.x-e.x);n=r-i}return n}function ywe(t,e){const n=bwe(t,e);if(!n)return e;const r=EY(n,t);return fv(r,r.next),fv(n,n.next)}function bwe(t,e){let n=e;const r=t.x,i=t.y;let s=-1/0,a;if(oy(t,n))return n;do{if(oy(t,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){const h=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=r&&h>s&&(s=h,a=n.x<n.next.x?n:n.next,h===r))return a}n=n.next}while(n!==e);if(!a)return null;const o=a,l=a.x,c=a.y;let d=1/0;n=a;do{if(r>=n.x&&n.x>=l&&r!==n.x&&MY(i<c?r:s,i,l,c,i<c?s:r,i,n.x,n.y)){const h=Math.abs(i-n.y)/(r-n.x);CS(n,t)&&(h<d||h===d&&(n.x>a.x||n.x===a.x&&_we(a,n)))&&(a=n,d=h)}n=n.next}while(n!==o);return a}function _we(t,e){return ta(t.prev,t,e.prev)<0&&ta(e.next,t,t.next)<0}function Swe(t,e,n,r){let i=t;do i.z===0&&(i.z=VR(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,wwe(i)}function wwe(t){let e,n=1;do{let r=t,i;t=null;let s=null;for(e=0;r;){e++;let a=r,o=0;for(let c=0;c<n&&(o++,a=a.nextZ,!!a);c++);let l=n;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||r.z<=a.z)?(i=r,r=r.nextZ,o--):(i=a,a=a.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=a}s.nextZ=null,n*=2}while(e>1);return t}function VR(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Mwe(t){let e=t,n=t;do(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next;while(e!==t);return n}function MY(t,e,n,r,i,s,a,o){return(i-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(r-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(i-a)*(r-o)}function __(t,e,n,r,i,s,a,o){return!(t===a&&e===o)&&MY(t,e,n,r,i,s,a,o)}function Twe(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Ewe(t,e)&&(CS(t,e)&&CS(e,t)&&Cwe(t,e)&&(ta(t.prev,t,e.prev)||ta(t,e.prev,e))||oy(t,e)&&ta(t.prev,t,t.next)>0&&ta(e.prev,e,e.next)>0)}function ta(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function oy(t,e){return t.x===e.x&&t.y===e.y}function TY(t,e,n,r){const i=sM(ta(t,e,n)),s=sM(ta(t,e,r)),a=sM(ta(n,r,t)),o=sM(ta(n,r,e));return!!(i!==s&&a!==o||i===0&&iM(t,n,e)||s===0&&iM(t,r,e)||a===0&&iM(n,t,r)||o===0&&iM(n,e,r))}function iM(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function sM(t){return t>0?1:t<0?-1:0}function Ewe(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&TY(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function CS(t,e){return ta(t.prev,t,t.next)<0?ta(t,e,t.next)>=0&&ta(t,t.prev,e)>=0:ta(t,e,t.prev)<0||ta(t,t.next,e)<0}function Cwe(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function EY(t,e){const n=GR(t.i,t.x,t.y),r=GR(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function Pz(t,e,n,r){const i=GR(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function AS(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function GR(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Awe(t,e,n,r){let i=0;for(let s=e,a=n-r;s<n;s+=r)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}class Nwe{static triangulate(e,n,r=2){return fwe(e,n,r)}}class Ud{static area(e){const n=e.length;let r=0;for(let i=n-1,s=0;s<n;i=s++)r+=e[i].x*e[s].y-e[s].x*e[i].y;return r*.5}static isClockWise(e){return Ud.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];Iz(e),Dz(r,e);let a=e.length;n.forEach(Iz);for(let l=0;l<n.length;l++)i.push(a),a+=n[l].length,Dz(r,n[l]);const o=Nwe.triangulate(r,i);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function Iz(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Dz(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class pE extends br{constructor(e=new $0([new zt(.5,.5),new zt(-.5,.5),new zt(-.5,-.5),new zt(.5,-.5)]),n={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:n},e=Array.isArray(e)?e:[e];const r=this,i=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new Cn(i,3)),this.setAttribute("uv",new Cn(s,2)),this.computeVertexNormals();function a(o){const l=[],c=n.curveSegments!==void 0?n.curveSegments:12,d=n.steps!==void 0?n.steps:1,h=n.depth!==void 0?n.depth:1;let g=n.bevelEnabled!==void 0?n.bevelEnabled:!0,v=n.bevelThickness!==void 0?n.bevelThickness:.2,b=n.bevelSize!==void 0?n.bevelSize:v-.1,_=n.bevelOffset!==void 0?n.bevelOffset:0,w=n.bevelSegments!==void 0?n.bevelSegments:3;const S=n.extrudePath,E=n.UVGenerator!==void 0?n.UVGenerator:Rwe;let A,N=!1,D,P,L,R;if(S){A=S.getSpacedPoints(d),N=!0,g=!1;const ye=S.isCatmullRomCurve3?S.closed:!1;D=S.computeFrenetFrames(d,ye),P=new Fe,L=new Fe,R=new Fe}g||(w=0,v=0,b=0,_=0);const O=o.extractPoints(c);let W=O.shape;const F=O.holes;if(!Ud.isClockWise(W)){W=W.reverse();for(let ye=0,Oe=F.length;ye<Oe;ye++){const he=F[ye];Ud.isClockWise(he)&&(F[ye]=he.reverse())}}function G(ye){const he=10000000000000001e-36;let Re=ye[0];for(let oe=1;oe<=ye.length;oe++){const Ue=oe%ye.length,Ee=ye[Ue],Pe=Ee.x-Re.x,Ze=Ee.y-Re.y,ae=Pe*Pe+Ze*Ze,te=Math.max(Math.abs(Ee.x),Math.abs(Ee.y),Math.abs(Re.x),Math.abs(Re.y)),be=he*te*te;if(ae<=be){ye.splice(Ue,1),oe--;continue}Re=Ee}}G(W),F.forEach(G);const Z=F.length,B=W;for(let ye=0;ye<Z;ye++){const Oe=F[ye];W=W.concat(Oe)}function q(ye,Oe,he){return Oe||Hn("ExtrudeGeometry: vec does not exist"),ye.clone().addScaledVector(Oe,he)}const K=W.length;function Y(ye,Oe,he){let Re,oe,Ue;const Ee=ye.x-Oe.x,Pe=ye.y-Oe.y,Ze=he.x-ye.x,ae=he.y-ye.y,te=Ee*Ee+Pe*Pe,be=Ee*ae-Pe*Ze;if(Math.abs(be)>Number.EPSILON){const me=Math.sqrt(te),ge=Math.sqrt(Ze*Ze+ae*ae),ke=Oe.x-Pe/me,Xe=Oe.y+Ee/me,Ae=he.x-ae/ge,je=he.y+Ze/ge,We=((Ae-ke)*ae-(je-Xe)*Ze)/(Ee*ae-Pe*Ze);Re=ke+Ee*We-ye.x,oe=Xe+Pe*We-ye.y;const De=Re*Re+oe*oe;if(De<=2)return new zt(Re,oe);Ue=Math.sqrt(De/2)}else{let me=!1;Ee>Number.EPSILON?Ze>Number.EPSILON&&(me=!0):Ee<-Number.EPSILON?Ze<-Number.EPSILON&&(me=!0):Math.sign(Pe)===Math.sign(ae)&&(me=!0),me?(Re=-Pe,oe=Ee,Ue=Math.sqrt(te)):(Re=Ee,oe=Pe,Ue=Math.sqrt(te/2))}return new zt(Re/Ue,oe/Ue)}const Q=[];for(let ye=0,Oe=B.length,he=Oe-1,Re=ye+1;ye<Oe;ye++,he++,Re++)he===Oe&&(he=0),Re===Oe&&(Re=0),Q[ye]=Y(B[ye],B[he],B[Re]);const U=[];let j,X=Q.concat();for(let ye=0,Oe=Z;ye<Oe;ye++){const he=F[ye];j=[];for(let Re=0,oe=he.length,Ue=oe-1,Ee=Re+1;Re<oe;Re++,Ue++,Ee++)Ue===oe&&(Ue=0),Ee===oe&&(Ee=0),j[Re]=Y(he[Re],he[Ue],he[Ee]);U.push(j),X=X.concat(j)}let H;if(w===0)H=Ud.triangulateShape(B,F);else{const ye=[],Oe=[];for(let he=0;he<w;he++){const Re=he/w,oe=v*Math.cos(Re*Math.PI/2),Ue=b*Math.sin(Re*Math.PI/2)+_;for(let Ee=0,Pe=B.length;Ee<Pe;Ee++){const Ze=q(B[Ee],Q[Ee],Ue);fe(Ze.x,Ze.y,-oe),Re===0&&ye.push(Ze)}for(let Ee=0,Pe=Z;Ee<Pe;Ee++){const Ze=F[Ee];j=U[Ee];const ae=[];for(let te=0,be=Ze.length;te<be;te++){const me=q(Ze[te],j[te],Ue);fe(me.x,me.y,-oe),Re===0&&ae.push(me)}Re===0&&Oe.push(ae)}}H=Ud.triangulateShape(ye,Oe)}const ie=H.length,ne=b+_;for(let ye=0;ye<K;ye++){const Oe=g?q(W[ye],X[ye],ne):W[ye];N?(L.copy(D.normals[0]).multiplyScalar(Oe.x),P.copy(D.binormals[0]).multiplyScalar(Oe.y),R.copy(A[0]).add(L).add(P),fe(R.x,R.y,R.z)):fe(Oe.x,Oe.y,0)}for(let ye=1;ye<=d;ye++)for(let Oe=0;Oe<K;Oe++){const he=g?q(W[Oe],X[Oe],ne):W[Oe];N?(L.copy(D.normals[ye]).multiplyScalar(he.x),P.copy(D.binormals[ye]).multiplyScalar(he.y),R.copy(A[ye]).add(L).add(P),fe(R.x,R.y,R.z)):fe(he.x,he.y,h/d*ye)}for(let ye=w-1;ye>=0;ye--){const Oe=ye/w,he=v*Math.cos(Oe*Math.PI/2),Re=b*Math.sin(Oe*Math.PI/2)+_;for(let oe=0,Ue=B.length;oe<Ue;oe++){const Ee=q(B[oe],Q[oe],Re);fe(Ee.x,Ee.y,h+he)}for(let oe=0,Ue=F.length;oe<Ue;oe++){const Ee=F[oe];j=U[oe];for(let Pe=0,Ze=Ee.length;Pe<Ze;Pe++){const ae=q(Ee[Pe],j[Pe],Re);N?fe(ae.x,ae.y+A[d-1].y,A[d-1].x+he):fe(ae.x,ae.y,h+he)}}}re(),ue();function re(){const ye=i.length/3;if(g){let Oe=0,he=K*Oe;for(let Re=0;Re<ie;Re++){const oe=H[Re];we(oe[2]+he,oe[1]+he,oe[0]+he)}Oe=d+w*2,he=K*Oe;for(let Re=0;Re<ie;Re++){const oe=H[Re];we(oe[0]+he,oe[1]+he,oe[2]+he)}}else{for(let Oe=0;Oe<ie;Oe++){const he=H[Oe];we(he[2],he[1],he[0])}for(let Oe=0;Oe<ie;Oe++){const he=H[Oe];we(he[0]+K*d,he[1]+K*d,he[2]+K*d)}}r.addGroup(ye,i.length/3-ye,0)}function ue(){const ye=i.length/3;let Oe=0;le(B,Oe),Oe+=B.length;for(let he=0,Re=F.length;he<Re;he++){const oe=F[he];le(oe,Oe),Oe+=oe.length}r.addGroup(ye,i.length/3-ye,1)}function le(ye,Oe){let he=ye.length;for(;--he>=0;){const Re=he;let oe=he-1;oe<0&&(oe=ye.length-1);for(let Ue=0,Ee=d+w*2;Ue<Ee;Ue++){const Pe=K*Ue,Ze=K*(Ue+1),ae=Oe+Re+Pe,te=Oe+oe+Pe,be=Oe+oe+Ze,me=Oe+Re+Ze;pe(ae,te,be,me)}}}function fe(ye,Oe,he){l.push(ye),l.push(Oe),l.push(he)}function we(ye,Oe,he){xe(ye),xe(Oe),xe(he);const Re=i.length/3,oe=E.generateTopUV(r,i,Re-3,Re-2,Re-1);Ve(oe[0]),Ve(oe[1]),Ve(oe[2])}function pe(ye,Oe,he,Re){xe(ye),xe(Oe),xe(Re),xe(Oe),xe(he),xe(Re);const oe=i.length/3,Ue=E.generateSideWallUV(r,i,oe-6,oe-3,oe-2,oe-1);Ve(Ue[0]),Ve(Ue[1]),Ve(Ue[3]),Ve(Ue[1]),Ve(Ue[2]),Ve(Ue[3])}function xe(ye){i.push(l[ye*3+0]),i.push(l[ye*3+1]),i.push(l[ye*3+2])}function Ve(ye){s.push(ye.x),s.push(ye.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),n=this.parameters.shapes,r=this.parameters.options;return kwe(n,r,e)}static fromJSON(e,n){const r=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=n[e.shapes[s]];r.push(o)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new b5[i.type]().fromJSON(i)),new pE(r,e.options)}}const Rwe={generateTopUV:function(t,e,n,r,i){const s=e[n*3],a=e[n*3+1],o=e[r*3],l=e[r*3+1],c=e[i*3],d=e[i*3+1];return[new zt(s,a),new zt(o,l),new zt(c,d)]},generateSideWallUV:function(t,e,n,r,i,s){const a=e[n*3],o=e[n*3+1],l=e[n*3+2],c=e[r*3],d=e[r*3+1],h=e[r*3+2],g=e[i*3],v=e[i*3+1],b=e[i*3+2],_=e[s*3],w=e[s*3+1],S=e[s*3+2];return Math.abs(o-d)<Math.abs(a-c)?[new zt(a,1-l),new zt(c,1-h),new zt(g,1-b),new zt(_,1-S)]:[new zt(o,1-l),new zt(d,1-h),new zt(v,1-b),new zt(w,1-S)]}};function kwe(t,e,n){if(n.shapes=[],Array.isArray(t))for(let r=0,i=t.length;r<i;r++){const s=t[r];n.shapes.push(s.uuid)}else n.shapes.push(t.uuid);return n.options=Object.assign({},e),e.extrudePath!==void 0&&(n.options.extrudePath=e.extrudePath.toJSON()),n}class mE extends ym{constructor(e=1,n=0){const r=(1+Math.sqrt(5))/2,i=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(i,s,e,n),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new mE(e.radius,e.detail)}}class gE extends br{constructor(e=[new zt(0,-.5),new zt(.5,0),new zt(0,.5)],n=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=sr(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],d=1/n,h=new Fe,g=new zt,v=new Fe,b=new Fe,_=new Fe;let w=0,S=0;for(let E=0;E<=e.length-1;E++)switch(E){case 0:w=e[E+1].x-e[E].x,S=e[E+1].y-e[E].y,v.x=S*1,v.y=-w,v.z=S*0,_.copy(v),v.normalize(),l.push(v.x,v.y,v.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:w=e[E+1].x-e[E].x,S=e[E+1].y-e[E].y,v.x=S*1,v.y=-w,v.z=S*0,b.copy(v),v.x+=_.x,v.y+=_.y,v.z+=_.z,v.normalize(),l.push(v.x,v.y,v.z),_.copy(b)}for(let E=0;E<=n;E++){const A=r+E*d*i,N=Math.sin(A),D=Math.cos(A);for(let P=0;P<=e.length-1;P++){h.x=e[P].x*N,h.y=e[P].y,h.z=e[P].x*D,a.push(h.x,h.y,h.z),g.x=E/n,g.y=P/(e.length-1),o.push(g.x,g.y);const L=l[3*P+0]*N,R=l[3*P+1],O=l[3*P+0]*D;c.push(L,R,O)}}for(let E=0;E<n;E++)for(let A=0;A<e.length-1;A++){const N=A+E*e.length,D=N,P=N+e.length,L=N+e.length+1,R=N+1;s.push(D,P,R),s.push(L,R,P)}this.setIndex(s),this.setAttribute("position",new Cn(a,3)),this.setAttribute("uv",new Cn(o,2)),this.setAttribute("normal",new Cn(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gE(e.points,e.segments,e.phiStart,e.phiLength)}}class Mw extends ym{constructor(e=1,n=0){const r=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(r,i,e,n),this.type="OctahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new Mw(e.radius,e.detail)}}class Mp extends br{constructor(e=1,n=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:i};const s=e/2,a=n/2,o=Math.floor(r),l=Math.floor(i),c=o+1,d=l+1,h=e/o,g=n/l,v=[],b=[],_=[],w=[];for(let S=0;S<d;S++){const E=S*g-a;for(let A=0;A<c;A++){const N=A*h-s;b.push(N,-E,0),_.push(0,0,1),w.push(A/o),w.push(1-S/l)}}for(let S=0;S<l;S++)for(let E=0;E<o;E++){const A=E+c*S,N=E+c*(S+1),D=E+1+c*(S+1),P=E+1+c*S;v.push(A,N,P),v.push(N,D,P)}this.setIndex(v),this.setAttribute("position",new Cn(b,3)),this.setAttribute("normal",new Cn(_,3)),this.setAttribute("uv",new Cn(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Mp(e.width,e.height,e.widthSegments,e.heightSegments)}}class vE extends br{constructor(e=.5,n=1,r=32,i=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:n,thetaSegments:r,phiSegments:i,thetaStart:s,thetaLength:a},r=Math.max(3,r),i=Math.max(1,i);const o=[],l=[],c=[],d=[];let h=e;const g=(n-e)/i,v=new Fe,b=new zt;for(let _=0;_<=i;_++){for(let w=0;w<=r;w++){const S=s+w/r*a;v.x=h*Math.cos(S),v.y=h*Math.sin(S),l.push(v.x,v.y,v.z),c.push(0,0,1),b.x=(v.x/n+1)/2,b.y=(v.y/n+1)/2,d.push(b.x,b.y)}h+=g}for(let _=0;_<i;_++){const w=_*(r+1);for(let S=0;S<r;S++){const E=S+w,A=E,N=E+r+1,D=E+r+2,P=E+1;o.push(A,N,P),o.push(N,D,P)}}this.setIndex(o),this.setAttribute("position",new Cn(l,3)),this.setAttribute("normal",new Cn(c,3)),this.setAttribute("uv",new Cn(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vE(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class xE extends br{constructor(e=new $0([new zt(0,.5),new zt(-.5,-.5),new zt(.5,-.5)]),n=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:n};const r=[],i=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let d=0;d<e.length;d++)c(e[d]),this.addGroup(o,l,d),o+=l,l=0;this.setIndex(r),this.setAttribute("position",new Cn(i,3)),this.setAttribute("normal",new Cn(s,3)),this.setAttribute("uv",new Cn(a,2));function c(d){const h=i.length/3,g=d.extractPoints(n);let v=g.shape;const b=g.holes;Ud.isClockWise(v)===!1&&(v=v.reverse());for(let w=0,S=b.length;w<S;w++){const E=b[w];Ud.isClockWise(E)===!0&&(b[w]=E.reverse())}const _=Ud.triangulateShape(v,b);for(let w=0,S=b.length;w<S;w++){const E=b[w];v=v.concat(E)}for(let w=0,S=v.length;w<S;w++){const E=v[w];i.push(E.x,E.y,0),s.push(0,0,1),a.push(E.x,E.y)}for(let w=0,S=_.length;w<S;w++){const E=_[w],A=E[0]+h,N=E[1]+h,D=E[2]+h;r.push(A,N,D),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),n=this.parameters.shapes;return Pwe(n,e)}static fromJSON(e,n){const r=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=n[e.shapes[i]];r.push(a)}return new xE(r,e.curveSegments)}}function Pwe(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,r=t.length;n<r;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}class Tw extends br{constructor(e=1,n=32,r=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));const l=Math.min(a+o,Math.PI);let c=0;const d=[],h=new Fe,g=new Fe,v=[],b=[],_=[],w=[];for(let S=0;S<=r;S++){const E=[],A=S/r;let N=0;S===0&&a===0?N=.5/n:S===r&&l===Math.PI&&(N=-.5/n);for(let D=0;D<=n;D++){const P=D/n;h.x=-e*Math.cos(i+P*s)*Math.sin(a+A*o),h.y=e*Math.cos(a+A*o),h.z=e*Math.sin(i+P*s)*Math.sin(a+A*o),b.push(h.x,h.y,h.z),g.copy(h).normalize(),_.push(g.x,g.y,g.z),w.push(P+N,1-A),E.push(c++)}d.push(E)}for(let S=0;S<r;S++)for(let E=0;E<n;E++){const A=d[S][E+1],N=d[S][E],D=d[S+1][E],P=d[S+1][E+1];(S!==0||a>0)&&v.push(A,N,P),(S!==r-1||l<Math.PI)&&v.push(N,D,P)}this.setIndex(v),this.setAttribute("position",new Cn(b,3)),this.setAttribute("normal",new Cn(_,3)),this.setAttribute("uv",new Cn(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Tw(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class yE extends ym{constructor(e=1,n=0){const r=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];super(r,i,e,n),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new yE(e.radius,e.detail)}}class bE extends br{constructor(e=1,n=.4,r=12,i=48,s=Math.PI*2,a=0,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:n,radialSegments:r,tubularSegments:i,arc:s,thetaStart:a,thetaLength:o},r=Math.floor(r),i=Math.floor(i);const l=[],c=[],d=[],h=[],g=new Fe,v=new Fe,b=new Fe;for(let _=0;_<=r;_++){const w=a+_/r*o;for(let S=0;S<=i;S++){const E=S/i*s;v.x=(e+n*Math.cos(w))*Math.cos(E),v.y=(e+n*Math.cos(w))*Math.sin(E),v.z=n*Math.sin(w),c.push(v.x,v.y,v.z),g.x=e*Math.cos(E),g.y=e*Math.sin(E),b.subVectors(v,g).normalize(),d.push(b.x,b.y,b.z),h.push(S/i),h.push(_/r)}}for(let _=1;_<=r;_++)for(let w=1;w<=i;w++){const S=(i+1)*_+w-1,E=(i+1)*(_-1)+w-1,A=(i+1)*(_-1)+w,N=(i+1)*_+w;l.push(S,E,N),l.push(E,A,N)}this.setIndex(l),this.setAttribute("position",new Cn(c,3)),this.setAttribute("normal",new Cn(d,3)),this.setAttribute("uv",new Cn(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bE(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class _E extends br{constructor(e=1,n=.4,r=64,i=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:n,tubularSegments:r,radialSegments:i,p:s,q:a},r=Math.floor(r),i=Math.floor(i);const o=[],l=[],c=[],d=[],h=new Fe,g=new Fe,v=new Fe,b=new Fe,_=new Fe,w=new Fe,S=new Fe;for(let A=0;A<=r;++A){const N=A/r*s*Math.PI*2;E(N,s,a,e,v),E(N+.01,s,a,e,b),w.subVectors(b,v),S.addVectors(b,v),_.crossVectors(w,S),S.crossVectors(_,w),_.normalize(),S.normalize();for(let D=0;D<=i;++D){const P=D/i*Math.PI*2,L=-n*Math.cos(P),R=n*Math.sin(P);h.x=v.x+(L*S.x+R*_.x),h.y=v.y+(L*S.y+R*_.y),h.z=v.z+(L*S.z+R*_.z),l.push(h.x,h.y,h.z),g.subVectors(h,v).normalize(),c.push(g.x,g.y,g.z),d.push(A/r),d.push(D/i)}}for(let A=1;A<=r;A++)for(let N=1;N<=i;N++){const D=(i+1)*(A-1)+(N-1),P=(i+1)*A+(N-1),L=(i+1)*A+N,R=(i+1)*(A-1)+N;o.push(D,P,R),o.push(P,L,R)}this.setIndex(o),this.setAttribute("position",new Cn(l,3)),this.setAttribute("normal",new Cn(c,3)),this.setAttribute("uv",new Cn(d,2));function E(A,N,D,P,L){const R=Math.cos(A),O=Math.sin(A),W=D/N*A,F=Math.cos(W);L.x=P*(2+F)*.5*R,L.y=P*(2+F)*O*.5,L.z=P*Math.sin(W)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _E(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class SE extends br{constructor(e=new h9(new Fe(-1,-1,0),new Fe(-1,1,0),new Fe(1,1,0)),n=64,r=1,i=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:n,radius:r,radialSegments:i,closed:s};const a=e.computeFrenetFrames(n,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new Fe,l=new Fe,c=new zt;let d=new Fe;const h=[],g=[],v=[],b=[];_(),this.setIndex(b),this.setAttribute("position",new Cn(h,3)),this.setAttribute("normal",new Cn(g,3)),this.setAttribute("uv",new Cn(v,2));function _(){for(let A=0;A<n;A++)w(A);w(s===!1?n:0),E(),S()}function w(A){d=e.getPointAt(A/n,d);const N=a.normals[A],D=a.binormals[A];for(let P=0;P<=i;P++){const L=P/i*Math.PI*2,R=Math.sin(L),O=-Math.cos(L);l.x=O*N.x+R*D.x,l.y=O*N.y+R*D.y,l.z=O*N.z+R*D.z,l.normalize(),g.push(l.x,l.y,l.z),o.x=d.x+r*l.x,o.y=d.y+r*l.y,o.z=d.z+r*l.z,h.push(o.x,o.y,o.z)}}function S(){for(let A=1;A<=n;A++)for(let N=1;N<=i;N++){const D=(i+1)*(A-1)+(N-1),P=(i+1)*A+(N-1),L=(i+1)*A+N,R=(i+1)*(A-1)+N;b.push(D,P,R),b.push(P,L,R)}}function E(){for(let A=0;A<=n;A++)for(let N=0;N<=i;N++)c.x=A/n,c.y=N/i,v.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new SE(new b5[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class m9 extends br{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,i=new Fe,s=new Fe;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,d=l.length;c<d;++c){const h=l[c],g=h.start,v=h.count;for(let b=g,_=g+v;b<_;b+=3)for(let w=0;w<3;w++){const S=o.getX(b+w),E=o.getX(b+(w+1)%3);i.fromBufferAttribute(a,S),s.fromBufferAttribute(a,E),Oz(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const d=3*o+c,h=3*o+(c+1)%3;i.fromBufferAttribute(a,d),s.fromBufferAttribute(a,h),Oz(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}this.setAttribute("position",new Cn(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Oz(t,e,n){const r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return n.has(r)===!0||n.has(i)===!0?!1:(n.add(r),n.add(i),!0)}var Lz=Object.freeze({__proto__:null,BoxGeometry:Cv,CapsuleGeometry:uE,CircleGeometry:dE,ConeGeometry:ww,CylinderGeometry:Sw,DodecahedronGeometry:fE,EdgesGeometry:l9,ExtrudeGeometry:pE,IcosahedronGeometry:mE,LatheGeometry:gE,OctahedronGeometry:Mw,PlaneGeometry:Mp,PolyhedronGeometry:ym,RingGeometry:vE,ShapeGeometry:xE,SphereGeometry:Tw,TetrahedronGeometry:yE,TorusGeometry:bE,TorusKnotGeometry:_E,TubeGeometry:SE,WireframeGeometry:m9});class CY extends vl{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new xn(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}function ly(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(hn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function Il(t){const e={};for(let n=0;n<t.length;n++){const r=ly(t[n]);for(const i in r)e[i]=r[i]}return e}function Iwe(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function AY(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:ii.workingColorSpace}const NS={clone:ly,merge:Il};var Dwe=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,Owe=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class au extends vl{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Dwe,this.fragmentShader=Owe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ly(e.uniforms),this.uniformsGroups=Iwe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?n.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?n.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?n.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?n.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?n.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?n.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?n.uniforms[i]={type:"m4",value:a.toArray()}:n.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class g9 extends au{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class v9 extends vl{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new xn(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xm,this.normalScale=new zt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new su,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class NY extends v9{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new zt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return sr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(n){this.ior=(1+.4*n)/(1-.4*n)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new xn(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new xn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xn(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class RY extends vl{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new xn(16777215),this.specular=new xn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xm,this.normalScale=new zt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new su,this.combine=yw,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class kY extends vl{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xm,this.normalScale=new zt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class PY extends vl{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xm,this.normalScale=new zt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class IY extends vl{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new xn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xm,this.normalScale=new zt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new su,this.combine=yw,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class wE extends vl{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=qX,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class ME extends vl{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class DY extends vl{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=xm,this.normalScale=new zt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class OY extends $l{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Og(t,e){return!t||t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function LY(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function WR(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,a=0;a!==r;++s){const o=n[s]*e;for(let l=0;l!==e;++l)i[a++]=t[o+l]}return i}function x9(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[i++];if(s===void 0)return;let a=s[r];if(a!==void 0)if(Array.isArray(a))do a=s[r],a!==void 0&&(e.push(s.time),n.push(...a)),s=t[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[r],a!==void 0&&(e.push(s.time),a.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do a=s[r],a!==void 0&&(e.push(s.time),n.push(a)),s=t[i++];while(s!==void 0)}function Lwe(t,e,n,r,i=30){const s=t.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],d=c.getValueSize(),h=[],g=[];for(let v=0;v<c.times.length;++v){const b=c.times[v]*i;if(!(b<n||b>=r)){h.push(c.times[v]);for(let _=0;_<d;++_)g.push(c.values[v*d+_])}}h.length!==0&&(c.times=Og(h,c.times.constructor),c.values=Og(g,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function zwe(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,s=e/r;for(let a=0;a<i;++a){const o=n.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=t.tracks.find(function(S){return S.name===o.name&&S.ValueTypeName===l});if(c===void 0)continue;let d=0;const h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=h/3);let g=0;const v=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(g=v/3);const b=o.times.length-1;let _;if(s<=o.times[0]){const S=d,E=h-d;_=o.values.slice(S,E)}else if(s>=o.times[b]){const S=b*h+d,E=S+h-d;_=o.values.slice(S,E)}else{const S=o.createInterpolant(),E=d,A=h-d;S.evaluate(s),_=S.resultBuffer.slice(E,A)}l==="quaternion"&&new Bo().fromArray(_).normalize().conjugate().toArray(_);const w=c.times.length;for(let S=0;S<w;++S){const E=S*v+g;if(l==="quaternion")Bo.multiplyQuaternionsFlat(c.values,E,_,0,c.values,E);else{const A=v-g*2;for(let N=0;N<A;++N)c.values[E+N]-=_[N]}}}return t.blendMode=Qk,t}class jwe{static convertArray(e,n){return Og(e,n)}static isTypedArray(e){return nY(e)}static getKeyframeOrder(e){return LY(e)}static sortedArray(e,n,r){return WR(e,n,r)}static flattenJSON(e,n,r,i){x9(e,n,r,i)}static subclip(e,n,r,i,s=30){return Lwe(e,n,r,i,s)}static makeClipAdditive(e,n=0,r=e,i=30){return zwe(e,n,r,i)}}class Iy{constructor(e,n,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new n.constructor(r),this.sampleValues=n,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const n=this.parameterPositions;let r=this._cachedIndex,i=n[r],s=n[r-1];e:{t:{let a;n:{r:if(!(e<i)){for(let o=r+2;;){if(i===void 0){if(e<s)break r;return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===o)break;if(s=i,i=n[++r],e<i)break t}a=n.length;break n}if(!(e>=s)){const o=n[1];e<o&&(r=2,s=o);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===l)break;if(i=s,s=n[--r-1],e>=s)break t}a=r,r=0;break n}break e}for(;r<a;){const o=r+a>>>1;e<n[o]?a=o:r=o+1}if(i=n[r],s=n[r-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}this._cachedIndex=r,this.intervalChanged_(r,s,i)}return this.interpolate_(r,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const n=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)n[a]=r[s+a];return n}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class zY extends Iy{constructor(e,n,r,i){super(e,n,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ig,endingEnd:Ig}}intervalChanged_(e,n,r){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],l=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Dg:s=e,o=2*n-r;break;case bS:s=i.length-2,o=n+i[s]-i[s+1];break;default:s=e,o=r}if(l===void 0)switch(this.getSettings_().endingEnd){case Dg:a=e,l=2*r-n;break;case bS:a=1,l=r+i[1]-i[0];break;default:a=e-1,l=n}const c=(r-n)*.5,d=this.valueSize;this._weightPrev=c/(n-o),this._weightNext=c/(l-r),this._offsetPrev=s*d,this._offsetNext=a*d}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,d=this._offsetPrev,h=this._offsetNext,g=this._weightPrev,v=this._weightNext,b=(r-n)/(i-n),_=b*b,w=_*b,S=-g*w+2*g*_-g*b,E=(1+g)*w+(-1.5-2*g)*_+(-.5+g)*b+1,A=(-1-v)*w+(1.5+v)*_+.5*b,N=v*w-v*_;for(let D=0;D!==o;++D)s[D]=S*a[d+D]+E*a[c+D]+A*a[l+D]+N*a[h+D];return s}}class y9 extends Iy{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,d=(r-n)/(i-n),h=1-d;for(let g=0;g!==o;++g)s[g]=a[c+g]*h+a[l+g]*d;return s}}class jY extends Iy{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class FY extends Iy{interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,d=this.settings||this.DefaultSettings_,h=d.inTangents,g=d.outTangents;if(!h||!g){const _=(r-n)/(i-n),w=1-_;for(let S=0;S!==o;++S)s[S]=a[c+S]*w+a[l+S]*_;return s}const v=o*2,b=e-1;for(let _=0;_!==o;++_){const w=a[c+_],S=a[l+_],E=b*v+_*2,A=g[E],N=g[E+1],D=e*v+_*2,P=h[D],L=h[D+1];let R=(r-n)/(i-n),O,W,F,V,G;for(let Z=0;Z<8;Z++){O=R*R,W=O*R,F=1-R,V=F*F,G=V*F;const q=G*n+3*V*R*A+3*F*O*P+W*i-r;if(Math.abs(q)<1e-10)break;const K=3*V*(A-n)+6*F*R*(P-A)+3*O*(i-P);if(Math.abs(K)<1e-10)break;R=R-q/K,R=Math.max(0,Math.min(1,R))}s[_]=G*w+3*V*R*N+3*F*O*L+W*S}return s}}class td{constructor(e,n,r,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(n===void 0||n.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Og(n,this.TimeBufferType),this.values=Og(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const n=e.constructor;let r;if(n.toJSON!==this.toJSON)r=n.toJSON(e);else{r={name:e.name,times:Og(e.times,Array),values:Og(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new jY(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new y9(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new zY(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const n=new FY(this.times,this.values,this.getValueSize(),e);return this.settings&&(n.settings=this.settings),n}setInterpolation(e){let n;switch(e){case yS:n=this.InterpolantFactoryMethodDiscrete;break;case v5:n=this.InterpolantFactoryMethodLinear;break;case UM:n=this.InterpolantFactoryMethodSmooth;break;case FR:n=this.InterpolantFactoryMethodBezier;break}if(n===void 0){const r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return hn("KeyframeTrack:",r),this}return this.createInterpolant=n,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return yS;case this.InterpolantFactoryMethodLinear:return v5;case this.InterpolantFactoryMethodSmooth:return UM;case this.InterpolantFactoryMethodBezier:return FR}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]+=e}return this}scale(e){if(e!==1){const n=this.times;for(let r=0,i=n.length;r!==i;++r)n[r]*=e}return this}trim(e,n){const r=this.times,i=r.length;let s=0,a=i-1;for(;s!==i&&r[s]<e;)++s;for(;a!==-1&&r[a]>n;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=r.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(Hn("KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(Hn("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=r[o];if(typeof l=="number"&&isNaN(l)){Hn("KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){Hn("KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&nY(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){Hn("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===UM,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],d=e[o+1];if(c!==d&&(o!==1||c!==e[0]))if(i)l=!0;else{const h=o*r,g=h-r,v=h+r;for(let b=0;b!==r;++b){const _=n[h+b];if(_!==n[g+b]||_!==n[v+b]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const h=o*r,g=a*r;for(let v=0;v!==r;++v)n[g+v]=n[h+v]}++a}}if(s>0){e[a]=e[s];for(let o=s*r,l=a*r,c=0;c!==r;++c)n[l+c]=n[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=n.slice(0,a*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}td.prototype.ValueTypeName="";td.prototype.TimeBufferType=Float32Array;td.prototype.ValueBufferType=Float32Array;td.prototype.DefaultInterpolation=v5;class Av extends td{constructor(e,n,r){super(e,n,r)}}Av.prototype.ValueTypeName="bool";Av.prototype.ValueBufferType=Array;Av.prototype.DefaultInterpolation=yS;Av.prototype.InterpolantFactoryMethodLinear=void 0;Av.prototype.InterpolantFactoryMethodSmooth=void 0;class b9 extends td{constructor(e,n,r,i){super(e,n,r,i)}}b9.prototype.ValueTypeName="color";class RS extends td{constructor(e,n,r,i){super(e,n,r,i)}}RS.prototype.ValueTypeName="number";class UY extends Iy{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(r-n)/(i-n);let c=e*o;for(let d=c+o;c!==d;c+=4)Bo.slerpFlat(s,0,a,c-o,a,c,l);return s}}class Ew extends td{constructor(e,n,r,i){super(e,n,r,i)}InterpolantFactoryMethodLinear(e){return new UY(this.times,this.values,this.getValueSize(),e)}}Ew.prototype.ValueTypeName="quaternion";Ew.prototype.InterpolantFactoryMethodSmooth=void 0;class Nv extends td{constructor(e,n,r){super(e,n,r)}}Nv.prototype.ValueTypeName="string";Nv.prototype.ValueBufferType=Array;Nv.prototype.DefaultInterpolation=yS;Nv.prototype.InterpolantFactoryMethodLinear=void 0;Nv.prototype.InterpolantFactoryMethodSmooth=void 0;class kS extends td{constructor(e,n,r,i){super(e,n,r,i)}}kS.prototype.ValueTypeName="vector";class PS{constructor(e="",n=-1,r=[],i=JT){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=ru(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let a=0,o=r.length;a!==o;++a)n.push(Uwe(r[a]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=r.length;s!==a;++s)n.push(td.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const d=LY(l);l=WR(l,1,d),c=WR(c,1,d),!i&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new RS(".morphTargetInfluences["+n[o].name+"]",l,c).scale(1/r))}return new this(e,-1,a)}static findByName(e,n){let r=e;if(!Array.isArray(e)){const i=e;r=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<r.length;i++)if(r[i].name===n)return r[i];return null}static CreateClipsFromMorphTargetSequences(e,n,r){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],d=c.name.match(s);if(d&&d.length>1){const h=d[1];let g=i[h];g||(i[h]=g=[]),g.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],n,r));return a}static parseAnimation(e,n){if(hn("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Hn("AnimationClip: No animation in JSONLoader data."),null;const r=function(h,g,v,b,_){if(v.length!==0){const w=[],S=[];x9(v,w,S,b),w.length!==0&&_.push(new h(g,w,S))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const g=c[h].keys;if(!(!g||g.length===0))if(g[0].morphTargets){const v={};let b;for(b=0;b<g.length;b++)if(g[b].morphTargets)for(let _=0;_<g[b].morphTargets.length;_++)v[g[b].morphTargets[_]]=-1;for(const _ in v){const w=[],S=[];for(let E=0;E!==g[b].morphTargets.length;++E){const A=g[b];w.push(A.time),S.push(A.morphTarget===_?1:0)}i.push(new RS(".morphTargetInfluence["+_+"]",w,S))}l=v.length*a}else{const v=".bones["+n[h].name+"]";r(kS,v+".position",g,"pos",i),r(Ew,v+".quaternion",g,"rot",i),r(kS,v+".scale",g,"scl",i)}}return i.length===0?null:new this(s,l,i,o)}resetDuration(){const e=this.tracks;let n=0;for(let r=0,i=e.length;r!==i;++r){const s=this.tracks[r];n=Math.max(n,s.times[s.times.length-1])}return this.duration=n,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let n=0;n<this.tracks.length;n++)e=e&&this.tracks[n].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let r=0;r<this.tracks.length;r++)e.push(this.tracks[r].clone());const n=new this.constructor(this.name,this.duration,e,this.blendMode);return n.userData=JSON.parse(JSON.stringify(this.userData)),n}toJSON(){return this.constructor.toJSON(this)}}function Fwe(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return RS;case"vector":case"vector2":case"vector3":case"vector4":return kS;case"color":return b9;case"quaternion":return Ew;case"bool":case"boolean":return Av;case"string":return Nv}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function Uwe(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Fwe(t.type);if(t.times===void 0){const n=[],r=[];x9(t.keys,n,r,"value"),t.times=n,t.values=r}return e.parse!==void 0?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Zf={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(zz(t)||(this.files[t]=e))},get:function(t){if(this.enabled!==!1&&!zz(t))return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function zz(t){try{const e=t.slice(t.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class _9{constructor(e,n,r){const i=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=r,this._abortController=null,this.itemStart=function(d){o++,s===!1&&i.onStart!==void 0&&i.onStart(d,a,o),s=!0},this.itemEnd=function(d){a++,i.onProgress!==void 0&&i.onProgress(d,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(d){i.onError!==void 0&&i.onError(d)},this.resolveURL=function(d){return l?l(d):d},this.setURLModifier=function(d){return l=d,this},this.addHandler=function(d,h){return c.push(d,h),this},this.removeHandler=function(d){const h=c.indexOf(d);return h!==-1&&c.splice(h,2),this},this.getHandler=function(d){for(let h=0,g=c.length;h<g;h+=2){const v=c[h],b=c[h+1];if(v.global&&(v.lastIndex=0),v.test(d))return b}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const BY=new _9;class Rc{constructor(e){this.manager=e!==void 0?e:BY,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,n){const r=this;return new Promise(function(i,s){r.load(e,i,n,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}Rc.DEFAULT_MATERIAL_NAME="__DEFAULT";const Yh={};class Bwe extends Error{constructor(e,n){super(e),this.response=n}}class vp extends Rc{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Zf.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(Yh[e]!==void 0){Yh[e].push({onLoad:n,onProgress:r,onError:i});return}Yh[e]=[],Yh[e].push({onLoad:n,onProgress:r,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&hn("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Yh[e],h=c.body.getReader(),g=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),v=g?parseInt(g):0,b=v!==0;let _=0;const w=new ReadableStream({start(S){E();function E(){h.read().then(({done:A,value:N})=>{if(A)S.close();else{_+=N.byteLength;const D=new ProgressEvent("progress",{lengthComputable:b,loaded:_,total:v});for(let P=0,L=d.length;P<L;P++){const R=d[P];R.onProgress&&R.onProgress(D)}S.enqueue(N),E()}},A=>{S.error(A)})}}});return new Response(w)}else throw new Bwe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,o));case"json":return c.json();default:if(o==="")return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),g=h&&h[1]?h[1].toLowerCase():void 0,v=new TextDecoder(g);return c.arrayBuffer().then(b=>v.decode(b))}}}).then(c=>{Zf.add(`file:${e}`,c);const d=Yh[e];delete Yh[e];for(let h=0,g=d.length;h<g;h++){const v=d[h];v.onLoad&&v.onLoad(c)}}).catch(c=>{const d=Yh[e];if(d===void 0)throw this.manager.itemError(e),c;delete Yh[e];for(let h=0,g=d.length;h<g;h++){const v=d[h];v.onError&&v.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class Hwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new vp(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}catch(l){i?i(l):Hn(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r<e.length;r++){const i=PS.parse(e[r]);n.push(i)}return n}}class Vwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=[],o=new cE,l=new vp(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function d(h){l.load(e[h],function(g){const v=s.parse(g,!0);a[h]={width:v.width,height:v.height,format:v.format,mipmaps:v.mipmaps},c+=1,c===6&&(v.mipmapCount===1&&(o.minFilter=rs),o.image=a,o.format=v.format,o.needsUpdate=!0,n&&n(o))},r,i)}if(Array.isArray(e))for(let h=0,g=e.length;h<g;++h)d(h);else l.load(e,function(h){const g=s.parse(h,!0);if(g.isCubemap){const v=g.mipmaps.length/g.mipmapCount;for(let b=0;b<v;b++){a[b]={mipmaps:[]};for(let _=0;_<g.mipmapCount;_++)a[b].mipmaps.push(g.mipmaps[b*g.mipmapCount+_]),a[b].format=g.format,a[b].width=g.width,a[b].height=g.height}o.image=a}else o.image.width=g.width,o.image.height=g.height,o.mipmaps=g.mipmaps;g.mipmapCount===1&&(o.minFilter=rs),o.format=g.format,o.needsUpdate=!0,n&&n(o)},r,i);return o}}const Gx=new WeakMap;class IS extends Rc{constructor(e){super(e)}load(e,n,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Zf.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){n&&n(a),s.manager.itemEnd(e)},0);else{let h=Gx.get(a);h===void 0&&(h=[],Gx.set(a,h)),h.push({onLoad:n,onError:i})}return a}const o=wS("img");function l(){d(),n&&n(this);const h=Gx.get(this)||[];for(let g=0;g<h.length;g++){const v=h[g];v.onLoad&&v.onLoad(this)}Gx.delete(this),s.manager.itemEnd(e)}function c(h){d(),i&&i(h),Zf.remove(`image:${e}`);const g=Gx.get(this)||[];for(let v=0;v<g.length;v++){const b=g[v];b.onError&&b.onError(h)}Gx.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Zf.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class Gwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=new _w;s.colorSpace=cl;const a=new IS(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(d){s.images[c]=d,o++,o===6&&(s.needsUpdate=!0,n&&n(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class Wwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new Bd,o=new vp(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(d){if(i!==void 0)i(d);else{d(d);return}}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:Tc,a.wrapT=c.wrapT!==void 0?c.wrapT:Tc,a.magFilter=c.magFilter!==void 0?c.magFilter:rs,a.minFilter=c.minFilter!==void 0?c.minFilter:rs,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=Kf),c.mipmapCount===1&&(a.minFilter=rs),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,n&&n(a,c)},r,i),a}}class $we extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=new ra,a=new IS(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,n!==void 0&&n(s)},r,i),s}}class bm extends yi{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new xn(e),this.intensity=n}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,n}}class HY extends bm{constructor(e,n,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(yi.DEFAULT_UP),this.updateMatrix(),this.groundColor=new xn(n)}copy(e,n){return super.copy(e,n),this.groundColor.copy(e.groundColor),this}toJSON(e){const n=super.toJSON(e);return n.object.groundColor=this.groundColor.getHex(),n}}const m6=new rr,jz=new Fe,Fz=new Fe;class S9{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new zt(512,512),this.mapType=zl,this.map=null,this.mapPass=null,this.matrix=new rr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Py,this._frameExtents=new zt(1,1),this._viewportCount=1,this._viewports=[new ci(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;jz.setFromMatrixPosition(e.matrixWorld),n.position.copy(jz),Fz.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(Fz),n.updateMatrixWorld(),m6.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(m6,n.coordinateSystem,n.reversedDepth),n.coordinateSystem===uv||n.reversedDepth?r.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(m6)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const aM=new Fe,oM=new Bo,Nf=new Fe;class TE extends yi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new rr,this.projectionMatrix=new rr,this.projectionMatrixInverse=new rr,this.coordinateSystem=Zc,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(aM,oM,Nf),Nf.x===1&&Nf.y===1&&Nf.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aM,oM,Nf.set(1,1,1)).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorld.decompose(aM,oM,Nf),Nf.x===1&&Nf.y===1&&Nf.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(aM,oM,Nf.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const b0=new Fe,Uz=new zt,Bz=new zt;class ea extends TE{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=iy*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Xg*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return iy*2*Math.atan(Math.tan(Xg*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){b0.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(b0.x,b0.y).multiplyScalar(-e/b0.z),b0.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(b0.x,b0.y).multiplyScalar(-e/b0.z)}getViewSize(e,n){return this.getViewBounds(e,Uz,Bz),n.subVectors(Bz,Uz)}setViewOffset(e,n,r,i,s,a){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Xg*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,n-=a.offsetY*r/c,i*=a.width/l,r*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}class qwe extends S9{constructor(){super(new ea(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const n=this.camera,r=iy*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||n.far;(r!==n.fov||i!==n.aspect||s!==n.far)&&(n.fov=r,n.aspect=i,n.far=s,n.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class VY extends bm{constructor(e,n,r=0,i=Math.PI/3,s=0,a=2){super(e,n),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(yi.DEFAULT_UP),this.updateMatrix(),this.target=new yi,this.distance=r,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new qwe}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const n=super.toJSON(e);return n.object.distance=this.distance,n.object.angle=this.angle,n.object.decay=this.decay,n.object.penumbra=this.penumbra,n.object.target=this.target.uuid,this.map&&this.map.isTexture&&(n.object.map=this.map.toJSON(e).uuid),n.object.shadow=this.shadow.toJSON(),n}}class Xwe extends S9{constructor(){super(new ea(90,1,.5,500)),this.isPointLightShadow=!0}}class GY extends bm{constructor(e,n,r=0,i=2){super(e,n),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new Xwe}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,n){return super.copy(e,n),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const n=super.toJSON(e);return n.object.distance=this.distance,n.object.decay=this.decay,n.object.shadow=this.shadow.toJSON(),n}}class Hd extends TE{constructor(e=-1,n=1,r=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,a=r+e,o=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}class Ywe extends S9{constructor(){super(new Hd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class WY extends bm{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(yi.DEFAULT_UP),this.updateMatrix(),this.target=new yi,this.shadow=new Ywe}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const n=super.toJSON(e);return n.object.shadow=this.shadow.toJSON(),n.object.target=this.target.uuid,n}}class $Y extends bm{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class qY extends bm{constructor(e,n,r=10,i=10){super(e,n),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=r,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const n=super.toJSON(e);return n.object.width=this.width,n.object.height=this.height,n}}class w9{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Fe)}set(e){for(let n=0;n<9;n++)this.coefficients[n].copy(e[n]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,n){const r=e.x,i=e.y,s=e.z,a=this.coefficients;return n.copy(a[0]).multiplyScalar(.282095),n.addScaledVector(a[1],.488603*i),n.addScaledVector(a[2],.488603*s),n.addScaledVector(a[3],.488603*r),n.addScaledVector(a[4],1.092548*(r*i)),n.addScaledVector(a[5],1.092548*(i*s)),n.addScaledVector(a[6],.315392*(3*s*s-1)),n.addScaledVector(a[7],1.092548*(r*s)),n.addScaledVector(a[8],.546274*(r*r-i*i)),n}getIrradianceAt(e,n){const r=e.x,i=e.y,s=e.z,a=this.coefficients;return n.copy(a[0]).multiplyScalar(.886227),n.addScaledVector(a[1],2*.511664*i),n.addScaledVector(a[2],2*.511664*s),n.addScaledVector(a[3],2*.511664*r),n.addScaledVector(a[4],2*.429043*r*i),n.addScaledVector(a[5],2*.429043*i*s),n.addScaledVector(a[6],.743125*s*s-.247708),n.addScaledVector(a[7],2*.429043*r*s),n.addScaledVector(a[8],.429043*(r*r-i*i)),n}add(e){for(let n=0;n<9;n++)this.coefficients[n].add(e.coefficients[n]);return this}addScaledSH(e,n){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],n);return this}scale(e){for(let n=0;n<9;n++)this.coefficients[n].multiplyScalar(e);return this}lerp(e,n){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],n);return this}equals(e){for(let n=0;n<9;n++)if(!this.coefficients[n].equals(e.coefficients[n]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,n=0){const r=this.coefficients;for(let i=0;i<9;i++)r[i].fromArray(e,n+i*3);return this}toArray(e=[],n=0){const r=this.coefficients;for(let i=0;i<9;i++)r[i].toArray(e,n+i*3);return e}static getBasisAt(e,n){const r=e.x,i=e.y,s=e.z;n[0]=.282095,n[1]=.488603*i,n[2]=.488603*s,n[3]=.488603*r,n[4]=1.092548*r*i,n[5]=1.092548*i*s,n[6]=.315392*(3*s*s-1),n[7]=1.092548*r*s,n[8]=.546274*(r*r-i*i)}}class XY extends bm{constructor(e=new w9,n=1){super(void 0,n),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const n=super.toJSON(e);return n.object.sh=this.sh.toArray(),n}}class EE extends Rc{constructor(e){super(e),this.textures={}}load(e,n,r,i){const s=this,a=new vp(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}catch(l){i?i(l):Hn(l),s.manager.itemError(e)}},r,i)}parse(e){const n=this.textures;function r(s){return n[s]===void 0&&hn("MaterialLoader: Undefined texture",s),n[s]}const i=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.sheen!==void 0&&(i.sheen=e.sheen),e.sheenColor!==void 0&&(i.sheenColor=new xn().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(i.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&i.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular!==void 0&&i.specular.setHex(e.specular),e.specularIntensity!==void 0&&(i.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&i.specularColor!==void 0&&i.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearcoat!==void 0&&(i.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(i.dispersion=e.dispersion),e.iridescence!==void 0&&(i.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(i.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(i.transmission=e.transmission),e.thickness!==void 0&&(i.thickness=e.thickness),e.attenuationDistance!==void 0&&(i.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&i.attenuationColor!==void 0&&i.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(i.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(i.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.shadowSide!==void 0&&(i.shadowSide=e.shadowSide),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(i.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(i.depthFunc=e.depthFunc),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(i.blendSrc=e.blendSrc),e.blendDst!==void 0&&(i.blendDst=e.blendDst),e.blendEquation!==void 0&&(i.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(i.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(i.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(i.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&i.blendColor!==void 0&&i.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(i.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(i.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(i.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(i.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(i.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(i.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(i.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(i.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(i.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==void 0&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(i.dithering=e.dithering),e.alphaToCoverage!==void 0&&(i.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(i.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(i.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(i.allowOverride=e.allowOverride),e.visible!==void 0&&(i.visible=e.visible),e.toneMapped!==void 0&&(i.toneMapped=e.toneMapped),e.userData!==void 0&&(i.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=r(a.value);break;case"c":i.uniforms[s].value=new xn().setHex(a.value);break;case"v2":i.uniforms[s].value=new zt().fromArray(a.value);break;case"v3":i.uniforms[s].value=new Fe().fromArray(a.value);break;case"v4":i.uniforms[s].value=new ci().fromArray(a.value);break;case"m3":i.uniforms[s].value=new yr().fromArray(a.value);break;case"m4":i.uniforms[s].value=new rr().fromArray(a.value);break;default:i.uniforms[s].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new zt().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new zt().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return EE.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:CY,SpriteMaterial:i9,RawShaderMaterial:g9,ShaderMaterial:au,PointsMaterial:a9,MeshPhysicalMaterial:NY,MeshStandardMaterial:v9,MeshPhongMaterial:RY,MeshToonMaterial:kY,MeshNormalMaterial:PY,MeshLambertMaterial:IY,MeshDepthMaterial:wE,MeshDistanceMaterial:ME,MeshBasicMaterial:wp,MeshMatcapMaterial:DY,LineDashedMaterial:OY,LineBasicMaterial:$l,Material:vl};return new n[e]}}class $R{static extractUrlBase(e){const n=e.lastIndexOf("/");return n===-1?"./":e.slice(0,n+1)}static resolveURL(e,n){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(n)&&/^\//.test(e)&&(n=n.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:n+e)}}class CE extends br{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class YY extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new vp(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}catch(l){i?i(l):Hn(l),s.manager.itemError(e)}},r,i)}parse(e){const n={},r={};function i(v,b){if(n[b]!==void 0)return n[b];const w=v.interleavedBuffers[b],S=s(v,w.buffer),E=s1(w.type,S),A=new aE(E,w.stride);return A.uuid=w.uuid,n[b]=A,A}function s(v,b){if(r[b]!==void 0)return r[b];const w=v.arrayBuffers[b],S=new Uint32Array(w).buffer;return r[b]=S,S}const a=e.isInstancedBufferGeometry?new CE:new br,o=e.data.index;if(o!==void 0){const v=s1(o.type,o.array);a.setIndex(new Vi(v,1))}const l=e.data.attributes;for(const v in l){const b=l[v];let _;if(b.isInterleavedBufferAttribute){const w=i(e.data,b.data);_=new Qc(w,b.itemSize,b.offset,b.normalized)}else{const w=s1(b.type,b.array),S=b.isInstancedBufferAttribute?dv:Vi;_=new S(w,b.itemSize,b.normalized)}b.name!==void 0&&(_.name=b.name),b.usage!==void 0&&_.setUsage(b.usage),a.setAttribute(v,_)}const c=e.data.morphAttributes;if(c)for(const v in c){const b=c[v],_=[];for(let w=0,S=b.length;w<S;w++){const E=b[w];let A;if(E.isInterleavedBufferAttribute){const N=i(e.data,E.data);A=new Qc(N,E.itemSize,E.offset,E.normalized)}else{const N=s1(E.type,E.array);A=new Vi(N,E.itemSize,E.normalized)}E.name!==void 0&&(A.name=E.name),_.push(A)}a.morphAttributes[v]=_}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let v=0,b=h.length;v!==b;++v){const _=h[v];a.addGroup(_.start,_.count,_.materialIndex)}const g=e.data.boundingSphere;return g!==void 0&&(a.boundingSphere=new Va().fromJSON(g)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}class Kwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=this.path===""?$R.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new vp(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){i!==void 0&&i(h),h("ObjectLoader: Can't parse "+e+".",h.message);return}const d=c.metadata;if(d===void 0||d.type===void 0||d.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),Hn("ObjectLoader: Can't load "+e);return}s.parse(c,n)},r,i)}async loadAsync(e,n){const r=this,i=this.path===""?$R.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new vp(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,n);let o;try{o=JSON.parse(a)}catch(c){throw new Error("ObjectLoader: Can't parse "+e+". "+c.message)}const l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await r.parseAsync(o)}parse(e,n){const r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,function(){n!==void 0&&n(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,r),d=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,d),this.bindLightTargets(c),n!==void 0){let h=!1;for(const g in a)if(a[g].data instanceof HTMLImageElement){h=!0;break}h===!1&&n(c)}return c}async parseAsync(e){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,r),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,i,o,a,n),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}parseShapes(e){const n={};if(e!==void 0)for(let r=0,i=e.length;r<i;r++){const s=new $0().fromJSON(e[r]);n[s.uuid]=s}return n}parseSkeletons(e,n){const r={},i={};if(n.traverse(function(s){s.isBone&&(i[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new oE().fromJSON(e[s],i);r[o.uuid]=o}return r}parseGeometries(e,n){const r={};if(e!==void 0){const i=new YY;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(l);break;default:l.type in Lz?o=Lz[l.type].fromJSON(l,n):hn(`ObjectLoader: Unsupported geometry type "${l.type}"`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),r[l.uuid]=o}}return r}parseMaterials(e,n){const r={},i={};if(e!==void 0){const s=new EE;s.setTextures(n);for(let a=0,o=e.length;a<o;a++){const l=e[a];r[l.uuid]===void 0&&(r[l.uuid]=s.parse(l)),i[l.uuid]=r[l.uuid]}}return i}parseAnimations(e){const n={};if(e!==void 0)for(let r=0;r<e.length;r++){const i=e[r],s=PS.parse(i);n[s.uuid]=s}return n}parseImages(e,n){const r=this,i={};let s;function a(l){return r.manager.itemStart(l),s.load(l,function(){r.manager.itemEnd(l)},void 0,function(){r.manager.itemError(l),r.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:r.resourcePath+c;return a(d)}else return l.data?{data:s1(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new _9(n);s=new IS(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c<d;c++){const h=e[c],g=h.url;if(Array.isArray(g)){const v=[];for(let b=0,_=g.length;b<_;b++){const w=g[b],S=o(w);S!==null&&(S instanceof HTMLImageElement?v.push(S):v.push(new Bd(S.data,S.width,S.height)))}i[h.uuid]=new H0(v)}else{const v=o(h.url);i[h.uuid]=new H0(v)}}}return i}async parseImagesAsync(e){const n=this,r={};let i;async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:n.resourcePath+o;return await i.loadAsync(l)}else return a.data?{data:s1(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){i=new IS(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[a],c=l.url;if(Array.isArray(c)){const d=[];for(let h=0,g=c.length;h<g;h++){const v=c[h],b=await s(v);b!==null&&(b instanceof HTMLImageElement?d.push(b):d.push(new Bd(b.data,b.width,b.height)))}r[l.uuid]=new H0(d)}else{const d=await s(l.url);r[l.uuid]=new H0(d)}}}return r}parseTextures(e,n){function r(s,a){return typeof s=="number"?s:(hn("ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const i={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&hn('ObjectLoader: No "image" specified for',o.uuid),n[o.image]===void 0&&hn("ObjectLoader: Undefined image",o.image);const l=n[o.image],c=l.data;let d;Array.isArray(c)?(d=new _w,c.length===6&&(d.needsUpdate=!0)):(c&&c.data?d=new Bd:d=new ra,c&&(d.needsUpdate=!0)),d.source=l,d.uuid=o.uuid,o.name!==void 0&&(d.name=o.name),o.mapping!==void 0&&(d.mapping=r(o.mapping,Zwe)),o.channel!==void 0&&(d.channel=o.channel),o.offset!==void 0&&d.offset.fromArray(o.offset),o.repeat!==void 0&&d.repeat.fromArray(o.repeat),o.center!==void 0&&d.center.fromArray(o.center),o.rotation!==void 0&&(d.rotation=o.rotation),o.wrap!==void 0&&(d.wrapS=r(o.wrap[0],Hz),d.wrapT=r(o.wrap[1],Hz)),o.format!==void 0&&(d.format=o.format),o.internalFormat!==void 0&&(d.internalFormat=o.internalFormat),o.type!==void 0&&(d.type=o.type),o.colorSpace!==void 0&&(d.colorSpace=o.colorSpace),o.minFilter!==void 0&&(d.minFilter=r(o.minFilter,Vz)),o.magFilter!==void 0&&(d.magFilter=r(o.magFilter,Vz)),o.anisotropy!==void 0&&(d.anisotropy=o.anisotropy),o.flipY!==void 0&&(d.flipY=o.flipY),o.generateMipmaps!==void 0&&(d.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(d.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(d.compareFunction=o.compareFunction),o.userData!==void 0&&(d.userData=o.userData),i[o.uuid]=d}return i}parseObject(e,n,r,i,s){let a;function o(g){return n[g]===void 0&&hn("ObjectLoader: Undefined geometry",g),n[g]}function l(g){if(g!==void 0){if(Array.isArray(g)){const v=[];for(let b=0,_=g.length;b<_;b++){const w=g[b];r[w]===void 0&&hn("ObjectLoader: Undefined material",w),v.push(r[w])}return v}return r[g]===void 0&&hn("ObjectLoader: Undefined material",g),r[g]}}function c(g){return i[g]===void 0&&hn("ObjectLoader: Undefined texture",g),i[g]}let d,h;switch(e.type){case"Scene":a=new t9,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new xn(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new sE(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new iE(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new ea(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new Hd(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new $Y(e.color,e.intensity);break;case"DirectionalLight":a=new WY(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new GY(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new qY(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new VY(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new HY(e.color,e.groundColor,e.intensity);break;case"LightProbe":const g=new w9().fromArray(e.sh);a=new XY(g,e.intensity);break;case"SkinnedMesh":d=o(e.geometry),h=l(e.material),a=new dY(d,h),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":d=o(e.geometry),h=l(e.material),a=new Us(d,h);break;case"InstancedMesh":d=o(e.geometry),h=l(e.material);const v=e.count,b=e.instanceMatrix,_=e.instanceColor;a=new fY(d,h,v),a.instanceMatrix=new dv(new Float32Array(b.array),16),_!==void 0&&(a.instanceColor=new dv(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":d=o(e.geometry),h=l(e.material),a=new hY(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),a.geometry=d,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(w=>{let S=null,E=null;return w.boundingBox!==void 0&&(S=new Ca().fromJSON(w.boundingBox)),w.boundingSphere!==void 0&&(E=new Va().fromJSON(w.boundingSphere)),{...w,boundingBox:S,boundingSphere:E}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new Va().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new Ca().fromJSON(e.boundingBox));break;case"LOD":a=new uY;break;case"Line":a=new am(o(e.geometry),l(e.material));break;case"LineLoop":a=new pY(o(e.geometry),l(e.material));break;case"LineSegments":a=new gh(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new mY(o(e.geometry),l(e.material));break;case"Sprite":a=new cY(l(e.material));break;case"Group":a=new a1;break;case"Bone":a=new s9;break;default:a=new yi}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.pivot!==void 0&&(a.pivot=new Fe().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(a.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(a.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.static!==void 0&&(a.static=e.static),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const g=e.children;for(let v=0;v<g.length;v++)a.add(this.parseObject(g[v],n,r,i,s))}if(e.animations!==void 0){const g=e.animations;for(let v=0;v<g.length;v++){const b=g[v];a.animations.push(s[b])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const g=e.levels;for(let v=0;v<g.length;v++){const b=g[v],_=a.getObjectByProperty("uuid",b.object);_!==void 0&&a.addLevel(_,b.distance,b.hysteresis)}}return a}bindSkeletons(e,n){Object.keys(n).length!==0&&e.traverse(function(r){if(r.isSkinnedMesh===!0&&r.skeleton!==void 0){const i=n[r.skeleton];i===void 0?hn("ObjectLoader: No skeleton found with UUID:",r.skeleton):r.bind(i,r.bindMatrix)}})}bindLightTargets(e){e.traverse(function(n){if(n.isDirectionalLight||n.isSpotLight){const r=n.target,i=e.getObjectByProperty("uuid",r);i!==void 0?n.target=i:n.target=new yi}})}}const Zwe={UVMapping:$T,CubeReflectionMapping:sh,CubeRefractionMapping:rm,EquirectangularReflectionMapping:L_,EquirectangularRefractionMapping:z_,CubeUVReflectionMapping:ky},Hz={RepeatWrapping:vS,ClampToEdgeWrapping:Tc,MirroredRepeatWrapping:xS},Vz={NearestFilter:Ea,NearestMipmapNearestFilter:Wk,NearestMipmapLinearFilter:i1,LinearFilter:rs,LinearMipmapNearestFilter:j_,LinearMipmapLinearFilter:Kf},g6=new WeakMap;class Qwe extends Rc{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&hn("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&hn("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Zf.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{if(g6.has(a)===!0)i&&i(g6.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return n&&n(c),s.manager.itemEnd(e),c});return}return setTimeout(function(){n&&n(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Zf.add(`image-bitmap:${e}`,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),g6.set(l,c),Zf.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});Zf.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let lM;class M9{static getContext(){return lM===void 0&&(lM=new(window.AudioContext||window.webkitAudioContext)),lM}static setContext(e){lM=e}}class Jwe extends Rc{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new vp(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);M9.getContext().decodeAudioData(c,function(h){n(h)}).catch(o)}catch(c){o(c)}},r,i);function o(l){i?i(l):Hn(l),s.manager.itemError(e)}}}const Gz=new rr,Wz=new rr,pg=new rr;class e3e{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ea,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ea,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,pg.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,a=n.near*Math.tan(Xg*n.fov*.5)/n.zoom;let o,l;Wz.elements[12]=-i,Gz.elements[12]=i,o=-a*n.aspect+s,l=a*n.aspect+s,pg.elements[0]=2*n.near/(l-o),pg.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(pg),o=-a*n.aspect-s,l=a*n.aspect-s,pg.elements[0]=2*n.near/(l-o),pg.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(pg)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Wz),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Gz)}}const Wx=-90,$x=1;class KY extends yi{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new ea(Wx,$x,e,n);i.layers=this.layers,this.add(i);const s=new ea(Wx,$x,e,n);s.layers=this.layers,this.add(s);const a=new ea(Wx,$x,e,n);a.layers=this.layers,this.add(a);const o=new ea(Wx,$x,e,n);o.layers=this.layers,this.add(o);const l=new ea(Wx,$x,e,n);l.layers=this.layers,this.add(l);const c=new ea(Wx,$x,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,a,o,l]=n;for(const c of n)this.remove(c);if(e===Zc)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===uv)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,d]=this.children,h=e.getRenderTarget(),g=e.getActiveCubeFace(),v=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;const _=r.texture.generateMipmaps;r.texture.generateMipmaps=!1;let w=!1;e.isWebGLRenderer===!0?w=e.state.buffers.depth.getReversed():w=e.reversedDepthBuffer,e.setRenderTarget(r,0,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,s),e.setRenderTarget(r,1,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,a),e.setRenderTarget(r,2,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,o),e.setRenderTarget(r,3,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,l),e.setRenderTarget(r,4,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,c),r.texture.generateMipmaps=_,e.setRenderTarget(r,5,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,d),e.setRenderTarget(h,g,v),e.xr.enabled=b,r.texture.needsPMREMUpdate=!0}}class ZY extends ea{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class QY{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=t3e.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function t3e(){this._document.hidden===!1&&this.reset()}const mg=new Fe,v6=new Bo,n3e=new Fe,gg=new Fe,vg=new Fe;class r3e extends yi{constructor(){super(),this.type="AudioListener",this.context=M9.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new QY}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const n=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(mg,v6,n3e),gg.set(0,0,-1).applyQuaternion(v6),vg.set(0,1,0).applyQuaternion(v6),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(mg.x,r),n.positionY.linearRampToValueAtTime(mg.y,r),n.positionZ.linearRampToValueAtTime(mg.z,r),n.forwardX.linearRampToValueAtTime(gg.x,r),n.forwardY.linearRampToValueAtTime(gg.y,r),n.forwardZ.linearRampToValueAtTime(gg.z,r),n.upX.linearRampToValueAtTime(vg.x,r),n.upY.linearRampToValueAtTime(vg.y,r),n.upZ.linearRampToValueAtTime(vg.z,r)}else n.setPosition(mg.x,mg.y,mg.z),n.setOrientation(gg.x,gg.y,gg.z,vg.x,vg.y,vg.z)}}class JY extends yi{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){hn("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){hn("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){hn("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){hn("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e<n;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e<n;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){hn("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(hn("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){hn("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,n){return super.copy(e,n),e.sourceType!=="buffer"?(hn("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const xg=new Fe,$z=new Bo,i3e=new Fe,yg=new Fe;class s3e extends JY{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,n,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=n,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(xg,$z,i3e),yg.set(0,0,1).applyQuaternion($z);const n=this.panner;if(n.positionX){const r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(xg.x,r),n.positionY.linearRampToValueAtTime(xg.y,r),n.positionZ.linearRampToValueAtTime(xg.z,r),n.orientationX.linearRampToValueAtTime(yg.x,r),n.orientationY.linearRampToValueAtTime(yg.y,r),n.orientationZ.linearRampToValueAtTime(yg.z,r)}else n.setPosition(xg.x,xg.y,xg.z),n.setOrientation(yg.x,yg.y,yg.z)}}class a3e{constructor(e,n=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=n,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const n=this.getFrequencyData();for(let r=0;r<n.length;r++)e+=n[r];return e/n.length}}class eK{constructor(e,n,r){this.binding=e,this.valueSize=r;let i,s,a;switch(n){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,n){const r=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)r[s+o]=r[o];a=n}else{a+=n;const o=n/a;this._mixBufferRegion(r,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const n=this.buffer,r=this.valueSize,i=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(n,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const n=this.valueSize,r=this.buffer,i=e*n+n,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=n*this._origIndex;this._mixBufferRegion(r,i,l,1-s,n)}a>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*n,1,n);for(let l=n,c=n+n;l!==c;++l)if(r[l]!==r[l+n]){o.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let s=r,a=i;s!==a;++s)n[s]=n[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let r=e;r<n;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,n=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[n+r]=this.buffer[e+r]}_select(e,n,r,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[n+a]=e[r+a]}_slerp(e,n,r,i){Bo.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const a=this._workIndex*s;Bo.multiplyQuaternionsFlat(e,a,e,n,e,r),Bo.slerpFlat(e,n,e,n,e,a,i)}_lerp(e,n,r,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=n+o;e[l]=e[l]*a+e[r+o]*i}}_lerpAdditive(e,n,r,i,s){for(let a=0;a!==s;++a){const o=n+a;e[o]=e[o]+e[r+a]*i}}}const T9="\\[\\]\\.:\\/",o3e=new RegExp("["+T9+"]","g"),E9="[^"+T9+"]",l3e="[^"+T9.replace("\\.","")+"]",c3e=/((?:WC+[\/:])*)/.source.replace("WC",E9),u3e=/(WCOD+)?/.source.replace("WCOD",l3e),d3e=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",E9),f3e=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",E9),h3e=new RegExp("^"+c3e+u3e+d3e+f3e+"$"),p3e=["material","materials","bones","map"];class m3e{constructor(e,n,r){const i=r||gi.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,i)}getValue(e,n){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,n)}setValue(e,n){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].unbind()}}class gi{constructor(e,n,r){this.path=n,this.parsedPath=r||gi.parseTrackName(n),this.node=gi.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,r){return e&&e.isAnimationObjectGroup?new gi.Composite(e,n,r):new gi(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(o3e,"")}static parseTrackName(e){const n=h3e.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);p3e.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===n||o.uuid===n)return o;const l=r(o.children);if(l)return l}return null},i=r(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,n){e[n]=this.targetObject[this.propertyName]}_getValue_array(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)e[n++]=r[i]}_getValue_arrayElement(e,n){e[n]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,n){this.resolvedProperty.toArray(e,n)}_setValue_direct(e,n){this.targetObject[this.propertyName]=e[n]}_setValue_direct_setNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,n){this.targetObject[this.propertyName]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++]}_setValue_array_setNeedsUpdate(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,n){const r=this.resolvedProperty;for(let i=0,s=r.length;i!==s;++i)r[i]=e[n++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,n){this.resolvedProperty[this.propertyIndex]=e[n]}_setValue_arrayElement_setNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty[this.propertyIndex]=e[n],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,n){this.resolvedProperty.fromArray(e,n)}_setValue_fromArray_setNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,n){this.resolvedProperty.fromArray(e,n),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,n){this.bind(),this.getValue(e,n)}_setValue_unbound(e,n){this.bind(),this.setValue(e,n)}bind(){let e=this.node;const n=this.parsedPath,r=n.objectName,i=n.propertyName;let s=n.propertyIndex;if(e||(e=gi.findNode(this.rootNode,n.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){hn("PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=n.objectIndex;switch(r){case"materials":if(!e.material){Hn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Hn("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Hn("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let d=0;d<e.length;d++)if(e[d].name===c){c=d;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Hn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Hn("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[r]===void 0){Hn("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){Hn("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[i];if(a===void 0){const c=n.nodeName;Hn("PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Hn("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Hn("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}gi.Composite=m3e;gi.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};gi.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};gi.prototype.GetterByBindingType=[gi.prototype._getValue_direct,gi.prototype._getValue_array,gi.prototype._getValue_arrayElement,gi.prototype._getValue_toArray];gi.prototype.SetterByBindingTypeAndVersioning=[[gi.prototype._setValue_direct,gi.prototype._setValue_direct_setNeedsUpdate,gi.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[gi.prototype._setValue_array,gi.prototype._setValue_array_setNeedsUpdate,gi.prototype._setValue_array_setMatrixWorldNeedsUpdate],[gi.prototype._setValue_arrayElement,gi.prototype._setValue_arrayElement_setNeedsUpdate,gi.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[gi.prototype._setValue_fromArray,gi.prototype._setValue_fromArray_setNeedsUpdate,gi.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class g3e{constructor(){this.isAnimationObjectGroup=!0,this.uuid=ru(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let r=0,i=arguments.length;r!==i;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}add(){const e=this._objects,n=this._indicesByUUID,r=this._paths,i=this._parsedPaths,s=this._bindings,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let d=0,h=arguments.length;d!==h;++d){const g=arguments[d],v=g.uuid;let b=n[v];if(b===void 0){b=l++,n[v]=b,e.push(g);for(let _=0,w=a;_!==w;++_)s[_].push(new gi(g,r[_],i[_]))}else if(b<c){o=e[b];const _=--c,w=e[_];n[w.uuid]=b,e[b]=w,n[v]=_,e[_]=g;for(let S=0,E=a;S!==E;++S){const A=s[S],N=A[_];let D=A[b];A[b]=N,D===void 0&&(D=new gi(g,r[S],i[S])),A[_]=D}}else e[b]!==o&&Hn("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,d=n[c];if(d!==void 0&&d>=s){const h=s++,g=e[h];n[g.uuid]=d,e[d]=g,n[c]=h,e[h]=l;for(let v=0,b=i;v!==b;++v){const _=r[v],w=_[h],S=_[d];_[d]=w,_[h]=S}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],d=c.uuid,h=n[d];if(h!==void 0)if(delete n[d],h<s){const g=--s,v=e[g],b=--a,_=e[b];n[v.uuid]=h,e[h]=v,n[_.uuid]=g,e[g]=_,e.pop();for(let w=0,S=i;w!==S;++w){const E=r[w],A=E[g],N=E[b];E[h]=A,E[g]=N,E.pop()}}else{const g=--a,v=e[g];g>0&&(n[v.uuid]=h),e[h]=v,e.pop();for(let b=0,_=i;b!==_;++b){const w=r[b];w[h]=w[g],w.pop()}}}this.nCachedObjects_=s}subscribe_(e,n){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,h=new Array(c);i=s.length,r[e]=i,a.push(e),o.push(n),s.push(h);for(let g=d,v=l.length;g!==v;++g){const b=l[g];h[g]=new gi(b,e,n)}return h}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];n[c]=r,a[r]=l,a.pop(),s[r]=s[o],s.pop(),i[r]=i[o],i.pop()}}}class tK{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,a=s.length,o=new Array(a),l={endingStart:Ig,endingEnd:Ig};for(let c=0;c!==a;++c){const d=s[c].createInterpolant(null);o[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=WX,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,r=!1){if(e.fadeOut(n),this.fadeIn(n),r===!0){const i=this._clip.duration,s=e._clip.duration,a=s/i,o=i/s;e.warp(1,a,n),this.warp(o,1,n)}return this}crossFadeTo(e,n,r=!1){return e.crossFadeFrom(this,n,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,r){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/a,c[1]=n/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?n=0:(this._startTime=null,n=r*l)}n*=this._updateTimeScale(e);const a=this._updateTime(n),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Qk:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(a),c[d].accumulateAdditive(o);break;case JT:default:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(a),c[d].accumulate(i,o)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const a=r===$X;if(e===0)return s===-1?i:a&&(s&1)===1?n-i:i;if(r===GX){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=n||i<0){const o=Math.floor(i/n);i-=n*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=Dg,i.endingEnd=Dg):(e?i.endingStart=this.zeroSlopeAtStart?Dg:Ig:i.endingStart=bS,n?i.endingEnd=this.zeroSlopeAtEnd?Dg:Ig:i.endingEnd=bS)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=n,o[1]=s+e,l[1]=r,this}}const v3e=new Float32Array(1);class x3e extends mh{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let h=0;h!==s;++h){const g=i[h],v=g.name;let b=d[v];if(b!==void 0)++b.referenceCount,a[h]=b;else{if(b=a[h],b!==void 0){b._cacheIndex===null&&(++b.referenceCount,this._addInactiveBinding(b,l,v));continue}const _=n&&n._propertyBindings[h].binding.parsedPath;b=new eK(gi.create(r,v,_),g.ValueTypeName,g.getValueSize()),++b.referenceCount,this._addInactiveBinding(b,l,v),a[h]=b}o[h].resultBuffer=b.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n<this._nActiveActions}_addInactiveAction(e,n,r){const i=this._actions,s=this._actionsByClip;let a=s[n];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[n]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[r]=e}_removeInactiveAction(e){const n=this._actions,r=n[n.length-1],i=e._cacheIndex;r._cacheIndex=i,n[i]=r,n.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],d=e._byClipCacheIndex;c._byClipCacheIndex=d,l[d]=c,l.pop(),e._byClipCacheIndex=null;const h=o.actionByRoot,g=(e._localRoot||this._root).uuid;delete h[g],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const n=this._actions,r=e._cacheIndex,i=this._nActiveActions++,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_takeBackAction(e){const n=this._actions,r=e._cacheIndex,i=--this._nActiveActions,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_addInactiveBinding(e,n,r){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[n];a===void 0&&(a={},i[n]=a),a[r]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const n=this._bindings,r=e.binding,i=r.rootNode.uuid,s=r.path,a=this._bindingsByRootAndName,o=a[i],l=n[n.length-1],c=e._cacheIndex;l._cacheIndex=c,n[c]=l,n.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const n=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_takeBackBinding(e){const n=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,s=n[i];e._cacheIndex=i,n[i]=e,s._cacheIndex=r,n[r]=s}_lendControlInterpolant(){const e=this._controlInterpolants,n=this._nActiveControlInterpolants++;let r=e[n];return r===void 0&&(r=new y9(new Float32Array(2),new Float32Array(2),1,v3e),r.__cacheIndex=n,e[n]=r),r}_takeBackControlInterpolant(e){const n=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=n[i];e.__cacheIndex=i,n[i]=e,s.__cacheIndex=r,n[r]=s}clipAction(e,n,r){const i=n||this._root,s=i.uuid;let a=typeof e=="string"?PS.findByName(i,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(r===void 0&&(a!==null?r=a.blendMode:r=JT),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===r)return h;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const d=new tK(this,a,n,r);return this._bindAction(d,c),this._addInactiveAction(d,o,s),d}existingAction(e,n){const r=n||this._root,i=r.uuid,s=typeof e=="string"?PS.findByName(r,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions,n=this._nActiveActions;for(let r=n-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const n=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let n=0;n<this._actions.length;n++)this._actions[n].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const n=this._actions,r=e.uuid,i=this._actionsByClip,s=i[r];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const d=c._cacheIndex,h=n[n.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=d,n[d]=h,n.pop(),this._removeInactiveBindingsForAction(c)}delete i[r]}}uncacheRoot(e){const n=e.uuid,r=this._actionsByClip;for(const a in r){const o=r[a].actionByRoot,l=o[n];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[n];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,n){const r=this.existingAction(e,n);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class y3e extends e9{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isRenderTarget3D=!0,this.depth=r,this.texture=new rE(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class C9{constructor(e){this.value=e}clone(){return new C9(this.value.clone===void 0?this.value:this.value.clone())}}let b3e=0;class _3e extends mh{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:b3e++}),this.name="",this.usage=SS,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const n=this.uniforms.indexOf(e);return n!==-1&&this.uniforms.splice(n,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const n=e.uniforms;this.uniforms.length=0;for(let r=0,i=n.length;r<i;r++){const s=Array.isArray(n[r])?n[r]:[n[r]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class S5 extends aE{constructor(e,n,r=1){super(e,n),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const n=super.clone(e);return n.meshPerAttribute=this.meshPerAttribute,n}toJSON(e){const n=super.toJSON(e);return n.isInstancedInterleavedBuffer=!0,n.meshPerAttribute=this.meshPerAttribute,n}}class S3e{constructor(e,n,r,i,s,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=n,this.itemSize=r,this.elementSize=i,this.count=s,this.normalized=a,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,n){return this.type=e,this.elementSize=n,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const qz=new rr;class nK{constructor(e,n,r=0,i=1/0){this.ray=new Ev(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new sy,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,n){this.ray.set(e,n)}setFromCamera(e,n){n.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(n.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(n).sub(this.ray.origin).normalize(),this.camera=n):n.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(n.near+n.far)/(n.near-n.far)).unproject(n),this.ray.direction.set(0,0,-1).transformDirection(n.matrixWorld),this.camera=n):Hn("Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return qz.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(qz),this}intersectObject(e,n=!0,r=[]){return qR(e,this,r,n),r.sort(Xz),r}intersectObjects(e,n=!0,r=[]){for(let i=0,s=e.length;i<s;i++)qR(e[i],this,r,n);return r.sort(Xz),r}}function Xz(t,e){return t.distance-e.distance}function qR(t,e,n,r){let i=!0;if(t.layers.test(e.layers)&&t.raycast(e,n)===!1&&(i=!1),i===!0&&r===!0){const s=t.children;for(let a=0,o=s.length;a<o;a++)qR(s[a],e,n,!0)}}class rK{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,hn("THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=performance.now();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}class XR{constructor(e=1,n=0,r=0){this.radius=e,this.phi=n,this.theta=r}set(e,n,r){return this.radius=e,this.phi=n,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=sr(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+n*n+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(sr(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class w3e{constructor(e=1,n=0,r=0){this.radius=e,this.theta=n,this.y=r}set(e,n,r){return this.radius=e,this.theta=n,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,n,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=n,this}clone(){return new this.constructor().copy(this)}}class A9{constructor(e,n,r,i){A9.prototype.isMatrix2=!0,this.elements=[1,0,0,1],e!==void 0&&this.set(e,n,r,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,n=0){for(let r=0;r<4;r++)this.elements[r]=e[r+n];return this}set(e,n,r,i){const s=this.elements;return s[0]=e,s[2]=n,s[1]=r,s[3]=i,this}}const Yz=new zt;class M3e{constructor(e=new zt(1/0,1/0),n=new zt(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=Yz.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Yz).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Kz=new Fe,cM=new Fe,qx=new Fe,Xx=new Fe,x6=new Fe,T3e=new Fe,E3e=new Fe;class iK{constructor(e=new Fe,n=new Fe){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){Kz.subVectors(e,this.start),cM.subVectors(this.end,this.start);const r=cM.dot(cM);let s=cM.dot(Kz)/r;return n&&(s=sr(s,0,1)),s}closestPointToPoint(e,n,r){const i=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(i).add(this.start)}distanceSqToLine3(e,n=T3e,r=E3e){const i=10000000000000001e-32;let s,a;const o=this.start,l=e.start,c=this.end,d=e.end;qx.subVectors(c,o),Xx.subVectors(d,l),x6.subVectors(o,l);const h=qx.dot(qx),g=Xx.dot(Xx),v=Xx.dot(x6);if(h<=i&&g<=i)return n.copy(o),r.copy(l),n.sub(r),n.dot(n);if(h<=i)s=0,a=v/g,a=sr(a,0,1);else{const b=qx.dot(x6);if(g<=i)a=0,s=sr(-b/h,0,1);else{const _=qx.dot(Xx),w=h*g-_*_;w!==0?s=sr((_*v-b*g)/w,0,1):s=0,a=(_*s+v)/g,a<0?(a=0,s=sr(-b/h,0,1)):a>1&&(a=1,s=sr((_-b)/h,0,1))}}return n.copy(o).addScaledVector(qx,s),r.copy(l).addScaledVector(Xx,a),n.distanceToSquared(r)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Zz=new Fe;class C3e extends yi{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new br,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,d=o/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(d),Math.sin(d),1)}r.setAttribute("position",new Cn(i,3));const s=new $l({fog:!1,toneMapped:!1});this.cone=new gh(r,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,n=e*Math.tan(this.light.angle);this.cone.scale.set(n,n,e),Zz.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Zz),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const _0=new Fe,uM=new rr,y6=new rr;class A3e extends gh{constructor(e){const n=sK(e),r=new br,i=[],s=[];for(let c=0;c<n.length;c++){const d=n[c];d.parent&&d.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}r.setAttribute("position",new Cn(i,3)),r.setAttribute("color",new Cn(s,3));const a=new $l({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=n,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const o=new xn(255),l=new xn(65280);this.setColors(o,l)}updateMatrixWorld(e){const n=this.bones,r=this.geometry,i=r.getAttribute("position");y6.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<n.length;s++){const o=n[s];o.parent&&o.parent.isBone&&(uM.multiplyMatrices(y6,o.matrixWorld),_0.setFromMatrixPosition(uM),i.setXYZ(a,_0.x,_0.y,_0.z),uM.multiplyMatrices(y6,o.parent.matrixWorld),_0.setFromMatrixPosition(uM),i.setXYZ(a+1,_0.x,_0.y,_0.z),a+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,n){const i=this.geometry.getAttribute("color");for(let s=0;s<i.count;s+=2)i.setXYZ(s,e.r,e.g,e.b),i.setXYZ(s+1,n.r,n.g,n.b);return i.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function sK(t){const e=[];t.isBone===!0&&e.push(t);for(let n=0;n<t.children.length;n++)e.push(...sK(t.children[n]));return e}class N3e extends Us{constructor(e,n,r){const i=new Tw(n,4,2),s=new wp({wireframe:!0,fog:!1,toneMapped:!1});super(i,s),this.light=e,this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const R3e=new Fe,Qz=new xn,Jz=new xn;class k3e extends yi{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const i=new Mw(n);i.rotateY(Math.PI*.5),this.material=new wp({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),a=new Float32Array(s.count*3);i.setAttribute("color",new Vi(a,3)),this.add(new Us(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const n=e.geometry.getAttribute("color");Qz.copy(this.light.color),Jz.copy(this.light.groundColor);for(let r=0,i=n.count;r<i;r++){const s=r<i/2?Qz:Jz;n.setXYZ(r,s.r,s.g,s.b)}n.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(R3e.setFromMatrixPosition(this.light.matrixWorld).negate())}}class P3e extends gh{constructor(e=10,n=10,r=4473924,i=8947848){r=new xn(r),i=new xn(i);const s=n/2,a=e/n,o=e/2,l=[],c=[];for(let g=0,v=0,b=-o;g<=n;g++,b+=a){l.push(-o,0,b,o,0,b),l.push(b,0,-o,b,0,o);const _=g===s?r:i;_.toArray(c,v),v+=3,_.toArray(c,v),v+=3,_.toArray(c,v),v+=3,_.toArray(c,v),v+=3}const d=new br;d.setAttribute("position",new Cn(l,3)),d.setAttribute("color",new Cn(c,3));const h=new $l({vertexColors:!0,toneMapped:!1});super(d,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class I3e extends gh{constructor(e=10,n=16,r=8,i=64,s=4473924,a=8947848){s=new xn(s),a=new xn(a);const o=[],l=[];if(n>1)for(let h=0;h<n;h++){const g=h/n*(Math.PI*2),v=Math.sin(g)*e,b=Math.cos(g)*e;o.push(0,0,0),o.push(v,0,b);const _=h&1?s:a;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let h=0;h<r;h++){const g=h&1?s:a,v=e-e/r*h;for(let b=0;b<i;b++){let _=b/i*(Math.PI*2),w=Math.sin(_)*v,S=Math.cos(_)*v;o.push(w,0,S),l.push(g.r,g.g,g.b),_=(b+1)/i*(Math.PI*2),w=Math.sin(_)*v,S=Math.cos(_)*v,o.push(w,0,S),l.push(g.r,g.g,g.b)}}const c=new br;c.setAttribute("position",new Cn(o,3)),c.setAttribute("color",new Cn(l,3));const d=new $l({vertexColors:!0,toneMapped:!1});super(c,d),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const ej=new Fe,dM=new Fe,tj=new Fe;class D3e extends yi{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="DirectionalLightHelper",n===void 0&&(n=1);let i=new br;i.setAttribute("position",new Cn([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));const s=new $l({fog:!1,toneMapped:!1});this.lightPlane=new am(i,s),this.add(this.lightPlane),i=new br,i.setAttribute("position",new Cn([0,0,0,0,0,1],3)),this.targetLine=new am(i,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),ej.setFromMatrixPosition(this.light.matrixWorld),dM.setFromMatrixPosition(this.light.target.matrixWorld),tj.subVectors(dM,ej),this.lightPlane.lookAt(dM),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(dM),this.targetLine.scale.z=tj.length()}}const fM=new Fe,fa=new TE;class O3e extends gh{constructor(e){const n=new br,r=new $l({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(b,_){l(b),l(_)}function l(b){i.push(0,0,0),s.push(0,0,0),a[b]===void 0&&(a[b]=[]),a[b].push(i.length/3-1)}n.setAttribute("position",new Cn(i,3)),n.setAttribute("color",new Cn(s,3)),super(n,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new xn(16755200),d=new xn(16711680),h=new xn(43775),g=new xn(16777215),v=new xn(3355443);this.setColors(c,d,h,g,v)}setColors(e,n,r,i,s){const o=this.geometry.getAttribute("color");return o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,n.r,n.g,n.b),o.setXYZ(25,n.r,n.g,n.b),o.setXYZ(26,n.r,n.g,n.b),o.setXYZ(27,n.r,n.g,n.b),o.setXYZ(28,n.r,n.g,n.b),o.setXYZ(29,n.r,n.g,n.b),o.setXYZ(30,n.r,n.g,n.b),o.setXYZ(31,n.r,n.g,n.b),o.setXYZ(32,r.r,r.g,r.b),o.setXYZ(33,r.r,r.g,r.b),o.setXYZ(34,r.r,r.g,r.b),o.setXYZ(35,r.r,r.g,r.b),o.setXYZ(36,r.r,r.g,r.b),o.setXYZ(37,r.r,r.g,r.b),o.setXYZ(38,i.r,i.g,i.b),o.setXYZ(39,i.r,i.g,i.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0,this}update(){const e=this.geometry,n=this.pointMap,r=1,i=1;let s,a;if(fa.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,a=0;else if(this.camera.coordinateSystem===Zc)s=-1,a=1;else if(this.camera.coordinateSystem===uv)s=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Ma("c",n,e,fa,0,0,s),Ma("t",n,e,fa,0,0,a),Ma("n1",n,e,fa,-r,-i,s),Ma("n2",n,e,fa,r,-i,s),Ma("n3",n,e,fa,-r,i,s),Ma("n4",n,e,fa,r,i,s),Ma("f1",n,e,fa,-r,-i,a),Ma("f2",n,e,fa,r,-i,a),Ma("f3",n,e,fa,-r,i,a),Ma("f4",n,e,fa,r,i,a),Ma("u1",n,e,fa,r*.7,i*1.1,s),Ma("u2",n,e,fa,-r*.7,i*1.1,s),Ma("u3",n,e,fa,0,i*2,s),Ma("cf1",n,e,fa,-r,0,a),Ma("cf2",n,e,fa,r,0,a),Ma("cf3",n,e,fa,0,-i,a),Ma("cf4",n,e,fa,0,i,a),Ma("cn1",n,e,fa,-r,0,s),Ma("cn2",n,e,fa,r,0,s),Ma("cn3",n,e,fa,0,-i,s),Ma("cn4",n,e,fa,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Ma(t,e,n,r,i,s,a){fM.set(i,s,a).unproject(r);const o=e[t];if(o!==void 0){const l=n.getAttribute("position");for(let c=0,d=o.length;c<d;c++)l.setXYZ(o[c],fM.x,fM.y,fM.z)}}const hM=new Ca;class L3e extends gh{constructor(e,n=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),s=new br;s.setIndex(new Vi(r,1)),s.setAttribute("position",new Vi(i,3)),super(s,new $l({color:n,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&hM.setFromObject(this.object),hM.isEmpty())return;const e=hM.min,n=hM.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=e.x,i[4]=n.y,i[5]=n.z,i[6]=e.x,i[7]=e.y,i[8]=n.z,i[9]=n.x,i[10]=e.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=e.z,i[15]=e.x,i[16]=n.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=n.x,i[22]=e.y,i[23]=e.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,n){return super.copy(e,n),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class z3e extends gh{constructor(e,n=16776960){const r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new br;s.setIndex(new Vi(r,1)),s.setAttribute("position",new Cn(i,3)),super(s,new $l({color:n,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const n=this.box;n.isEmpty()||(n.getCenter(this.position),n.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class j3e extends am{constructor(e,n=1,r=16776960){const i=r,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new br;a.setAttribute("position",new Cn(s,3)),a.computeBoundingSphere(),super(a,new $l({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=n;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new br;l.setAttribute("position",new Cn(o,3)),l.computeBoundingSphere(),this.add(new Us(l,new wp({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const nj=new Fe;let pM,b6;class F3e extends yi{constructor(e=new Fe(0,0,1),n=new Fe(0,0,0),r=1,i=16776960,s=r*.2,a=s*.2){super(),this.type="ArrowHelper",pM===void 0&&(pM=new br,pM.setAttribute("position",new Cn([0,0,0,0,1,0],3)),b6=new ww(.5,1,5,1),b6.translate(0,-.5,0)),this.position.copy(n),this.line=new am(pM,new $l({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Us(b6,new wp({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{nj.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(nj,n)}}setLength(e,n=e*.2,r=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(r,n,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class U3e extends gh{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new br;i.setAttribute("position",new Cn(n,3)),i.setAttribute("color",new Cn(r,3));const s=new $l({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new xn,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(n),i.toArray(s,6),i.toArray(s,9),i.set(r),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class B3e{constructor(){this.type="ShapePath",this.color=new xn,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new _5,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,s,a){return this.currentPath.bezierCurveTo(e,n,r,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(S){const E=[];for(let A=0,N=S.length;A<N;A++){const D=S[A],P=new $0;P.curves=D.curves,E.push(P)}return E}function r(S,E){const A=E.length;let N=!1;for(let D=A-1,P=0;P<A;D=P++){let L=E[D],R=E[P],O=R.x-L.x,W=R.y-L.y;if(Math.abs(W)>Number.EPSILON){if(W<0&&(L=E[P],O=-O,R=E[D],W=-W),S.y<L.y||S.y>R.y)continue;if(S.y===L.y){if(S.x===L.x)return!0}else{const F=W*(S.x-L.x)-O*(S.y-L.y);if(F===0)return!0;if(F<0)continue;N=!N}}else{if(S.y!==L.y)continue;if(R.x<=S.x&&S.x<=L.x||L.x<=S.x&&S.x<=R.x)return!0}}return N}const i=Ud.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new $0,l.curves=o.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const h=[],g=[];let v=[],b=0,_;g[b]=void 0,v[b]=[];for(let S=0,E=s.length;S<E;S++)o=s[S],_=o.getPoints(),a=i(_),a=e?!a:a,a?(!d&&g[b]&&b++,g[b]={s:new $0,p:_},g[b].s.curves=o.curves,d&&b++,v[b]=[]):v[b].push({h:o,p:_[0]});if(!g[0])return n(s);if(g.length>1){let S=!1,E=0;for(let A=0,N=g.length;A<N;A++)h[A]=[];for(let A=0,N=g.length;A<N;A++){const D=v[A];for(let P=0;P<D.length;P++){const L=D[P];let R=!0;for(let O=0;O<g.length;O++)r(L.p,g[O].p)&&(A!==O&&E++,R?(R=!1,h[O].push(L)):S=!0);R&&h[A].push(L)}}E>0&&S===!1&&(v=h)}let w;for(let S=0,E=g.length;S<E;S++){l=g[S].s,c.push(l),w=v[S];for(let A=0,N=w.length;A<N;A++)l.holes.push(w[A].h)}return c}}class H3e extends mh{constructor(e,n=null){super(),this.object=e,this.domElement=n,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){hn("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function V3e(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}function G3e(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}function W3e(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function YR(t,e,n,r){const i=$3e(r);switch(n){case Kk:return t*e;case KT:return t*e/i.components*i.byteLength;case bw:return t*e/i.components*i.byteLength;case cv:return t*e*2/i.components*i.byteLength;case ZT:return t*e*2/i.components*i.byteLength;case Zk:return t*e*3/i.components*i.byteLength;case ul:return t*e*4/i.components*i.byteLength;case QT:return t*e*4/i.components*i.byteLength;case F_:case U_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case B_:case H_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case U2:case H2:return Math.max(t,16)*Math.max(e,8)/4;case F2:case B2:return Math.max(t,8)*Math.max(e,8)/2;case V2:case G2:case $2:case q2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case W2:case X2:case Y2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case K2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Z2:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Q2:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case J2:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case e5:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case t5:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case n5:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case r5:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case i5:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case s5:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case a5:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case o5:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case l5:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case c5:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case u5:case d5:case f5:return Math.ceil(t/4)*Math.ceil(e/4)*16;case h5:case p5:return Math.ceil(t/4)*Math.ceil(e/4)*8;case m5:case g5:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function $3e(t){switch(t){case zl:case $k:return{byteLength:1,components:1};case ny:case qk:case ah:return{byteLength:2,components:1};case XT:case YT:return{byteLength:2,components:4};case Ku:case qT:case Bl:return{byteLength:4,components:1};case Xk:case Yk:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}class q3e{static contain(e,n){return V3e(e,n)}static cover(e,n){return G3e(e,n)}static fill(e){return W3e(e)}static getByteLength(e,n,r,i){return YR(e,n,r,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:xw}}));typeof window<"u"&&(window.__THREE__?hn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=xw);/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */function aK(){let t=null,e=!1,n=null,r=null;function i(s,a){n(s,a),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function X3e(t){const e=new WeakMap;function n(o,l){const c=o.array,d=o.usage,h=c.byteLength,g=t.createBuffer();t.bindBuffer(l,g),t.bufferData(l,c,d),o.onUploadCallback();let v;if(c instanceof Float32Array)v=t.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)v=t.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?v=t.HALF_FLOAT:v=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)v=t.SHORT;else if(c instanceof Uint32Array)v=t.UNSIGNED_INT;else if(c instanceof Int32Array)v=t.INT;else if(c instanceof Int8Array)v=t.BYTE;else if(c instanceof Uint8Array)v=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)v=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:g,type:v,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:h}}function r(o,l,c){const d=l.array,h=l.updateRanges;if(t.bindBuffer(c,o),h.length===0)t.bufferSubData(c,0,d);else{h.sort((v,b)=>v.start-b.start);let g=0;for(let v=1;v<h.length;v++){const b=h[g],_=h[v];_.start<=b.start+b.count+1?b.count=Math.max(b.count,_.start+_.count-b.start):(++g,h[g]=_)}h.length=g+1;for(let v=0,b=h.length;v<b;v++){const _=h[v];t.bufferSubData(c,_.start*d.BYTES_PER_ELEMENT,d,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(t.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,n(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(c.buffer,o,l),c.version=o.version}}return{get:i,remove:s,update:a}}var Y3e=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,K3e=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,Z3e=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,Q3e=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,J3e=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,e4e=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,t4e=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,n4e=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,r4e=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec4 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
	}
#endif`,i4e=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,s4e=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,a4e=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,o4e=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,l4e=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,c4e=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,u4e=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,d4e=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,f4e=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,h4e=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,p4e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#endif`,m4e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#endif`,g4e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec4 vColor;
#endif`,v4e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec4( 1.0 );
#endif
#ifdef USE_COLOR_ALPHA
	vColor *= color;
#elif defined( USE_COLOR )
	vColor.rgb *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.rgb *= instanceColor.rgb;
#endif
#ifdef USE_BATCHING_COLOR
	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
#endif`,x4e=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,y4e=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,b4e=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,_4e=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,S4e=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,w4e=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,M4e=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,T4e="gl_FragColor = linearToOutputTexel( gl_FragColor );",E4e=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,C4e=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
		#ifdef ENVMAP_BLENDING_MULTIPLY
			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
		#elif defined( ENVMAP_BLENDING_MIX )
			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
		#elif defined( ENVMAP_BLENDING_ADD )
			outgoingLight += envColor.xyz * specularStrength * reflectivity;
		#endif
	#endif
#endif`,A4e=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
#endif`,N4e=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,R4e=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,k4e=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,P4e=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,I4e=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,D4e=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,O4e=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,L4e=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,z4e=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,j4e=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,F4e=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,U4e=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,B4e=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,H4e=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,V4e=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,G4e=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,W4e=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,$4e=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
material.metalness = metalnessFactor;
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = vec3( 0.04 );
	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,q4e=`uniform sampler2D dfgLUT;
struct PhysicalMaterial {
	vec3 diffuseColor;
	vec3 diffuseContribution;
	vec3 specularColor;
	vec3 specularColorBlended;
	float roughness;
	float metalness;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
		vec3 iridescenceFresnelDielectric;
		vec3 iridescenceFresnelMetallic;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return v;
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColorBlended;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float rInv = 1.0 / ( roughness + 0.1 );
	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
	float DG = exp( a * dotNV + b );
	return saturate( DG );
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	float dotNV = saturate( dot( normal, viewDir ) );
	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
	float Ess_V = dfgV.x + dfgV.y;
	float Ess_L = dfgL.x + dfgL.y;
	float Ems_V = 1.0 - Ess_V;
	float Ems_L = 1.0 - Ess_L;
	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
	float compensationFactor = Ems_V * Ems_L;
	vec3 multiScatter = Fms * compensationFactor;
	return singleScatter + multiScatter;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
		#ifdef USE_CLEARCOAT
			vec3 Ncc = geometryClearcoatNormal;
			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
			mat3 mInvClearcoat = mat3(
				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
				vec3(             0, 1,             0 ),
				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
			);
			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
		#endif
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
 
 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
 
 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
 
 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
 
 		irradiance *= sheenEnergyComp;
 
 	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
	#ifdef USE_SHEEN
		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
		diffuse *= sheenEnergyComp;
	#endif
	reflectedLight.indirectDiffuse += diffuse;
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
 	#endif
	vec3 singleScatteringDielectric = vec3( 0.0 );
	vec3 multiScatteringDielectric = vec3( 0.0 );
	vec3 singleScatteringMetallic = vec3( 0.0 );
	vec3 multiScatteringMetallic = vec3( 0.0 );
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
	#endif
	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	vec3 indirectSpecular = radiance * singleScattering;
	indirectSpecular += multiScattering * cosineWeightedIrradiance;
	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
	#ifdef USE_SHEEN
		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
		indirectSpecular *= sheenEnergyComp;
		indirectDiffuse *= sheenEnergyComp;
	#endif
	reflectedLight.indirectSpecular += indirectSpecular;
	reflectedLight.indirectDiffuse += indirectDiffuse;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,X4e=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,Y4e=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
			iblIrradiance += getIBLIrradiance( geometryNormal );
		#endif
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,K4e=`#if defined( RE_IndirectDiffuse )
	#if defined( LAMBERT ) || defined( PHONG )
		irradiance += iblIrradiance;
	#endif
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,Z4e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,Q4e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,J4e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,eMe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,tMe=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,nMe=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,rMe=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	#if defined( USE_POINTS_UV )
		vec2 uv = vUv;
	#else
		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	#endif
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,iMe=`#if defined( USE_POINTS_UV )
	varying vec2 vUv;
#else
	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		uniform mat3 uvTransform;
	#endif
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,sMe=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,aMe=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,oMe=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,lMe=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,cMe=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,uMe=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,dMe=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,fMe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,hMe=`#ifdef USE_NORMALMAP_OBJECTSPACE
	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,pMe=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,mMe=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,gMe=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,vMe=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,xMe=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,yMe=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,bMe=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif`,_Me=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,SMe=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,wMe=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v <= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v >= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v <= 0.0 )
		return vec3( 0., 0., 0. );
	if( v >= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v <= 0.0 )
		return vec2( 0., 0. );
	if( v >= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	#ifdef USE_REVERSED_DEPTH_BUFFER
	
		return depth * ( far - near ) - far;
	#else
		return depth * ( near - far ) - near;
	#endif
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	
	#ifdef USE_REVERSED_DEPTH_BUFFER
		return ( near * far ) / ( ( near - far ) * depth - near );
	#else
		return ( near * far ) / ( ( far - near ) * depth - far );
	#endif
}`,MMe=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,TMe=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,EMe=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,CMe=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,AMe=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,NMe=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,RMe=`#if NUM_SPOT_LIGHT_COORDS > 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#if defined( SHADOWMAP_TYPE_PCF )
			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		#else
			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		#endif
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		#if defined( SHADOWMAP_TYPE_PCF )
			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		#else
			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		#endif
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#if defined( SHADOWMAP_TYPE_PCF )
			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		#elif defined( SHADOWMAP_TYPE_BASIC )
			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		#endif
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	#if defined( SHADOWMAP_TYPE_PCF )
		float interleavedGradientNoise( vec2 position ) {
			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
		}
		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
			const float goldenAngle = 2.399963229728653;
			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
			float theta = float( sampleIndex ) * goldenAngle + phi;
			return vec2( cos( theta ), sin( theta ) ) * r;
		}
	#endif
	#if defined( SHADOWMAP_TYPE_PCF )
		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
			float shadow = 1.0;
			shadowCoord.xyz /= shadowCoord.w;
			shadowCoord.z += shadowBias;
			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
			if ( frustumTest ) {
				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
				float radius = shadowRadius * texelSize.x;
				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
				shadow = (
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
				) * 0.2;
			}
			return mix( 1.0, shadow, shadowIntensity );
		}
	#elif defined( SHADOWMAP_TYPE_VSM )
		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
			float shadow = 1.0;
			shadowCoord.xyz /= shadowCoord.w;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				shadowCoord.z -= shadowBias;
			#else
				shadowCoord.z += shadowBias;
			#endif
			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
			if ( frustumTest ) {
				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
				float mean = distribution.x;
				float variance = distribution.y * distribution.y;
				#ifdef USE_REVERSED_DEPTH_BUFFER
					float hard_shadow = step( mean, shadowCoord.z );
				#else
					float hard_shadow = step( shadowCoord.z, mean );
				#endif
				
				if ( hard_shadow == 1.0 ) {
					shadow = 1.0;
				} else {
					variance = max( variance, 0.0000001 );
					float d = shadowCoord.z - mean;
					float p_max = variance / ( variance + d * d );
					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
					shadow = max( hard_shadow, p_max );
				}
			}
			return mix( 1.0, shadow, shadowIntensity );
		}
	#else
		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
			float shadow = 1.0;
			shadowCoord.xyz /= shadowCoord.w;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				shadowCoord.z -= shadowBias;
			#else
				shadowCoord.z += shadowBias;
			#endif
			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
			if ( frustumTest ) {
				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
				#ifdef USE_REVERSED_DEPTH_BUFFER
					shadow = step( depth, shadowCoord.z );
				#else
					shadow = step( shadowCoord.z, depth );
				#endif
			}
			return mix( 1.0, shadow, shadowIntensity );
		}
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	#if defined( SHADOWMAP_TYPE_PCF )
	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		vec3 bd3D = normalize( lightToPosition );
		vec3 absVec = abs( lightToPosition );
		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
			#ifdef USE_REVERSED_DEPTH_BUFFER
				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
				dp -= shadowBias;
			#else
				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
				dp += shadowBias;
			#endif
			float texelSize = shadowRadius / shadowMapSize.x;
			vec3 absDir = abs( bd3D );
			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
			tangent = normalize( cross( bd3D, tangent ) );
			vec3 bitangent = cross( bd3D, tangent );
			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
			vec2 sample0 = vogelDiskSample( 0, 5, phi );
			vec2 sample1 = vogelDiskSample( 1, 5, phi );
			vec2 sample2 = vogelDiskSample( 2, 5, phi );
			vec2 sample3 = vogelDiskSample( 3, 5, phi );
			vec2 sample4 = vogelDiskSample( 4, 5, phi );
			shadow = (
				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
			) * 0.2;
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	#elif defined( SHADOWMAP_TYPE_BASIC )
	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		vec3 absVec = abs( lightToPosition );
		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			float depth = textureCube( shadowMap, bd3D ).r;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				depth = 1.0 - depth;
			#endif
			shadow = step( dp, depth );
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	#endif
	#endif
#endif`,kMe=`#if NUM_SPOT_LIGHT_COORDS > 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,PMe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
#endif`,IMe=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,DMe=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,OMe=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,LMe=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,zMe=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,jMe=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,FMe=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,UMe=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,BMe=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,HMe=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,VMe=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		#else
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,GMe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,WMe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,$Me=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,qMe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const XMe=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,YMe=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,KMe=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,ZMe=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,QMe=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,JMe=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,e2e=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,t2e=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	#ifdef USE_REVERSED_DEPTH_BUFFER
		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
	#else
		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
	#endif
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,n2e=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,r2e=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
}`,i2e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,s2e=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,a2e=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,o2e=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,l2e=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,c2e=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,u2e=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,d2e=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,f2e=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,h2e=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,p2e=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,m2e=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,g2e=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,v2e=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,x2e=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,y2e=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
 
		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
 
 	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,b2e=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,_2e=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,S2e=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,w2e=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,M2e=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,T2e=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,E2e=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,C2e=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,Tr={alphahash_fragment:Y3e,alphahash_pars_fragment:K3e,alphamap_fragment:Z3e,alphamap_pars_fragment:Q3e,alphatest_fragment:J3e,alphatest_pars_fragment:e4e,aomap_fragment:t4e,aomap_pars_fragment:n4e,batching_pars_vertex:r4e,batching_vertex:i4e,begin_vertex:s4e,beginnormal_vertex:a4e,bsdfs:o4e,iridescence_fragment:l4e,bumpmap_pars_fragment:c4e,clipping_planes_fragment:u4e,clipping_planes_pars_fragment:d4e,clipping_planes_pars_vertex:f4e,clipping_planes_vertex:h4e,color_fragment:p4e,color_pars_fragment:m4e,color_pars_vertex:g4e,color_vertex:v4e,common:x4e,cube_uv_reflection_fragment:y4e,defaultnormal_vertex:b4e,displacementmap_pars_vertex:_4e,displacementmap_vertex:S4e,emissivemap_fragment:w4e,emissivemap_pars_fragment:M4e,colorspace_fragment:T4e,colorspace_pars_fragment:E4e,envmap_fragment:C4e,envmap_common_pars_fragment:A4e,envmap_pars_fragment:N4e,envmap_pars_vertex:R4e,envmap_physical_pars_fragment:B4e,envmap_vertex:k4e,fog_vertex:P4e,fog_pars_vertex:I4e,fog_fragment:D4e,fog_pars_fragment:O4e,gradientmap_pars_fragment:L4e,lightmap_pars_fragment:z4e,lights_lambert_fragment:j4e,lights_lambert_pars_fragment:F4e,lights_pars_begin:U4e,lights_toon_fragment:H4e,lights_toon_pars_fragment:V4e,lights_phong_fragment:G4e,lights_phong_pars_fragment:W4e,lights_physical_fragment:$4e,lights_physical_pars_fragment:q4e,lights_fragment_begin:X4e,lights_fragment_maps:Y4e,lights_fragment_end:K4e,logdepthbuf_fragment:Z4e,logdepthbuf_pars_fragment:Q4e,logdepthbuf_pars_vertex:J4e,logdepthbuf_vertex:eMe,map_fragment:tMe,map_pars_fragment:nMe,map_particle_fragment:rMe,map_particle_pars_fragment:iMe,metalnessmap_fragment:sMe,metalnessmap_pars_fragment:aMe,morphinstance_vertex:oMe,morphcolor_vertex:lMe,morphnormal_vertex:cMe,morphtarget_pars_vertex:uMe,morphtarget_vertex:dMe,normal_fragment_begin:fMe,normal_fragment_maps:hMe,normal_pars_fragment:pMe,normal_pars_vertex:mMe,normal_vertex:gMe,normalmap_pars_fragment:vMe,clearcoat_normal_fragment_begin:xMe,clearcoat_normal_fragment_maps:yMe,clearcoat_pars_fragment:bMe,iridescence_pars_fragment:_Me,opaque_fragment:SMe,packing:wMe,premultiplied_alpha_fragment:MMe,project_vertex:TMe,dithering_fragment:EMe,dithering_pars_fragment:CMe,roughnessmap_fragment:AMe,roughnessmap_pars_fragment:NMe,shadowmap_pars_fragment:RMe,shadowmap_pars_vertex:kMe,shadowmap_vertex:PMe,shadowmask_pars_fragment:IMe,skinbase_vertex:DMe,skinning_pars_vertex:OMe,skinning_vertex:LMe,skinnormal_vertex:zMe,specularmap_fragment:jMe,specularmap_pars_fragment:FMe,tonemapping_fragment:UMe,tonemapping_pars_fragment:BMe,transmission_fragment:HMe,transmission_pars_fragment:VMe,uv_pars_fragment:GMe,uv_pars_vertex:WMe,uv_vertex:$Me,worldpos_vertex:qMe,background_vert:XMe,background_frag:YMe,backgroundCube_vert:KMe,backgroundCube_frag:ZMe,cube_vert:QMe,cube_frag:JMe,depth_vert:e2e,depth_frag:t2e,distance_vert:n2e,distance_frag:r2e,equirect_vert:i2e,equirect_frag:s2e,linedashed_vert:a2e,linedashed_frag:o2e,meshbasic_vert:l2e,meshbasic_frag:c2e,meshlambert_vert:u2e,meshlambert_frag:d2e,meshmatcap_vert:f2e,meshmatcap_frag:h2e,meshnormal_vert:p2e,meshnormal_frag:m2e,meshphong_vert:g2e,meshphong_frag:v2e,meshphysical_vert:x2e,meshphysical_frag:y2e,meshtoon_vert:b2e,meshtoon_frag:_2e,points_vert:S2e,points_frag:w2e,shadow_vert:M2e,shadow_frag:T2e,sprite_vert:E2e,sprite_frag:C2e},pn={common:{diffuse:{value:new xn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new yr},alphaMap:{value:null},alphaMapTransform:{value:new yr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new yr}},envmap:{envMap:{value:null},envMapRotation:{value:new yr},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new yr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new yr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new yr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new yr},normalScale:{value:new zt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new yr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new yr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new yr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new yr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new xn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new xn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new yr},alphaTest:{value:0},uvTransform:{value:new yr}},sprite:{diffuse:{value:new xn(16777215)},opacity:{value:1},center:{value:new zt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new yr},alphaMap:{value:null},alphaMapTransform:{value:new yr},alphaTest:{value:0}}},Dd={basic:{uniforms:Il([pn.common,pn.specularmap,pn.envmap,pn.aomap,pn.lightmap,pn.fog]),vertexShader:Tr.meshbasic_vert,fragmentShader:Tr.meshbasic_frag},lambert:{uniforms:Il([pn.common,pn.specularmap,pn.envmap,pn.aomap,pn.lightmap,pn.emissivemap,pn.bumpmap,pn.normalmap,pn.displacementmap,pn.fog,pn.lights,{emissive:{value:new xn(0)},envMapIntensity:{value:1}}]),vertexShader:Tr.meshlambert_vert,fragmentShader:Tr.meshlambert_frag},phong:{uniforms:Il([pn.common,pn.specularmap,pn.envmap,pn.aomap,pn.lightmap,pn.emissivemap,pn.bumpmap,pn.normalmap,pn.displacementmap,pn.fog,pn.lights,{emissive:{value:new xn(0)},specular:{value:new xn(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Tr.meshphong_vert,fragmentShader:Tr.meshphong_frag},standard:{uniforms:Il([pn.common,pn.envmap,pn.aomap,pn.lightmap,pn.emissivemap,pn.bumpmap,pn.normalmap,pn.displacementmap,pn.roughnessmap,pn.metalnessmap,pn.fog,pn.lights,{emissive:{value:new xn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Tr.meshphysical_vert,fragmentShader:Tr.meshphysical_frag},toon:{uniforms:Il([pn.common,pn.aomap,pn.lightmap,pn.emissivemap,pn.bumpmap,pn.normalmap,pn.displacementmap,pn.gradientmap,pn.fog,pn.lights,{emissive:{value:new xn(0)}}]),vertexShader:Tr.meshtoon_vert,fragmentShader:Tr.meshtoon_frag},matcap:{uniforms:Il([pn.common,pn.bumpmap,pn.normalmap,pn.displacementmap,pn.fog,{matcap:{value:null}}]),vertexShader:Tr.meshmatcap_vert,fragmentShader:Tr.meshmatcap_frag},points:{uniforms:Il([pn.points,pn.fog]),vertexShader:Tr.points_vert,fragmentShader:Tr.points_frag},dashed:{uniforms:Il([pn.common,pn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Tr.linedashed_vert,fragmentShader:Tr.linedashed_frag},depth:{uniforms:Il([pn.common,pn.displacementmap]),vertexShader:Tr.depth_vert,fragmentShader:Tr.depth_frag},normal:{uniforms:Il([pn.common,pn.bumpmap,pn.normalmap,pn.displacementmap,{opacity:{value:1}}]),vertexShader:Tr.meshnormal_vert,fragmentShader:Tr.meshnormal_frag},sprite:{uniforms:Il([pn.sprite,pn.fog]),vertexShader:Tr.sprite_vert,fragmentShader:Tr.sprite_frag},background:{uniforms:{uvTransform:{value:new yr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Tr.background_vert,fragmentShader:Tr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new yr}},vertexShader:Tr.backgroundCube_vert,fragmentShader:Tr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Tr.cube_vert,fragmentShader:Tr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Tr.equirect_vert,fragmentShader:Tr.equirect_frag},distance:{uniforms:Il([pn.common,pn.displacementmap,{referencePosition:{value:new Fe},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Tr.distance_vert,fragmentShader:Tr.distance_frag},shadow:{uniforms:Il([pn.lights,pn.fog,{color:{value:new xn(0)},opacity:{value:1}}]),vertexShader:Tr.shadow_vert,fragmentShader:Tr.shadow_frag}};Dd.physical={uniforms:Il([Dd.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new yr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new yr},clearcoatNormalScale:{value:new zt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new yr},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new yr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new yr},sheen:{value:0},sheenColor:{value:new xn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new yr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new yr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new yr},transmissionSamplerSize:{value:new zt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new yr},attenuationDistance:{value:0},attenuationColor:{value:new xn(0)},specularColor:{value:new xn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new yr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new yr},anisotropyVector:{value:new zt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new yr}}]),vertexShader:Tr.meshphysical_vert,fragmentShader:Tr.meshphysical_frag};const mM={r:0,b:0,g:0},bg=new su,A2e=new rr;function N2e(t,e,n,r,i,s){const a=new xn(0);let o=i===!0?0:1,l,c,d=null,h=0,g=null;function v(E){let A=E.isScene===!0?E.background:null;if(A&&A.isTexture){const N=E.backgroundBlurriness>0;A=e.get(A,N)}return A}function b(E){let A=!1;const N=v(E);N===null?w(a,o):N&&N.isColor&&(w(N,1),A=!0);const D=t.xr.getEnvironmentBlendMode();D==="additive"?n.buffers.color.setClear(0,0,0,1,s):D==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,s),(t.autoClear||A)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function _(E,A){const N=v(A);N&&(N.isCubeTexture||N.mapping===ky)?(c===void 0&&(c=new Us(new Cv(1,1,1),new au({name:"BackgroundCubeMaterial",uniforms:ly(Dd.backgroundCube.uniforms),vertexShader:Dd.backgroundCube.vertexShader,fragmentShader:Dd.backgroundCube.fragmentShader,side:Vl,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(D,P,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),bg.copy(A.backgroundRotation),bg.x*=-1,bg.y*=-1,bg.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(bg.y*=-1,bg.z*=-1),c.material.uniforms.envMap.value=N,c.material.uniforms.flipEnvMap.value=N.isCubeTexture&&N.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(A2e.makeRotationFromEuler(bg)),c.material.toneMapped=ii.getTransfer(N.colorSpace)!==ji,(d!==N||h!==N.version||g!==t.toneMapping)&&(c.material.needsUpdate=!0,d=N,h=N.version,g=t.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null)):N&&N.isTexture&&(l===void 0&&(l=new Us(new Mp(2,2),new au({name:"BackgroundMaterial",uniforms:ly(Dd.background.uniforms),vertexShader:Dd.background.vertexShader,fragmentShader:Dd.background.fragmentShader,side:gp,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=N,l.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,l.material.toneMapped=ii.getTransfer(N.colorSpace)!==ji,N.matrixAutoUpdate===!0&&N.updateMatrix(),l.material.uniforms.uvTransform.value.copy(N.matrix),(d!==N||h!==N.version||g!==t.toneMapping)&&(l.material.needsUpdate=!0,d=N,h=N.version,g=t.toneMapping),l.layers.enableAll(),E.unshift(l,l.geometry,l.material,0,0,null))}function w(E,A){E.getRGB(mM,AY(t)),n.buffers.color.setClear(mM.r,mM.g,mM.b,A,s)}function S(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(E,A=1){a.set(E),o=A,w(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(E){o=E,w(a,o)},render:b,addToRenderList:_,dispose:S}}function R2e(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=g(null);let s=i,a=!1;function o(F,V,G,Z,B){let q=!1;const K=h(F,Z,G,V);s!==K&&(s=K,c(s.object)),q=v(F,Z,G,B),q&&b(F,Z,G,B),B!==null&&e.update(B,t.ELEMENT_ARRAY_BUFFER),(q||a)&&(a=!1,N(F,V,G,Z),B!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(B).buffer))}function l(){return t.createVertexArray()}function c(F){return t.bindVertexArray(F)}function d(F){return t.deleteVertexArray(F)}function h(F,V,G,Z){const B=Z.wireframe===!0;let q=r[V.id];q===void 0&&(q={},r[V.id]=q);const K=F.isInstancedMesh===!0?F.id:0;let Y=q[K];Y===void 0&&(Y={},q[K]=Y);let Q=Y[G.id];Q===void 0&&(Q={},Y[G.id]=Q);let U=Q[B];return U===void 0&&(U=g(l()),Q[B]=U),U}function g(F){const V=[],G=[],Z=[];for(let B=0;B<n;B++)V[B]=0,G[B]=0,Z[B]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:V,enabledAttributes:G,attributeDivisors:Z,object:F,attributes:{},index:null}}function v(F,V,G,Z){const B=s.attributes,q=V.attributes;let K=0;const Y=G.getAttributes();for(const Q in Y)if(Y[Q].location>=0){const j=B[Q];let X=q[Q];if(X===void 0&&(Q==="instanceMatrix"&&F.instanceMatrix&&(X=F.instanceMatrix),Q==="instanceColor"&&F.instanceColor&&(X=F.instanceColor)),j===void 0||j.attribute!==X||X&&j.data!==X.data)return!0;K++}return s.attributesNum!==K||s.index!==Z}function b(F,V,G,Z){const B={},q=V.attributes;let K=0;const Y=G.getAttributes();for(const Q in Y)if(Y[Q].location>=0){let j=q[Q];j===void 0&&(Q==="instanceMatrix"&&F.instanceMatrix&&(j=F.instanceMatrix),Q==="instanceColor"&&F.instanceColor&&(j=F.instanceColor));const X={};X.attribute=j,j&&j.data&&(X.data=j.data),B[Q]=X,K++}s.attributes=B,s.attributesNum=K,s.index=Z}function _(){const F=s.newAttributes;for(let V=0,G=F.length;V<G;V++)F[V]=0}function w(F){S(F,0)}function S(F,V){const G=s.newAttributes,Z=s.enabledAttributes,B=s.attributeDivisors;G[F]=1,Z[F]===0&&(t.enableVertexAttribArray(F),Z[F]=1),B[F]!==V&&(t.vertexAttribDivisor(F,V),B[F]=V)}function E(){const F=s.newAttributes,V=s.enabledAttributes;for(let G=0,Z=V.length;G<Z;G++)V[G]!==F[G]&&(t.disableVertexAttribArray(G),V[G]=0)}function A(F,V,G,Z,B,q,K){K===!0?t.vertexAttribIPointer(F,V,G,B,q):t.vertexAttribPointer(F,V,G,Z,B,q)}function N(F,V,G,Z){_();const B=Z.attributes,q=G.getAttributes(),K=V.defaultAttributeValues;for(const Y in q){const Q=q[Y];if(Q.location>=0){let U=B[Y];if(U===void 0&&(Y==="instanceMatrix"&&F.instanceMatrix&&(U=F.instanceMatrix),Y==="instanceColor"&&F.instanceColor&&(U=F.instanceColor)),U!==void 0){const j=U.normalized,X=U.itemSize,H=e.get(U);if(H===void 0)continue;const ie=H.buffer,ne=H.type,re=H.bytesPerElement,ue=ne===t.INT||ne===t.UNSIGNED_INT||U.gpuType===qT;if(U.isInterleavedBufferAttribute){const le=U.data,fe=le.stride,we=U.offset;if(le.isInstancedInterleavedBuffer){for(let pe=0;pe<Q.locationSize;pe++)S(Q.location+pe,le.meshPerAttribute);F.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=le.meshPerAttribute*le.count)}else for(let pe=0;pe<Q.locationSize;pe++)w(Q.location+pe);t.bindBuffer(t.ARRAY_BUFFER,ie);for(let pe=0;pe<Q.locationSize;pe++)A(Q.location+pe,X/Q.locationSize,ne,j,fe*re,(we+X/Q.locationSize*pe)*re,ue)}else{if(U.isInstancedBufferAttribute){for(let le=0;le<Q.locationSize;le++)S(Q.location+le,U.meshPerAttribute);F.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=U.meshPerAttribute*U.count)}else for(let le=0;le<Q.locationSize;le++)w(Q.location+le);t.bindBuffer(t.ARRAY_BUFFER,ie);for(let le=0;le<Q.locationSize;le++)A(Q.location+le,X/Q.locationSize,ne,j,X*re,X/Q.locationSize*le*re,ue)}}else if(K!==void 0){const j=K[Y];if(j!==void 0)switch(j.length){case 2:t.vertexAttrib2fv(Q.location,j);break;case 3:t.vertexAttrib3fv(Q.location,j);break;case 4:t.vertexAttrib4fv(Q.location,j);break;default:t.vertexAttrib1fv(Q.location,j)}}}}E()}function D(){O();for(const F in r){const V=r[F];for(const G in V){const Z=V[G];for(const B in Z){const q=Z[B];for(const K in q)d(q[K].object),delete q[K];delete Z[B]}}delete r[F]}}function P(F){if(r[F.id]===void 0)return;const V=r[F.id];for(const G in V){const Z=V[G];for(const B in Z){const q=Z[B];for(const K in q)d(q[K].object),delete q[K];delete Z[B]}}delete r[F.id]}function L(F){for(const V in r){const G=r[V];for(const Z in G){const B=G[Z];if(B[F.id]===void 0)continue;const q=B[F.id];for(const K in q)d(q[K].object),delete q[K];delete B[F.id]}}}function R(F){for(const V in r){const G=r[V],Z=F.isInstancedMesh===!0?F.id:0,B=G[Z];if(B!==void 0){for(const q in B){const K=B[q];for(const Y in K)d(K[Y].object),delete K[Y];delete B[q]}delete G[Z],Object.keys(G).length===0&&delete r[V]}}}function O(){W(),a=!0,s!==i&&(s=i,c(s.object))}function W(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:O,resetDefaultState:W,dispose:D,releaseStatesOfGeometry:P,releaseStatesOfObject:R,releaseStatesOfProgram:L,initAttributes:_,enableAttribute:w,disableUnusedAttributes:E}}function k2e(t,e,n){let r;function i(c){r=c}function s(c,d){t.drawArrays(r,c,d),n.update(d,r,1)}function a(c,d,h){h!==0&&(t.drawArraysInstanced(r,c,d,h),n.update(d,r,h))}function o(c,d,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,d,0,h);let v=0;for(let b=0;b<h;b++)v+=d[b];n.update(v,r,1)}function l(c,d,h,g){if(h===0)return;const v=e.get("WEBGL_multi_draw");if(v===null)for(let b=0;b<c.length;b++)a(c[b],d[b],g[b]);else{v.multiDrawArraysInstancedWEBGL(r,c,0,d,0,g,0,h);let b=0;for(let _=0;_<h;_++)b+=d[_]*g[_];n.update(b,r,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function P2e(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const L=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(L){return!(L!==ul&&r.convert(L)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(L){const R=L===ah&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==zl&&r.convert(L)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==Bl&&!R)}function l(L){if(L==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const d=l(c);d!==c&&(hn("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const h=n.logarithmicDepthBuffer===!0,g=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_TEXTURE_SIZE),w=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),S=t.getParameter(t.MAX_VERTEX_ATTRIBS),E=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),A=t.getParameter(t.MAX_VARYING_VECTORS),N=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),D=t.getParameter(t.MAX_SAMPLES),P=t.getParameter(t.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:h,reversedDepthBuffer:g,maxTextures:v,maxVertexTextures:b,maxTextureSize:_,maxCubemapSize:w,maxAttributes:S,maxVertexUniforms:E,maxVaryings:A,maxFragmentUniforms:N,maxSamples:D,samples:P}}function I2e(t){const e=this;let n=null,r=0,i=!1,s=!1;const a=new Jh,o=new yr,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,g){const v=h.length!==0||g||r!==0||i;return i=g,r=h.length,v},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,g){n=d(h,g,0)},this.setState=function(h,g,v){const b=h.clippingPlanes,_=h.clipIntersection,w=h.clipShadows,S=t.get(h);if(!i||b===null||b.length===0||s&&!w)s?d(null):c();else{const E=s?0:r,A=E*4;let N=S.clippingState||null;l.value=N,N=d(b,g,A,v);for(let D=0;D!==A;++D)N[D]=n[D];S.clippingState=N,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(h,g,v,b){const _=h!==null?h.length:0;let w=null;if(_!==0){if(w=l.value,b!==!0||w===null){const S=v+_*4,E=g.matrixWorldInverse;o.getNormalMatrix(E),(w===null||w.length<S)&&(w=new Float32Array(S));for(let A=0,N=v;A!==_;++A,N+=4)a.copy(h[A]).applyMatrix4(E,o),a.normal.toArray(w,N),w[N+3]=a.constant}l.value=w,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,w}}const V0=4,rj=[.125,.215,.35,.446,.526,.582],Ng=20,D2e=256,l_=new Hd,ij=new xn;let _6=null,S6=0,w6=0,M6=!1;const O2e=new Fe;class KR{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,r=.1,i=100,s={}){const{size:a=256,position:o=O2e}=s;_6=this._renderer.getRenderTarget(),S6=this._renderer.getActiveCubeFace(),w6=this._renderer.getActiveMipmapLevel(),M6=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,r,i,l,o),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=oj(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=aj(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(_6,S6,w6),this._renderer.xr.enabled=M6,e.scissorTest=!1,Yx(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===sh||e.mapping===rm?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),_6=this._renderer.getRenderTarget(),S6=this._renderer.getActiveCubeFace(),w6=this._renderer.getActiveMipmapLevel(),M6=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:rs,minFilter:rs,generateMipmaps:!1,type:ah,format:ul,colorSpace:im,depthBuffer:!1},i=sj(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=sj(e,n,r);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=L2e(s)),this._blurMaterial=j2e(s,e,n),this._ggxMaterial=z2e(s,e,n)}return i}_compileMaterial(e){const n=new Us(new br,e);this._renderer.compile(n,l_)}_sceneToCubeUV(e,n,r,i,s){const l=new ea(90,1,n,r),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],h=this._renderer,g=h.autoClear,v=h.toneMapping;h.getClearColor(ij),h.toneMapping=nu,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(i),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Us(new Cv,new wp({name:"PMREM.Background",side:Vl,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,w=_.material;let S=!1;const E=e.background;E?E.isColor&&(w.color.copy(E),e.background=null,S=!0):(w.color.copy(ij),S=!0);for(let A=0;A<6;A++){const N=A%3;N===0?(l.up.set(0,c[A],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+d[A],s.y,s.z)):N===1?(l.up.set(0,0,c[A]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+d[A],s.z)):(l.up.set(0,c[A],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+d[A]));const D=this._cubeSize;Yx(i,N*D,A>2?D:0,D,D),h.setRenderTarget(i),S&&h.render(_,l),h.render(e,l)}h.toneMapping=v,h.autoClear=g,e.background=E}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===sh||e.mapping===rm;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=oj()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=aj());const s=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Yx(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(a,l_)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);n.autoClear=r}_applyGGXFilter(e,n,r){const i=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[r];o.material=a;const l=a.uniforms,c=r/(this._lodMeshes.length-1),d=n/(this._lodMeshes.length-1),h=Math.sqrt(c*c-d*d),g=0+c*1.25,v=h*g,{_lodMax:b}=this,_=this._sizeLods[r],w=3*_*(r>b-V0?r-b+V0:0),S=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=v,l.mipInt.value=b-n,Yx(s,w,S,3*_,2*_),i.setRenderTarget(s),i.render(o,l_),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=b-r,Yx(e,w,S,3*_,2*_),i.setRenderTarget(e),i.render(o,l_)}_blur(e,n,r,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,n,r,i,"latitudinal",s),this._halfBlur(a,e,r,r,i,"longitudinal",s)}_halfBlur(e,n,r,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Hn("blur direction must be either latitudinal or longitudinal!");const d=3,h=this._lodMeshes[i];h.material=c;const g=c.uniforms,v=this._sizeLods[r]-1,b=isFinite(s)?Math.PI/(2*v):2*Math.PI/(2*Ng-1),_=s/b,w=isFinite(s)?1+Math.floor(d*_):Ng;w>Ng&&hn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${Ng}`);const S=[];let E=0;for(let L=0;L<Ng;++L){const R=L/_,O=Math.exp(-R*R/2);S.push(O),L===0?E+=O:L<w&&(E+=2*O)}for(let L=0;L<S.length;L++)S[L]=S[L]/E;g.envMap.value=e.texture,g.samples.value=w,g.weights.value=S,g.latitudinal.value=a==="latitudinal",o&&(g.poleAxis.value=o);const{_lodMax:A}=this;g.dTheta.value=b,g.mipInt.value=A-r;const N=this._sizeLods[i],D=3*N*(i>A-V0?i-A+V0:0),P=4*(this._cubeSize-N);Yx(n,D,P,3*N,2*N),l.setRenderTarget(n),l.render(h,l_)}}function L2e(t){const e=[],n=[],r=[];let i=t;const s=t-V0+1+rj.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>t-V0?l=rj[a-t+V0-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),d=-c,h=1+c,g=[d,d,h,d,h,h,d,d,h,h,d,h],v=6,b=6,_=3,w=2,S=1,E=new Float32Array(_*b*v),A=new Float32Array(w*b*v),N=new Float32Array(S*b*v);for(let P=0;P<v;P++){const L=P%3*2/3-1,R=P>2?0:-1,O=[L,R,0,L+2/3,R,0,L+2/3,R+1,0,L,R,0,L+2/3,R+1,0,L,R+1,0];E.set(O,_*b*P),A.set(g,w*b*P);const W=[P,P,P,P,P,P];N.set(W,S*b*P)}const D=new br;D.setAttribute("position",new Vi(E,_)),D.setAttribute("uv",new Vi(A,w)),D.setAttribute("faceIndex",new Vi(N,S)),r.push(new Us(D,null)),i>V0&&i--}return{lodMeshes:r,sizeLods:e,sigmas:n}}function sj(t,e,n){const r=new iu(t,e,n);return r.texture.mapping=ky,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Yx(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function z2e(t,e,n){return new au({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:D2e,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:AE(),fragmentShader:`

			precision highp float;
			precision highp int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform float roughness;
			uniform float mipInt;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			#define PI 3.14159265359

			// Van der Corput radical inverse
			float radicalInverse_VdC(uint bits) {
				bits = (bits << 16u) | (bits >> 16u);
				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
			}

			// Hammersley sequence
			vec2 hammersley(uint i, uint N) {
				return vec2(float(i) / float(N), radicalInverse_VdC(i));
			}

			// GGX VNDF importance sampling (Eric Heitz 2018)
			// "Sampling the GGX Distribution of Visible Normals"
			// https://jcgt.org/published/0007/04/01/
			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
				float alpha = roughness * roughness;

				// Section 4.1: Orthonormal basis
				vec3 T1 = vec3(1.0, 0.0, 0.0);
				vec3 T2 = cross(V, T1);

				// Section 4.2: Parameterization of projected area
				float r = sqrt(Xi.x);
				float phi = 2.0 * PI * Xi.y;
				float t1 = r * cos(phi);
				float t2 = r * sin(phi);
				float s = 0.5 * (1.0 + V.z);
				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;

				// Section 4.3: Reprojection onto hemisphere
				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;

				// Section 3.4: Transform back to ellipsoid configuration
				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
			}

			void main() {
				vec3 N = normalize(vOutputDirection);
				vec3 V = N; // Assume view direction equals normal for pre-filtering

				vec3 prefilteredColor = vec3(0.0);
				float totalWeight = 0.0;

				// For very low roughness, just sample the environment directly
				if (roughness < 0.001) {
					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
					return;
				}

				// Tangent space basis for VNDF sampling
				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
				vec3 tangent = normalize(cross(up, N));
				vec3 bitangent = cross(N, tangent);

				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));

					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);

					// Transform H back to world space
					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
					vec3 L = normalize(2.0 * dot(V, H) * H - V);

					float NdotL = max(dot(N, L), 0.0);

					if(NdotL > 0.0) {
						// Sample environment at fixed mip level
						// VNDF importance sampling handles the distribution filtering
						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);

						// Weight by NdotL for the split-sum approximation
						// VNDF PDF naturally accounts for the visible microfacet distribution
						prefilteredColor += sampleColor * NdotL;
						totalWeight += NdotL;
					}
				}

				if (totalWeight > 0.0) {
					prefilteredColor = prefilteredColor / totalWeight;
				}

				gl_FragColor = vec4(prefilteredColor, 1.0);
			}
		`,blending:th,depthTest:!1,depthWrite:!1})}function j2e(t,e,n){const r=new Float32Array(Ng),i=new Fe(0,1,0);return new au({name:"SphericalGaussianBlur",defines:{n:Ng,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:AE(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i < n; i++ ) {

					if ( i >= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

			}
		`,blending:th,depthTest:!1,depthWrite:!1})}function aj(){return new au({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:AE(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include <common>

			void main() {

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );

			}
		`,blending:th,depthTest:!1,depthWrite:!1})}function oj(){return new au({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:AE(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );

			}
		`,blending:th,depthTest:!1,depthWrite:!1})}function AE(){return`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`}class N9 extends iu{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new _w(i),this._setTextureOptions(n),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},i=new Cv(5,5,5),s=new au({name:"CubemapFromEquirect",uniforms:ly(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Vl,blending:th});s.uniforms.tEquirect.value=n;const a=new Us(i,s),o=n.minFilter;return n.minFilter===Kf&&(n.minFilter=rs),new KY(1,10,this).update(e,a),n.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,n=!0,r=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(n,r,i);e.setRenderTarget(s)}}function F2e(t){let e=new WeakMap,n=new WeakMap,r=null;function i(g,v=!1){return g==null?null:v?a(g):s(g)}function s(g){if(g&&g.isTexture){const v=g.mapping;if(v===L_||v===z_)if(e.has(g)){const b=e.get(g).texture;return o(b,g.mapping)}else{const b=g.image;if(b&&b.height>0){const _=new N9(b.height);return _.fromEquirectangularTexture(t,g),e.set(g,_),g.addEventListener("dispose",c),o(_.texture,g.mapping)}else return null}}return g}function a(g){if(g&&g.isTexture){const v=g.mapping,b=v===L_||v===z_,_=v===sh||v===rm;if(b||_){let w=n.get(g);const S=w!==void 0?w.texture.pmremVersion:0;if(g.isRenderTargetTexture&&g.pmremVersion!==S)return r===null&&(r=new KR(t)),w=b?r.fromEquirectangular(g,w):r.fromCubemap(g,w),w.texture.pmremVersion=g.pmremVersion,n.set(g,w),w.texture;if(w!==void 0)return w.texture;{const E=g.image;return b&&E&&E.height>0||_&&E&&l(E)?(r===null&&(r=new KR(t)),w=b?r.fromEquirectangular(g):r.fromCubemap(g),w.texture.pmremVersion=g.pmremVersion,n.set(g,w),g.addEventListener("dispose",d),w.texture):null}}}return g}function o(g,v){return v===L_?g.mapping=sh:v===z_&&(g.mapping=rm),g}function l(g){let v=0;const b=6;for(let _=0;_<b;_++)g[_]!==void 0&&v++;return v===b}function c(g){const v=g.target;v.removeEventListener("dispose",c);const b=e.get(v);b!==void 0&&(e.delete(v),b.dispose())}function d(g){const v=g.target;v.removeEventListener("dispose",d);const b=n.get(v);b!==void 0&&(n.delete(v),b.dispose())}function h(){e=new WeakMap,n=new WeakMap,r!==null&&(r.dispose(),r=null)}return{get:i,dispose:h}}function U2e(t){const e={};function n(r){if(e[r]!==void 0)return e[r];const i=t.getExtension(r);return e[r]=i,i}return{has:function(r){return n(r)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(r){const i=n(r);return i===null&&TS("WebGLRenderer: "+r+" extension not supported."),i}}}function B2e(t,e,n,r){const i={},s=new WeakMap;function a(h){const g=h.target;g.index!==null&&e.remove(g.index);for(const b in g.attributes)e.remove(g.attributes[b]);g.removeEventListener("dispose",a),delete i[g.id];const v=s.get(g);v&&(e.remove(v),s.delete(g)),r.releaseStatesOfGeometry(g),g.isInstancedBufferGeometry===!0&&delete g._maxInstanceCount,n.memory.geometries--}function o(h,g){return i[g.id]===!0||(g.addEventListener("dispose",a),i[g.id]=!0,n.memory.geometries++),g}function l(h){const g=h.attributes;for(const v in g)e.update(g[v],t.ARRAY_BUFFER)}function c(h){const g=[],v=h.index,b=h.attributes.position;let _=0;if(b===void 0)return;if(v!==null){const E=v.array;_=v.version;for(let A=0,N=E.length;A<N;A+=3){const D=E[A+0],P=E[A+1],L=E[A+2];g.push(D,P,P,L,L,D)}}else{const E=b.array;_=b.version;for(let A=0,N=E.length/3-1;A<N;A+=3){const D=A+0,P=A+1,L=A+2;g.push(D,P,P,L,L,D)}}const w=new(b.count>=65535?r9:n9)(g,1);w.version=_;const S=s.get(h);S&&e.remove(S),s.set(h,w)}function d(h){const g=s.get(h);if(g){const v=h.index;v!==null&&g.version<v.version&&c(h)}else c(h);return s.get(h)}return{get:o,update:l,getWireframeAttribute:d}}function H2e(t,e,n){let r;function i(g){r=g}let s,a;function o(g){s=g.type,a=g.bytesPerElement}function l(g,v){t.drawElements(r,v,s,g*a),n.update(v,r,1)}function c(g,v,b){b!==0&&(t.drawElementsInstanced(r,v,s,g*a,b),n.update(v,r,b))}function d(g,v,b){if(b===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,v,0,s,g,0,b);let w=0;for(let S=0;S<b;S++)w+=v[S];n.update(w,r,1)}function h(g,v,b,_){if(b===0)return;const w=e.get("WEBGL_multi_draw");if(w===null)for(let S=0;S<g.length;S++)c(g[S]/a,v[S],_[S]);else{w.multiDrawElementsInstancedWEBGL(r,v,0,s,g,0,_,0,b);let S=0;for(let E=0;E<b;E++)S+=v[E]*_[E];n.update(S,r,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=h}function V2e(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,a,o){switch(n.calls++,a){case t.TRIANGLES:n.triangles+=o*(s/3);break;case t.LINES:n.lines+=o*(s/2);break;case t.LINE_STRIP:n.lines+=o*(s-1);break;case t.LINE_LOOP:n.lines+=o*s;break;case t.POINTS:n.points+=o*s;break;default:Hn("WebGLInfo: Unknown draw mode:",a);break}}function i(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:i,update:r}}function G2e(t,e,n){const r=new WeakMap,i=new ci;function s(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=d!==void 0?d.length:0;let g=r.get(o);if(g===void 0||g.count!==h){let W=function(){R.dispose(),r.delete(o),o.removeEventListener("dispose",W)};var v=W;g!==void 0&&g.texture.dispose();const b=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,w=o.morphAttributes.color!==void 0,S=o.morphAttributes.position||[],E=o.morphAttributes.normal||[],A=o.morphAttributes.color||[];let N=0;b===!0&&(N=1),_===!0&&(N=2),w===!0&&(N=3);let D=o.attributes.position.count*N,P=1;D>e.maxTextureSize&&(P=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const L=new Float32Array(D*P*4*h),R=new nE(L,D,P,h);R.type=Bl,R.needsUpdate=!0;const O=N*4;for(let F=0;F<h;F++){const V=S[F],G=E[F],Z=A[F],B=D*P*4*F;for(let q=0;q<V.count;q++){const K=q*O;b===!0&&(i.fromBufferAttribute(V,q),L[B+K+0]=i.x,L[B+K+1]=i.y,L[B+K+2]=i.z,L[B+K+3]=0),_===!0&&(i.fromBufferAttribute(G,q),L[B+K+4]=i.x,L[B+K+5]=i.y,L[B+K+6]=i.z,L[B+K+7]=0),w===!0&&(i.fromBufferAttribute(Z,q),L[B+K+8]=i.x,L[B+K+9]=i.y,L[B+K+10]=i.z,L[B+K+11]=Z.itemSize===4?i.w:1)}}g={count:h,texture:R,size:new zt(D,P)},r.set(o,g),o.addEventListener("dispose",W)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",a.morphTexture,n);else{let b=0;for(let w=0;w<c.length;w++)b+=c[w];const _=o.morphTargetsRelative?1:1-b;l.getUniforms().setValue(t,"morphTargetBaseInfluence",_),l.getUniforms().setValue(t,"morphTargetInfluences",c)}l.getUniforms().setValue(t,"morphTargetsTexture",g.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",g.size)}return{update:s}}function W2e(t,e,n,r,i){let s=new WeakMap;function a(c){const d=i.render.frame,h=c.geometry,g=e.get(c,h);if(s.get(g)!==d&&(e.update(g),s.set(g,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==d&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),s.set(c,d))),c.isSkinnedMesh){const v=c.skeleton;s.get(v)!==d&&(v.update(),s.set(v,d))}return g}function o(){s=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),r.releaseStatesOfObject(d),n.remove(d.instanceMatrix),d.instanceColor!==null&&n.remove(d.instanceColor)}return{update:a,dispose:o}}const $2e={[Fk]:"LINEAR_TONE_MAPPING",[Uk]:"REINHARD_TONE_MAPPING",[Bk]:"CINEON_TONE_MAPPING",[WT]:"ACES_FILMIC_TONE_MAPPING",[Vk]:"AGX_TONE_MAPPING",[Gk]:"NEUTRAL_TONE_MAPPING",[Hk]:"CUSTOM_TONE_MAPPING"};function q2e(t,e,n,r,i){const s=new iu(e,n,{type:t,depthBuffer:r,stencilBuffer:i}),a=new iu(e,n,{type:ah,depthBuffer:!1,stencilBuffer:!1}),o=new br;o.setAttribute("position",new Cn([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new Cn([0,2,0,0,2,0],2));const l=new g9({uniforms:{tDiffuse:{value:null}},vertexShader:`
			precision highp float;

			uniform mat4 modelViewMatrix;
			uniform mat4 projectionMatrix;

			attribute vec3 position;
			attribute vec2 uv;

			varying vec2 vUv;

			void main() {
				vUv = uv;
				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
			}`,fragmentShader:`
			precision highp float;

			uniform sampler2D tDiffuse;

			varying vec2 vUv;

			#include <tonemapping_pars_fragment>
			#include <colorspace_pars_fragment>

			void main() {
				gl_FragColor = texture2D( tDiffuse, vUv );

				#ifdef LINEAR_TONE_MAPPING
					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
				#elif defined( REINHARD_TONE_MAPPING )
					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
				#elif defined( CINEON_TONE_MAPPING )
					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
				#elif defined( ACES_FILMIC_TONE_MAPPING )
					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
				#elif defined( AGX_TONE_MAPPING )
					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
				#elif defined( NEUTRAL_TONE_MAPPING )
					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
				#elif defined( CUSTOM_TONE_MAPPING )
					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
				#endif

				#ifdef SRGB_TRANSFER
					gl_FragColor = sRGBTransferOETF( gl_FragColor );
				#endif
			}`,depthTest:!1,depthWrite:!1}),c=new Us(o,l),d=new Hd(-1,1,1,-1,0,1);let h=null,g=null,v=!1,b,_=null,w=[],S=!1;this.setSize=function(E,A){s.setSize(E,A),a.setSize(E,A);for(let N=0;N<w.length;N++){const D=w[N];D.setSize&&D.setSize(E,A)}},this.setEffects=function(E){w=E,S=w.length>0&&w[0].isRenderPass===!0;const A=s.width,N=s.height;for(let D=0;D<w.length;D++){const P=w[D];P.setSize&&P.setSize(A,N)}},this.begin=function(E,A){if(v||E.toneMapping===nu&&w.length===0)return!1;if(_=A,A!==null){const N=A.width,D=A.height;(s.width!==N||s.height!==D)&&this.setSize(N,D)}return S===!1&&E.setRenderTarget(s),b=E.toneMapping,E.toneMapping=nu,!0},this.hasRenderPass=function(){return S},this.end=function(E,A){E.toneMapping=b,v=!0;let N=s,D=a;for(let P=0;P<w.length;P++){const L=w[P];if(L.enabled!==!1&&(L.render(E,D,N,A),L.needsSwap!==!1)){const R=N;N=D,D=R}}if(h!==E.outputColorSpace||g!==E.toneMapping){h=E.outputColorSpace,g=E.toneMapping,l.defines={},ii.getTransfer(h)===ji&&(l.defines.SRGB_TRANSFER="");const P=$2e[g];P&&(l.defines[P]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=N.texture,E.setRenderTarget(_),E.render(c,d),_=null,v=!1},this.isCompositing=function(){return v},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),l.dispose()}}const oK=new ra,ZR=new ay(1,1),lK=new nE,cK=new rE,uK=new _w,lj=[],cj=[],uj=new Float32Array(16),dj=new Float32Array(9),fj=new Float32Array(4);function Dy(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=lj[i];if(s===void 0&&(s=new Float32Array(i),lj[i]=s),e!==0){r.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=n,t[a].toArray(s,o)}return s}function ao(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function oo(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function NE(t,e){let n=cj[e];n===void 0&&(n=new Int32Array(e),cj[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function X2e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function Y2e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ao(n,e))return;t.uniform2fv(this.addr,e),oo(n,e)}}function K2e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(ao(n,e))return;t.uniform3fv(this.addr,e),oo(n,e)}}function Z2e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ao(n,e))return;t.uniform4fv(this.addr,e),oo(n,e)}}function Q2e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ao(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),oo(n,e)}else{if(ao(n,r))return;fj.set(r),t.uniformMatrix2fv(this.addr,!1,fj),oo(n,r)}}function J2e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ao(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),oo(n,e)}else{if(ao(n,r))return;dj.set(r),t.uniformMatrix3fv(this.addr,!1,dj),oo(n,r)}}function e5e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(ao(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),oo(n,e)}else{if(ao(n,r))return;uj.set(r),t.uniformMatrix4fv(this.addr,!1,uj),oo(n,r)}}function t5e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function n5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ao(n,e))return;t.uniform2iv(this.addr,e),oo(n,e)}}function r5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ao(n,e))return;t.uniform3iv(this.addr,e),oo(n,e)}}function i5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ao(n,e))return;t.uniform4iv(this.addr,e),oo(n,e)}}function s5e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function a5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(ao(n,e))return;t.uniform2uiv(this.addr,e),oo(n,e)}}function o5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(ao(n,e))return;t.uniform3uiv(this.addr,e),oo(n,e)}}function l5e(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(ao(n,e))return;t.uniform4uiv(this.addr,e),oo(n,e)}}function c5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i);let s;this.type===t.SAMPLER_2D_SHADOW?(ZR.compareFunction=n.isReversedDepthBuffer()?tE:eE,s=ZR):s=oK,n.setTexture2D(e||s,i)}function u5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||cK,i)}function d5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||uK,i)}function f5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||lK,i)}function h5e(t){switch(t){case 5126:return X2e;case 35664:return Y2e;case 35665:return K2e;case 35666:return Z2e;case 35674:return Q2e;case 35675:return J2e;case 35676:return e5e;case 5124:case 35670:return t5e;case 35667:case 35671:return n5e;case 35668:case 35672:return r5e;case 35669:case 35673:return i5e;case 5125:return s5e;case 36294:return a5e;case 36295:return o5e;case 36296:return l5e;case 35678:case 36198:case 36298:case 36306:case 35682:return c5e;case 35679:case 36299:case 36307:return u5e;case 35680:case 36300:case 36308:case 36293:return d5e;case 36289:case 36303:case 36311:case 36292:return f5e}}function p5e(t,e){t.uniform1fv(this.addr,e)}function m5e(t,e){const n=Dy(e,this.size,2);t.uniform2fv(this.addr,n)}function g5e(t,e){const n=Dy(e,this.size,3);t.uniform3fv(this.addr,n)}function v5e(t,e){const n=Dy(e,this.size,4);t.uniform4fv(this.addr,n)}function x5e(t,e){const n=Dy(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function y5e(t,e){const n=Dy(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function b5e(t,e){const n=Dy(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function _5e(t,e){t.uniform1iv(this.addr,e)}function S5e(t,e){t.uniform2iv(this.addr,e)}function w5e(t,e){t.uniform3iv(this.addr,e)}function M5e(t,e){t.uniform4iv(this.addr,e)}function T5e(t,e){t.uniform1uiv(this.addr,e)}function E5e(t,e){t.uniform2uiv(this.addr,e)}function C5e(t,e){t.uniform3uiv(this.addr,e)}function A5e(t,e){t.uniform4uiv(this.addr,e)}function N5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);ao(r,s)||(t.uniform1iv(this.addr,s),oo(r,s));let a;this.type===t.SAMPLER_2D_SHADOW?a=ZR:a=oK;for(let o=0;o!==i;++o)n.setTexture2D(e[o]||a,s[o])}function R5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);ao(r,s)||(t.uniform1iv(this.addr,s),oo(r,s));for(let a=0;a!==i;++a)n.setTexture3D(e[a]||cK,s[a])}function k5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);ao(r,s)||(t.uniform1iv(this.addr,s),oo(r,s));for(let a=0;a!==i;++a)n.setTextureCube(e[a]||uK,s[a])}function P5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);ao(r,s)||(t.uniform1iv(this.addr,s),oo(r,s));for(let a=0;a!==i;++a)n.setTexture2DArray(e[a]||lK,s[a])}function I5e(t){switch(t){case 5126:return p5e;case 35664:return m5e;case 35665:return g5e;case 35666:return v5e;case 35674:return x5e;case 35675:return y5e;case 35676:return b5e;case 5124:case 35670:return _5e;case 35667:case 35671:return S5e;case 35668:case 35672:return w5e;case 35669:case 35673:return M5e;case 5125:return T5e;case 36294:return E5e;case 36295:return C5e;case 36296:return A5e;case 35678:case 36198:case 36298:case 36306:case 35682:return N5e;case 35679:case 36299:case 36307:return R5e;case 35680:case 36300:case 36308:case 36293:return k5e;case 36289:case 36303:case 36311:case 36292:return P5e}}class D5e{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=h5e(n.type)}}class O5e{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=I5e(n.type)}}class L5e{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,n[o.id],r)}}}const T6=/(\w+)(\])?(\[|\.)?/g;function hj(t,e){t.seq.push(e),t.map[e.id]=e}function z5e(t,e,n){const r=t.name,i=r.length;for(T6.lastIndex=0;;){const s=T6.exec(r),a=T6.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){hj(n,c===void 0?new D5e(o,t,e):new O5e(o,t,e));break}else{let h=n.map[o];h===void 0&&(h=new L5e(o),hj(n,h)),n=h}}}class HM{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let a=0;a<r;++a){const o=e.getActiveUniform(n,a),l=e.getUniformLocation(n,o.name);z5e(o,l,this)}const i=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):s.push(a);i.length>0&&(this.seq=i.concat(s))}setValue(e,n,r,i){const s=this.map[n];s!==void 0&&s.setValue(e,r,i)}setOptional(e,n,r){const i=n[r];i!==void 0&&this.setValue(e,r,i)}static upload(e,n,r,i){for(let s=0,a=n.length;s!==a;++s){const o=n[s],l=r[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,n){const r=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in n&&r.push(a)}return r}}function pj(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const j5e=37297;let F5e=0;function U5e(t,e){const n=t.split(`
`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let a=i;a<s;a++){const o=a+1;r.push(`${o===e?">":" "} ${o}: ${n[a]}`)}return r.join(`
`)}const mj=new yr;function B5e(t){ii._getMatrix(mj,ii.workingColorSpace,t);const e=`mat3( ${mj.elements.map(n=>n.toFixed(4))} )`;switch(ii.getTransfer(t)){case _S:return[e,"LinearTransferOETF"];case ji:return[e,"sRGBTransferOETF"];default:return hn("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function gj(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),s=(t.getShaderInfoLog(e)||"").trim();if(r&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return n.toUpperCase()+`

`+s+`

`+U5e(t.getShaderSource(e),o)}else return s}function H5e(t,e){const n=B5e(e);return[`vec4 ${t}( vec4 value ) {`,`	return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
`)}const V5e={[Fk]:"Linear",[Uk]:"Reinhard",[Bk]:"Cineon",[WT]:"ACESFilmic",[Vk]:"AgX",[Gk]:"Neutral",[Hk]:"Custom"};function G5e(t,e){const n=V5e[e];return n===void 0?(hn("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+t+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const gM=new Fe;function W5e(){ii.getLuminanceCoefficients(gM);const t=gM.x.toFixed(4),e=gM.y.toFixed(4),n=gM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${t}, ${e}, ${n} );`,"	return dot( weights, rgb );","}"].join(`
`)}function $5e(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(S_).join(`
`)}function q5e(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
`)}function X5e(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=t.getActiveAttrib(e,i),a=s.name;let o=1;s.type===t.FLOAT_MAT2&&(o=2),s.type===t.FLOAT_MAT3&&(o=3),s.type===t.FLOAT_MAT4&&(o=4),n[a]={type:s.type,location:t.getAttribLocation(e,a),locationSize:o}}return n}function S_(t){return t!==""}function vj(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function xj(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Y5e=/^[ \t]*#include +<([\w\d./]+)>/gm;function QR(t){return t.replace(Y5e,Z5e)}const K5e=new Map;function Z5e(t,e){let n=Tr[e];if(n===void 0){const r=K5e.get(e);if(r!==void 0)n=Tr[r],hn('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return QR(n)}const Q5e=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function yj(t){return t.replace(Q5e,J5e)}function J5e(t,e,n,r){let i="";for(let s=parseInt(e);s<parseInt(n);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function bj(t){let e=`precision ${t.precision} float;
	precision ${t.precision} int;
	precision ${t.precision} sampler2D;
	precision ${t.precision} samplerCube;
	precision ${t.precision} sampler3D;
	precision ${t.precision} sampler2DArray;
	precision ${t.precision} sampler2DShadow;
	precision ${t.precision} samplerCubeShadow;
	precision ${t.precision} sampler2DArrayShadow;
	precision ${t.precision} isampler2D;
	precision ${t.precision} isampler3D;
	precision ${t.precision} isamplerCube;
	precision ${t.precision} isampler2DArray;
	precision ${t.precision} usampler2D;
	precision ${t.precision} usampler3D;
	precision ${t.precision} usamplerCube;
	precision ${t.precision} usampler2DArray;
	`;return t.precision==="highp"?e+=`
#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}const eTe={[S1]:"SHADOWMAP_TYPE_PCF",[Pg]:"SHADOWMAP_TYPE_VSM"};function tTe(t){return eTe[t.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const nTe={[sh]:"ENVMAP_TYPE_CUBE",[rm]:"ENVMAP_TYPE_CUBE",[ky]:"ENVMAP_TYPE_CUBE_UV"};function rTe(t){return t.envMap===!1?"ENVMAP_TYPE_CUBE":nTe[t.envMapMode]||"ENVMAP_TYPE_CUBE"}const iTe={[rm]:"ENVMAP_MODE_REFRACTION"};function sTe(t){return t.envMap===!1?"ENVMAP_MODE_REFLECTION":iTe[t.envMapMode]||"ENVMAP_MODE_REFLECTION"}const aTe={[yw]:"ENVMAP_BLENDING_MULTIPLY",[BX]:"ENVMAP_BLENDING_MIX",[HX]:"ENVMAP_BLENDING_ADD"};function oTe(t){return t.envMap===!1?"ENVMAP_BLENDING_NONE":aTe[t.combine]||"ENVMAP_BLENDING_NONE"}function lTe(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}function cTe(t,e,n,r){const i=t.getContext(),s=n.defines;let a=n.vertexShader,o=n.fragmentShader;const l=tTe(n),c=rTe(n),d=sTe(n),h=oTe(n),g=lTe(n),v=$5e(n),b=q5e(s),_=i.createProgram();let w,S,E=n.glslVersion?"#version "+n.glslVersion+`
`:"";n.isRawShaderMaterial?(w=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(S_).join(`
`),w.length>0&&(w+=`
`),S=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(S_).join(`
`),S.length>0&&(S+=`
`)):(w=[bj(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(S_).join(`
`),S=[bj(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+h:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==nu?"#define TONE_MAPPING":"",n.toneMapping!==nu?Tr.tonemapping_pars_fragment:"",n.toneMapping!==nu?G5e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Tr.colorspace_pars_fragment,H5e("linearToOutputTexel",n.outputColorSpace),W5e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
`].filter(S_).join(`
`)),a=QR(a),a=vj(a,n),a=xj(a,n),o=QR(o),o=vj(o,n),o=xj(o,n),a=yj(a),o=yj(o),n.isRawShaderMaterial!==!0&&(E=`#version 300 es
`,w=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+w,S=["#define varying in",n.glslVersion===BR?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===BR?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
`+S);const A=E+w+a,N=E+S+o,D=pj(i,i.VERTEX_SHADER,A),P=pj(i,i.FRAGMENT_SHADER,N);i.attachShader(_,D),i.attachShader(_,P),n.index0AttributeName!==void 0?i.bindAttribLocation(_,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function L(F){if(t.debug.checkShaderErrors){const V=i.getProgramInfoLog(_)||"",G=i.getShaderInfoLog(D)||"",Z=i.getShaderInfoLog(P)||"",B=V.trim(),q=G.trim(),K=Z.trim();let Y=!0,Q=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(Y=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,_,D,P);else{const U=gj(i,D,"vertex"),j=gj(i,P,"fragment");Hn("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`

Material Name: `+F.name+`
Material Type: `+F.type+`

Program Info Log: `+B+`
`+U+`
`+j)}else B!==""?hn("WebGLProgram: Program Info Log:",B):(q===""||K==="")&&(Q=!1);Q&&(F.diagnostics={runnable:Y,programLog:B,vertexShader:{log:q,prefix:w},fragmentShader:{log:K,prefix:S}})}i.deleteShader(D),i.deleteShader(P),R=new HM(i,_),O=X5e(i,_)}let R;this.getUniforms=function(){return R===void 0&&L(this),R};let O;this.getAttributes=function(){return O===void 0&&L(this),O};let W=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return W===!1&&(W=i.getProgramParameter(_,j5e)),W},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=F5e++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=D,this.fragmentShader=P,this}let uTe=0;class dTe{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new fTe(e),n.set(e,r)),r}}class fTe{constructor(e){this.id=uTe++,this.code=e,this.usedTimes=0}}function hTe(t,e,n,r,i,s){const a=new sy,o=new dTe,l=new Set,c=[],d=new Map,h=r.logarithmicDepthBuffer;let g=r.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function b(R){return l.add(R),R===0?"uv":`uv${R}`}function _(R,O,W,F,V){const G=F.fog,Z=V.geometry,B=R.isMeshStandardMaterial||R.isMeshLambertMaterial||R.isMeshPhongMaterial?F.environment:null,q=R.isMeshStandardMaterial||R.isMeshLambertMaterial&&!R.envMap||R.isMeshPhongMaterial&&!R.envMap,K=e.get(R.envMap||B,q),Y=K&&K.mapping===ky?K.image.height:null,Q=v[R.type];R.precision!==null&&(g=r.getMaxPrecision(R.precision),g!==R.precision&&hn("WebGLProgram.getParameters:",R.precision,"not supported, using",g,"instead."));const U=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,j=U!==void 0?U.length:0;let X=0;Z.morphAttributes.position!==void 0&&(X=1),Z.morphAttributes.normal!==void 0&&(X=2),Z.morphAttributes.color!==void 0&&(X=3);let H,ie,ne,re;if(Q){const et=Dd[Q];H=et.vertexShader,ie=et.fragmentShader}else H=R.vertexShader,ie=R.fragmentShader,o.update(R),ne=o.getVertexShaderID(R),re=o.getFragmentShaderID(R);const ue=t.getRenderTarget(),le=t.state.buffers.depth.getReversed(),fe=V.isInstancedMesh===!0,we=V.isBatchedMesh===!0,pe=!!R.map,xe=!!R.matcap,Ve=!!K,ye=!!R.aoMap,Oe=!!R.lightMap,he=!!R.bumpMap,Re=!!R.normalMap,oe=!!R.displacementMap,Ue=!!R.emissiveMap,Ee=!!R.metalnessMap,Pe=!!R.roughnessMap,Ze=R.anisotropy>0,ae=R.clearcoat>0,te=R.dispersion>0,be=R.iridescence>0,me=R.sheen>0,ge=R.transmission>0,ke=Ze&&!!R.anisotropyMap,Xe=ae&&!!R.clearcoatMap,Ae=ae&&!!R.clearcoatNormalMap,je=ae&&!!R.clearcoatRoughnessMap,We=be&&!!R.iridescenceMap,De=be&&!!R.iridescenceThicknessMap,Be=me&&!!R.sheenColorMap,qe=me&&!!R.sheenRoughnessMap,Se=!!R.specularMap,Ye=!!R.specularColorMap,dt=!!R.specularIntensityMap,Le=ge&&!!R.transmissionMap,st=ge&&!!R.thicknessMap,ft=!!R.gradientMap,mt=!!R.alphaMap,tt=R.alphaTest>0,Qe=!!R.alphaHash,ze=!!R.extensions;let Te=nu;R.toneMapped&&(ue===null||ue.isXRRenderTarget===!0)&&(Te=t.toneMapping);const He={shaderID:Q,shaderType:R.type,shaderName:R.name,vertexShader:H,fragmentShader:ie,defines:R.defines,customVertexShaderID:ne,customFragmentShaderID:re,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:g,batching:we,batchingColor:we&&V._colorsTexture!==null,instancing:fe,instancingColor:fe&&V.instanceColor!==null,instancingMorph:fe&&V.morphTexture!==null,outputColorSpace:ue===null?t.outputColorSpace:ue.isXRRenderTarget===!0?ue.texture.colorSpace:im,alphaToCoverage:!!R.alphaToCoverage,map:pe,matcap:xe,envMap:Ve,envMapMode:Ve&&K.mapping,envMapCubeUVHeight:Y,aoMap:ye,lightMap:Oe,bumpMap:he,normalMap:Re,displacementMap:oe,emissiveMap:Ue,normalMapObjectSpace:Re&&R.normalMapType===YX,normalMapTangentSpace:Re&&R.normalMapType===xm,metalnessMap:Ee,roughnessMap:Pe,anisotropy:Ze,anisotropyMap:ke,clearcoat:ae,clearcoatMap:Xe,clearcoatNormalMap:Ae,clearcoatRoughnessMap:je,dispersion:te,iridescence:be,iridescenceMap:We,iridescenceThicknessMap:De,sheen:me,sheenColorMap:Be,sheenRoughnessMap:qe,specularMap:Se,specularColorMap:Ye,specularIntensityMap:dt,transmission:ge,transmissionMap:Le,thicknessMap:st,gradientMap:ft,opaque:R.transparent===!1&&R.blending===qg&&R.alphaToCoverage===!1,alphaMap:mt,alphaTest:tt,alphaHash:Qe,combine:R.combine,mapUv:pe&&b(R.map.channel),aoMapUv:ye&&b(R.aoMap.channel),lightMapUv:Oe&&b(R.lightMap.channel),bumpMapUv:he&&b(R.bumpMap.channel),normalMapUv:Re&&b(R.normalMap.channel),displacementMapUv:oe&&b(R.displacementMap.channel),emissiveMapUv:Ue&&b(R.emissiveMap.channel),metalnessMapUv:Ee&&b(R.metalnessMap.channel),roughnessMapUv:Pe&&b(R.roughnessMap.channel),anisotropyMapUv:ke&&b(R.anisotropyMap.channel),clearcoatMapUv:Xe&&b(R.clearcoatMap.channel),clearcoatNormalMapUv:Ae&&b(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:je&&b(R.clearcoatRoughnessMap.channel),iridescenceMapUv:We&&b(R.iridescenceMap.channel),iridescenceThicknessMapUv:De&&b(R.iridescenceThicknessMap.channel),sheenColorMapUv:Be&&b(R.sheenColorMap.channel),sheenRoughnessMapUv:qe&&b(R.sheenRoughnessMap.channel),specularMapUv:Se&&b(R.specularMap.channel),specularColorMapUv:Ye&&b(R.specularColorMap.channel),specularIntensityMapUv:dt&&b(R.specularIntensityMap.channel),transmissionMapUv:Le&&b(R.transmissionMap.channel),thicknessMapUv:st&&b(R.thicknessMap.channel),alphaMapUv:mt&&b(R.alphaMap.channel),vertexTangents:!!Z.attributes.tangent&&(Re||Ze),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,pointsUvs:V.isPoints===!0&&!!Z.attributes.uv&&(pe||mt),fog:!!G,useFog:R.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:R.wireframe===!1&&(R.flatShading===!0||Z.attributes.normal===void 0&&Re===!1&&(R.isMeshLambertMaterial||R.isMeshPhongMaterial||R.isMeshStandardMaterial||R.isMeshPhysicalMaterial)),sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:le,skinning:V.isSkinnedMesh===!0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:j,morphTextureStride:X,numDirLights:O.directional.length,numPointLights:O.point.length,numSpotLights:O.spot.length,numSpotLightMaps:O.spotLightMap.length,numRectAreaLights:O.rectArea.length,numHemiLights:O.hemi.length,numDirLightShadows:O.directionalShadowMap.length,numPointLightShadows:O.pointShadowMap.length,numSpotLightShadows:O.spotShadowMap.length,numSpotLightShadowsWithMaps:O.numSpotLightShadowsWithMaps,numLightProbes:O.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:R.dithering,shadowMapEnabled:t.shadowMap.enabled&&W.length>0,shadowMapType:t.shadowMap.type,toneMapping:Te,decodeVideoTexture:pe&&R.map.isVideoTexture===!0&&ii.getTransfer(R.map.colorSpace)===ji,decodeVideoTextureEmissive:Ue&&R.emissiveMap.isVideoTexture===!0&&ii.getTransfer(R.emissiveMap.colorSpace)===ji,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===Xc,flipSided:R.side===Vl,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionClipCullDistance:ze&&R.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ze&&R.extensions.multiDraw===!0||we)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()};return He.vertexUv1s=l.has(1),He.vertexUv2s=l.has(2),He.vertexUv3s=l.has(3),l.clear(),He}function w(R){const O=[];if(R.shaderID?O.push(R.shaderID):(O.push(R.customVertexShaderID),O.push(R.customFragmentShaderID)),R.defines!==void 0)for(const W in R.defines)O.push(W),O.push(R.defines[W]);return R.isRawShaderMaterial===!1&&(S(O,R),E(O,R),O.push(t.outputColorSpace)),O.push(R.customProgramCacheKey),O.join()}function S(R,O){R.push(O.precision),R.push(O.outputColorSpace),R.push(O.envMapMode),R.push(O.envMapCubeUVHeight),R.push(O.mapUv),R.push(O.alphaMapUv),R.push(O.lightMapUv),R.push(O.aoMapUv),R.push(O.bumpMapUv),R.push(O.normalMapUv),R.push(O.displacementMapUv),R.push(O.emissiveMapUv),R.push(O.metalnessMapUv),R.push(O.roughnessMapUv),R.push(O.anisotropyMapUv),R.push(O.clearcoatMapUv),R.push(O.clearcoatNormalMapUv),R.push(O.clearcoatRoughnessMapUv),R.push(O.iridescenceMapUv),R.push(O.iridescenceThicknessMapUv),R.push(O.sheenColorMapUv),R.push(O.sheenRoughnessMapUv),R.push(O.specularMapUv),R.push(O.specularColorMapUv),R.push(O.specularIntensityMapUv),R.push(O.transmissionMapUv),R.push(O.thicknessMapUv),R.push(O.combine),R.push(O.fogExp2),R.push(O.sizeAttenuation),R.push(O.morphTargetsCount),R.push(O.morphAttributeCount),R.push(O.numDirLights),R.push(O.numPointLights),R.push(O.numSpotLights),R.push(O.numSpotLightMaps),R.push(O.numHemiLights),R.push(O.numRectAreaLights),R.push(O.numDirLightShadows),R.push(O.numPointLightShadows),R.push(O.numSpotLightShadows),R.push(O.numSpotLightShadowsWithMaps),R.push(O.numLightProbes),R.push(O.shadowMapType),R.push(O.toneMapping),R.push(O.numClippingPlanes),R.push(O.numClipIntersection),R.push(O.depthPacking)}function E(R,O){a.disableAll(),O.instancing&&a.enable(0),O.instancingColor&&a.enable(1),O.instancingMorph&&a.enable(2),O.matcap&&a.enable(3),O.envMap&&a.enable(4),O.normalMapObjectSpace&&a.enable(5),O.normalMapTangentSpace&&a.enable(6),O.clearcoat&&a.enable(7),O.iridescence&&a.enable(8),O.alphaTest&&a.enable(9),O.vertexColors&&a.enable(10),O.vertexAlphas&&a.enable(11),O.vertexUv1s&&a.enable(12),O.vertexUv2s&&a.enable(13),O.vertexUv3s&&a.enable(14),O.vertexTangents&&a.enable(15),O.anisotropy&&a.enable(16),O.alphaHash&&a.enable(17),O.batching&&a.enable(18),O.dispersion&&a.enable(19),O.batchingColor&&a.enable(20),O.gradientMap&&a.enable(21),R.push(a.mask),a.disableAll(),O.fog&&a.enable(0),O.useFog&&a.enable(1),O.flatShading&&a.enable(2),O.logarithmicDepthBuffer&&a.enable(3),O.reversedDepthBuffer&&a.enable(4),O.skinning&&a.enable(5),O.morphTargets&&a.enable(6),O.morphNormals&&a.enable(7),O.morphColors&&a.enable(8),O.premultipliedAlpha&&a.enable(9),O.shadowMapEnabled&&a.enable(10),O.doubleSided&&a.enable(11),O.flipSided&&a.enable(12),O.useDepthPacking&&a.enable(13),O.dithering&&a.enable(14),O.transmission&&a.enable(15),O.sheen&&a.enable(16),O.opaque&&a.enable(17),O.pointsUvs&&a.enable(18),O.decodeVideoTexture&&a.enable(19),O.decodeVideoTextureEmissive&&a.enable(20),O.alphaToCoverage&&a.enable(21),R.push(a.mask)}function A(R){const O=v[R.type];let W;if(O){const F=Dd[O];W=NS.clone(F.uniforms)}else W=R.uniforms;return W}function N(R,O){let W=d.get(O);return W!==void 0?++W.usedTimes:(W=new cTe(t,O,R,i),c.push(W),d.set(O,W)),W}function D(R){if(--R.usedTimes===0){const O=c.indexOf(R);c[O]=c[c.length-1],c.pop(),d.delete(R.cacheKey),R.destroy()}}function P(R){o.remove(R)}function L(){o.dispose()}return{getParameters:_,getProgramCacheKey:w,getUniforms:A,acquireProgram:N,releaseProgram:D,releaseShaderCache:P,programs:c,dispose:L}}function pTe(){let t=new WeakMap;function e(a){return t.has(a)}function n(a){let o=t.get(a);return o===void 0&&(o={},t.set(a,o)),o}function r(a){t.delete(a)}function i(a,o,l){t.get(a)[o]=l}function s(){t=new WeakMap}return{has:e,get:n,remove:r,update:i,dispose:s}}function mTe(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.materialVariant!==e.materialVariant?t.materialVariant-e.materialVariant:t.z!==e.z?t.z-e.z:t.id-e.id}function _j(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Sj(){const t=[];let e=0;const n=[],r=[],i=[];function s(){e=0,n.length=0,r.length=0,i.length=0}function a(g){let v=0;return g.isInstancedMesh&&(v+=2),g.isSkinnedMesh&&(v+=1),v}function o(g,v,b,_,w,S){let E=t[e];return E===void 0?(E={id:g.id,object:g,geometry:v,material:b,materialVariant:a(g),groupOrder:_,renderOrder:g.renderOrder,z:w,group:S},t[e]=E):(E.id=g.id,E.object=g,E.geometry=v,E.material=b,E.materialVariant=a(g),E.groupOrder=_,E.renderOrder=g.renderOrder,E.z=w,E.group=S),e++,E}function l(g,v,b,_,w,S){const E=o(g,v,b,_,w,S);b.transmission>0?r.push(E):b.transparent===!0?i.push(E):n.push(E)}function c(g,v,b,_,w,S){const E=o(g,v,b,_,w,S);b.transmission>0?r.unshift(E):b.transparent===!0?i.unshift(E):n.unshift(E)}function d(g,v){n.length>1&&n.sort(g||mTe),r.length>1&&r.sort(v||_j),i.length>1&&i.sort(v||_j)}function h(){for(let g=e,v=t.length;g<v;g++){const b=t[g];if(b.id===null)break;b.id=null,b.object=null,b.geometry=null,b.material=null,b.group=null}}return{opaque:n,transmissive:r,transparent:i,init:s,push:l,unshift:c,finish:h,sort:d}}function gTe(){let t=new WeakMap;function e(r,i){const s=t.get(r);let a;return s===void 0?(a=new Sj,t.set(r,[a])):i>=s.length?(a=new Sj,s.push(a)):a=s[i],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function vTe(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Fe,color:new xn};break;case"SpotLight":n={position:new Fe,direction:new Fe,color:new xn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Fe,color:new xn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Fe,skyColor:new xn,groundColor:new xn};break;case"RectAreaLight":n={color:new xn,position:new Fe,halfWidth:new Fe,halfHeight:new Fe};break}return t[e.id]=n,n}}}function xTe(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new zt};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new zt};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new zt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let yTe=0;function bTe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function _Te(t){const e=new vTe,n=xTe(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new Fe);const i=new Fe,s=new rr,a=new rr;function o(c){let d=0,h=0,g=0;for(let O=0;O<9;O++)r.probe[O].set(0,0,0);let v=0,b=0,_=0,w=0,S=0,E=0,A=0,N=0,D=0,P=0,L=0;c.sort(bTe);for(let O=0,W=c.length;O<W;O++){const F=c[O],V=F.color,G=F.intensity,Z=F.distance;let B=null;if(F.shadow&&F.shadow.map&&(F.shadow.map.texture.format===cv?B=F.shadow.map.texture:B=F.shadow.map.depthTexture||F.shadow.map.texture),F.isAmbientLight)d+=V.r*G,h+=V.g*G,g+=V.b*G;else if(F.isLightProbe){for(let q=0;q<9;q++)r.probe[q].addScaledVector(F.sh.coefficients[q],G);L++}else if(F.isDirectionalLight){const q=e.get(F);if(q.color.copy(F.color).multiplyScalar(F.intensity),F.castShadow){const K=F.shadow,Y=n.get(F);Y.shadowIntensity=K.intensity,Y.shadowBias=K.bias,Y.shadowNormalBias=K.normalBias,Y.shadowRadius=K.radius,Y.shadowMapSize=K.mapSize,r.directionalShadow[v]=Y,r.directionalShadowMap[v]=B,r.directionalShadowMatrix[v]=F.shadow.matrix,E++}r.directional[v]=q,v++}else if(F.isSpotLight){const q=e.get(F);q.position.setFromMatrixPosition(F.matrixWorld),q.color.copy(V).multiplyScalar(G),q.distance=Z,q.coneCos=Math.cos(F.angle),q.penumbraCos=Math.cos(F.angle*(1-F.penumbra)),q.decay=F.decay,r.spot[_]=q;const K=F.shadow;if(F.map&&(r.spotLightMap[D]=F.map,D++,K.updateMatrices(F),F.castShadow&&P++),r.spotLightMatrix[_]=K.matrix,F.castShadow){const Y=n.get(F);Y.shadowIntensity=K.intensity,Y.shadowBias=K.bias,Y.shadowNormalBias=K.normalBias,Y.shadowRadius=K.radius,Y.shadowMapSize=K.mapSize,r.spotShadow[_]=Y,r.spotShadowMap[_]=B,N++}_++}else if(F.isRectAreaLight){const q=e.get(F);q.color.copy(V).multiplyScalar(G),q.halfWidth.set(F.width*.5,0,0),q.halfHeight.set(0,F.height*.5,0),r.rectArea[w]=q,w++}else if(F.isPointLight){const q=e.get(F);if(q.color.copy(F.color).multiplyScalar(F.intensity),q.distance=F.distance,q.decay=F.decay,F.castShadow){const K=F.shadow,Y=n.get(F);Y.shadowIntensity=K.intensity,Y.shadowBias=K.bias,Y.shadowNormalBias=K.normalBias,Y.shadowRadius=K.radius,Y.shadowMapSize=K.mapSize,Y.shadowCameraNear=K.camera.near,Y.shadowCameraFar=K.camera.far,r.pointShadow[b]=Y,r.pointShadowMap[b]=B,r.pointShadowMatrix[b]=F.shadow.matrix,A++}r.point[b]=q,b++}else if(F.isHemisphereLight){const q=e.get(F);q.skyColor.copy(F.color).multiplyScalar(G),q.groundColor.copy(F.groundColor).multiplyScalar(G),r.hemi[S]=q,S++}}w>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=pn.LTC_FLOAT_1,r.rectAreaLTC2=pn.LTC_FLOAT_2):(r.rectAreaLTC1=pn.LTC_HALF_1,r.rectAreaLTC2=pn.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=h,r.ambient[2]=g;const R=r.hash;(R.directionalLength!==v||R.pointLength!==b||R.spotLength!==_||R.rectAreaLength!==w||R.hemiLength!==S||R.numDirectionalShadows!==E||R.numPointShadows!==A||R.numSpotShadows!==N||R.numSpotMaps!==D||R.numLightProbes!==L)&&(r.directional.length=v,r.spot.length=_,r.rectArea.length=w,r.point.length=b,r.hemi.length=S,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=A,r.pointShadowMap.length=A,r.spotShadow.length=N,r.spotShadowMap.length=N,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=A,r.spotLightMatrix.length=N+D-P,r.spotLightMap.length=D,r.numSpotLightShadowsWithMaps=P,r.numLightProbes=L,R.directionalLength=v,R.pointLength=b,R.spotLength=_,R.rectAreaLength=w,R.hemiLength=S,R.numDirectionalShadows=E,R.numPointShadows=A,R.numSpotShadows=N,R.numSpotMaps=D,R.numLightProbes=L,r.version=yTe++)}function l(c,d){let h=0,g=0,v=0,b=0,_=0;const w=d.matrixWorldInverse;for(let S=0,E=c.length;S<E;S++){const A=c[S];if(A.isDirectionalLight){const N=r.directional[h];N.direction.setFromMatrixPosition(A.matrixWorld),i.setFromMatrixPosition(A.target.matrixWorld),N.direction.sub(i),N.direction.transformDirection(w),h++}else if(A.isSpotLight){const N=r.spot[v];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(w),N.direction.setFromMatrixPosition(A.matrixWorld),i.setFromMatrixPosition(A.target.matrixWorld),N.direction.sub(i),N.direction.transformDirection(w),v++}else if(A.isRectAreaLight){const N=r.rectArea[b];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(w),a.identity(),s.copy(A.matrixWorld),s.premultiply(w),a.extractRotation(s),N.halfWidth.set(A.width*.5,0,0),N.halfHeight.set(0,A.height*.5,0),N.halfWidth.applyMatrix4(a),N.halfHeight.applyMatrix4(a),b++}else if(A.isPointLight){const N=r.point[g];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(w),g++}else if(A.isHemisphereLight){const N=r.hemi[_];N.direction.setFromMatrixPosition(A.matrixWorld),N.direction.transformDirection(w),_++}}}return{setup:o,setupView:l,state:r}}function wj(t){const e=new _Te(t),n=[],r=[];function i(d){c.camera=d,n.length=0,r.length=0}function s(d){n.push(d)}function a(d){r.push(d)}function o(){e.setup(n)}function l(d){e.setupView(n,d)}const c={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function STe(t){let e=new WeakMap;function n(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new wj(t),e.set(i,[o])):s>=a.length?(o=new wj(t),a.push(o)):o=a[s],o}function r(){e=new WeakMap}return{get:n,dispose:r}}const wTe=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,MTe=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
void main() {
	const float samples = float( VSM_SAMPLES );
	float mean = 0.0;
	float squared_mean = 0.0;
	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
	for ( float i = 0.0; i < samples; i ++ ) {
		float uvOffset = uvStart + i * uvStride;
		#ifdef HORIZONTAL_PASS
			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
}`,TTe=[new Fe(1,0,0),new Fe(-1,0,0),new Fe(0,1,0),new Fe(0,-1,0),new Fe(0,0,1),new Fe(0,0,-1)],ETe=[new Fe(0,-1,0),new Fe(0,-1,0),new Fe(0,0,1),new Fe(0,0,-1),new Fe(0,-1,0),new Fe(0,-1,0)],Mj=new rr,c_=new Fe,E6=new Fe;function CTe(t,e,n){let r=new Py;const i=new zt,s=new zt,a=new ci,o=new wE,l=new ME,c={},d=n.maxTextureSize,h={[gp]:Vl,[Vl]:gp,[Xc]:Xc},g=new au({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new zt},radius:{value:4}},vertexShader:wTe,fragmentShader:MTe}),v=g.clone();v.defines.HORIZONTAL_PASS=1;const b=new br;b.setAttribute("position",new Vi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Us(b,g),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=S1;let S=this.type;this.render=function(P,L,R){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||P.length===0)return;this.type===O_&&(hn("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=S1);const O=t.getRenderTarget(),W=t.getActiveCubeFace(),F=t.getActiveMipmapLevel(),V=t.state;V.setBlending(th),V.buffers.depth.getReversed()===!0?V.buffers.color.setClear(0,0,0,0):V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const G=S!==this.type;G&&L.traverse(function(Z){Z.material&&(Array.isArray(Z.material)?Z.material.forEach(B=>B.needsUpdate=!0):Z.material.needsUpdate=!0)});for(let Z=0,B=P.length;Z<B;Z++){const q=P[Z],K=q.shadow;if(K===void 0){hn("WebGLShadowMap:",q,"has no shadow.");continue}if(K.autoUpdate===!1&&K.needsUpdate===!1)continue;i.copy(K.mapSize);const Y=K.getFrameExtents();i.multiply(Y),s.copy(K.mapSize),(i.x>d||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/Y.x),i.x=s.x*Y.x,K.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/Y.y),i.y=s.y*Y.y,K.mapSize.y=s.y));const Q=t.state.buffers.depth.getReversed();if(K.camera._reversedDepth=Q,K.map===null||G===!0){if(K.map!==null&&(K.map.depthTexture!==null&&(K.map.depthTexture.dispose(),K.map.depthTexture=null),K.map.dispose()),this.type===Pg){if(q.isPointLight){hn("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}K.map=new iu(i.x,i.y,{format:cv,type:ah,minFilter:rs,magFilter:rs,generateMipmaps:!1}),K.map.texture.name=q.name+".shadowMap",K.map.depthTexture=new ay(i.x,i.y,Bl),K.map.depthTexture.name=q.name+".shadowMapDepth",K.map.depthTexture.format=oh,K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=Ea,K.map.depthTexture.magFilter=Ea}else q.isPointLight?(K.map=new N9(i.x),K.map.depthTexture=new vY(i.x,Ku)):(K.map=new iu(i.x,i.y),K.map.depthTexture=new ay(i.x,i.y,Ku)),K.map.depthTexture.name=q.name+".shadowMap",K.map.depthTexture.format=oh,this.type===S1?(K.map.depthTexture.compareFunction=Q?tE:eE,K.map.depthTexture.minFilter=rs,K.map.depthTexture.magFilter=rs):(K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=Ea,K.map.depthTexture.magFilter=Ea);K.camera.updateProjectionMatrix()}const U=K.map.isWebGLCubeRenderTarget?6:1;for(let j=0;j<U;j++){if(K.map.isWebGLCubeRenderTarget)t.setRenderTarget(K.map,j),t.clear();else{j===0&&(t.setRenderTarget(K.map),t.clear());const X=K.getViewport(j);a.set(s.x*X.x,s.y*X.y,s.x*X.z,s.y*X.w),V.viewport(a)}if(q.isPointLight){const X=K.camera,H=K.matrix,ie=q.distance||X.far;ie!==X.far&&(X.far=ie,X.updateProjectionMatrix()),c_.setFromMatrixPosition(q.matrixWorld),X.position.copy(c_),E6.copy(X.position),E6.add(TTe[j]),X.up.copy(ETe[j]),X.lookAt(E6),X.updateMatrixWorld(),H.makeTranslation(-c_.x,-c_.y,-c_.z),Mj.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),K._frustum.setFromProjectionMatrix(Mj,X.coordinateSystem,X.reversedDepth)}else K.updateMatrices(q);r=K.getFrustum(),N(L,R,K.camera,q,this.type)}K.isPointLightShadow!==!0&&this.type===Pg&&E(K,R),K.needsUpdate=!1}S=this.type,w.needsUpdate=!1,t.setRenderTarget(O,W,F)};function E(P,L){const R=e.update(_);g.defines.VSM_SAMPLES!==P.blurSamples&&(g.defines.VSM_SAMPLES=P.blurSamples,v.defines.VSM_SAMPLES=P.blurSamples,g.needsUpdate=!0,v.needsUpdate=!0),P.mapPass===null&&(P.mapPass=new iu(i.x,i.y,{format:cv,type:ah})),g.uniforms.shadow_pass.value=P.map.depthTexture,g.uniforms.resolution.value=P.mapSize,g.uniforms.radius.value=P.radius,t.setRenderTarget(P.mapPass),t.clear(),t.renderBufferDirect(L,null,R,g,_,null),v.uniforms.shadow_pass.value=P.mapPass.texture,v.uniforms.resolution.value=P.mapSize,v.uniforms.radius.value=P.radius,t.setRenderTarget(P.map),t.clear(),t.renderBufferDirect(L,null,R,v,_,null)}function A(P,L,R,O){let W=null;const F=R.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(F!==void 0)W=F;else if(W=R.isPointLight===!0?l:o,t.localClippingEnabled&&L.clipShadows===!0&&Array.isArray(L.clippingPlanes)&&L.clippingPlanes.length!==0||L.displacementMap&&L.displacementScale!==0||L.alphaMap&&L.alphaTest>0||L.map&&L.alphaTest>0||L.alphaToCoverage===!0){const V=W.uuid,G=L.uuid;let Z=c[V];Z===void 0&&(Z={},c[V]=Z);let B=Z[G];B===void 0&&(B=W.clone(),Z[G]=B,L.addEventListener("dispose",D)),W=B}if(W.visible=L.visible,W.wireframe=L.wireframe,O===Pg?W.side=L.shadowSide!==null?L.shadowSide:L.side:W.side=L.shadowSide!==null?L.shadowSide:h[L.side],W.alphaMap=L.alphaMap,W.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,W.map=L.map,W.clipShadows=L.clipShadows,W.clippingPlanes=L.clippingPlanes,W.clipIntersection=L.clipIntersection,W.displacementMap=L.displacementMap,W.displacementScale=L.displacementScale,W.displacementBias=L.displacementBias,W.wireframeLinewidth=L.wireframeLinewidth,W.linewidth=L.linewidth,R.isPointLight===!0&&W.isMeshDistanceMaterial===!0){const V=t.properties.get(W);V.light=R}return W}function N(P,L,R,O,W){if(P.visible===!1)return;if(P.layers.test(L.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&W===Pg)&&(!P.frustumCulled||r.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,P.matrixWorld);const G=e.update(P),Z=P.material;if(Array.isArray(Z)){const B=G.groups;for(let q=0,K=B.length;q<K;q++){const Y=B[q],Q=Z[Y.materialIndex];if(Q&&Q.visible){const U=A(P,Q,O,W);P.onBeforeShadow(t,P,L,R,G,U,Y),t.renderBufferDirect(R,null,G,U,P,Y),P.onAfterShadow(t,P,L,R,G,U,Y)}}}else if(Z.visible){const B=A(P,Z,O,W);P.onBeforeShadow(t,P,L,R,G,B,null),t.renderBufferDirect(R,null,G,B,P,null),P.onAfterShadow(t,P,L,R,G,B,null)}}const V=P.children;for(let G=0,Z=V.length;G<Z;G++)N(V[G],L,R,O,W)}function D(P){P.target.removeEventListener("dispose",D);for(const R in c){const O=c[R],W=P.target.uuid;W in O&&(O[W].dispose(),delete O[W])}}}function ATe(t,e){function n(){let Le=!1;const st=new ci;let ft=null;const mt=new ci(0,0,0,0);return{setMask:function(tt){ft!==tt&&!Le&&(t.colorMask(tt,tt,tt,tt),ft=tt)},setLocked:function(tt){Le=tt},setClear:function(tt,Qe,ze,Te,He){He===!0&&(tt*=Te,Qe*=Te,ze*=Te),st.set(tt,Qe,ze,Te),mt.equals(st)===!1&&(t.clearColor(tt,Qe,ze,Te),mt.copy(st))},reset:function(){Le=!1,ft=null,mt.set(-1,0,0,0)}}}function r(){let Le=!1,st=!1,ft=null,mt=null,tt=null;return{setReversed:function(Qe){if(st!==Qe){const ze=e.get("EXT_clip_control");Qe?ze.clipControlEXT(ze.LOWER_LEFT_EXT,ze.ZERO_TO_ONE_EXT):ze.clipControlEXT(ze.LOWER_LEFT_EXT,ze.NEGATIVE_ONE_TO_ONE_EXT),st=Qe;const Te=tt;tt=null,this.setClear(Te)}},getReversed:function(){return st},setTest:function(Qe){Qe?ue(t.DEPTH_TEST):le(t.DEPTH_TEST)},setMask:function(Qe){ft!==Qe&&!Le&&(t.depthMask(Qe),ft=Qe)},setFunc:function(Qe){if(st&&(Qe=J_e[Qe]),mt!==Qe){switch(Qe){case P2:t.depthFunc(t.NEVER);break;case I2:t.depthFunc(t.ALWAYS);break;case D2:t.depthFunc(t.LESS);break;case lv:t.depthFunc(t.LEQUAL);break;case O2:t.depthFunc(t.EQUAL);break;case L2:t.depthFunc(t.GEQUAL);break;case z2:t.depthFunc(t.GREATER);break;case j2:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}mt=Qe}},setLocked:function(Qe){Le=Qe},setClear:function(Qe){tt!==Qe&&(tt=Qe,st&&(Qe=1-Qe),t.clearDepth(Qe))},reset:function(){Le=!1,ft=null,mt=null,tt=null,st=!1}}}function i(){let Le=!1,st=null,ft=null,mt=null,tt=null,Qe=null,ze=null,Te=null,He=null;return{setTest:function(et){Le||(et?ue(t.STENCIL_TEST):le(t.STENCIL_TEST))},setMask:function(et){st!==et&&!Le&&(t.stencilMask(et),st=et)},setFunc:function(et,ht,ct){(ft!==et||mt!==ht||tt!==ct)&&(t.stencilFunc(et,ht,ct),ft=et,mt=ht,tt=ct)},setOp:function(et,ht,ct){(Qe!==et||ze!==ht||Te!==ct)&&(t.stencilOp(et,ht,ct),Qe=et,ze=ht,Te=ct)},setLocked:function(et){Le=et},setClear:function(et){He!==et&&(t.clearStencil(et),He=et)},reset:function(){Le=!1,st=null,ft=null,mt=null,tt=null,Qe=null,ze=null,Te=null,He=null}}}const s=new n,a=new r,o=new i,l=new WeakMap,c=new WeakMap;let d={},h={},g=new WeakMap,v=[],b=null,_=!1,w=null,S=null,E=null,A=null,N=null,D=null,P=null,L=new xn(0,0,0),R=0,O=!1,W=null,F=null,V=null,G=null,Z=null;const B=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,K=0;const Y=t.getParameter(t.VERSION);Y.indexOf("WebGL")!==-1?(K=parseFloat(/^WebGL (\d)/.exec(Y)[1]),q=K>=1):Y.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),q=K>=2);let Q=null,U={};const j=t.getParameter(t.SCISSOR_BOX),X=t.getParameter(t.VIEWPORT),H=new ci().fromArray(j),ie=new ci().fromArray(X);function ne(Le,st,ft,mt){const tt=new Uint8Array(4),Qe=t.createTexture();t.bindTexture(Le,Qe),t.texParameteri(Le,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(Le,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let ze=0;ze<ft;ze++)Le===t.TEXTURE_3D||Le===t.TEXTURE_2D_ARRAY?t.texImage3D(st,0,t.RGBA,1,1,mt,0,t.RGBA,t.UNSIGNED_BYTE,tt):t.texImage2D(st+ze,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,tt);return Qe}const re={};re[t.TEXTURE_2D]=ne(t.TEXTURE_2D,t.TEXTURE_2D,1),re[t.TEXTURE_CUBE_MAP]=ne(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),re[t.TEXTURE_2D_ARRAY]=ne(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),re[t.TEXTURE_3D]=ne(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ue(t.DEPTH_TEST),a.setFunc(lv),he(!1),Re(DR),ue(t.CULL_FACE),ye(th);function ue(Le){d[Le]!==!0&&(t.enable(Le),d[Le]=!0)}function le(Le){d[Le]!==!1&&(t.disable(Le),d[Le]=!1)}function fe(Le,st){return h[Le]!==st?(t.bindFramebuffer(Le,st),h[Le]=st,Le===t.DRAW_FRAMEBUFFER&&(h[t.FRAMEBUFFER]=st),Le===t.FRAMEBUFFER&&(h[t.DRAW_FRAMEBUFFER]=st),!0):!1}function we(Le,st){let ft=v,mt=!1;if(Le){ft=g.get(st),ft===void 0&&(ft=[],g.set(st,ft));const tt=Le.textures;if(ft.length!==tt.length||ft[0]!==t.COLOR_ATTACHMENT0){for(let Qe=0,ze=tt.length;Qe<ze;Qe++)ft[Qe]=t.COLOR_ATTACHMENT0+Qe;ft.length=tt.length,mt=!0}}else ft[0]!==t.BACK&&(ft[0]=t.BACK,mt=!0);mt&&t.drawBuffers(ft)}function pe(Le){return b!==Le?(t.useProgram(Le),b=Le,!0):!1}const xe={[A0]:t.FUNC_ADD,[MX]:t.FUNC_SUBTRACT,[TX]:t.FUNC_REVERSE_SUBTRACT};xe[EX]=t.MIN,xe[CX]=t.MAX;const Ve={[AX]:t.ZERO,[NX]:t.ONE,[RX]:t.SRC_COLOR,[R2]:t.SRC_ALPHA,[LX]:t.SRC_ALPHA_SATURATE,[DX]:t.DST_COLOR,[PX]:t.DST_ALPHA,[kX]:t.ONE_MINUS_SRC_COLOR,[k2]:t.ONE_MINUS_SRC_ALPHA,[OX]:t.ONE_MINUS_DST_COLOR,[IX]:t.ONE_MINUS_DST_ALPHA,[zX]:t.CONSTANT_COLOR,[jX]:t.ONE_MINUS_CONSTANT_COLOR,[FX]:t.CONSTANT_ALPHA,[UX]:t.ONE_MINUS_CONSTANT_ALPHA};function ye(Le,st,ft,mt,tt,Qe,ze,Te,He,et){if(Le===th){_===!0&&(le(t.BLEND),_=!1);return}if(_===!1&&(ue(t.BLEND),_=!0),Le!==wX){if(Le!==w||et!==O){if((S!==A0||N!==A0)&&(t.blendEquation(t.FUNC_ADD),S=A0,N=A0),et)switch(Le){case qg:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case OR:t.blendFunc(t.ONE,t.ONE);break;case LR:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case zR:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:Hn("WebGLState: Invalid blending: ",Le);break}else switch(Le){case qg:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case OR:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case LR:Hn("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case zR:Hn("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Hn("WebGLState: Invalid blending: ",Le);break}E=null,A=null,D=null,P=null,L.set(0,0,0),R=0,w=Le,O=et}return}tt=tt||st,Qe=Qe||ft,ze=ze||mt,(st!==S||tt!==N)&&(t.blendEquationSeparate(xe[st],xe[tt]),S=st,N=tt),(ft!==E||mt!==A||Qe!==D||ze!==P)&&(t.blendFuncSeparate(Ve[ft],Ve[mt],Ve[Qe],Ve[ze]),E=ft,A=mt,D=Qe,P=ze),(Te.equals(L)===!1||He!==R)&&(t.blendColor(Te.r,Te.g,Te.b,He),L.copy(Te),R=He),w=Le,O=!1}function Oe(Le,st){Le.side===Xc?le(t.CULL_FACE):ue(t.CULL_FACE);let ft=Le.side===Vl;st&&(ft=!ft),he(ft),Le.blending===qg&&Le.transparent===!1?ye(th):ye(Le.blending,Le.blendEquation,Le.blendSrc,Le.blendDst,Le.blendEquationAlpha,Le.blendSrcAlpha,Le.blendDstAlpha,Le.blendColor,Le.blendAlpha,Le.premultipliedAlpha),a.setFunc(Le.depthFunc),a.setTest(Le.depthTest),a.setMask(Le.depthWrite),s.setMask(Le.colorWrite);const mt=Le.stencilWrite;o.setTest(mt),mt&&(o.setMask(Le.stencilWriteMask),o.setFunc(Le.stencilFunc,Le.stencilRef,Le.stencilFuncMask),o.setOp(Le.stencilFail,Le.stencilZFail,Le.stencilZPass)),Ue(Le.polygonOffset,Le.polygonOffsetFactor,Le.polygonOffsetUnits),Le.alphaToCoverage===!0?ue(t.SAMPLE_ALPHA_TO_COVERAGE):le(t.SAMPLE_ALPHA_TO_COVERAGE)}function he(Le){W!==Le&&(Le?t.frontFace(t.CW):t.frontFace(t.CCW),W=Le)}function Re(Le){Le!==bX?(ue(t.CULL_FACE),Le!==F&&(Le===DR?t.cullFace(t.BACK):Le===_X?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):le(t.CULL_FACE),F=Le}function oe(Le){Le!==V&&(q&&t.lineWidth(Le),V=Le)}function Ue(Le,st,ft){Le?(ue(t.POLYGON_OFFSET_FILL),(G!==st||Z!==ft)&&(G=st,Z=ft,a.getReversed()&&(st=-st),t.polygonOffset(st,ft))):le(t.POLYGON_OFFSET_FILL)}function Ee(Le){Le?ue(t.SCISSOR_TEST):le(t.SCISSOR_TEST)}function Pe(Le){Le===void 0&&(Le=t.TEXTURE0+B-1),Q!==Le&&(t.activeTexture(Le),Q=Le)}function Ze(Le,st,ft){ft===void 0&&(Q===null?ft=t.TEXTURE0+B-1:ft=Q);let mt=U[ft];mt===void 0&&(mt={type:void 0,texture:void 0},U[ft]=mt),(mt.type!==Le||mt.texture!==st)&&(Q!==ft&&(t.activeTexture(ft),Q=ft),t.bindTexture(Le,st||re[Le]),mt.type=Le,mt.texture=st)}function ae(){const Le=U[Q];Le!==void 0&&Le.type!==void 0&&(t.bindTexture(Le.type,null),Le.type=void 0,Le.texture=void 0)}function te(){try{t.compressedTexImage2D(...arguments)}catch(Le){Hn("WebGLState:",Le)}}function be(){try{t.compressedTexImage3D(...arguments)}catch(Le){Hn("WebGLState:",Le)}}function me(){try{t.texSubImage2D(...arguments)}catch(Le){Hn("WebGLState:",Le)}}function ge(){try{t.texSubImage3D(...arguments)}catch(Le){Hn("WebGLState:",Le)}}function ke(){try{t.compressedTexSubImage2D(...arguments)}catch(Le){Hn("WebGLState:",Le)}}function Xe(){try{t.compressedTexSubImage3D(...arguments)}catch(Le){Hn("WebGLState:",Le)}}function Ae(){try{t.texStorage2D(...arguments)}catch(Le){Hn("WebGLState:",Le)}}function je(){try{t.texStorage3D(...arguments)}catch(Le){Hn("WebGLState:",Le)}}function We(){try{t.texImage2D(...arguments)}catch(Le){Hn("WebGLState:",Le)}}function De(){try{t.texImage3D(...arguments)}catch(Le){Hn("WebGLState:",Le)}}function Be(Le){H.equals(Le)===!1&&(t.scissor(Le.x,Le.y,Le.z,Le.w),H.copy(Le))}function qe(Le){ie.equals(Le)===!1&&(t.viewport(Le.x,Le.y,Le.z,Le.w),ie.copy(Le))}function Se(Le,st){let ft=c.get(st);ft===void 0&&(ft=new WeakMap,c.set(st,ft));let mt=ft.get(Le);mt===void 0&&(mt=t.getUniformBlockIndex(st,Le.name),ft.set(Le,mt))}function Ye(Le,st){const mt=c.get(st).get(Le);l.get(st)!==mt&&(t.uniformBlockBinding(st,mt,Le.__bindingPointIndex),l.set(st,mt))}function dt(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),a.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),d={},Q=null,U={},h={},g=new WeakMap,v=[],b=null,_=!1,w=null,S=null,E=null,A=null,N=null,D=null,P=null,L=new xn(0,0,0),R=0,O=!1,W=null,F=null,V=null,G=null,Z=null,H.set(0,0,t.canvas.width,t.canvas.height),ie.set(0,0,t.canvas.width,t.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ue,disable:le,bindFramebuffer:fe,drawBuffers:we,useProgram:pe,setBlending:ye,setMaterial:Oe,setFlipSided:he,setCullFace:Re,setLineWidth:oe,setPolygonOffset:Ue,setScissorTest:Ee,activeTexture:Pe,bindTexture:Ze,unbindTexture:ae,compressedTexImage2D:te,compressedTexImage3D:be,texImage2D:We,texImage3D:De,updateUBOMapping:Se,uniformBlockBinding:Ye,texStorage2D:Ae,texStorage3D:je,texSubImage2D:me,texSubImage3D:ge,compressedTexSubImage2D:ke,compressedTexSubImage3D:Xe,scissor:Be,viewport:qe,reset:dt}}function NTe(t,e,n,r,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new zt,d=new WeakMap;let h;const g=new WeakMap;let v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(ae,te){return v?new OffscreenCanvas(ae,te):wS("canvas")}function _(ae,te,be){let me=1;const ge=Ze(ae);if((ge.width>be||ge.height>be)&&(me=be/Math.max(ge.width,ge.height)),me<1)if(typeof HTMLImageElement<"u"&&ae instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&ae instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&ae instanceof ImageBitmap||typeof VideoFrame<"u"&&ae instanceof VideoFrame){const ke=Math.floor(me*ge.width),Xe=Math.floor(me*ge.height);h===void 0&&(h=b(ke,Xe));const Ae=te?b(ke,Xe):h;return Ae.width=ke,Ae.height=Xe,Ae.getContext("2d").drawImage(ae,0,0,ke,Xe),hn("WebGLRenderer: Texture has been resized from ("+ge.width+"x"+ge.height+") to ("+ke+"x"+Xe+")."),Ae}else return"data"in ae&&hn("WebGLRenderer: Image in DataTexture is too big ("+ge.width+"x"+ge.height+")."),ae;return ae}function w(ae){return ae.generateMipmaps}function S(ae){t.generateMipmap(ae)}function E(ae){return ae.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:ae.isWebGL3DRenderTarget?t.TEXTURE_3D:ae.isWebGLArrayRenderTarget||ae.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function A(ae,te,be,me,ge=!1){if(ae!==null){if(t[ae]!==void 0)return t[ae];hn("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+ae+"'")}let ke=te;if(te===t.RED&&(be===t.FLOAT&&(ke=t.R32F),be===t.HALF_FLOAT&&(ke=t.R16F),be===t.UNSIGNED_BYTE&&(ke=t.R8)),te===t.RED_INTEGER&&(be===t.UNSIGNED_BYTE&&(ke=t.R8UI),be===t.UNSIGNED_SHORT&&(ke=t.R16UI),be===t.UNSIGNED_INT&&(ke=t.R32UI),be===t.BYTE&&(ke=t.R8I),be===t.SHORT&&(ke=t.R16I),be===t.INT&&(ke=t.R32I)),te===t.RG&&(be===t.FLOAT&&(ke=t.RG32F),be===t.HALF_FLOAT&&(ke=t.RG16F),be===t.UNSIGNED_BYTE&&(ke=t.RG8)),te===t.RG_INTEGER&&(be===t.UNSIGNED_BYTE&&(ke=t.RG8UI),be===t.UNSIGNED_SHORT&&(ke=t.RG16UI),be===t.UNSIGNED_INT&&(ke=t.RG32UI),be===t.BYTE&&(ke=t.RG8I),be===t.SHORT&&(ke=t.RG16I),be===t.INT&&(ke=t.RG32I)),te===t.RGB_INTEGER&&(be===t.UNSIGNED_BYTE&&(ke=t.RGB8UI),be===t.UNSIGNED_SHORT&&(ke=t.RGB16UI),be===t.UNSIGNED_INT&&(ke=t.RGB32UI),be===t.BYTE&&(ke=t.RGB8I),be===t.SHORT&&(ke=t.RGB16I),be===t.INT&&(ke=t.RGB32I)),te===t.RGBA_INTEGER&&(be===t.UNSIGNED_BYTE&&(ke=t.RGBA8UI),be===t.UNSIGNED_SHORT&&(ke=t.RGBA16UI),be===t.UNSIGNED_INT&&(ke=t.RGBA32UI),be===t.BYTE&&(ke=t.RGBA8I),be===t.SHORT&&(ke=t.RGBA16I),be===t.INT&&(ke=t.RGBA32I)),te===t.RGB&&(be===t.UNSIGNED_INT_5_9_9_9_REV&&(ke=t.RGB9_E5),be===t.UNSIGNED_INT_10F_11F_11F_REV&&(ke=t.R11F_G11F_B10F)),te===t.RGBA){const Xe=ge?_S:ii.getTransfer(me);be===t.FLOAT&&(ke=t.RGBA32F),be===t.HALF_FLOAT&&(ke=t.RGBA16F),be===t.UNSIGNED_BYTE&&(ke=Xe===ji?t.SRGB8_ALPHA8:t.RGBA8),be===t.UNSIGNED_SHORT_4_4_4_4&&(ke=t.RGBA4),be===t.UNSIGNED_SHORT_5_5_5_1&&(ke=t.RGB5_A1)}return(ke===t.R16F||ke===t.R32F||ke===t.RG16F||ke===t.RG32F||ke===t.RGBA16F||ke===t.RGBA32F)&&e.get("EXT_color_buffer_float"),ke}function N(ae,te){let be;return ae?te===null||te===Ku||te===ry?be=t.DEPTH24_STENCIL8:te===Bl?be=t.DEPTH32F_STENCIL8:te===ny&&(be=t.DEPTH24_STENCIL8,hn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):te===null||te===Ku||te===ry?be=t.DEPTH_COMPONENT24:te===Bl?be=t.DEPTH_COMPONENT32F:te===ny&&(be=t.DEPTH_COMPONENT16),be}function D(ae,te){return w(ae)===!0||ae.isFramebufferTexture&&ae.minFilter!==Ea&&ae.minFilter!==rs?Math.log2(Math.max(te.width,te.height))+1:ae.mipmaps!==void 0&&ae.mipmaps.length>0?ae.mipmaps.length:ae.isCompressedTexture&&Array.isArray(ae.image)?te.mipmaps.length:1}function P(ae){const te=ae.target;te.removeEventListener("dispose",P),R(te),te.isVideoTexture&&d.delete(te)}function L(ae){const te=ae.target;te.removeEventListener("dispose",L),W(te)}function R(ae){const te=r.get(ae);if(te.__webglInit===void 0)return;const be=ae.source,me=g.get(be);if(me){const ge=me[te.__cacheKey];ge.usedTimes--,ge.usedTimes===0&&O(ae),Object.keys(me).length===0&&g.delete(be)}r.remove(ae)}function O(ae){const te=r.get(ae);t.deleteTexture(te.__webglTexture);const be=ae.source,me=g.get(be);delete me[te.__cacheKey],a.memory.textures--}function W(ae){const te=r.get(ae);if(ae.depthTexture&&(ae.depthTexture.dispose(),r.remove(ae.depthTexture)),ae.isWebGLCubeRenderTarget)for(let me=0;me<6;me++){if(Array.isArray(te.__webglFramebuffer[me]))for(let ge=0;ge<te.__webglFramebuffer[me].length;ge++)t.deleteFramebuffer(te.__webglFramebuffer[me][ge]);else t.deleteFramebuffer(te.__webglFramebuffer[me]);te.__webglDepthbuffer&&t.deleteRenderbuffer(te.__webglDepthbuffer[me])}else{if(Array.isArray(te.__webglFramebuffer))for(let me=0;me<te.__webglFramebuffer.length;me++)t.deleteFramebuffer(te.__webglFramebuffer[me]);else t.deleteFramebuffer(te.__webglFramebuffer);if(te.__webglDepthbuffer&&t.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&t.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer)for(let me=0;me<te.__webglColorRenderbuffer.length;me++)te.__webglColorRenderbuffer[me]&&t.deleteRenderbuffer(te.__webglColorRenderbuffer[me]);te.__webglDepthRenderbuffer&&t.deleteRenderbuffer(te.__webglDepthRenderbuffer)}const be=ae.textures;for(let me=0,ge=be.length;me<ge;me++){const ke=r.get(be[me]);ke.__webglTexture&&(t.deleteTexture(ke.__webglTexture),a.memory.textures--),r.remove(be[me])}r.remove(ae)}let F=0;function V(){F=0}function G(){const ae=F;return ae>=i.maxTextures&&hn("WebGLTextures: Trying to use "+ae+" texture units while this GPU supports only "+i.maxTextures),F+=1,ae}function Z(ae){const te=[];return te.push(ae.wrapS),te.push(ae.wrapT),te.push(ae.wrapR||0),te.push(ae.magFilter),te.push(ae.minFilter),te.push(ae.anisotropy),te.push(ae.internalFormat),te.push(ae.format),te.push(ae.type),te.push(ae.generateMipmaps),te.push(ae.premultiplyAlpha),te.push(ae.flipY),te.push(ae.unpackAlignment),te.push(ae.colorSpace),te.join()}function B(ae,te){const be=r.get(ae);if(ae.isVideoTexture&&Ee(ae),ae.isRenderTargetTexture===!1&&ae.isExternalTexture!==!0&&ae.version>0&&be.__version!==ae.version){const me=ae.image;if(me===null)hn("WebGLRenderer: Texture marked for update but no image data found.");else if(me.complete===!1)hn("WebGLRenderer: Texture marked for update but image is incomplete");else{re(be,ae,te);return}}else ae.isExternalTexture&&(be.__webglTexture=ae.sourceTexture?ae.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,be.__webglTexture,t.TEXTURE0+te)}function q(ae,te){const be=r.get(ae);if(ae.isRenderTargetTexture===!1&&ae.version>0&&be.__version!==ae.version){re(be,ae,te);return}else ae.isExternalTexture&&(be.__webglTexture=ae.sourceTexture?ae.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,be.__webglTexture,t.TEXTURE0+te)}function K(ae,te){const be=r.get(ae);if(ae.isRenderTargetTexture===!1&&ae.version>0&&be.__version!==ae.version){re(be,ae,te);return}n.bindTexture(t.TEXTURE_3D,be.__webglTexture,t.TEXTURE0+te)}function Y(ae,te){const be=r.get(ae);if(ae.isCubeDepthTexture!==!0&&ae.version>0&&be.__version!==ae.version){ue(be,ae,te);return}n.bindTexture(t.TEXTURE_CUBE_MAP,be.__webglTexture,t.TEXTURE0+te)}const Q={[vS]:t.REPEAT,[Tc]:t.CLAMP_TO_EDGE,[xS]:t.MIRRORED_REPEAT},U={[Ea]:t.NEAREST,[Wk]:t.NEAREST_MIPMAP_NEAREST,[i1]:t.NEAREST_MIPMAP_LINEAR,[rs]:t.LINEAR,[j_]:t.LINEAR_MIPMAP_NEAREST,[Kf]:t.LINEAR_MIPMAP_LINEAR},j={[KX]:t.NEVER,[tY]:t.ALWAYS,[ZX]:t.LESS,[eE]:t.LEQUAL,[QX]:t.EQUAL,[tE]:t.GEQUAL,[JX]:t.GREATER,[eY]:t.NOTEQUAL};function X(ae,te){if(te.type===Bl&&e.has("OES_texture_float_linear")===!1&&(te.magFilter===rs||te.magFilter===j_||te.magFilter===i1||te.magFilter===Kf||te.minFilter===rs||te.minFilter===j_||te.minFilter===i1||te.minFilter===Kf)&&hn("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(ae,t.TEXTURE_WRAP_S,Q[te.wrapS]),t.texParameteri(ae,t.TEXTURE_WRAP_T,Q[te.wrapT]),(ae===t.TEXTURE_3D||ae===t.TEXTURE_2D_ARRAY)&&t.texParameteri(ae,t.TEXTURE_WRAP_R,Q[te.wrapR]),t.texParameteri(ae,t.TEXTURE_MAG_FILTER,U[te.magFilter]),t.texParameteri(ae,t.TEXTURE_MIN_FILTER,U[te.minFilter]),te.compareFunction&&(t.texParameteri(ae,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(ae,t.TEXTURE_COMPARE_FUNC,j[te.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(te.magFilter===Ea||te.minFilter!==i1&&te.minFilter!==Kf||te.type===Bl&&e.has("OES_texture_float_linear")===!1)return;if(te.anisotropy>1||r.get(te).__currentAnisotropy){const be=e.get("EXT_texture_filter_anisotropic");t.texParameterf(ae,be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(te.anisotropy,i.getMaxAnisotropy())),r.get(te).__currentAnisotropy=te.anisotropy}}}function H(ae,te){let be=!1;ae.__webglInit===void 0&&(ae.__webglInit=!0,te.addEventListener("dispose",P));const me=te.source;let ge=g.get(me);ge===void 0&&(ge={},g.set(me,ge));const ke=Z(te);if(ke!==ae.__cacheKey){ge[ke]===void 0&&(ge[ke]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,be=!0),ge[ke].usedTimes++;const Xe=ge[ae.__cacheKey];Xe!==void 0&&(ge[ae.__cacheKey].usedTimes--,Xe.usedTimes===0&&O(te)),ae.__cacheKey=ke,ae.__webglTexture=ge[ke].texture}return be}function ie(ae,te,be){return Math.floor(Math.floor(ae/be)/te)}function ne(ae,te,be,me){const ke=ae.updateRanges;if(ke.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,te.width,te.height,be,me,te.data);else{ke.sort((De,Be)=>De.start-Be.start);let Xe=0;for(let De=1;De<ke.length;De++){const Be=ke[Xe],qe=ke[De],Se=Be.start+Be.count,Ye=ie(qe.start,te.width,4),dt=ie(Be.start,te.width,4);qe.start<=Se+1&&Ye===dt&&ie(qe.start+qe.count-1,te.width,4)===Ye?Be.count=Math.max(Be.count,qe.start+qe.count-Be.start):(++Xe,ke[Xe]=qe)}ke.length=Xe+1;const Ae=t.getParameter(t.UNPACK_ROW_LENGTH),je=t.getParameter(t.UNPACK_SKIP_PIXELS),We=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,te.width);for(let De=0,Be=ke.length;De<Be;De++){const qe=ke[De],Se=Math.floor(qe.start/4),Ye=Math.ceil(qe.count/4),dt=Se%te.width,Le=Math.floor(Se/te.width),st=Ye,ft=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,dt),t.pixelStorei(t.UNPACK_SKIP_ROWS,Le),n.texSubImage2D(t.TEXTURE_2D,0,dt,Le,st,ft,be,me,te.data)}ae.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,Ae),t.pixelStorei(t.UNPACK_SKIP_PIXELS,je),t.pixelStorei(t.UNPACK_SKIP_ROWS,We)}}function re(ae,te,be){let me=t.TEXTURE_2D;(te.isDataArrayTexture||te.isCompressedArrayTexture)&&(me=t.TEXTURE_2D_ARRAY),te.isData3DTexture&&(me=t.TEXTURE_3D);const ge=H(ae,te),ke=te.source;n.bindTexture(me,ae.__webglTexture,t.TEXTURE0+be);const Xe=r.get(ke);if(ke.version!==Xe.__version||ge===!0){n.activeTexture(t.TEXTURE0+be);const Ae=ii.getPrimaries(ii.workingColorSpace),je=te.colorSpace===np?null:ii.getPrimaries(te.colorSpace),We=te.colorSpace===np||Ae===je?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,te.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,te.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,We);let De=_(te.image,!1,i.maxTextureSize);De=Pe(te,De);const Be=s.convert(te.format,te.colorSpace),qe=s.convert(te.type);let Se=A(te.internalFormat,Be,qe,te.colorSpace,te.isVideoTexture);X(me,te);let Ye;const dt=te.mipmaps,Le=te.isVideoTexture!==!0,st=Xe.__version===void 0||ge===!0,ft=ke.dataReady,mt=D(te,De);if(te.isDepthTexture)Se=N(te.format===B0,te.type),st&&(Le?n.texStorage2D(t.TEXTURE_2D,1,Se,De.width,De.height):n.texImage2D(t.TEXTURE_2D,0,Se,De.width,De.height,0,Be,qe,null));else if(te.isDataTexture)if(dt.length>0){Le&&st&&n.texStorage2D(t.TEXTURE_2D,mt,Se,dt[0].width,dt[0].height);for(let tt=0,Qe=dt.length;tt<Qe;tt++)Ye=dt[tt],Le?ft&&n.texSubImage2D(t.TEXTURE_2D,tt,0,0,Ye.width,Ye.height,Be,qe,Ye.data):n.texImage2D(t.TEXTURE_2D,tt,Se,Ye.width,Ye.height,0,Be,qe,Ye.data);te.generateMipmaps=!1}else Le?(st&&n.texStorage2D(t.TEXTURE_2D,mt,Se,De.width,De.height),ft&&ne(te,De,Be,qe)):n.texImage2D(t.TEXTURE_2D,0,Se,De.width,De.height,0,Be,qe,De.data);else if(te.isCompressedTexture)if(te.isCompressedArrayTexture){Le&&st&&n.texStorage3D(t.TEXTURE_2D_ARRAY,mt,Se,dt[0].width,dt[0].height,De.depth);for(let tt=0,Qe=dt.length;tt<Qe;tt++)if(Ye=dt[tt],te.format!==ul)if(Be!==null)if(Le){if(ft)if(te.layerUpdates.size>0){const ze=YR(Ye.width,Ye.height,te.format,te.type);for(const Te of te.layerUpdates){const He=Ye.data.subarray(Te*ze/Ye.data.BYTES_PER_ELEMENT,(Te+1)*ze/Ye.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,tt,0,0,Te,Ye.width,Ye.height,1,Be,He)}te.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,tt,0,0,0,Ye.width,Ye.height,De.depth,Be,Ye.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,tt,Se,Ye.width,Ye.height,De.depth,0,Ye.data,0,0);else hn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Le?ft&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,tt,0,0,0,Ye.width,Ye.height,De.depth,Be,qe,Ye.data):n.texImage3D(t.TEXTURE_2D_ARRAY,tt,Se,Ye.width,Ye.height,De.depth,0,Be,qe,Ye.data)}else{Le&&st&&n.texStorage2D(t.TEXTURE_2D,mt,Se,dt[0].width,dt[0].height);for(let tt=0,Qe=dt.length;tt<Qe;tt++)Ye=dt[tt],te.format!==ul?Be!==null?Le?ft&&n.compressedTexSubImage2D(t.TEXTURE_2D,tt,0,0,Ye.width,Ye.height,Be,Ye.data):n.compressedTexImage2D(t.TEXTURE_2D,tt,Se,Ye.width,Ye.height,0,Ye.data):hn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Le?ft&&n.texSubImage2D(t.TEXTURE_2D,tt,0,0,Ye.width,Ye.height,Be,qe,Ye.data):n.texImage2D(t.TEXTURE_2D,tt,Se,Ye.width,Ye.height,0,Be,qe,Ye.data)}else if(te.isDataArrayTexture)if(Le){if(st&&n.texStorage3D(t.TEXTURE_2D_ARRAY,mt,Se,De.width,De.height,De.depth),ft)if(te.layerUpdates.size>0){const tt=YR(De.width,De.height,te.format,te.type);for(const Qe of te.layerUpdates){const ze=De.data.subarray(Qe*tt/De.data.BYTES_PER_ELEMENT,(Qe+1)*tt/De.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Qe,De.width,De.height,1,Be,qe,ze)}te.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,De.width,De.height,De.depth,Be,qe,De.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Se,De.width,De.height,De.depth,0,Be,qe,De.data);else if(te.isData3DTexture)Le?(st&&n.texStorage3D(t.TEXTURE_3D,mt,Se,De.width,De.height,De.depth),ft&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,De.width,De.height,De.depth,Be,qe,De.data)):n.texImage3D(t.TEXTURE_3D,0,Se,De.width,De.height,De.depth,0,Be,qe,De.data);else if(te.isFramebufferTexture){if(st)if(Le)n.texStorage2D(t.TEXTURE_2D,mt,Se,De.width,De.height);else{let tt=De.width,Qe=De.height;for(let ze=0;ze<mt;ze++)n.texImage2D(t.TEXTURE_2D,ze,Se,tt,Qe,0,Be,qe,null),tt>>=1,Qe>>=1}}else if(dt.length>0){if(Le&&st){const tt=Ze(dt[0]);n.texStorage2D(t.TEXTURE_2D,mt,Se,tt.width,tt.height)}for(let tt=0,Qe=dt.length;tt<Qe;tt++)Ye=dt[tt],Le?ft&&n.texSubImage2D(t.TEXTURE_2D,tt,0,0,Be,qe,Ye):n.texImage2D(t.TEXTURE_2D,tt,Se,Be,qe,Ye);te.generateMipmaps=!1}else if(Le){if(st){const tt=Ze(De);n.texStorage2D(t.TEXTURE_2D,mt,Se,tt.width,tt.height)}ft&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,Be,qe,De)}else n.texImage2D(t.TEXTURE_2D,0,Se,Be,qe,De);w(te)&&S(me),Xe.__version=ke.version,te.onUpdate&&te.onUpdate(te)}ae.__version=te.version}function ue(ae,te,be){if(te.image.length!==6)return;const me=H(ae,te),ge=te.source;n.bindTexture(t.TEXTURE_CUBE_MAP,ae.__webglTexture,t.TEXTURE0+be);const ke=r.get(ge);if(ge.version!==ke.__version||me===!0){n.activeTexture(t.TEXTURE0+be);const Xe=ii.getPrimaries(ii.workingColorSpace),Ae=te.colorSpace===np?null:ii.getPrimaries(te.colorSpace),je=te.colorSpace===np||Xe===Ae?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,te.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,te.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,te.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,je);const We=te.isCompressedTexture||te.image[0].isCompressedTexture,De=te.image[0]&&te.image[0].isDataTexture,Be=[];for(let Qe=0;Qe<6;Qe++)!We&&!De?Be[Qe]=_(te.image[Qe],!0,i.maxCubemapSize):Be[Qe]=De?te.image[Qe].image:te.image[Qe],Be[Qe]=Pe(te,Be[Qe]);const qe=Be[0],Se=s.convert(te.format,te.colorSpace),Ye=s.convert(te.type),dt=A(te.internalFormat,Se,Ye,te.colorSpace),Le=te.isVideoTexture!==!0,st=ke.__version===void 0||me===!0,ft=ge.dataReady;let mt=D(te,qe);X(t.TEXTURE_CUBE_MAP,te);let tt;if(We){Le&&st&&n.texStorage2D(t.TEXTURE_CUBE_MAP,mt,dt,qe.width,qe.height);for(let Qe=0;Qe<6;Qe++){tt=Be[Qe].mipmaps;for(let ze=0;ze<tt.length;ze++){const Te=tt[ze];te.format!==ul?Se!==null?Le?ft&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,ze,0,0,Te.width,Te.height,Se,Te.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,ze,dt,Te.width,Te.height,0,Te.data):hn("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Le?ft&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,ze,0,0,Te.width,Te.height,Se,Ye,Te.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,ze,dt,Te.width,Te.height,0,Se,Ye,Te.data)}}}else{if(tt=te.mipmaps,Le&&st){tt.length>0&&mt++;const Qe=Ze(Be[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,mt,dt,Qe.width,Qe.height)}for(let Qe=0;Qe<6;Qe++)if(De){Le?ft&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,0,0,Be[Qe].width,Be[Qe].height,Se,Ye,Be[Qe].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,dt,Be[Qe].width,Be[Qe].height,0,Se,Ye,Be[Qe].data);for(let ze=0;ze<tt.length;ze++){const He=tt[ze].image[Qe].image;Le?ft&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,ze+1,0,0,He.width,He.height,Se,Ye,He.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,ze+1,dt,He.width,He.height,0,Se,Ye,He.data)}}else{Le?ft&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,0,0,Se,Ye,Be[Qe]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,0,dt,Se,Ye,Be[Qe]);for(let ze=0;ze<tt.length;ze++){const Te=tt[ze];Le?ft&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,ze+1,0,0,Se,Ye,Te.image[Qe]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Qe,ze+1,dt,Se,Ye,Te.image[Qe])}}}w(te)&&S(t.TEXTURE_CUBE_MAP),ke.__version=ge.version,te.onUpdate&&te.onUpdate(te)}ae.__version=te.version}function le(ae,te,be,me,ge,ke){const Xe=s.convert(be.format,be.colorSpace),Ae=s.convert(be.type),je=A(be.internalFormat,Xe,Ae,be.colorSpace),We=r.get(te),De=r.get(be);if(De.__renderTarget=te,!We.__hasExternalTextures){const Be=Math.max(1,te.width>>ke),qe=Math.max(1,te.height>>ke);ge===t.TEXTURE_3D||ge===t.TEXTURE_2D_ARRAY?n.texImage3D(ge,ke,je,Be,qe,te.depth,0,Xe,Ae,null):n.texImage2D(ge,ke,je,Be,qe,0,Xe,Ae,null)}n.bindFramebuffer(t.FRAMEBUFFER,ae),Ue(te)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,me,ge,De.__webglTexture,0,oe(te)):(ge===t.TEXTURE_2D||ge>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&ge<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,me,ge,De.__webglTexture,ke),n.bindFramebuffer(t.FRAMEBUFFER,null)}function fe(ae,te,be){if(t.bindRenderbuffer(t.RENDERBUFFER,ae),te.depthBuffer){const me=te.depthTexture,ge=me&&me.isDepthTexture?me.type:null,ke=N(te.stencilBuffer,ge),Xe=te.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;Ue(te)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,oe(te),ke,te.width,te.height):be?t.renderbufferStorageMultisample(t.RENDERBUFFER,oe(te),ke,te.width,te.height):t.renderbufferStorage(t.RENDERBUFFER,ke,te.width,te.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Xe,t.RENDERBUFFER,ae)}else{const me=te.textures;for(let ge=0;ge<me.length;ge++){const ke=me[ge],Xe=s.convert(ke.format,ke.colorSpace),Ae=s.convert(ke.type),je=A(ke.internalFormat,Xe,Ae,ke.colorSpace);Ue(te)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,oe(te),je,te.width,te.height):be?t.renderbufferStorageMultisample(t.RENDERBUFFER,oe(te),je,te.width,te.height):t.renderbufferStorage(t.RENDERBUFFER,je,te.width,te.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function we(ae,te,be){const me=te.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(t.FRAMEBUFFER,ae),!(te.depthTexture&&te.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ge=r.get(te.depthTexture);if(ge.__renderTarget=te,(!ge.__webglTexture||te.depthTexture.image.width!==te.width||te.depthTexture.image.height!==te.height)&&(te.depthTexture.image.width=te.width,te.depthTexture.image.height=te.height,te.depthTexture.needsUpdate=!0),me){if(ge.__webglInit===void 0&&(ge.__webglInit=!0,te.depthTexture.addEventListener("dispose",P)),ge.__webglTexture===void 0){ge.__webglTexture=t.createTexture(),n.bindTexture(t.TEXTURE_CUBE_MAP,ge.__webglTexture),X(t.TEXTURE_CUBE_MAP,te.depthTexture);const We=s.convert(te.depthTexture.format),De=s.convert(te.depthTexture.type);let Be;te.depthTexture.format===oh?Be=t.DEPTH_COMPONENT24:te.depthTexture.format===B0&&(Be=t.DEPTH24_STENCIL8);for(let qe=0;qe<6;qe++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+qe,0,Be,te.width,te.height,0,We,De,null)}}else B(te.depthTexture,0);const ke=ge.__webglTexture,Xe=oe(te),Ae=me?t.TEXTURE_CUBE_MAP_POSITIVE_X+be:t.TEXTURE_2D,je=te.depthTexture.format===B0?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(te.depthTexture.format===oh)Ue(te)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,je,Ae,ke,0,Xe):t.framebufferTexture2D(t.FRAMEBUFFER,je,Ae,ke,0);else if(te.depthTexture.format===B0)Ue(te)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,je,Ae,ke,0,Xe):t.framebufferTexture2D(t.FRAMEBUFFER,je,Ae,ke,0);else throw new Error("Unknown depthTexture format")}function pe(ae){const te=r.get(ae),be=ae.isWebGLCubeRenderTarget===!0;if(te.__boundDepthTexture!==ae.depthTexture){const me=ae.depthTexture;if(te.__depthDisposeCallback&&te.__depthDisposeCallback(),me){const ge=()=>{delete te.__boundDepthTexture,delete te.__depthDisposeCallback,me.removeEventListener("dispose",ge)};me.addEventListener("dispose",ge),te.__depthDisposeCallback=ge}te.__boundDepthTexture=me}if(ae.depthTexture&&!te.__autoAllocateDepthBuffer)if(be)for(let me=0;me<6;me++)we(te.__webglFramebuffer[me],ae,me);else{const me=ae.texture.mipmaps;me&&me.length>0?we(te.__webglFramebuffer[0],ae,0):we(te.__webglFramebuffer,ae,0)}else if(be){te.__webglDepthbuffer=[];for(let me=0;me<6;me++)if(n.bindFramebuffer(t.FRAMEBUFFER,te.__webglFramebuffer[me]),te.__webglDepthbuffer[me]===void 0)te.__webglDepthbuffer[me]=t.createRenderbuffer(),fe(te.__webglDepthbuffer[me],ae,!1);else{const ge=ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ke=te.__webglDepthbuffer[me];t.bindRenderbuffer(t.RENDERBUFFER,ke),t.framebufferRenderbuffer(t.FRAMEBUFFER,ge,t.RENDERBUFFER,ke)}}else{const me=ae.texture.mipmaps;if(me&&me.length>0?n.bindFramebuffer(t.FRAMEBUFFER,te.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,te.__webglFramebuffer),te.__webglDepthbuffer===void 0)te.__webglDepthbuffer=t.createRenderbuffer(),fe(te.__webglDepthbuffer,ae,!1);else{const ge=ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ke=te.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ke),t.framebufferRenderbuffer(t.FRAMEBUFFER,ge,t.RENDERBUFFER,ke)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function xe(ae,te,be){const me=r.get(ae);te!==void 0&&le(me.__webglFramebuffer,ae,ae.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),be!==void 0&&pe(ae)}function Ve(ae){const te=ae.texture,be=r.get(ae),me=r.get(te);ae.addEventListener("dispose",L);const ge=ae.textures,ke=ae.isWebGLCubeRenderTarget===!0,Xe=ge.length>1;if(Xe||(me.__webglTexture===void 0&&(me.__webglTexture=t.createTexture()),me.__version=te.version,a.memory.textures++),ke){be.__webglFramebuffer=[];for(let Ae=0;Ae<6;Ae++)if(te.mipmaps&&te.mipmaps.length>0){be.__webglFramebuffer[Ae]=[];for(let je=0;je<te.mipmaps.length;je++)be.__webglFramebuffer[Ae][je]=t.createFramebuffer()}else be.__webglFramebuffer[Ae]=t.createFramebuffer()}else{if(te.mipmaps&&te.mipmaps.length>0){be.__webglFramebuffer=[];for(let Ae=0;Ae<te.mipmaps.length;Ae++)be.__webglFramebuffer[Ae]=t.createFramebuffer()}else be.__webglFramebuffer=t.createFramebuffer();if(Xe)for(let Ae=0,je=ge.length;Ae<je;Ae++){const We=r.get(ge[Ae]);We.__webglTexture===void 0&&(We.__webglTexture=t.createTexture(),a.memory.textures++)}if(ae.samples>0&&Ue(ae)===!1){be.__webglMultisampledFramebuffer=t.createFramebuffer(),be.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,be.__webglMultisampledFramebuffer);for(let Ae=0;Ae<ge.length;Ae++){const je=ge[Ae];be.__webglColorRenderbuffer[Ae]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,be.__webglColorRenderbuffer[Ae]);const We=s.convert(je.format,je.colorSpace),De=s.convert(je.type),Be=A(je.internalFormat,We,De,je.colorSpace,ae.isXRRenderTarget===!0),qe=oe(ae);t.renderbufferStorageMultisample(t.RENDERBUFFER,qe,Be,ae.width,ae.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ae,t.RENDERBUFFER,be.__webglColorRenderbuffer[Ae])}t.bindRenderbuffer(t.RENDERBUFFER,null),ae.depthBuffer&&(be.__webglDepthRenderbuffer=t.createRenderbuffer(),fe(be.__webglDepthRenderbuffer,ae,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(ke){n.bindTexture(t.TEXTURE_CUBE_MAP,me.__webglTexture),X(t.TEXTURE_CUBE_MAP,te);for(let Ae=0;Ae<6;Ae++)if(te.mipmaps&&te.mipmaps.length>0)for(let je=0;je<te.mipmaps.length;je++)le(be.__webglFramebuffer[Ae][je],ae,te,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,je);else le(be.__webglFramebuffer[Ae],ae,te,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,0);w(te)&&S(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Xe){for(let Ae=0,je=ge.length;Ae<je;Ae++){const We=ge[Ae],De=r.get(We);let Be=t.TEXTURE_2D;(ae.isWebGL3DRenderTarget||ae.isWebGLArrayRenderTarget)&&(Be=ae.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Be,De.__webglTexture),X(Be,We),le(be.__webglFramebuffer,ae,We,t.COLOR_ATTACHMENT0+Ae,Be,0),w(We)&&S(Be)}n.unbindTexture()}else{let Ae=t.TEXTURE_2D;if((ae.isWebGL3DRenderTarget||ae.isWebGLArrayRenderTarget)&&(Ae=ae.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(Ae,me.__webglTexture),X(Ae,te),te.mipmaps&&te.mipmaps.length>0)for(let je=0;je<te.mipmaps.length;je++)le(be.__webglFramebuffer[je],ae,te,t.COLOR_ATTACHMENT0,Ae,je);else le(be.__webglFramebuffer,ae,te,t.COLOR_ATTACHMENT0,Ae,0);w(te)&&S(Ae),n.unbindTexture()}ae.depthBuffer&&pe(ae)}function ye(ae){const te=ae.textures;for(let be=0,me=te.length;be<me;be++){const ge=te[be];if(w(ge)){const ke=E(ae),Xe=r.get(ge).__webglTexture;n.bindTexture(ke,Xe),S(ke),n.unbindTexture()}}}const Oe=[],he=[];function Re(ae){if(ae.samples>0){if(Ue(ae)===!1){const te=ae.textures,be=ae.width,me=ae.height;let ge=t.COLOR_BUFFER_BIT;const ke=ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Xe=r.get(ae),Ae=te.length>1;if(Ae)for(let We=0;We<te.length;We++)n.bindFramebuffer(t.FRAMEBUFFER,Xe.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+We,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Xe.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+We,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Xe.__webglMultisampledFramebuffer);const je=ae.texture.mipmaps;je&&je.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Xe.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Xe.__webglFramebuffer);for(let We=0;We<te.length;We++){if(ae.resolveDepthBuffer&&(ae.depthBuffer&&(ge|=t.DEPTH_BUFFER_BIT),ae.stencilBuffer&&ae.resolveStencilBuffer&&(ge|=t.STENCIL_BUFFER_BIT)),Ae){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Xe.__webglColorRenderbuffer[We]);const De=r.get(te[We]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,De,0)}t.blitFramebuffer(0,0,be,me,0,0,be,me,ge,t.NEAREST),l===!0&&(Oe.length=0,he.length=0,Oe.push(t.COLOR_ATTACHMENT0+We),ae.depthBuffer&&ae.resolveDepthBuffer===!1&&(Oe.push(ke),he.push(ke),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,he)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,Oe))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),Ae)for(let We=0;We<te.length;We++){n.bindFramebuffer(t.FRAMEBUFFER,Xe.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+We,t.RENDERBUFFER,Xe.__webglColorRenderbuffer[We]);const De=r.get(te[We]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Xe.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+We,t.TEXTURE_2D,De,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Xe.__webglMultisampledFramebuffer)}else if(ae.depthBuffer&&ae.resolveDepthBuffer===!1&&l){const te=ae.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[te])}}}function oe(ae){return Math.min(i.maxSamples,ae.samples)}function Ue(ae){const te=r.get(ae);return ae.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&te.__useRenderToTexture!==!1}function Ee(ae){const te=a.render.frame;d.get(ae)!==te&&(d.set(ae,te),ae.update())}function Pe(ae,te){const be=ae.colorSpace,me=ae.format,ge=ae.type;return ae.isCompressedTexture===!0||ae.isVideoTexture===!0||be!==im&&be!==np&&(ii.getTransfer(be)===ji?(me!==ul||ge!==zl)&&hn("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Hn("WebGLTextures: Unsupported texture color space:",be)),te}function Ze(ae){return typeof HTMLImageElement<"u"&&ae instanceof HTMLImageElement?(c.width=ae.naturalWidth||ae.width,c.height=ae.naturalHeight||ae.height):typeof VideoFrame<"u"&&ae instanceof VideoFrame?(c.width=ae.displayWidth,c.height=ae.displayHeight):(c.width=ae.width,c.height=ae.height),c}this.allocateTextureUnit=G,this.resetTextureUnits=V,this.setTexture2D=B,this.setTexture2DArray=q,this.setTexture3D=K,this.setTextureCube=Y,this.rebindTextures=xe,this.setupRenderTarget=Ve,this.updateRenderTargetMipmap=ye,this.updateMultisampleRenderTarget=Re,this.setupDepthRenderbuffer=pe,this.setupFrameBufferTexture=le,this.useMultisampledRTT=Ue,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function dK(t,e){function n(r,i=np){let s;const a=ii.getTransfer(i);if(r===zl)return t.UNSIGNED_BYTE;if(r===XT)return t.UNSIGNED_SHORT_4_4_4_4;if(r===YT)return t.UNSIGNED_SHORT_5_5_5_1;if(r===Xk)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===Yk)return t.UNSIGNED_INT_10F_11F_11F_REV;if(r===$k)return t.BYTE;if(r===qk)return t.SHORT;if(r===ny)return t.UNSIGNED_SHORT;if(r===qT)return t.INT;if(r===Ku)return t.UNSIGNED_INT;if(r===Bl)return t.FLOAT;if(r===ah)return t.HALF_FLOAT;if(r===Kk)return t.ALPHA;if(r===Zk)return t.RGB;if(r===ul)return t.RGBA;if(r===oh)return t.DEPTH_COMPONENT;if(r===B0)return t.DEPTH_STENCIL;if(r===KT)return t.RED;if(r===bw)return t.RED_INTEGER;if(r===cv)return t.RG;if(r===ZT)return t.RG_INTEGER;if(r===QT)return t.RGBA_INTEGER;if(r===F_||r===U_||r===B_||r===H_)if(a===ji)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===F_)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===U_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===B_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===H_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===F_)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===U_)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===B_)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===H_)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===F2||r===U2||r===B2||r===H2)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===F2)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===U2)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===B2)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===H2)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===V2||r===G2||r===W2||r===$2||r===q2||r===X2||r===Y2)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===V2||r===G2)return a===ji?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===W2)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(r===$2)return s.COMPRESSED_R11_EAC;if(r===q2)return s.COMPRESSED_SIGNED_R11_EAC;if(r===X2)return s.COMPRESSED_RG11_EAC;if(r===Y2)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(r===K2||r===Z2||r===Q2||r===J2||r===e5||r===t5||r===n5||r===r5||r===i5||r===s5||r===a5||r===o5||r===l5||r===c5)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===K2)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Z2)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Q2)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===J2)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===e5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===t5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===n5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===r5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===i5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===s5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===a5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===o5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===l5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===c5)return a===ji?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===u5||r===d5||r===f5)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===u5)return a===ji?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===d5)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===f5)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===h5||r===p5||r===m5||r===g5)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===h5)return s.COMPRESSED_RED_RGTC1_EXT;if(r===p5)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===m5)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===g5)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===ry?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}const RTe=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,kTe=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;

void main() {

	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );

	if ( coord.x >= 1.0 ) {

		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;

	} else {

		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;

	}

}`;class PTe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const r=new o9(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new au({vertexShader:RTe,fragmentShader:kTe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Us(new Mp(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ITe extends mh{constructor(e,n){super();const r=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,h=null,g=null,v=null,b=null;const _=typeof XRWebGLBinding<"u",w=new PTe,S={},E=n.getContextAttributes();let A=null,N=null;const D=[],P=[],L=new zt;let R=null;const O=new ea;O.viewport=new ci;const W=new ea;W.viewport=new ci;const F=[O,W],V=new ZY;let G=null,Z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(re){let ue=D[re];return ue===void 0&&(ue=new BM,D[re]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(re){let ue=D[re];return ue===void 0&&(ue=new BM,D[re]=ue),ue.getGripSpace()},this.getHand=function(re){let ue=D[re];return ue===void 0&&(ue=new BM,D[re]=ue),ue.getHandSpace()};function B(re){const ue=P.indexOf(re.inputSource);if(ue===-1)return;const le=D[ue];le!==void 0&&(le.update(re.inputSource,re.frame,c||a),le.dispatchEvent({type:re.type,data:re.inputSource}))}function q(){i.removeEventListener("select",B),i.removeEventListener("selectstart",B),i.removeEventListener("selectend",B),i.removeEventListener("squeeze",B),i.removeEventListener("squeezestart",B),i.removeEventListener("squeezeend",B),i.removeEventListener("end",q),i.removeEventListener("inputsourceschange",K);for(let re=0;re<D.length;re++){const ue=P[re];ue!==null&&(P[re]=null,D[re].disconnect(ue))}G=null,Z=null,w.reset();for(const re in S)delete S[re];e.setRenderTarget(A),v=null,g=null,h=null,i=null,N=null,ne.stop(),r.isPresenting=!1,e.setPixelRatio(R),e.setSize(L.width,L.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(re){s=re,r.isPresenting===!0&&hn("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(re){o=re,r.isPresenting===!0&&hn("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(re){c=re},this.getBaseLayer=function(){return g!==null?g:v},this.getBinding=function(){return h===null&&_&&(h=new XRWebGLBinding(i,n)),h},this.getFrame=function(){return b},this.getSession=function(){return i},this.setSession=async function(re){if(i=re,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",B),i.addEventListener("selectstart",B),i.addEventListener("selectend",B),i.addEventListener("squeeze",B),i.addEventListener("squeezestart",B),i.addEventListener("squeezeend",B),i.addEventListener("end",q),i.addEventListener("inputsourceschange",K),E.xrCompatible!==!0&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(L),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let le=null,fe=null,we=null;E.depth&&(we=E.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,le=E.stencil?B0:oh,fe=E.stencil?ry:Ku);const pe={colorFormat:n.RGBA8,depthFormat:we,scaleFactor:s};h=this.getBinding(),g=h.createProjectionLayer(pe),i.updateRenderState({layers:[g]}),e.setPixelRatio(1),e.setSize(g.textureWidth,g.textureHeight,!1),N=new iu(g.textureWidth,g.textureHeight,{format:ul,type:zl,depthTexture:new ay(g.textureWidth,g.textureHeight,fe,void 0,void 0,void 0,void 0,void 0,void 0,le),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}else{const le={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:s};v=new XRWebGLLayer(i,n,le),i.updateRenderState({baseLayer:v}),e.setPixelRatio(1),e.setSize(v.framebufferWidth,v.framebufferHeight,!1),N=new iu(v.framebufferWidth,v.framebufferHeight,{format:ul,type:zl,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:v.ignoreDepthValues===!1,resolveStencilBuffer:v.ignoreDepthValues===!1})}N.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),ne.setContext(i),ne.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return w.getDepthTexture()};function K(re){for(let ue=0;ue<re.removed.length;ue++){const le=re.removed[ue],fe=P.indexOf(le);fe>=0&&(P[fe]=null,D[fe].disconnect(le))}for(let ue=0;ue<re.added.length;ue++){const le=re.added[ue];let fe=P.indexOf(le);if(fe===-1){for(let pe=0;pe<D.length;pe++)if(pe>=P.length){P.push(le),fe=pe;break}else if(P[pe]===null){P[pe]=le,fe=pe;break}if(fe===-1)break}const we=D[fe];we&&we.connect(le)}}const Y=new Fe,Q=new Fe;function U(re,ue,le){Y.setFromMatrixPosition(ue.matrixWorld),Q.setFromMatrixPosition(le.matrixWorld);const fe=Y.distanceTo(Q),we=ue.projectionMatrix.elements,pe=le.projectionMatrix.elements,xe=we[14]/(we[10]-1),Ve=we[14]/(we[10]+1),ye=(we[9]+1)/we[5],Oe=(we[9]-1)/we[5],he=(we[8]-1)/we[0],Re=(pe[8]+1)/pe[0],oe=xe*he,Ue=xe*Re,Ee=fe/(-he+Re),Pe=Ee*-he;if(ue.matrixWorld.decompose(re.position,re.quaternion,re.scale),re.translateX(Pe),re.translateZ(Ee),re.matrixWorld.compose(re.position,re.quaternion,re.scale),re.matrixWorldInverse.copy(re.matrixWorld).invert(),we[10]===-1)re.projectionMatrix.copy(ue.projectionMatrix),re.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const Ze=xe+Ee,ae=Ve+Ee,te=oe-Pe,be=Ue+(fe-Pe),me=ye*Ve/ae*Ze,ge=Oe*Ve/ae*Ze;re.projectionMatrix.makePerspective(te,be,me,ge,Ze,ae),re.projectionMatrixInverse.copy(re.projectionMatrix).invert()}}function j(re,ue){ue===null?re.matrixWorld.copy(re.matrix):re.matrixWorld.multiplyMatrices(ue.matrixWorld,re.matrix),re.matrixWorldInverse.copy(re.matrixWorld).invert()}this.updateCamera=function(re){if(i===null)return;let ue=re.near,le=re.far;w.texture!==null&&(w.depthNear>0&&(ue=w.depthNear),w.depthFar>0&&(le=w.depthFar)),V.near=W.near=O.near=ue,V.far=W.far=O.far=le,(G!==V.near||Z!==V.far)&&(i.updateRenderState({depthNear:V.near,depthFar:V.far}),G=V.near,Z=V.far),V.layers.mask=re.layers.mask|6,O.layers.mask=V.layers.mask&-5,W.layers.mask=V.layers.mask&-3;const fe=re.parent,we=V.cameras;j(V,fe);for(let pe=0;pe<we.length;pe++)j(we[pe],fe);we.length===2?U(V,O,W):V.projectionMatrix.copy(O.projectionMatrix),X(re,V,fe)};function X(re,ue,le){le===null?re.matrix.copy(ue.matrixWorld):(re.matrix.copy(le.matrixWorld),re.matrix.invert(),re.matrix.multiply(ue.matrixWorld)),re.matrix.decompose(re.position,re.quaternion,re.scale),re.updateMatrixWorld(!0),re.projectionMatrix.copy(ue.projectionMatrix),re.projectionMatrixInverse.copy(ue.projectionMatrixInverse),re.isPerspectiveCamera&&(re.fov=iy*2*Math.atan(1/re.projectionMatrix.elements[5]),re.zoom=1)}this.getCamera=function(){return V},this.getFoveation=function(){if(!(g===null&&v===null))return l},this.setFoveation=function(re){l=re,g!==null&&(g.fixedFoveation=re),v!==null&&v.fixedFoveation!==void 0&&(v.fixedFoveation=re)},this.hasDepthSensing=function(){return w.texture!==null},this.getDepthSensingMesh=function(){return w.getMesh(V)},this.getCameraTexture=function(re){return S[re]};let H=null;function ie(re,ue){if(d=ue.getViewerPose(c||a),b=ue,d!==null){const le=d.views;v!==null&&(e.setRenderTargetFramebuffer(N,v.framebuffer),e.setRenderTarget(N));let fe=!1;le.length!==V.cameras.length&&(V.cameras.length=0,fe=!0);for(let Ve=0;Ve<le.length;Ve++){const ye=le[Ve];let Oe=null;if(v!==null)Oe=v.getViewport(ye);else{const Re=h.getViewSubImage(g,ye);Oe=Re.viewport,Ve===0&&(e.setRenderTargetTextures(N,Re.colorTexture,Re.depthStencilTexture),e.setRenderTarget(N))}let he=F[Ve];he===void 0&&(he=new ea,he.layers.enable(Ve),he.viewport=new ci,F[Ve]=he),he.matrix.fromArray(ye.transform.matrix),he.matrix.decompose(he.position,he.quaternion,he.scale),he.projectionMatrix.fromArray(ye.projectionMatrix),he.projectionMatrixInverse.copy(he.projectionMatrix).invert(),he.viewport.set(Oe.x,Oe.y,Oe.width,Oe.height),Ve===0&&(V.matrix.copy(he.matrix),V.matrix.decompose(V.position,V.quaternion,V.scale)),fe===!0&&V.cameras.push(he)}const we=i.enabledFeatures;if(we&&we.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){h=r.getBinding();const Ve=h.getDepthInformation(le[0]);Ve&&Ve.isValid&&Ve.texture&&w.init(Ve,i.renderState)}if(we&&we.includes("camera-access")&&_){e.state.unbindTexture(),h=r.getBinding();for(let Ve=0;Ve<le.length;Ve++){const ye=le[Ve].camera;if(ye){let Oe=S[ye];Oe||(Oe=new o9,S[ye]=Oe);const he=h.getCameraImage(ye);Oe.sourceTexture=he}}}}for(let le=0;le<D.length;le++){const fe=P[le],we=D[le];fe!==null&&we!==void 0&&we.update(fe,ue,c||a)}H&&H(re,ue),ue.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:ue}),b=null}const ne=new aK;ne.setAnimationLoop(ie),this.setAnimationLoop=function(re){H=re},this.dispose=function(){}}}const _g=new su,DTe=new rr;function OTe(t,e){function n(w,S){w.matrixAutoUpdate===!0&&w.updateMatrix(),S.value.copy(w.matrix)}function r(w,S){S.color.getRGB(w.fogColor.value,AY(t)),S.isFog?(w.fogNear.value=S.near,w.fogFar.value=S.far):S.isFogExp2&&(w.fogDensity.value=S.density)}function i(w,S,E,A,N){S.isMeshBasicMaterial?s(w,S):S.isMeshLambertMaterial?(s(w,S),S.envMap&&(w.envMapIntensity.value=S.envMapIntensity)):S.isMeshToonMaterial?(s(w,S),h(w,S)):S.isMeshPhongMaterial?(s(w,S),d(w,S),S.envMap&&(w.envMapIntensity.value=S.envMapIntensity)):S.isMeshStandardMaterial?(s(w,S),g(w,S),S.isMeshPhysicalMaterial&&v(w,S,N)):S.isMeshMatcapMaterial?(s(w,S),b(w,S)):S.isMeshDepthMaterial?s(w,S):S.isMeshDistanceMaterial?(s(w,S),_(w,S)):S.isMeshNormalMaterial?s(w,S):S.isLineBasicMaterial?(a(w,S),S.isLineDashedMaterial&&o(w,S)):S.isPointsMaterial?l(w,S,E,A):S.isSpriteMaterial?c(w,S):S.isShadowMaterial?(w.color.value.copy(S.color),w.opacity.value=S.opacity):S.isShaderMaterial&&(S.uniformsNeedUpdate=!1)}function s(w,S){w.opacity.value=S.opacity,S.color&&w.diffuse.value.copy(S.color),S.emissive&&w.emissive.value.copy(S.emissive).multiplyScalar(S.emissiveIntensity),S.map&&(w.map.value=S.map,n(S.map,w.mapTransform)),S.alphaMap&&(w.alphaMap.value=S.alphaMap,n(S.alphaMap,w.alphaMapTransform)),S.bumpMap&&(w.bumpMap.value=S.bumpMap,n(S.bumpMap,w.bumpMapTransform),w.bumpScale.value=S.bumpScale,S.side===Vl&&(w.bumpScale.value*=-1)),S.normalMap&&(w.normalMap.value=S.normalMap,n(S.normalMap,w.normalMapTransform),w.normalScale.value.copy(S.normalScale),S.side===Vl&&w.normalScale.value.negate()),S.displacementMap&&(w.displacementMap.value=S.displacementMap,n(S.displacementMap,w.displacementMapTransform),w.displacementScale.value=S.displacementScale,w.displacementBias.value=S.displacementBias),S.emissiveMap&&(w.emissiveMap.value=S.emissiveMap,n(S.emissiveMap,w.emissiveMapTransform)),S.specularMap&&(w.specularMap.value=S.specularMap,n(S.specularMap,w.specularMapTransform)),S.alphaTest>0&&(w.alphaTest.value=S.alphaTest);const E=e.get(S),A=E.envMap,N=E.envMapRotation;A&&(w.envMap.value=A,_g.copy(N),_g.x*=-1,_g.y*=-1,_g.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(_g.y*=-1,_g.z*=-1),w.envMapRotation.value.setFromMatrix4(DTe.makeRotationFromEuler(_g)),w.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=S.reflectivity,w.ior.value=S.ior,w.refractionRatio.value=S.refractionRatio),S.lightMap&&(w.lightMap.value=S.lightMap,w.lightMapIntensity.value=S.lightMapIntensity,n(S.lightMap,w.lightMapTransform)),S.aoMap&&(w.aoMap.value=S.aoMap,w.aoMapIntensity.value=S.aoMapIntensity,n(S.aoMap,w.aoMapTransform))}function a(w,S){w.diffuse.value.copy(S.color),w.opacity.value=S.opacity,S.map&&(w.map.value=S.map,n(S.map,w.mapTransform))}function o(w,S){w.dashSize.value=S.dashSize,w.totalSize.value=S.dashSize+S.gapSize,w.scale.value=S.scale}function l(w,S,E,A){w.diffuse.value.copy(S.color),w.opacity.value=S.opacity,w.size.value=S.size*E,w.scale.value=A*.5,S.map&&(w.map.value=S.map,n(S.map,w.uvTransform)),S.alphaMap&&(w.alphaMap.value=S.alphaMap,n(S.alphaMap,w.alphaMapTransform)),S.alphaTest>0&&(w.alphaTest.value=S.alphaTest)}function c(w,S){w.diffuse.value.copy(S.color),w.opacity.value=S.opacity,w.rotation.value=S.rotation,S.map&&(w.map.value=S.map,n(S.map,w.mapTransform)),S.alphaMap&&(w.alphaMap.value=S.alphaMap,n(S.alphaMap,w.alphaMapTransform)),S.alphaTest>0&&(w.alphaTest.value=S.alphaTest)}function d(w,S){w.specular.value.copy(S.specular),w.shininess.value=Math.max(S.shininess,1e-4)}function h(w,S){S.gradientMap&&(w.gradientMap.value=S.gradientMap)}function g(w,S){w.metalness.value=S.metalness,S.metalnessMap&&(w.metalnessMap.value=S.metalnessMap,n(S.metalnessMap,w.metalnessMapTransform)),w.roughness.value=S.roughness,S.roughnessMap&&(w.roughnessMap.value=S.roughnessMap,n(S.roughnessMap,w.roughnessMapTransform)),S.envMap&&(w.envMapIntensity.value=S.envMapIntensity)}function v(w,S,E){w.ior.value=S.ior,S.sheen>0&&(w.sheenColor.value.copy(S.sheenColor).multiplyScalar(S.sheen),w.sheenRoughness.value=S.sheenRoughness,S.sheenColorMap&&(w.sheenColorMap.value=S.sheenColorMap,n(S.sheenColorMap,w.sheenColorMapTransform)),S.sheenRoughnessMap&&(w.sheenRoughnessMap.value=S.sheenRoughnessMap,n(S.sheenRoughnessMap,w.sheenRoughnessMapTransform))),S.clearcoat>0&&(w.clearcoat.value=S.clearcoat,w.clearcoatRoughness.value=S.clearcoatRoughness,S.clearcoatMap&&(w.clearcoatMap.value=S.clearcoatMap,n(S.clearcoatMap,w.clearcoatMapTransform)),S.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=S.clearcoatRoughnessMap,n(S.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),S.clearcoatNormalMap&&(w.clearcoatNormalMap.value=S.clearcoatNormalMap,n(S.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(S.clearcoatNormalScale),S.side===Vl&&w.clearcoatNormalScale.value.negate())),S.dispersion>0&&(w.dispersion.value=S.dispersion),S.iridescence>0&&(w.iridescence.value=S.iridescence,w.iridescenceIOR.value=S.iridescenceIOR,w.iridescenceThicknessMinimum.value=S.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=S.iridescenceThicknessRange[1],S.iridescenceMap&&(w.iridescenceMap.value=S.iridescenceMap,n(S.iridescenceMap,w.iridescenceMapTransform)),S.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=S.iridescenceThicknessMap,n(S.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),S.transmission>0&&(w.transmission.value=S.transmission,w.transmissionSamplerMap.value=E.texture,w.transmissionSamplerSize.value.set(E.width,E.height),S.transmissionMap&&(w.transmissionMap.value=S.transmissionMap,n(S.transmissionMap,w.transmissionMapTransform)),w.thickness.value=S.thickness,S.thicknessMap&&(w.thicknessMap.value=S.thicknessMap,n(S.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=S.attenuationDistance,w.attenuationColor.value.copy(S.attenuationColor)),S.anisotropy>0&&(w.anisotropyVector.value.set(S.anisotropy*Math.cos(S.anisotropyRotation),S.anisotropy*Math.sin(S.anisotropyRotation)),S.anisotropyMap&&(w.anisotropyMap.value=S.anisotropyMap,n(S.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=S.specularIntensity,w.specularColor.value.copy(S.specularColor),S.specularColorMap&&(w.specularColorMap.value=S.specularColorMap,n(S.specularColorMap,w.specularColorMapTransform)),S.specularIntensityMap&&(w.specularIntensityMap.value=S.specularIntensityMap,n(S.specularIntensityMap,w.specularIntensityMapTransform))}function b(w,S){S.matcap&&(w.matcap.value=S.matcap)}function _(w,S){const E=e.get(S).light;w.referencePosition.value.setFromMatrixPosition(E.matrixWorld),w.nearDistance.value=E.shadow.camera.near,w.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function LTe(t,e,n,r){let i={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,A){const N=A.program;r.uniformBlockBinding(E,N)}function c(E,A){let N=i[E.id];N===void 0&&(b(E),N=d(E),i[E.id]=N,E.addEventListener("dispose",w));const D=A.program;r.updateUBOMapping(E,D);const P=e.render.frame;s[E.id]!==P&&(g(E),s[E.id]=P)}function d(E){const A=h();E.__bindingPointIndex=A;const N=t.createBuffer(),D=E.__size,P=E.usage;return t.bindBuffer(t.UNIFORM_BUFFER,N),t.bufferData(t.UNIFORM_BUFFER,D,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,A,N),N}function h(){for(let E=0;E<o;E++)if(a.indexOf(E)===-1)return a.push(E),E;return Hn("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function g(E){const A=i[E.id],N=E.uniforms,D=E.__cache;t.bindBuffer(t.UNIFORM_BUFFER,A);for(let P=0,L=N.length;P<L;P++){const R=Array.isArray(N[P])?N[P]:[N[P]];for(let O=0,W=R.length;O<W;O++){const F=R[O];if(v(F,P,O,D)===!0){const V=F.__offset,G=Array.isArray(F.value)?F.value:[F.value];let Z=0;for(let B=0;B<G.length;B++){const q=G[B],K=_(q);typeof q=="number"||typeof q=="boolean"?(F.__data[0]=q,t.bufferSubData(t.UNIFORM_BUFFER,V+Z,F.__data)):q.isMatrix3?(F.__data[0]=q.elements[0],F.__data[1]=q.elements[1],F.__data[2]=q.elements[2],F.__data[3]=0,F.__data[4]=q.elements[3],F.__data[5]=q.elements[4],F.__data[6]=q.elements[5],F.__data[7]=0,F.__data[8]=q.elements[6],F.__data[9]=q.elements[7],F.__data[10]=q.elements[8],F.__data[11]=0):(q.toArray(F.__data,Z),Z+=K.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,V,F.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function v(E,A,N,D){const P=E.value,L=A+"_"+N;if(D[L]===void 0)return typeof P=="number"||typeof P=="boolean"?D[L]=P:D[L]=P.clone(),!0;{const R=D[L];if(typeof P=="number"||typeof P=="boolean"){if(R!==P)return D[L]=P,!0}else if(R.equals(P)===!1)return R.copy(P),!0}return!1}function b(E){const A=E.uniforms;let N=0;const D=16;for(let L=0,R=A.length;L<R;L++){const O=Array.isArray(A[L])?A[L]:[A[L]];for(let W=0,F=O.length;W<F;W++){const V=O[W],G=Array.isArray(V.value)?V.value:[V.value];for(let Z=0,B=G.length;Z<B;Z++){const q=G[Z],K=_(q),Y=N%D,Q=Y%K.boundary,U=Y+Q;N+=Q,U!==0&&D-U<K.storage&&(N+=D-U),V.__data=new Float32Array(K.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=N,N+=K.storage}}}const P=N%D;return P>0&&(N+=D-P),E.__size=N,E.__cache={},this}function _(E){const A={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(A.boundary=4,A.storage=4):E.isVector2?(A.boundary=8,A.storage=8):E.isVector3||E.isColor?(A.boundary=16,A.storage=12):E.isVector4?(A.boundary=16,A.storage=16):E.isMatrix3?(A.boundary=48,A.storage=48):E.isMatrix4?(A.boundary=64,A.storage=64):E.isTexture?hn("WebGLRenderer: Texture samplers can not be part of an uniforms group."):hn("WebGLRenderer: Unsupported uniform value type.",E),A}function w(E){const A=E.target;A.removeEventListener("dispose",w);const N=a.indexOf(A.__bindingPointIndex);a.splice(N,1),t.deleteBuffer(i[A.id]),delete i[A.id],delete s[A.id]}function S(){for(const E in i)t.deleteBuffer(i[E]);a=[],i={},s={}}return{bind:l,update:c,dispose:S}}const zTe=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Rf=null;function jTe(){return Rf===null&&(Rf=new Bd(zTe,16,16,cv,ah),Rf.name="DFG_LUT",Rf.minFilter=rs,Rf.magFilter=rs,Rf.wrapS=Tc,Rf.wrapT=Tc,Rf.generateMipmaps=!1,Rf.needsUpdate=!0),Rf}class fK{constructor(e={}){const{canvas:n=rY(),context:r=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:g=!1,outputBufferType:v=zl}=e;this.isWebGLRenderer=!0;let b;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");b=r.getContextAttributes().alpha}else b=a;const _=v,w=new Set([QT,ZT,bw]),S=new Set([zl,Ku,ny,ry,XT,YT]),E=new Uint32Array(4),A=new Int32Array(4);let N=null,D=null;const P=[],L=[];let R=null;this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=nu,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const O=this;let W=!1;this._outputColorSpace=cl;let F=0,V=0,G=null,Z=-1,B=null;const q=new ci,K=new ci;let Y=null;const Q=new xn(0);let U=0,j=n.width,X=n.height,H=1,ie=null,ne=null;const re=new ci(0,0,j,X),ue=new ci(0,0,j,X);let le=!1;const fe=new Py;let we=!1,pe=!1;const xe=new rr,Ve=new Fe,ye=new ci,Oe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let he=!1;function Re(){return G===null?H:1}let oe=r;function Ue(ve,ot){return n.getContext(ve,ot)}try{const ve={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:h};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${xw}`),n.addEventListener("webglcontextlost",ze,!1),n.addEventListener("webglcontextrestored",Te,!1),n.addEventListener("webglcontextcreationerror",He,!1),oe===null){const ot="webgl2";if(oe=Ue(ot,ve),oe===null)throw Ue(ot)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(ve){throw Hn("WebGLRenderer: "+ve.message),ve}let Ee,Pe,Ze,ae,te,be,me,ge,ke,Xe,Ae,je,We,De,Be,qe,Se,Ye,dt,Le,st,ft,mt;function tt(){Ee=new U2e(oe),Ee.init(),st=new dK(oe,Ee),Pe=new P2e(oe,Ee,e,st),Ze=new ATe(oe,Ee),Pe.reversedDepthBuffer&&g&&Ze.buffers.depth.setReversed(!0),ae=new V2e(oe),te=new pTe,be=new NTe(oe,Ee,Ze,te,Pe,st,ae),me=new F2e(O),ge=new X3e(oe),ft=new R2e(oe,ge),ke=new B2e(oe,ge,ae,ft),Xe=new W2e(oe,ke,ge,ft,ae),Ye=new G2e(oe,Pe,be),Be=new I2e(te),Ae=new hTe(O,me,Ee,Pe,ft,Be),je=new OTe(O,te),We=new gTe,De=new STe(Ee),Se=new N2e(O,me,Ze,Xe,b,l),qe=new CTe(O,Xe,Pe),mt=new LTe(oe,ae,Pe,Ze),dt=new k2e(oe,Ee,ae),Le=new H2e(oe,Ee,ae),ae.programs=Ae.programs,O.capabilities=Pe,O.extensions=Ee,O.properties=te,O.renderLists=We,O.shadowMap=qe,O.state=Ze,O.info=ae}tt(),_!==zl&&(R=new q2e(_,n.width,n.height,i,s));const Qe=new ITe(O,oe);this.xr=Qe,this.getContext=function(){return oe},this.getContextAttributes=function(){return oe.getContextAttributes()},this.forceContextLoss=function(){const ve=Ee.get("WEBGL_lose_context");ve&&ve.loseContext()},this.forceContextRestore=function(){const ve=Ee.get("WEBGL_lose_context");ve&&ve.restoreContext()},this.getPixelRatio=function(){return H},this.setPixelRatio=function(ve){ve!==void 0&&(H=ve,this.setSize(j,X,!1))},this.getSize=function(ve){return ve.set(j,X)},this.setSize=function(ve,ot,_t=!0){if(Qe.isPresenting){hn("WebGLRenderer: Can't change size while VR device is presenting.");return}j=ve,X=ot,n.width=Math.floor(ve*H),n.height=Math.floor(ot*H),_t===!0&&(n.style.width=ve+"px",n.style.height=ot+"px"),R!==null&&R.setSize(n.width,n.height),this.setViewport(0,0,ve,ot)},this.getDrawingBufferSize=function(ve){return ve.set(j*H,X*H).floor()},this.setDrawingBufferSize=function(ve,ot,_t){j=ve,X=ot,H=_t,n.width=Math.floor(ve*_t),n.height=Math.floor(ot*_t),this.setViewport(0,0,ve,ot)},this.setEffects=function(ve){if(_===zl){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(ve){for(let ot=0;ot<ve.length;ot++)if(ve[ot].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}R.setEffects(ve||[])},this.getCurrentViewport=function(ve){return ve.copy(q)},this.getViewport=function(ve){return ve.copy(re)},this.setViewport=function(ve,ot,_t,yt){ve.isVector4?re.set(ve.x,ve.y,ve.z,ve.w):re.set(ve,ot,_t,yt),Ze.viewport(q.copy(re).multiplyScalar(H).round())},this.getScissor=function(ve){return ve.copy(ue)},this.setScissor=function(ve,ot,_t,yt){ve.isVector4?ue.set(ve.x,ve.y,ve.z,ve.w):ue.set(ve,ot,_t,yt),Ze.scissor(K.copy(ue).multiplyScalar(H).round())},this.getScissorTest=function(){return le},this.setScissorTest=function(ve){Ze.setScissorTest(le=ve)},this.setOpaqueSort=function(ve){ie=ve},this.setTransparentSort=function(ve){ne=ve},this.getClearColor=function(ve){return ve.copy(Se.getClearColor())},this.setClearColor=function(){Se.setClearColor(...arguments)},this.getClearAlpha=function(){return Se.getClearAlpha()},this.setClearAlpha=function(){Se.setClearAlpha(...arguments)},this.clear=function(ve=!0,ot=!0,_t=!0){let yt=0;if(ve){let vt=!1;if(G!==null){const Yt=G.texture.format;vt=w.has(Yt)}if(vt){const Yt=G.texture.type,rn=S.has(Yt),sn=Se.getClearColor(),Zt=Se.getClearAlpha(),Mn=sn.r,Un=sn.g,$n=sn.b;rn?(E[0]=Mn,E[1]=Un,E[2]=$n,E[3]=Zt,oe.clearBufferuiv(oe.COLOR,0,E)):(A[0]=Mn,A[1]=Un,A[2]=$n,A[3]=Zt,oe.clearBufferiv(oe.COLOR,0,A))}else yt|=oe.COLOR_BUFFER_BIT}ot&&(yt|=oe.DEPTH_BUFFER_BIT),_t&&(yt|=oe.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),yt!==0&&oe.clear(yt)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",ze,!1),n.removeEventListener("webglcontextrestored",Te,!1),n.removeEventListener("webglcontextcreationerror",He,!1),Se.dispose(),We.dispose(),De.dispose(),te.dispose(),me.dispose(),Xe.dispose(),ft.dispose(),mt.dispose(),Ae.dispose(),Qe.dispose(),Qe.removeEventListener("sessionstart",$e),Qe.removeEventListener("sessionend",Tt),Et.stop()};function ze(ve){ve.preventDefault(),MS("WebGLRenderer: Context Lost."),W=!0}function Te(){MS("WebGLRenderer: Context Restored."),W=!1;const ve=ae.autoReset,ot=qe.enabled,_t=qe.autoUpdate,yt=qe.needsUpdate,vt=qe.type;tt(),ae.autoReset=ve,qe.enabled=ot,qe.autoUpdate=_t,qe.needsUpdate=yt,qe.type=vt}function He(ve){Hn("WebGLRenderer: A WebGL context could not be created. Reason: ",ve.statusMessage)}function et(ve){const ot=ve.target;ot.removeEventListener("dispose",et),ht(ot)}function ht(ve){ct(ve),te.remove(ve)}function ct(ve){const ot=te.get(ve).programs;ot!==void 0&&(ot.forEach(function(_t){Ae.releaseProgram(_t)}),ve.isShaderMaterial&&Ae.releaseShaderCache(ve))}this.renderBufferDirect=function(ve,ot,_t,yt,vt,Yt){ot===null&&(ot=Oe);const rn=vt.isMesh&&vt.matrixWorld.determinant()<0,sn=Nn(ve,ot,_t,yt,vt);Ze.setMaterial(yt,rn);let Zt=_t.index,Mn=1;if(yt.wireframe===!0){if(Zt=ke.getWireframeAttribute(_t),Zt===void 0)return;Mn=2}const Un=_t.drawRange,$n=_t.attributes.position;let on=Un.start*Mn,ir=(Un.start+Un.count)*Mn;Yt!==null&&(on=Math.max(on,Yt.start*Mn),ir=Math.min(ir,(Yt.start+Yt.count)*Mn)),Zt!==null?(on=Math.max(on,0),ir=Math.min(ir,Zt.count)):$n!=null&&(on=Math.max(on,0),ir=Math.min(ir,$n.count));const Xr=ir-on;if(Xr<0||Xr===1/0)return;ft.setup(vt,yt,sn,_t,Zt);let Jr,cr=dt;if(Zt!==null&&(Jr=ge.get(Zt),cr=Le,cr.setIndex(Jr)),vt.isMesh)yt.wireframe===!0?(Ze.setLineWidth(yt.wireframeLinewidth*Re()),cr.setMode(oe.LINES)):cr.setMode(oe.TRIANGLES);else if(vt.isLine){let Nr=yt.linewidth;Nr===void 0&&(Nr=1),Ze.setLineWidth(Nr*Re()),vt.isLineSegments?cr.setMode(oe.LINES):vt.isLineLoop?cr.setMode(oe.LINE_LOOP):cr.setMode(oe.LINE_STRIP)}else vt.isPoints?cr.setMode(oe.POINTS):vt.isSprite&&cr.setMode(oe.TRIANGLES);if(vt.isBatchedMesh)if(vt._multiDrawInstances!==null)TS("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),cr.renderMultiDrawInstances(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount,vt._multiDrawInstances);else if(Ee.get("WEBGL_multi_draw"))cr.renderMultiDraw(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount);else{const Nr=vt._multiDrawStarts,en=vt._multiDrawCounts,ss=vt._multiDrawCount,Rn=Zt?ge.get(Zt).bytesPerElement:1,gs=te.get(yt).currentProgram.getUniforms();for(let Rs=0;Rs<ss;Rs++)gs.setValue(oe,"_gl_DrawID",Rs),cr.render(Nr[Rs]/Rn,en[Rs])}else if(vt.isInstancedMesh)cr.renderInstances(on,Xr,vt.count);else if(_t.isInstancedBufferGeometry){const Nr=_t._maxInstanceCount!==void 0?_t._maxInstanceCount:1/0,en=Math.min(_t.instanceCount,Nr);cr.renderInstances(on,Xr,en)}else cr.render(on,Xr)};function bt(ve,ot,_t){ve.transparent===!0&&ve.side===Xc&&ve.forceSinglePass===!1?(ve.side=Vl,ve.needsUpdate=!0,fn(ve,ot,_t),ve.side=gp,ve.needsUpdate=!0,fn(ve,ot,_t),ve.side=Xc):fn(ve,ot,_t)}this.compile=function(ve,ot,_t=null){_t===null&&(_t=ve),D=De.get(_t),D.init(ot),L.push(D),_t.traverseVisible(function(vt){vt.isLight&&vt.layers.test(ot.layers)&&(D.pushLight(vt),vt.castShadow&&D.pushShadow(vt))}),ve!==_t&&ve.traverseVisible(function(vt){vt.isLight&&vt.layers.test(ot.layers)&&(D.pushLight(vt),vt.castShadow&&D.pushShadow(vt))}),D.setupLights();const yt=new Set;return ve.traverse(function(vt){if(!(vt.isMesh||vt.isPoints||vt.isLine||vt.isSprite))return;const Yt=vt.material;if(Yt)if(Array.isArray(Yt))for(let rn=0;rn<Yt.length;rn++){const sn=Yt[rn];bt(sn,_t,vt),yt.add(sn)}else bt(Yt,_t,vt),yt.add(Yt)}),D=L.pop(),yt},this.compileAsync=function(ve,ot,_t=null){const yt=this.compile(ve,ot,_t);return new Promise(vt=>{function Yt(){if(yt.forEach(function(rn){te.get(rn).currentProgram.isReady()&&yt.delete(rn)}),yt.size===0){vt(ve);return}setTimeout(Yt,10)}Ee.get("KHR_parallel_shader_compile")!==null?Yt():setTimeout(Yt,10)})};let wt=null;function Pt(ve){wt&&wt(ve)}function $e(){Et.stop()}function Tt(){Et.start()}const Et=new aK;Et.setAnimationLoop(Pt),typeof self<"u"&&Et.setContext(self),this.setAnimationLoop=function(ve){wt=ve,Qe.setAnimationLoop(ve),ve===null?Et.stop():Et.start()},Qe.addEventListener("sessionstart",$e),Qe.addEventListener("sessionend",Tt),this.render=function(ve,ot){if(ot!==void 0&&ot.isCamera!==!0){Hn("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(W===!0)return;const _t=Qe.enabled===!0&&Qe.isPresenting===!0,yt=R!==null&&(G===null||_t)&&R.begin(O,G);if(ve.matrixWorldAutoUpdate===!0&&ve.updateMatrixWorld(),ot.parent===null&&ot.matrixWorldAutoUpdate===!0&&ot.updateMatrixWorld(),Qe.enabled===!0&&Qe.isPresenting===!0&&(R===null||R.isCompositing()===!1)&&(Qe.cameraAutoUpdate===!0&&Qe.updateCamera(ot),ot=Qe.getCamera()),ve.isScene===!0&&ve.onBeforeRender(O,ve,ot,G),D=De.get(ve,L.length),D.init(ot),L.push(D),xe.multiplyMatrices(ot.projectionMatrix,ot.matrixWorldInverse),fe.setFromProjectionMatrix(xe,Zc,ot.reversedDepth),pe=this.localClippingEnabled,we=Be.init(this.clippingPlanes,pe),N=We.get(ve,P.length),N.init(),P.push(N),Qe.enabled===!0&&Qe.isPresenting===!0){const rn=O.xr.getDepthSensingMesh();rn!==null&&Ot(rn,ot,-1/0,O.sortObjects)}Ot(ve,ot,0,O.sortObjects),N.finish(),O.sortObjects===!0&&N.sort(ie,ne),he=Qe.enabled===!1||Qe.isPresenting===!1||Qe.hasDepthSensing()===!1,he&&Se.addToRenderList(N,ve),this.info.render.frame++,we===!0&&Be.beginShadows();const vt=D.state.shadowsArray;if(qe.render(vt,ve,ot),we===!0&&Be.endShadows(),this.info.autoReset===!0&&this.info.reset(),(yt&&R.hasRenderPass())===!1){const rn=N.opaque,sn=N.transmissive;if(D.setupLights(),ot.isArrayCamera){const Zt=ot.cameras;if(sn.length>0)for(let Mn=0,Un=Zt.length;Mn<Un;Mn++){const $n=Zt[Mn];an(rn,sn,ve,$n)}he&&Se.render(ve);for(let Mn=0,Un=Zt.length;Mn<Un;Mn++){const $n=Zt[Mn];Gt(N,ve,$n,$n.viewport)}}else sn.length>0&&an(rn,sn,ve,ot),he&&Se.render(ve),Gt(N,ve,ot)}G!==null&&V===0&&(be.updateMultisampleRenderTarget(G),be.updateRenderTargetMipmap(G)),yt&&R.end(O),ve.isScene===!0&&ve.onAfterRender(O,ve,ot),ft.resetDefaultState(),Z=-1,B=null,L.pop(),L.length>0?(D=L[L.length-1],we===!0&&Be.setGlobalState(O.clippingPlanes,D.state.camera)):D=null,P.pop(),P.length>0?N=P[P.length-1]:N=null};function Ot(ve,ot,_t,yt){if(ve.visible===!1)return;if(ve.layers.test(ot.layers)){if(ve.isGroup)_t=ve.renderOrder;else if(ve.isLOD)ve.autoUpdate===!0&&ve.update(ot);else if(ve.isLight)D.pushLight(ve),ve.castShadow&&D.pushShadow(ve);else if(ve.isSprite){if(!ve.frustumCulled||fe.intersectsSprite(ve)){yt&&ye.setFromMatrixPosition(ve.matrixWorld).applyMatrix4(xe);const rn=Xe.update(ve),sn=ve.material;sn.visible&&N.push(ve,rn,sn,_t,ye.z,null)}}else if((ve.isMesh||ve.isLine||ve.isPoints)&&(!ve.frustumCulled||fe.intersectsObject(ve))){const rn=Xe.update(ve),sn=ve.material;if(yt&&(ve.boundingSphere!==void 0?(ve.boundingSphere===null&&ve.computeBoundingSphere(),ye.copy(ve.boundingSphere.center)):(rn.boundingSphere===null&&rn.computeBoundingSphere(),ye.copy(rn.boundingSphere.center)),ye.applyMatrix4(ve.matrixWorld).applyMatrix4(xe)),Array.isArray(sn)){const Zt=rn.groups;for(let Mn=0,Un=Zt.length;Mn<Un;Mn++){const $n=Zt[Mn],on=sn[$n.materialIndex];on&&on.visible&&N.push(ve,rn,on,_t,ye.z,$n)}}else sn.visible&&N.push(ve,rn,sn,_t,ye.z,null)}}const Yt=ve.children;for(let rn=0,sn=Yt.length;rn<sn;rn++)Ot(Yt[rn],ot,_t,yt)}function Gt(ve,ot,_t,yt){const{opaque:vt,transmissive:Yt,transparent:rn}=ve;D.setupLightsView(_t),we===!0&&Be.setGlobalState(O.clippingPlanes,_t),yt&&Ze.viewport(q.copy(yt)),vt.length>0&&On(vt,ot,_t),Yt.length>0&&On(Yt,ot,_t),rn.length>0&&On(rn,ot,_t),Ze.buffers.depth.setTest(!0),Ze.buffers.depth.setMask(!0),Ze.buffers.color.setMask(!0),Ze.setPolygonOffset(!1)}function an(ve,ot,_t,yt){if((_t.isScene===!0?_t.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[yt.id]===void 0){const on=Ee.has("EXT_color_buffer_half_float")||Ee.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[yt.id]=new iu(1,1,{generateMipmaps:!0,type:on?ah:zl,minFilter:Kf,samples:Pe.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ii.workingColorSpace})}const Yt=D.state.transmissionRenderTarget[yt.id],rn=yt.viewport||q;Yt.setSize(rn.z*O.transmissionResolutionScale,rn.w*O.transmissionResolutionScale);const sn=O.getRenderTarget(),Zt=O.getActiveCubeFace(),Mn=O.getActiveMipmapLevel();O.setRenderTarget(Yt),O.getClearColor(Q),U=O.getClearAlpha(),U<1&&O.setClearColor(16777215,.5),O.clear(),he&&Se.render(_t);const Un=O.toneMapping;O.toneMapping=nu;const $n=yt.viewport;if(yt.viewport!==void 0&&(yt.viewport=void 0),D.setupLightsView(yt),we===!0&&Be.setGlobalState(O.clippingPlanes,yt),On(ve,_t,yt),be.updateMultisampleRenderTarget(Yt),be.updateRenderTargetMipmap(Yt),Ee.has("WEBGL_multisampled_render_to_texture")===!1){let on=!1;for(let ir=0,Xr=ot.length;ir<Xr;ir++){const Jr=ot[ir],{object:cr,geometry:Nr,material:en,group:ss}=Jr;if(en.side===Xc&&cr.layers.test(yt.layers)){const Rn=en.side;en.side=Vl,en.needsUpdate=!0,Bt(cr,_t,yt,Nr,en,ss),en.side=Rn,en.needsUpdate=!0,on=!0}}on===!0&&(be.updateMultisampleRenderTarget(Yt),be.updateRenderTargetMipmap(Yt))}O.setRenderTarget(sn,Zt,Mn),O.setClearColor(Q,U),$n!==void 0&&(yt.viewport=$n),O.toneMapping=Un}function On(ve,ot,_t){const yt=ot.isScene===!0?ot.overrideMaterial:null;for(let vt=0,Yt=ve.length;vt<Yt;vt++){const rn=ve[vt],{object:sn,geometry:Zt,group:Mn}=rn;let Un=rn.material;Un.allowOverride===!0&&yt!==null&&(Un=yt),sn.layers.test(_t.layers)&&Bt(sn,ot,_t,Zt,Un,Mn)}}function Bt(ve,ot,_t,yt,vt,Yt){ve.onBeforeRender(O,ot,_t,yt,vt,Yt),ve.modelViewMatrix.multiplyMatrices(_t.matrixWorldInverse,ve.matrixWorld),ve.normalMatrix.getNormalMatrix(ve.modelViewMatrix),vt.onBeforeRender(O,ot,_t,yt,ve,Yt),vt.transparent===!0&&vt.side===Xc&&vt.forceSinglePass===!1?(vt.side=Vl,vt.needsUpdate=!0,O.renderBufferDirect(_t,ot,yt,vt,ve,Yt),vt.side=gp,vt.needsUpdate=!0,O.renderBufferDirect(_t,ot,yt,vt,ve,Yt),vt.side=Xc):O.renderBufferDirect(_t,ot,yt,vt,ve,Yt),ve.onAfterRender(O,ot,_t,yt,vt,Yt)}function fn(ve,ot,_t){ot.isScene!==!0&&(ot=Oe);const yt=te.get(ve),vt=D.state.lights,Yt=D.state.shadowsArray,rn=vt.state.version,sn=Ae.getParameters(ve,vt.state,Yt,ot,_t),Zt=Ae.getProgramCacheKey(sn);let Mn=yt.programs;yt.environment=ve.isMeshStandardMaterial||ve.isMeshLambertMaterial||ve.isMeshPhongMaterial?ot.environment:null,yt.fog=ot.fog;const Un=ve.isMeshStandardMaterial||ve.isMeshLambertMaterial&&!ve.envMap||ve.isMeshPhongMaterial&&!ve.envMap;yt.envMap=me.get(ve.envMap||yt.environment,Un),yt.envMapRotation=yt.environment!==null&&ve.envMap===null?ot.environmentRotation:ve.envMapRotation,Mn===void 0&&(ve.addEventListener("dispose",et),Mn=new Map,yt.programs=Mn);let $n=Mn.get(Zt);if($n!==void 0){if(yt.currentProgram===$n&&yt.lightsStateVersion===rn)return In(ve,sn),$n}else sn.uniforms=Ae.getUniforms(ve),ve.onBeforeCompile(sn,O),$n=Ae.acquireProgram(sn,Zt),Mn.set(Zt,$n),yt.uniforms=sn.uniforms;const on=yt.uniforms;return(!ve.isShaderMaterial&&!ve.isRawShaderMaterial||ve.clipping===!0)&&(on.clippingPlanes=Be.uniform),In(ve,sn),yt.needsLights=Ln(ve),yt.lightsStateVersion=rn,yt.needsLights&&(on.ambientLightColor.value=vt.state.ambient,on.lightProbe.value=vt.state.probe,on.directionalLights.value=vt.state.directional,on.directionalLightShadows.value=vt.state.directionalShadow,on.spotLights.value=vt.state.spot,on.spotLightShadows.value=vt.state.spotShadow,on.rectAreaLights.value=vt.state.rectArea,on.ltc_1.value=vt.state.rectAreaLTC1,on.ltc_2.value=vt.state.rectAreaLTC2,on.pointLights.value=vt.state.point,on.pointLightShadows.value=vt.state.pointShadow,on.hemisphereLights.value=vt.state.hemi,on.directionalShadowMatrix.value=vt.state.directionalShadowMatrix,on.spotLightMatrix.value=vt.state.spotLightMatrix,on.spotLightMap.value=vt.state.spotLightMap,on.pointShadowMatrix.value=vt.state.pointShadowMatrix),yt.currentProgram=$n,yt.uniformsList=null,$n}function Ht(ve){if(ve.uniformsList===null){const ot=ve.currentProgram.getUniforms();ve.uniformsList=HM.seqWithValue(ot.seq,ve.uniforms)}return ve.uniformsList}function In(ve,ot){const _t=te.get(ve);_t.outputColorSpace=ot.outputColorSpace,_t.batching=ot.batching,_t.batchingColor=ot.batchingColor,_t.instancing=ot.instancing,_t.instancingColor=ot.instancingColor,_t.instancingMorph=ot.instancingMorph,_t.skinning=ot.skinning,_t.morphTargets=ot.morphTargets,_t.morphNormals=ot.morphNormals,_t.morphColors=ot.morphColors,_t.morphTargetsCount=ot.morphTargetsCount,_t.numClippingPlanes=ot.numClippingPlanes,_t.numIntersection=ot.numClipIntersection,_t.vertexAlphas=ot.vertexAlphas,_t.vertexTangents=ot.vertexTangents,_t.toneMapping=ot.toneMapping}function Nn(ve,ot,_t,yt,vt){ot.isScene!==!0&&(ot=Oe),be.resetTextureUnits();const Yt=ot.fog,rn=yt.isMeshStandardMaterial||yt.isMeshLambertMaterial||yt.isMeshPhongMaterial?ot.environment:null,sn=G===null?O.outputColorSpace:G.isXRRenderTarget===!0?G.texture.colorSpace:im,Zt=yt.isMeshStandardMaterial||yt.isMeshLambertMaterial&&!yt.envMap||yt.isMeshPhongMaterial&&!yt.envMap,Mn=me.get(yt.envMap||rn,Zt),Un=yt.vertexColors===!0&&!!_t.attributes.color&&_t.attributes.color.itemSize===4,$n=!!_t.attributes.tangent&&(!!yt.normalMap||yt.anisotropy>0),on=!!_t.morphAttributes.position,ir=!!_t.morphAttributes.normal,Xr=!!_t.morphAttributes.color;let Jr=nu;yt.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&(Jr=O.toneMapping);const cr=_t.morphAttributes.position||_t.morphAttributes.normal||_t.morphAttributes.color,Nr=cr!==void 0?cr.length:0,en=te.get(yt),ss=D.state.lights;if(we===!0&&(pe===!0||ve!==B)){const Ii=ve===B&&yt.id===Z;Be.setState(yt,ve,Ii)}let Rn=!1;yt.version===en.__version?(en.needsLights&&en.lightsStateVersion!==ss.state.version||en.outputColorSpace!==sn||vt.isBatchedMesh&&en.batching===!1||!vt.isBatchedMesh&&en.batching===!0||vt.isBatchedMesh&&en.batchingColor===!0&&vt.colorTexture===null||vt.isBatchedMesh&&en.batchingColor===!1&&vt.colorTexture!==null||vt.isInstancedMesh&&en.instancing===!1||!vt.isInstancedMesh&&en.instancing===!0||vt.isSkinnedMesh&&en.skinning===!1||!vt.isSkinnedMesh&&en.skinning===!0||vt.isInstancedMesh&&en.instancingColor===!0&&vt.instanceColor===null||vt.isInstancedMesh&&en.instancingColor===!1&&vt.instanceColor!==null||vt.isInstancedMesh&&en.instancingMorph===!0&&vt.morphTexture===null||vt.isInstancedMesh&&en.instancingMorph===!1&&vt.morphTexture!==null||en.envMap!==Mn||yt.fog===!0&&en.fog!==Yt||en.numClippingPlanes!==void 0&&(en.numClippingPlanes!==Be.numPlanes||en.numIntersection!==Be.numIntersection)||en.vertexAlphas!==Un||en.vertexTangents!==$n||en.morphTargets!==on||en.morphNormals!==ir||en.morphColors!==Xr||en.toneMapping!==Jr||en.morphTargetsCount!==Nr)&&(Rn=!0):(Rn=!0,en.__version=yt.version);let gs=en.currentProgram;Rn===!0&&(gs=fn(yt,ot,vt));let Rs=!1,Pi=!1,vs=!1;const pr=gs.getUniforms(),di=en.uniforms;if(Ze.useProgram(gs.program)&&(Rs=!0,Pi=!0,vs=!0),yt.id!==Z&&(Z=yt.id,Pi=!0),Rs||B!==ve){Ze.buffers.depth.getReversed()&&ve.reversedDepth!==!0&&(ve._reversedDepth=!0,ve.updateProjectionMatrix()),pr.setValue(oe,"projectionMatrix",ve.projectionMatrix),pr.setValue(oe,"viewMatrix",ve.matrixWorldInverse);const $a=pr.map.cameraPosition;$a!==void 0&&$a.setValue(oe,Ve.setFromMatrixPosition(ve.matrixWorld)),Pe.logarithmicDepthBuffer&&pr.setValue(oe,"logDepthBufFC",2/(Math.log(ve.far+1)/Math.LN2)),(yt.isMeshPhongMaterial||yt.isMeshToonMaterial||yt.isMeshLambertMaterial||yt.isMeshBasicMaterial||yt.isMeshStandardMaterial||yt.isShaderMaterial)&&pr.setValue(oe,"isOrthographic",ve.isOrthographicCamera===!0),B!==ve&&(B=ve,Pi=!0,vs=!0)}if(en.needsLights&&(ss.state.directionalShadowMap.length>0&&pr.setValue(oe,"directionalShadowMap",ss.state.directionalShadowMap,be),ss.state.spotShadowMap.length>0&&pr.setValue(oe,"spotShadowMap",ss.state.spotShadowMap,be),ss.state.pointShadowMap.length>0&&pr.setValue(oe,"pointShadowMap",ss.state.pointShadowMap,be)),vt.isSkinnedMesh){pr.setOptional(oe,vt,"bindMatrix"),pr.setOptional(oe,vt,"bindMatrixInverse");const Ii=vt.skeleton;Ii&&(Ii.boneTexture===null&&Ii.computeBoneTexture(),pr.setValue(oe,"boneTexture",Ii.boneTexture,be))}vt.isBatchedMesh&&(pr.setOptional(oe,vt,"batchingTexture"),pr.setValue(oe,"batchingTexture",vt._matricesTexture,be),pr.setOptional(oe,vt,"batchingIdTexture"),pr.setValue(oe,"batchingIdTexture",vt._indirectTexture,be),pr.setOptional(oe,vt,"batchingColorTexture"),vt._colorsTexture!==null&&pr.setValue(oe,"batchingColorTexture",vt._colorsTexture,be));const ks=_t.morphAttributes;if((ks.position!==void 0||ks.normal!==void 0||ks.color!==void 0)&&Ye.update(vt,_t,gs),(Pi||en.receiveShadow!==vt.receiveShadow)&&(en.receiveShadow=vt.receiveShadow,pr.setValue(oe,"receiveShadow",vt.receiveShadow)),(yt.isMeshStandardMaterial||yt.isMeshLambertMaterial||yt.isMeshPhongMaterial)&&yt.envMap===null&&ot.environment!==null&&(di.envMapIntensity.value=ot.environmentIntensity),di.dfgLUT!==void 0&&(di.dfgLUT.value=jTe()),Pi&&(pr.setValue(oe,"toneMappingExposure",O.toneMappingExposure),en.needsLights&&bn(di,vs),Yt&&yt.fog===!0&&je.refreshFogUniforms(di,Yt),je.refreshMaterialUniforms(di,yt,H,X,D.state.transmissionRenderTarget[ve.id]),HM.upload(oe,Ht(en),di,be)),yt.isShaderMaterial&&yt.uniformsNeedUpdate===!0&&(HM.upload(oe,Ht(en),di,be),yt.uniformsNeedUpdate=!1),yt.isSpriteMaterial&&pr.setValue(oe,"center",vt.center),pr.setValue(oe,"modelViewMatrix",vt.modelViewMatrix),pr.setValue(oe,"normalMatrix",vt.normalMatrix),pr.setValue(oe,"modelMatrix",vt.matrixWorld),yt.isShaderMaterial||yt.isRawShaderMaterial){const Ii=yt.uniformsGroups;for(let $a=0,co=Ii.length;$a<co;$a++){const So=Ii[$a];mt.update(So,gs),mt.bind(So,gs)}}return gs}function bn(ve,ot){ve.ambientLightColor.needsUpdate=ot,ve.lightProbe.needsUpdate=ot,ve.directionalLights.needsUpdate=ot,ve.directionalLightShadows.needsUpdate=ot,ve.pointLights.needsUpdate=ot,ve.pointLightShadows.needsUpdate=ot,ve.spotLights.needsUpdate=ot,ve.spotLightShadows.needsUpdate=ot,ve.rectAreaLights.needsUpdate=ot,ve.hemisphereLights.needsUpdate=ot}function Ln(ve){return ve.isMeshLambertMaterial||ve.isMeshToonMaterial||ve.isMeshPhongMaterial||ve.isMeshStandardMaterial||ve.isShadowMaterial||ve.isShaderMaterial&&ve.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return V},this.getRenderTarget=function(){return G},this.setRenderTargetTextures=function(ve,ot,_t){const yt=te.get(ve);yt.__autoAllocateDepthBuffer=ve.resolveDepthBuffer===!1,yt.__autoAllocateDepthBuffer===!1&&(yt.__useRenderToTexture=!1),te.get(ve.texture).__webglTexture=ot,te.get(ve.depthTexture).__webglTexture=yt.__autoAllocateDepthBuffer?void 0:_t,yt.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(ve,ot){const _t=te.get(ve);_t.__webglFramebuffer=ot,_t.__useDefaultFramebuffer=ot===void 0};const Fn=oe.createFramebuffer();this.setRenderTarget=function(ve,ot=0,_t=0){G=ve,F=ot,V=_t;let yt=null,vt=!1,Yt=!1;if(ve){const sn=te.get(ve);if(sn.__useDefaultFramebuffer!==void 0){Ze.bindFramebuffer(oe.FRAMEBUFFER,sn.__webglFramebuffer),q.copy(ve.viewport),K.copy(ve.scissor),Y=ve.scissorTest,Ze.viewport(q),Ze.scissor(K),Ze.setScissorTest(Y),Z=-1;return}else if(sn.__webglFramebuffer===void 0)be.setupRenderTarget(ve);else if(sn.__hasExternalTextures)be.rebindTextures(ve,te.get(ve.texture).__webglTexture,te.get(ve.depthTexture).__webglTexture);else if(ve.depthBuffer){const Un=ve.depthTexture;if(sn.__boundDepthTexture!==Un){if(Un!==null&&te.has(Un)&&(ve.width!==Un.image.width||ve.height!==Un.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");be.setupDepthRenderbuffer(ve)}}const Zt=ve.texture;(Zt.isData3DTexture||Zt.isDataArrayTexture||Zt.isCompressedArrayTexture)&&(Yt=!0);const Mn=te.get(ve).__webglFramebuffer;ve.isWebGLCubeRenderTarget?(Array.isArray(Mn[ot])?yt=Mn[ot][_t]:yt=Mn[ot],vt=!0):ve.samples>0&&be.useMultisampledRTT(ve)===!1?yt=te.get(ve).__webglMultisampledFramebuffer:Array.isArray(Mn)?yt=Mn[_t]:yt=Mn,q.copy(ve.viewport),K.copy(ve.scissor),Y=ve.scissorTest}else q.copy(re).multiplyScalar(H).floor(),K.copy(ue).multiplyScalar(H).floor(),Y=le;if(_t!==0&&(yt=Fn),Ze.bindFramebuffer(oe.FRAMEBUFFER,yt)&&Ze.drawBuffers(ve,yt),Ze.viewport(q),Ze.scissor(K),Ze.setScissorTest(Y),vt){const sn=te.get(ve.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_CUBE_MAP_POSITIVE_X+ot,sn.__webglTexture,_t)}else if(Yt){const sn=ot;for(let Zt=0;Zt<ve.textures.length;Zt++){const Mn=te.get(ve.textures[Zt]);oe.framebufferTextureLayer(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0+Zt,Mn.__webglTexture,_t,sn)}}else if(ve!==null&&_t!==0){const sn=te.get(ve.texture);oe.framebufferTexture2D(oe.FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,sn.__webglTexture,_t)}Z=-1},this.readRenderTargetPixels=function(ve,ot,_t,yt,vt,Yt,rn,sn=0){if(!(ve&&ve.isWebGLRenderTarget)){Hn("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Zt=te.get(ve).__webglFramebuffer;if(ve.isWebGLCubeRenderTarget&&rn!==void 0&&(Zt=Zt[rn]),Zt){Ze.bindFramebuffer(oe.FRAMEBUFFER,Zt);try{const Mn=ve.textures[sn],Un=Mn.format,$n=Mn.type;if(ve.textures.length>1&&oe.readBuffer(oe.COLOR_ATTACHMENT0+sn),!Pe.textureFormatReadable(Un)){Hn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Pe.textureTypeReadable($n)){Hn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ot>=0&&ot<=ve.width-yt&&_t>=0&&_t<=ve.height-vt&&oe.readPixels(ot,_t,yt,vt,st.convert(Un),st.convert($n),Yt)}finally{const Mn=G!==null?te.get(G).__webglFramebuffer:null;Ze.bindFramebuffer(oe.FRAMEBUFFER,Mn)}}},this.readRenderTargetPixelsAsync=async function(ve,ot,_t,yt,vt,Yt,rn,sn=0){if(!(ve&&ve.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Zt=te.get(ve).__webglFramebuffer;if(ve.isWebGLCubeRenderTarget&&rn!==void 0&&(Zt=Zt[rn]),Zt)if(ot>=0&&ot<=ve.width-yt&&_t>=0&&_t<=ve.height-vt){Ze.bindFramebuffer(oe.FRAMEBUFFER,Zt);const Mn=ve.textures[sn],Un=Mn.format,$n=Mn.type;if(ve.textures.length>1&&oe.readBuffer(oe.COLOR_ATTACHMENT0+sn),!Pe.textureFormatReadable(Un))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Pe.textureTypeReadable($n))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const on=oe.createBuffer();oe.bindBuffer(oe.PIXEL_PACK_BUFFER,on),oe.bufferData(oe.PIXEL_PACK_BUFFER,Yt.byteLength,oe.STREAM_READ),oe.readPixels(ot,_t,yt,vt,st.convert(Un),st.convert($n),0);const ir=G!==null?te.get(G).__webglFramebuffer:null;Ze.bindFramebuffer(oe.FRAMEBUFFER,ir);const Xr=oe.fenceSync(oe.SYNC_GPU_COMMANDS_COMPLETE,0);return oe.flush(),await Q_e(oe,Xr,4),oe.bindBuffer(oe.PIXEL_PACK_BUFFER,on),oe.getBufferSubData(oe.PIXEL_PACK_BUFFER,0,Yt),oe.deleteBuffer(on),oe.deleteSync(Xr),Yt}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(ve,ot=null,_t=0){const yt=Math.pow(2,-_t),vt=Math.floor(ve.image.width*yt),Yt=Math.floor(ve.image.height*yt),rn=ot!==null?ot.x:0,sn=ot!==null?ot.y:0;be.setTexture2D(ve,0),oe.copyTexSubImage2D(oe.TEXTURE_2D,_t,0,0,rn,sn,vt,Yt),Ze.unbindTexture()};const Bi=oe.createFramebuffer(),ui=oe.createFramebuffer();this.copyTextureToTexture=function(ve,ot,_t=null,yt=null,vt=0,Yt=0){let rn,sn,Zt,Mn,Un,$n,on,ir,Xr;const Jr=ve.isCompressedTexture?ve.mipmaps[Yt]:ve.image;if(_t!==null)rn=_t.max.x-_t.min.x,sn=_t.max.y-_t.min.y,Zt=_t.isBox3?_t.max.z-_t.min.z:1,Mn=_t.min.x,Un=_t.min.y,$n=_t.isBox3?_t.min.z:0;else{const di=Math.pow(2,-vt);rn=Math.floor(Jr.width*di),sn=Math.floor(Jr.height*di),ve.isDataArrayTexture?Zt=Jr.depth:ve.isData3DTexture?Zt=Math.floor(Jr.depth*di):Zt=1,Mn=0,Un=0,$n=0}yt!==null?(on=yt.x,ir=yt.y,Xr=yt.z):(on=0,ir=0,Xr=0);const cr=st.convert(ot.format),Nr=st.convert(ot.type);let en;ot.isData3DTexture?(be.setTexture3D(ot,0),en=oe.TEXTURE_3D):ot.isDataArrayTexture||ot.isCompressedArrayTexture?(be.setTexture2DArray(ot,0),en=oe.TEXTURE_2D_ARRAY):(be.setTexture2D(ot,0),en=oe.TEXTURE_2D),oe.pixelStorei(oe.UNPACK_FLIP_Y_WEBGL,ot.flipY),oe.pixelStorei(oe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ot.premultiplyAlpha),oe.pixelStorei(oe.UNPACK_ALIGNMENT,ot.unpackAlignment);const ss=oe.getParameter(oe.UNPACK_ROW_LENGTH),Rn=oe.getParameter(oe.UNPACK_IMAGE_HEIGHT),gs=oe.getParameter(oe.UNPACK_SKIP_PIXELS),Rs=oe.getParameter(oe.UNPACK_SKIP_ROWS),Pi=oe.getParameter(oe.UNPACK_SKIP_IMAGES);oe.pixelStorei(oe.UNPACK_ROW_LENGTH,Jr.width),oe.pixelStorei(oe.UNPACK_IMAGE_HEIGHT,Jr.height),oe.pixelStorei(oe.UNPACK_SKIP_PIXELS,Mn),oe.pixelStorei(oe.UNPACK_SKIP_ROWS,Un),oe.pixelStorei(oe.UNPACK_SKIP_IMAGES,$n);const vs=ve.isDataArrayTexture||ve.isData3DTexture,pr=ot.isDataArrayTexture||ot.isData3DTexture;if(ve.isDepthTexture){const di=te.get(ve),ks=te.get(ot),Ii=te.get(di.__renderTarget),$a=te.get(ks.__renderTarget);Ze.bindFramebuffer(oe.READ_FRAMEBUFFER,Ii.__webglFramebuffer),Ze.bindFramebuffer(oe.DRAW_FRAMEBUFFER,$a.__webglFramebuffer);for(let co=0;co<Zt;co++)vs&&(oe.framebufferTextureLayer(oe.READ_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,te.get(ve).__webglTexture,vt,$n+co),oe.framebufferTextureLayer(oe.DRAW_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,te.get(ot).__webglTexture,Yt,Xr+co)),oe.blitFramebuffer(Mn,Un,rn,sn,on,ir,rn,sn,oe.DEPTH_BUFFER_BIT,oe.NEAREST);Ze.bindFramebuffer(oe.READ_FRAMEBUFFER,null),Ze.bindFramebuffer(oe.DRAW_FRAMEBUFFER,null)}else if(vt!==0||ve.isRenderTargetTexture||te.has(ve)){const di=te.get(ve),ks=te.get(ot);Ze.bindFramebuffer(oe.READ_FRAMEBUFFER,Bi),Ze.bindFramebuffer(oe.DRAW_FRAMEBUFFER,ui);for(let Ii=0;Ii<Zt;Ii++)vs?oe.framebufferTextureLayer(oe.READ_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,di.__webglTexture,vt,$n+Ii):oe.framebufferTexture2D(oe.READ_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,di.__webglTexture,vt),pr?oe.framebufferTextureLayer(oe.DRAW_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,ks.__webglTexture,Yt,Xr+Ii):oe.framebufferTexture2D(oe.DRAW_FRAMEBUFFER,oe.COLOR_ATTACHMENT0,oe.TEXTURE_2D,ks.__webglTexture,Yt),vt!==0?oe.blitFramebuffer(Mn,Un,rn,sn,on,ir,rn,sn,oe.COLOR_BUFFER_BIT,oe.NEAREST):pr?oe.copyTexSubImage3D(en,Yt,on,ir,Xr+Ii,Mn,Un,rn,sn):oe.copyTexSubImage2D(en,Yt,on,ir,Mn,Un,rn,sn);Ze.bindFramebuffer(oe.READ_FRAMEBUFFER,null),Ze.bindFramebuffer(oe.DRAW_FRAMEBUFFER,null)}else pr?ve.isDataTexture||ve.isData3DTexture?oe.texSubImage3D(en,Yt,on,ir,Xr,rn,sn,Zt,cr,Nr,Jr.data):ot.isCompressedArrayTexture?oe.compressedTexSubImage3D(en,Yt,on,ir,Xr,rn,sn,Zt,cr,Jr.data):oe.texSubImage3D(en,Yt,on,ir,Xr,rn,sn,Zt,cr,Nr,Jr):ve.isDataTexture?oe.texSubImage2D(oe.TEXTURE_2D,Yt,on,ir,rn,sn,cr,Nr,Jr.data):ve.isCompressedTexture?oe.compressedTexSubImage2D(oe.TEXTURE_2D,Yt,on,ir,Jr.width,Jr.height,cr,Jr.data):oe.texSubImage2D(oe.TEXTURE_2D,Yt,on,ir,rn,sn,cr,Nr,Jr);oe.pixelStorei(oe.UNPACK_ROW_LENGTH,ss),oe.pixelStorei(oe.UNPACK_IMAGE_HEIGHT,Rn),oe.pixelStorei(oe.UNPACK_SKIP_PIXELS,gs),oe.pixelStorei(oe.UNPACK_SKIP_ROWS,Rs),oe.pixelStorei(oe.UNPACK_SKIP_IMAGES,Pi),Yt===0&&ot.generateMipmaps&&oe.generateMipmap(en),Ze.unbindTexture()},this.initRenderTarget=function(ve){te.get(ve).__webglFramebuffer===void 0&&be.setupRenderTarget(ve)},this.initTexture=function(ve){ve.isCubeTexture?be.setTextureCube(ve,0):ve.isData3DTexture?be.setTexture3D(ve,0):ve.isDataArrayTexture||ve.isCompressedArrayTexture?be.setTexture2DArray(ve,0):be.setTexture2D(ve,0),Ze.unbindTexture()},this.resetState=function(){F=0,V=0,G=null,Ze.reset(),ft.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Zc}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=ii._getDrawingBufferColorSpace(e),n.unpackColorSpace=ii._getUnpackColorSpace()}}const FTe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:WT,AddEquation:A0,AddOperation:HX,AdditiveAnimationBlendMode:Qk,AdditiveBlending:OR,AgXToneMapping:Vk,AlphaFormat:Kk,AlwaysCompare:tY,AlwaysDepth:I2,AlwaysStencilFunc:UR,AmbientLight:$Y,AnimationAction:tK,AnimationClip:PS,AnimationLoader:Hwe,AnimationMixer:x3e,AnimationObjectGroup:g3e,AnimationUtils:jwe,ArcCurve:xY,ArrayCamera:ZY,ArrowHelper:F3e,AttachedBindMode:jR,Audio:JY,AudioAnalyser:a3e,AudioContext:M9,AudioListener:r3e,AudioLoader:Jwe,AxesHelper:U3e,BackSide:Vl,BasicDepthPacking:qX,BasicShadowMap:SX,BatchedMesh:hY,BezierInterpolant:FY,Bone:s9,BooleanKeyframeTrack:Av,Box2:M3e,Box3:Ca,Box3Helper:z3e,BoxGeometry:Cv,BoxHelper:L3e,BufferAttribute:Vi,BufferGeometry:br,BufferGeometryLoader:YY,ByteType:$k,Cache:Zf,Camera:TE,CameraHelper:O3e,CanvasTexture:iwe,CapsuleGeometry:uE,CatmullRomCurve3:yY,CineonToneMapping:Bk,CircleGeometry:dE,ClampToEdgeWrapping:Tc,Clock:rK,Color:xn,ColorKeyframeTrack:b9,ColorManagement:ii,Compatibility:q_e,CompressedArrayTexture:nwe,CompressedCubeTexture:rwe,CompressedTexture:cE,CompressedTextureLoader:Vwe,ConeGeometry:ww,ConstantAlphaFactor:FX,ConstantColorFactor:zX,Controls:H3e,CubeCamera:KY,CubeDepthTexture:vY,CubeReflectionMapping:sh,CubeRefractionMapping:rm,CubeTexture:_w,CubeTextureLoader:Gwe,CubeUVReflectionMapping:ky,CubicBezierCurve:u9,CubicBezierCurve3:bY,CubicInterpolant:zY,CullFaceBack:DR,CullFaceFront:_X,CullFaceFrontBack:a_e,CullFaceNone:bX,Curve:Zd,CurvePath:SY,CustomBlending:wX,CustomToneMapping:Hk,CylinderGeometry:Sw,Cylindrical:w3e,Data3DTexture:rE,DataArrayTexture:nE,DataTexture:Bd,DataTextureLoader:Wwe,DataUtils:NSe,DecrementStencilOp:M_e,DecrementWrapStencilOp:E_e,DefaultLoadingManager:BY,DepthFormat:oh,DepthStencilFormat:B0,DepthTexture:ay,DetachedBindMode:VX,DirectionalLight:WY,DirectionalLightHelper:D3e,DiscreteInterpolant:jY,DodecahedronGeometry:fE,DoubleSide:Xc,DstAlphaFactor:PX,DstColorFactor:DX,DynamicCopyUsage:B_e,DynamicDrawUsage:O_e,DynamicReadUsage:j_e,EdgesGeometry:l9,EllipseCurve:hE,EqualCompare:QX,EqualDepth:O2,EqualStencilFunc:R_e,EquirectangularReflectionMapping:L_,EquirectangularRefractionMapping:z_,Euler:su,EventDispatcher:mh,ExternalTexture:o9,ExtrudeGeometry:pE,FileLoader:vp,Float16BufferAttribute:LSe,Float32BufferAttribute:Cn,FloatType:Bl,Fog:sE,FogExp2:iE,FramebufferTexture:twe,FrontSide:gp,Frustum:Py,FrustumArray:lE,GLBufferAttribute:S3e,GLSL1:V_e,GLSL3:BR,GreaterCompare:JX,GreaterDepth:z2,GreaterEqualCompare:tE,GreaterEqualDepth:L2,GreaterEqualStencilFunc:D_e,GreaterStencilFunc:P_e,GridHelper:P3e,Group:a1,HalfFloatType:ah,HemisphereLight:HY,HemisphereLightHelper:k3e,IcosahedronGeometry:mE,ImageBitmapLoader:Qwe,ImageLoader:IS,ImageUtils:aY,IncrementStencilOp:w_e,IncrementWrapStencilOp:T_e,InstancedBufferAttribute:dv,InstancedBufferGeometry:CE,InstancedInterleavedBuffer:S5,InstancedMesh:fY,Int16BufferAttribute:DSe,Int32BufferAttribute:OSe,Int8BufferAttribute:kSe,IntType:qT,InterleavedBuffer:aE,InterleavedBufferAttribute:Qc,Interpolant:Iy,InterpolateBezier:FR,InterpolateDiscrete:yS,InterpolateLinear:v5,InterpolateSmooth:UM,InterpolationSamplingMode:$_e,InterpolationSamplingType:W_e,InvertStencilOp:C_e,KeepStencilOp:Cg,KeyframeTrack:td,LOD:uY,LatheGeometry:gE,Layers:sy,LessCompare:ZX,LessDepth:D2,LessEqualCompare:eE,LessEqualDepth:lv,LessEqualStencilFunc:k_e,LessStencilFunc:N_e,Light:bm,LightProbe:XY,Line:am,Line3:iK,LineBasicMaterial:$l,LineCurve:d9,LineCurve3:_Y,LineDashedMaterial:OY,LineLoop:pY,LineSegments:gh,LinearFilter:rs,LinearInterpolant:y9,LinearMipMapLinearFilter:d_e,LinearMipMapNearestFilter:u_e,LinearMipmapLinearFilter:Kf,LinearMipmapNearestFilter:j_,LinearSRGBColorSpace:im,LinearToneMapping:Fk,LinearTransfer:_S,Loader:Rc,LoaderUtils:$R,LoadingManager:_9,LoopOnce:GX,LoopPingPong:$X,LoopRepeat:WX,MOUSE:Tg,Material:vl,MaterialBlending:o_e,MaterialLoader:EE,MathUtils:sY,Matrix2:A9,Matrix3:yr,Matrix4:rr,MaxEquation:CX,Mesh:Us,MeshBasicMaterial:wp,MeshDepthMaterial:wE,MeshDistanceMaterial:ME,MeshLambertMaterial:IY,MeshMatcapMaterial:DY,MeshNormalMaterial:PY,MeshPhongMaterial:RY,MeshPhysicalMaterial:NY,MeshStandardMaterial:v9,MeshToonMaterial:kY,MinEquation:EX,MirroredRepeatWrapping:xS,MixOperation:BX,MultiplyBlending:zR,MultiplyOperation:yw,NearestFilter:Ea,NearestMipMapLinearFilter:c_e,NearestMipMapNearestFilter:l_e,NearestMipmapLinearFilter:i1,NearestMipmapNearestFilter:Wk,NeutralToneMapping:Gk,NeverCompare:KX,NeverDepth:P2,NeverStencilFunc:A_e,NoBlending:th,NoColorSpace:np,NoNormalPacking:x_e,NoToneMapping:nu,NormalAnimationBlendMode:JT,NormalBlending:qg,NormalGAPacking:b_e,NormalRGPacking:y_e,NotEqualCompare:eY,NotEqualDepth:j2,NotEqualStencilFunc:I_e,NumberKeyframeTrack:RS,Object3D:yi,ObjectLoader:Kwe,ObjectSpaceNormalMap:YX,OctahedronGeometry:Mw,OneFactor:NX,OneMinusConstantAlphaFactor:UX,OneMinusConstantColorFactor:jX,OneMinusDstAlphaFactor:IX,OneMinusDstColorFactor:OX,OneMinusSrcAlphaFactor:k2,OneMinusSrcColorFactor:kX,OrthographicCamera:Hd,PCFShadowMap:S1,PCFSoftShadowMap:O_,PMREMGenerator:KR,Path:_5,PerspectiveCamera:ea,Plane:Jh,PlaneGeometry:Mp,PlaneHelper:j3e,PointLight:GY,PointLightHelper:N3e,Points:mY,PointsMaterial:a9,PolarGridHelper:I3e,PolyhedronGeometry:ym,PositionalAudio:s3e,PropertyBinding:gi,PropertyMixer:eK,QuadraticBezierCurve:f9,QuadraticBezierCurve3:h9,Quaternion:Bo,QuaternionKeyframeTrack:Ew,QuaternionLinearInterpolant:UY,R11_EAC_Format:$2,RED_GREEN_RGTC2_Format:m5,RED_RGTC1_Format:h5,REVISION:xw,RG11_EAC_Format:X2,RGBADepthPacking:XX,RGBAFormat:ul,RGBAIntegerFormat:QT,RGBA_ASTC_10x10_Format:o5,RGBA_ASTC_10x5_Format:i5,RGBA_ASTC_10x6_Format:s5,RGBA_ASTC_10x8_Format:a5,RGBA_ASTC_12x10_Format:l5,RGBA_ASTC_12x12_Format:c5,RGBA_ASTC_4x4_Format:K2,RGBA_ASTC_5x4_Format:Z2,RGBA_ASTC_5x5_Format:Q2,RGBA_ASTC_6x5_Format:J2,RGBA_ASTC_6x6_Format:e5,RGBA_ASTC_8x5_Format:t5,RGBA_ASTC_8x6_Format:n5,RGBA_ASTC_8x8_Format:r5,RGBA_BPTC_Format:u5,RGBA_ETC2_EAC_Format:W2,RGBA_PVRTC_2BPPV1_Format:H2,RGBA_PVRTC_4BPPV1_Format:B2,RGBA_S3TC_DXT1_Format:U_,RGBA_S3TC_DXT3_Format:B_,RGBA_S3TC_DXT5_Format:H_,RGBDepthPacking:g_e,RGBFormat:Zk,RGBIntegerFormat:f_e,RGB_BPTC_SIGNED_Format:d5,RGB_BPTC_UNSIGNED_Format:f5,RGB_ETC1_Format:V2,RGB_ETC2_Format:G2,RGB_PVRTC_2BPPV1_Format:U2,RGB_PVRTC_4BPPV1_Format:F2,RGB_S3TC_DXT1_Format:F_,RGDepthPacking:v_e,RGFormat:cv,RGIntegerFormat:ZT,RawShaderMaterial:g9,Ray:Ev,Raycaster:nK,RectAreaLight:qY,RedFormat:KT,RedIntegerFormat:bw,ReinhardToneMapping:Uk,RenderTarget:e9,RenderTarget3D:y3e,RepeatWrapping:vS,ReplaceStencilOp:S_e,ReverseSubtractEquation:TX,RingGeometry:vE,SIGNED_R11_EAC_Format:q2,SIGNED_RED_GREEN_RGTC2_Format:g5,SIGNED_RED_RGTC1_Format:p5,SIGNED_RG11_EAC_Format:Y2,SRGBColorSpace:cl,SRGBTransfer:ji,Scene:t9,ShaderChunk:Tr,ShaderLib:Dd,ShaderMaterial:au,ShadowMaterial:CY,Shape:$0,ShapeGeometry:xE,ShapePath:B3e,ShapeUtils:Ud,ShortType:qk,Skeleton:oE,SkeletonHelper:A3e,SkinnedMesh:dY,Source:H0,Sphere:Va,SphereGeometry:Tw,Spherical:XR,SphericalHarmonics3:w9,SplineCurve:p9,SpotLight:VY,SpotLightHelper:C3e,Sprite:cY,SpriteMaterial:i9,SrcAlphaFactor:R2,SrcAlphaSaturateFactor:LX,SrcColorFactor:RX,StaticCopyUsage:U_e,StaticDrawUsage:SS,StaticReadUsage:z_e,StereoCamera:e3e,StreamCopyUsage:H_e,StreamDrawUsage:L_e,StreamReadUsage:F_e,StringKeyframeTrack:Nv,SubtractEquation:MX,SubtractiveBlending:LR,TOUCH:Eg,TangentSpaceNormalMap:xm,TetrahedronGeometry:yE,Texture:ra,TextureLoader:$we,TextureUtils:q3e,Timer:QY,TimestampQuery:G_e,TorusGeometry:bE,TorusKnotGeometry:_E,Triangle:Mc,TriangleFanDrawMode:m_e,TriangleStripDrawMode:p_e,TrianglesDrawMode:h_e,TubeGeometry:SE,UVMapping:$T,Uint16BufferAttribute:n9,Uint32BufferAttribute:r9,Uint8BufferAttribute:PSe,Uint8ClampedBufferAttribute:ISe,Uniform:C9,UniformsGroup:_3e,UniformsLib:pn,UniformsUtils:NS,UnsignedByteType:zl,UnsignedInt101111Type:Yk,UnsignedInt248Type:ry,UnsignedInt5999Type:Xk,UnsignedIntType:Ku,UnsignedShort4444Type:XT,UnsignedShort5551Type:YT,UnsignedShortType:ny,VSMShadowMap:Pg,Vector2:zt,Vector3:Fe,Vector4:ci,VectorKeyframeTrack:kS,VideoFrameTexture:ewe,VideoTexture:gY,WebGL3DRenderTarget:bSe,WebGLArrayRenderTarget:ySe,WebGLCoordinateSystem:Zc,WebGLCubeRenderTarget:N9,WebGLRenderTarget:iu,WebGLRenderer:fK,WebGLUtils:dK,WebGPUCoordinateSystem:uv,WebXRController:BM,WireframeGeometry:m9,WrapAroundEnding:bS,ZeroCurvatureEnding:Ig,ZeroFactor:AX,ZeroSlopeEnding:Dg,ZeroStencilOp:__e,createCanvasElement:rY,error:Hn,getConsoleFunction:Z_e,log:MS,setConsoleFunction:K_e,warn:hn,warnOnce:TS},Symbol.toStringTag,{value:"Module"}));var C6={exports:{}},A6={};/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Tj;function UTe(){if(Tj)return A6;Tj=1;var t=$S(),e=One();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,a=t.useEffect,o=t.useMemo,l=t.useDebugValue;return A6.useSyncExternalStoreWithSelector=function(c,d,h,g,v){var b=s(null);if(b.current===null){var _={hasValue:!1,value:null};b.current=_}else _=b.current;b=o(function(){function S(P){if(!E){if(E=!0,A=P,P=g(P),v!==void 0&&_.hasValue){var L=_.value;if(v(L,P))return N=L}return N=P}if(L=N,r(A,P))return L;var R=g(P);return v!==void 0&&v(L,R)?(A=P,L):(A=P,N=R)}var E=!1,A,N,D=h===void 0?null:h;return[function(){return S(d())},D===null?void 0:function(){return S(D())}]},[d,h,g,v]);var w=i(c,b[0],b[1]);return a(function(){_.hasValue=!0,_.value=w},[w]),l(w),w},A6}var Ej;function BTe(){return Ej||(Ej=1,C6.exports=UTe()),C6.exports}var HTe=BTe();const VTe=dy(HTe),Cj=t=>{let e;const n=new Set,r=(c,d)=>{const h=typeof c=="function"?c(e):c;if(!Object.is(h,e)){const g=e;e=d??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(v=>v(e,g))}},i=()=>e,o={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,i,o);return o},GTe=(t=>t?Cj(t):Cj),{useSyncExternalStoreWithSelector:WTe}=VTe,$Te=t=>t;function qTe(t,e=$Te,n){const r=WTe(t.subscribe,t.getState,t.getInitialState,e,n);return Qr.useDebugValue(r),r}const Aj=(t,e)=>{const n=GTe(t),r=(i,s=e)=>qTe(n,i,s);return Object.assign(r,n),r},XTe=((t,e)=>t?Aj(t,e):Aj),YTe=t=>typeof t=="object"&&typeof t.then=="function",vM=[];function KTe(t,e,n=(r,i)=>r===i){if(t===e)return!0;if(!t||!e)return!1;const r=t.length;if(e.length!==r)return!1;for(let i=0;i<r;i++)if(!n(t[i],e[i]))return!1;return!0}function ZTe(t,e=null,n=!1,r={}){e===null&&(e=[t]);for(const s of vM)if(KTe(e,s.keys,s.equal)){if(n)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return r.lifespan&&r.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,r.lifespan)),s.response;if(!n)throw s.promise}const i={keys:e,equal:r.equal,remove:()=>{const s=vM.indexOf(i);s!==-1&&vM.splice(s,1)},promise:(YTe(t)?t:t(...e)).then(s=>{i.response=s,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(s=>i.error=s)};if(vM.push(i),!n)throw i.promise}const QTe=(t,e,n)=>ZTe(t,e,!1,n);var JR=IF();const JTe=dy(JR);function R9(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=e?t.return:t.child;for(;r;){const i=R9(r,e,n);if(i)return i;r=e?null:r.sibling}}function hK(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const k9=hK(T.createContext(null));class pK extends T.Component{render(){return T.createElement(k9.Provider,{value:this._reactInternals},this.props.children)}}function mK(){const t=T.useContext(k9);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=T.useId();return T.useMemo(()=>{for(const n of[t,t==null?void 0:t.alternate]){if(!n)continue;const r=R9(n,!1,i=>{let s=i.memoizedState;for(;s;){if(s.memoizedState===e)return!0;s=s.next}});if(r)return r}},[t,e])}const eEe=Symbol.for("react.context"),tEe=t=>t!==null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===eEe;function nEe(){const t=mK(),[e]=T.useState(()=>new Map);e.clear();let n=t;for(;n;){const r=n.type;tEe(r)&&r!==k9&&!e.has(r)&&e.set(r,T.use(hK(r))),n=n.return}return e}function rEe(){const t=nEe();return T.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>T.createElement(e,null,T.createElement(n.Provider,{...r,value:t.get(n)})),e=>T.createElement(pK,{...e})),[t])}function gK(t){let e=t.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const vK=t=>t&&t.isOrthographicCamera,iEe=t=>t&&t.hasOwnProperty("current"),sEe=t=>t!=null&&(typeof t=="string"||typeof t=="number"||t.isColor),Cw=((t,e)=>typeof window<"u"&&(((t=window.document)==null?void 0:t.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?T.useLayoutEffect:T.useEffect;function xK(t){const e=T.useRef(t);return Cw(()=>void(e.current=t),[t]),e}function aEe(){const t=mK(),e=rEe();return T.useMemo(()=>({children:n})=>{const i=!!R9(t,!0,s=>s.type===T.StrictMode)?T.StrictMode:T.Fragment;return p.jsx(i,{children:p.jsx(e,{children:n})})},[t,e])}function oEe({set:t}){return Cw(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}const lEe=(t=>(t=class extends T.Component{constructor(...n){super(...n),this.state={error:!1}}componentDidCatch(n){this.props.set(n)}render(){return this.state.error?null:this.props.children}},t.getDerivedStateFromError=()=>({error:!0}),t))();function yK(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}function Kx(t){var e;return(e=t.__r3f)==null?void 0:e.root.getState()}const Qs={obj:t=>t===Object(t)&&!Qs.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,nul:t=>t===null,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:r="reference",strict:i=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(Qs.str(t)||Qs.num(t)||Qs.boo(t))return t===e;const s=Qs.obj(t);if(s&&r==="reference")return t===e;const a=Qs.arr(t);if(a&&n==="reference")return t===e;if((a||s)&&t===e)return!0;let o;for(o in t)if(!(o in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(o in i?e:t)if(!Qs.equ(t[o],e[o],{strict:i,objects:"reference"}))return!1}else for(o in i?e:t)if(t[o]!==e[o])return!1;if(Qs.und(o)){if(a&&t.length===0&&e.length===0||s&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function cEe(t){t.type!=="Scene"&&(t.dispose==null||t.dispose());for(const e in t){const n=t[e];(n==null?void 0:n.type)!=="Scene"&&(n==null||n.dispose==null||n.dispose())}}const bK=["children","key","ref"];function uEe(t){const e={};for(const n in t)bK.includes(n)||(e[n]=t[n]);return e}function w5(t,e,n,r){const i=t;let s=i==null?void 0:i.__r3f;return s||(s={root:e,type:n,parent:null,children:[],props:uEe(r),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=s)),s}function DS(t,e){if(!e.includes("-"))return{root:t,key:e,target:t[e]};if(e in t)return{root:t,key:e,target:t[e]};let n=t;const r=e.split("-");for(const i of r){if(typeof n!="object"||n===null){if(n!==void 0){const s=r.slice(r.indexOf(i)).join("-");return{root:n,key:s,target:void 0}}return{root:t,key:e,target:void 0}}e=i,t=n,n=n[e]}return{root:t,key:e,target:n}}const Nj=/-\d+$/;function M5(t,e){if(Qs.str(e.props.attach)){if(Nj.test(e.props.attach)){const i=e.props.attach.replace(Nj,""),{root:s,key:a}=DS(t.object,i);Array.isArray(s[a])||(s[a]=[])}const{root:n,key:r}=DS(t.object,e.props.attach);e.previousAttach=n[r],n[r]=e.object}else Qs.fun(e.props.attach)&&(e.previousAttach=e.props.attach(t.object,e.object))}function T5(t,e){if(Qs.str(e.props.attach)){const{root:n,key:r}=DS(t.object,e.props.attach),i=e.previousAttach;i===void 0?delete n[r]:n[r]=i}else e.previousAttach==null||e.previousAttach(t.object,e.object);delete e.previousAttach}const e7=[...bK,"args","dispose","attach","object","onUpdate","dispose"],Rj=new Map;function dEe(t){let e=Rj.get(t.constructor);try{e||(e=new t.constructor,Rj.set(t.constructor,e))}catch{}return e}function fEe(t,e){const n={};for(const r in e)if(!e7.includes(r)&&!Qs.equ(e[r],t.props[r])){n[r]=e[r];for(const i in e)i.startsWith(`${r}-`)&&(n[i]=e[i])}for(const r in t.props){if(e7.includes(r)||e.hasOwnProperty(r))continue;const{root:i,key:s}=DS(t.object,r);if(i.constructor&&i.constructor.length===0){const a=dEe(i);Qs.und(a)||(n[s]=a[s])}else n[s]=0}return n}const hEe=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],pEe=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function N0(t,e){var n;const r=t.__r3f,i=r&&gK(r).getState(),s=r==null?void 0:r.eventCount;for(const o in e){let l=e[o];if(e7.includes(o))continue;if(r&&pEe.test(o)){typeof l=="function"?r.handlers[o]=l:delete r.handlers[o],r.eventCount=Object.keys(r.handlers).length;continue}if(l===void 0)continue;let{root:c,key:d,target:h}=DS(t,o);if(h===void 0&&(typeof c!="object"||c===null))throw Error(`R3F: Cannot set "${o}". Ensure it is an object before setting "${d}".`);if(h instanceof sy&&l instanceof sy)h.mask=l.mask;else if(h instanceof xn&&sEe(l))h.set(l);else if(h!==null&&typeof h=="object"&&typeof h.set=="function"&&typeof h.copy=="function"&&l!=null&&l.constructor&&h.constructor===l.constructor)h.copy(l);else if(h!==null&&typeof h=="object"&&typeof h.set=="function"&&Array.isArray(l))typeof h.fromArray=="function"?h.fromArray(l):h.set(...l);else if(h!==null&&typeof h=="object"&&typeof h.set=="function"&&typeof l=="number")typeof h.setScalar=="function"?h.setScalar(l):h.set(l);else{var a;c[d]=l,i&&!i.linear&&hEe.includes(d)&&(a=c[d])!=null&&a.isTexture&&c[d].format===ul&&c[d].type===zl&&(c[d].colorSpace=cl)}}if(r!=null&&r.parent&&i!=null&&i.internal&&(n=r.object)!=null&&n.isObject3D&&s!==r.eventCount){const o=r.object,l=i.internal.interaction.indexOf(o);l>-1&&i.internal.interaction.splice(l,1),r.eventCount&&o.raycast!==null&&i.internal.interaction.push(o)}return r&&r.props.attach===void 0&&(r.object.isBufferGeometry?r.props.attach="geometry":r.object.isMaterial&&(r.props.attach="material")),r&&Oy(r),t}function Oy(t){var e;if(!t.parent)return;t.props.onUpdate==null||t.props.onUpdate(t.object);const n=(e=t.root)==null||e.getState==null?void 0:e.getState();n&&n.internal.frames===0&&n.invalidate()}function mEe(t,e){t.manual||(vK(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix())}const Sc=t=>t==null?void 0:t.isObject3D;function xM(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function _K(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function gEe(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(r=>r!==e),n.initialHits=n.initialHits.filter(r=>r!==e),n.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&n.hovered.delete(i)}),n.capturedMap.forEach((r,i)=>{_K(n.capturedMap,e,r,i)})}function vEe(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+h*h))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+d]}))}function r(l,c){const d=t.getState(),h=new Set,g=[],v=c?c(d.internal.interaction):d.internal.interaction;for(let S=0;S<v.length;S++){const E=Kx(v[S]);E&&(E.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(l,d);function b(S){const E=Kx(S);if(!E||!E.events.enabled||E.raycaster.camera===null)return[];if(E.raycaster.camera===void 0){var A;E.events.compute==null||E.events.compute(l,E,(A=E.previousRoot)==null?void 0:A.getState()),E.raycaster.camera===void 0&&(E.raycaster.camera=null)}return E.raycaster.camera?E.raycaster.intersectObject(S,!0):[]}let _=v.flatMap(b).sort((S,E)=>{const A=Kx(S.object),N=Kx(E.object);return!A||!N?S.distance-E.distance:N.events.priority-A.events.priority||S.distance-E.distance}).filter(S=>{const E=xM(S);return h.has(E)?!1:(h.add(E),!0)});d.events.filter&&(_=d.events.filter(_,d));for(const S of _){let E=S.object;for(;E;){var w;(w=E.__r3f)!=null&&w.eventCount&&g.push({...S,eventObject:E}),E=E.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let S of d.internal.capturedMap.get(l.pointerId).values())h.has(xM(S.intersection))||g.push(S.intersection);return g}function i(l,c,d,h){if(l.length){const g={stopped:!1};for(const v of l){let b=Kx(v.object);if(b||v.object.traverseAncestors(_=>{const w=Kx(_);if(w)return b=w,!1}),b){const{raycaster:_,pointer:w,camera:S,internal:E}=b,A=new Fe(w.x,w.y,0).unproject(S),N=O=>{var W,F;return(W=(F=E.capturedMap.get(O))==null?void 0:F.has(v.eventObject))!=null?W:!1},D=O=>{const W={intersection:v,target:c.target};E.capturedMap.has(O)?E.capturedMap.get(O).set(v.eventObject,W):E.capturedMap.set(O,new Map([[v.eventObject,W]])),c.target.setPointerCapture(O)},P=O=>{const W=E.capturedMap.get(O);W&&_K(E.capturedMap,v.eventObject,W,O)};let L={};for(let O in c){let W=c[O];typeof W!="function"&&(L[O]=W)}let R={...v,...L,pointer:w,intersections:l,stopped:g.stopped,delta:d,unprojectedPoint:A,ray:_.ray,camera:S,stopPropagation(){const O="pointerId"in c&&E.capturedMap.get(c.pointerId);if((!O||O.has(v.eventObject))&&(R.stopped=g.stopped=!0,E.hovered.size&&Array.from(E.hovered.values()).find(W=>W.eventObject===v.eventObject))){const W=l.slice(0,l.indexOf(v));s([...W,v])}},target:{hasPointerCapture:N,setPointerCapture:D,releasePointerCapture:P},currentTarget:{hasPointerCapture:N,setPointerCapture:D,releasePointerCapture:P},nativeEvent:c};if(h(R),g.stopped===!0)break}}}return l}function s(l){const{internal:c}=t.getState();for(const d of c.hovered.values())if(!l.length||!l.find(h=>h.object===d.object&&h.index===d.index&&h.instanceId===d.instanceId)){const g=d.eventObject.__r3f;if(c.hovered.delete(xM(d)),g!=null&&g.eventCount){const v=g.handlers,b={...d,intersections:l};v.onPointerOut==null||v.onPointerOut(b),v.onPointerLeave==null||v.onPointerLeave(b)}}}function a(l,c){for(let d=0;d<c.length;d++){const h=c[d].__r3f;h==null||h.handlers.onPointerMissed==null||h.handlers.onPointerMissed(l)}}function o(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return c=>{const{internal:d}=t.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:h,internal:g}=t.getState();g.lastEvent.current=d;const v=l==="onPointerMove",b=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",w=r(d,v?n:void 0),S=b?e(d):0;l==="onPointerDown"&&(g.initialClick=[d.offsetX,d.offsetY],g.initialHits=w.map(A=>A.eventObject)),b&&!w.length&&S<=2&&(a(d,g.interaction),h&&h(d)),v&&s(w);function E(A){const N=A.eventObject,D=N.__r3f;if(!(D!=null&&D.eventCount))return;const P=D.handlers;if(v){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const L=xM(A),R=g.hovered.get(L);R?R.stopped&&A.stopPropagation():(g.hovered.set(L,A),P.onPointerOver==null||P.onPointerOver(A),P.onPointerEnter==null||P.onPointerEnter(A))}P.onPointerMove==null||P.onPointerMove(A)}else{const L=P[l];L?(!b||g.initialHits.includes(N))&&(a(d,g.interaction.filter(R=>!g.initialHits.includes(R))),L(A)):b&&g.initialHits.includes(N)&&a(d,g.interaction.filter(R=>!g.initialHits.includes(R)))}}i(w,d,S,E)}}return{handlePointer:o}}const kj=t=>!!(t!=null&&t.render),SK=T.createContext(null),xEe=(t,e)=>{const n=XTe((o,l)=>{const c=new Fe,d=new Fe,h=new Fe;function g(S=l().camera,E=d,A=l().size){const{width:N,height:D,top:P,left:L}=A,R=N/D;E.isVector3?h.copy(E):h.set(...E);const O=S.getWorldPosition(c).distanceTo(h);if(vK(S))return{width:N/S.zoom,height:D/S.zoom,top:P,left:L,factor:1,distance:O,aspect:R};{const W=S.fov*Math.PI/180,F=2*Math.tan(W/2)*O,V=F*(N/D);return{width:V,height:F,top:P,left:L,factor:N/V,distance:O,aspect:R}}}let v;const b=S=>o(E=>({performance:{...E.performance,current:S}})),_=new zt;return{set:o,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(S=1)=>t(l(),S),advance:(S,E)=>e(S,E,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new rK,pointer:_,mouse:_,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const S=l();v&&clearTimeout(v),S.performance.current!==S.performance.min&&b(S.performance.min),v=setTimeout(()=>b(l().performance.max),S.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:g},setEvents:S=>o(E=>({...E,events:{...E.events,...S}})),setSize:(S,E,A=0,N=0)=>{const D=l().camera,P={width:S,height:E,top:A,left:N};o(L=>({size:P,viewport:{...L.viewport,...g(D,d,P)}}))},setDpr:S=>o(E=>{const A=yK(S);return{viewport:{...E.viewport,dpr:A,initialDpr:E.viewport.initialDpr||A}}}),setFrameloop:(S="always")=>{const E=l().clock;E.stop(),E.elapsedTime=0,S!=="never"&&(E.start(),E.elapsedTime=0),o(()=>({frameloop:S}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:T.createRef(),active:!1,frames:0,priority:0,subscribe:(S,E,A)=>{const N=l().internal;return N.priority=N.priority+(E>0?1:0),N.subscribers.push({ref:S,priority:E,store:A}),N.subscribers=N.subscribers.sort((D,P)=>D.priority-P.priority),()=>{const D=l().internal;D!=null&&D.subscribers&&(D.priority=D.priority-(E>0?1:0),D.subscribers=D.subscribers.filter(P=>P.ref!==S))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,a=r.camera;return n.subscribe(()=>{const{camera:o,size:l,viewport:c,gl:d,set:h}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){i=l,s=c.dpr,mEe(o,l),c.dpr>0&&d.setPixelRatio(c.dpr);const g=typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,g)}o!==a&&(a=o,h(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(o)}})))}),n.subscribe(o=>t(o)),n};function wK(){const t=T.useContext(SK);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function $c(t=n=>n,e){return wK()(t,e)}function RE(t,e=0){const n=wK(),r=n.getState().internal.subscribe,i=xK(t);return Cw(()=>r(i,e,n),[e,r,n]),null}/**
 * @license React
 * react-reconciler-constants.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */const yEe=1,bEe=8,_Ee=32,SEe=2;var wEe={version:"9.5.0"};function MEe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Pj={exports:{}},Ij={exports:{}},Dj;function TEe(){return Dj||(Dj=1,(function(t){t.exports=function(e){function n(m,x,C,k){return new Fy(m,x,C,k)}function r(){}function i(m){var x="https://react.dev/errors/"+m;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var C=2;C<arguments.length;C++)x+="&args[]="+encodeURIComponent(arguments[C])}return"Minified React error #"+m+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(m){var x=m,C=m;if(m.alternate)for(;x.return;)x=x.return;else{m=x;do x=m,(x.flags&4098)!==0&&(C=x.return),m=x.return;while(m)}return x.tag===3?C:null}function a(m){if(s(m)!==m)throw Error(i(188))}function o(m){var x=m.alternate;if(!x){if(x=s(m),x===null)throw Error(i(188));return x!==m?null:m}for(var C=m,k=x;;){var $=C.return;if($===null)break;var ee=$.alternate;if(ee===null){if(k=$.return,k!==null){C=k;continue}break}if($.child===ee.child){for(ee=$.child;ee;){if(ee===C)return a($),m;if(ee===k)return a($),x;ee=ee.sibling}throw Error(i(188))}if(C.return!==k.return)C=$,k=ee;else{for(var Ce=!1,at=$.child;at;){if(at===C){Ce=!0,C=$,k=ee;break}if(at===k){Ce=!0,k=$,C=ee;break}at=at.sibling}if(!Ce){for(at=ee.child;at;){if(at===C){Ce=!0,C=ee,k=$;break}if(at===k){Ce=!0,k=ee,C=$;break}at=at.sibling}if(!Ce)throw Error(i(189))}}if(C.alternate!==k)throw Error(i(190))}if(C.tag!==3)throw Error(i(188));return C.stateNode.current===C?m:x}function l(m){var x=m.tag;if(x===5||x===26||x===27||x===6)return m;for(m=m.child;m!==null;){if(x=l(m),x!==null)return x;m=m.sibling}return null}function c(m){var x=m.tag;if(x===5||x===26||x===27||x===6)return m;for(m=m.child;m!==null;){if(m.tag!==4&&(x=c(m),x!==null))return x;m=m.sibling}return null}function d(m){return m===null||typeof m!="object"?null:(m=gd&&m[gd]||m["@@iterator"],typeof m=="function"?m:null)}function h(m){if(m==null)return null;if(typeof m=="function")return m.$$typeof===uf?null:m.displayName||m.name||null;if(typeof m=="string")return m;switch(m){case Mh:return"Fragment";case Eh:return"Profiler";case Th:return"StrictMode";case Gv:return"Suspense";case md:return"SuspenseList";case zm:return"Activity"}if(typeof m=="object")switch(m.$$typeof){case wh:return"Portal";case sc:return m.displayName||"Context";case Lm:return(m._context.displayName||"Context")+".Consumer";case Bp:var x=m.render;return m=m.displayName,m||(m=x.displayName||x.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case Wv:return x=m.displayName||null,x!==null?x:h(m.type)||"Memo";case Ao:x=m._payload,m=m._init;try{return h(m(x))}catch{}}return null}function g(m){return{current:m}}function v(m){0>kh||(m.current=ix[kh],ix[kh]=null,kh--)}function b(m,x){kh++,ix[kh]=m.current,m.current=x}function _(m){return m>>>=0,m===0?32:31-(sx(m)/b3|0)|0}function w(m){var x=m&42;if(x!==0)return x;switch(m&-m){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return m&261888;case 262144:case 524288:case 1048576:case 2097152:return m&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return m&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return m}}function S(m,x,C){var k=m.pendingLanes;if(k===0)return 0;var $=0,ee=m.suspendedLanes,Ce=m.pingedLanes;m=m.warmLanes;var at=k&134217727;return at!==0?(k=at&~ee,k!==0?$=w(k):(Ce&=at,Ce!==0?$=w(Ce):C||(C=at&~m,C!==0&&($=w(C))))):(at=k&~ee,at!==0?$=w(at):Ce!==0?$=w(Ce):C||(C=k&~m,C!==0&&($=w(C)))),$===0?0:x!==0&&x!==$&&(x&ee)===0&&(ee=$&-$,C=x&-x,ee>=C||ee===32&&(C&4194048)!==0)?x:$}function E(m,x){return(m.pendingLanes&~(m.suspendedLanes&~m.pingedLanes)&x)===0}function A(m,x){switch(m){case 1:case 2:case 4:case 8:case 64:return x+250;case 16:case 32: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 x+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function N(){var m=Xp;return Xp<<=1,(Xp&62914560)===0&&(Xp=4194304),m}function D(m){for(var x=[],C=0;31>C;C++)x.push(m);return x}function P(m,x){m.pendingLanes|=x,x!==268435456&&(m.suspendedLanes=0,m.pingedLanes=0,m.warmLanes=0)}function L(m,x,C,k,$,ee){var Ce=m.pendingLanes;m.pendingLanes=C,m.suspendedLanes=0,m.pingedLanes=0,m.warmLanes=0,m.expiredLanes&=C,m.entangledLanes&=C,m.errorRecoveryDisabledLanes&=C,m.shellSuspendCounter=0;var at=m.entanglements,It=m.expirationTimes,Wt=m.hiddenUpdates;for(C=Ce&~C;0<C;){var ln=31-Qo(C),qt=1<<ln;at[ln]=0,It[ln]=-1;var yn=Wt[ln];if(yn!==null)for(Wt[ln]=null,ln=0;ln<yn.length;ln++){var dr=yn[ln];dr!==null&&(dr.lane&=-536870913)}C&=~qt}k!==0&&R(m,k,0),ee!==0&&$===0&&m.tag!==0&&(m.suspendedLanes|=ee&~(Ce&~x))}function R(m,x,C){m.pendingLanes|=x,m.suspendedLanes&=~x;var k=31-Qo(x);m.entangledLanes|=x,m.entanglements[k]=m.entanglements[k]|1073741824|C&261930}function O(m,x){var C=m.entangledLanes|=x;for(m=m.entanglements;C;){var k=31-Qo(C),$=1<<k;$&x|m[k]&x&&(m[k]|=x),C&=~$}}function W(m,x){var C=x&-x;return C=(C&42)!==0?1:F(C),(C&(m.suspendedLanes|x))!==0?0:C}function F(m){switch(m){case 2:m=1;break;case 8:m=4;break;case 32:m=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:m=128;break;case 268435456:m=134217728;break;default:m=0}return m}function V(m){return m&=-m,2<m?8<m?(m&134217727)!==0?32:268435456:8:2}function G(m){if(typeof Mb=="function"&&w3(m),Jo&&typeof Jo.setStrictMode=="function")try{Jo.setStrictMode(Ih,m)}catch{}}function Z(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}function B(m){if(dx===void 0)try{throw Error()}catch(C){var x=C.stack.trim().match(/\n( *(at )?)/);dx=x&&x[1]||"",wu=-1<C.stack.indexOf(`
    at`)?" (<anonymous>)":-1<C.stack.indexOf("@")?"@unknown:0:0":""}return`
`+dx+m+wu}function q(m,x){if(!m||$m)return"";$m=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var k={DetermineComponentFrameRoot:function(){try{if(x){var qt=function(){throw Error()};if(Object.defineProperty(qt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(qt,[])}catch(dr){var yn=dr}Reflect.construct(m,[],qt)}else{try{qt.call()}catch(dr){yn=dr}m.call(qt.prototype)}}else{try{throw Error()}catch(dr){yn=dr}(qt=m())&&typeof qt.catch=="function"&&qt.catch(function(){})}}catch(dr){if(dr&&yn&&typeof dr.stack=="string")return[dr.stack,yn.stack]}return[null,null]}};k.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var $=Object.getOwnPropertyDescriptor(k.DetermineComponentFrameRoot,"name");$&&$.configurable&&Object.defineProperty(k.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var ee=k.DetermineComponentFrameRoot(),Ce=ee[0],at=ee[1];if(Ce&&at){var It=Ce.split(`
`),Wt=at.split(`
`);for($=k=0;k<It.length&&!It[k].includes("DetermineComponentFrameRoot");)k++;for(;$<Wt.length&&!Wt[$].includes("DetermineComponentFrameRoot");)$++;if(k===It.length||$===Wt.length)for(k=It.length-1,$=Wt.length-1;1<=k&&0<=$&&It[k]!==Wt[$];)$--;for(;1<=k&&0<=$;k--,$--)if(It[k]!==Wt[$]){if(k!==1||$!==1)do if(k--,$--,0>$||It[k]!==Wt[$]){var ln=`
`+It[k].replace(" at new "," at ");return m.displayName&&ln.includes("<anonymous>")&&(ln=ln.replace("<anonymous>",m.displayName)),ln}while(1<=k&&0<=$);break}}}finally{$m=!1,Error.prepareStackTrace=C}return(C=m?m.displayName||m.name:"")?B(C):""}function K(m,x){switch(m.tag){case 26:case 27:case 5:return B(m.type);case 16:return B("Lazy");case 13:return m.child!==x&&x!==null?B("Suspense Fallback"):B("Suspense");case 19:return B("SuspenseList");case 0:case 15:return q(m.type,!1);case 11:return q(m.type.render,!1);case 1:return q(m.type,!0);case 31:return B("Activity");default:return""}}function Y(m){try{var x="",C=null;do x+=K(m,C),C=m,m=m.return;while(m);return x}catch(k){return`
Error generating stack: `+k.message+`
`+k.stack}}function Q(m,x){if(typeof m=="object"&&m!==null){var C=Tb.get(m);return C!==void 0?C:(x={value:m,source:x,stack:Y(x)},Tb.set(m,x),x)}return{value:m,source:x,stack:Y(x)}}function U(m,x){yd[Mu++]=qm,yd[Mu++]=Li,Li=m,qm=x}function j(m,x,C){lc[El++]=Ka,lc[El++]=zc,lc[El++]=cc,cc=m;var k=Ka;m=zc;var $=32-Qo(k)-1;k&=~(1<<$),C+=1;var ee=32-Qo(x)+$;if(30<ee){var Ce=$-$%5;ee=(k&(1<<Ce)-1).toString(32),k>>=Ce,$-=Ce,Ka=1<<32-Qo(x)+$|C<<$|k,zc=ee+m}else Ka=1<<ee|C<<$|k,zc=m}function X(m){m.return!==null&&(U(m,1),j(m,1,0))}function H(m){for(;m===Li;)Li=yd[--Mu],yd[Mu]=null,qm=yd[--Mu],yd[Mu]=null;for(;m===cc;)cc=lc[--El],lc[El]=null,zc=lc[--El],lc[El]=null,Ka=lc[--El],lc[El]=null}function ie(m,x){lc[El++]=Ka,lc[El++]=zc,lc[El++]=cc,Ka=x.id,zc=x.overflow,cc=m}function ne(m,x){b(Za,x),b(bd,m),b(Oa,null),m=Lw(x),v(Oa),b(Oa,m)}function re(){v(Oa),v(bd),v(Za)}function ue(m){m.memoizedState!==null&&b(Xm,m);var x=Oa.current,C=Gp(x,m.type);x!==C&&(b(bd,m),b(Oa,C))}function le(m){bd.current===m&&(v(Oa),v(bd)),Xm.current===m&&(v(Xm),Ws?Nh._currentValue=Ah:Nh._currentValue2=Ah)}function fe(m){var x=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Oe(Q(x,m)),fx}function we(m,x){if(!ls)throw Error(i(175));l3(m.stateNode,m.type,m.memoizedProps,x,m)||fe(m,!0)}function pe(m){for(_a=m.return;_a;)switch(_a.tag){case 5:case 31:case 13:Ro=!1;return;case 27:case 3:Ro=!0;return;default:_a=_a.return}}function xe(m){if(!ls||m!==_a)return!1;if(!Fr)return pe(m),Fr=!0,!1;var x=m.tag;if(ba?x!==3&&x!==27&&(x!==5||qp(m.type)&&!No(m.type,m.memoizedProps))&&cs&&fe(m):x!==3&&(x!==5||qp(m.type)&&!No(m.type,m.memoizedProps))&&cs&&fe(m),pe(m),x===13){if(!ls)throw Error(i(316));if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));cs=hb(m)}else if(x===31){if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));cs=u3(m)}else cs=ba&&x===27?e3(m.type,cs):_a?Jw(m.stateNode):null;return!0}function Ve(){ls&&(cs=_a=null,Fr=!1)}function ye(){var m=Tu;return m!==null&&(nl===null?nl=m:nl.push.apply(nl,m),Tu=null),m}function Oe(m){Tu===null?Tu=[m]:Tu.push(m)}function he(m,x,C){Ws?(b(uc,x._currentValue),x._currentValue=C):(b(uc,x._currentValue2),x._currentValue2=C)}function Re(m){var x=uc.current;Ws?m._currentValue=x:m._currentValue2=x,v(uc)}function oe(m,x,C){for(;m!==null;){var k=m.alternate;if((m.childLanes&x)!==x?(m.childLanes|=x,k!==null&&(k.childLanes|=x)):k!==null&&(k.childLanes&x)!==x&&(k.childLanes|=x),m===C)break;m=m.return}}function Ue(m,x,C,k){var $=m.child;for($!==null&&($.return=m);$!==null;){var ee=$.dependencies;if(ee!==null){var Ce=$.child;ee=ee.firstContext;e:for(;ee!==null;){var at=ee;ee=$;for(var It=0;It<x.length;It++)if(at.context===x[It]){ee.lanes|=C,at=ee.alternate,at!==null&&(at.lanes|=C),oe(ee.return,C,m),k||(Ce=null);break e}ee=at.next}}else if($.tag===18){if(Ce=$.return,Ce===null)throw Error(i(341));Ce.lanes|=C,ee=Ce.alternate,ee!==null&&(ee.lanes|=C),oe(Ce,C,m),Ce=null}else Ce=$.child;if(Ce!==null)Ce.return=$;else for(Ce=$;Ce!==null;){if(Ce===m){Ce=null;break}if($=Ce.sibling,$!==null){$.return=Ce.return,Ce=$;break}Ce=Ce.return}$=Ce}}function Ee(m,x,C,k){m=null;for(var $=x,ee=!1;$!==null;){if(!ee){if(($.flags&524288)!==0)ee=!0;else if(($.flags&262144)!==0)break}if($.tag===10){var Ce=$.alternate;if(Ce===null)throw Error(i(387));if(Ce=Ce.memoizedProps,Ce!==null){var at=$.type;qs($.pendingProps.value,Ce.value)||(m!==null?m.push(at):m=[at])}}else if($===Xm.current){if(Ce=$.alternate,Ce===null)throw Error(i(387));Ce.memoizedState.memoizedState!==$.memoizedState.memoizedState&&(m!==null?m.push(Nh):m=[Nh])}$=$.return}m!==null&&Ue(x,m,C,k),x.flags|=262144}function Pe(m){for(m=m.firstContext;m!==null;){var x=m.context;if(!qs(Ws?x._currentValue:x._currentValue2,m.memoizedValue))return!0;m=m.next}return!1}function Ze(m){$i=m,jc=null,m=m.dependencies,m!==null&&(m.firstContext=null)}function ae(m){return be($i,m)}function te(m,x){return $i===null&&Ze(m),be(m,x)}function be(m,x){var C=Ws?x._currentValue:x._currentValue2;if(x={context:x,memoizedValue:C,next:null},jc===null){if(m===null)throw Error(i(308));jc=x,m.dependencies={lanes:0,firstContext:x},m.flags|=524288}else jc=jc.next=x;return C}function me(){return{controller:new M3,data:new Map,refCount:0}}function ge(m){m.refCount--,m.refCount===0&&La(HE,function(){m.controller.abort()})}function ke(){}function Xe(m){m!==Ei&&m.next===null&&(Ei===null?Ym=Ei=m:Ei=Ei.next=m),dc=!0,po||(po=!0,Se())}function Ae(m,x){if(!hx&&dc){hx=!0;do for(var C=!1,k=Ym;k!==null;){if(m!==0){var $=k.pendingLanes;if($===0)var ee=0;else{var Ce=k.suspendedLanes,at=k.pingedLanes;ee=(1<<31-Qo(42|m)+1)-1,ee&=$&~(Ce&~at),ee=ee&201326741?ee&201326741|1:ee?ee|2:0}ee!==0&&(C=!0,qe(k,ee))}else ee=Ur,ee=S(k,k===Mr?ee:0,k.cancelPendingCommit!==null||k.timeoutHandle!==Zo),(ee&3)===0||E(k,ee)||(C=!0,qe(k,ee));k=k.next}while(C);hx=!1}}function je(){We()}function We(){dc=po=!1;var m=0;mf!==0&&Ch()&&(m=mf);for(var x=ho(),C=null,k=Ym;k!==null;){var $=k.next,ee=De(k,x);ee===0?(k.next=null,C===null?Ym=$:C.next=$,$===null&&(Ei=C)):(C=k,(m!==0||(ee&3)!==0)&&(dc=!0)),k=$}ua!==0&&ua!==5||Ae(m),mf!==0&&(mf=0)}function De(m,x){for(var C=m.suspendedLanes,k=m.pingedLanes,$=m.expirationTimes,ee=m.pendingLanes&-62914561;0<ee;){var Ce=31-Qo(ee),at=1<<Ce,It=$[Ce];It===-1?((at&C)===0||(at&k)!==0)&&($[Ce]=A(at,x)):It<=x&&(m.expiredLanes|=at),ee&=~at}if(x=Mr,C=Ur,C=S(m,m===x?C:0,m.cancelPendingCommit!==null||m.timeoutHandle!==Zo),k=m.callbackNode,C===0||m===x&&(Ai===2||Ai===9)||m.cancelPendingCommit!==null)return k!==null&&k!==null&&ox(k),m.callbackNode=null,m.callbackPriority=0;if((C&3)===0||E(m,C)){if(x=C&-C,x===m.callbackPriority)return x;switch(k!==null&&ox(k),V(C)){case 2:case 8:C=S3;break;case 32:C=Wm;break;case 268435456:C=cx;break;default:C=Wm}return k=Be.bind(null,m),C=Gm(C,k),m.callbackPriority=x,m.callbackNode=C,x}return k!==null&&k!==null&&ox(k),m.callbackPriority=2,m.callbackNode=null,2}function Be(m,x){if(ua!==0&&ua!==5)return m.callbackNode=null,m.callbackPriority=0,null;var C=m.callbackNode;if(bu()&&m.callbackNode!==C)return null;var k=Ur;return k=S(m,m===Mr?k:0,m.cancelPendingCommit!==null||m.timeoutHandle!==Zo),k===0?null:(Lc(m,k,x),De(m,ho()),m.callbackNode!=null&&m.callbackNode===C?Be.bind(null,m):null)}function qe(m,x){if(bu())return null;Lc(m,x,!0)}function Se(){Zy?Qy(function(){(Ir&6)!==0?Gm(lx,je):We()}):Gm(lx,je)}function Ye(){if(mf===0){var m=_d;m===0&&(m=ax,ax<<=1,(ax&261888)===0&&(ax=256)),mf=m}return mf}function dt(m,x){if(Yp===null){var C=Yp=[];Eb=0,_d=Ye(),Sa={status:"pending",value:void 0,then:function(k){C.push(k)}}}return Eb++,x.then(Le,Le),x}function Le(){if(--Eb===0&&Yp!==null){Sa!==null&&(Sa.status="fulfilled");var m=Yp;Yp=null,_d=0,Sa=null;for(var x=0;x<m.length;x++)(0,m[x])()}}function st(m,x){var C=[],k={status:"pending",value:null,reason:null,then:function($){C.push($)}};return m.then(function(){k.status="fulfilled",k.value=x;for(var $=0;$<C.length;$++)(0,C[$])(x)},function($){for(k.status="rejected",k.reason=$,$=0;$<C.length;$++)(0,C[$])(void 0)}),k}function ft(){var m=gf.current;return m!==null?m:Mr.pooledCache}function mt(m,x){x===null?b(gf,gf.current):b(gf,x.pool)}function tt(){var m=ft();return m===null?null:{parent:Ws?us._currentValue:us._currentValue2,pool:m}}function Qe(m,x){if(qs(m,x))return!0;if(typeof m!="object"||m===null||typeof x!="object"||x===null)return!1;var C=Object.keys(m),k=Object.keys(x);if(C.length!==k.length)return!1;for(k=0;k<C.length;k++){var $=C[k];if(!BE.call(x,$)||!qs(m[$],x[$]))return!1}return!0}function ze(m){return m=m.status,m==="fulfilled"||m==="rejected"}function Te(m,x,C){switch(C=m[C],C===void 0?m.push(x):C!==x&&(x.then(ke,ke),x=C),x.status){case"fulfilled":return x.value;case"rejected":throw m=x.reason,ht(m),m;default:if(typeof x.status=="string")x.then(ke,ke);else{if(m=Mr,m!==null&&100<m.shellSuspendCounter)throw Error(i(482));m=x,m.status="pending",m.then(function(k){if(x.status==="pending"){var $=x;$.status="fulfilled",$.value=k}},function(k){if(x.status==="pending"){var $=x;$.status="rejected",$.reason=k}})}switch(x.status){case"fulfilled":return x.value;case"rejected":throw m=x.reason,ht(m),m}throw ko=x,wa}}function He(m){try{var x=m._init;return x(m._payload)}catch(C){throw C!==null&&typeof C=="object"&&typeof C.then=="function"?(ko=C,wa):C}}function et(){if(ko===null)throw Error(i(459));var m=ko;return ko=null,m}function ht(m){if(m===wa||m===hc)throw Error(i(483))}function ct(m){var x=Dh;return Dh+=1,vf===null&&(vf=[]),Te(vf,m,x)}function bt(m,x){x=x.props.ref,m.ref=x!==void 0?x:null}function wt(m,x){throw x.$$typeof===Sh?Error(i(525)):(m=Object.prototype.toString.call(x),Error(i(31,m==="[object Object]"?"object with keys {"+Object.keys(x).join(", ")+"}":m)))}function Pt(m){function x(At,xt){if(m){var kt=At.deletions;kt===null?(At.deletions=[xt],At.flags|=16):kt.push(xt)}}function C(At,xt){if(!m)return null;for(;xt!==null;)x(At,xt),xt=xt.sibling;return null}function k(At){for(var xt=new Map;At!==null;)At.key!==null?xt.set(At.key,At):xt.set(At.index,At),At=At.sibling;return xt}function $(At,xt){return At=Ml(At,xt),At.index=0,At.sibling=null,At}function ee(At,xt,kt){return At.index=kt,m?(kt=At.alternate,kt!==null?(kt=kt.index,kt<xt?(At.flags|=67108866,xt):kt):(At.flags|=67108866,xt)):(At.flags|=1048576,xt)}function Ce(At){return m&&At.alternate===null&&(At.flags|=67108866),At}function at(At,xt,kt,tn){return xt===null||xt.tag!==6?(xt=Uy(kt,At.mode,tn),xt.return=At,xt):(xt=$(xt,kt),xt.return=At,xt)}function It(At,xt,kt,tn){var Xn=kt.type;return Xn===Mh?ln(At,xt,kt.props.children,tn,kt.key):xt!==null&&(xt.elementType===Xn||typeof Xn=="object"&&Xn!==null&&Xn.$$typeof===Ao&&He(Xn)===xt.type)?(xt=$(xt,kt.props),bt(xt,kt),xt.return=At,xt):(xt=pd(kt.type,kt.key,kt.props,null,At.mode,tn),bt(xt,kt),xt.return=At,xt)}function Wt(At,xt,kt,tn){return xt===null||xt.tag!==4||xt.stateNode.containerInfo!==kt.containerInfo||xt.stateNode.implementation!==kt.implementation?(xt=Hy(kt,At.mode,tn),xt.return=At,xt):(xt=$(xt,kt.children||[]),xt.return=At,xt)}function ln(At,xt,kt,tn,Xn){return xt===null||xt.tag!==7?(xt=ic(kt,At.mode,tn,Xn),xt.return=At,xt):(xt=$(xt,kt),xt.return=At,xt)}function qt(At,xt,kt){if(typeof xt=="string"&&xt!==""||typeof xt=="number"||typeof xt=="bigint")return xt=Uy(""+xt,At.mode,kt),xt.return=At,xt;if(typeof xt=="object"&&xt!==null){switch(xt.$$typeof){case _u:return kt=pd(xt.type,xt.key,xt.props,null,At.mode,kt),bt(kt,xt),kt.return=At,kt;case wh:return xt=Hy(xt,At.mode,kt),xt.return=At,xt;case Ao:return xt=He(xt),qt(At,xt,kt)}if(df(xt)||d(xt))return xt=ic(xt,At.mode,kt,null),xt.return=At,xt;if(typeof xt.then=="function")return qt(At,ct(xt),kt);if(xt.$$typeof===sc)return qt(At,te(At,xt),kt);wt(At,xt)}return null}function yn(At,xt,kt,tn){var Xn=xt!==null?xt.key:null;if(typeof kt=="string"&&kt!==""||typeof kt=="number"||typeof kt=="bigint")return Xn!==null?null:at(At,xt,""+kt,tn);if(typeof kt=="object"&&kt!==null){switch(kt.$$typeof){case _u:return kt.key===Xn?It(At,xt,kt,tn):null;case wh:return kt.key===Xn?Wt(At,xt,kt,tn):null;case Ao:return kt=He(kt),yn(At,xt,kt,tn)}if(df(kt)||d(kt))return Xn!==null?null:ln(At,xt,kt,tn,null);if(typeof kt.then=="function")return yn(At,xt,ct(kt),tn);if(kt.$$typeof===sc)return yn(At,xt,te(At,kt),tn);wt(At,kt)}return null}function dr(At,xt,kt,tn,Xn){if(typeof tn=="string"&&tn!==""||typeof tn=="number"||typeof tn=="bigint")return At=At.get(kt)||null,at(xt,At,""+tn,Xn);if(typeof tn=="object"&&tn!==null){switch(tn.$$typeof){case _u:return At=At.get(tn.key===null?kt:tn.key)||null,It(xt,At,tn,Xn);case wh:return At=At.get(tn.key===null?kt:tn.key)||null,Wt(xt,At,tn,Xn);case Ao:return tn=He(tn),dr(At,xt,kt,tn,Xn)}if(df(tn)||d(tn))return At=At.get(kt)||null,ln(xt,At,tn,Xn,null);if(typeof tn.then=="function")return dr(At,xt,kt,ct(tn),Xn);if(tn.$$typeof===sc)return dr(At,xt,kt,te(xt,tn),Xn);wt(xt,tn)}return null}function Ks(At,xt,kt,tn){for(var Xn=null,Cs=null,Kn=xt,ti=xt=0,za=null;Kn!==null&&ti<kt.length;ti++){Kn.index>ti?(za=Kn,Kn=null):za=Kn.sibling;var fi=yn(At,Kn,kt[ti],tn);if(fi===null){Kn===null&&(Kn=za);break}m&&Kn&&fi.alternate===null&&x(At,Kn),xt=ee(fi,xt,ti),Cs===null?Xn=fi:Cs.sibling=fi,Cs=fi,Kn=za}if(ti===kt.length)return C(At,Kn),Fr&&U(At,ti),Xn;if(Kn===null){for(;ti<kt.length;ti++)Kn=qt(At,kt[ti],tn),Kn!==null&&(xt=ee(Kn,xt,ti),Cs===null?Xn=Kn:Cs.sibling=Kn,Cs=Kn);return Fr&&U(At,ti),Xn}for(Kn=k(Kn);ti<kt.length;ti++)za=dr(Kn,At,ti,kt[ti],tn),za!==null&&(m&&za.alternate!==null&&Kn.delete(za.key===null?ti:za.key),xt=ee(za,xt,ti),Cs===null?Xn=za:Cs.sibling=za,Cs=za);return m&&Kn.forEach(function(gc){return x(At,gc)}),Fr&&U(At,ti),Xn}function r0(At,xt,kt,tn){if(kt==null)throw Error(i(151));for(var Xn=null,Cs=null,Kn=xt,ti=xt=0,za=null,fi=kt.next();Kn!==null&&!fi.done;ti++,fi=kt.next()){Kn.index>ti?(za=Kn,Kn=null):za=Kn.sibling;var gc=yn(At,Kn,fi.value,tn);if(gc===null){Kn===null&&(Kn=za);break}m&&Kn&&gc.alternate===null&&x(At,Kn),xt=ee(gc,xt,ti),Cs===null?Xn=gc:Cs.sibling=gc,Cs=gc,Kn=za}if(fi.done)return C(At,Kn),Fr&&U(At,ti),Xn;if(Kn===null){for(;!fi.done;ti++,fi=kt.next())fi=qt(At,fi.value,tn),fi!==null&&(xt=ee(fi,xt,ti),Cs===null?Xn=fi:Cs.sibling=fi,Cs=fi);return Fr&&U(At,ti),Xn}for(Kn=k(Kn);!fi.done;ti++,fi=kt.next())fi=dr(Kn,At,ti,fi.value,tn),fi!==null&&(m&&fi.alternate!==null&&Kn.delete(fi.key===null?ti:fi.key),xt=ee(fi,xt,ti),Cs===null?Xn=fi:Cs.sibling=fi,Cs=fi);return m&&Kn.forEach(function(VE){return x(At,VE)}),Fr&&U(At,ti),Xn}function Tf(At,xt,kt,tn){if(typeof kt=="object"&&kt!==null&&kt.type===Mh&&kt.key===null&&(kt=kt.props.children),typeof kt=="object"&&kt!==null){switch(kt.$$typeof){case _u:e:{for(var Xn=kt.key;xt!==null;){if(xt.key===Xn){if(Xn=kt.type,Xn===Mh){if(xt.tag===7){C(At,xt.sibling),tn=$(xt,kt.props.children),tn.return=At,At=tn;break e}}else if(xt.elementType===Xn||typeof Xn=="object"&&Xn!==null&&Xn.$$typeof===Ao&&He(Xn)===xt.type){C(At,xt.sibling),tn=$(xt,kt.props),bt(tn,kt),tn.return=At,At=tn;break e}C(At,xt);break}else x(At,xt);xt=xt.sibling}kt.type===Mh?(tn=ic(kt.props.children,At.mode,tn,kt.key),tn.return=At,At=tn):(tn=pd(kt.type,kt.key,kt.props,null,At.mode,tn),bt(tn,kt),tn.return=At,At=tn)}return Ce(At);case wh:e:{for(Xn=kt.key;xt!==null;){if(xt.key===Xn)if(xt.tag===4&&xt.stateNode.containerInfo===kt.containerInfo&&xt.stateNode.implementation===kt.implementation){C(At,xt.sibling),tn=$(xt,kt.children||[]),tn.return=At,At=tn;break e}else{C(At,xt);break}else x(At,xt);xt=xt.sibling}tn=Hy(kt,At.mode,tn),tn.return=At,At=tn}return Ce(At);case Ao:return kt=He(kt),Tf(At,xt,kt,tn)}if(df(kt))return Ks(At,xt,kt,tn);if(d(kt)){if(Xn=d(kt),typeof Xn!="function")throw Error(i(150));return kt=Xn.call(kt),r0(At,xt,kt,tn)}if(typeof kt.then=="function")return Tf(At,xt,ct(kt),tn);if(kt.$$typeof===sc)return Tf(At,xt,te(At,kt),tn);wt(At,kt)}return typeof kt=="string"&&kt!==""||typeof kt=="number"||typeof kt=="bigint"?(kt=""+kt,xt!==null&&xt.tag===6?(C(At,xt.sibling),tn=$(xt,kt),tn.return=At,At=tn):(C(At,xt),tn=Uy(kt,At.mode,tn),tn.return=At,At=tn),Ce(At)):C(At,xt)}return function(At,xt,kt,tn){try{Dh=0;var Xn=Tf(At,xt,kt,tn);return vf=null,Xn}catch(Kn){if(Kn===wa||Kn===hc)throw Kn;var Cs=n(29,Kn,null,At.mode);return Cs.lanes=tn,Cs.return=At,Cs}finally{}}}function $e(){for(var m=Cu,x=Oh=Cu=0;x<m;){var C=Ja[x];Ja[x++]=null;var k=Ja[x];Ja[x++]=null;var $=Ja[x];Ja[x++]=null;var ee=Ja[x];if(Ja[x++]=null,k!==null&&$!==null){var Ce=k.pending;Ce===null?$.next=$:($.next=Ce.next,Ce.next=$),k.pending=$}ee!==0&&Gt(C,$,ee)}}function Tt(m,x,C,k){Ja[Cu++]=m,Ja[Cu++]=x,Ja[Cu++]=C,Ja[Cu++]=k,Oh|=k,m.lanes|=k,m=m.alternate,m!==null&&(m.lanes|=k)}function Et(m,x,C,k){return Tt(m,x,C,k),an(m)}function Ot(m,x){return Tt(m,null,null,x),an(m)}function Gt(m,x,C){m.lanes|=C;var k=m.alternate;k!==null&&(k.lanes|=C);for(var $=!1,ee=m.return;ee!==null;)ee.childLanes|=C,k=ee.alternate,k!==null&&(k.childLanes|=C),ee.tag===22&&(m=ee.stateNode,m===null||m._visibility&1||($=!0)),m=ee,ee=ee.return;return m.tag===3?(ee=m.stateNode,$&&x!==null&&($=31-Qo(C),m=ee.hiddenUpdates,k=m[$],k===null?m[$]=[x]:k.push(x),x.lane=C|536870912),ee):null}function an(m){if(50<ai)throw ai=0,tg=null,Error(i(185));for(var x=m.return;x!==null;)m=x,x=m.return;return m.tag===3?m.stateNode:null}function On(m){m.updateQueue={baseState:m.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Bt(m,x){m=m.updateQueue,x.updateQueue===m&&(x.updateQueue={baseState:m.baseState,firstBaseUpdate:m.firstBaseUpdate,lastBaseUpdate:m.lastBaseUpdate,shared:m.shared,callbacks:null})}function fn(m){return{lane:m,tag:0,payload:null,callback:null,next:null}}function Ht(m,x,C){var k=m.updateQueue;if(k===null)return null;if(k=k.shared,(Ir&2)!==0){var $=k.pending;return $===null?x.next=x:(x.next=$.next,$.next=x),k.pending=x,x=an(m),Gt(m,null,C),x}return Tt(m,k,x,C),an(m)}function In(m,x,C){if(x=x.updateQueue,x!==null&&(x=x.shared,(C&4194048)!==0)){var k=x.lanes;k&=m.pendingLanes,C|=k,x.lanes=C,O(m,C)}}function Nn(m,x){var C=m.updateQueue,k=m.alternate;if(k!==null&&(k=k.updateQueue,C===k)){var $=null,ee=null;if(C=C.firstBaseUpdate,C!==null){do{var Ce={lane:C.lane,tag:C.tag,payload:C.payload,callback:null,next:null};ee===null?$=ee=Ce:ee=ee.next=Ce,C=C.next}while(C!==null);ee===null?$=ee=x:ee=ee.next=x}else $=ee=x;C={baseState:k.baseState,firstBaseUpdate:$,lastBaseUpdate:ee,shared:k.shared,callbacks:k.callbacks},m.updateQueue=C;return}m=C.lastBaseUpdate,m===null?C.firstBaseUpdate=x:m.next=x,C.lastBaseUpdate=x}function bn(){if(mx){var m=Sa;if(m!==null)throw m}}function Ln(m,x,C,k){mx=!1;var $=m.updateQueue;Cl=!1;var ee=$.firstBaseUpdate,Ce=$.lastBaseUpdate,at=$.shared.pending;if(at!==null){$.shared.pending=null;var It=at,Wt=It.next;It.next=null,Ce===null?ee=Wt:Ce.next=Wt,Ce=It;var ln=m.alternate;ln!==null&&(ln=ln.updateQueue,at=ln.lastBaseUpdate,at!==Ce&&(at===null?ln.firstBaseUpdate=Wt:at.next=Wt,ln.lastBaseUpdate=It))}if(ee!==null){var qt=$.baseState;Ce=0,ln=Wt=It=null,at=ee;do{var yn=at.lane&-536870913,dr=yn!==at.lane;if(dr?(Ur&yn)===yn:(k&yn)===yn){yn!==0&&yn===_d&&(mx=!0),ln!==null&&(ln=ln.next={lane:0,tag:at.tag,payload:at.payload,callback:null,next:null});e:{var Ks=m,r0=at;yn=x;var Tf=C;switch(r0.tag){case 1:if(Ks=r0.payload,typeof Ks=="function"){qt=Ks.call(Tf,qt,yn);break e}qt=Ks;break e;case 3:Ks.flags=Ks.flags&-65537|128;case 0:if(Ks=r0.payload,yn=typeof Ks=="function"?Ks.call(Tf,qt,yn):Ks,yn==null)break e;qt=Vv({},qt,yn);break e;case 2:Cl=!0}}yn=at.callback,yn!==null&&(m.flags|=64,dr&&(m.flags|=8192),dr=$.callbacks,dr===null?$.callbacks=[yn]:dr.push(yn))}else dr={lane:yn,tag:at.tag,payload:at.payload,callback:at.callback,next:null},ln===null?(Wt=ln=dr,It=qt):ln=ln.next=dr,Ce|=yn;if(at=at.next,at===null){if(at=$.shared.pending,at===null)break;dr=at,at=dr.next,dr.next=null,$.lastBaseUpdate=dr,$.shared.pending=null}}while(!0);ln===null&&(It=qt),$.baseState=It,$.firstBaseUpdate=Wt,$.lastBaseUpdate=ln,ee===null&&($.shared.lanes=0),wd|=Ce,m.lanes=Ce,m.memoizedState=qt}}function Fn(m,x){if(typeof m!="function")throw Error(i(191,m));m.call(x)}function Bi(m,x){var C=m.callbacks;if(C!==null)for(m.callbacks=null,m=0;m<C.length;m++)Fn(C[m],x)}function ui(m,x){m=Nu,b(xf,m),b(Lh,x),Nu=m|x.baseLanes}function ve(){b(xf,Nu),b(Lh,Lh.current)}function ot(){Nu=xf.current,v(Lh),v(xf)}function _t(m){var x=m.alternate;b(zs,zs.current&1),b(el,m),tl===null&&(x===null||Lh.current!==null||x.memoizedState!==null)&&(tl=m)}function yt(m){b(zs,zs.current),b(el,m),tl===null&&(tl=m)}function vt(m){m.tag===22?(b(zs,zs.current),b(el,m),tl===null&&(tl=m)):Yt()}function Yt(){b(zs,zs.current),b(el,el.current)}function rn(m){v(el),tl===m&&(tl=null),v(zs)}function sn(m){for(var x=m;x!==null;){if(x.tag===13){var C=x.memoizedState;if(C!==null&&(C=C.dehydrated,C===null||hf(C)||Zv(C)))return x}else if(x.tag===19&&(x.memoizedProps.revealOrder==="forwards"||x.memoizedProps.revealOrder==="backwards"||x.memoizedProps.revealOrder==="unstable_legacy-backwards"||x.memoizedProps.revealOrder==="together")){if((x.flags&128)!==0)return x}else if(x.child!==null){x.child.return=x,x=x.child;continue}if(x===m)break;for(;x.sibling===null;){if(x.return===null||x.return===m)return null;x=x.return}x.sibling.return=x.return,x=x.sibling}return null}function Zt(){throw Error(i(321))}function Mn(m,x){if(x===null)return!1;for(var C=0;C<x.length&&C<m.length;C++)if(!qs(m[C],x[C]))return!1;return!0}function Un(m,x,C,k,$,ee){return Sd=ee,vr=x,x.memoizedState=null,x.updateQueue=null,x.lanes=0,Gn.H=m===null||m.memoizedState===null?Ms:Au,Kr=!1,ee=C(k,$),Kr=!1,_r&&(ee=on(x,C,k,$)),$n(m),ee}function $n(m){Gn.H=Al;var x=Bn!==null&&Bn.next!==null;if(Sd=0,or=Bn=vr=null,wr=!1,pc=0,Fc=null,x)throw Error(i(300));m===null||es||(m=m.dependencies,m!==null&&Pe(m)&&(es=!0))}function on(m,x,C,k){vr=m;var $=0;do{if(_r&&(Fc=null),pc=0,_r=!1,25<=$)throw Error(i(301));if($+=1,or=Bn=null,m.updateQueue!=null){var ee=m.updateQueue;ee.lastEffect=null,ee.events=null,ee.stores=null,ee.memoCache!=null&&(ee.memoCache.index=0)}Gn.H=yf,ee=x(C,k)}while(_r);return ee}function ir(){var m=Gn.H,x=m.useState()[0];return x=typeof x.then=="function"?Rn(x):x,m=m.useState()[0],(Bn!==null?Bn.memoizedState:null)!==m&&(vr.flags|=1024),x}function Xr(){var m=mo!==0;return mo=0,m}function Jr(m,x,C){x.updateQueue=m.updateQueue,x.flags&=-2053,m.lanes&=~C}function cr(m){if(wr){for(m=m.memoizedState;m!==null;){var x=m.queue;x!==null&&(x.pending=null),m=m.next}wr=!1}Sd=0,or=Bn=vr=null,_r=!1,pc=mo=0,Fc=null}function Nr(){var m={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return or===null?vr.memoizedState=or=m:or=or.next=m,or}function en(){if(Bn===null){var m=vr.alternate;m=m!==null?m.memoizedState:null}else m=Bn.next;var x=or===null?vr.memoizedState:or.next;if(x!==null)or=x,Bn=m;else{if(m===null)throw vr.alternate===null?Error(i(467)):Error(i(310));Bn=m,m={memoizedState:Bn.memoizedState,baseState:Bn.baseState,baseQueue:Bn.baseQueue,queue:Bn.queue,next:null},or===null?vr.memoizedState=or=m:or=or.next=m}return or}function ss(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Rn(m){var x=pc;return pc+=1,Fc===null&&(Fc=[]),m=Te(Fc,m,x),x=vr,(or===null?x.memoizedState:or.next)===null&&(x=x.alternate,Gn.H=x===null||x.memoizedState===null?Ms:Au),m}function gs(m){if(m!==null&&typeof m=="object"){if(typeof m.then=="function")return Rn(m);if(m.$$typeof===sc)return ae(m)}throw Error(i(438,String(m)))}function Rs(m){var x=null,C=vr.updateQueue;if(C!==null&&(x=C.memoCache),x==null){var k=vr.alternate;k!==null&&(k=k.updateQueue,k!==null&&(k=k.memoCache,k!=null&&(x={data:k.data.map(function($){return $.slice()}),index:0})))}if(x==null&&(x={data:[],index:0}),C===null&&(C=ss(),vr.updateQueue=C),C.memoCache=x,C=x.data[x.index],C===void 0)for(C=x.data[x.index]=Array(m),k=0;k<m;k++)C[k]=Gy;return x.index++,C}function Pi(m,x){return typeof x=="function"?x(m):x}function vs(m){var x=en();return pr(x,Bn,m)}function pr(m,x,C){var k=m.queue;if(k===null)throw Error(i(311));k.lastRenderedReducer=C;var $=m.baseQueue,ee=k.pending;if(ee!==null){if($!==null){var Ce=$.next;$.next=ee.next,ee.next=Ce}x.baseQueue=$=ee,k.pending=null}if(ee=m.baseState,$===null)m.memoizedState=ee;else{x=$.next;var at=Ce=null,It=null,Wt=x,ln=!1;do{var qt=Wt.lane&-536870913;if(qt!==Wt.lane?(Ur&qt)===qt:(Sd&qt)===qt){var yn=Wt.revertLane;if(yn===0)It!==null&&(It=It.next={lane:0,revertLane:0,gesture:null,action:Wt.action,hasEagerState:Wt.hasEagerState,eagerState:Wt.eagerState,next:null}),qt===_d&&(ln=!0);else if((Sd&yn)===yn){Wt=Wt.next,yn===_d&&(ln=!0);continue}else qt={lane:0,revertLane:Wt.revertLane,gesture:null,action:Wt.action,hasEagerState:Wt.hasEagerState,eagerState:Wt.eagerState,next:null},It===null?(at=It=qt,Ce=ee):It=It.next=qt,vr.lanes|=yn,wd|=yn;qt=Wt.action,Kr&&C(ee,qt),ee=Wt.hasEagerState?Wt.eagerState:C(ee,qt)}else yn={lane:qt,revertLane:Wt.revertLane,gesture:Wt.gesture,action:Wt.action,hasEagerState:Wt.hasEagerState,eagerState:Wt.eagerState,next:null},It===null?(at=It=yn,Ce=ee):It=It.next=yn,vr.lanes|=qt,wd|=qt;Wt=Wt.next}while(Wt!==null&&Wt!==x);if(It===null?Ce=ee:It.next=at,!qs(ee,m.memoizedState)&&(es=!0,ln&&(C=Sa,C!==null)))throw C;m.memoizedState=ee,m.baseState=Ce,m.baseQueue=It,k.lastRenderedState=ee}return $===null&&(k.lanes=0),[m.memoizedState,k.dispatch]}function di(m){var x=en(),C=x.queue;if(C===null)throw Error(i(311));C.lastRenderedReducer=m;var k=C.dispatch,$=C.pending,ee=x.memoizedState;if($!==null){C.pending=null;var Ce=$=$.next;do ee=m(ee,Ce.action),Ce=Ce.next;while(Ce!==$);qs(ee,x.memoizedState)||(es=!0),x.memoizedState=ee,x.baseQueue===null&&(x.baseState=ee),C.lastRenderedState=ee}return[ee,k]}function ks(m,x,C){var k=vr,$=en(),ee=Fr;if(ee){if(C===void 0)throw Error(i(407));C=C()}else C=x();var Ce=!qs((Bn||$).memoizedState,C);if(Ce&&($.memoizedState=C,es=!0),$=$.queue,zr(co.bind(null,k,$,m),[m]),$.getSnapshot!==x||Ce||or!==null&&or.memoizedState.tag&1){if(k.flags|=2048,xs(9,{destroy:void 0},$a.bind(null,k,$,C,x),null),Mr===null)throw Error(i(349));ee||(Sd&127)!==0||Ii(k,x,C)}return C}function Ii(m,x,C){m.flags|=16384,m={getSnapshot:x,value:C},x=vr.updateQueue,x===null?(x=ss(),vr.updateQueue=x,x.stores=[m]):(C=x.stores,C===null?x.stores=[m]:C.push(m))}function $a(m,x,C,k){x.value=C,x.getSnapshot=k,So(x)&&ql(m)}function co(m,x,C){return C(function(){So(x)&&ql(m)})}function So(m){var x=m.getSnapshot;m=m.value;try{var C=x();return!qs(m,C)}catch{return!0}}function ql(m){var x=Ot(m,2);x!==null&&Ss(x,m,2)}function xl(m){var x=Nr();if(typeof m=="function"){var C=m;if(m=C(),Kr){G(!0);try{C()}finally{G(!1)}}}return x.memoizedState=x.baseState=m,x.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pi,lastRenderedState:m},x}function uo(m,x,C,k){return m.baseState=C,pr(m,Bn,typeof k=="function"?k:Pi)}function Ps(m,x,C,k,$){if(xh(m))throw Error(i(485));if(m=x.action,m!==null){var ee={payload:$,action:m,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(Ce){ee.listeners.push(Ce)}};Gn.T!==null?C(!0):ee.isTransition=!1,k(ee),C=x.pending,C===null?(ee.next=x.pending=ee,Xl(x,ee)):(ee.next=C.next,x.pending=C.next=ee)}}function Xl(m,x){var C=x.action,k=x.payload,$=m.state;if(x.isTransition){var ee=Gn.T,Ce={};Gn.T=Ce;try{var at=C($,k),It=Gn.S;It!==null&&It(Ce,at),Go(m,x,at)}catch(Wt){Mo(m,x,Wt)}finally{ee!==null&&Ce.types!==null&&(ee.types=Ce.types),Gn.T=ee}}else try{ee=C($,k),Go(m,x,ee)}catch(Wt){Mo(m,x,Wt)}}function Go(m,x,C){C!==null&&typeof C=="object"&&typeof C.then=="function"?C.then(function(k){wo(m,x,k)},function(k){return Mo(m,x,k)}):wo(m,x,C)}function wo(m,x,C){x.status="fulfilled",x.value=C,kc(x),m.state=C,x=m.pending,x!==null&&(C=x.next,C===x?m.pending=null:(C=C.next,x.next=C,Xl(m,C)))}function Mo(m,x,C){var k=m.pending;if(m.pending=null,k!==null){k=k.next;do x.status="rejected",x.reason=C,kc(x),x=x.next;while(x!==k)}m.action=null}function kc(m){m=m.listeners;for(var x=0;x<m.length;x++)(0,m[x])()}function Pc(m,x){return x}function Yl(m,x){if(Fr){var C=Mr.formState;if(C!==null){e:{var k=vr;if(Fr){if(cs){var $=Qw(cs,Ro);if($){cs=Jw($),k=cb($);break e}}fe(k)}k=!1}k&&(x=C[0])}}C=Nr(),C.memoizedState=C.baseState=x,k={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pc,lastRenderedState:x},C.queue=k,C=_l.bind(null,vr,k),k.dispatch=C,k=xl(!1);var ee=Tp.bind(null,vr,!1,k.queue);return k=Nr(),$={state:x,dispatch:null,action:m,pending:null},k.queue=$,C=Ps.bind(null,vr,$,ee,C),$.dispatch=C,k.memoizedState=m,[x,C,!1]}function qa(m){var x=en();return ia(x,Bn,m)}function ia(m,x,C){if(x=pr(m,x,Pc)[0],m=vs(Pi)[0],typeof x=="object"&&x!==null&&typeof x.then=="function")try{var k=Rn(x)}catch(Ce){throw Ce===wa?hc:Ce}else k=x;x=en();var $=x.queue,ee=$.dispatch;return C!==x.memoizedState&&(vr.flags|=2048,xs(9,{destroy:void 0},Aa.bind(null,$,C),null)),[k,ee,m]}function Aa(m,x){m.action=x}function yl(m){var x=en(),C=Bn;if(C!==null)return ia(x,C,m);en(),x=x.memoizedState,C=en();var k=C.queue.dispatch;return C.memoizedState=m,[x,k,!1]}function xs(m,x,C,k){return m={tag:m,create:C,deps:k,inst:x,next:null},x=vr.updateQueue,x===null&&(x=ss(),vr.updateQueue=x),C=x.lastEffect,C===null?x.lastEffect=m.next=m:(k=C.next,C.next=m,m.next=k,x.lastEffect=m),m}function Wo(){return en().memoizedState}function $o(m,x,C,k){var $=Nr();vr.flags|=m,$.memoizedState=xs(1|x,{destroy:void 0},C,k===void 0?null:k)}function Ic(m,x,C,k){var $=en();k=k===void 0?null:k;var ee=$.memoizedState.inst;Bn!==null&&k!==null&&Mn(k,Bn.memoizedState.deps)?$.memoizedState=xs(x,ee,C,k):(vr.flags|=m,$.memoizedState=xs(1|x,ee,C,k))}function ei(m,x){$o(8390656,8,m,x)}function zr(m,x){Ic(2048,8,m,x)}function Xa(m){vr.flags|=4;var x=vr.updateQueue;if(x===null)x=ss(),vr.updateQueue=x,x.events=[m];else{var C=x.events;C===null?x.events=[m]:C.push(m)}}function mr(m){var x=en().memoizedState;return Xa({ref:x,nextImpl:m}),function(){if((Ir&2)!==0)throw Error(i(440));return x.impl.apply(void 0,arguments)}}function bi(m,x){return Ic(4,2,m,x)}function Di(m,x){return Ic(4,4,m,x)}function Wr(m,x){if(typeof x=="function"){m=m();var C=x(m);return function(){typeof C=="function"?C():x(null)}}if(x!=null)return m=m(),x.current=m,function(){x.current=null}}function To(m,x,C){C=C!=null?C.concat([m]):null,Ic(4,4,Wr.bind(null,x,m),C)}function bl(){}function Kl(m,x){var C=en();x=x===void 0?null:x;var k=C.memoizedState;return x!==null&&Mn(x,k[1])?k[0]:(C.memoizedState=[m,x],m)}function ga(m,x){var C=en();x=x===void 0?null:x;var k=C.memoizedState;if(x!==null&&Mn(x,k[1]))return k[0];if(k=m(),Kr){G(!0);try{m()}finally{G(!1)}}return C.memoizedState=[k,x],k}function hi(m,x,C){return C===void 0||(Sd&1073741824)!==0&&(Ur&261930)===0?m.memoizedState=x:(m.memoizedState=C,m=dd(),vr.lanes|=m,wd|=m,C)}function vh(m,x,C,k){return qs(C,x)?C:Lh.current!==null?(m=hi(m,C,k),qs(m,x)||(es=!0),m):(Sd&42)===0||(Sd&1073741824)!==0&&(Ur&261930)===0?(es=!0,m.memoizedState=C):(m=dd(),vr.lanes|=m,wd|=m,x)}function nd(m,x,C,k,$){var ee=ac();jr(ee!==0&&8>ee?ee:8);var Ce=Gn.T,at={};Gn.T=at,Tp(m,!1,x,C);try{var It=$(),Wt=Gn.S;if(Wt!==null&&Wt(at,It),It!==null&&typeof It=="object"&&typeof It.then=="function"){var ln=st(It,k);va(m,x,ln,os(m))}else va(m,x,k,os(m))}catch(qt){va(m,x,{then:function(){},status:"rejected",reason:qt},os())}finally{jr(ee),Ce!==null&&at.types!==null&&(Ce.types=at.types),Gn.T=Ce}}function rd(m){var x=m.memoizedState;if(x!==null)return x;x={memoizedState:Ah,baseState:Ah,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pi,lastRenderedState:Ah},next:null};var C={};return x.next={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pi,lastRenderedState:C},next:null},m.memoizedState=x,m=m.alternate,m!==null&&(m.memoizedState=x),x}function Qd(){return ae(Nh)}function fo(){return en().memoizedState}function Gi(){return en().memoizedState}function Hs(m){for(var x=m.return;x!==null;){switch(x.tag){case 24:case 3:var C=os();m=fn(C);var k=Ht(x,m,C);k!==null&&(Ss(k,x,C),In(k,x,C)),x={cache:me()},m.payload=x;return}x=x.return}}function ys(m,x,C){var k=os();C={lane:k,revertLane:0,gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null},xh(m)?_m(x,C):(C=Et(m,x,C,k),C!==null&&(Ss(C,m,k),Jd(C,x,k)))}function _l(m,x,C){var k=os();va(m,x,C,k)}function va(m,x,C,k){var $={lane:k,revertLane:0,gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null};if(xh(m))_m(x,$);else{var ee=m.alternate;if(m.lanes===0&&(ee===null||ee.lanes===0)&&(ee=x.lastRenderedReducer,ee!==null))try{var Ce=x.lastRenderedState,at=ee(Ce,C);if($.hasEagerState=!0,$.eagerState=at,qs(at,Ce))return Tt(m,x,$,0),Mr===null&&$e(),!1}catch{}finally{}if(C=Et(m,x,$,k),C!==null)return Ss(C,m,k),Jd(C,x,k),!0}return!1}function Tp(m,x,C,k){if(k={lane:2,revertLane:Ye(),gesture:null,action:k,hasEagerState:!1,eagerState:null,next:null},xh(m)){if(x)throw Error(i(479))}else x=Et(m,C,k,2),x!==null&&Ss(x,m,2)}function xh(m){var x=m.alternate;return m===vr||x!==null&&x===vr}function _m(m,x){_r=wr=!0;var C=m.pending;C===null?x.next=x:(x.next=C.next,C.next=x),m.pending=x}function Jd(m,x,C){if((C&4194048)!==0){var k=x.lanes;k&=m.pendingLanes,C|=k,x.lanes=C,O(m,C)}}function id(m,x,C,k){x=m.memoizedState,C=C(k,x),C=C==null?x:Vv({},x,C),m.memoizedState=C,m.lanes===0&&(m.updateQueue.baseState=C)}function Ep(m,x,C,k,$,ee,Ce){return m=m.stateNode,typeof m.shouldComponentUpdate=="function"?m.shouldComponentUpdate(k,ee,Ce):x.prototype&&x.prototype.isPureReactComponent?!Qe(C,k)||!Qe($,ee):!0}function Cp(m,x,C,k){m=x.state,typeof x.componentWillReceiveProps=="function"&&x.componentWillReceiveProps(C,k),typeof x.UNSAFE_componentWillReceiveProps=="function"&&x.UNSAFE_componentWillReceiveProps(C,k),x.state!==m&&Km.enqueueReplaceState(x,x.state,null)}function sd(m,x){var C=x;if("ref"in x){C={};for(var k in x)k!=="ref"&&(C[k]=x[k])}if(m=m.defaultProps){C===x&&(C=Vv({},C));for(var $ in m)C[$]===void 0&&(C[$]=m[$])}return C}function Zl(m,x){try{var C=m.onUncaughtError;C(x.value,{componentStack:x.stack})}catch(k){setTimeout(function(){throw k})}}function Ql(m,x,C){try{var k=m.onCaughtError;k(C.value,{componentStack:C.stack,errorBoundary:x.tag===1?x.stateNode:null})}catch($){setTimeout(function(){throw $})}}function ad(m,x,C){return C=fn(C),C.tag=3,C.payload={element:null},C.callback=function(){Zl(m,x)},C}function Sm(m){return m=fn(m),m.tag=3,m}function Ap(m,x,C,k){var $=C.type.getDerivedStateFromError;if(typeof $=="function"){var ee=k.value;m.payload=function(){return $(ee)},m.callback=function(){Ql(x,C,k)}}var Ce=C.stateNode;Ce!==null&&typeof Ce.componentDidCatch=="function"&&(m.callback=function(){Ql(x,C,k),typeof $!="function"&&(Md===null?Md=new Set([this]):Md.add(this));var at=k.stack;this.componentDidCatch(k.value,{componentStack:at!==null?at:""})})}function wm(m,x,C,k,$){if(C.flags|=32768,k!==null&&typeof k=="object"&&typeof k.then=="function"){if(x=C.alternate,x!==null&&Ee(x,C,$,!0),C=el.current,C!==null){switch(C.tag){case 31:case 13:return tl===null?zp():C.alternate===null&&Es===0&&(Es=3),C.flags&=-257,C.flags|=65536,C.lanes=$,k===Eu?C.flags|=16384:(x=C.updateQueue,x===null?C.updateQueue=new Set([k]):x.add(k),Up(m,k,$)),!1;case 22:return C.flags|=65536,k===Eu?C.flags|=16384:(x=C.updateQueue,x===null?(x={transitions:null,markerInstances:null,retryQueue:new Set([k])},C.updateQueue=x):(C=x.retryQueue,C===null?x.retryQueue=new Set([k]):C.add(k)),Up(m,k,$)),!1}throw Error(i(435,C.tag))}return Up(m,k,$),zp(),!1}if(Fr)return x=el.current,x!==null?((x.flags&65536)===0&&(x.flags|=256),x.flags|=65536,x.lanes=$,k!==fx&&(m=Error(i(422),{cause:k}),Oe(Q(m,C)))):(k!==fx&&(x=Error(i(423),{cause:k}),Oe(Q(x,C))),m=m.current.alternate,m.flags|=65536,$&=-$,m.lanes|=$,k=Q(k,C),$=ad(m.stateNode,k,$),Nn(m,$),Es!==4&&(Es=2)),!1;var ee=Error(i(520),{cause:k});if(ee=Q(ee,C),Qm===null?Qm=[ee]:Qm.push(ee),Es!==4&&(Es=2),x===null)return!0;k=Q(k,C),C=x;do{switch(C.tag){case 3:return C.flags|=65536,m=$&-$,C.lanes|=m,m=ad(C.stateNode,k,m),Nn(C,m),!1;case 1:if(x=C.type,ee=C.stateNode,(C.flags&128)===0&&(typeof x.getDerivedStateFromError=="function"||ee!==null&&typeof ee.componentDidCatch=="function"&&(Md===null||!Md.has(ee))))return C.flags|=65536,$&=-$,C.lanes|=$,$=Sm($),Ap($,m,C,k),Nn(C,$),!1}C=C.return}while(C!==null);return!1}function Vs(m,x,C,k){x.child=m===null?Cb(x,null,C,k):Qa(x,m.child,C,k)}function Mm(m,x,C,k,$){C=C.render;var ee=x.ref;if("ref"in k){var Ce={};for(var at in k)at!=="ref"&&(Ce[at]=k[at])}else Ce=k;return Ze(x),k=Un(m,x,C,Ce,ee,$),at=Xr(),m!==null&&!es?(Jr(m,x,$),Ke(m,x,$)):(Fr&&at&&X(x),x.flags|=1,Vs(m,x,k,$),x.child)}function Tm(m,x,C,k,$){if(m===null){var ee=C.type;return typeof ee=="function"&&!bh(ee)&&ee.defaultProps===void 0&&C.compare===null?(x.tag=15,x.type=ee,Em(m,x,ee,k,$)):(m=pd(C.type,null,k,x,x.mode,$),m.ref=x.ref,m.return=x,x.child=m)}if(ee=m.child,!lt(m,$)){var Ce=ee.memoizedProps;if(C=C.compare,C=C!==null?C:Qe,C(Ce,k)&&m.ref===x.ref)return Ke(m,x,$)}return x.flags|=1,m=Ml(ee,k),m.ref=x.ref,m.return=x,x.child=m}function Em(m,x,C,k,$){if(m!==null){var ee=m.memoizedProps;if(Qe(ee,k)&&m.ref===x.ref)if(es=!1,x.pendingProps=k=ee,lt(m,$))(m.flags&131072)!==0&&(es=!0);else return x.lanes=m.lanes,Ke(m,x,$)}return ld(m,x,C,k,$)}function Cm(m,x,C,k){var $=k.children,ee=m!==null?m.memoizedState:null;if(m===null&&x.stateNode===null&&(x.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),k.mode==="hidden"){if((x.flags&128)!==0){if(ee=ee!==null?ee.baseLanes|C:C,m!==null){for(k=x.child=m.child,$=0;k!==null;)$=$|k.lanes|k.childLanes,k=k.sibling;k=$&~ee}else k=0,x.child=null;return od(m,x,ee,C,k)}if((C&536870912)!==0)x.memoizedState={baseLanes:0,cachePool:null},m!==null&&mt(x,ee!==null?ee.cachePool:null),ee!==null?ui(x,ee):ve(),vt(x);else return k=x.lanes=536870912,od(m,x,ee!==null?ee.baseLanes|C:C,C,k)}else ee!==null?(mt(x,ee.cachePool),ui(x,ee),Yt(),x.memoizedState=null):(m!==null&&mt(x,null),ve(),Yt());return Vs(m,x,$,C),x.child}function uu(m,x){return m!==null&&m.tag===22||x.stateNode!==null||(x.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),x.sibling}function od(m,x,C,k,$){var ee=ft();return ee=ee===null?null:{parent:Ws?us._currentValue:us._currentValue2,pool:ee},x.memoizedState={baseLanes:C,cachePool:ee},m!==null&&mt(x,null),ve(),vt(x),m!==null&&Ee(m,x,k,!0),x.childLanes=$,null}function Np(m,x){return x=fu({mode:x.mode,children:x.children},m.mode),x.ref=m.ref,m.child=x,x.return=m,x}function Rp(m,x,C){return Qa(x,m.child,null,C),m=Np(x,x.pendingProps),m.flags|=2,rn(x),x.memoizedState=null,m}function Am(m,x,C){var k=x.pendingProps,$=(x.flags&128)!==0;if(x.flags&=-129,m===null){if(Fr){if(k.mode==="hidden")return m=Np(x,k),x.lanes=536870912,uu(null,m);if(yt(x),(m=cs)?(m=db(m,Ro),m!==null&&(x.memoizedState={dehydrated:m,treeContext:cc!==null?{id:Ka,overflow:zc}:null,retryLane:536870912,hydrationErrors:null},C=By(m),C.return=x,x.child=C,_a=x,cs=null)):m=null,m===null)throw fe(x);return x.lanes=536870912,null}return Np(x,k)}var ee=m.memoizedState;if(ee!==null){var Ce=ee.dehydrated;if(yt(x),$)if(x.flags&256)x.flags&=-257,x=Rp(m,x,C);else if(x.memoizedState!==null)x.child=m.child,x.flags|=128,x=null;else throw Error(i(558));else if(es||Ee(m,x,C,!1),$=(C&m.childLanes)!==0,es||$){if(k=Mr,k!==null&&(Ce=W(k,C),Ce!==0&&Ce!==ee.retryLane))throw ee.retryLane=Ce,Ot(m,Ce),Ss(k,m,Ce),Po;zp(),x=Rp(m,x,C)}else m=ee.treeContext,ls&&(cs=r3(Ce),_a=x,Fr=!0,Tu=null,Ro=!1,m!==null&&ie(x,m)),x=Np(x,k),x.flags|=4096;return x}return m=Ml(m.child,{mode:k.mode,children:k.children}),m.ref=x.ref,x.child=m,m.return=x,m}function Jl(m,x){var C=x.ref;if(C===null)m!==null&&m.ref!==null&&(x.flags|=4194816);else{if(typeof C!="function"&&typeof C!="object")throw Error(i(284));(m===null||m.ref!==C)&&(x.flags|=4194816)}}function ld(m,x,C,k,$){return Ze(x),C=Un(m,x,C,k,void 0,$),k=Xr(),m!==null&&!es?(Jr(m,x,$),Ke(m,x,$)):(Fr&&k&&X(x),x.flags|=1,Vs(m,x,C,$),x.child)}function Is(m,x,C,k,$,ee){return Ze(x),x.updateQueue=null,C=on(x,k,C,$),$n(m),k=Xr(),m!==null&&!es?(Jr(m,x,ee),Ke(m,x,ee)):(Fr&&k&&X(x),x.flags|=1,Vs(m,x,C,ee),x.child)}function du(m,x,C,k,$){if(Ze(x),x.stateNode===null){var ee=Su,Ce=C.contextType;typeof Ce=="object"&&Ce!==null&&(ee=ae(Ce)),ee=new C(k,ee),x.memoizedState=ee.state!==null&&ee.state!==void 0?ee.state:null,ee.updater=Km,x.stateNode=ee,ee._reactInternals=x,ee=x.stateNode,ee.props=k,ee.state=x.memoizedState,ee.refs={},On(x),Ce=C.contextType,ee.context=typeof Ce=="object"&&Ce!==null?ae(Ce):Su,ee.state=x.memoizedState,Ce=C.getDerivedStateFromProps,typeof Ce=="function"&&(id(x,C,Ce,k),ee.state=x.memoizedState),typeof C.getDerivedStateFromProps=="function"||typeof ee.getSnapshotBeforeUpdate=="function"||typeof ee.UNSAFE_componentWillMount!="function"&&typeof ee.componentWillMount!="function"||(Ce=ee.state,typeof ee.componentWillMount=="function"&&ee.componentWillMount(),typeof ee.UNSAFE_componentWillMount=="function"&&ee.UNSAFE_componentWillMount(),Ce!==ee.state&&Km.enqueueReplaceState(ee,ee.state,null),Ln(x,k,ee,$),bn(),ee.state=x.memoizedState),typeof ee.componentDidMount=="function"&&(x.flags|=4194308),k=!0}else if(m===null){ee=x.stateNode;var at=x.memoizedProps,It=sd(C,at);ee.props=It;var Wt=ee.context,ln=C.contextType;Ce=Su,typeof ln=="object"&&ln!==null&&(Ce=ae(ln));var qt=C.getDerivedStateFromProps;ln=typeof qt=="function"||typeof ee.getSnapshotBeforeUpdate=="function",at=x.pendingProps!==at,ln||typeof ee.UNSAFE_componentWillReceiveProps!="function"&&typeof ee.componentWillReceiveProps!="function"||(at||Wt!==Ce)&&Cp(x,ee,k,Ce),Cl=!1;var yn=x.memoizedState;ee.state=yn,Ln(x,k,ee,$),bn(),Wt=x.memoizedState,at||yn!==Wt||Cl?(typeof qt=="function"&&(id(x,C,qt,k),Wt=x.memoizedState),(It=Cl||Ep(x,C,It,k,yn,Wt,Ce))?(ln||typeof ee.UNSAFE_componentWillMount!="function"&&typeof ee.componentWillMount!="function"||(typeof ee.componentWillMount=="function"&&ee.componentWillMount(),typeof ee.UNSAFE_componentWillMount=="function"&&ee.UNSAFE_componentWillMount()),typeof ee.componentDidMount=="function"&&(x.flags|=4194308)):(typeof ee.componentDidMount=="function"&&(x.flags|=4194308),x.memoizedProps=k,x.memoizedState=Wt),ee.props=k,ee.state=Wt,ee.context=Ce,k=It):(typeof ee.componentDidMount=="function"&&(x.flags|=4194308),k=!1)}else{ee=x.stateNode,Bt(m,x),Ce=x.memoizedProps,ln=sd(C,Ce),ee.props=ln,qt=x.pendingProps,yn=ee.context,Wt=C.contextType,It=Su,typeof Wt=="object"&&Wt!==null&&(It=ae(Wt)),at=C.getDerivedStateFromProps,(Wt=typeof at=="function"||typeof ee.getSnapshotBeforeUpdate=="function")||typeof ee.UNSAFE_componentWillReceiveProps!="function"&&typeof ee.componentWillReceiveProps!="function"||(Ce!==qt||yn!==It)&&Cp(x,ee,k,It),Cl=!1,yn=x.memoizedState,ee.state=yn,Ln(x,k,ee,$),bn();var dr=x.memoizedState;Ce!==qt||yn!==dr||Cl||m!==null&&m.dependencies!==null&&Pe(m.dependencies)?(typeof at=="function"&&(id(x,C,at,k),dr=x.memoizedState),(ln=Cl||Ep(x,C,ln,k,yn,dr,It)||m!==null&&m.dependencies!==null&&Pe(m.dependencies))?(Wt||typeof ee.UNSAFE_componentWillUpdate!="function"&&typeof ee.componentWillUpdate!="function"||(typeof ee.componentWillUpdate=="function"&&ee.componentWillUpdate(k,dr,It),typeof ee.UNSAFE_componentWillUpdate=="function"&&ee.UNSAFE_componentWillUpdate(k,dr,It)),typeof ee.componentDidUpdate=="function"&&(x.flags|=4),typeof ee.getSnapshotBeforeUpdate=="function"&&(x.flags|=1024)):(typeof ee.componentDidUpdate!="function"||Ce===m.memoizedProps&&yn===m.memoizedState||(x.flags|=4),typeof ee.getSnapshotBeforeUpdate!="function"||Ce===m.memoizedProps&&yn===m.memoizedState||(x.flags|=1024),x.memoizedProps=k,x.memoizedState=dr),ee.props=k,ee.state=dr,ee.context=It,k=ln):(typeof ee.componentDidUpdate!="function"||Ce===m.memoizedProps&&yn===m.memoizedState||(x.flags|=4),typeof ee.getSnapshotBeforeUpdate!="function"||Ce===m.memoizedProps&&yn===m.memoizedState||(x.flags|=1024),k=!1)}return ee=k,Jl(m,x),k=(x.flags&128)!==0,ee||k?(ee=x.stateNode,C=k&&typeof C.getDerivedStateFromError!="function"?null:ee.render(),x.flags|=1,m!==null&&k?(x.child=Qa(x,m.child,null,$),x.child=Qa(x,null,C,$)):Vs(m,x,C,$),x.memoizedState=ee.state,m=x.child):m=Ke(m,x,$),m}function bs(m,x,C,k){return Ve(),x.flags|=256,Vs(m,x,C,k),x.child}function kp(m){return{baseLanes:m,cachePool:tt()}}function yh(m,x,C){return m=m!==null?m.childLanes&~C:0,x&&(m|=Io),m}function cd(m,x,C){var k=x.pendingProps,$=!1,ee=(x.flags&128)!==0,Ce;if((Ce=ee)||(Ce=m!==null&&m.memoizedState===null?!1:(zs.current&2)!==0),Ce&&($=!0,x.flags&=-129),Ce=(x.flags&32)!==0,x.flags&=-33,m===null){if(Fr){if($?_t(x):Yt(),(m=cs)?(m=o3(m,Ro),m!==null&&(x.memoizedState={dehydrated:m,treeContext:cc!==null?{id:Ka,overflow:zc}:null,retryLane:536870912,hydrationErrors:null},C=By(m),C.return=x,x.child=C,_a=x,cs=null)):m=null,m===null)throw fe(x);return Zv(m)?x.lanes=32:x.lanes=536870912,null}var at=k.children;return k=k.fallback,$?(Yt(),$=x.mode,at=fu({mode:"hidden",children:at},$),k=ic(k,$,C,null),at.return=x,k.return=x,at.sibling=k,x.child=at,k=x.child,k.memoizedState=kp(C),k.childLanes=yh(m,Ce,C),x.memoizedState=zh,uu(null,k)):(_t(x),Pp(x,at))}var It=m.memoizedState;if(It!==null&&(at=It.dehydrated,at!==null)){if(ee)x.flags&256?(_t(x),x.flags&=-257,x=Dc(m,x,C)):x.memoizedState!==null?(Yt(),x.child=m.child,x.flags|=128,x=null):(Yt(),at=k.fallback,$=x.mode,k=fu({mode:"visible",children:k.children},$),at=ic(at,$,C,null),at.flags|=2,k.return=x,at.return=x,k.sibling=at,x.child=k,Qa(x,m.child,null,C),k=x.child,k.memoizedState=kp(C),k.childLanes=yh(m,Ce,C),x.memoizedState=zh,x=uu(null,k));else if(_t(x),Zv(at))Ce=Qv(at).digest,k=Error(i(419)),k.stack="",k.digest=Ce,Oe({value:k,source:null,stack:null}),x=Dc(m,x,C);else if(es||Ee(m,x,C,!1),Ce=(C&m.childLanes)!==0,es||Ce){if(Ce=Mr,Ce!==null&&(k=W(Ce,C),k!==0&&k!==It.retryLane))throw It.retryLane=k,Ot(m,k),Ss(Ce,m,k),Po;hf(at)||zp(),x=Dc(m,x,C)}else hf(at)?(x.flags|=192,x.child=m.child,x=null):(m=It.treeContext,ls&&(cs=i3(at),_a=x,Fr=!0,Tu=null,Ro=!1,m!==null&&ie(x,m)),x=Pp(x,k.children),x.flags|=4096);return x}return $?(Yt(),at=k.fallback,$=x.mode,It=m.child,ee=It.sibling,k=Ml(It,{mode:"hidden",children:k.children}),k.subtreeFlags=It.subtreeFlags&65011712,ee!==null?at=Ml(ee,at):(at=ic(at,$,C,null),at.flags|=2),at.return=x,k.return=x,k.sibling=at,x.child=k,uu(null,k),k=x.child,at=m.child.memoizedState,at===null?at=kp(C):($=at.cachePool,$!==null?(It=Ws?us._currentValue:us._currentValue2,$=$.parent!==It?{parent:It,pool:It}:$):$=tt(),at={baseLanes:at.baseLanes|C,cachePool:$}),k.memoizedState=at,k.childLanes=yh(m,Ce,C),x.memoizedState=zh,uu(m.child,k)):(_t(x),C=m.child,m=C.sibling,C=Ml(C,{mode:"visible",children:k.children}),C.return=x,C.sibling=null,m!==null&&(Ce=x.deletions,Ce===null?(x.deletions=[m],x.flags|=16):Ce.push(m)),x.child=C,x.memoizedState=null,C)}function Pp(m,x){return x=fu({mode:"visible",children:x},m.mode),x.return=m,m.child=x}function fu(m,x){return m=n(22,m,null,x),m.lanes=0,m}function Dc(m,x,C){return Qa(x,m.child,null,C),m=Pp(x,x.pendingProps.children),m.flags|=2,x.memoizedState=null,m}function de(m,x,C){m.lanes|=x;var k=m.alternate;k!==null&&(k.lanes|=x),oe(m.return,x,C)}function Me(m,x,C,k,$,ee){var Ce=m.memoizedState;Ce===null?m.memoizedState={isBackwards:x,rendering:null,renderingStartTime:0,last:k,tail:C,tailMode:$,treeForkCount:ee}:(Ce.isBackwards=x,Ce.rendering=null,Ce.renderingStartTime=0,Ce.last=k,Ce.tail=C,Ce.tailMode=$,Ce.treeForkCount=ee)}function Ge(m,x,C){var k=x.pendingProps,$=k.revealOrder,ee=k.tail;k=k.children;var Ce=zs.current,at=(Ce&2)!==0;if(at?(Ce=Ce&1|2,x.flags|=128):Ce&=1,b(zs,Ce),Vs(m,x,k,C),k=Fr?qm:0,!at&&m!==null&&(m.flags&128)!==0)e:for(m=x.child;m!==null;){if(m.tag===13)m.memoizedState!==null&&de(m,C,x);else if(m.tag===19)de(m,C,x);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===x)break e;for(;m.sibling===null;){if(m.return===null||m.return===x)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}switch($){case"forwards":for(C=x.child,$=null;C!==null;)m=C.alternate,m!==null&&sn(m)===null&&($=C),C=C.sibling;C=$,C===null?($=x.child,x.child=null):($=C.sibling,C.sibling=null),Me(x,!1,$,C,ee,k);break;case"backwards":case"unstable_legacy-backwards":for(C=null,$=x.child,x.child=null;$!==null;){if(m=$.alternate,m!==null&&sn(m)===null){x.child=$;break}m=$.sibling,$.sibling=C,C=$,$=m}Me(x,!0,C,null,ee,k);break;case"together":Me(x,!1,null,null,void 0,k);break;default:x.memoizedState=null}return x.child}function Ke(m,x,C){if(m!==null&&(x.dependencies=m.dependencies),wd|=x.lanes,(C&x.childLanes)===0)if(m!==null){if(Ee(m,x,C,!1),(C&x.childLanes)===0)return null}else return null;if(m!==null&&x.child!==m.child)throw Error(i(153));if(x.child!==null){for(m=x.child,C=Ml(m,m.pendingProps),x.child=C,C.return=x;m.sibling!==null;)m=m.sibling,C=C.sibling=Ml(m,m.pendingProps),C.return=x;C.sibling=null}return x.child}function lt(m,x){return(m.lanes&x)!==0?!0:(m=m.dependencies,!!(m!==null&&Pe(m)))}function St(m,x,C){switch(x.tag){case 3:ne(x,x.stateNode.containerInfo),he(x,us,m.memoizedState.cache),Ve();break;case 27:case 5:ue(x);break;case 4:ne(x,x.stateNode.containerInfo);break;case 10:he(x,x.type,x.memoizedProps.value);break;case 31:if(x.memoizedState!==null)return x.flags|=128,yt(x),null;break;case 13:var k=x.memoizedState;if(k!==null)return k.dehydrated!==null?(_t(x),x.flags|=128,null):(C&x.child.childLanes)!==0?cd(m,x,C):(_t(x),m=Ke(m,x,C),m!==null?m.sibling:null);_t(x);break;case 19:var $=(m.flags&128)!==0;if(k=(C&x.childLanes)!==0,k||(Ee(m,x,C,!1),k=(C&x.childLanes)!==0),$){if(k)return Ge(m,x,C);x.flags|=128}if($=x.memoizedState,$!==null&&($.rendering=null,$.tail=null,$.lastEffect=null),b(zs,zs.current),k)break;return null;case 22:return x.lanes=0,Cm(m,x,C,x.pendingProps);case 24:he(x,us,m.memoizedState.cache)}return Ke(m,x,C)}function jt(m,x,C){if(m!==null)if(m.memoizedProps!==x.pendingProps)es=!0;else{if(!lt(m,C)&&(x.flags&128)===0)return es=!1,St(m,x,C);es=(m.flags&131072)!==0}else es=!1,Fr&&(x.flags&1048576)!==0&&j(x,qm,x.index);switch(x.lanes=0,x.tag){case 16:e:{var k=x.pendingProps;if(m=He(x.elementType),x.type=m,typeof m=="function")bh(m)?(k=sd(m,k),x.tag=1,x=du(null,x,m,k,C)):(x.tag=0,x=ld(null,x,m,k,C));else{if(m!=null){var $=m.$$typeof;if($===Bp){x.tag=11,x=Mm(null,x,m,k,C);break e}else if($===Wv){x.tag=14,x=Tm(null,x,m,k,C);break e}}throw x=h(m)||m,Error(i(306,x,""))}}return x;case 0:return ld(m,x,x.type,x.pendingProps,C);case 1:return k=x.type,$=sd(k,x.pendingProps),du(m,x,k,$,C);case 3:e:{if(ne(x,x.stateNode.containerInfo),m===null)throw Error(i(387));var ee=x.pendingProps;$=x.memoizedState,k=$.element,Bt(m,x),Ln(x,ee,null,C);var Ce=x.memoizedState;if(ee=Ce.cache,he(x,us,ee),ee!==$.cache&&Ue(x,[us],C,!0),bn(),ee=Ce.element,ls&&$.isDehydrated)if($={element:ee,isDehydrated:!1,cache:Ce.cache},x.updateQueue.baseState=$,x.memoizedState=$,x.flags&256){x=bs(m,x,ee,C);break e}else if(ee!==k){k=Q(Error(i(424)),x),Oe(k),x=bs(m,x,ee,C);break e}else for(ls&&(cs=n3(x.stateNode.containerInfo),_a=x,Fr=!0,Tu=null,Ro=!0),C=Cb(x,null,ee,C),x.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(Ve(),ee===k){x=Ke(m,x,C);break e}Vs(m,x,ee,C)}x=x.child}return x;case 26:if(oc)return Jl(m,x),m===null?(C=gb(x.type,null,x.pendingProps,null))?x.memoizedState=C:Fr||(x.stateNode=nx(x.type,x.pendingProps,Za.current,x)):x.memoizedState=gb(x.type,m.memoizedProps,x.pendingProps,m.memoizedState),null;case 27:if(ba)return ue(x),m===null&&ba&&Fr&&(k=x.stateNode=rx(x.type,x.pendingProps,Za.current,Oa.current,!1),_a=x,Ro=!0,cs=ub(x.type,k,cs)),Vs(m,x,x.pendingProps.children,C),Jl(m,x),m===null&&(x.flags|=4194304),x.child;case 5:return m===null&&Fr&&(g3(x.type,x.pendingProps,Oa.current),($=k=cs)&&(k=s3(k,x.type,x.pendingProps,Ro),k!==null?(x.stateNode=k,_a=x,cs=t3(k),Ro=!1,$=!0):$=!1),$||fe(x)),ue(x),$=x.type,ee=x.pendingProps,Ce=m!==null?m.memoizedProps:null,k=ee.children,No($,ee)?k=null:Ce!==null&&No($,Ce)&&(x.flags|=32),x.memoizedState!==null&&($=Un(m,x,ir,null,null,C),Ws?Nh._currentValue=$:Nh._currentValue2=$),Jl(m,x),Vs(m,x,k,C),x.child;case 6:return m===null&&Fr&&(mb(x.pendingProps,Oa.current),(m=C=cs)&&(C=a3(C,x.pendingProps,Ro),C!==null?(x.stateNode=C,_a=x,cs=null,m=!0):m=!1),m||fe(x)),null;case 13:return cd(m,x,C);case 4:return ne(x,x.stateNode.containerInfo),k=x.pendingProps,m===null?x.child=Qa(x,null,k,C):Vs(m,x,k,C),x.child;case 11:return Mm(m,x,x.type,x.pendingProps,C);case 7:return Vs(m,x,x.pendingProps,C),x.child;case 8:return Vs(m,x,x.pendingProps.children,C),x.child;case 12:return Vs(m,x,x.pendingProps.children,C),x.child;case 10:return k=x.pendingProps,he(x,x.type,k.value),Vs(m,x,k.children,C),x.child;case 9:return $=x.type._context,k=x.pendingProps.children,Ze(x),$=ae($),k=k($),x.flags|=1,Vs(m,x,k,C),x.child;case 14:return Tm(m,x,x.type,x.pendingProps,C);case 15:return Em(m,x,x.type,x.pendingProps,C);case 19:return Ge(m,x,C);case 31:return Am(m,x,C);case 22:return Cm(m,x,C,x.pendingProps);case 24:return Ze(x),k=ae(us),m===null?($=ft(),$===null&&($=Mr,ee=me(),$.pooledCache=ee,ee.refCount++,ee!==null&&($.pooledCacheLanes|=C),$=ee),x.memoizedState={parent:k,cache:$},On(x),he(x,us,$)):((m.lanes&C)!==0&&(Bt(m,x),Ln(x,null,null,C),bn()),$=m.memoizedState,ee=x.memoizedState,$.parent!==k?($={parent:k,cache:k},x.memoizedState=$,x.lanes===0&&(x.memoizedState=x.updateQueue.baseState=$),he(x,us,k)):(k=ee.cache,he(x,us,k),k!==$.cache&&Ue(x,[us],C,!0))),Vs(m,x,x.pendingProps.children,C),x.child;case 29:throw x.pendingProps}throw Error(i(156,x.tag))}function Vt(m){m.flags|=4}function Kt(m){Tl&&(m.flags|=8)}function mn(m,x){if(m!==null&&m.child===x.child)return!1;if((x.flags&16)!==0)return!0;for(m=x.child;m!==null;){if((m.flags&8218)!==0||(m.subtreeFlags&8218)!==0)return!0;m=m.sibling}return!1}function vn(m,x,C,k){if(qr)for(C=x.child;C!==null;){if(C.tag===5||C.tag===6)Fm(m,C.stateNode);else if(!(C.tag===4||ba&&C.tag===27)&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===x)break;for(;C.sibling===null;){if(C.return===null||C.return===x)return;C=C.return}C.sibling.return=C.return,C=C.sibling}else if(Tl)for(var $=x.child;$!==null;){if($.tag===5){var ee=$.stateNode;C&&k&&(ee=Zw(ee,$.type,$.memoizedProps)),Fm(m,ee)}else if($.tag===6)ee=$.stateNode,C&&k&&(ee=lb(ee,$.memoizedProps)),Fm(m,ee);else if($.tag!==4){if($.tag===22&&$.memoizedState!==null)ee=$.child,ee!==null&&(ee.return=$),vn(m,$,!0,!0);else if($.child!==null){$.child.return=$,$=$.child;continue}}if($===x)break;for(;$.sibling===null;){if($.return===null||$.return===x)return;$=$.return}$.sibling.return=$.return,$=$.sibling}}function Sn(m,x,C,k){var $=!1;if(Tl)for(var ee=x.child;ee!==null;){if(ee.tag===5){var Ce=ee.stateNode;C&&k&&(Ce=Zw(Ce,ee.type,ee.memoizedProps)),ab(m,Ce)}else if(ee.tag===6)Ce=ee.stateNode,C&&k&&(Ce=lb(Ce,ee.memoizedProps)),ab(m,Ce);else if(ee.tag!==4){if(ee.tag===22&&ee.memoizedState!==null)$=ee.child,$!==null&&($.return=ee),Sn(m,ee,!0,!0),$=!0;else if(ee.child!==null){ee.child.return=ee,ee=ee.child;continue}}if(ee===x)break;for(;ee.sibling===null;){if(ee.return===null||ee.return===x)return $;ee=ee.return}ee.sibling.return=ee.return,ee=ee.sibling}return $}function er(m,x){if(Tl&&mn(m,x)){m=x.stateNode;var C=m.containerInfo,k=sb();Sn(k,x,!1,!1),m.pendingChildren=k,Vt(x),Kw(C,k)}}function Yr(m,x,C,k){if(qr)m.memoizedProps!==k&&Vt(x);else if(Tl){var $=m.stateNode,ee=m.memoizedProps;if((m=mn(m,x))||ee!==k){var Ce=Oa.current;ee=Yw($,C,ee,k,!m,null),ee===$?x.stateNode=$:(Kt(x),Ko(ee,C,k,Ce)&&Vt(x),x.stateNode=ee,m&&vn(ee,x,!1,!1))}else x.stateNode=$}}function tr(m,x,C,k,$){if((m.mode&32)!==0&&(C===null?Um(x,k):$p(x,C,k))){if(m.flags|=16777216,($&335544128)===$||Xy(x,k))if(ws(m.stateNode,x,k))m.flags|=8192;else if($r())m.flags|=8192;else throw ko=Eu,px}else m.flags&=-16777217}function ur(m,x){if(bb(x)){if(m.flags|=16777216,!_b(x))if($r())m.flags|=8192;else throw ko=Eu,px}else m.flags&=-16777217}function Vn(m,x){x!==null&&(m.flags|=4),m.flags&16384&&(x=m.tag!==22?N():536870912,m.lanes|=x,t0|=x)}function An(m,x){if(!Fr)switch(m.tailMode){case"hidden":x=m.tail;for(var C=null;x!==null;)x.alternate!==null&&(C=x),x=x.sibling;C===null?m.tail=null:C.sibling=null;break;case"collapsed":C=m.tail;for(var k=null;C!==null;)C.alternate!==null&&(k=C),C=C.sibling;k===null?x||m.tail===null?m.tail=null:m.tail.sibling=null:k.sibling=null}}function qn(m){var x=m.alternate!==null&&m.alternate.child===m.child,C=0,k=0;if(x)for(var $=m.child;$!==null;)C|=$.lanes|$.childLanes,k|=$.subtreeFlags&65011712,k|=$.flags&65011712,$.return=m,$=$.sibling;else for($=m.child;$!==null;)C|=$.lanes|$.childLanes,k|=$.subtreeFlags,k|=$.flags,$.return=m,$=$.sibling;return m.subtreeFlags|=k,m.childLanes=C,x}function Ji(m,x,C){var k=x.pendingProps;switch(H(x),x.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qn(x),null;case 1:return qn(x),null;case 3:return C=x.stateNode,k=null,m!==null&&(k=m.memoizedState.cache),x.memoizedState.cache!==k&&(x.flags|=2048),Re(us),re(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(m===null||m.child===null)&&(xe(x)?Vt(x):m===null||m.memoizedState.isDehydrated&&(x.flags&256)===0||(x.flags|=1024,ye())),er(m,x),qn(x),null;case 26:if(oc){var $=x.type,ee=x.memoizedState;return m===null?(Vt(x),ee!==null?(qn(x),ur(x,ee)):(qn(x),tr(x,$,null,k,C))):ee?ee!==m.memoizedState?(Vt(x),qn(x),ur(x,ee)):(qn(x),x.flags&=-16777217):(ee=m.memoizedProps,qr?ee!==k&&Vt(x):Yr(m,x,$,k),qn(x),tr(x,$,ee,k,C)),null}case 27:if(ba){if(le(x),C=Za.current,$=x.type,m!==null&&x.stateNode!=null)qr?m.memoizedProps!==k&&Vt(x):Yr(m,x,$,k);else{if(!k){if(x.stateNode===null)throw Error(i(166));return qn(x),null}m=Oa.current,xe(x)?we(x,m):(m=rx($,k,C,m,!0),x.stateNode=m,Vt(x))}return qn(x),null}case 5:if(le(x),$=x.type,m!==null&&x.stateNode!=null)Yr(m,x,$,k);else{if(!k){if(x.stateNode===null)throw Error(i(166));return qn(x),null}if(ee=Oa.current,xe(x))we(x,ee),h3(x.stateNode,$,k,ee)&&(x.flags|=64);else{var Ce=$y($,k,Za.current,ee,x);Kt(x),vn(Ce,x,!1,!1),x.stateNode=Ce,Ko(Ce,$,k,ee)&&Vt(x)}}return qn(x),tr(x,x.type,m===null?null:m.memoizedProps,x.pendingProps,C),null;case 6:if(m&&x.stateNode!=null)C=m.memoizedProps,qr?C!==k&&Vt(x):Tl&&(C!==k?(m=Za.current,C=Oa.current,Kt(x),x.stateNode=vd(k,m,C,x)):x.stateNode=m.stateNode);else{if(typeof k!="string"&&x.stateNode===null)throw Error(i(166));if(m=Za.current,C=Oa.current,xe(x)){if(!ls)throw Error(i(176));if(m=x.stateNode,C=x.memoizedProps,k=null,$=_a,$!==null)switch($.tag){case 27:case 5:k=$.memoizedProps}jE(m,C,x,k)||fe(x,!0)}else Kt(x),x.stateNode=vd(k,m,C,x)}return qn(x),null;case 31:if(C=x.memoizedState,m===null||m.memoizedState!==null){if(k=xe(x),C!==null){if(m===null){if(!k)throw Error(i(318));if(!ls)throw Error(i(556));if(m=x.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(557));fb(m,x)}else Ve(),(x.flags&128)===0&&(x.memoizedState=null),x.flags|=4;qn(x),m=!1}else C=ye(),m!==null&&m.memoizedState!==null&&(m.memoizedState.hydrationErrors=C),m=!0;if(!m)return x.flags&256?(rn(x),x):(rn(x),null);if((x.flags&128)!==0)throw Error(i(558))}return qn(x),null;case 13:if(k=x.memoizedState,m===null||m.memoizedState!==null&&m.memoizedState.dehydrated!==null){if($=xe(x),k!==null&&k.dehydrated!==null){if(m===null){if(!$)throw Error(i(318));if(!ls)throw Error(i(344));if($=x.memoizedState,$=$!==null?$.dehydrated:null,!$)throw Error(i(317));c3($,x)}else Ve(),(x.flags&128)===0&&(x.memoizedState=null),x.flags|=4;qn(x),$=!1}else $=ye(),m!==null&&m.memoizedState!==null&&(m.memoizedState.hydrationErrors=$),$=!0;if(!$)return x.flags&256?(rn(x),x):(rn(x),null)}return rn(x),(x.flags&128)!==0?(x.lanes=C,x):(C=k!==null,m=m!==null&&m.memoizedState!==null,C&&(k=x.child,$=null,k.alternate!==null&&k.alternate.memoizedState!==null&&k.alternate.memoizedState.cachePool!==null&&($=k.alternate.memoizedState.cachePool.pool),ee=null,k.memoizedState!==null&&k.memoizedState.cachePool!==null&&(ee=k.memoizedState.cachePool.pool),ee!==$&&(k.flags|=2048)),C!==m&&C&&(x.child.flags|=8192),Vn(x,x.updateQueue),qn(x),null);case 4:return re(),er(m,x),m===null&&Oi(x.stateNode.containerInfo),qn(x),null;case 10:return Re(x.type),qn(x),null;case 19:if(v(zs),k=x.memoizedState,k===null)return qn(x),null;if($=(x.flags&128)!==0,ee=k.rendering,ee===null)if($)An(k,!1);else{if(Es!==0||m!==null&&(m.flags&128)!==0)for(m=x.child;m!==null;){if(ee=sn(m),ee!==null){for(x.flags|=128,An(k,!1),m=ee.updateQueue,x.updateQueue=m,Vn(x,m),x.subtreeFlags=0,m=C,C=x.child;C!==null;)Uv(C,m),C=C.sibling;return b(zs,zs.current&1|2),Fr&&U(x,k.treeForkCount),x.child}m=m.sibling}k.tail!==null&&ho()>Mf&&(x.flags|=128,$=!0,An(k,!1),x.lanes=4194304)}else{if(!$)if(m=sn(ee),m!==null){if(x.flags|=128,$=!0,m=m.updateQueue,x.updateQueue=m,Vn(x,m),An(k,!0),k.tail===null&&k.tailMode==="hidden"&&!ee.alternate&&!Fr)return qn(x),null}else 2*ho()-k.renderingStartTime>Mf&&C!==536870912&&(x.flags|=128,$=!0,An(k,!1),x.lanes=4194304);k.isBackwards?(ee.sibling=x.child,x.child=ee):(m=k.last,m!==null?m.sibling=ee:x.child=ee,k.last=ee)}return k.tail!==null?(m=k.tail,k.rendering=m,k.tail=m.sibling,k.renderingStartTime=ho(),m.sibling=null,C=zs.current,b(zs,$?C&1|2:C&1),Fr&&U(x,k.treeForkCount),m):(qn(x),null);case 22:case 23:return rn(x),ot(),k=x.memoizedState!==null,m!==null?m.memoizedState!==null!==k&&(x.flags|=8192):k&&(x.flags|=8192),k?(C&536870912)!==0&&(x.flags&128)===0&&(qn(x),x.subtreeFlags&6&&(x.flags|=8192)):qn(x),C=x.updateQueue,C!==null&&Vn(x,C.retryQueue),C=null,m!==null&&m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(C=m.memoizedState.cachePool.pool),k=null,x.memoizedState!==null&&x.memoizedState.cachePool!==null&&(k=x.memoizedState.cachePool.pool),k!==C&&(x.flags|=2048),m!==null&&v(gf),null;case 24:return C=null,m!==null&&(C=m.memoizedState.cache),x.memoizedState.cache!==C&&(x.flags|=2048),Re(us),qn(x),null;case 25:return null;case 30:return null}throw Error(i(156,x.tag))}function Ds(m,x){switch(H(x),x.tag){case 1:return m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 3:return Re(us),re(),m=x.flags,(m&65536)!==0&&(m&128)===0?(x.flags=m&-65537|128,x):null;case 26:case 27:case 5:return le(x),null;case 31:if(x.memoizedState!==null){if(rn(x),x.alternate===null)throw Error(i(340));Ve()}return m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 13:if(rn(x),m=x.memoizedState,m!==null&&m.dehydrated!==null){if(x.alternate===null)throw Error(i(340));Ve()}return m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 19:return v(zs),null;case 4:return re(),null;case 10:return Re(x.type),null;case 22:case 23:return rn(x),ot(),m!==null&&v(gf),m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 24:return Re(us),null;case 25:return null;default:return null}}function pi(m,x){switch(H(x),x.tag){case 3:Re(us),re();break;case 26:case 27:case 5:le(x);break;case 4:re();break;case 31:x.memoizedState!==null&&rn(x);break;case 13:rn(x);break;case 19:v(zs);break;case 10:Re(x.type);break;case 22:case 23:rn(x),ot(),m!==null&&v(gf);break;case 24:Re(us)}}function si(m,x){try{var C=x.updateQueue,k=C!==null?C.lastEffect:null;if(k!==null){var $=k.next;C=$;do{if((C.tag&m)===m){k=void 0;var ee=C.create,Ce=C.inst;k=ee(),Ce.destroy=k}C=C.next}while(C!==$)}}catch(at){nr(x,x.return,at)}}function as(m,x,C){try{var k=x.updateQueue,$=k!==null?k.lastEffect:null;if($!==null){var ee=$.next;k=ee;do{if((k.tag&m)===m){var Ce=k.inst,at=Ce.destroy;if(at!==void 0){Ce.destroy=void 0,$=x;var It=C,Wt=at;try{Wt()}catch(ln){nr($,It,ln)}}}k=k.next}while(k!==ee)}}catch(ln){nr(x,x.return,ln)}}function Os(m){var x=m.updateQueue;if(x!==null){var C=m.stateNode;try{Bi(x,C)}catch(k){nr(m,m.return,k)}}}function Ya(m,x,C){C.props=sd(m.type,m.memoizedProps),C.state=m.memoizedState;try{C.componentWillUnmount()}catch(k){nr(m,x,k)}}function Na(m,x){try{var C=m.ref;if(C!==null){switch(m.tag){case 26:case 27:case 5:var k=Vp(m.stateNode);break;case 30:k=m.stateNode;break;default:k=m.stateNode}typeof C=="function"?m.refCleanup=C(k):C.current=k}}catch($){nr(m,x,$)}}function Hi(m,x){var C=m.ref,k=m.refCleanup;if(C!==null)if(typeof k=="function")try{k()}catch($){nr(m,x,$)}finally{m.refCleanup=null,m=m.alternate,m!=null&&(m.refCleanup=null)}else if(typeof C=="function")try{C(null)}catch($){nr(m,x,$)}else C.current=null}function Gs(m){var x=m.type,C=m.memoizedProps,k=m.stateNode;try{Bw(k,x,C,m)}catch($){nr(m,m.return,$)}}function Ra(m,x,C){try{Hw(m.stateNode,m.type,C,x,m)}catch(k){nr(m,m.return,k)}}function Eo(m){return m.tag===5||m.tag===3||(oc?m.tag===26:!1)||(ba?m.tag===27&&Rh(m.type):!1)||m.tag===4}function sa(m){e:for(;;){for(;m.sibling===null;){if(m.return===null||Eo(m.return))return null;m=m.return}for(m.sibling.return=m.return,m=m.sibling;m.tag!==5&&m.tag!==6&&m.tag!==18;){if(ba&&m.tag===27&&Rh(m.type)||m.flags&2||m.child===null||m.tag===4)continue e;m.child.return=m,m=m.child}if(!(m.flags&2))return m.stateNode}}function aa(m,x,C){var k=m.tag;if(k===5||k===6)m=m.stateNode,x?Gw(C,m,x):tb(C,m);else if(k!==4&&(ba&&k===27&&Rh(m.type)&&(C=m.stateNode,x=null),m=m.child,m!==null))for(aa(m,x,C),m=m.sibling;m!==null;)aa(m,x,C),m=m.sibling}function xa(m,x,C){var k=m.tag;if(k===5||k===6)m=m.stateNode,x?Vw(C,m,x):eb(C,m);else if(k!==4&&(ba&&k===27&&Rh(m.type)&&(C=m.stateNode),m=m.child,m!==null))for(xa(m,x,C),m=m.sibling;m!==null;)xa(m,x,C),m=m.sibling}function Oc(m,x,C){m=m.containerInfo;try{ob(m,C)}catch(k){nr(x,x.return,k)}}function ka(m){var x=m.stateNode,C=m.memoizedProps;try{la(m.type,C,x,m)}catch(k){nr(m,m.return,k)}}function Rv(m,x){for($v(m.containerInfo),Xs=x;Xs!==null;)if(m=Xs,x=m.child,(m.subtreeFlags&1028)!==0&&x!==null)x.return=m,Xs=x;else for(;Xs!==null;){m=Xs;var C=m.alternate;switch(x=m.flags,m.tag){case 0:if((x&4)!==0&&(x=m.updateQueue,x=x!==null?x.events:null,x!==null))for(var k=0;k<x.length;k++){var $=x[k];$.ref.impl=$.nextImpl}break;case 11:case 15:break;case 1:if((x&1024)!==0&&C!==null){x=void 0,k=m,$=C.memoizedProps,C=C.memoizedState;var ee=k.stateNode;try{var Ce=sd(k.type,$);x=ee.getSnapshotBeforeUpdate(Ce,C),ee.__reactInternalSnapshotBeforeUpdate=x}catch(at){nr(k,k.return,at)}}break;case 3:(x&1024)!==0&&qr&&ib(m.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((x&1024)!==0)throw Error(i(163))}if(x=m.sibling,x!==null){x.return=m.return,Xs=x;break}Xs=m.return}}function Nw(m,x,C){var k=C.flags;switch(C.tag){case 0:case 11:case 15:Co(m,C),k&4&&si(5,C);break;case 1:if(Co(m,C),k&4)if(m=C.stateNode,x===null)try{m.componentDidMount()}catch(Ce){nr(C,C.return,Ce)}else{var $=sd(C.type,x.memoizedProps);x=x.memoizedState;try{m.componentDidUpdate($,x,m.__reactInternalSnapshotBeforeUpdate)}catch(Ce){nr(C,C.return,Ce)}}k&64&&Os(C),k&512&&Na(C,C.return);break;case 3:if(Co(m,C),k&64&&(k=C.updateQueue,k!==null)){if(m=null,C.child!==null)switch(C.child.tag){case 27:case 5:m=Vp(C.child.stateNode);break;case 1:m=C.child.stateNode}try{Bi(k,m)}catch(Ce){nr(C,C.return,Ce)}}break;case 27:ba&&x===null&&k&4&&ka(C);case 26:case 5:if(Co(m,C),x===null){if(k&4)Gs(C);else if(k&64){m=C.type,x=C.memoizedProps,$=C.stateNode;try{d3($,m,x,C)}catch(Ce){nr(C,C.return,Ce)}}}k&512&&Na(C,C.return);break;case 12:Co(m,C);break;case 31:Co(m,C),k&4&&tc(m,C);break;case 13:Co(m,C),k&4&&Rm(m,C),k&64&&(k=C.memoizedState,k!==null&&(k=k.dehydrated,k!==null&&(C=OE.bind(null,C),Jv(k,C))));break;case 22:if(k=C.memoizedState!==null||js,!k){x=x!==null&&x.memoizedState!==null||Fs,$=js;var ee=Fs;js=k,(Fs=x)&&!ee?rc(m,C,(C.subtreeFlags&8772)!==0):Co(m,C),js=$,Fs=ee}break;case 30:break;default:Co(m,C)}}function zy(m){var x=m.alternate;x!==null&&(m.alternate=null,zy(x)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(x=m.stateNode,x!==null&&qv(x)),m.stateNode=null,m.return=null,m.dependencies=null,m.memoizedProps=null,m.memoizedState=null,m.pendingProps=null,m.stateNode=null,m.updateQueue=null}function ec(m,x,C){for(C=C.child;C!==null;)Nm(m,x,C),C=C.sibling}function Nm(m,x,C){if(Jo&&typeof Jo.onCommitFiberUnmount=="function")try{Jo.onCommitFiberUnmount(Ih,C)}catch{}switch(C.tag){case 26:if(oc){Fs||Hi(C,x),ec(m,x,C),C.memoizedState?pf(C.memoizedState):C.stateNode&&yb(C.stateNode);break}case 27:if(ba){Fs||Hi(C,x);var k=Ts,$=Ys;Rh(C.type)&&(Ts=C.stateNode,Ys=!1),ec(m,x,C),Da(C.stateNode),Ts=k,Ys=$;break}case 5:Fs||Hi(C,x);case 6:if(qr){if(k=Ts,$=Ys,Ts=null,ec(m,x,C),Ts=k,Ys=$,Ts!==null)if(Ys)try{nb(Ts,C.stateNode)}catch(ee){nr(C,x,ee)}else try{Ww(Ts,C.stateNode)}catch(ee){nr(C,x,ee)}}else ec(m,x,C);break;case 18:qr&&Ts!==null&&(Ys?ex(Ts,C.stateNode):pb(Ts,C.stateNode));break;case 4:qr?(k=Ts,$=Ys,Ts=C.stateNode.containerInfo,Ys=!0,ec(m,x,C),Ts=k,Ys=$):(Tl&&Oc(C.stateNode,C,sb()),ec(m,x,C));break;case 0:case 11:case 14:case 15:as(2,C,x),Fs||as(4,C,x),ec(m,x,C);break;case 1:Fs||(Hi(C,x),k=C.stateNode,typeof k.componentWillUnmount=="function"&&Ya(C,x,k)),ec(m,x,C);break;case 21:ec(m,x,C);break;case 22:Fs=(k=Fs)||C.memoizedState!==null,ec(m,x,C),Fs=k;break;default:ec(m,x,C)}}function tc(m,x){if(ls&&x.memoizedState===null&&(m=x.alternate,m!==null&&(m=m.memoizedState,m!==null))){m=m.dehydrated;try{FE(m)}catch(C){nr(x,x.return,C)}}}function Rm(m,x){if(ls&&x.memoizedState===null&&(m=x.alternate,m!==null&&(m=m.memoizedState,m!==null&&(m=m.dehydrated,m!==null))))try{UE(m)}catch(C){nr(x,x.return,C)}}function nc(m){switch(m.tag){case 31:case 13:case 19:var x=m.stateNode;return x===null&&(x=m.stateNode=new Nb),x;case 22:return m=m.stateNode,x=m._retryCache,x===null&&(x=m._retryCache=new Nb),x;default:throw Error(i(435,m.tag))}}function ud(m,x){var C=nc(m);x.forEach(function(k){if(!C.has(k)){C.add(k);var $=LE.bind(null,m,k);k.then($,$)}})}function Pa(m,x){var C=x.deletions;if(C!==null)for(var k=0;k<C.length;k++){var $=C[k],ee=m,Ce=x;if(qr){var at=Ce;e:for(;at!==null;){switch(at.tag){case 27:if(ba){if(Rh(at.type)){Ts=at.stateNode,Ys=!1;break e}break}case 5:Ts=at.stateNode,Ys=!1;break e;case 3:case 4:Ts=at.stateNode.containerInfo,Ys=!0;break e}at=at.return}if(Ts===null)throw Error(i(160));Nm(ee,Ce,$),Ts=null,Ys=!1}else Nm(ee,Ce,$);ee=$.alternate,ee!==null&&(ee.return=null),$.return=null}if(x.subtreeFlags&13886)for(x=x.child;x!==null;)km(x,m),x=x.sibling}function km(m,x){var C=m.alternate,k=m.flags;switch(m.tag){case 0:case 11:case 14:case 15:Pa(x,m),Ia(m),k&4&&(as(3,m,m.return),si(3,m),as(5,m,m.return));break;case 1:Pa(x,m),Ia(m),k&512&&(Fs||C===null||Hi(C,C.return)),k&64&&js&&(m=m.updateQueue,m!==null&&(k=m.callbacks,k!==null&&(C=m.shared.hiddenCallbacks,m.shared.hiddenCallbacks=C===null?k:C.concat(k))));break;case 26:if(oc){var $=Ci;if(Pa(x,m),Ia(m),k&512&&(Fs||C===null||Hi(C,C.return)),k&4){k=C!==null?C.memoizedState:null;var ee=m.memoizedState;C===null?ee===null?m.stateNode===null?m.stateNode=v3($,m.type,m.memoizedProps,m):xb($,m.type,m.stateNode):m.stateNode=vb($,ee,m.memoizedProps):k!==ee?(k===null?C.stateNode!==null&&yb(C.stateNode):pf(k),ee===null?xb($,m.type,m.stateNode):vb($,ee,m.memoizedProps)):ee===null&&m.stateNode!==null&&Ra(m,m.memoizedProps,C.memoizedProps)}break}case 27:if(ba){Pa(x,m),Ia(m),k&512&&(Fs||C===null||Hi(C,C.return)),C!==null&&k&4&&Ra(m,m.memoizedProps,C.memoizedProps);break}case 5:if(Pa(x,m),Ia(m),k&512&&(Fs||C===null||Hi(C,C.return)),qr){if(m.flags&32){$=m.stateNode;try{rb($)}catch(qt){nr(m,m.return,qt)}}k&4&&m.stateNode!=null&&($=m.memoizedProps,Ra(m,$,C!==null?C.memoizedProps:$)),k&1024&&(Kp=!0)}else Tl&&m.alternate!==null&&(m.alternate.stateNode=m.stateNode);break;case 6:if(Pa(x,m),Ia(m),k&4&&qr){if(m.stateNode===null)throw Error(i(162));k=m.memoizedProps,C=C!==null?C.memoizedProps:k,$=m.stateNode;try{Uw($,C,k)}catch(qt){nr(m,m.return,qt)}}break;case 3:if(oc?(x3(),$=Ci,Ci=Vm(x.containerInfo),Pa(x,m),Ci=$):Pa(x,m),Ia(m),k&4){if(qr&&ls&&C!==null&&C.memoizedState.isDehydrated)try{f3(x.containerInfo)}catch(qt){nr(m,m.return,qt)}if(Tl){k=x.containerInfo,C=x.pendingChildren;try{ob(k,C)}catch(qt){nr(m,m.return,qt)}}}Kp&&(Kp=!1,kv(m));break;case 4:oc?(C=Ci,Ci=Vm(m.stateNode.containerInfo),Pa(x,m),Ia(m),Ci=C):(Pa(x,m),Ia(m)),k&4&&Tl&&Oc(m.stateNode,m,m.stateNode.pendingChildren);break;case 12:Pa(x,m),Ia(m);break;case 31:Pa(x,m),Ia(m),k&4&&(k=m.updateQueue,k!==null&&(m.updateQueue=null,ud(m,k)));break;case 13:Pa(x,m),Ia(m),m.child.flags&8192&&m.memoizedState!==null!=(C!==null&&C.memoizedState!==null)&&(Jm=ho()),k&4&&(k=m.updateQueue,k!==null&&(m.updateQueue=null,ud(m,k)));break;case 22:$=m.memoizedState!==null;var Ce=C!==null&&C.memoizedState!==null,at=js,It=Fs;if(js=at||$,Fs=It||Ce,Pa(x,m),Fs=It,js=at,Ia(m),k&8192&&(x=m.stateNode,x._visibility=$?x._visibility&-2:x._visibility|1,$&&(C===null||Ce||js||Fs||ef(m)),qr)){e:if(C=null,qr)for(x=m;;){if(x.tag===5||oc&&x.tag===26){if(C===null){Ce=C=x;try{ee=Ce.stateNode,$?zE(ee):qw(Ce.stateNode,Ce.memoizedProps)}catch(qt){nr(Ce,Ce.return,qt)}}}else if(x.tag===6){if(C===null){Ce=x;try{var Wt=Ce.stateNode;$?$w(Wt):Xw(Wt,Ce.memoizedProps)}catch(qt){nr(Ce,Ce.return,qt)}}}else if(x.tag===18){if(C===null){Ce=x;try{var ln=Ce.stateNode;$?p3(ln):m3(Ce.stateNode)}catch(qt){nr(Ce,Ce.return,qt)}}}else if((x.tag!==22&&x.tag!==23||x.memoizedState===null||x===m)&&x.child!==null){x.child.return=x,x=x.child;continue}if(x===m)break e;for(;x.sibling===null;){if(x.return===null||x.return===m)break e;C===x&&(C=null),x=x.return}C===x&&(C=null),x.sibling.return=x.return,x=x.sibling}}k&4&&(k=m.updateQueue,k!==null&&(C=k.retryQueue,C!==null&&(k.retryQueue=null,ud(m,C))));break;case 19:Pa(x,m),Ia(m),k&4&&(k=m.updateQueue,k!==null&&(m.updateQueue=null,ud(m,k)));break;case 30:break;case 21:break;default:Pa(x,m),Ia(m)}}function Ia(m){var x=m.flags;if(x&2){try{for(var C,k=m.return;k!==null;){if(Eo(k)){C=k;break}k=k.return}if(qr){if(C==null)throw Error(i(160));switch(C.tag){case 27:if(ba){var $=C.stateNode,ee=sa(m);xa(m,ee,$);break}case 5:var Ce=C.stateNode;C.flags&32&&(rb(Ce),C.flags&=-33);var at=sa(m);xa(m,at,Ce);break;case 3:case 4:var It=C.stateNode.containerInfo,Wt=sa(m);aa(m,Wt,It);break;default:throw Error(i(161))}}}catch(ln){nr(m,m.return,ln)}m.flags&=-3}x&4096&&(m.flags&=-4097)}function kv(m){if(m.subtreeFlags&1024)for(m=m.child;m!==null;){var x=m;kv(x),x.tag===5&&x.flags&1024&&Ky(x.stateNode),m=m.sibling}}function Co(m,x){if(x.subtreeFlags&8772)for(x=x.child;x!==null;)Nw(m,x.alternate,x),x=x.sibling}function ef(m){for(m=m.child;m!==null;){var x=m;switch(x.tag){case 0:case 11:case 14:case 15:as(4,x,x.return),ef(x);break;case 1:Hi(x,x.return);var C=x.stateNode;typeof C.componentWillUnmount=="function"&&Ya(x,x.return,C),ef(x);break;case 27:ba&&Da(x.stateNode);case 26:case 5:Hi(x,x.return),ef(x);break;case 22:x.memoizedState===null&&ef(x);break;case 30:ef(x);break;default:ef(x)}m=m.sibling}}function rc(m,x,C){for(C=C&&(x.subtreeFlags&8772)!==0,x=x.child;x!==null;){var k=x.alternate,$=m,ee=x,Ce=ee.flags;switch(ee.tag){case 0:case 11:case 15:rc($,ee,C),si(4,ee);break;case 1:if(rc($,ee,C),k=ee,$=k.stateNode,typeof $.componentDidMount=="function")try{$.componentDidMount()}catch(Wt){nr(k,k.return,Wt)}if(k=ee,$=k.updateQueue,$!==null){var at=k.stateNode;try{var It=$.shared.hiddenCallbacks;if(It!==null)for($.shared.hiddenCallbacks=null,$=0;$<It.length;$++)Fn(It[$],at)}catch(Wt){nr(k,k.return,Wt)}}C&&Ce&64&&Os(ee),Na(ee,ee.return);break;case 27:ba&&ka(ee);case 26:case 5:rc($,ee,C),C&&k===null&&Ce&4&&Gs(ee),Na(ee,ee.return);break;case 12:rc($,ee,C);break;case 31:rc($,ee,C),C&&Ce&4&&tc($,ee);break;case 13:rc($,ee,C),C&&Ce&4&&Rm($,ee);break;case 22:ee.memoizedState===null&&rc($,ee,C),Na(ee,ee.return);break;case 30:break;default:rc($,ee,C)}x=x.sibling}}function tf(m,x){var C=null;m!==null&&m.memoizedState!==null&&m.memoizedState.cachePool!==null&&(C=m.memoizedState.cachePool.pool),m=null,x.memoizedState!==null&&x.memoizedState.cachePool!==null&&(m=x.memoizedState.cachePool.pool),m!==C&&(m!=null&&m.refCount++,C!=null&&ge(C))}function jy(m,x){m=null,x.alternate!==null&&(m=x.alternate.memoizedState.cache),x=x.memoizedState.cache,x!==m&&(x.refCount++,m!=null&&ge(m))}function _s(m,x,C,k){if(x.subtreeFlags&10256)for(x=x.child;x!==null;)Pv(m,x,C,k),x=x.sibling}function Pv(m,x,C,k){var $=x.flags;switch(x.tag){case 0:case 11:case 15:_s(m,x,C,k),$&2048&&si(9,x);break;case 1:_s(m,x,C,k);break;case 3:_s(m,x,C,k),$&2048&&(m=null,x.alternate!==null&&(m=x.alternate.memoizedState.cache),x=x.memoizedState.cache,x!==m&&(x.refCount++,m!=null&&ge(m)));break;case 12:if($&2048){_s(m,x,C,k),m=x.stateNode;try{var ee=x.memoizedProps,Ce=ee.id,at=ee.onPostCommit;typeof at=="function"&&at(Ce,x.alternate===null?"mount":"update",m.passiveEffectDuration,-0)}catch(It){nr(x,x.return,It)}}else _s(m,x,C,k);break;case 31:_s(m,x,C,k);break;case 13:_s(m,x,C,k);break;case 23:break;case 22:ee=x.stateNode,Ce=x.alternate,x.memoizedState!==null?ee._visibility&2?_s(m,x,C,k):Ip(m,x):ee._visibility&2?_s(m,x,C,k):(ee._visibility|=2,qo(m,x,C,k,(x.subtreeFlags&10256)!==0||!1)),$&2048&&tf(Ce,x);break;case 24:_s(m,x,C,k),$&2048&&jy(x.alternate,x);break;default:_s(m,x,C,k)}}function qo(m,x,C,k,$){for($=$&&((x.subtreeFlags&10256)!==0||!1),x=x.child;x!==null;){var ee=m,Ce=x,at=C,It=k,Wt=Ce.flags;switch(Ce.tag){case 0:case 11:case 15:qo(ee,Ce,at,It,$),si(8,Ce);break;case 23:break;case 22:var ln=Ce.stateNode;Ce.memoizedState!==null?ln._visibility&2?qo(ee,Ce,at,It,$):Ip(ee,Ce):(ln._visibility|=2,qo(ee,Ce,at,It,$)),$&&Wt&2048&&tf(Ce.alternate,Ce);break;case 24:qo(ee,Ce,at,It,$),$&&Wt&2048&&jy(Ce.alternate,Ce);break;default:qo(ee,Ce,at,It,$)}x=x.sibling}}function Ip(m,x){if(x.subtreeFlags&10256)for(x=x.child;x!==null;){var C=m,k=x,$=k.flags;switch(k.tag){case 22:Ip(C,k),$&2048&&tf(k.alternate,k);break;case 24:Ip(C,k),$&2048&&jy(k.alternate,k);break;default:Ip(C,k)}x=x.sibling}}function hu(m,x,C){if(m.subtreeFlags&Nl)for(m=m.child;m!==null;)nf(m,x,C),m=m.sibling}function nf(m,x,C){switch(m.tag){case 26:if(hu(m,x,C),m.flags&Nl)if(m.memoizedState!==null)y3(C,Ci,m.memoizedState,m.memoizedProps);else{var k=m.stateNode,$=m.type;m=m.memoizedProps,((x&335544128)===x||Xy($,m))&&Xv(C,k,$,m)}break;case 5:hu(m,x,C),m.flags&Nl&&(k=m.stateNode,$=m.type,m=m.memoizedProps,((x&335544128)===x||Xy($,m))&&Xv(C,k,$,m));break;case 3:case 4:oc?(k=Ci,Ci=Vm(m.stateNode.containerInfo),hu(m,x,C),Ci=k):hu(m,x,C);break;case 22:m.memoizedState===null&&(k=m.alternate,k!==null&&k.memoizedState!==null?(k=Nl,Nl=16777216,hu(m,x,C),Nl=k):hu(m,x,C));break;default:hu(m,x,C)}}function Iv(m){var x=m.alternate;if(x!==null&&(m=x.child,m!==null)){x.child=null;do x=m.sibling,m.sibling=null,m=x;while(m!==null)}}function Dp(m){var x=m.deletions;if((m.flags&16)!==0){if(x!==null)for(var C=0;C<x.length;C++){var k=x[C];Xs=k,Sl(k,m)}Iv(m)}if(m.subtreeFlags&10256)for(m=m.child;m!==null;)Dv(m),m=m.sibling}function Dv(m){switch(m.tag){case 0:case 11:case 15:Dp(m),m.flags&2048&&as(9,m,m.return);break;case 3:Dp(m);break;case 12:Dp(m);break;case 22:var x=m.stateNode;m.memoizedState!==null&&x._visibility&2&&(m.return===null||m.return.tag!==13)?(x._visibility&=-3,Pm(m)):Dp(m);break;default:Dp(m)}}function Pm(m){var x=m.deletions;if((m.flags&16)!==0){if(x!==null)for(var C=0;C<x.length;C++){var k=x[C];Xs=k,Sl(k,m)}Iv(m)}for(m=m.child;m!==null;){switch(x=m,x.tag){case 0:case 11:case 15:as(8,x,x.return),Pm(x);break;case 22:C=x.stateNode,C._visibility&2&&(C._visibility&=-3,Pm(x));break;default:Pm(x)}m=m.sibling}}function Sl(m,x){for(;Xs!==null;){var C=Xs;switch(C.tag){case 0:case 11:case 15:as(8,C,x);break;case 23:case 22:if(C.memoizedState!==null&&C.memoizedState.cachePool!==null){var k=C.memoizedState.cachePool.pool;k!=null&&k.refCount++}break;case 24:ge(C.memoizedState.cache)}if(k=C.child,k!==null)k.return=C,Xs=k;else e:for(C=m;Xs!==null;){k=Xs;var $=k.sibling,ee=k.return;if(zy(k),k===C){Xs=null;break e}if($!==null){$.return=ee,Xs=$;break e}Xs=ee}}}function rf(m){var x=gr(m);if(x!=null){if(typeof x.memoizedProps["data-testname"]!="string")throw Error(i(364));return x}if(m=$s(m),m===null)throw Error(i(362));return m.stateNode.current}function sf(m,x){var C=m.tag;switch(x.$$typeof){case mc:if(m.type===x.value)return!0;break;case Qp:e:{for(x=x.value,m=[m,0],C=0;C<m.length;){var k=m[C++],$=k.tag,ee=m[C++],Ce=x[ee];if($!==5&&$!==26&&$!==27||!ff(k)){for(;Ce!=null&&sf(k,Ce);)ee++,Ce=x[ee];if(ee===x.length){x=!0;break e}else for(k=k.child;k!==null;)m.push(k,ee),k=k.sibling}}x=!1}return x;case Jp:if((C===5||C===26||C===27)&&Jy(m.stateNode,x.value))return!0;break;case bf:if((C===5||C===6||C===26||C===27)&&(m=Bm(m),m!==null&&0<=m.indexOf(x.value)))return!0;break;case Zm:if((C===5||C===26||C===27)&&(m=m.memoizedProps["data-testname"],typeof m=="string"&&m.toLowerCase()===x.value.toLowerCase()))return!0;break;default:throw Error(i(365))}return!1}function Op(m){switch(m.$$typeof){case mc:return"<"+(h(m.value)||"Unknown")+">";case Qp:return":has("+(Op(m)||"")+")";case Jp:return'[role="'+m.value+'"]';case bf:return'"'+m.value+'"';case Zm:return'[data-testname="'+m.value+'"]';default:throw Error(i(365))}}function Lp(m,x){var C=[];m=[m,0];for(var k=0;k<m.length;){var $=m[k++],ee=$.tag,Ce=m[k++],at=x[Ce];if(ee!==5&&ee!==26&&ee!==27||!ff($)){for(;at!=null&&sf($,at);)Ce++,at=x[Ce];if(Ce===x.length)C.push($);else for($=$.child;$!==null;)m.push($,Ce),$=$.sibling}}return C}function Xo(m,x){if(!ya)throw Error(i(363));m=rf(m),m=Lp(m,x),x=[],m=Array.from(m);for(var C=0;C<m.length;){var k=m[C++],$=k.tag;if($===5||$===26||$===27)ff(k)||x.push(k.stateNode);else for(k=k.child;k!==null;)m.push(k),k=k.sibling}return x}function os(){return(Ir&2)!==0&&Ur!==0?Ur&-Ur:Gn.T!==null?Ye():Wp()}function dd(){if(Io===0)if((Ur&536870912)===0||Fr){var m=Ph;Ph<<=1,(Ph&3932160)===0&&(Ph=262144),Io=m}else Io=536870912;return m=el.current,m!==null&&(m.flags|=32),Io}function Ss(m,x,C){(m===Mr&&(Ai===2||Ai===9)||m.cancelPendingCommit!==null)&&(Ls(m,0),mu(m,Ur,Io,!1)),P(m,C),((Ir&2)===0||m!==Mr)&&(m===Mr&&((Ir&2)===0&&(wf|=C),Es===4&&mu(m,Ur,Io,!1)),Xe(m))}function Lc(m,x,C){if((Ir&6)!==0)throw Error(i(327));var k=!C&&(x&127)===0&&(x&m.expiredLanes)===0||E(m,x),$=k?Pw(m,x):gu(m,x,!0),ee=k;do{if($===0){_f&&!k&&mu(m,x,0,!1);break}else{if(C=m.current.alternate,ee&&!Rw(C)){$=gu(m,x,!1),ee=!1;continue}if($===2){if(ee=x,m.errorRecoveryDisabledLanes&ee)var Ce=0;else Ce=m.pendingLanes&-536870913,Ce=Ce!==0?Ce:Ce&536870912?536870912:0;if(Ce!==0){x=Ce;e:{var at=m;$=Qm;var It=ls&&at.current.memoizedState.isDehydrated;if(It&&(Ls(at,Ce).flags|=256),Ce=gu(at,Ce,!1),Ce!==2){if(Sf&&!It){at.errorRecoveryDisabledLanes|=ee,wf|=ee,$=4;break e}ee=nl,nl=$,ee!==null&&(nl===null?nl=ee:nl.push.apply(nl,ee))}$=Ce}if(ee=!1,$!==2)continue}}if($===1){Ls(m,0),mu(m,x,0,!0);break}e:{switch(k=m,ee=$,ee){case 0:case 1:throw Error(i(345));case 4:if((x&4194048)!==x)break;case 6:mu(k,x,Io,!Uc);break e;case 2:nl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((x&62914560)===x&&($=Jm+300-ho(),10<$)){if(mu(k,x,Io,!Uc),S(k,0,!0)!==0)break e;Ru=x,k.timeoutHandle=qy(pu.bind(null,k,C,nl,eg,gx,x,Io,wf,t0,Uc,ee,"Throttled",-0,0),$);break e}pu(k,C,nl,eg,gx,x,Io,wf,t0,Uc,ee,null,-0,0)}}break}while(!0);Xe(m)}function pu(m,x,C,k,$,ee,Ce,at,It,Wt,ln,qt,yn,dr){if(m.timeoutHandle=Zo,qt=x.subtreeFlags,qt&8192||(qt&16785408)===16785408){qt=Yy(),nf(x,ee,qt);var Ks=(ee&62914560)===ee?Jm-ho():(ee&4194048)===ee?Fh-ho():0;if(Ks=Fw(qt,Ks),Ks!==null){Ru=ee,m.cancelPendingCommit=Ks(xu.bind(null,m,x,ee,C,k,$,Ce,at,It,ln,qt,null,yn,dr)),mu(m,ee,Ce,!Wt);return}}xu(m,x,ee,C,k,$,Ce,at,It)}function Rw(m){for(var x=m;;){var C=x.tag;if((C===0||C===11||C===15)&&x.flags&16384&&(C=x.updateQueue,C!==null&&(C=C.stores,C!==null)))for(var k=0;k<C.length;k++){var $=C[k],ee=$.getSnapshot;$=$.value;try{if(!qs(ee(),$))return!1}catch{return!1}}if(C=x.child,x.subtreeFlags&16384&&C!==null)C.return=x,x=C;else{if(x===m)break;for(;x.sibling===null;){if(x.return===null||x.return===m)return!0;x=x.return}x.sibling.return=x.return,x=x.sibling}}return!0}function mu(m,x,C,k){x&=~e0,x&=~wf,m.suspendedLanes|=x,m.pingedLanes&=~x,k&&(m.warmLanes|=x),k=m.expirationTimes;for(var $=x;0<$;){var ee=31-Qo($),Ce=1<<ee;k[ee]=-1,$&=~Ce}C!==0&&R(m,C,x)}function Ov(){return(Ir&6)===0?(Ae(0),!1):!0}function Lv(){if(Dr!==null){if(Ai===0)var m=Dr.return;else m=Dr,jc=$i=null,cr(m),vf=null,Dh=0,m=Dr;for(;m!==null;)pi(m.alternate,m),m=m.return;Dr=null}}function Ls(m,x){var C=m.timeoutHandle;C!==Zo&&(m.timeoutHandle=Zo,jw(C)),C=m.cancelPendingCommit,C!==null&&(m.cancelPendingCommit=null,C()),Ru=0,Lv(),Mr=m,Dr=C=Ml(m.current,null),Ur=x,Ai=0,ca=null,Uc=!1,_f=E(m,x),Sf=!1,t0=Io=e0=wf=wd=Es=0,nl=Qm=null,gx=!1,(x&8)!==0&&(x|=x&32);var k=m.entangledLanes;if(k!==0)for(m=m.entanglements,k&=x;0<k;){var $=31-Qo(k),ee=1<<$;x|=m[$],k&=~ee}return Nu=x,$e(),C}function Wi(m,x){vr=null,Gn.H=Al,x===wa||x===hc?(x=et(),Ai=3):x===px?(x=et(),Ai=4):Ai=x===Po?8:x!==null&&typeof x=="object"&&typeof x.then=="function"?6:1,ca=x,Dr===null&&(Es=1,Zl(m,Q(x,m.current)))}function $r(){var m=el.current;return m===null?!0:(Ur&4194048)===Ur?tl===null:(Ur&62914560)===Ur||(Ur&536870912)!==0?m===tl:!1}function fd(){var m=Gn.H;return Gn.H=Al,m===null?Al:m}function wl(){var m=Gn.A;return Gn.A=Zp,m}function zp(){Es=4,Uc||(Ur&4194048)!==Ur&&el.current!==null||(_f=!0),(wd&134217727)===0&&(wf&134217727)===0||Mr===null||mu(Mr,Ur,Io,!1)}function gu(m,x,C){var k=Ir;Ir|=2;var $=fd(),ee=wl();(Mr!==m||Ur!==x)&&(eg=null,Ls(m,x)),x=!1;var Ce=Es;e:do try{if(Ai!==0&&Dr!==null){var at=Dr,It=ca;switch(Ai){case 8:Lv(),Ce=6;break e;case 3:case 2:case 9:case 6:el.current===null&&(x=!0);var Wt=Ai;if(Ai=0,ca=null,vu(m,at,It,Wt),C&&_f){Ce=0;break e}break;default:Wt=Ai,Ai=0,ca=null,vu(m,at,It,Wt)}}kw(),Ce=Es;break}catch(ln){Wi(m,ln)}while(!0);return x&&m.shellSuspendCounter++,jc=$i=null,Ir=k,Gn.H=$,Gn.A=ee,Dr===null&&(Mr=null,Ur=0,$e()),Ce}function kw(){for(;Dr!==null;)af(Dr)}function Pw(m,x){var C=Ir;Ir|=2;var k=fd(),$=wl();Mr!==m||Ur!==x?(eg=null,Mf=ho()+500,Ls(m,x)):_f=E(m,x);e:do try{if(Ai!==0&&Dr!==null){x=Dr;var ee=ca;t:switch(Ai){case 1:Ai=0,ca=null,vu(m,x,ee,1);break;case 2:case 9:if(ze(ee)){Ai=0,ca=null,zv(x);break}x=function(){Ai!==2&&Ai!==9||Mr!==m||(Ai=7),Xe(m)},ee.then(x,x);break e;case 3:Ai=7;break e;case 4:Ai=5;break e;case 7:ze(ee)?(Ai=0,ca=null,zv(x)):(Ai=0,ca=null,vu(m,x,ee,7));break;case 5:var Ce=null;switch(Dr.tag){case 26:Ce=Dr.memoizedState;case 5:case 27:var at=Dr,It=at.type,Wt=at.pendingProps;if(Ce?_b(Ce):ws(at.stateNode,It,Wt)){Ai=0,ca=null;var ln=at.sibling;if(ln!==null)Dr=ln;else{var qt=at.return;qt!==null?(Dr=qt,Fp(qt)):Dr=null}break t}}Ai=0,ca=null,vu(m,x,ee,5);break;case 6:Ai=0,ca=null,vu(m,x,ee,6);break;case 8:Lv(),Es=6;break e;default:throw Error(i(462))}}jp();break}catch(yn){Wi(m,yn)}while(!0);return jc=$i=null,Gn.H=k,Gn.A=$,Ir=C,Dr!==null?0:(Mr=null,Ur=0,$e(),Es)}function jp(){for(;Dr!==null&&!_3();)af(Dr)}function af(m){var x=jt(m.alternate,m,Nu);m.memoizedProps=m.pendingProps,x===null?Fp(m):Dr=x}function zv(m){var x=m,C=x.alternate;switch(x.tag){case 15:case 0:x=Is(C,x,x.pendingProps,x.type,void 0,Ur);break;case 11:x=Is(C,x,x.pendingProps,x.type.render,x.ref,Ur);break;case 5:cr(x);default:pi(C,x),x=Dr=Uv(x,Nu),x=jt(C,x,Nu)}m.memoizedProps=m.pendingProps,x===null?Fp(m):Dr=x}function vu(m,x,C,k){jc=$i=null,cr(x),vf=null,Dh=0;var $=x.return;try{if(wm(m,$,x,C,Ur)){Es=1,Zl(m,Q(C,m.current)),Dr=null;return}}catch(ee){if($!==null)throw Dr=$,ee;Es=1,Zl(m,Q(C,m.current)),Dr=null;return}x.flags&32768?(Fr||k===1?m=!0:_f||(Ur&536870912)!==0?m=!1:(Uc=m=!0,(k===2||k===9||k===3||k===6)&&(k=el.current,k!==null&&k.tag===13&&(k.flags|=16384))),of(x,m)):Fp(x)}function Fp(m){var x=m;do{if((x.flags&32768)!==0){of(x,Uc);return}m=x.return;var C=Ji(x.alternate,x,Nu);if(C!==null){Dr=C;return}if(x=x.sibling,x!==null){Dr=x;return}Dr=x=m}while(x!==null);Es===0&&(Es=5)}function of(m,x){do{var C=Ds(m.alternate,m);if(C!==null){C.flags&=32767,Dr=C;return}if(C=m.return,C!==null&&(C.flags|=32768,C.subtreeFlags=0,C.deletions=null),!x&&(m=m.sibling,m!==null)){Dr=m;return}Dr=m=C}while(m!==null);Es=6,Dr=null}function xu(m,x,C,k,$,ee,Ce,at,It){m.cancelPendingCommit=null;do bu();while(ua!==0);if((Ir&6)!==0)throw Error(i(327));if(x!==null){if(x===m.current)throw Error(i(177));if(ee=x.lanes|x.childLanes,ee|=Oh,L(m,C,ee,Ce,at,It),m===Mr&&(Dr=Mr=null,Ur=0),Uh=x,Td=m,Ru=C,n0=ee,vx=$,Rb=k,(x.subtreeFlags&10256)!==0||(x.flags&10256)!==0?(m.callbackNode=null,m.callbackPriority=0,oa(Wm,function(){return Im(),null})):(m.callbackNode=null,m.callbackPriority=0),k=(x.flags&13878)!==0,(x.subtreeFlags&13878)!==0||k){k=Gn.T,Gn.T=null,$=ac(),jr(2),Ce=Ir,Ir|=4;try{Rv(m,x,C)}finally{Ir=Ce,jr($),Gn.T=k}}ua=1,hd(),yu(),jv()}}function hd(){if(ua===1){ua=0;var m=Td,x=Uh,C=(x.flags&13878)!==0;if((x.subtreeFlags&13878)!==0||C){C=Gn.T,Gn.T=null;var k=ac();jr(2);var $=Ir;Ir|=4;try{km(x,m),zw(m.containerInfo)}finally{Ir=$,jr(k),Gn.T=C}}m.current=x,ua=2}}function yu(){if(ua===2){ua=0;var m=Td,x=Uh,C=(x.flags&8772)!==0;if((x.subtreeFlags&8772)!==0||C){C=Gn.T,Gn.T=null;var k=ac();jr(2);var $=Ir;Ir|=4;try{Nw(m,x.alternate,x)}finally{Ir=$,jr(k),Gn.T=C}}ua=3}}function jv(){if(ua===4||ua===3){ua=0,wb();var m=Td,x=Uh,C=Ru,k=Rb;(x.subtreeFlags&10256)!==0||(x.flags&10256)!==0?ua=5:(ua=0,Uh=Td=null,Fv(m,m.pendingLanes));var $=m.pendingLanes;if($===0&&(Md=null),V(C),x=x.stateNode,Jo&&typeof Jo.onCommitFiberRoot=="function")try{Jo.onCommitFiberRoot(Ih,x,void 0,(x.current.flags&128)===128)}catch{}if(k!==null){x=Gn.T,$=ac(),jr(2),Gn.T=null;try{for(var ee=m.onRecoverableError,Ce=0;Ce<k.length;Ce++){var at=k[Ce];ee(at.value,{componentStack:at.stack})}}finally{Gn.T=x,jr($)}}(Ru&3)!==0&&bu(),Xe(m),$=m.pendingLanes,(C&261930)!==0&&($&42)!==0?m===tg?ai++:(ai=0,tg=m):ai=0,ls&&Hm(),Ae(0)}}function Fv(m,x){(m.pooledCacheLanes&=x)===0&&(x=m.pooledCache,x!=null&&(m.pooledCache=null,ge(x)))}function bu(){return hd(),yu(),jv(),Im()}function Im(){if(ua!==5)return!1;var m=Td,x=n0;n0=0;var C=V(Ru),k=32>C?32:C;C=Gn.T;var $=ac();try{jr(k),Gn.T=null,k=vx,vx=null;var ee=Td,Ce=Ru;if(ua=0,Uh=Td=null,Ru=0,(Ir&6)!==0)throw Error(i(331));var at=Ir;if(Ir|=4,Dv(ee.current),Pv(ee,ee.current,Ce,k),Ir=at,Ae(0,!1),Jo&&typeof Jo.onPostCommitFiberRoot=="function")try{Jo.onPostCommitFiberRoot(Ih,ee)}catch{}return!0}finally{jr($),Gn.T=C,Fv(m,x)}}function lf(m,x,C){x=Q(C,x),x=ad(m.stateNode,x,2),m=Ht(m,x,2),m!==null&&(P(m,2),Xe(m))}function nr(m,x,C){if(m.tag===3)lf(m,m,C);else for(;x!==null;){if(x.tag===3){lf(x,m,C);break}else if(x.tag===1){var k=x.stateNode;if(typeof x.type.getDerivedStateFromError=="function"||typeof k.componentDidCatch=="function"&&(Md===null||!Md.has(k))){m=Q(C,m),C=Sm(2),k=Ht(x,C,2),k!==null&&(Ap(C,k,x,m),P(k,2),Xe(k));break}}x=x.return}}function Up(m,x,C){var k=m.pingCache;if(k===null){k=m.pingCache=new Rl;var $=new Set;k.set(x,$)}else $=k.get(x),$===void 0&&($=new Set,k.set(x,$));$.has(C)||(Sf=!0,$.add(C),m=Iw.bind(null,m,x,C),x.then(m,m))}function Iw(m,x,C){var k=m.pingCache;k!==null&&k.delete(x),m.pingedLanes|=m.suspendedLanes&C,m.warmLanes&=~C,Mr===m&&(Ur&C)===C&&(Es===4||Es===3&&(Ur&62914560)===Ur&&300>ho()-Jm?(Ir&2)===0&&Ls(m,0):e0|=C,t0===Ur&&(t0=0)),Xe(m)}function Dw(m,x){x===0&&(x=N()),m=Ot(m,x),m!==null&&(P(m,x),Xe(m))}function OE(m){var x=m.memoizedState,C=0;x!==null&&(C=x.retryLane),Dw(m,C)}function LE(m,x){var C=0;switch(m.tag){case 31:case 13:var k=m.stateNode,$=m.memoizedState;$!==null&&(C=$.retryLane);break;case 19:k=m.stateNode;break;case 22:k=m.stateNode._retryCache;break;default:throw Error(i(314))}k!==null&&k.delete(x),Dw(m,C)}function oa(m,x){return Gm(m,x)}function Fy(m,x,C,k){this.tag=m,this.key=C,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=x,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=k,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bh(m){return m=m.prototype,!(!m||!m.isReactComponent)}function Ml(m,x){var C=m.alternate;return C===null?(C=n(m.tag,x,m.key,m.mode),C.elementType=m.elementType,C.type=m.type,C.stateNode=m.stateNode,C.alternate=m,m.alternate=C):(C.pendingProps=x,C.type=m.type,C.flags=0,C.subtreeFlags=0,C.deletions=null),C.flags=m.flags&65011712,C.childLanes=m.childLanes,C.lanes=m.lanes,C.child=m.child,C.memoizedProps=m.memoizedProps,C.memoizedState=m.memoizedState,C.updateQueue=m.updateQueue,x=m.dependencies,C.dependencies=x===null?null:{lanes:x.lanes,firstContext:x.firstContext},C.sibling=m.sibling,C.index=m.index,C.ref=m.ref,C.refCleanup=m.refCleanup,C}function Uv(m,x){m.flags&=65011714;var C=m.alternate;return C===null?(m.childLanes=0,m.lanes=x,m.child=null,m.subtreeFlags=0,m.memoizedProps=null,m.memoizedState=null,m.updateQueue=null,m.dependencies=null,m.stateNode=null):(m.childLanes=C.childLanes,m.lanes=C.lanes,m.child=C.child,m.subtreeFlags=0,m.deletions=null,m.memoizedProps=C.memoizedProps,m.memoizedState=C.memoizedState,m.updateQueue=C.updateQueue,m.type=C.type,x=C.dependencies,m.dependencies=x===null?null:{lanes:x.lanes,firstContext:x.firstContext}),m}function pd(m,x,C,k,$,ee){var Ce=0;if(k=m,typeof m=="function")bh(m)&&(Ce=1);else if(typeof m=="string")Ce=oc&&ba?tx(m,C,Oa.current)?26:Sb(m)?27:5:oc?tx(m,C,Oa.current)?26:5:ba&&Sb(m)?27:5;else e:switch(m){case zm:return m=n(31,C,x,$),m.elementType=zm,m.lanes=ee,m;case Mh:return ic(C.children,$,ee,x);case Th:Ce=8,$|=24;break;case Eh:return m=n(12,C,x,$|2),m.elementType=Eh,m.lanes=ee,m;case Gv:return m=n(13,C,x,$),m.elementType=Gv,m.lanes=ee,m;case md:return m=n(19,C,x,$),m.elementType=md,m.lanes=ee,m;default:if(typeof m=="object"&&m!==null)switch(m.$$typeof){case sc:Ce=10;break e;case Lm:Ce=9;break e;case Bp:Ce=11;break e;case Wv:Ce=14;break e;case Ao:Ce=16,k=null;break e}Ce=29,C=Error(i(130,m===null?"null":typeof m,"")),k=null}return x=n(Ce,C,x,$),x.elementType=m,x.type=k,x.lanes=ee,x}function ic(m,x,C,k){return m=n(7,m,k,x),m.lanes=C,m}function Uy(m,x,C){return m=n(6,m,null,x),m.lanes=C,m}function By(m){var x=n(18,null,null,0);return x.stateNode=m,x}function Hy(m,x,C){return x=n(4,m.children!==null?m.children:[],m.key,x),x.lanes=C,x.stateNode={containerInfo:m.containerInfo,pendingChildren:null,implementation:m.implementation},x}function Ow(m,x,C,k,$,ee,Ce,at,It){this.tag=1,this.containerInfo=m,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Zo,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=D(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=D(0),this.hiddenUpdates=D(null),this.identifierPrefix=k,this.onUncaughtError=$,this.onCaughtError=ee,this.onRecoverableError=Ce,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=It,this.incompleteTransitions=new Map}function cf(m,x,C,k,$,ee,Ce,at,It,Wt,ln,qt){return m=new Ow(m,x,C,Ce,It,Wt,ln,qt,at),x=1,ee===!0&&(x|=24),ee=n(3,null,null,x),m.current=ee,ee.stateNode=m,x=me(),x.refCount++,m.pooledCache=x,x.refCount++,ee.memoizedState={element:k,isDehydrated:C,cache:x},On(ee),m}function Bv(m){return m?(m=Su,m):Su}function Dm(m){var x=m._reactInternals;if(x===void 0)throw typeof m.render=="function"?Error(i(188)):(m=Object.keys(m).join(","),Error(i(268,m)));return m=o(x),m=m!==null?l(m):null,m===null?null:Vp(m.stateNode)}function Vy(m,x,C,k,$,ee){$=Bv($),k.context===null?k.context=$:k.pendingContext=$,k=fn(x),k.payload={element:C},ee=ee===void 0?null:ee,ee!==null&&(k.callback=ee),C=Ht(m,k,x),C!==null&&(Ss(C,m,x),In(C,m,x))}function _h(m,x){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var C=m.retryLane;m.retryLane=C!==0&&C<x?C:x}}function Om(m,x){_h(m,x),(m=m.alternate)&&_h(m,x)}var Sr={},Hv=Qr,Yo=JTe,Vv=Object.assign,Sh=Symbol.for("react.element"),_u=Symbol.for("react.transitional.element"),wh=Symbol.for("react.portal"),Mh=Symbol.for("react.fragment"),Th=Symbol.for("react.strict_mode"),Eh=Symbol.for("react.profiler"),Lm=Symbol.for("react.consumer"),sc=Symbol.for("react.context"),Bp=Symbol.for("react.forward_ref"),Gv=Symbol.for("react.suspense"),md=Symbol.for("react.suspense_list"),Wv=Symbol.for("react.memo"),Ao=Symbol.for("react.lazy"),zm=Symbol.for("react.activity"),Gy=Symbol.for("react.memo_cache_sentinel"),gd=Symbol.iterator,uf=Symbol.for("react.client.reference"),df=Array.isArray,Gn=Hv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Wy=e.rendererVersion,jm=e.rendererPackageName,Hp=e.extraDevToolsConfig,Vp=e.getPublicInstance,Lw=e.getRootHostContext,Gp=e.getChildHostContext,$v=e.prepareForCommit,zw=e.resetAfterCommit,$y=e.createInstance;e.cloneMutableInstance;var Fm=e.appendInitialChild,Ko=e.finalizeInitialChildren,No=e.shouldSetTextContent,vd=e.createTextInstance;e.cloneMutableTextInstance;var qy=e.scheduleTimeout,jw=e.cancelTimeout,Zo=e.noTimeout,Ws=e.isPrimaryRenderer;e.warnsIfNotActing;var qr=e.supportsMutation,Tl=e.supportsPersistence,ls=e.supportsHydration,gr=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var Oi=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var jr=e.setCurrentUpdatePriority,ac=e.getCurrentUpdatePriority,Wp=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var Ch=e.shouldAttemptEagerTransition,qv=e.detachDeletedInstance;e.requestPostPaintCallback;var Um=e.maySuspendCommit,$p=e.maySuspendCommitOnUpdate,Xy=e.maySuspendCommitInSyncRender,ws=e.preloadInstance,Yy=e.startSuspendingCommit,Xv=e.suspendInstance;e.suspendOnActiveViewTransition;var Fw=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var Ah=e.NotPendingTransition,Nh=e.HostTransitionContext,Ky=e.resetFormInstance;e.bindToConsole;var Zy=e.supportsMicrotasks,Qy=e.scheduleMicrotask,ya=e.supportsTestSelectors,$s=e.findFiberRoot,Yv=e.getBoundingRect,Bm=e.getTextContent,ff=e.isHiddenSubtree,Jy=e.matchAccessibilityRole,xd=e.setFocusIfFocusable,Kv=e.setupIntersectionObserver,eb=e.appendChild,tb=e.appendChildToContainer,Uw=e.commitTextUpdate,Bw=e.commitMount,Hw=e.commitUpdate,Vw=e.insertBefore,Gw=e.insertInContainerBefore,Ww=e.removeChild,nb=e.removeChildFromContainer,rb=e.resetTextContent,zE=e.hideInstance,$w=e.hideTextInstance,qw=e.unhideInstance,Xw=e.unhideTextInstance;e.cancelViewTransitionName,e.cancelRootViewTransitionName,e.restoreRootViewTransitionName,e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone,e.measureClonedInstance,e.hasInstanceChanged,e.hasInstanceAffectedParent,e.startViewTransition,e.startGestureTransition,e.stopViewTransition,e.getCurrentGestureOffset,e.createViewTransitionInstance;var ib=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var Yw=e.cloneInstance,sb=e.createContainerChildSet,ab=e.appendChildToContainerChildSet,Kw=e.finalizeContainerChildren,ob=e.replaceContainerChildren,Zw=e.cloneHiddenInstance,lb=e.cloneHiddenTextInstance,hf=e.isSuspenseInstancePending,Zv=e.isSuspenseInstanceFallback,Qv=e.getSuspenseInstanceFallbackErrorDetails,Jv=e.registerSuspenseInstanceRetry,Qw=e.canHydrateFormStateMarker,cb=e.isFormStateMarkerMatching,Jw=e.getNextHydratableSibling,e3=e.getNextHydratableSiblingAfterSingleton,t3=e.getFirstHydratableChild,n3=e.getFirstHydratableChildWithinContainer,r3=e.getFirstHydratableChildWithinActivityInstance,i3=e.getFirstHydratableChildWithinSuspenseInstance,ub=e.getFirstHydratableChildWithinSingleton,s3=e.canHydrateInstance,a3=e.canHydrateTextInstance,db=e.canHydrateActivityInstance,o3=e.canHydrateSuspenseInstance,l3=e.hydrateInstance,jE=e.hydrateTextInstance,fb=e.hydrateActivityInstance,c3=e.hydrateSuspenseInstance,u3=e.getNextHydratableInstanceAfterActivityInstance,hb=e.getNextHydratableInstanceAfterSuspenseInstance,d3=e.commitHydratedInstance,f3=e.commitHydratedContainer,FE=e.commitHydratedActivityInstance,UE=e.commitHydratedSuspenseInstance,h3=e.finalizeHydratedChildren,Hm=e.flushHydrationEvents;e.clearActivityBoundary;var pb=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var ex=e.clearSuspenseBoundaryFromContainer,p3=e.hideDehydratedBoundary,m3=e.unhideDehydratedBoundary,qp=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var g3=e.validateHydratableInstance,mb=e.validateHydratableTextInstance,oc=e.supportsResources,tx=e.isHostHoistableType,Vm=e.getHoistableRoot,gb=e.getResource,vb=e.acquireResource,pf=e.releaseResource,v3=e.hydrateHoistable,xb=e.mountHoistable,yb=e.unmountHoistable,nx=e.createHoistableInstance,x3=e.prepareToCommitHoistables,bb=e.mayResourceSuspendCommit,_b=e.preloadResource,y3=e.suspendResource,ba=e.supportsSingletons,rx=e.resolveSingletonInstance,la=e.acquireSingletonInstance,Da=e.releaseSingletonInstance,Sb=e.isHostSingletonType,Rh=e.isSingletonScope,ix=[],kh=-1,Su={},Qo=Math.clz32?Math.clz32:_,sx=Math.log,b3=Math.LN2,ax=256,Ph=262144,Xp=4194304,Gm=Yo.unstable_scheduleCallback,ox=Yo.unstable_cancelCallback,_3=Yo.unstable_shouldYield,wb=Yo.unstable_requestPaint,ho=Yo.unstable_now,lx=Yo.unstable_ImmediatePriority,S3=Yo.unstable_UserBlockingPriority,Wm=Yo.unstable_NormalPriority,cx=Yo.unstable_IdlePriority,Mb=Yo.log,w3=Yo.unstable_setDisableYieldValue,Ih=null,Jo=null,qs=typeof Object.is=="function"?Object.is:Z,ux=typeof reportError=="function"?reportError:function(m){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var x=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof m=="object"&&m!==null&&typeof m.message=="string"?String(m.message):String(m),error:m});if(!window.dispatchEvent(x))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",m);return}console.error(m)},BE=Object.prototype.hasOwnProperty,dx,wu,$m=!1,Tb=new WeakMap,yd=[],Mu=0,Li=null,qm=0,lc=[],El=0,cc=null,Ka=1,zc="",Oa=g(null),bd=g(null),Za=g(null),Xm=g(null),_a=null,cs=null,Fr=!1,Tu=null,Ro=!1,fx=Error(i(519)),uc=g(null),$i=null,jc=null,M3=typeof AbortController<"u"?AbortController:function(){var m=[],x=this.signal={aborted:!1,addEventListener:function(C,k){m.push(k)}};this.abort=function(){x.aborted=!0,m.forEach(function(C){return C()})}},La=Yo.unstable_scheduleCallback,HE=Yo.unstable_NormalPriority,us={$$typeof:sc,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Ym=null,Ei=null,po=!1,dc=!1,hx=!1,mf=0,Yp=null,Eb=0,_d=0,Sa=null,fc=Gn.S;Gn.S=function(m,x){Fh=ho(),typeof x=="object"&&x!==null&&typeof x.then=="function"&&dt(m,x),fc!==null&&fc(m,x)};var gf=g(null),wa=Error(i(460)),px=Error(i(474)),hc=Error(i(542)),Eu={then:function(){}},ko=null,vf=null,Dh=0,Qa=Pt(!0),Cb=Pt(!1),Ja=[],Cu=0,Oh=0,Cl=!1,mx=!1,Lh=g(null),xf=g(0),el=g(null),tl=null,zs=g(0),Sd=0,vr=null,Bn=null,or=null,wr=!1,_r=!1,Kr=!1,mo=0,pc=0,Fc=null,Ab=0,Al={readContext:ae,use:gs,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};Al.useEffectEvent=Zt;var Ms={readContext:ae,use:gs,useCallback:function(m,x){return Nr().memoizedState=[m,x===void 0?null:x],m},useContext:ae,useEffect:ei,useImperativeHandle:function(m,x,C){C=C!=null?C.concat([m]):null,$o(4194308,4,Wr.bind(null,x,m),C)},useLayoutEffect:function(m,x){return $o(4194308,4,m,x)},useInsertionEffect:function(m,x){$o(4,2,m,x)},useMemo:function(m,x){var C=Nr();x=x===void 0?null:x;var k=m();if(Kr){G(!0);try{m()}finally{G(!1)}}return C.memoizedState=[k,x],k},useReducer:function(m,x,C){var k=Nr();if(C!==void 0){var $=C(x);if(Kr){G(!0);try{C(x)}finally{G(!1)}}}else $=x;return k.memoizedState=k.baseState=$,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:m,lastRenderedState:$},k.queue=m,m=m.dispatch=ys.bind(null,vr,m),[k.memoizedState,m]},useRef:function(m){var x=Nr();return m={current:m},x.memoizedState=m},useState:function(m){m=xl(m);var x=m.queue,C=_l.bind(null,vr,x);return x.dispatch=C,[m.memoizedState,C]},useDebugValue:bl,useDeferredValue:function(m,x){var C=Nr();return hi(C,m,x)},useTransition:function(){var m=xl(!1);return m=nd.bind(null,vr,m.queue,!0,!1),Nr().memoizedState=m,[!1,m]},useSyncExternalStore:function(m,x,C){var k=vr,$=Nr();if(Fr){if(C===void 0)throw Error(i(407));C=C()}else{if(C=x(),Mr===null)throw Error(i(349));(Ur&127)!==0||Ii(k,x,C)}$.memoizedState=C;var ee={value:C,getSnapshot:x};return $.queue=ee,ei(co.bind(null,k,ee,m),[m]),k.flags|=2048,xs(9,{destroy:void 0},$a.bind(null,k,ee,C,x),null),C},useId:function(){var m=Nr(),x=Mr.identifierPrefix;if(Fr){var C=zc,k=Ka;C=(k&~(1<<32-Qo(k)-1)).toString(32)+C,x="_"+x+"R_"+C,C=mo++,0<C&&(x+="H"+C.toString(32)),x+="_"}else C=Ab++,x="_"+x+"r_"+C.toString(32)+"_";return m.memoizedState=x},useHostTransitionStatus:Qd,useFormState:Yl,useActionState:Yl,useOptimistic:function(m){var x=Nr();x.memoizedState=x.baseState=m;var C={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return x.queue=C,x=Tp.bind(null,vr,!0,C),C.dispatch=x,[m,x]},useMemoCache:Rs,useCacheRefresh:function(){return Nr().memoizedState=Hs.bind(null,vr)},useEffectEvent:function(m){var x=Nr(),C={impl:m};return x.memoizedState=C,function(){if((Ir&2)!==0)throw Error(i(440));return C.impl.apply(void 0,arguments)}}},Au={readContext:ae,use:gs,useCallback:Kl,useContext:ae,useEffect:zr,useImperativeHandle:To,useInsertionEffect:bi,useLayoutEffect:Di,useMemo:ga,useReducer:vs,useRef:Wo,useState:function(){return vs(Pi)},useDebugValue:bl,useDeferredValue:function(m,x){var C=en();return vh(C,Bn.memoizedState,m,x)},useTransition:function(){var m=vs(Pi)[0],x=en().memoizedState;return[typeof m=="boolean"?m:Rn(m),x]},useSyncExternalStore:ks,useId:fo,useHostTransitionStatus:Qd,useFormState:qa,useActionState:qa,useOptimistic:function(m,x){var C=en();return uo(C,Bn,m,x)},useMemoCache:Rs,useCacheRefresh:Gi};Au.useEffectEvent=mr;var yf={readContext:ae,use:gs,useCallback:Kl,useContext:ae,useEffect:zr,useImperativeHandle:To,useInsertionEffect:bi,useLayoutEffect:Di,useMemo:ga,useReducer:di,useRef:Wo,useState:function(){return di(Pi)},useDebugValue:bl,useDeferredValue:function(m,x){var C=en();return Bn===null?hi(C,m,x):vh(C,Bn.memoizedState,m,x)},useTransition:function(){var m=di(Pi)[0],x=en().memoizedState;return[typeof m=="boolean"?m:Rn(m),x]},useSyncExternalStore:ks,useId:fo,useHostTransitionStatus:Qd,useFormState:yl,useActionState:yl,useOptimistic:function(m,x){var C=en();return Bn!==null?uo(C,Bn,m,x):(C.baseState=m,[m,C.queue.dispatch])},useMemoCache:Rs,useCacheRefresh:Gi};yf.useEffectEvent=mr;var Km={enqueueSetState:function(m,x,C){m=m._reactInternals;var k=os(),$=fn(k);$.payload=x,C!=null&&($.callback=C),x=Ht(m,$,k),x!==null&&(Ss(x,m,k),In(x,m,k))},enqueueReplaceState:function(m,x,C){m=m._reactInternals;var k=os(),$=fn(k);$.tag=1,$.payload=x,C!=null&&($.callback=C),x=Ht(m,$,k),x!==null&&(Ss(x,m,k),In(x,m,k))},enqueueForceUpdate:function(m,x){m=m._reactInternals;var C=os(),k=fn(C);k.tag=2,x!=null&&(k.callback=x),x=Ht(m,k,C),x!==null&&(Ss(x,m,C),In(x,m,C))}},Po=Error(i(461)),es=!1,zh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},js=!1,Fs=!1,Kp=!1,Nb=typeof WeakSet=="function"?WeakSet:Set,Xs=null,Ts=null,Ys=!1,Ci=null,Nl=8192,Zp={getCacheForType:function(m){var x=ae(us),C=x.data.get(m);return C===void 0&&(C=m(),x.data.set(m,C)),C},cacheSignal:function(){return ae(us).controller.signal}},mc=0,Qp=1,Jp=2,Zm=3,bf=4;if(typeof Symbol=="function"&&Symbol.for){var jh=Symbol.for;mc=jh("selector.component"),Qp=jh("selector.has_pseudo_class"),Jp=jh("selector.role"),Zm=jh("selector.test_id"),bf=jh("selector.text")}var Rl=typeof WeakMap=="function"?WeakMap:Map,Ir=0,Mr=null,Dr=null,Ur=0,Ai=0,ca=null,Uc=!1,_f=!1,Sf=!1,Nu=0,Es=0,wd=0,wf=0,e0=0,Io=0,t0=0,Qm=null,nl=null,gx=!1,Jm=0,Fh=0,Mf=1/0,eg=null,Md=null,ua=0,Td=null,Uh=null,Ru=0,n0=0,vx=null,Rb=null,ai=0,tg=null;return Sr.attemptContinuousHydration=function(m){if(m.tag===13||m.tag===31){var x=Ot(m,67108864);x!==null&&Ss(x,m,67108864),Om(m,67108864)}},Sr.attemptHydrationAtCurrentPriority=function(m){if(m.tag===13||m.tag===31){var x=os();x=F(x);var C=Ot(m,x);C!==null&&Ss(C,m,x),Om(m,x)}},Sr.attemptSynchronousHydration=function(m){switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var x=w(m.pendingLanes);if(x!==0){for(m.pendingLanes|=2,m.entangledLanes|=2;x;){var C=1<<31-Qo(x);m.entanglements[1]|=C,x&=~C}Xe(m),(Ir&6)===0&&(Mf=ho()+500,Ae(0))}}break;case 31:case 13:x=Ot(m,2),x!==null&&Ss(x,m,2),Ov(),Om(m,2)}},Sr.batchedUpdates=function(m,x){return m(x)},Sr.createComponentSelector=function(m){return{$$typeof:mc,value:m}},Sr.createContainer=function(m,x,C,k,$,ee,Ce,at,It,Wt){return cf(m,x,!1,null,C,k,ee,null,Ce,at,It,Wt)},Sr.createHasPseudoClassSelector=function(m){return{$$typeof:Qp,value:m}},Sr.createHydrationContainer=function(m,x,C,k,$,ee,Ce,at,It,Wt,ln,qt,yn,dr){var Ks;return m=cf(C,k,!0,m,$,ee,at,dr,It,Wt,ln,qt),m.context=Bv(null),C=m.current,k=os(),k=F(k),$=fn(k),$.callback=(Ks=x)!=null?Ks:null,Ht(C,$,k),x=k,m.current.lanes=x,P(m,x),Xe(m),m},Sr.createPortal=function(m,x,C){var k=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:wh,key:k==null?null:""+k,children:m,containerInfo:x,implementation:C}},Sr.createRoleSelector=function(m){return{$$typeof:Jp,value:m}},Sr.createTestNameSelector=function(m){return{$$typeof:Zm,value:m}},Sr.createTextSelector=function(m){return{$$typeof:bf,value:m}},Sr.defaultOnCaughtError=function(m){console.error(m)},Sr.defaultOnRecoverableError=function(m){ux(m)},Sr.defaultOnUncaughtError=function(m){ux(m)},Sr.deferredUpdates=function(m){var x=Gn.T,C=ac();try{return jr(32),Gn.T=null,m()}finally{jr(C),Gn.T=x}},Sr.discreteUpdates=function(m,x,C,k,$){var ee=Gn.T,Ce=ac();try{return jr(2),Gn.T=null,m(x,C,k,$)}finally{jr(Ce),Gn.T=ee,Ir===0&&(Mf=ho()+500)}},Sr.findAllNodes=Xo,Sr.findBoundingRects=function(m,x){if(!ya)throw Error(i(363));x=Xo(m,x),m=[];for(var C=0;C<x.length;C++)m.push(Yv(x[C]));for(x=m.length-1;0<x;x--){C=m[x];for(var k=C.x,$=k+C.width,ee=C.y,Ce=ee+C.height,at=x-1;0<=at;at--)if(x!==at){var It=m[at],Wt=It.x,ln=Wt+It.width,qt=It.y,yn=qt+It.height;if(k>=Wt&&ee>=qt&&$<=ln&&Ce<=yn){m.splice(x,1);break}else if(k!==Wt||C.width!==It.width||yn<ee||qt>Ce){if(!(ee!==qt||C.height!==It.height||ln<k||Wt>$)){Wt>k&&(It.width+=Wt-k,It.x=k),ln<$&&(It.width=$-Wt),m.splice(x,1);break}}else{qt>ee&&(It.height+=qt-ee,It.y=ee),yn<Ce&&(It.height=Ce-qt),m.splice(x,1);break}}}return m},Sr.findHostInstance=Dm,Sr.findHostInstanceWithNoPortals=function(m){return m=o(m),m=m!==null?c(m):null,m===null?null:Vp(m.stateNode)},Sr.findHostInstanceWithWarning=function(m){return Dm(m)},Sr.flushPassiveEffects=bu,Sr.flushSyncFromReconciler=function(m){var x=Ir;Ir|=1;var C=Gn.T,k=ac();try{if(jr(2),Gn.T=null,m)return m()}finally{jr(k),Gn.T=C,Ir=x,(Ir&6)===0&&Ae(0)}},Sr.flushSyncWork=Ov,Sr.focusWithin=function(m,x){if(!ya)throw Error(i(363));for(m=rf(m),x=Lp(m,x),x=Array.from(x),m=0;m<x.length;){var C=x[m++],k=C.tag;if(!ff(C)){if((k===5||k===26||k===27)&&xd(C.stateNode))return!0;for(C=C.child;C!==null;)x.push(C),C=C.sibling}}return!1},Sr.getFindAllNodesFailureDescription=function(m,x){if(!ya)throw Error(i(363));var C=0,k=[];m=[rf(m),0];for(var $=0;$<m.length;){var ee=m[$++],Ce=ee.tag,at=m[$++],It=x[at];if((Ce!==5&&Ce!==26&&Ce!==27||!ff(ee))&&(sf(ee,It)&&(k.push(Op(It)),at++,at>C&&(C=at)),at<x.length))for(ee=ee.child;ee!==null;)m.push(ee,at),ee=ee.sibling}if(C<x.length){for(m=[];C<x.length;C++)m.push(Op(x[C]));return`findAllNodes was able to match part of the selector:
  `+(k.join(" > ")+`

No matching component was found for:
  `)+m.join(" > ")}return null},Sr.getPublicRootInstance=function(m){if(m=m.current,!m.child)return null;switch(m.child.tag){case 27:case 5:return Vp(m.child.stateNode);default:return m.child.stateNode}},Sr.injectIntoDevTools=function(){var m={bundleType:0,version:Wy,rendererPackageName:jm,currentDispatcherRef:Gn,reconcilerVersion:"19.2.0"};if(Hp!==null&&(m.rendererConfig=Hp),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")m=!1;else{var x=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(x.isDisabled||!x.supportsFiber)m=!0;else{try{Ih=x.inject(m),Jo=x}catch{}m=!!x.checkDCE}}return m},Sr.isAlreadyRendering=function(){return(Ir&6)!==0},Sr.observeVisibleRects=function(m,x,C,k){if(!ya)throw Error(i(363));m=Xo(m,x);var $=Kv(m,C,k).disconnect;return{disconnect:function(){$()}}},Sr.shouldError=function(){return null},Sr.shouldSuspend=function(){return!1},Sr.startHostTransition=function(m,x,C,k){if(m.tag!==5)throw Error(i(476));var $=rd(m).queue;nd(m,$,x,Ah,C===null?r:function(){var ee=rd(m);return ee.next===null&&(ee=m.alternate.memoizedState),va(m,ee.next.queue,{},os()),C(k)})},Sr.updateContainer=function(m,x,C,k){var $=x.current,ee=os();return Vy($,ee,m,x,C,k),ee},Sr.updateContainerSync=function(m,x,C,k){return Vy(x.current,2,m,x,C,k),2},Sr},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})(Ij)),Ij.exports}var Oj;function EEe(){return Oj||(Oj=1,Pj.exports=TEe()),Pj.exports}var CEe=EEe();const AEe=MEe(CEe);function NEe(t){const e=AEe(t);return e.injectIntoDevTools(),e}const MK=0,cy={},REe=/^three(?=[A-Z])/,kE=t=>`${t[0].toUpperCase()}${t.slice(1)}`;let kEe=0;const PEe=t=>typeof t=="function";function IEe(t){if(PEe(t)){const e=`${kEe++}`;return cy[e]=t,e}else Object.assign(cy,t)}function TK(t,e){const n=kE(t),r=cy[n];if(t!=="primitive"&&!r)throw new Error(`R3F: ${n} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(t==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function DEe(t,e,n){var r;return t=kE(t)in cy?t:t.replace(REe,""),TK(t,e),t==="primitive"&&(r=e.object)!=null&&r.__r3f&&delete e.object.__r3f,w5(e.object,n,t,e)}function OEe(t){if(!t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?T5(t.parent,t):Sc(t.object)&&(t.object.visible=!1),t.isHidden=!0,Oy(t)}}function EK(t){if(t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?M5(t.parent,t):Sc(t.object)&&t.props.visible!==!1&&(t.object.visible=!0),t.isHidden=!1,Oy(t)}}function P9(t,e,n){const r=e.root.getState();if(!(!t.parent&&t.object!==r.scene)){if(!e.object){var i,s;const a=cy[kE(e.type)];e.object=(i=e.props.object)!=null?i:new a(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(N0(e.object,e.props),e.props.attach)M5(t,e);else if(Sc(e.object)&&Sc(t.object)){const a=t.object.children.indexOf(n==null?void 0:n.object);if(n&&a!==-1){const o=t.object.children.indexOf(e.object);if(o!==-1){t.object.children.splice(o,1);const l=o<a?a-1:a;t.object.children.splice(l,0,e.object)}else e.object.parent=t.object,t.object.children.splice(a,0,e.object),e.object.dispatchEvent({type:"added"}),t.object.dispatchEvent({type:"childadded",child:e.object})}else t.object.add(e.object)}for(const a of e.children)P9(e,a);Oy(e)}}function N6(t,e){e&&(e.parent=t,t.children.push(e),P9(t,e))}function Lj(t,e,n){if(!e||!n)return;e.parent=t;const r=t.children.indexOf(n);r!==-1?t.children.splice(r,0,e):t.children.push(e),P9(t,e,n)}function CK(t){if(typeof t.dispose=="function"){const e=()=>{try{t.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():JR.unstable_scheduleCallback(JR.unstable_IdlePriority,e)}}function t7(t,e,n){if(!e)return;e.parent=null;const r=t.children.indexOf(e);r!==-1&&t.children.splice(r,1),e.props.attach?T5(t,e):Sc(e.object)&&Sc(t.object)&&(t.object.remove(e.object),gEe(gK(e),e.object));const i=e.props.dispose!==null&&n!==!1;for(let s=e.children.length-1;s>=0;s--){const a=e.children[s];t7(e,a,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&CK(e.object),n===void 0&&Oy(e)}function LEe(t,e){for(const n of[t,t.alternate])if(n!==null)if(typeof n.ref=="function"){n.refCleanup==null||n.refCleanup();const r=n.ref(e);typeof r=="function"&&(n.refCleanup=r)}else n.ref&&(n.ref.current=e)}const VM=[];function zEe(){for(const[n]of VM){const r=n.parent;if(r){n.props.attach?T5(r,n):Sc(n.object)&&Sc(r.object)&&r.object.remove(n.object);for(const i of n.children)i.props.attach?T5(n,i):Sc(i.object)&&Sc(n.object)&&n.object.remove(i.object)}n.isHidden&&EK(n),n.object.__r3f&&delete n.object.__r3f,n.type!=="primitive"&&CK(n.object)}for(const[n,r,i]of VM){n.props=r;const s=n.parent;if(s){var t,e;const a=cy[kE(n.type)];n.object=(t=n.props.object)!=null?t:new a(...(e=n.props.args)!=null?e:[]),n.object.__r3f=n,LEe(i,n.object),N0(n.object,n.props),n.props.attach?M5(s,n):Sc(n.object)&&Sc(s.object)&&s.object.add(n.object);for(const o of n.children)o.props.attach?M5(n,o):Sc(o.object)&&Sc(n.object)&&n.object.add(o.object);Oy(n)}}VM.length=0}const R6=()=>{},zj={};let yM=MK;const jEe=0,FEe=4,n7=NEe({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:DEe,removeChild:t7,appendChild:N6,appendInitialChild:N6,insertBefore:Lj,appendChildToContainer(t,e){const n=t.getState().scene.__r3f;!e||!n||N6(n,e)},removeChildFromContainer(t,e){const n=t.getState().scene.__r3f;!e||!n||t7(n,e)},insertInContainerBefore(t,e,n){const r=t.getState().scene.__r3f;!e||!n||!r||Lj(r,e,n)},getRootHostContext:()=>zj,getChildHostContext:()=>zj,commitUpdate(t,e,n,r,i){var s,a,o;TK(e,r);let l=!1;if((t.type==="primitive"&&n.object!==r.object||((s=r.args)==null?void 0:s.length)!==((a=n.args)==null?void 0:a.length)||(o=r.args)!=null&&o.some((d,h)=>{var g;return d!==((g=n.args)==null?void 0:g[h])}))&&(l=!0),l)VM.push([t,{...r},i]);else{const d=fEe(t,r);Object.keys(d).length&&(Object.assign(t.props,d),N0(t.object,d))}(i.sibling===null||(i.flags&FEe)===jEe)&&zEe()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:t=>t==null?void 0:t.object,prepareForCommit:()=>null,preparePortalMount:t=>w5(t.getState().scene,t,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:OEe,unhideInstance:EK,createTextInstance:R6,hideTextInstance:R6,unhideTextInstance:R6,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:T.createContext(null),setCurrentUpdatePriority(t){yM=t},getCurrentUpdatePriority(){return yM},resolveUpdatePriority(){var t;if(yM!==MK)return yM;switch(typeof window<"u"&&((t=window.event)==null?void 0:t.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return SEe;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return bEe;default:return _Ee}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:wEe.version,applyViewTransitionName(t,e,n){},restoreViewTransitionName(t,e){},cancelViewTransitionName(t,e,n){},cancelRootViewTransitionName(t){},restoreRootViewTransitionName(t){},InstanceMeasurement:null,measureInstance:t=>null,wasInstanceInViewport:t=>!0,hasInstanceChanged:(t,e)=>!1,hasInstanceAffectedParent:(t,e)=>!1,suspendOnActiveViewTransition(t,e){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(t){},createViewTransitionInstance:t=>null,getCurrentGestureOffset(t){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(t,e){return t},cloneMutableTextInstance(t){return t},cloneRootViewTransitionContainer(t){throw new Error("Not implemented.")},removeRootViewTransitionClone(t,e){throw new Error("Not implemented.")},createFragmentInstance:t=>null,updateFragmentInstanceFiber(t,e){},commitNewChildToFragmentInstance(t,e){},deleteChildFromFragmentInstance(t,e){},measureClonedInstance:t=>null,maySuspendCommitOnUpdate:(t,e,n)=>!1,maySuspendCommitInSyncRender:(t,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(t,e)=>null}),hv=new Map,Zx={objects:"shallow",strict:!1};function UEe(t,e){if(!e&&typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:n,height:r,top:i,left:s}=t.parentElement.getBoundingClientRect();return{width:n,height:r,top:i,left:s}}else if(!e&&typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function BEe(t){const e=hv.get(t),n=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||xEe(s7,Fj),a=n||n7.createContainer(s,yEe,null,!1,null,"",i,i,i,null);e||hv.set(t,{fiber:a,store:s});let o,l,c=!1,d=null;return{async configure(h={}){let g;d=new Promise(j=>g=j);let{gl:v,size:b,scene:_,events:w,onCreated:S,shadows:E=!1,linear:A=!1,flat:N=!1,legacy:D=!1,orthographic:P=!1,frameloop:L="always",dpr:R=[1,2],performance:O,raycaster:W,camera:F,onPointerMissed:V}=h,G=s.getState(),Z=G.gl;if(!G.gl){const j={canvas:t,powerPreference:"high-performance",antialias:!0,alpha:!0},X=typeof v=="function"?await v(j):v;kj(X)?Z=X:Z=new fK({...j,...v}),G.set({gl:Z})}let B=G.raycaster;B||G.set({raycaster:B=new nK});const{params:q,...K}=W||{};if(Qs.equ(K,B,Zx)||N0(B,{...K}),Qs.equ(q,B.params,Zx)||N0(B,{params:{...B.params,...q}}),!G.camera||G.camera===l&&!Qs.equ(l,F,Zx)){l=F;const j=F==null?void 0:F.isCamera,X=j?F:P?new Hd(0,0,0,0,.1,1e3):new ea(75,0,.1,1e3);j||(X.position.z=5,F&&(N0(X,F),X.manual||("aspect"in F||"left"in F||"right"in F||"bottom"in F||"top"in F)&&(X.manual=!0,X.updateProjectionMatrix())),!G.camera&&!(F!=null&&F.rotation)&&X.lookAt(0,0,0)),G.set({camera:X}),B.camera=X}if(!G.scene){let j;_!=null&&_.isScene?(j=_,w5(j,s,"",{})):(j=new t9,w5(j,s,"",{}),_&&N0(j,_)),G.set({scene:j})}w&&!G.events.handlers&&G.set({events:w(s)});const Y=UEe(t,b);if(Qs.equ(Y,G.size,Zx)||G.setSize(Y.width,Y.height,Y.top,Y.left),R&&G.viewport.dpr!==yK(R)&&G.setDpr(R),G.frameloop!==L&&G.setFrameloop(L),G.onPointerMissed||G.set({onPointerMissed:V}),O&&!Qs.equ(O,G.performance,Zx)&&G.set(j=>({performance:{...j.performance,...O}})),!G.xr){var Q;const j=(ie,ne)=>{const re=s.getState();re.frameloop!=="never"&&Fj(ie,!0,re,ne)},X=()=>{const ie=s.getState();ie.gl.xr.enabled=ie.gl.xr.isPresenting,ie.gl.xr.setAnimationLoop(ie.gl.xr.isPresenting?j:null),ie.gl.xr.isPresenting||s7(ie)},H={connect(){const ie=s.getState().gl;ie.xr.addEventListener("sessionstart",X),ie.xr.addEventListener("sessionend",X)},disconnect(){const ie=s.getState().gl;ie.xr.removeEventListener("sessionstart",X),ie.xr.removeEventListener("sessionend",X)}};typeof((Q=Z.xr)==null?void 0:Q.addEventListener)=="function"&&H.connect(),G.set({xr:H})}if(Z.shadowMap){const j=Z.shadowMap.enabled,X=Z.shadowMap.type;if(Z.shadowMap.enabled=!!E,Qs.boo(E))Z.shadowMap.type=O_;else if(Qs.str(E)){var U;const H={basic:SX,percentage:S1,soft:O_,variance:Pg};Z.shadowMap.type=(U=H[E])!=null?U:O_}else Qs.obj(E)&&Object.assign(Z.shadowMap,E);(j!==Z.shadowMap.enabled||X!==Z.shadowMap.type)&&(Z.shadowMap.needsUpdate=!0)}return ii.enabled=!D,c||(Z.outputColorSpace=A?im:cl,Z.toneMapping=N?nu:WT),G.legacy!==D&&G.set(()=>({legacy:D})),G.linear!==A&&G.set(()=>({linear:A})),G.flat!==N&&G.set(()=>({flat:N})),v&&!Qs.fun(v)&&!kj(v)&&!Qs.equ(v,Z,Zx)&&N0(Z,v),o=S,c=!0,g(),this},render(h){return!c&&!d&&this.configure(),d.then(()=>{n7.updateContainer(p.jsx(HEe,{store:s,children:h,onCreated:o,rootElement:t}),a,null,()=>{})}),s},unmount(){AK(t)}}}function HEe({store:t,children:e,onCreated:n,rootElement:r}){return Cw(()=>{const i=t.getState();i.set(s=>({internal:{...s.internal,active:!0}})),n&&n(i),t.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),p.jsx(SK.Provider,{value:t,children:e})}function AK(t,e){const n=hv.get(t),r=n==null?void 0:n.fiber;if(r){const i=n==null?void 0:n.store.getState();i&&(i.internal.active=!1),n7.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,a,o,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(o=i.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),cEe(i.scene),hv.delete(t)}catch{}},500)})}}const VEe=new Set,GEe=new Set,WEe=new Set;function k6(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function $_(t,e){switch(t){case"before":return k6(VEe,e);case"after":return k6(GEe,e);case"tail":return k6(WEe,e)}}let P6,I6;function r7(t,e,n){let r=e.clock.getDelta();e.frameloop==="never"&&typeof t=="number"&&(r=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),P6=e.internal.subscribers;for(let i=0;i<P6.length;i++)I6=P6[i],I6.ref.current(I6.store.getState(),r,n);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let E5=!1,i7=!1,D6,jj,Qx;function NK(t){jj=requestAnimationFrame(NK),E5=!0,D6=0,$_("before",t),i7=!0;for(const n of hv.values()){var e;Qx=n.store.getState(),Qx.internal.active&&(Qx.frameloop==="always"||Qx.internal.frames>0)&&!((e=Qx.gl.xr)!=null&&e.isPresenting)&&(D6+=r7(t,Qx))}if(i7=!1,$_("after",t),D6===0)return $_("tail",t),E5=!1,cancelAnimationFrame(jj)}function s7(t,e=1){var n;if(!t)return hv.forEach(r=>s7(r.store.getState(),e));(n=t.gl.xr)!=null&&n.isPresenting||!t.internal.active||t.frameloop==="never"||(e>1?t.internal.frames=Math.min(60,t.internal.frames+e):i7?t.internal.frames=2:t.internal.frames=1,E5||(E5=!0,requestAnimationFrame(NK)))}function Fj(t,e=!0,n,r){if(e&&$_("before",t),n)r7(t,n,r);else for(const i of hv.values())r7(t,i.store.getState());e&&$_("after",t)}const O6={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function $Ee(t){const{handlePointer:e}=vEe(t);return{priority:1,enabled:!0,compute(n,r,i){r.pointer.set(n.offsetX/r.size.width*2-1,-(n.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(O6).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{const{set:r,events:i}=t.getState();if(i.disconnect==null||i.disconnect(),r(s=>({events:{...s.events,connected:n}})),i.handlers)for(const s in i.handlers){const a=i.handlers[s],[o,l]=O6[s];n.addEventListener(o,a,{passive:l})}},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){if(r.handlers)for(const i in r.handlers){const s=r.handlers[i],[a]=O6[i];r.connected.removeEventListener(a,s)}n(i=>({events:{...i.events,connected:void 0}}))}}}}function Uj(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function qEe({debounce:t,scroll:e,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,a]=T.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),o=T.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=T.useRef(!1);T.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[h,g,v]=T.useMemo(()=>{const S=()=>{if(!o.current.element)return;const{left:E,top:A,width:N,height:D,bottom:P,right:L,x:R,y:O}=o.current.element.getBoundingClientRect(),W={left:E,top:A,width:N,height:D,bottom:P,right:L,x:R,y:O};o.current.element instanceof HTMLElement&&r&&(W.height=o.current.element.offsetHeight,W.width=o.current.element.offsetWidth),Object.freeze(W),d.current&&!ZEe(o.current.lastBounds,W)&&a(o.current.lastBounds=W)};return[S,c?Uj(S,c):S,l?Uj(S,l):S]},[a,r,l,c]);function b(){o.current.scrollContainers&&(o.current.scrollContainers.forEach(S=>S.removeEventListener("scroll",v,!0)),o.current.scrollContainers=null),o.current.resizeObserver&&(o.current.resizeObserver.disconnect(),o.current.resizeObserver=null),o.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",o.current.orientationHandler))}function _(){o.current.element&&(o.current.resizeObserver=new i(v),o.current.resizeObserver.observe(o.current.element),e&&o.current.scrollContainers&&o.current.scrollContainers.forEach(S=>S.addEventListener("scroll",v,{capture:!0,passive:!0})),o.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",o.current.orientationHandler))}const w=S=>{!S||S===o.current.element||(b(),o.current.element=S,o.current.scrollContainers=RK(S),_())};return YEe(v,!!e),XEe(g),T.useEffect(()=>{b(),_()},[e,v,g]),T.useEffect(()=>b,[]),[w,s,h]}function XEe(t){T.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function YEe(t,e){T.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function RK(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(t);return[n,r,i].some(s=>s==="auto"||s==="scroll")&&e.push(t),[...e,...RK(t.parentElement)]}const KEe=["x","y","top","bottom","left","right","width","height"],ZEe=(t,e)=>KEe.every(n=>t[n]===e[n]);function QEe({ref:t,children:e,fallback:n,resize:r,style:i,gl:s,events:a=$Ee,eventSource:o,eventPrefix:l,shadows:c,linear:d,flat:h,legacy:g,orthographic:v,frameloop:b,dpr:_,performance:w,raycaster:S,camera:E,scene:A,onPointerMissed:N,onCreated:D,...P}){T.useMemo(()=>IEe(FTe),[]);const L=aEe(),[R,O]=qEe({scroll:!0,debounce:{scroll:50,resize:0},...r}),W=T.useRef(null),F=T.useRef(null);T.useImperativeHandle(t,()=>W.current);const V=xK(N),[G,Z]=T.useState(!1),[B,q]=T.useState(!1);if(G)throw G;if(B)throw B;const K=T.useRef(null);Cw(()=>{const Q=W.current;if(O.width>0&&O.height>0&&Q){K.current||(K.current=BEe(Q));async function U(){await K.current.configure({gl:s,scene:A,events:a,shadows:c,linear:d,flat:h,legacy:g,orthographic:v,frameloop:b,dpr:_,performance:w,raycaster:S,camera:E,size:O,onPointerMissed:(...j)=>V.current==null?void 0:V.current(...j),onCreated:j=>{j.events.connect==null||j.events.connect(o?iEe(o)?o.current:o:F.current),l&&j.setEvents({compute:(X,H)=>{const ie=X[l+"X"],ne=X[l+"Y"];H.pointer.set(ie/H.size.width*2-1,-(ne/H.size.height)*2+1),H.raycaster.setFromCamera(H.pointer,H.camera)}}),D==null||D(j)}}),K.current.render(p.jsx(L,{children:p.jsx(lEe,{set:q,children:p.jsx(T.Suspense,{fallback:p.jsx(oEe,{set:Z}),children:e??null})})}))}U()}}),T.useEffect(()=>{const Q=W.current;if(Q)return()=>AK(Q)},[]);const Y=o?"none":"auto";return p.jsx("div",{ref:F,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:Y,...i},...P,children:p.jsx("div",{ref:R,style:{width:"100%",height:"100%"},children:p.jsx("canvas",{ref:W,style:{display:"block"},children:n})})})}function JEe(t){return p.jsx(pK,{children:p.jsx(QEe,{...t})})}function lh(){return lh=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},lh.apply(null,arguments)}const Aw=new Fe,I9=new Fe,eCe=new Fe,Bj=new zt;function tCe(t,e,n){const r=Aw.setFromMatrixPosition(t.matrixWorld);r.project(e);const i=n.width/2,s=n.height/2;return[r.x*i+i,-(r.y*s)+s]}function nCe(t,e){const n=Aw.setFromMatrixPosition(t.matrixWorld),r=I9.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),s=e.getWorldDirection(eCe);return i.angleTo(s)>Math.PI/2}function rCe(t,e,n,r){const i=Aw.setFromMatrixPosition(t.matrixWorld),s=i.clone();s.project(e),Bj.set(s.x,s.y),n.setFromCamera(Bj,e);const a=n.intersectObjects(r,!0);if(a.length){const o=a[0].distance;return i.distanceTo(n.ray.origin)<o}return!0}function iCe(t,e){if(e instanceof Hd)return e.zoom;if(e instanceof ea){const n=Aw.setFromMatrixPosition(t.matrixWorld),r=I9.setFromMatrixPosition(e.matrixWorld),i=e.fov*Math.PI/180,s=n.distanceTo(r);return 1/(2*Math.tan(i/2)*s)}else return 1}function sCe(t,e,n){if(e instanceof ea||e instanceof Hd){const r=Aw.setFromMatrixPosition(t.matrixWorld),i=I9.setFromMatrixPosition(e.matrixWorld),s=r.distanceTo(i),a=(n[1]-n[0])/(e.far-e.near),o=n[1]-a*e.far;return Math.round(a*s+o)}}const a7=t=>Math.abs(t)<1e-10?0:t;function kK(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=a7(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const aCe=(t=>e=>kK(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),oCe=(t=>(e,n)=>kK(e,t(n),"translate(-50%,-50%)"))(t=>[1/t,1/t,1/t,1,-1/t,-1/t,-1/t,-1,1/t,1/t,1/t,1,1,1,1,1]);function lCe(t){return t&&typeof t=="object"&&"current"in t}const D9=T.forwardRef(({children:t,eps:e=.001,style:n,className:r,prepend:i,center:s,fullscreen:a,portal:o,distanceFactor:l,sprite:c=!1,transform:d=!1,occlude:h,onOcclude:g,castShadow:v,receiveShadow:b,material:_,geometry:w,zIndexRange:S=[16777271,0],calculatePosition:E=tCe,as:A="div",wrapperClass:N,pointerEvents:D="auto",...P},L)=>{const{gl:R,camera:O,scene:W,size:F,raycaster:V,events:G,viewport:Z}=$c(),[B]=T.useState(()=>document.createElement(A)),q=T.useRef(null),K=T.useRef(null),Y=T.useRef(0),Q=T.useRef([0,0]),U=T.useRef(null),j=T.useRef(null),X=(o==null?void 0:o.current)||G.connected||R.domElement.parentNode,H=T.useRef(null),ie=T.useRef(!1),ne=T.useMemo(()=>h&&h!=="blending"||Array.isArray(h)&&h.length&&lCe(h[0]),[h]);T.useLayoutEffect(()=>{const we=R.domElement;h&&h==="blending"?(we.style.zIndex=`${Math.floor(S[0]/2)}`,we.style.position="absolute",we.style.pointerEvents="none"):(we.style.zIndex=null,we.style.position=null,we.style.pointerEvents=null)},[h]),T.useLayoutEffect(()=>{if(K.current){const we=q.current=OF.createRoot(B);if(W.updateMatrixWorld(),d)B.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const pe=E(K.current,O,F);B.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${pe[0]}px,${pe[1]}px,0);transform-origin:0 0;`}return X&&(i?X.prepend(B):X.appendChild(B)),()=>{X&&X.removeChild(B),we.unmount()}}},[X,d]),T.useLayoutEffect(()=>{N&&(B.className=N)},[N]);const re=T.useMemo(()=>d?{position:"absolute",top:0,left:0,width:F.width,height:F.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...a&&{top:-F.height/2,left:-F.width/2,width:F.width,height:F.height},...n},[n,s,a,F,d]),ue=T.useMemo(()=>({position:"absolute",pointerEvents:D}),[D]);T.useLayoutEffect(()=>{if(ie.current=!1,d){var we;(we=q.current)==null||we.render(T.createElement("div",{ref:U,style:re},T.createElement("div",{ref:j,style:ue},T.createElement("div",{ref:L,className:r,style:n,children:t}))))}else{var pe;(pe=q.current)==null||pe.render(T.createElement("div",{ref:L,style:re,className:r,children:t}))}});const le=T.useRef(!0);RE(we=>{if(K.current){O.updateMatrixWorld(),K.current.updateWorldMatrix(!0,!1);const pe=d?Q.current:E(K.current,O,F);if(d||Math.abs(Y.current-O.zoom)>e||Math.abs(Q.current[0]-pe[0])>e||Math.abs(Q.current[1]-pe[1])>e){const xe=nCe(K.current,O);let Ve=!1;ne&&(Array.isArray(h)?Ve=h.map(Re=>Re.current):h!=="blending"&&(Ve=[W]));const ye=le.current;if(Ve){const Re=rCe(K.current,O,V,Ve);le.current=Re&&!xe}else le.current=!xe;ye!==le.current&&(g?g(!le.current):B.style.display=le.current?"block":"none");const Oe=Math.floor(S[0]/2),he=h?ne?[S[0],Oe]:[Oe-1,0]:S;if(B.style.zIndex=`${sCe(K.current,O,he)}`,d){const[Re,oe]=[F.width/2,F.height/2],Ue=O.projectionMatrix.elements[5]*oe,{isOrthographicCamera:Ee,top:Pe,left:Ze,bottom:ae,right:te}=O,be=aCe(O.matrixWorldInverse),me=Ee?`scale(${Ue})translate(${a7(-(te+Ze)/2)}px,${a7((Pe+ae)/2)}px)`:`translateZ(${Ue}px)`;let ge=K.current.matrixWorld;c&&(ge=O.matrixWorldInverse.clone().transpose().copyPosition(ge).scale(K.current.scale),ge.elements[3]=ge.elements[7]=ge.elements[11]=0,ge.elements[15]=1),B.style.width=F.width+"px",B.style.height=F.height+"px",B.style.perspective=Ee?"":`${Ue}px`,U.current&&j.current&&(U.current.style.transform=`${me}${be}translate(${Re}px,${oe}px)`,j.current.style.transform=oCe(ge,1/((l||10)/400)))}else{const Re=l===void 0?1:iCe(K.current,O)*l;B.style.transform=`translate3d(${pe[0]}px,${pe[1]}px,0) scale(${Re})`}Q.current=pe,Y.current=O.zoom}}if(!ne&&H.current&&!ie.current)if(d){if(U.current){const pe=U.current.children[0];if(pe!=null&&pe.clientWidth&&pe!=null&&pe.clientHeight){const{isOrthographicCamera:xe}=O;if(xe||w)P.scale&&(Array.isArray(P.scale)?P.scale instanceof Fe?H.current.scale.copy(P.scale.clone().divideScalar(1)):H.current.scale.set(1/P.scale[0],1/P.scale[1],1/P.scale[2]):H.current.scale.setScalar(1/P.scale));else{const Ve=(l||10)/400,ye=pe.clientWidth*Ve,Oe=pe.clientHeight*Ve;H.current.scale.set(ye,Oe,1)}ie.current=!0}}}else{const pe=B.children[0];if(pe!=null&&pe.clientWidth&&pe!=null&&pe.clientHeight){const xe=1/Z.factor,Ve=pe.clientWidth*xe,ye=pe.clientHeight*xe;H.current.scale.set(Ve,ye,1),ie.current=!0}H.current.lookAt(we.camera.position)}});const fe=T.useMemo(()=>({vertexShader:d?void 0:`
          /*
            This shader is from the THREE's SpriteMaterial.
            We need to turn the backing plane into a Sprite
            (make it always face the camera) if "transfrom"
            is false.
          */
          #include <common>

          void main() {
            vec2 center = vec2(0., 1.);
            float rotation = 0.0;

            // This is somewhat arbitrary, but it seems to work well
            // Need to figure out how to derive this dynamically if it even matters
            float size = 0.03;

            vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
            vec2 scale;
            scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
            scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );

            bool isPerspective = isPerspectiveMatrix( projectionMatrix );
            if ( isPerspective ) scale *= - mvPosition.z;

            vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size;
            vec2 rotatedPosition;
            rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
            rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
            mvPosition.xy += rotatedPosition;

            gl_Position = projectionMatrix * mvPosition;
          }
      `,fragmentShader:`
        void main() {
          gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
        }
      `}),[d]);return T.createElement("group",lh({},P,{ref:K}),h&&!ne&&T.createElement("mesh",{castShadow:v,receiveShadow:b,ref:H},w||T.createElement("planeGeometry",null),_||T.createElement("shaderMaterial",{side:Xc,vertexShader:fe.vertexShader,fragmentShader:fe.fragmentShader})))}),PK=parseInt(xw.replace(/\D+/g,"")),IK=PK>=125?"uv1":"uv2";function cCe(t,e=Math.PI/3){const n=Math.cos(e),r=(1+1e-10)*100,i=[new Fe,new Fe,new Fe],s=new Fe,a=new Fe,o=new Fe,l=new Fe;function c(_){const w=~~(_.x*r),S=~~(_.y*r),E=~~(_.z*r);return`${w},${S},${E}`}const d=t.index?t.toNonIndexed():t,h=d.attributes.position,g={};for(let _=0,w=h.count/3;_<w;_++){const S=3*_,E=i[0].fromBufferAttribute(h,S+0),A=i[1].fromBufferAttribute(h,S+1),N=i[2].fromBufferAttribute(h,S+2);s.subVectors(N,A),a.subVectors(E,A);const D=new Fe().crossVectors(s,a).normalize();for(let P=0;P<3;P++){const L=i[P],R=c(L);R in g||(g[R]=[]),g[R].push(D)}}const v=new Float32Array(h.count*3),b=new Vi(v,3,!1);for(let _=0,w=h.count/3;_<w;_++){const S=3*_,E=i[0].fromBufferAttribute(h,S+0),A=i[1].fromBufferAttribute(h,S+1),N=i[2].fromBufferAttribute(h,S+2);s.subVectors(N,A),a.subVectors(E,A),o.crossVectors(s,a).normalize();for(let D=0;D<3;D++){const P=i[D],L=c(P),R=g[L];l.set(0,0,0);for(let O=0,W=R.length;O<W;O++){const F=R[O];o.dot(F)>n&&l.add(F)}l.normalize(),b.setXYZ(S+D,l.x,l.y,l.z)}}return d.setAttribute("normal",b),d}var uCe=Object.defineProperty,dCe=(t,e,n)=>e in t?uCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fCe=(t,e,n)=>(dCe(t,e+"",n),n);class hCe{constructor(){fCe(this,"_listeners")}addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}var pCe=Object.defineProperty,mCe=(t,e,n)=>e in t?pCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Zn=(t,e,n)=>(mCe(t,typeof e!="symbol"?e+"":e,n),n);const bM=new Ev,Hj=new Jh,gCe=Math.cos(70*(Math.PI/180)),Vj=(t,e)=>(t%e+e)%e;let vCe=class extends hCe{constructor(e,n){super(),Zn(this,"object"),Zn(this,"domElement"),Zn(this,"enabled",!0),Zn(this,"target",new Fe),Zn(this,"minDistance",0),Zn(this,"maxDistance",1/0),Zn(this,"minZoom",0),Zn(this,"maxZoom",1/0),Zn(this,"minPolarAngle",0),Zn(this,"maxPolarAngle",Math.PI),Zn(this,"minAzimuthAngle",-1/0),Zn(this,"maxAzimuthAngle",1/0),Zn(this,"enableDamping",!1),Zn(this,"dampingFactor",.05),Zn(this,"enableZoom",!0),Zn(this,"zoomSpeed",1),Zn(this,"enableRotate",!0),Zn(this,"rotateSpeed",1),Zn(this,"enablePan",!0),Zn(this,"panSpeed",1),Zn(this,"screenSpacePanning",!0),Zn(this,"keyPanSpeed",7),Zn(this,"zoomToCursor",!1),Zn(this,"autoRotate",!1),Zn(this,"autoRotateSpeed",2),Zn(this,"reverseOrbit",!1),Zn(this,"reverseHorizontalOrbit",!1),Zn(this,"reverseVerticalOrbit",!1),Zn(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Zn(this,"mouseButtons",{LEFT:Tg.ROTATE,MIDDLE:Tg.DOLLY,RIGHT:Tg.PAN}),Zn(this,"touches",{ONE:Eg.ROTATE,TWO:Eg.DOLLY_PAN}),Zn(this,"target0"),Zn(this,"position0"),Zn(this,"zoom0"),Zn(this,"_domElementKeyEvents",null),Zn(this,"getPolarAngle"),Zn(this,"getAzimuthalAngle"),Zn(this,"setPolarAngle"),Zn(this,"setAzimuthalAngle"),Zn(this,"getDistance"),Zn(this,"getZoomScale"),Zn(this,"listenToKeyEvents"),Zn(this,"stopListenToKeyEvents"),Zn(this,"saveState"),Zn(this,"reset"),Zn(this,"update"),Zn(this,"connect"),Zn(this,"dispose"),Zn(this,"dollyIn"),Zn(this,"dollyOut"),Zn(this,"getScale"),Zn(this,"setScale"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=Se=>{let Ye=Vj(Se,2*Math.PI),dt=d.phi;dt<0&&(dt+=2*Math.PI),Ye<0&&(Ye+=2*Math.PI);let Le=Math.abs(Ye-dt);2*Math.PI-Le<Le&&(Ye<dt?Ye+=2*Math.PI:dt+=2*Math.PI),h.phi=Ye-dt,r.update()},this.setAzimuthalAngle=Se=>{let Ye=Vj(Se,2*Math.PI),dt=d.theta;dt<0&&(dt+=2*Math.PI),Ye<0&&(Ye+=2*Math.PI);let Le=Math.abs(Ye-dt);2*Math.PI-Le<Le&&(Ye<dt?Ye+=2*Math.PI:dt+=2*Math.PI),h.theta=Ye-dt,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=Se=>{Se.addEventListener("keydown",ke),this._domElementKeyEvents=Se},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ke),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=o.NONE},this.update=(()=>{const Se=new Fe,Ye=new Fe(0,1,0),dt=new Bo().setFromUnitVectors(e.up,Ye),Le=dt.clone().invert(),st=new Fe,ft=new Bo,mt=2*Math.PI;return function(){const Qe=r.object.position;dt.setFromUnitVectors(e.up,Ye),Le.copy(dt).invert(),Se.copy(Qe).sub(r.target),Se.applyQuaternion(dt),d.setFromVector3(Se),r.autoRotate&&l===o.NONE&&Z(V()),r.enableDamping?(d.theta+=h.theta*r.dampingFactor,d.phi+=h.phi*r.dampingFactor):(d.theta+=h.theta,d.phi+=h.phi);let ze=r.minAzimuthAngle,Te=r.maxAzimuthAngle;isFinite(ze)&&isFinite(Te)&&(ze<-Math.PI?ze+=mt:ze>Math.PI&&(ze-=mt),Te<-Math.PI?Te+=mt:Te>Math.PI&&(Te-=mt),ze<=Te?d.theta=Math.max(ze,Math.min(Te,d.theta)):d.theta=d.theta>(ze+Te)/2?Math.max(ze,d.theta):Math.min(Te,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(v,r.dampingFactor):r.target.add(v),r.zoomToCursor&&O||r.object.isOrthographicCamera?d.radius=H(d.radius):d.radius=H(d.radius*g),Se.setFromSpherical(d),Se.applyQuaternion(Le),Qe.copy(r.target).add(Se),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(h.theta*=1-r.dampingFactor,h.phi*=1-r.dampingFactor,v.multiplyScalar(1-r.dampingFactor)):(h.set(0,0,0),v.set(0,0,0));let He=!1;if(r.zoomToCursor&&O){let et=null;if(r.object instanceof ea&&r.object.isPerspectiveCamera){const ht=Se.length();et=H(ht*g);const ct=ht-et;r.object.position.addScaledVector(L,ct),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const ht=new Fe(R.x,R.y,0);ht.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/g)),r.object.updateProjectionMatrix(),He=!0;const ct=new Fe(R.x,R.y,0);ct.unproject(r.object),r.object.position.sub(ct).add(ht),r.object.updateMatrixWorld(),et=Se.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;et!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(et).add(r.object.position):(bM.origin.copy(r.object.position),bM.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(bM.direction))<gCe?e.lookAt(r.target):(Hj.setFromNormalAndCoplanarPoint(r.object.up,r.target),bM.intersectPlane(Hj,r.target))))}else r.object instanceof Hd&&r.object.isOrthographicCamera&&(He=g!==1,He&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/g)),r.object.updateProjectionMatrix()));return g=1,O=!1,He||st.distanceToSquared(r.object.position)>c||8*(1-ft.dot(r.object.quaternion))>c?(r.dispatchEvent(i),st.copy(r.object.position),ft.copy(r.object.quaternion),He=!1,!0):!1}})(),this.connect=Se=>{r.domElement=Se,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",je),r.domElement.addEventListener("pointerdown",Ze),r.domElement.addEventListener("pointercancel",te),r.domElement.addEventListener("wheel",ge)},this.dispose=()=>{var Se,Ye,dt,Le,st,ft;r.domElement&&(r.domElement.style.touchAction="auto"),(Se=r.domElement)==null||Se.removeEventListener("contextmenu",je),(Ye=r.domElement)==null||Ye.removeEventListener("pointerdown",Ze),(dt=r.domElement)==null||dt.removeEventListener("pointercancel",te),(Le=r.domElement)==null||Le.removeEventListener("wheel",ge),(st=r.domElement)==null||st.ownerDocument.removeEventListener("pointermove",ae),(ft=r.domElement)==null||ft.ownerDocument.removeEventListener("pointerup",te),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ke)};const r=this,i={type:"change"},s={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=o.NONE;const c=1e-6,d=new XR,h=new XR;let g=1;const v=new Fe,b=new zt,_=new zt,w=new zt,S=new zt,E=new zt,A=new zt,N=new zt,D=new zt,P=new zt,L=new Fe,R=new zt;let O=!1;const W=[],F={};function V(){return 2*Math.PI/60/60*r.autoRotateSpeed}function G(){return Math.pow(.95,r.zoomSpeed)}function Z(Se){r.reverseOrbit||r.reverseHorizontalOrbit?h.theta+=Se:h.theta-=Se}function B(Se){r.reverseOrbit||r.reverseVerticalOrbit?h.phi+=Se:h.phi-=Se}const q=(()=>{const Se=new Fe;return function(dt,Le){Se.setFromMatrixColumn(Le,0),Se.multiplyScalar(-dt),v.add(Se)}})(),K=(()=>{const Se=new Fe;return function(dt,Le){r.screenSpacePanning===!0?Se.setFromMatrixColumn(Le,1):(Se.setFromMatrixColumn(Le,0),Se.crossVectors(r.object.up,Se)),Se.multiplyScalar(dt),v.add(Se)}})(),Y=(()=>{const Se=new Fe;return function(dt,Le){const st=r.domElement;if(st&&r.object instanceof ea&&r.object.isPerspectiveCamera){const ft=r.object.position;Se.copy(ft).sub(r.target);let mt=Se.length();mt*=Math.tan(r.object.fov/2*Math.PI/180),q(2*dt*mt/st.clientHeight,r.object.matrix),K(2*Le*mt/st.clientHeight,r.object.matrix)}else st&&r.object instanceof Hd&&r.object.isOrthographicCamera?(q(dt*(r.object.right-r.object.left)/r.object.zoom/st.clientWidth,r.object.matrix),K(Le*(r.object.top-r.object.bottom)/r.object.zoom/st.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function Q(Se){r.object instanceof ea&&r.object.isPerspectiveCamera||r.object instanceof Hd&&r.object.isOrthographicCamera?g=Se:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function U(Se){Q(g/Se)}function j(Se){Q(g*Se)}function X(Se){if(!r.zoomToCursor||!r.domElement)return;O=!0;const Ye=r.domElement.getBoundingClientRect(),dt=Se.clientX-Ye.left,Le=Se.clientY-Ye.top,st=Ye.width,ft=Ye.height;R.x=dt/st*2-1,R.y=-(Le/ft)*2+1,L.set(R.x,R.y,1).unproject(r.object).sub(r.object.position).normalize()}function H(Se){return Math.max(r.minDistance,Math.min(r.maxDistance,Se))}function ie(Se){b.set(Se.clientX,Se.clientY)}function ne(Se){X(Se),N.set(Se.clientX,Se.clientY)}function re(Se){S.set(Se.clientX,Se.clientY)}function ue(Se){_.set(Se.clientX,Se.clientY),w.subVectors(_,b).multiplyScalar(r.rotateSpeed);const Ye=r.domElement;Ye&&(Z(2*Math.PI*w.x/Ye.clientHeight),B(2*Math.PI*w.y/Ye.clientHeight)),b.copy(_),r.update()}function le(Se){D.set(Se.clientX,Se.clientY),P.subVectors(D,N),P.y>0?U(G()):P.y<0&&j(G()),N.copy(D),r.update()}function fe(Se){E.set(Se.clientX,Se.clientY),A.subVectors(E,S).multiplyScalar(r.panSpeed),Y(A.x,A.y),S.copy(E),r.update()}function we(Se){X(Se),Se.deltaY<0?j(G()):Se.deltaY>0&&U(G()),r.update()}function pe(Se){let Ye=!1;switch(Se.code){case r.keys.UP:Y(0,r.keyPanSpeed),Ye=!0;break;case r.keys.BOTTOM:Y(0,-r.keyPanSpeed),Ye=!0;break;case r.keys.LEFT:Y(r.keyPanSpeed,0),Ye=!0;break;case r.keys.RIGHT:Y(-r.keyPanSpeed,0),Ye=!0;break}Ye&&(Se.preventDefault(),r.update())}function xe(){if(W.length==1)b.set(W[0].pageX,W[0].pageY);else{const Se=.5*(W[0].pageX+W[1].pageX),Ye=.5*(W[0].pageY+W[1].pageY);b.set(Se,Ye)}}function Ve(){if(W.length==1)S.set(W[0].pageX,W[0].pageY);else{const Se=.5*(W[0].pageX+W[1].pageX),Ye=.5*(W[0].pageY+W[1].pageY);S.set(Se,Ye)}}function ye(){const Se=W[0].pageX-W[1].pageX,Ye=W[0].pageY-W[1].pageY,dt=Math.sqrt(Se*Se+Ye*Ye);N.set(0,dt)}function Oe(){r.enableZoom&&ye(),r.enablePan&&Ve()}function he(){r.enableZoom&&ye(),r.enableRotate&&xe()}function Re(Se){if(W.length==1)_.set(Se.pageX,Se.pageY);else{const dt=qe(Se),Le=.5*(Se.pageX+dt.x),st=.5*(Se.pageY+dt.y);_.set(Le,st)}w.subVectors(_,b).multiplyScalar(r.rotateSpeed);const Ye=r.domElement;Ye&&(Z(2*Math.PI*w.x/Ye.clientHeight),B(2*Math.PI*w.y/Ye.clientHeight)),b.copy(_)}function oe(Se){if(W.length==1)E.set(Se.pageX,Se.pageY);else{const Ye=qe(Se),dt=.5*(Se.pageX+Ye.x),Le=.5*(Se.pageY+Ye.y);E.set(dt,Le)}A.subVectors(E,S).multiplyScalar(r.panSpeed),Y(A.x,A.y),S.copy(E)}function Ue(Se){const Ye=qe(Se),dt=Se.pageX-Ye.x,Le=Se.pageY-Ye.y,st=Math.sqrt(dt*dt+Le*Le);D.set(0,st),P.set(0,Math.pow(D.y/N.y,r.zoomSpeed)),U(P.y),N.copy(D)}function Ee(Se){r.enableZoom&&Ue(Se),r.enablePan&&oe(Se)}function Pe(Se){r.enableZoom&&Ue(Se),r.enableRotate&&Re(Se)}function Ze(Se){var Ye,dt;r.enabled!==!1&&(W.length===0&&((Ye=r.domElement)==null||Ye.ownerDocument.addEventListener("pointermove",ae),(dt=r.domElement)==null||dt.ownerDocument.addEventListener("pointerup",te)),We(Se),Se.pointerType==="touch"?Xe(Se):be(Se))}function ae(Se){r.enabled!==!1&&(Se.pointerType==="touch"?Ae(Se):me(Se))}function te(Se){var Ye,dt,Le;De(Se),W.length===0&&((Ye=r.domElement)==null||Ye.releasePointerCapture(Se.pointerId),(dt=r.domElement)==null||dt.ownerDocument.removeEventListener("pointermove",ae),(Le=r.domElement)==null||Le.ownerDocument.removeEventListener("pointerup",te)),r.dispatchEvent(a),l=o.NONE}function be(Se){let Ye;switch(Se.button){case 0:Ye=r.mouseButtons.LEFT;break;case 1:Ye=r.mouseButtons.MIDDLE;break;case 2:Ye=r.mouseButtons.RIGHT;break;default:Ye=-1}switch(Ye){case Tg.DOLLY:if(r.enableZoom===!1)return;ne(Se),l=o.DOLLY;break;case Tg.ROTATE:if(Se.ctrlKey||Se.metaKey||Se.shiftKey){if(r.enablePan===!1)return;re(Se),l=o.PAN}else{if(r.enableRotate===!1)return;ie(Se),l=o.ROTATE}break;case Tg.PAN:if(Se.ctrlKey||Se.metaKey||Se.shiftKey){if(r.enableRotate===!1)return;ie(Se),l=o.ROTATE}else{if(r.enablePan===!1)return;re(Se),l=o.PAN}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function me(Se){if(r.enabled!==!1)switch(l){case o.ROTATE:if(r.enableRotate===!1)return;ue(Se);break;case o.DOLLY:if(r.enableZoom===!1)return;le(Se);break;case o.PAN:if(r.enablePan===!1)return;fe(Se);break}}function ge(Se){r.enabled===!1||r.enableZoom===!1||l!==o.NONE&&l!==o.ROTATE||(Se.preventDefault(),r.dispatchEvent(s),we(Se),r.dispatchEvent(a))}function ke(Se){r.enabled===!1||r.enablePan===!1||pe(Se)}function Xe(Se){switch(Be(Se),W.length){case 1:switch(r.touches.ONE){case Eg.ROTATE:if(r.enableRotate===!1)return;xe(),l=o.TOUCH_ROTATE;break;case Eg.PAN:if(r.enablePan===!1)return;Ve(),l=o.TOUCH_PAN;break;default:l=o.NONE}break;case 2:switch(r.touches.TWO){case Eg.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Oe(),l=o.TOUCH_DOLLY_PAN;break;case Eg.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;he(),l=o.TOUCH_DOLLY_ROTATE;break;default:l=o.NONE}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function Ae(Se){switch(Be(Se),l){case o.TOUCH_ROTATE:if(r.enableRotate===!1)return;Re(Se),r.update();break;case o.TOUCH_PAN:if(r.enablePan===!1)return;oe(Se),r.update();break;case o.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Ee(Se),r.update();break;case o.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Pe(Se),r.update();break;default:l=o.NONE}}function je(Se){r.enabled!==!1&&Se.preventDefault()}function We(Se){W.push(Se)}function De(Se){delete F[Se.pointerId];for(let Ye=0;Ye<W.length;Ye++)if(W[Ye].pointerId==Se.pointerId){W.splice(Ye,1);return}}function Be(Se){let Ye=F[Se.pointerId];Ye===void 0&&(Ye=new zt,F[Se.pointerId]=Ye),Ye.set(Se.pageX,Se.pageY)}function qe(Se){const Ye=Se.pointerId===W[0].pointerId?W[1]:W[0];return F[Ye.pointerId]}this.dollyIn=(Se=G())=>{j(Se),r.update()},this.dollyOut=(Se=G())=>{U(Se),r.update()},this.getScale=()=>g,this.setScale=Se=>{Q(Se),r.update()},this.getZoomScale=()=>G(),n!==void 0&&this.connect(n),this.update()}};const Gj=new Ca,_M=new Fe;class O9 extends CE{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],n=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],r=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(r),this.setAttribute("position",new Cn(e,3)),this.setAttribute("uv",new Cn(n,2))}applyMatrix4(e){const n=this.attributes.instanceStart,r=this.attributes.instanceEnd;return n!==void 0&&(n.applyMatrix4(e),r.applyMatrix4(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let n;e instanceof Float32Array?n=e:Array.isArray(e)&&(n=new Float32Array(e));const r=new S5(n,6,1);return this.setAttribute("instanceStart",new Qc(r,3,0)),this.setAttribute("instanceEnd",new Qc(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,n=3){let r;e instanceof Float32Array?r=e:Array.isArray(e)&&(r=new Float32Array(e));const i=new S5(r,n*2,1);return this.setAttribute("instanceColorStart",new Qc(i,n,0)),this.setAttribute("instanceColorEnd",new Qc(i,n,n)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new m9(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ca);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),Gj.setFromBufferAttribute(n),this.boundingBox.union(Gj))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Va),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;if(e!==void 0&&n!==void 0){const r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0;for(let s=0,a=e.count;s<a;s++)_M.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(_M)),_M.fromBufferAttribute(n,s),i=Math.max(i,r.distanceToSquared(_M));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}class DK extends O9{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){const n=e.length-3,r=new Float32Array(2*n);for(let i=0;i<n;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setPositions(r),this}setColors(e,n=3){const r=e.length-n,i=new Float32Array(2*r);if(n===3)for(let s=0;s<r;s+=n)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5];else for(let s=0;s<r;s+=n)i[2*s]=e[s],i[2*s+1]=e[s+1],i[2*s+2]=e[s+2],i[2*s+3]=e[s+3],i[2*s+4]=e[s+4],i[2*s+5]=e[s+5],i[2*s+6]=e[s+6],i[2*s+7]=e[s+7];return super.setColors(i,n),this}fromLine(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}}class L9 extends au{constructor(e){super({type:"LineMaterial",uniforms:NS.clone(NS.merge([pn.common,pn.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new zt(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
				#include <common>
				#include <fog_pars_vertex>
				#include <logdepthbuf_pars_vertex>
				#include <clipping_planes_pars_vertex>

				uniform float linewidth;
				uniform vec2 resolution;

				attribute vec3 instanceStart;
				attribute vec3 instanceEnd;

				#ifdef USE_COLOR
					#ifdef USE_LINE_COLOR_ALPHA
						varying vec4 vLineColor;
						attribute vec4 instanceColorStart;
						attribute vec4 instanceColorEnd;
					#else
						varying vec3 vLineColor;
						attribute vec3 instanceColorStart;
						attribute vec3 instanceColorEnd;
					#endif
				#endif

				#ifdef WORLD_UNITS

					varying vec4 worldPos;
					varying vec3 worldStart;
					varying vec3 worldEnd;

					#ifdef USE_DASH

						varying vec2 vUv;

					#endif

				#else

					varying vec2 vUv;

				#endif

				#ifdef USE_DASH

					uniform float dashScale;
					attribute float instanceDistanceStart;
					attribute float instanceDistanceEnd;
					varying float vLineDistance;

				#endif

				void trimSegment( const in vec4 start, inout vec4 end ) {

					// trim end segment so it terminates between the camera plane and the near plane

					// conservative estimate of the near plane
					float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
					float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
					float nearEstimate = - 0.5 * b / a;

					float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );

					end.xyz = mix( start.xyz, end.xyz, alpha );

				}

				void main() {

					#ifdef USE_COLOR

						vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;

					#endif

					#ifdef USE_DASH

						vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
						vUv = uv;

					#endif

					float aspect = resolution.x / resolution.y;

					// camera space
					vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
					vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );

					#ifdef WORLD_UNITS

						worldStart = start.xyz;
						worldEnd = end.xyz;

					#else

						vUv = uv;

					#endif

					// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
					// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
					// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
					// perhaps there is a more elegant solution -- WestLangley

					bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column

					if ( perspective ) {

						if ( start.z < 0.0 && end.z >= 0.0 ) {

							trimSegment( start, end );

						} else if ( end.z < 0.0 && start.z >= 0.0 ) {

							trimSegment( end, start );

						}

					}

					// clip space
					vec4 clipStart = projectionMatrix * start;
					vec4 clipEnd = projectionMatrix * end;

					// ndc space
					vec3 ndcStart = clipStart.xyz / clipStart.w;
					vec3 ndcEnd = clipEnd.xyz / clipEnd.w;

					// direction
					vec2 dir = ndcEnd.xy - ndcStart.xy;

					// account for clip-space aspect ratio
					dir.x *= aspect;
					dir = normalize( dir );

					#ifdef WORLD_UNITS

						// get the offset direction as perpendicular to the view vector
						vec3 worldDir = normalize( end.xyz - start.xyz );
						vec3 offset;
						if ( position.y < 0.5 ) {

							offset = normalize( cross( start.xyz, worldDir ) );

						} else {

							offset = normalize( cross( end.xyz, worldDir ) );

						}

						// sign flip
						if ( position.x < 0.0 ) offset *= - 1.0;

						float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );

						// don't extend the line if we're rendering dashes because we
						// won't be rendering the endcaps
						#ifndef USE_DASH

							// extend the line bounds to encompass  endcaps
							start.xyz += - worldDir * linewidth * 0.5;
							end.xyz += worldDir * linewidth * 0.5;

							// shift the position of the quad so it hugs the forward edge of the line
							offset.xy -= dir * forwardOffset;
							offset.z += 0.5;

						#endif

						// endcaps
						if ( position.y > 1.0 || position.y < 0.0 ) {

							offset.xy += dir * 2.0 * forwardOffset;

						}

						// adjust for linewidth
						offset *= linewidth * 0.5;

						// set the world position
						worldPos = ( position.y < 0.5 ) ? start : end;
						worldPos.xyz += offset;

						// project the worldpos
						vec4 clip = projectionMatrix * worldPos;

						// shift the depth of the projected points so the line
						// segments overlap neatly
						vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
						clip.z = clipPose.z * clip.w;

					#else

						vec2 offset = vec2( dir.y, - dir.x );
						// undo aspect ratio adjustment
						dir.x /= aspect;
						offset.x /= aspect;

						// sign flip
						if ( position.x < 0.0 ) offset *= - 1.0;

						// endcaps
						if ( position.y < 0.0 ) {

							offset += - dir;

						} else if ( position.y > 1.0 ) {

							offset += dir;

						}

						// adjust for linewidth
						offset *= linewidth;

						// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
						offset /= resolution.y;

						// select end
						vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;

						// back to clip space
						offset *= clip.w;

						clip.xy += offset;

					#endif

					gl_Position = clip;

					vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation

					#include <logdepthbuf_vertex>
					#include <clipping_planes_vertex>
					#include <fog_vertex>

				}
			`,fragmentShader:`
				uniform vec3 diffuse;
				uniform float opacity;
				uniform float linewidth;

				#ifdef USE_DASH

					uniform float dashOffset;
					uniform float dashSize;
					uniform float gapSize;

				#endif

				varying float vLineDistance;

				#ifdef WORLD_UNITS

					varying vec4 worldPos;
					varying vec3 worldStart;
					varying vec3 worldEnd;

					#ifdef USE_DASH

						varying vec2 vUv;

					#endif

				#else

					varying vec2 vUv;

				#endif

				#include <common>
				#include <fog_pars_fragment>
				#include <logdepthbuf_pars_fragment>
				#include <clipping_planes_pars_fragment>

				#ifdef USE_COLOR
					#ifdef USE_LINE_COLOR_ALPHA
						varying vec4 vLineColor;
					#else
						varying vec3 vLineColor;
					#endif
				#endif

				vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {

					float mua;
					float mub;

					vec3 p13 = p1 - p3;
					vec3 p43 = p4 - p3;

					vec3 p21 = p2 - p1;

					float d1343 = dot( p13, p43 );
					float d4321 = dot( p43, p21 );
					float d1321 = dot( p13, p21 );
					float d4343 = dot( p43, p43 );
					float d2121 = dot( p21, p21 );

					float denom = d2121 * d4343 - d4321 * d4321;

					float numer = d1343 * d4321 - d1321 * d4343;

					mua = numer / denom;
					mua = clamp( mua, 0.0, 1.0 );
					mub = ( d1343 + d4321 * ( mua ) ) / d4343;
					mub = clamp( mub, 0.0, 1.0 );

					return vec2( mua, mub );

				}

				void main() {

					#include <clipping_planes_fragment>

					#ifdef USE_DASH

						if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps

						if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX

					#endif

					float alpha = opacity;

					#ifdef WORLD_UNITS

						// Find the closest points on the view ray and the line segment
						vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
						vec3 lineDir = worldEnd - worldStart;
						vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );

						vec3 p1 = worldStart + lineDir * params.x;
						vec3 p2 = rayEnd * params.y;
						vec3 delta = p1 - p2;
						float len = length( delta );
						float norm = len / linewidth;

						#ifndef USE_DASH

							#ifdef USE_ALPHA_TO_COVERAGE

								float dnorm = fwidth( norm );
								alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );

							#else

								if ( norm > 0.5 ) {

									discard;

								}

							#endif

						#endif

					#else

						#ifdef USE_ALPHA_TO_COVERAGE

							// artifacts appear on some hardware if a derivative is taken within a conditional
							float a = vUv.x;
							float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
							float len2 = a * a + b * b;
							float dlen = fwidth( len2 );

							if ( abs( vUv.y ) > 1.0 ) {

								alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );

							}

						#else

							if ( abs( vUv.y ) > 1.0 ) {

								float a = vUv.x;
								float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
								float len2 = a * a + b * b;

								if ( len2 > 1.0 ) discard;

							}

						#endif

					#endif

					vec4 diffuseColor = vec4( diffuse, alpha );
					#ifdef USE_COLOR
						#ifdef USE_LINE_COLOR_ALPHA
							diffuseColor *= vLineColor;
						#else
							diffuseColor.rgb *= vLineColor;
						#endif
					#endif

					#include <logdepthbuf_fragment>

					gl_FragColor = diffuseColor;

					#include <tonemapping_fragment>
					#include <${PK>=154?"colorspace_fragment":"encodings_fragment"}>
					#include <fog_fragment>
					#include <premultiplied_alpha_fragment>

				}
			`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(n){this.uniforms.diffuse.value=n}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(n){n===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(n){this.uniforms.linewidth.value=n}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(n){!!n!="USE_DASH"in this.defines&&(this.needsUpdate=!0),n===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(n){this.uniforms.dashScale.value=n}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(n){this.uniforms.dashSize.value=n}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(n){this.uniforms.dashOffset.value=n}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(n){this.uniforms.gapSize.value=n}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(n){this.uniforms.opacity.value=n}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(n){this.uniforms.resolution.value.copy(n)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(n){!!n!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),n===!0?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}const L6=new ci,Wj=new Fe,$j=new Fe,Oo=new ci,Lo=new ci,kf=new ci,z6=new Fe,j6=new rr,jo=new iK,qj=new Fe,SM=new Ca,wM=new Va,Pf=new ci;let Gf,Yg;function Xj(t,e,n){return Pf.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),Pf.multiplyScalar(1/Pf.w),Pf.x=Yg/n.width,Pf.y=Yg/n.height,Pf.applyMatrix4(t.projectionMatrixInverse),Pf.multiplyScalar(1/Pf.w),Math.abs(Math.max(Pf.x,Pf.y))}function xCe(t,e){const n=t.matrixWorld,r=t.geometry,i=r.attributes.instanceStart,s=r.attributes.instanceEnd,a=Math.min(r.instanceCount,i.count);for(let o=0,l=a;o<l;o++){jo.start.fromBufferAttribute(i,o),jo.end.fromBufferAttribute(s,o),jo.applyMatrix4(n);const c=new Fe,d=new Fe;Gf.distanceSqToSegment(jo.start,jo.end,d,c),d.distanceTo(c)<Yg*.5&&e.push({point:d,pointOnLine:c,distance:Gf.origin.distanceTo(d),object:t,face:null,faceIndex:o,uv:null,[IK]:null})}}function yCe(t,e,n){const r=e.projectionMatrix,s=t.material.resolution,a=t.matrixWorld,o=t.geometry,l=o.attributes.instanceStart,c=o.attributes.instanceEnd,d=Math.min(o.instanceCount,l.count),h=-e.near;Gf.at(1,kf),kf.w=1,kf.applyMatrix4(e.matrixWorldInverse),kf.applyMatrix4(r),kf.multiplyScalar(1/kf.w),kf.x*=s.x/2,kf.y*=s.y/2,kf.z=0,z6.copy(kf),j6.multiplyMatrices(e.matrixWorldInverse,a);for(let g=0,v=d;g<v;g++){if(Oo.fromBufferAttribute(l,g),Lo.fromBufferAttribute(c,g),Oo.w=1,Lo.w=1,Oo.applyMatrix4(j6),Lo.applyMatrix4(j6),Oo.z>h&&Lo.z>h)continue;if(Oo.z>h){const A=Oo.z-Lo.z,N=(Oo.z-h)/A;Oo.lerp(Lo,N)}else if(Lo.z>h){const A=Lo.z-Oo.z,N=(Lo.z-h)/A;Lo.lerp(Oo,N)}Oo.applyMatrix4(r),Lo.applyMatrix4(r),Oo.multiplyScalar(1/Oo.w),Lo.multiplyScalar(1/Lo.w),Oo.x*=s.x/2,Oo.y*=s.y/2,Lo.x*=s.x/2,Lo.y*=s.y/2,jo.start.copy(Oo),jo.start.z=0,jo.end.copy(Lo),jo.end.z=0;const _=jo.closestPointToPointParameter(z6,!0);jo.at(_,qj);const w=sY.lerp(Oo.z,Lo.z,_),S=w>=-1&&w<=1,E=z6.distanceTo(qj)<Yg*.5;if(S&&E){jo.start.fromBufferAttribute(l,g),jo.end.fromBufferAttribute(c,g),jo.start.applyMatrix4(a),jo.end.applyMatrix4(a);const A=new Fe,N=new Fe;Gf.distanceSqToSegment(jo.start,jo.end,N,A),n.push({point:N,pointOnLine:A,distance:Gf.origin.distanceTo(N),object:t,face:null,faceIndex:g,uv:null,[IK]:null})}}}class OK extends Us{constructor(e=new O9,n=new L9({color:Math.random()*16777215})){super(e,n),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,n=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*n.count);for(let a=0,o=0,l=n.count;a<l;a++,o+=2)Wj.fromBufferAttribute(n,a),$j.fromBufferAttribute(r,a),i[o]=o===0?0:i[o-1],i[o+1]=i[o]+Wj.distanceTo($j);const s=new S5(i,2,1);return e.setAttribute("instanceDistanceStart",new Qc(s,1,0)),e.setAttribute("instanceDistanceEnd",new Qc(s,1,1)),this}raycast(e,n){const r=this.material.worldUnits,i=e.camera;i===null&&!r&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=e.params.Line2!==void 0&&e.params.Line2.threshold||0;Gf=e.ray;const a=this.matrixWorld,o=this.geometry,l=this.material;Yg=l.linewidth+s,o.boundingSphere===null&&o.computeBoundingSphere(),wM.copy(o.boundingSphere).applyMatrix4(a);let c;if(r)c=Yg*.5;else{const h=Math.max(i.near,wM.distanceToPoint(Gf.origin));c=Xj(i,h,l.resolution)}if(wM.radius+=c,Gf.intersectsSphere(wM)===!1)return;o.boundingBox===null&&o.computeBoundingBox(),SM.copy(o.boundingBox).applyMatrix4(a);let d;if(r)d=Yg*.5;else{const h=Math.max(i.near,SM.distanceToPoint(Gf.origin));d=Xj(i,h,l.resolution)}SM.expandByScalar(d),Gf.intersectsBox(SM)!==!1&&(r?xCe(this,n):yCe(this,i,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(L6),this.material.uniforms.resolution.value.set(L6.z,L6.w))}}class bCe extends OK{constructor(e=new DK,n=new L9({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}const _Ce=T.forwardRef(function({points:e,color:n=16777215,vertexColors:r,linewidth:i,lineWidth:s,segments:a,dashed:o,...l},c){var d,h;const g=$c(S=>S.size),v=T.useMemo(()=>a?new OK:new bCe,[a]),[b]=T.useState(()=>new L9),_=(r==null||(d=r[0])==null?void 0:d.length)===4?4:3,w=T.useMemo(()=>{const S=a?new O9:new DK,E=e.map(A=>{const N=Array.isArray(A);return A instanceof Fe||A instanceof ci?[A.x,A.y,A.z]:A instanceof zt?[A.x,A.y,0]:N&&A.length===3?[A[0],A[1],A[2]]:N&&A.length===2?[A[0],A[1],0]:A});if(S.setPositions(E.flat()),r){n=16777215;const A=r.map(N=>N instanceof xn?N.toArray():N);S.setColors(A.flat(),_)}return S},[e,a,r,_]);return T.useLayoutEffect(()=>{v.computeLineDistances()},[e,v]),T.useLayoutEffect(()=>{o?b.defines.USE_DASH="":delete b.defines.USE_DASH,b.needsUpdate=!0},[o,b]),T.useEffect(()=>()=>{w.dispose(),b.dispose()},[w]),T.createElement("primitive",lh({object:v,ref:c},l),T.createElement("primitive",{object:w,attach:"geometry"}),T.createElement("primitive",lh({object:b,attach:"material",color:n,vertexColors:!!r,resolution:[g.width,g.height],linewidth:(h=i??s)!==null&&h!==void 0?h:1,dashed:o,transparent:_===4},l)))});function SCe(){var t=Object.create(null);function e(i,s){var a=i.id,o=i.name,l=i.dependencies;l===void 0&&(l=[]);var c=i.init;c===void 0&&(c=function(){});var d=i.getTransferables;if(d===void 0&&(d=null),!t[a])try{l=l.map(function(g){return g&&g.isWorkerModule&&(e(g,function(v){if(v instanceof Error)throw v}),g=t[g.id].value),g}),c=r("<"+o+">.init",c),d&&(d=r("<"+o+">.getTransferables",d));var h=null;typeof c=="function"?h=c.apply(void 0,l):console.error("worker module init function failed to rehydrate"),t[a]={id:a,value:h,getTransferables:d},s(h)}catch(g){g&&g.noLog||console.error(g),s(g)}}function n(i,s){var a,o=i.id,l=i.args;(!t[o]||typeof t[o].value!="function")&&s(new Error("Worker module "+o+": not found or its 'init' did not return a function"));try{var c=(a=t[o]).value.apply(a,l);c&&typeof c.then=="function"?c.then(d,function(h){return s(h instanceof Error?h:new Error(""+h))}):d(c)}catch(h){s(h)}function d(h){try{var g=t[o].getTransferables&&t[o].getTransferables(h);(!g||!Array.isArray(g)||!g.length)&&(g=void 0),s(h,g)}catch(v){console.error(v),s(v)}}}function r(i,s){var a=void 0;self.troikaDefine=function(l){return a=l};var o=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/

troikaDefine(
`+s+`
)`],{type:"application/javascript"}));try{importScripts(o)}catch(l){console.error(l)}return URL.revokeObjectURL(o),delete self.troikaDefine,a}self.addEventListener("message",function(i){var s=i.data,a=s.messageId,o=s.action,l=s.data;try{o==="registerModule"&&e(l,function(c){c instanceof Error?postMessage({messageId:a,success:!1,error:c.message}):postMessage({messageId:a,success:!0,result:{isCallable:typeof c=="function"}})}),o==="callModule"&&n(l,function(c,d){c instanceof Error?postMessage({messageId:a,success:!1,error:c.message}):postMessage({messageId:a,success:!0,result:c},d||void 0)})}catch(c){postMessage({messageId:a,success:!1,error:c.stack})}})}function wCe(t){var e=function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,n);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var n=t.dependencies,r=t.init;n=Array.isArray(n)?n.map(function(s){return s&&(s=s.onMainThread||s,s._getInitResult&&(s=s._getInitResult())),s}):[];var i=Promise.all(n).then(function(s){return r.apply(null,s)});return e._getInitResult=function(){return i},i},e}var LK=function(){var t=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),t=!0}catch(n){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+n.message+"]")}return LK=function(){return t},t},MCe=0,TCe=0,F6=!1,q_=Object.create(null),X_=Object.create(null),o7=Object.create(null);function Ly(t){if((!t||typeof t.init!="function")&&!F6)throw new Error("requires `options.init` function");var e=t.dependencies,n=t.init,r=t.getTransferables,i=t.workerId,s=wCe(t);i==null&&(i="#default");var a="workerModule"+ ++MCe,o=t.name||a,l=null;e=e&&e.map(function(d){return typeof d=="function"&&!d.workerModuleData&&(F6=!0,d=Ly({workerId:i,name:"<"+o+"> function dependency: "+d.name,init:`function(){return (
`+GM(d)+`
)}`}),F6=!1),d&&d.workerModuleData&&(d=d.workerModuleData),d});function c(){for(var d=[],h=arguments.length;h--;)d[h]=arguments[h];if(!LK())return s.apply(void 0,d);if(!l){l=Yj(i,"registerModule",c.workerModuleData);var g=function(){l=null,X_[i].delete(g)};(X_[i]||(X_[i]=new Set)).add(g)}return l.then(function(v){var b=v.isCallable;if(b)return Yj(i,"callModule",{id:a,args:d});throw new Error("Worker module function was called but `init` did not return a callable function")})}return c.workerModuleData={isWorkerModule:!0,id:a,name:o,dependencies:e,init:GM(n),getTransferables:r&&GM(r)},c.onMainThread=s,c}function ECe(t){X_[t]&&X_[t].forEach(function(e){e()}),q_[t]&&(q_[t].terminate(),delete q_[t])}function GM(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function CCe(t){var e=q_[t];if(!e){var n=GM(SCe);e=q_[t]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+t.replace(/\*/g,"")+` **/

;(`+n+")()"],{type:"application/javascript"}))),e.onmessage=function(r){var i=r.data,s=i.messageId,a=o7[s];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete o7[s],a(i)}}return e}function Yj(t,e,n){return new Promise(function(r,i){var s=++TCe;o7[s]=function(a){a.success?r(a.result):i(new Error("Error in worker "+e+" call: "+a.error))},CCe(t).postMessage({messageId:s,action:e,data:n})})}function zK(){var t=(function(e){function n(Q,U,j,X,H,ie,ne,re){var ue=1-ne;re.x=ue*ue*Q+2*ue*ne*j+ne*ne*H,re.y=ue*ue*U+2*ue*ne*X+ne*ne*ie}function r(Q,U,j,X,H,ie,ne,re,ue,le){var fe=1-ue;le.x=fe*fe*fe*Q+3*fe*fe*ue*j+3*fe*ue*ue*H+ue*ue*ue*ne,le.y=fe*fe*fe*U+3*fe*fe*ue*X+3*fe*ue*ue*ie+ue*ue*ue*re}function i(Q,U){for(var j=/([MLQCZ])([^MLQCZ]*)/g,X,H,ie,ne,re;X=j.exec(Q);){var ue=X[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(le){return parseFloat(le)});switch(X[1]){case"M":ne=H=ue[0],re=ie=ue[1];break;case"L":(ue[0]!==ne||ue[1]!==re)&&U("L",ne,re,ne=ue[0],re=ue[1]);break;case"Q":{U("Q",ne,re,ne=ue[2],re=ue[3],ue[0],ue[1]);break}case"C":{U("C",ne,re,ne=ue[4],re=ue[5],ue[0],ue[1],ue[2],ue[3]);break}case"Z":(ne!==H||re!==ie)&&U("L",ne,re,H,ie);break}}}function s(Q,U,j){j===void 0&&(j=16);var X={x:0,y:0};i(Q,function(H,ie,ne,re,ue,le,fe,we,pe){switch(H){case"L":U(ie,ne,re,ue);break;case"Q":{for(var xe=ie,Ve=ne,ye=1;ye<j;ye++)n(ie,ne,le,fe,re,ue,ye/(j-1),X),U(xe,Ve,X.x,X.y),xe=X.x,Ve=X.y;break}case"C":{for(var Oe=ie,he=ne,Re=1;Re<j;Re++)r(ie,ne,le,fe,we,pe,re,ue,Re/(j-1),X),U(Oe,he,X.x,X.y),Oe=X.x,he=X.y;break}}})}var a="precision highp float;attribute vec2 aUV;varying vec2 vUV;void main(){vUV=aUV;gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",o="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){gl_FragColor=texture2D(tex,vUV);}",l=new WeakMap,c={premultipliedAlpha:!1,preserveDrawingBuffer:!0,antialias:!1,depth:!1};function d(Q,U){var j=Q.getContext?Q.getContext("webgl",c):Q,X=l.get(j);if(!X){let Oe=function(Pe){var Ze=ie[Pe];if(!Ze&&(Ze=ie[Pe]=j.getExtension(Pe),!Ze))throw new Error(Pe+" not supported");return Ze},he=function(Pe,Ze){var ae=j.createShader(Ze);return j.shaderSource(ae,Pe),j.compileShader(ae),ae},Re=function(Pe,Ze,ae,te){if(!ne[Pe]){var be={},me={},ge=j.createProgram();j.attachShader(ge,he(Ze,j.VERTEX_SHADER)),j.attachShader(ge,he(ae,j.FRAGMENT_SHADER)),j.linkProgram(ge),ne[Pe]={program:ge,transaction:function(Xe){j.useProgram(ge),Xe({setUniform:function(je,We){for(var De=[],Be=arguments.length-2;Be-- >0;)De[Be]=arguments[Be+2];var qe=me[We]||(me[We]=j.getUniformLocation(ge,We));j["uniform"+je].apply(j,[qe].concat(De))},setAttribute:function(je,We,De,Be,qe){var Se=be[je];Se||(Se=be[je]={buf:j.createBuffer(),loc:j.getAttribLocation(ge,je),data:null}),j.bindBuffer(j.ARRAY_BUFFER,Se.buf),j.vertexAttribPointer(Se.loc,We,j.FLOAT,!1,0,0),j.enableVertexAttribArray(Se.loc),H?j.vertexAttribDivisor(Se.loc,Be):Oe("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Se.loc,Be),qe!==Se.data&&(j.bufferData(j.ARRAY_BUFFER,qe,De),Se.data=qe)}})}}}ne[Pe].transaction(te)},oe=function(Pe,Ze){ue++;try{j.activeTexture(j.TEXTURE0+ue);var ae=re[Pe];ae||(ae=re[Pe]=j.createTexture(),j.bindTexture(j.TEXTURE_2D,ae),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST)),j.bindTexture(j.TEXTURE_2D,ae),Ze(ae,ue)}finally{ue--}},Ue=function(Pe,Ze,ae){var te=j.createFramebuffer();le.push(te),j.bindFramebuffer(j.FRAMEBUFFER,te),j.activeTexture(j.TEXTURE0+Ze),j.bindTexture(j.TEXTURE_2D,Pe),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,Pe,0);try{ae(te)}finally{j.deleteFramebuffer(te),j.bindFramebuffer(j.FRAMEBUFFER,le[--le.length-1]||null)}},Ee=function(){ie={},ne={},re={},ue=-1,le.length=0};var fe=Oe,we=he,pe=Re,xe=oe,Ve=Ue,ye=Ee,H=typeof WebGL2RenderingContext<"u"&&j instanceof WebGL2RenderingContext,ie={},ne={},re={},ue=-1,le=[];j.canvas.addEventListener("webglcontextlost",function(Pe){Ee(),Pe.preventDefault()},!1),l.set(j,X={gl:j,isWebGL2:H,getExtension:Oe,withProgram:Re,withTexture:oe,withTextureFramebuffer:Ue,handleContextLoss:Ee})}U(X)}function h(Q,U,j,X,H,ie,ne,re){ne===void 0&&(ne=15),re===void 0&&(re=null),d(Q,function(ue){var le=ue.gl,fe=ue.withProgram,we=ue.withTexture;we("copy",function(pe,xe){le.texImage2D(le.TEXTURE_2D,0,le.RGBA,H,ie,0,le.RGBA,le.UNSIGNED_BYTE,U),fe("copy",a,o,function(Ve){var ye=Ve.setUniform,Oe=Ve.setAttribute;Oe("aUV",2,le.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),ye("1i","image",xe),le.bindFramebuffer(le.FRAMEBUFFER,re||null),le.disable(le.BLEND),le.colorMask(ne&8,ne&4,ne&2,ne&1),le.viewport(j,X,H,ie),le.scissor(j,X,H,ie),le.drawArrays(le.TRIANGLES,0,3)})})})}function g(Q,U,j){var X=Q.width,H=Q.height;d(Q,function(ie){var ne=ie.gl,re=new Uint8Array(X*H*4);ne.readPixels(0,0,X,H,ne.RGBA,ne.UNSIGNED_BYTE,re),Q.width=U,Q.height=j,h(ne,re,0,0,X,H)})}var v=Object.freeze({__proto__:null,withWebGLContext:d,renderImageData:h,resizeWebGLCanvasWithoutClearing:g});function b(Q,U,j,X,H,ie){ie===void 0&&(ie=1);var ne=new Uint8Array(Q*U),re=X[2]-X[0],ue=X[3]-X[1],le=[];s(j,function(Oe,he,Re,oe){le.push({x1:Oe,y1:he,x2:Re,y2:oe,minX:Math.min(Oe,Re),minY:Math.min(he,oe),maxX:Math.max(Oe,Re),maxY:Math.max(he,oe)})}),le.sort(function(Oe,he){return Oe.maxX-he.maxX});for(var fe=0;fe<Q;fe++)for(var we=0;we<U;we++){var pe=Ve(X[0]+re*(fe+.5)/Q,X[1]+ue*(we+.5)/U),xe=Math.pow(1-Math.abs(pe)/H,ie)/2;pe<0&&(xe=1-xe),xe=Math.max(0,Math.min(255,Math.round(xe*255))),ne[we*Q+fe]=xe}return ne;function Ve(Oe,he){for(var Re=1/0,oe=1/0,Ue=le.length;Ue--;){var Ee=le[Ue];if(Ee.maxX+oe<=Oe)break;if(Oe+oe>Ee.minX&&he-oe<Ee.maxY&&he+oe>Ee.minY){var Pe=S(Oe,he,Ee.x1,Ee.y1,Ee.x2,Ee.y2);Pe<Re&&(Re=Pe,oe=Math.sqrt(Re))}}return ye(Oe,he)&&(oe=-oe),oe}function ye(Oe,he){for(var Re=0,oe=le.length;oe--;){var Ue=le[oe];if(Ue.maxX<=Oe)break;var Ee=Ue.y1>he!=Ue.y2>he&&Oe<(Ue.x2-Ue.x1)*(he-Ue.y1)/(Ue.y2-Ue.y1)+Ue.x1;Ee&&(Re+=Ue.y1<Ue.y2?1:-1)}return Re!==0}}function _(Q,U,j,X,H,ie,ne,re,ue,le){ie===void 0&&(ie=1),re===void 0&&(re=0),ue===void 0&&(ue=0),le===void 0&&(le=0),w(Q,U,j,X,H,ie,ne,null,re,ue,le)}function w(Q,U,j,X,H,ie,ne,re,ue,le,fe){ie===void 0&&(ie=1),ue===void 0&&(ue=0),le===void 0&&(le=0),fe===void 0&&(fe=0);for(var we=b(Q,U,j,X,H,ie),pe=new Uint8Array(we.length*4),xe=0;xe<we.length;xe++)pe[xe*4+fe]=we[xe];h(ne,pe,ue,le,Q,U,1<<3-fe,re)}function S(Q,U,j,X,H,ie){var ne=H-j,re=ie-X,ue=ne*ne+re*re,le=ue?Math.max(0,Math.min(1,((Q-j)*ne+(U-X)*re)/ue)):0,fe=Q-(j+le*ne),we=U-(X+le*re);return fe*fe+we*we}var E=Object.freeze({__proto__:null,generate:b,generateIntoCanvas:_,generateIntoFramebuffer:w}),A="precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",N="precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",D="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",P=new Float32Array([0,0,2,0,0,2]),L=null,R=!1,O={},W=new WeakMap;function F(Q){if(!R&&!B(Q))throw new Error("WebGL generation not supported")}function V(Q,U,j,X,H,ie,ne){if(ie===void 0&&(ie=1),ne===void 0&&(ne=null),!ne&&(ne=L,!ne)){var re=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!re)throw new Error("OffscreenCanvas or DOM canvas not supported");ne=L=re.getContext("webgl",{depth:!1})}F(ne);var ue=new Uint8Array(Q*U*4);d(ne,function(pe){var xe=pe.gl,Ve=pe.withTexture,ye=pe.withTextureFramebuffer;Ve("readable",function(Oe,he){xe.texImage2D(xe.TEXTURE_2D,0,xe.RGBA,Q,U,0,xe.RGBA,xe.UNSIGNED_BYTE,null),ye(Oe,he,function(Re){Z(Q,U,j,X,H,ie,xe,Re,0,0,0),xe.readPixels(0,0,Q,U,xe.RGBA,xe.UNSIGNED_BYTE,ue)})})});for(var le=new Uint8Array(Q*U),fe=0,we=0;fe<ue.length;fe+=4)le[we++]=ue[fe];return le}function G(Q,U,j,X,H,ie,ne,re,ue,le){ie===void 0&&(ie=1),re===void 0&&(re=0),ue===void 0&&(ue=0),le===void 0&&(le=0),Z(Q,U,j,X,H,ie,ne,null,re,ue,le)}function Z(Q,U,j,X,H,ie,ne,re,ue,le,fe){ie===void 0&&(ie=1),ue===void 0&&(ue=0),le===void 0&&(le=0),fe===void 0&&(fe=0),F(ne);var we=[];s(j,function(pe,xe,Ve,ye){we.push(pe,xe,Ve,ye)}),we=new Float32Array(we),d(ne,function(pe){var xe=pe.gl,Ve=pe.isWebGL2,ye=pe.getExtension,Oe=pe.withProgram,he=pe.withTexture,Re=pe.withTextureFramebuffer,oe=pe.handleContextLoss;if(he("rawDistances",function(Ue,Ee){(Q!==Ue._lastWidth||U!==Ue._lastHeight)&&xe.texImage2D(xe.TEXTURE_2D,0,xe.RGBA,Ue._lastWidth=Q,Ue._lastHeight=U,0,xe.RGBA,xe.UNSIGNED_BYTE,null),Oe("main",A,N,function(Pe){var Ze=Pe.setAttribute,ae=Pe.setUniform,te=!Ve&&ye("ANGLE_instanced_arrays"),be=!Ve&&ye("EXT_blend_minmax");Ze("aUV",2,xe.STATIC_DRAW,0,P),Ze("aLineSegment",4,xe.DYNAMIC_DRAW,1,we),ae.apply(void 0,["4f","uGlyphBounds"].concat(X)),ae("1f","uMaxDistance",H),ae("1f","uExponent",ie),Re(Ue,Ee,function(me){xe.enable(xe.BLEND),xe.colorMask(!0,!0,!0,!0),xe.viewport(0,0,Q,U),xe.scissor(0,0,Q,U),xe.blendFunc(xe.ONE,xe.ONE),xe.blendEquationSeparate(xe.FUNC_ADD,Ve?xe.MAX:be.MAX_EXT),xe.clear(xe.COLOR_BUFFER_BIT),Ve?xe.drawArraysInstanced(xe.TRIANGLES,0,3,we.length/4):te.drawArraysInstancedANGLE(xe.TRIANGLES,0,3,we.length/4)})}),Oe("post",a,D,function(Pe){Pe.setAttribute("aUV",2,xe.STATIC_DRAW,0,P),Pe.setUniform("1i","tex",Ee),xe.bindFramebuffer(xe.FRAMEBUFFER,re),xe.disable(xe.BLEND),xe.colorMask(fe===0,fe===1,fe===2,fe===3),xe.viewport(ue,le,Q,U),xe.scissor(ue,le,Q,U),xe.drawArrays(xe.TRIANGLES,0,3)})}),xe.isContextLost())throw oe(),new Error("webgl context lost")})}function B(Q){var U=!Q||Q===L?O:Q.canvas||Q,j=W.get(U);if(j===void 0){R=!0;var X=null;try{var H=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],ie=V(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,Q);j=ie&&H.length===ie.length&&ie.every(function(ne,re){return ne===H[re]}),j||(X="bad trial run results",console.info(H,ie))}catch(ne){j=!1,X=ne.message}X&&console.warn("WebGL SDF generation not supported:",X),R=!1,W.set(U,j)}return j}var q=Object.freeze({__proto__:null,generate:V,generateIntoCanvas:G,generateIntoFramebuffer:Z,isSupported:B});function K(Q,U,j,X,H,ie){H===void 0&&(H=Math.max(X[2]-X[0],X[3]-X[1])/2),ie===void 0&&(ie=1);try{return V.apply(q,arguments)}catch(ne){return console.info("WebGL SDF generation failed, falling back to JS",ne),b.apply(E,arguments)}}function Y(Q,U,j,X,H,ie,ne,re,ue,le){H===void 0&&(H=Math.max(X[2]-X[0],X[3]-X[1])/2),ie===void 0&&(ie=1),re===void 0&&(re=0),ue===void 0&&(ue=0),le===void 0&&(le=0);try{return G.apply(q,arguments)}catch(fe){return console.info("WebGL SDF generation failed, falling back to JS",fe),_.apply(E,arguments)}}return e.forEachPathCommand=i,e.generate=K,e.generateIntoCanvas=Y,e.javascript=E,e.pathToLineSegments=s,e.webgl=q,e.webglUtils=v,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}function ACe(){var t=(function(e){var n={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},i={};r.L=1,i[1]="L",Object.keys(n).forEach(function(oe,Ue){r[oe]=1<<Ue+1,i[r[oe]]=oe}),Object.freeze(r);var s=r.LRI|r.RLI|r.FSI,a=r.L|r.R|r.AL,o=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,l=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,c=r.S|r.WS|r.B|s|r.PDI|l,d=null;function h(){if(!d){d=new Map;var oe=function(Ee){if(n.hasOwnProperty(Ee)){var Pe=0;n[Ee].split(",").forEach(function(Ze){var ae=Ze.split("+"),te=ae[0],be=ae[1];te=parseInt(te,36),be=be?parseInt(be,36):0,d.set(Pe+=te,r[Ee]);for(var me=0;me<be;me++)d.set(++Pe,r[Ee])})}};for(var Ue in n)oe(Ue)}}function g(oe){return h(),d.get(oe.codePointAt(0))||r.L}function v(oe){return i[g(oe)]}var b={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function _(oe,Ue){var Ee=36,Pe=0,Ze=new Map,ae=Ue&&new Map,te;return oe.split(",").forEach(function be(me){if(me.indexOf("+")!==-1)for(var ge=+me;ge--;)be(te);else{te=me;var ke=me.split(">"),Xe=ke[0],Ae=ke[1];Xe=String.fromCodePoint(Pe+=parseInt(Xe,Ee)),Ae=String.fromCodePoint(Pe+=parseInt(Ae,Ee)),Ze.set(Xe,Ae),Ue&&ae.set(Ae,Xe)}}),{map:Ze,reverseMap:ae}}var w,S,E;function A(){if(!w){var oe=_(b.pairs,!0),Ue=oe.map,Ee=oe.reverseMap;w=Ue,S=Ee,E=_(b.canonical,!1).map}}function N(oe){return A(),w.get(oe)||null}function D(oe){return A(),S.get(oe)||null}function P(oe){return A(),E.get(oe)||null}var L=r.L,R=r.R,O=r.EN,W=r.ES,F=r.ET,V=r.AN,G=r.CS,Z=r.B,B=r.S,q=r.ON,K=r.BN,Y=r.NSM,Q=r.AL,U=r.LRO,j=r.RLO,X=r.LRE,H=r.RLE,ie=r.PDF,ne=r.LRI,re=r.RLI,ue=r.FSI,le=r.PDI;function fe(oe,Ue){for(var Ee=125,Pe=new Uint32Array(oe.length),Ze=0;Ze<oe.length;Ze++)Pe[Ze]=g(oe[Ze]);var ae=new Map;function te(Gi,Hs){var ys=Pe[Gi];Pe[Gi]=Hs,ae.set(ys,ae.get(ys)-1),ys&o&&ae.set(o,ae.get(o)-1),ae.set(Hs,(ae.get(Hs)||0)+1),Hs&o&&ae.set(o,(ae.get(o)||0)+1)}for(var be=new Uint8Array(oe.length),me=new Map,ge=[],ke=null,Xe=0;Xe<oe.length;Xe++)ke||ge.push(ke={start:Xe,end:oe.length-1,level:Ue==="rtl"?1:Ue==="ltr"?0:Qd(Xe,!1)}),Pe[Xe]&Z&&(ke.end=Xe,ke=null);for(var Ae=H|X|j|U|s|le|ie|Z,je=function(Gi){return Gi+(Gi&1?1:2)},We=function(Gi){return Gi+(Gi&1?2:1)},De=0;De<ge.length;De++){ke=ge[De];var Be=[{_level:ke.level,_override:0,_isolate:0}],qe=void 0,Se=0,Ye=0,dt=0;ae.clear();for(var Le=ke.start;Le<=ke.end;Le++){var st=Pe[Le];if(qe=Be[Be.length-1],ae.set(st,(ae.get(st)||0)+1),st&o&&ae.set(o,(ae.get(o)||0)+1),st&Ae)if(st&(H|X)){be[Le]=qe._level;var ft=(st===H?We:je)(qe._level);ft<=Ee&&!Se&&!Ye?Be.push({_level:ft,_override:0,_isolate:0}):Se||Ye++}else if(st&(j|U)){be[Le]=qe._level;var mt=(st===j?We:je)(qe._level);mt<=Ee&&!Se&&!Ye?Be.push({_level:mt,_override:st&j?R:L,_isolate:0}):Se||Ye++}else if(st&s){st&ue&&(st=Qd(Le+1,!0)===1?re:ne),be[Le]=qe._level,qe._override&&te(Le,qe._override);var tt=(st===re?We:je)(qe._level);tt<=Ee&&Se===0&&Ye===0?(dt++,Be.push({_level:tt,_override:0,_isolate:1,_isolInitIndex:Le})):Se++}else if(st&le){if(Se>0)Se--;else if(dt>0){for(Ye=0;!Be[Be.length-1]._isolate;)Be.pop();var Qe=Be[Be.length-1]._isolInitIndex;Qe!=null&&(me.set(Qe,Le),me.set(Le,Qe)),Be.pop(),dt--}qe=Be[Be.length-1],be[Le]=qe._level,qe._override&&te(Le,qe._override)}else st&ie?(Se===0&&(Ye>0?Ye--:!qe._isolate&&Be.length>1&&(Be.pop(),qe=Be[Be.length-1])),be[Le]=qe._level):st&Z&&(be[Le]=ke.level);else be[Le]=qe._level,qe._override&&st!==K&&te(Le,qe._override)}for(var ze=[],Te=null,He=ke.start;He<=ke.end;He++){var et=Pe[He];if(!(et&l)){var ht=be[He],ct=et&s,bt=et===le;Te&&ht===Te._level?(Te._end=He,Te._endsWithIsolInit=ct):ze.push(Te={_start:He,_end:He,_level:ht,_startsWithPDI:bt,_endsWithIsolInit:ct})}}for(var wt=[],Pt=0;Pt<ze.length;Pt++){var $e=ze[Pt];if(!$e._startsWithPDI||$e._startsWithPDI&&!me.has($e._start)){for(var Tt=[Te=$e],Et=void 0;Te&&Te._endsWithIsolInit&&(Et=me.get(Te._end))!=null;)for(var Ot=Pt+1;Ot<ze.length;Ot++)if(ze[Ot]._start===Et){Tt.push(Te=ze[Ot]);break}for(var Gt=[],an=0;an<Tt.length;an++)for(var On=Tt[an],Bt=On._start;Bt<=On._end;Bt++)Gt.push(Bt);for(var fn=be[Gt[0]],Ht=ke.level,In=Gt[0]-1;In>=0;In--)if(!(Pe[In]&l)){Ht=be[In];break}var Nn=Gt[Gt.length-1],bn=be[Nn],Ln=ke.level;if(!(Pe[Nn]&s)){for(var Fn=Nn+1;Fn<=ke.end;Fn++)if(!(Pe[Fn]&l)){Ln=be[Fn];break}}wt.push({_seqIndices:Gt,_sosType:Math.max(Ht,fn)%2?R:L,_eosType:Math.max(Ln,bn)%2?R:L})}}for(var Bi=0;Bi<wt.length;Bi++){var ui=wt[Bi],ve=ui._seqIndices,ot=ui._sosType,_t=ui._eosType,yt=be[ve[0]]&1?R:L;if(ae.get(Y))for(var vt=0;vt<ve.length;vt++){var Yt=ve[vt];if(Pe[Yt]&Y){for(var rn=ot,sn=vt-1;sn>=0;sn--)if(!(Pe[ve[sn]]&l)){rn=Pe[ve[sn]];break}te(Yt,rn&(s|le)?q:rn)}}if(ae.get(O))for(var Zt=0;Zt<ve.length;Zt++){var Mn=ve[Zt];if(Pe[Mn]&O)for(var Un=Zt-1;Un>=-1;Un--){var $n=Un===-1?ot:Pe[ve[Un]];if($n&a){$n===Q&&te(Mn,V);break}}}if(ae.get(Q))for(var on=0;on<ve.length;on++){var ir=ve[on];Pe[ir]&Q&&te(ir,R)}if(ae.get(W)||ae.get(G))for(var Xr=1;Xr<ve.length-1;Xr++){var Jr=ve[Xr];if(Pe[Jr]&(W|G)){for(var cr=0,Nr=0,en=Xr-1;en>=0&&(cr=Pe[ve[en]],!!(cr&l));en--);for(var ss=Xr+1;ss<ve.length&&(Nr=Pe[ve[ss]],!!(Nr&l));ss++);cr===Nr&&(Pe[Jr]===W?cr===O:cr&(O|V))&&te(Jr,cr)}}if(ae.get(O))for(var Rn=0;Rn<ve.length;Rn++){var gs=ve[Rn];if(Pe[gs]&O){for(var Rs=Rn-1;Rs>=0&&Pe[ve[Rs]]&(F|l);Rs--)te(ve[Rs],O);for(Rn++;Rn<ve.length&&Pe[ve[Rn]]&(F|l|O);Rn++)Pe[ve[Rn]]!==O&&te(ve[Rn],O)}}if(ae.get(F)||ae.get(W)||ae.get(G))for(var Pi=0;Pi<ve.length;Pi++){var vs=ve[Pi];if(Pe[vs]&(F|W|G)){te(vs,q);for(var pr=Pi-1;pr>=0&&Pe[ve[pr]]&l;pr--)te(ve[pr],q);for(var di=Pi+1;di<ve.length&&Pe[ve[di]]&l;di++)te(ve[di],q)}}if(ae.get(O))for(var ks=0,Ii=ot;ks<ve.length;ks++){var $a=ve[ks],co=Pe[$a];co&O?Ii===L&&te($a,L):co&a&&(Ii=co)}if(ae.get(o)){var So=R|O|V,ql=So|L,xl=[];{for(var uo=[],Ps=0;Ps<ve.length;Ps++)if(Pe[ve[Ps]]&o){var Xl=oe[ve[Ps]],Go=void 0;if(N(Xl)!==null)if(uo.length<63)uo.push({char:Xl,seqIndex:Ps});else break;else if((Go=D(Xl))!==null)for(var wo=uo.length-1;wo>=0;wo--){var Mo=uo[wo].char;if(Mo===Go||Mo===D(P(Xl))||N(P(Mo))===Xl){xl.push([uo[wo].seqIndex,Ps]),uo.length=wo;break}}}xl.sort(function(Gi,Hs){return Gi[0]-Hs[0]})}for(var kc=0;kc<xl.length;kc++){for(var Pc=xl[kc],Yl=Pc[0],qa=Pc[1],ia=!1,Aa=0,yl=Yl+1;yl<qa;yl++){var xs=ve[yl];if(Pe[xs]&ql){ia=!0;var Wo=Pe[xs]&So?R:L;if(Wo===yt){Aa=Wo;break}}}if(ia&&!Aa){Aa=ot;for(var $o=Yl-1;$o>=0;$o--){var Ic=ve[$o];if(Pe[Ic]&ql){var ei=Pe[Ic]&So?R:L;ei!==yt?Aa=ei:Aa=yt;break}}}if(Aa){if(Pe[ve[Yl]]=Pe[ve[qa]]=Aa,Aa!==yt){for(var zr=Yl+1;zr<ve.length;zr++)if(!(Pe[ve[zr]]&l)){g(oe[ve[zr]])&Y&&(Pe[ve[zr]]=Aa);break}}if(Aa!==yt){for(var Xa=qa+1;Xa<ve.length;Xa++)if(!(Pe[ve[Xa]]&l)){g(oe[ve[Xa]])&Y&&(Pe[ve[Xa]]=Aa);break}}}}for(var mr=0;mr<ve.length;mr++)if(Pe[ve[mr]]&o){for(var bi=mr,Di=mr,Wr=ot,To=mr-1;To>=0;To--)if(Pe[ve[To]]&l)bi=To;else{Wr=Pe[ve[To]]&So?R:L;break}for(var bl=_t,Kl=mr+1;Kl<ve.length;Kl++)if(Pe[ve[Kl]]&(o|l))Di=Kl;else{bl=Pe[ve[Kl]]&So?R:L;break}for(var ga=bi;ga<=Di;ga++)Pe[ve[ga]]=Wr===bl?Wr:yt;mr=Di}}}for(var hi=ke.start;hi<=ke.end;hi++){var vh=be[hi],nd=Pe[hi];if(vh&1?nd&(L|O|V)&&be[hi]++:nd&R?be[hi]++:nd&(V|O)&&(be[hi]+=2),nd&l&&(be[hi]=hi===0?ke.level:be[hi-1]),hi===ke.end||g(oe[hi])&(B|Z))for(var rd=hi;rd>=0&&g(oe[rd])&c;rd--)be[rd]=ke.level}}return{levels:be,paragraphs:ge};function Qd(Gi,Hs){for(var ys=Gi;ys<oe.length;ys++){var _l=Pe[ys];if(_l&(R|Q))return 1;if(_l&(Z|L)||Hs&&_l===le)return 0;if(_l&s){var va=fo(ys);ys=va===-1?oe.length:va}}return 0}function fo(Gi){for(var Hs=1,ys=Gi+1;ys<oe.length;ys++){var _l=Pe[ys];if(_l&Z)break;if(_l&le){if(--Hs===0)return ys}else _l&s&&Hs++}return-1}}var we="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",pe;function xe(){if(!pe){var oe=_(we,!0),Ue=oe.map,Ee=oe.reverseMap;Ee.forEach(function(Pe,Ze){Ue.set(Ze,Pe)}),pe=Ue}}function Ve(oe){return xe(),pe.get(oe)||null}function ye(oe,Ue,Ee,Pe){var Ze=oe.length;Ee=Math.max(0,Ee==null?0:+Ee),Pe=Math.min(Ze-1,Pe==null?Ze-1:+Pe);for(var ae=new Map,te=Ee;te<=Pe;te++)if(Ue[te]&1){var be=Ve(oe[te]);be!==null&&ae.set(te,be)}return ae}function Oe(oe,Ue,Ee,Pe){var Ze=oe.length;Ee=Math.max(0,Ee==null?0:+Ee),Pe=Math.min(Ze-1,Pe==null?Ze-1:+Pe);var ae=[];return Ue.paragraphs.forEach(function(te){var be=Math.max(Ee,te.start),me=Math.min(Pe,te.end);if(be<me){for(var ge=Ue.levels.slice(be,me+1),ke=me;ke>=be&&g(oe[ke])&c;ke--)ge[ke]=te.level;for(var Xe=te.level,Ae=1/0,je=0;je<ge.length;je++){var We=ge[je];We>Xe&&(Xe=We),We<Ae&&(Ae=We|1)}for(var De=Xe;De>=Ae;De--)for(var Be=0;Be<ge.length;Be++)if(ge[Be]>=De){for(var qe=Be;Be+1<ge.length&&ge[Be+1]>=De;)Be++;Be>qe&&ae.push([qe+be,Be+be])}}}),ae}function he(oe,Ue,Ee,Pe){var Ze=Re(oe,Ue,Ee,Pe),ae=[].concat(oe);return Ze.forEach(function(te,be){ae[be]=(Ue.levels[te]&1?Ve(oe[te]):null)||oe[te]}),ae.join("")}function Re(oe,Ue,Ee,Pe){for(var Ze=Oe(oe,Ue,Ee,Pe),ae=[],te=0;te<oe.length;te++)ae[te]=te;return Ze.forEach(function(be){for(var me=be[0],ge=be[1],ke=ae.slice(me,ge+1),Xe=ke.length;Xe--;)ae[ge-Xe]=ke[Xe]}),ae}return e.closingToOpeningBracket=D,e.getBidiCharType=g,e.getBidiCharTypeName=v,e.getCanonicalBracket=P,e.getEmbeddingLevels=fe,e.getMirroredCharacter=Ve,e.getMirroredCharactersMap=ye,e.getReorderSegments=Oe,e.getReorderedIndices=Re,e.getReorderedString=he,e.openingToClosingBracket=N,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}const jK=/\bvoid\s+main\s*\(\s*\)\s*{/g;function l7(t){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function n(r,i){let s=Tr[i];return s?l7(s):r}return t.replace(e,n)}const zo=[];for(let t=0;t<256;t++)zo[t]=(t<16?"0":"")+t.toString(16);function NCe(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(zo[t&255]+zo[t>>8&255]+zo[t>>16&255]+zo[t>>24&255]+"-"+zo[e&255]+zo[e>>8&255]+"-"+zo[e>>16&15|64]+zo[e>>24&255]+"-"+zo[n&63|128]+zo[n>>8&255]+"-"+zo[n>>16&255]+zo[n>>24&255]+zo[r&255]+zo[r>>8&255]+zo[r>>16&255]+zo[r>>24&255]).toUpperCase()}const Sg=Object.assign||function(){let t=arguments[0];for(let e=1,n=arguments.length;e<n;e++){let r=arguments[e];if(r)for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},RCe=Date.now(),Kj=new WeakMap,Zj=new Map;let kCe=1e10;function c7(t,e){const n=OCe(e);let r=Kj.get(t);if(r||Kj.set(t,r=Object.create(null)),r[n])return new r[n];const i=`_onBeforeCompile${n}`,s=function(c,d){t.onBeforeCompile.call(this,c,d);const h=this.customProgramCacheKey()+"|"+c.vertexShader+"|"+c.fragmentShader;let g=Zj[h];if(!g){const v=PCe(this,c,e,n);g=Zj[h]=v}c.vertexShader=g.vertexShader,c.fragmentShader=g.fragmentShader,Sg(c.uniforms,this.uniforms),e.timeUniform&&(c.uniforms[e.timeUniform]={get value(){return Date.now()-RCe}}),this[i]&&this[i](c)},a=function(){return o(e.chained?t:t.clone())},o=function(c){const d=Object.create(c,l);return Object.defineProperty(d,"baseMaterial",{value:t}),Object.defineProperty(d,"id",{value:kCe++}),d.uuid=NCe(),d.uniforms=Sg({},c.uniforms,e.uniforms),d.defines=Sg({},c.defines,e.defines),d.defines[`TROIKA_DERIVED_MATERIAL_${n}`]="",d.extensions=Sg({},c.extensions,e.extensions),d._listeners=void 0,d},l={constructor:{value:a},isDerivedMaterial:{value:!0},type:{get:()=>t.type,set:c=>{t.type=c}},isDerivedFrom:{writable:!0,configurable:!0,value:function(c){const d=this.baseMaterial;return c===d||d.isDerivedMaterial&&d.isDerivedFrom(c)||!1}},customProgramCacheKey:{writable:!0,configurable:!0,value:function(){return t.customProgramCacheKey()+"|"+n}},onBeforeCompile:{get(){return s},set(c){this[i]=c}},copy:{writable:!0,configurable:!0,value:function(c){return t.copy.call(this,c),!t.isShaderMaterial&&!t.isDerivedMaterial&&(Sg(this.extensions,c.extensions),Sg(this.defines,c.defines),Sg(this.uniforms,NS.clone(c.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const c=new t.constructor;return o(c).copy(this)}},getDepthMaterial:{writable:!0,configurable:!0,value:function(){let c=this._depthMaterial;return c||(c=this._depthMaterial=c7(t.isDerivedMaterial?t.getDepthMaterial():new wE({depthPacking:XX}),e),c.defines.IS_DEPTH_MATERIAL="",c.uniforms=this.uniforms),c}},getDistanceMaterial:{writable:!0,configurable:!0,value:function(){let c=this._distanceMaterial;return c||(c=this._distanceMaterial=c7(t.isDerivedMaterial?t.getDistanceMaterial():new ME,e),c.defines.IS_DISTANCE_MATERIAL="",c.uniforms=this.uniforms),c}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:c,_distanceMaterial:d}=this;c&&c.dispose(),d&&d.dispose(),t.dispose.call(this)}}};return r[n]=a,new a}function PCe(t,{vertexShader:e,fragmentShader:n},r,i){let{vertexDefs:s,vertexMainIntro:a,vertexMainOutro:o,vertexTransform:l,fragmentDefs:c,fragmentMainIntro:d,fragmentMainOutro:h,fragmentColorTransform:g,customRewriter:v,timeUniform:b}=r;if(s=s||"",a=a||"",o=o||"",c=c||"",d=d||"",h=h||"",(l||v)&&(e=l7(e)),(g||v)&&(n=n.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,`
//!BEGIN_POST_CHUNK $1
$&
//!END_POST_CHUNK
`),n=l7(n)),v){let _=v({vertexShader:e,fragmentShader:n});e=_.vertexShader,n=_.fragmentShader}if(g){let _=[];n=n.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,w=>(_.push(w),"")),h=`${g}
${_.join(`
`)}
${h}`}if(b){const _=`
uniform float ${b};
`;s=_+s,c=_+c}return l&&(e=`vec3 troika_position_${i};
vec3 troika_normal_${i};
vec2 troika_uv_${i};
${e}
`,s=`${s}
void troikaVertexTransform${i}(inout vec3 position, inout vec3 normal, inout vec2 uv) {
  ${l}
}
`,a=`
troika_position_${i} = vec3(position);
troika_normal_${i} = vec3(normal);
troika_uv_${i} = vec2(uv);
troikaVertexTransform${i}(troika_position_${i}, troika_normal_${i}, troika_uv_${i});
${a}
`,e=e.replace(/\b(position|normal|uv)\b/g,(_,w,S,E)=>/\battribute\s+vec[23]\s+$/.test(E.substr(0,S))?w:`troika_${w}_${i}`),t.map&&t.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=Qj(e,i,s,a,o),n=Qj(n,i,c,d,h),{vertexShader:e,fragmentShader:n}}function Qj(t,e,n,r,i){return(r||i||n)&&(t=t.replace(jK,`
${n}
void troikaOrigMain${e}() {`),t+=`
void main() {
  ${r}
  troikaOrigMain${e}();
  ${i}
}`),t}function ICe(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}let DCe=0;const Jj=new Map;function OCe(t){const e=JSON.stringify(t,ICe);let n=Jj.get(e);return n==null&&Jj.set(e,n=++DCe),n}/*!
Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering.
Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE
*/function LCe(){return typeof window>"u"&&(self.window=self),(function(t){var e={parse:function(i){var s=e._bin,a=new Uint8Array(i);if(s.readASCII(a,0,4)=="ttcf"){var o=4;s.readUshort(a,o),o+=2,s.readUshort(a,o),o+=2;var l=s.readUint(a,o);o+=4;for(var c=[],d=0;d<l;d++){var h=s.readUint(a,o);o+=4,c.push(e._readFont(a,h))}return c}return[e._readFont(a,0)]},_readFont:function(i,s){var a=e._bin,o=s;a.readFixed(i,s),s+=4;var l=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2;for(var c=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],d={_data:i,_offset:o},h={},g=0;g<l;g++){var v=a.readASCII(i,s,4);s+=4,a.readUint(i,s),s+=4;var b=a.readUint(i,s);s+=4;var _=a.readUint(i,s);s+=4,h[v]={offset:b,length:_}}for(g=0;g<c.length;g++){var w=c[g];h[w]&&(d[w.trim()]=e[w.trim()].parse(i,h[w].offset,h[w].length,d))}return d},_tabOffset:function(i,s,a){for(var o=e._bin,l=o.readUshort(i,a+4),c=a+12,d=0;d<l;d++){var h=o.readASCII(i,c,4);c+=4,o.readUint(i,c),c+=4;var g=o.readUint(i,c);if(c+=4,o.readUint(i,c),c+=4,h==s)return g}return 0}};e._bin={readFixed:function(i,s){return(i[s]<<8|i[s+1])+(i[s+2]<<8|i[s+3])/65540},readF2dot14:function(i,s){return e._bin.readShort(i,s)/16384},readInt:function(i,s){return e._bin._view(i).getInt32(s)},readInt8:function(i,s){return e._bin._view(i).getInt8(s)},readShort:function(i,s){return e._bin._view(i).getInt16(s)},readUshort:function(i,s){return e._bin._view(i).getUint16(s)},readUshorts:function(i,s,a){for(var o=[],l=0;l<a;l++)o.push(e._bin.readUshort(i,s+2*l));return o},readUint:function(i,s){return e._bin._view(i).getUint32(s)},readUint64:function(i,s){return 4294967296*e._bin.readUint(i,s)+e._bin.readUint(i,s+4)},readASCII:function(i,s,a){for(var o="",l=0;l<a;l++)o+=String.fromCharCode(i[s+l]);return o},readUnicode:function(i,s,a){for(var o="",l=0;l<a;l++){var c=i[s++]<<8|i[s++];o+=String.fromCharCode(c)}return o},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(i,s,a){var o=e._bin._tdec;return o&&s==0&&a==i.length?o.decode(i):e._bin.readASCII(i,s,a)},readBytes:function(i,s,a){for(var o=[],l=0;l<a;l++)o.push(i[s+l]);return o},readASCIIArray:function(i,s,a){for(var o=[],l=0;l<a;l++)o.push(String.fromCharCode(i[s+l]));return o},_view:function(i){return i._dataView||(i._dataView=i.buffer?new DataView(i.buffer,i.byteOffset,i.byteLength):new DataView(new Uint8Array(i).buffer))}},e._lctf={},e._lctf.parse=function(i,s,a,o,l){var c=e._bin,d={},h=s;c.readFixed(i,s),s+=4;var g=c.readUshort(i,s);s+=2;var v=c.readUshort(i,s);s+=2;var b=c.readUshort(i,s);return s+=2,d.scriptList=e._lctf.readScriptList(i,h+g),d.featureList=e._lctf.readFeatureList(i,h+v),d.lookupList=e._lctf.readLookupList(i,h+b,l),d},e._lctf.readLookupList=function(i,s,a){var o=e._bin,l=s,c=[],d=o.readUshort(i,s);s+=2;for(var h=0;h<d;h++){var g=o.readUshort(i,s);s+=2;var v=e._lctf.readLookupTable(i,l+g,a);c.push(v)}return c},e._lctf.readLookupTable=function(i,s,a){var o=e._bin,l=s,c={tabs:[]};c.ltype=o.readUshort(i,s),s+=2,c.flag=o.readUshort(i,s),s+=2;var d=o.readUshort(i,s);s+=2;for(var h=c.ltype,g=0;g<d;g++){var v=o.readUshort(i,s);s+=2;var b=a(i,h,l+v,c);c.tabs.push(b)}return c},e._lctf.numOfOnes=function(i){for(var s=0,a=0;a<32;a++)(i>>>a&1)!=0&&s++;return s},e._lctf.readClassDef=function(i,s){var a=e._bin,o=[],l=a.readUshort(i,s);if(s+=2,l==1){var c=a.readUshort(i,s);s+=2;var d=a.readUshort(i,s);s+=2;for(var h=0;h<d;h++)o.push(c+h),o.push(c+h),o.push(a.readUshort(i,s)),s+=2}if(l==2){var g=a.readUshort(i,s);for(s+=2,h=0;h<g;h++)o.push(a.readUshort(i,s)),s+=2,o.push(a.readUshort(i,s)),s+=2,o.push(a.readUshort(i,s)),s+=2}return o},e._lctf.getInterval=function(i,s){for(var a=0;a<i.length;a+=3){var o=i[a],l=i[a+1];if(i[a+2],o<=s&&s<=l)return a}return-1},e._lctf.readCoverage=function(i,s){var a=e._bin,o={};o.fmt=a.readUshort(i,s),s+=2;var l=a.readUshort(i,s);return s+=2,o.fmt==1&&(o.tab=a.readUshorts(i,s,l)),o.fmt==2&&(o.tab=a.readUshorts(i,s,3*l)),o},e._lctf.coverageIndex=function(i,s){var a=i.tab;if(i.fmt==1)return a.indexOf(s);if(i.fmt==2){var o=e._lctf.getInterval(a,s);if(o!=-1)return a[o+2]+(s-a[o])}return-1},e._lctf.readFeatureList=function(i,s){var a=e._bin,o=s,l=[],c=a.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=a.readASCII(i,s,4);s+=4;var g=a.readUshort(i,s);s+=2;var v=e._lctf.readFeatureTable(i,o+g);v.tag=h.trim(),l.push(v)}return l},e._lctf.readFeatureTable=function(i,s){var a=e._bin,o=s,l={},c=a.readUshort(i,s);s+=2,c>0&&(l.featureParams=o+c);var d=a.readUshort(i,s);s+=2,l.tab=[];for(var h=0;h<d;h++)l.tab.push(a.readUshort(i,s+2*h));return l},e._lctf.readScriptList=function(i,s){var a=e._bin,o=s,l={},c=a.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=a.readASCII(i,s,4);s+=4;var g=a.readUshort(i,s);s+=2,l[h.trim()]=e._lctf.readScriptTable(i,o+g)}return l},e._lctf.readScriptTable=function(i,s){var a=e._bin,o=s,l={},c=a.readUshort(i,s);s+=2,c>0&&(l.default=e._lctf.readLangSysTable(i,o+c));var d=a.readUshort(i,s);s+=2;for(var h=0;h<d;h++){var g=a.readASCII(i,s,4);s+=4;var v=a.readUshort(i,s);s+=2,l[g.trim()]=e._lctf.readLangSysTable(i,o+v)}return l},e._lctf.readLangSysTable=function(i,s){var a=e._bin,o={};a.readUshort(i,s),s+=2,o.reqFeature=a.readUshort(i,s),s+=2;var l=a.readUshort(i,s);return s+=2,o.features=a.readUshorts(i,s,l),o},e.CFF={},e.CFF.parse=function(i,s,a){var o=e._bin;(i=new Uint8Array(i.buffer,s,a))[s=0],i[++s],i[++s],i[++s],s++;var l=[];s=e.CFF.readIndex(i,s,l);for(var c=[],d=0;d<l.length-1;d++)c.push(o.readASCII(i,s+l[d],l[d+1]-l[d]));s+=l[l.length-1];var h=[];s=e.CFF.readIndex(i,s,h);var g=[];for(d=0;d<h.length-1;d++)g.push(e.CFF.readDict(i,s+h[d],s+h[d+1]));s+=h[h.length-1];var v=g[0],b=[];s=e.CFF.readIndex(i,s,b);var _=[];for(d=0;d<b.length-1;d++)_.push(o.readASCII(i,s+b[d],b[d+1]-b[d]));if(s+=b[b.length-1],e.CFF.readSubrs(i,s,v),v.CharStrings){s=v.CharStrings,b=[],s=e.CFF.readIndex(i,s,b);var w=[];for(d=0;d<b.length-1;d++)w.push(o.readBytes(i,s+b[d],b[d+1]-b[d]));v.CharStrings=w}if(v.ROS){s=v.FDArray;var S=[];for(s=e.CFF.readIndex(i,s,S),v.FDArray=[],d=0;d<S.length-1;d++){var E=e.CFF.readDict(i,s+S[d],s+S[d+1]);e.CFF._readFDict(i,E,_),v.FDArray.push(E)}s+=S[S.length-1],s=v.FDSelect,v.FDSelect=[];var A=i[s];if(s++,A!=3)throw A;var N=o.readUshort(i,s);for(s+=2,d=0;d<N+1;d++)v.FDSelect.push(o.readUshort(i,s),i[s+2]),s+=3}return v.Encoding&&(v.Encoding=e.CFF.readEncoding(i,v.Encoding,v.CharStrings.length)),v.charset&&(v.charset=e.CFF.readCharset(i,v.charset,v.CharStrings.length)),e.CFF._readFDict(i,v,_),v},e.CFF._readFDict=function(i,s,a){var o;for(var l in s.Private&&(o=s.Private[1],s.Private=e.CFF.readDict(i,o,o+s.Private[0]),s.Private.Subrs&&e.CFF.readSubrs(i,o+s.Private.Subrs,s.Private)),s)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(l)!=-1&&(s[l]=a[s[l]-426+35])},e.CFF.readSubrs=function(i,s,a){var o=e._bin,l=[];s=e.CFF.readIndex(i,s,l);var c,d=l.length;c=d<1240?107:d<33900?1131:32768,a.Bias=c,a.Subrs=[];for(var h=0;h<l.length-1;h++)a.Subrs.push(o.readBytes(i,s+l[h],l[h+1]-l[h]))},e.CFF.tableSE=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,0,111,112,113,114,0,115,116,117,118,119,120,121,122,0,123,0,124,125,126,127,128,129,130,131,0,132,133,0,134,135,136,137,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,0,139,0,0,0,0,140,141,142,143,0,0,0,0,0,144,0,0,0,145,0,0,146,147,148,149,0,0,0,0],e.CFF.glyphByUnicode=function(i,s){for(var a=0;a<i.charset.length;a++)if(i.charset[a]==s)return a;return-1},e.CFF.glyphBySE=function(i,s){return s<0||s>255?-1:e.CFF.glyphByUnicode(i,e.CFF.tableSE[s])},e.CFF.readEncoding=function(i,s,a){e._bin;var o=[".notdef"],l=i[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var c=i[s];s++;for(var d=0;d<c;d++)o.push(i[s+d]);return o},e.CFF.readCharset=function(i,s,a){var o=e._bin,l=[".notdef"],c=i[s];if(s++,c==0)for(var d=0;d<a;d++){var h=o.readUshort(i,s);s+=2,l.push(h)}else{if(c!=1&&c!=2)throw"error: format: "+c;for(;l.length<a;){h=o.readUshort(i,s),s+=2;var g=0;for(c==1?(g=i[s],s++):(g=o.readUshort(i,s),s+=2),d=0;d<=g;d++)l.push(h),h++}}return l},e.CFF.readIndex=function(i,s,a){var o=e._bin,l=o.readUshort(i,s)+1,c=i[s+=2];if(s++,c==1)for(var d=0;d<l;d++)a.push(i[s+d]);else if(c==2)for(d=0;d<l;d++)a.push(o.readUshort(i,s+2*d));else if(c==3)for(d=0;d<l;d++)a.push(16777215&o.readUint(i,s+3*d-1));else if(l!=1)throw"unsupported offset size: "+c+", count: "+l;return(s+=l*c)-1},e.CFF.getCharString=function(i,s,a){var o=e._bin,l=i[s],c=i[s+1];i[s+2],i[s+3],i[s+4];var d=1,h=null,g=null;l<=20&&(h=l,d=1),l==12&&(h=100*l+c,d=2),21<=l&&l<=27&&(h=l,d=1),l==28&&(g=o.readShort(i,s+1),d=3),29<=l&&l<=31&&(h=l,d=1),32<=l&&l<=246&&(g=l-139,d=1),247<=l&&l<=250&&(g=256*(l-247)+c+108,d=2),251<=l&&l<=254&&(g=256*-(l-251)-c-108,d=2),l==255&&(g=o.readInt(i,s+1)/65535,d=5),a.val=g??"o"+h,a.size=d},e.CFF.readCharString=function(i,s,a){for(var o=s+a,l=e._bin,c=[];s<o;){var d=i[s],h=i[s+1];i[s+2],i[s+3],i[s+4];var g=1,v=null,b=null;d<=20&&(v=d,g=1),d==12&&(v=100*d+h,g=2),d!=19&&d!=20||(v=d,g=2),21<=d&&d<=27&&(v=d,g=1),d==28&&(b=l.readShort(i,s+1),g=3),29<=d&&d<=31&&(v=d,g=1),32<=d&&d<=246&&(b=d-139,g=1),247<=d&&d<=250&&(b=256*(d-247)+h+108,g=2),251<=d&&d<=254&&(b=256*-(d-251)-h-108,g=2),d==255&&(b=l.readInt(i,s+1)/65535,g=5),c.push(b??"o"+v),s+=g}return c},e.CFF.readDict=function(i,s,a){for(var o=e._bin,l={},c=[];s<a;){var d=i[s],h=i[s+1];i[s+2],i[s+3],i[s+4];var g=1,v=null,b=null;if(d==28&&(b=o.readShort(i,s+1),g=3),d==29&&(b=o.readInt(i,s+1),g=5),32<=d&&d<=246&&(b=d-139,g=1),247<=d&&d<=250&&(b=256*(d-247)+h+108,g=2),251<=d&&d<=254&&(b=256*-(d-251)-h-108,g=2),d==255)throw b=o.readInt(i,s+1)/65535,g=5,"unknown number";if(d==30){var _=[];for(g=1;;){var w=i[s+g];g++;var S=w>>4,E=15&w;if(S!=15&&_.push(S),E!=15&&_.push(E),E==15)break}for(var A="",N=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],D=0;D<_.length;D++)A+=N[_[D]];b=parseFloat(A)}d<=21&&(v=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][d],g=1,d==12&&(v=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][h],g=2)),v!=null?(l[v]=c.length==1?c[0]:c,c=[]):c.push(b),s+=g}return l},e.cmap={},e.cmap.parse=function(i,s,a){i=new Uint8Array(i.buffer,s,a),s=0;var o=e._bin,l={};o.readUshort(i,s),s+=2;var c=o.readUshort(i,s);s+=2;var d=[];l.tables=[];for(var h=0;h<c;h++){var g=o.readUshort(i,s);s+=2;var v=o.readUshort(i,s);s+=2;var b=o.readUint(i,s);s+=4;var _="p"+g+"e"+v,w=d.indexOf(b);if(w==-1){var S;w=l.tables.length,d.push(b);var E=o.readUshort(i,b);E==0?S=e.cmap.parse0(i,b):E==4?S=e.cmap.parse4(i,b):E==6?S=e.cmap.parse6(i,b):E==12?S=e.cmap.parse12(i,b):console.debug("unknown format: "+E,g,v,b),l.tables.push(S)}if(l[_]!=null)throw"multiple tables for one platform+encoding";l[_]=w}return l},e.cmap.parse0=function(i,s){var a=e._bin,o={};o.format=a.readUshort(i,s),s+=2;var l=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2,o.map=[];for(var c=0;c<l-6;c++)o.map.push(i[s+c]);return o},e.cmap.parse4=function(i,s){var a=e._bin,o=s,l={};l.format=a.readUshort(i,s),s+=2;var c=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2;var d=a.readUshort(i,s);s+=2;var h=d/2;l.searchRange=a.readUshort(i,s),s+=2,l.entrySelector=a.readUshort(i,s),s+=2,l.rangeShift=a.readUshort(i,s),s+=2,l.endCount=a.readUshorts(i,s,h),s+=2*h,s+=2,l.startCount=a.readUshorts(i,s,h),s+=2*h,l.idDelta=[];for(var g=0;g<h;g++)l.idDelta.push(a.readShort(i,s)),s+=2;for(l.idRangeOffset=a.readUshorts(i,s,h),s+=2*h,l.glyphIdArray=[];s<o+c;)l.glyphIdArray.push(a.readUshort(i,s)),s+=2;return l},e.cmap.parse6=function(i,s){var a=e._bin,o={};o.format=a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,o.firstCode=a.readUshort(i,s),s+=2;var l=a.readUshort(i,s);s+=2,o.glyphIdArray=[];for(var c=0;c<l;c++)o.glyphIdArray.push(a.readUshort(i,s)),s+=2;return o},e.cmap.parse12=function(i,s){var a=e._bin,o={};o.format=a.readUshort(i,s),s+=2,s+=2,a.readUint(i,s),s+=4,a.readUint(i,s),s+=4;var l=a.readUint(i,s);s+=4,o.groups=[];for(var c=0;c<l;c++){var d=s+12*c,h=a.readUint(i,d+0),g=a.readUint(i,d+4),v=a.readUint(i,d+8);o.groups.push([h,g,v])}return o},e.glyf={},e.glyf.parse=function(i,s,a,o){for(var l=[],c=0;c<o.maxp.numGlyphs;c++)l.push(null);return l},e.glyf._parseGlyf=function(i,s){var a=e._bin,o=i._data,l=e._tabOffset(o,"glyf",i._offset)+i.loca[s];if(i.loca[s]==i.loca[s+1])return null;var c={};if(c.noc=a.readShort(o,l),l+=2,c.xMin=a.readShort(o,l),l+=2,c.yMin=a.readShort(o,l),l+=2,c.xMax=a.readShort(o,l),l+=2,c.yMax=a.readShort(o,l),l+=2,c.xMin>=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var d=0;d<c.noc;d++)c.endPts.push(a.readUshort(o,l)),l+=2;var h=a.readUshort(o,l);if(l+=2,o.length-l<h)return null;c.instructions=a.readBytes(o,l,h),l+=h;var g=c.endPts[c.noc-1]+1;for(c.flags=[],d=0;d<g;d++){var v=o[l];if(l++,c.flags.push(v),(8&v)!=0){var b=o[l];l++;for(var _=0;_<b;_++)c.flags.push(v),d++}}for(c.xs=[],d=0;d<g;d++){var w=(2&c.flags[d])!=0,S=(16&c.flags[d])!=0;w?(c.xs.push(S?o[l]:-o[l]),l++):S?c.xs.push(0):(c.xs.push(a.readShort(o,l)),l+=2)}for(c.ys=[],d=0;d<g;d++)w=(4&c.flags[d])!=0,S=(32&c.flags[d])!=0,w?(c.ys.push(S?o[l]:-o[l]),l++):S?c.ys.push(0):(c.ys.push(a.readShort(o,l)),l+=2);var E=0,A=0;for(d=0;d<g;d++)E+=c.xs[d],A+=c.ys[d],c.xs[d]=E,c.ys[d]=A}else{var N;c.parts=[];do{N=a.readUshort(o,l),l+=2;var D={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(D),D.glyphIndex=a.readUshort(o,l),l+=2,1&N){var P=a.readShort(o,l);l+=2;var L=a.readShort(o,l);l+=2}else P=a.readInt8(o,l),l++,L=a.readInt8(o,l),l++;2&N?(D.m.tx=P,D.m.ty=L):(D.p1=P,D.p2=L),8&N?(D.m.a=D.m.d=a.readF2dot14(o,l),l+=2):64&N?(D.m.a=a.readF2dot14(o,l),l+=2,D.m.d=a.readF2dot14(o,l),l+=2):128&N&&(D.m.a=a.readF2dot14(o,l),l+=2,D.m.b=a.readF2dot14(o,l),l+=2,D.m.c=a.readF2dot14(o,l),l+=2,D.m.d=a.readF2dot14(o,l),l+=2)}while(32&N);if(256&N){var R=a.readUshort(o,l);for(l+=2,c.instr=[],d=0;d<R;d++)c.instr.push(o[l]),l++}}return c},e.GDEF={},e.GDEF.parse=function(i,s,a,o){var l=s;s+=4;var c=e._bin.readUshort(i,s);return{glyphClassDef:c===0?null:e._lctf.readClassDef(i,l+c)}},e.GPOS={},e.GPOS.parse=function(i,s,a,o){return e._lctf.parse(i,s,a,o,e.GPOS.subt)},e.GPOS.subt=function(i,s,a,o){var l=e._bin,c=a,d={};if(d.fmt=l.readUshort(i,a),a+=2,s==1||s==2||s==3||s==7||s==8&&d.fmt<=2){var h=l.readUshort(i,a);a+=2,d.coverage=e._lctf.readCoverage(i,h+c)}if(s==1&&d.fmt==1){var g=l.readUshort(i,a);a+=2,g!=0&&(d.pos=e.GPOS.readValueRecord(i,a,g))}else if(s==2&&d.fmt>=1&&d.fmt<=2){g=l.readUshort(i,a),a+=2;var v=l.readUshort(i,a);a+=2;var b=e._lctf.numOfOnes(g),_=e._lctf.numOfOnes(v);if(d.fmt==1){d.pairsets=[];var w=l.readUshort(i,a);a+=2;for(var S=0;S<w;S++){var E=c+l.readUshort(i,a);a+=2;var A=l.readUshort(i,E);E+=2;for(var N=[],D=0;D<A;D++){var P=l.readUshort(i,E);E+=2,g!=0&&(V=e.GPOS.readValueRecord(i,E,g),E+=2*b),v!=0&&(G=e.GPOS.readValueRecord(i,E,v),E+=2*_),N.push({gid2:P,val1:V,val2:G})}d.pairsets.push(N)}}if(d.fmt==2){var L=l.readUshort(i,a);a+=2;var R=l.readUshort(i,a);a+=2;var O=l.readUshort(i,a);a+=2;var W=l.readUshort(i,a);for(a+=2,d.classDef1=e._lctf.readClassDef(i,c+L),d.classDef2=e._lctf.readClassDef(i,c+R),d.matrix=[],S=0;S<O;S++){var F=[];for(D=0;D<W;D++){var V=null,G=null;g!=0&&(V=e.GPOS.readValueRecord(i,a,g),a+=2*b),v!=0&&(G=e.GPOS.readValueRecord(i,a,v),a+=2*_),F.push({val1:V,val2:G})}d.matrix.push(F)}}}else if(s==4&&d.fmt==1)d.markCoverage=e._lctf.readCoverage(i,l.readUshort(i,a)+c),d.baseCoverage=e._lctf.readCoverage(i,l.readUshort(i,a+2)+c),d.markClassCount=l.readUshort(i,a+4),d.markArray=e.GPOS.readMarkArray(i,l.readUshort(i,a+6)+c),d.baseArray=e.GPOS.readBaseArray(i,l.readUshort(i,a+8)+c,d.markClassCount);else if(s==6&&d.fmt==1)d.mark1Coverage=e._lctf.readCoverage(i,l.readUshort(i,a)+c),d.mark2Coverage=e._lctf.readCoverage(i,l.readUshort(i,a+2)+c),d.markClassCount=l.readUshort(i,a+4),d.mark1Array=e.GPOS.readMarkArray(i,l.readUshort(i,a+6)+c),d.mark2Array=e.GPOS.readBaseArray(i,l.readUshort(i,a+8)+c,d.markClassCount);else{if(s==9&&d.fmt==1){var Z=l.readUshort(i,a);a+=2;var B=l.readUint(i,a);if(a+=4,o.ltype==9)o.ltype=Z;else if(o.ltype!=Z)throw"invalid extension substitution";return e.GPOS.subt(i,o.ltype,c+B)}console.debug("unsupported GPOS table LookupType",s,"format",d.fmt)}return d},e.GPOS.readValueRecord=function(i,s,a){var o=e._bin,l=[];return l.push(1&a?o.readShort(i,s):0),s+=1&a?2:0,l.push(2&a?o.readShort(i,s):0),s+=2&a?2:0,l.push(4&a?o.readShort(i,s):0),s+=4&a?2:0,l.push(8&a?o.readShort(i,s):0),s+=8&a?2:0,l},e.GPOS.readBaseArray=function(i,s,a){var o=e._bin,l=[],c=s,d=o.readUshort(i,s);s+=2;for(var h=0;h<d;h++){for(var g=[],v=0;v<a;v++)g.push(e.GPOS.readAnchorRecord(i,c+o.readUshort(i,s))),s+=2;l.push(g)}return l},e.GPOS.readMarkArray=function(i,s){var a=e._bin,o=[],l=s,c=a.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=e.GPOS.readAnchorRecord(i,a.readUshort(i,s+2)+l);h.markClass=a.readUshort(i,s),o.push(h),s+=4}return o},e.GPOS.readAnchorRecord=function(i,s){var a=e._bin,o={};return o.fmt=a.readUshort(i,s),o.x=a.readShort(i,s+2),o.y=a.readShort(i,s+4),o},e.GSUB={},e.GSUB.parse=function(i,s,a,o){return e._lctf.parse(i,s,a,o,e.GSUB.subt)},e.GSUB.subt=function(i,s,a,o){var l=e._bin,c=a,d={};if(d.fmt=l.readUshort(i,a),a+=2,s!=1&&s!=2&&s!=4&&s!=5&&s!=6)return null;if(s==1||s==2||s==4||s==5&&d.fmt<=2||s==6&&d.fmt<=2){var h=l.readUshort(i,a);a+=2,d.coverage=e._lctf.readCoverage(i,c+h)}if(s==1&&d.fmt>=1&&d.fmt<=2){if(d.fmt==1)d.delta=l.readShort(i,a),a+=2;else if(d.fmt==2){var g=l.readUshort(i,a);a+=2,d.newg=l.readUshorts(i,a,g),a+=2*d.newg.length}}else if(s==2&&d.fmt==1){g=l.readUshort(i,a),a+=2,d.seqs=[];for(var v=0;v<g;v++){var b=l.readUshort(i,a)+c;a+=2;var _=l.readUshort(i,b);d.seqs.push(l.readUshorts(i,b+2,_))}}else if(s==4)for(d.vals=[],g=l.readUshort(i,a),a+=2,v=0;v<g;v++){var w=l.readUshort(i,a);a+=2,d.vals.push(e.GSUB.readLigatureSet(i,c+w))}else if(s==5&&d.fmt==2){if(d.fmt==2){var S=l.readUshort(i,a);a+=2,d.cDef=e._lctf.readClassDef(i,c+S),d.scset=[];var E=l.readUshort(i,a);for(a+=2,v=0;v<E;v++){var A=l.readUshort(i,a);a+=2,d.scset.push(A==0?null:e.GSUB.readSubClassSet(i,c+A))}}}else if(s==6&&d.fmt==3){if(d.fmt==3){for(v=0;v<3;v++){g=l.readUshort(i,a),a+=2;for(var N=[],D=0;D<g;D++)N.push(e._lctf.readCoverage(i,c+l.readUshort(i,a+2*D)));a+=2*g,v==0&&(d.backCvg=N),v==1&&(d.inptCvg=N),v==2&&(d.ahedCvg=N)}g=l.readUshort(i,a),a+=2,d.lookupRec=e.GSUB.readSubstLookupRecords(i,a,g)}}else{if(s==7&&d.fmt==1){var P=l.readUshort(i,a);a+=2;var L=l.readUint(i,a);if(a+=4,o.ltype==9)o.ltype=P;else if(o.ltype!=P)throw"invalid extension substitution";return e.GSUB.subt(i,o.ltype,c+L)}console.debug("unsupported GSUB table LookupType",s,"format",d.fmt)}return d},e.GSUB.readSubClassSet=function(i,s){var a=e._bin.readUshort,o=s,l=[],c=a(i,s);s+=2;for(var d=0;d<c;d++){var h=a(i,s);s+=2,l.push(e.GSUB.readSubClassRule(i,o+h))}return l},e.GSUB.readSubClassRule=function(i,s){var a=e._bin.readUshort,o={},l=a(i,s),c=a(i,s+=2);s+=2,o.input=[];for(var d=0;d<l-1;d++)o.input.push(a(i,s)),s+=2;return o.substLookupRecords=e.GSUB.readSubstLookupRecords(i,s,c),o},e.GSUB.readSubstLookupRecords=function(i,s,a){for(var o=e._bin.readUshort,l=[],c=0;c<a;c++)l.push(o(i,s),o(i,s+2)),s+=4;return l},e.GSUB.readChainSubClassSet=function(i,s){var a=e._bin,o=s,l=[],c=a.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=a.readUshort(i,s);s+=2,l.push(e.GSUB.readChainSubClassRule(i,o+h))}return l},e.GSUB.readChainSubClassRule=function(i,s){for(var a=e._bin,o={},l=["backtrack","input","lookahead"],c=0;c<l.length;c++){var d=a.readUshort(i,s);s+=2,c==1&&d--,o[l[c]]=a.readUshorts(i,s,d),s+=2*o[l[c]].length}return d=a.readUshort(i,s),s+=2,o.subst=a.readUshorts(i,s,2*d),s+=2*o.subst.length,o},e.GSUB.readLigatureSet=function(i,s){var a=e._bin,o=s,l=[],c=a.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=a.readUshort(i,s);s+=2,l.push(e.GSUB.readLigature(i,o+h))}return l},e.GSUB.readLigature=function(i,s){var a=e._bin,o={chain:[]};o.nglyph=a.readUshort(i,s),s+=2;var l=a.readUshort(i,s);s+=2;for(var c=0;c<l-1;c++)o.chain.push(a.readUshort(i,s)),s+=2;return o},e.head={},e.head.parse=function(i,s,a){var o=e._bin,l={};return o.readFixed(i,s),s+=4,l.fontRevision=o.readFixed(i,s),s+=4,o.readUint(i,s),s+=4,o.readUint(i,s),s+=4,l.flags=o.readUshort(i,s),s+=2,l.unitsPerEm=o.readUshort(i,s),s+=2,l.created=o.readUint64(i,s),s+=8,l.modified=o.readUint64(i,s),s+=8,l.xMin=o.readShort(i,s),s+=2,l.yMin=o.readShort(i,s),s+=2,l.xMax=o.readShort(i,s),s+=2,l.yMax=o.readShort(i,s),s+=2,l.macStyle=o.readUshort(i,s),s+=2,l.lowestRecPPEM=o.readUshort(i,s),s+=2,l.fontDirectionHint=o.readShort(i,s),s+=2,l.indexToLocFormat=o.readShort(i,s),s+=2,l.glyphDataFormat=o.readShort(i,s),s+=2,l},e.hhea={},e.hhea.parse=function(i,s,a){var o=e._bin,l={};return o.readFixed(i,s),s+=4,l.ascender=o.readShort(i,s),s+=2,l.descender=o.readShort(i,s),s+=2,l.lineGap=o.readShort(i,s),s+=2,l.advanceWidthMax=o.readUshort(i,s),s+=2,l.minLeftSideBearing=o.readShort(i,s),s+=2,l.minRightSideBearing=o.readShort(i,s),s+=2,l.xMaxExtent=o.readShort(i,s),s+=2,l.caretSlopeRise=o.readShort(i,s),s+=2,l.caretSlopeRun=o.readShort(i,s),s+=2,l.caretOffset=o.readShort(i,s),s+=2,s+=8,l.metricDataFormat=o.readShort(i,s),s+=2,l.numberOfHMetrics=o.readUshort(i,s),s+=2,l},e.hmtx={},e.hmtx.parse=function(i,s,a,o){for(var l=e._bin,c={aWidth:[],lsBearing:[]},d=0,h=0,g=0;g<o.maxp.numGlyphs;g++)g<o.hhea.numberOfHMetrics&&(d=l.readUshort(i,s),s+=2,h=l.readShort(i,s),s+=2),c.aWidth.push(d),c.lsBearing.push(h);return c},e.kern={},e.kern.parse=function(i,s,a,o){var l=e._bin,c=l.readUshort(i,s);if(s+=2,c==1)return e.kern.parseV1(i,s-2,a,o);var d=l.readUshort(i,s);s+=2;for(var h={glyph1:[],rval:[]},g=0;g<d;g++){s+=2,a=l.readUshort(i,s),s+=2;var v=l.readUshort(i,s);s+=2;var b=v>>>8;if((b&=15)!=0)throw"unknown kern table format: "+b;s=e.kern.readFormat0(i,s,h)}return h},e.kern.parseV1=function(i,s,a,o){var l=e._bin;l.readFixed(i,s),s+=4;var c=l.readUint(i,s);s+=4;for(var d={glyph1:[],rval:[]},h=0;h<c;h++){l.readUint(i,s),s+=4;var g=l.readUshort(i,s);s+=2,l.readUshort(i,s),s+=2;var v=g>>>8;if((v&=15)!=0)throw"unknown kern table format: "+v;s=e.kern.readFormat0(i,s,d)}return d},e.kern.readFormat0=function(i,s,a){var o=e._bin,l=-1,c=o.readUshort(i,s);s+=2,o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2;for(var d=0;d<c;d++){var h=o.readUshort(i,s);s+=2;var g=o.readUshort(i,s);s+=2;var v=o.readShort(i,s);s+=2,h!=l&&(a.glyph1.push(h),a.rval.push({glyph2:[],vals:[]}));var b=a.rval[a.rval.length-1];b.glyph2.push(g),b.vals.push(v),l=h}return s},e.loca={},e.loca.parse=function(i,s,a,o){var l=e._bin,c=[],d=o.head.indexToLocFormat,h=o.maxp.numGlyphs+1;if(d==0)for(var g=0;g<h;g++)c.push(l.readUshort(i,s+(g<<1))<<1);if(d==1)for(g=0;g<h;g++)c.push(l.readUint(i,s+(g<<2)));return c},e.maxp={},e.maxp.parse=function(i,s,a){var o=e._bin,l={},c=o.readUint(i,s);return s+=4,l.numGlyphs=o.readUshort(i,s),s+=2,c==65536&&(l.maxPoints=o.readUshort(i,s),s+=2,l.maxContours=o.readUshort(i,s),s+=2,l.maxCompositePoints=o.readUshort(i,s),s+=2,l.maxCompositeContours=o.readUshort(i,s),s+=2,l.maxZones=o.readUshort(i,s),s+=2,l.maxTwilightPoints=o.readUshort(i,s),s+=2,l.maxStorage=o.readUshort(i,s),s+=2,l.maxFunctionDefs=o.readUshort(i,s),s+=2,l.maxInstructionDefs=o.readUshort(i,s),s+=2,l.maxStackElements=o.readUshort(i,s),s+=2,l.maxSizeOfInstructions=o.readUshort(i,s),s+=2,l.maxComponentElements=o.readUshort(i,s),s+=2,l.maxComponentDepth=o.readUshort(i,s),s+=2),l},e.name={},e.name.parse=function(i,s,a){var o=e._bin,l={};o.readUshort(i,s),s+=2;var c=o.readUshort(i,s);s+=2,o.readUshort(i,s);for(var d,h=["copyright","fontFamily","fontSubfamily","ID","fullName","version","postScriptName","trademark","manufacturer","designer","description","urlVendor","urlDesigner","licence","licenceURL","---","typoFamilyName","typoSubfamilyName","compatibleFull","sampleText","postScriptCID","wwsFamilyName","wwsSubfamilyName","lightPalette","darkPalette"],g=s+=2,v=0;v<c;v++){var b=o.readUshort(i,s);s+=2;var _=o.readUshort(i,s);s+=2;var w=o.readUshort(i,s);s+=2;var S=o.readUshort(i,s);s+=2;var E=o.readUshort(i,s);s+=2;var A=o.readUshort(i,s);s+=2;var N,D=h[S],P=g+12*c+A;if(b==0)N=o.readUnicode(i,P,E/2);else if(b==3&&_==0)N=o.readUnicode(i,P,E/2);else if(_==0)N=o.readASCII(i,P,E);else if(_==1)N=o.readUnicode(i,P,E/2);else if(_==3)N=o.readUnicode(i,P,E/2);else{if(b!=1)throw"unknown encoding "+_+", platformID: "+b;N=o.readASCII(i,P,E),console.debug("reading unknown MAC encoding "+_+" as ASCII")}var L="p"+b+","+w.toString(16);l[L]==null&&(l[L]={}),l[L][D!==void 0?D:S]=N,l[L]._lang=w}for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==1033)return l[R];for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==0)return l[R];for(var R in l)if(l[R].postScriptName!=null&&l[R]._lang==3084)return l[R];for(var R in l)if(l[R].postScriptName!=null)return l[R];for(var R in l){d=R;break}return console.debug("returning name table with languageID "+l[d]._lang),l[d]},e["OS/2"]={},e["OS/2"].parse=function(i,s,a){var o=e._bin.readUshort(i,s);s+=2;var l={};if(o==0)e["OS/2"].version0(i,s,l);else if(o==1)e["OS/2"].version1(i,s,l);else if(o==2||o==3||o==4)e["OS/2"].version2(i,s,l);else{if(o!=5)throw"unknown OS/2 table version: "+o;e["OS/2"].version5(i,s,l)}return l},e["OS/2"].version0=function(i,s,a){var o=e._bin;return a.xAvgCharWidth=o.readShort(i,s),s+=2,a.usWeightClass=o.readUshort(i,s),s+=2,a.usWidthClass=o.readUshort(i,s),s+=2,a.fsType=o.readUshort(i,s),s+=2,a.ySubscriptXSize=o.readShort(i,s),s+=2,a.ySubscriptYSize=o.readShort(i,s),s+=2,a.ySubscriptXOffset=o.readShort(i,s),s+=2,a.ySubscriptYOffset=o.readShort(i,s),s+=2,a.ySuperscriptXSize=o.readShort(i,s),s+=2,a.ySuperscriptYSize=o.readShort(i,s),s+=2,a.ySuperscriptXOffset=o.readShort(i,s),s+=2,a.ySuperscriptYOffset=o.readShort(i,s),s+=2,a.yStrikeoutSize=o.readShort(i,s),s+=2,a.yStrikeoutPosition=o.readShort(i,s),s+=2,a.sFamilyClass=o.readShort(i,s),s+=2,a.panose=o.readBytes(i,s,10),s+=10,a.ulUnicodeRange1=o.readUint(i,s),s+=4,a.ulUnicodeRange2=o.readUint(i,s),s+=4,a.ulUnicodeRange3=o.readUint(i,s),s+=4,a.ulUnicodeRange4=o.readUint(i,s),s+=4,a.achVendID=[o.readInt8(i,s),o.readInt8(i,s+1),o.readInt8(i,s+2),o.readInt8(i,s+3)],s+=4,a.fsSelection=o.readUshort(i,s),s+=2,a.usFirstCharIndex=o.readUshort(i,s),s+=2,a.usLastCharIndex=o.readUshort(i,s),s+=2,a.sTypoAscender=o.readShort(i,s),s+=2,a.sTypoDescender=o.readShort(i,s),s+=2,a.sTypoLineGap=o.readShort(i,s),s+=2,a.usWinAscent=o.readUshort(i,s),s+=2,a.usWinDescent=o.readUshort(i,s),s+=2},e["OS/2"].version1=function(i,s,a){var o=e._bin;return s=e["OS/2"].version0(i,s,a),a.ulCodePageRange1=o.readUint(i,s),s+=4,a.ulCodePageRange2=o.readUint(i,s),s+=4},e["OS/2"].version2=function(i,s,a){var o=e._bin;return s=e["OS/2"].version1(i,s,a),a.sxHeight=o.readShort(i,s),s+=2,a.sCapHeight=o.readShort(i,s),s+=2,a.usDefault=o.readUshort(i,s),s+=2,a.usBreak=o.readUshort(i,s),s+=2,a.usMaxContext=o.readUshort(i,s),s+=2},e["OS/2"].version5=function(i,s,a){var o=e._bin;return s=e["OS/2"].version2(i,s,a),a.usLowerOpticalPointSize=o.readUshort(i,s),s+=2,a.usUpperOpticalPointSize=o.readUshort(i,s),s+=2},e.post={},e.post.parse=function(i,s,a){var o=e._bin,l={};return l.version=o.readFixed(i,s),s+=4,l.italicAngle=o.readFixed(i,s),s+=4,l.underlinePosition=o.readShort(i,s),s+=2,l.underlineThickness=o.readShort(i,s),s+=2,l},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(i,s){var a=i.cmap,o=-1;if(a.p0e4!=null?o=a.p0e4:a.p3e1!=null?o=a.p3e1:a.p1e0!=null?o=a.p1e0:a.p0e3!=null&&(o=a.p0e3),o==-1)throw"no familiar platform and encoding!";var l=a.tables[o];if(l.format==0)return s>=l.map.length?0:l.map[s];if(l.format==4){for(var c=-1,d=0;d<l.endCount.length;d++)if(s<=l.endCount[d]){c=d;break}return c==-1||l.startCount[c]>s?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[s-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:s+l.idDelta[c])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(d=0;d<l.groups.length;d++){var h=l.groups[d];if(h[0]<=s&&s<=h[1])return h[2]+(s-h[0])}return 0}throw"unknown cmap table format "+l.format},e.U.glyphToPath=function(i,s){var a={cmds:[],crds:[]};if(i.SVG&&i.SVG.entries[s]){var o=i.SVG.entries[s];return o==null?a:(typeof o=="string"&&(o=e.SVG.toPath(o),i.SVG.entries[s]=o),o)}if(i.CFF){var l={x:0,y:0,stack:[],nStems:0,haveWidth:!1,width:i.CFF.Private?i.CFF.Private.defaultWidthX:0,open:!1},c=i.CFF,d=i.CFF.Private;if(c.ROS){for(var h=0;c.FDSelect[h+2]<=s;)h+=2;d=c.FDArray[c.FDSelect[h+1]].Private}e.U._drawCFF(i.CFF.CharStrings[s],l,c,d,a)}else i.glyf&&e.U._drawGlyf(s,i,a);return a},e.U._drawGlyf=function(i,s,a){var o=s.glyf[i];o==null&&(o=s.glyf[i]=e.glyf._parseGlyf(s,i)),o!=null&&(o.noc>-1?e.U._simpleGlyph(o,a):e.U._compoGlyph(o,s,a))},e.U._simpleGlyph=function(i,s){for(var a=0;a<i.noc;a++){for(var o=a==0?0:i.endPts[a-1]+1,l=i.endPts[a],c=o;c<=l;c++){var d=c==o?l:c-1,h=c==l?o:c+1,g=1&i.flags[c],v=1&i.flags[d],b=1&i.flags[h],_=i.xs[c],w=i.ys[c];if(c==o)if(g){if(!v){e.U.P.moveTo(s,_,w);continue}e.U.P.moveTo(s,i.xs[d],i.ys[d])}else v?e.U.P.moveTo(s,i.xs[d],i.ys[d]):e.U.P.moveTo(s,(i.xs[d]+_)/2,(i.ys[d]+w)/2);g?v&&e.U.P.lineTo(s,_,w):b?e.U.P.qcurveTo(s,_,w,i.xs[h],i.ys[h]):e.U.P.qcurveTo(s,_,w,(_+i.xs[h])/2,(w+i.ys[h])/2)}e.U.P.closePath(s)}},e.U._compoGlyph=function(i,s,a){for(var o=0;o<i.parts.length;o++){var l={cmds:[],crds:[]},c=i.parts[o];e.U._drawGlyf(c.glyphIndex,s,l);for(var d=c.m,h=0;h<l.crds.length;h+=2){var g=l.crds[h],v=l.crds[h+1];a.crds.push(g*d.a+v*d.b+d.tx),a.crds.push(g*d.c+v*d.d+d.ty)}for(h=0;h<l.cmds.length;h++)a.cmds.push(l.cmds[h])}},e.U._getGlyphClass=function(i,s){var a=e._lctf.getInterval(s,i);return a==-1?0:s[a+2]},e.U._applySubs=function(i,s,a,o){for(var l=i.length-s-1,c=0;c<a.tabs.length;c++)if(a.tabs[c]!=null){var d,h=a.tabs[c];if(!h.coverage||(d=e._lctf.coverageIndex(h.coverage,i[s]))!=-1){if(a.ltype==1)i[s],h.fmt==1?i[s]=i[s]+h.delta:i[s]=h.newg[d];else if(a.ltype==4)for(var g=h.vals[d],v=0;v<g.length;v++){var b=g[v],_=b.chain.length;if(!(_>l)){for(var w=!0,S=0,E=0;E<_;E++){for(;i[s+S+(1+E)]==-1;)S++;b.chain[E]!=i[s+S+(1+E)]&&(w=!1)}if(w){for(i[s]=b.nglyph,E=0;E<_+S;E++)i[s+E+1]=-1;break}}}else if(a.ltype==5&&h.fmt==2)for(var A=e._lctf.getInterval(h.cDef,i[s]),N=h.cDef[A+2],D=h.scset[N],P=0;P<D.length;P++){var L=D[P],R=L.input;if(!(R.length>l)){for(w=!0,E=0;E<R.length;E++){var O=e._lctf.getInterval(h.cDef,i[s+1+E]);if(A==-1&&h.cDef[O+2]!=R[E]){w=!1;break}}if(w){var W=L.substLookupRecords;for(v=0;v<W.length;v+=2)W[v],W[v+1]}}}else if(a.ltype==6&&h.fmt==3){if(!e.U._glsCovered(i,h.backCvg,s-h.backCvg.length)||!e.U._glsCovered(i,h.inptCvg,s)||!e.U._glsCovered(i,h.ahedCvg,s+h.inptCvg.length))continue;var F=h.lookupRec;for(P=0;P<F.length;P+=2){A=F[P];var V=o[F[P+1]];e.U._applySubs(i,s+A,V,o)}}}}},e.U._glsCovered=function(i,s,a){for(var o=0;o<s.length;o++)if(e._lctf.coverageIndex(s[o],i[a+o])==-1)return!1;return!0},e.U.glyphsToPath=function(i,s,a){for(var o={cmds:[],crds:[]},l=0,c=0;c<s.length;c++){var d=s[c];if(d!=-1){for(var h=c<s.length-1&&s[c+1]!=-1?s[c+1]:0,g=e.U.glyphToPath(i,d),v=0;v<g.crds.length;v+=2)o.crds.push(g.crds[v]+l),o.crds.push(g.crds[v+1]);for(a&&o.cmds.push(a),v=0;v<g.cmds.length;v++)o.cmds.push(g.cmds[v]);a&&o.cmds.push("X"),l+=i.hmtx.aWidth[d],c<s.length-1&&(l+=e.U.getPairAdjustment(i,d,h))}}return o},e.U.P={},e.U.P.moveTo=function(i,s,a){i.cmds.push("M"),i.crds.push(s,a)},e.U.P.lineTo=function(i,s,a){i.cmds.push("L"),i.crds.push(s,a)},e.U.P.curveTo=function(i,s,a,o,l,c,d){i.cmds.push("C"),i.crds.push(s,a,o,l,c,d)},e.U.P.qcurveTo=function(i,s,a,o,l){i.cmds.push("Q"),i.crds.push(s,a,o,l)},e.U.P.closePath=function(i){i.cmds.push("Z")},e.U._drawCFF=function(i,s,a,o,l){for(var c=s.stack,d=s.nStems,h=s.haveWidth,g=s.width,v=s.open,b=0,_=s.x,w=s.y,S=0,E=0,A=0,N=0,D=0,P=0,L=0,R=0,O=0,W=0,F={val:0,size:0};b<i.length;){e.CFF.getCharString(i,b,F);var V=F.val;if(b+=F.size,V=="o1"||V=="o18")c.length%2!=0&&!h&&(g=c.shift()+o.nominalWidthX),d+=c.length>>1,c.length=0,h=!0;else if(V=="o3"||V=="o23")c.length%2!=0&&!h&&(g=c.shift()+o.nominalWidthX),d+=c.length>>1,c.length=0,h=!0;else if(V=="o4")c.length>1&&!h&&(g=c.shift()+o.nominalWidthX,h=!0),v&&e.U.P.closePath(l),w+=c.pop(),e.U.P.moveTo(l,_,w),v=!0;else if(V=="o5")for(;c.length>0;)_+=c.shift(),w+=c.shift(),e.U.P.lineTo(l,_,w);else if(V=="o6"||V=="o7")for(var G=c.length,Z=V=="o6",B=0;B<G;B++){var q=c.shift();Z?_+=q:w+=q,Z=!Z,e.U.P.lineTo(l,_,w)}else if(V=="o8"||V=="o24"){G=c.length;for(var K=0;K+6<=G;)S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),_=A+c.shift(),w=N+c.shift(),e.U.P.curveTo(l,S,E,A,N,_,w),K+=6;V=="o24"&&(_+=c.shift(),w+=c.shift(),e.U.P.lineTo(l,_,w))}else{if(V=="o11")break;if(V=="o1234"||V=="o1235"||V=="o1236"||V=="o1237")V=="o1234"&&(E=w,A=(S=_+c.shift())+c.shift(),W=N=E+c.shift(),P=N,R=w,_=(L=(D=(O=A+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,S,E,A,N,O,W),e.U.P.curveTo(l,D,P,L,R,_,w)),V=="o1235"&&(S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),O=A+c.shift(),W=N+c.shift(),D=O+c.shift(),P=W+c.shift(),L=D+c.shift(),R=P+c.shift(),_=L+c.shift(),w=R+c.shift(),c.shift(),e.U.P.curveTo(l,S,E,A,N,O,W),e.U.P.curveTo(l,D,P,L,R,_,w)),V=="o1236"&&(S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),W=N=E+c.shift(),P=N,L=(D=(O=A+c.shift())+c.shift())+c.shift(),R=P+c.shift(),_=L+c.shift(),e.U.P.curveTo(l,S,E,A,N,O,W),e.U.P.curveTo(l,D,P,L,R,_,w)),V=="o1237"&&(S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),O=A+c.shift(),W=N+c.shift(),D=O+c.shift(),P=W+c.shift(),L=D+c.shift(),R=P+c.shift(),Math.abs(L-_)>Math.abs(R-w)?_=L+c.shift():w=R+c.shift(),e.U.P.curveTo(l,S,E,A,N,O,W),e.U.P.curveTo(l,D,P,L,R,_,w));else if(V=="o14"){if(c.length>0&&!h&&(g=c.shift()+a.nominalWidthX,h=!0),c.length==4){var Y=c.shift(),Q=c.shift(),U=c.shift(),j=c.shift(),X=e.CFF.glyphBySE(a,U),H=e.CFF.glyphBySE(a,j);e.U._drawCFF(a.CharStrings[X],s,a,o,l),s.x=Y,s.y=Q,e.U._drawCFF(a.CharStrings[H],s,a,o,l)}v&&(e.U.P.closePath(l),v=!1)}else if(V=="o19"||V=="o20")c.length%2!=0&&!h&&(g=c.shift()+o.nominalWidthX),d+=c.length>>1,c.length=0,h=!0,b+=d+7>>3;else if(V=="o21")c.length>2&&!h&&(g=c.shift()+o.nominalWidthX,h=!0),w+=c.pop(),_+=c.pop(),v&&e.U.P.closePath(l),e.U.P.moveTo(l,_,w),v=!0;else if(V=="o22")c.length>1&&!h&&(g=c.shift()+o.nominalWidthX,h=!0),_+=c.pop(),v&&e.U.P.closePath(l),e.U.P.moveTo(l,_,w),v=!0;else if(V=="o25"){for(;c.length>6;)_+=c.shift(),w+=c.shift(),e.U.P.lineTo(l,_,w);S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),_=A+c.shift(),w=N+c.shift(),e.U.P.curveTo(l,S,E,A,N,_,w)}else if(V=="o26")for(c.length%2&&(_+=c.shift());c.length>0;)S=_,E=w+c.shift(),_=A=S+c.shift(),w=(N=E+c.shift())+c.shift(),e.U.P.curveTo(l,S,E,A,N,_,w);else if(V=="o27")for(c.length%2&&(w+=c.shift());c.length>0;)E=w,A=(S=_+c.shift())+c.shift(),N=E+c.shift(),_=A+c.shift(),w=N,e.U.P.curveTo(l,S,E,A,N,_,w);else if(V=="o10"||V=="o29"){var ie=V=="o10"?o:a;if(c.length==0)console.debug("error: empty stack");else{var ne=c.pop(),re=ie.Subrs[ne+ie.Bias];s.x=_,s.y=w,s.nStems=d,s.haveWidth=h,s.width=g,s.open=v,e.U._drawCFF(re,s,a,o,l),_=s.x,w=s.y,d=s.nStems,h=s.haveWidth,g=s.width,v=s.open}}else if(V=="o30"||V=="o31"){var ue=c.length,le=(K=0,V=="o31");for(K+=ue-(G=-3&ue);K<G;)le?(E=w,A=(S=_+c.shift())+c.shift(),w=(N=E+c.shift())+c.shift(),G-K==5?(_=A+c.shift(),K++):_=A,le=!1):(S=_,E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),_=A+c.shift(),G-K==5?(w=N+c.shift(),K++):w=N,le=!0),e.U.P.curveTo(l,S,E,A,N,_,w),K+=4}else{if((V+"").charAt(0)=="o")throw console.debug("Unknown operation: "+V,i),V;c.push(V)}}}s.x=_,s.y=w,s.nStems=d,s.haveWidth=h,s.width=g,s.open=v};var n=e,r={Typr:n};return t.Typr=n,t.default=r,Object.defineProperty(t,"__esModule",{value:!0}),t})({}).Typr}/*!
Custom bundle of woff2otf (https://github.com/arty-name/woff2otf) with fflate
(https://github.com/101arrowz/fflate) for use in Troika text rendering. 
Original licenses apply: 
- fflate: https://github.com/101arrowz/fflate/blob/master/LICENSE (MIT)
- woff2otf.js: https://github.com/arty-name/woff2otf/blob/master/woff2otf.js (Apache2)
*/function zCe(){return(function(t){var e=Uint8Array,n=Uint16Array,r=Uint32Array,i=new e([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),s=new e([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),a=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),o=function(V,G){for(var Z=new n(31),B=0;B<31;++B)Z[B]=G+=1<<V[B-1];var q=new r(Z[30]);for(B=1;B<30;++B)for(var K=Z[B];K<Z[B+1];++K)q[K]=K-Z[B]<<5|B;return[Z,q]},l=o(i,2),c=l[0],d=l[1];c[28]=258,d[258]=28;for(var h=o(s,0)[0],g=new n(32768),v=0;v<32768;++v){var b=(43690&v)>>>1|(21845&v)<<1;b=(61680&(b=(52428&b)>>>2|(13107&b)<<2))>>>4|(3855&b)<<4,g[v]=((65280&b)>>>8|(255&b)<<8)>>>1}var _=function(V,G,Z){for(var B=V.length,q=0,K=new n(G);q<B;++q)++K[V[q]-1];var Y,Q=new n(G);for(q=0;q<G;++q)Q[q]=Q[q-1]+K[q-1]<<1;{Y=new n(1<<G);var U=15-G;for(q=0;q<B;++q)if(V[q])for(var j=q<<4|V[q],X=G-V[q],H=Q[V[q]-1]++<<X,ie=H|(1<<X)-1;H<=ie;++H)Y[g[H]>>>U]=j}return Y},w=new e(288);for(v=0;v<144;++v)w[v]=8;for(v=144;v<256;++v)w[v]=9;for(v=256;v<280;++v)w[v]=7;for(v=280;v<288;++v)w[v]=8;var S=new e(32);for(v=0;v<32;++v)S[v]=5;var E=_(w,9),A=_(S,5),N=function(V){for(var G=V[0],Z=1;Z<V.length;++Z)V[Z]>G&&(G=V[Z]);return G},D=function(V,G,Z){var B=G/8|0;return(V[B]|V[B+1]<<8)>>(7&G)&Z},P=function(V,G){var Z=G/8|0;return(V[Z]|V[Z+1]<<8|V[Z+2]<<16)>>(7&G)},L=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],R=function(V,G,Z){var B=new Error(G||L[V]);if(B.code=V,Error.captureStackTrace&&Error.captureStackTrace(B,R),!Z)throw B;return B},O=function(V,G,Z){var B=V.length;if(!B||Z&&!Z.l&&B<5)return G||new e(0);var q=!G||Z,K=!Z||Z.i;Z||(Z={}),G||(G=new e(3*B));var Y,Q=function(qe){var Se=G.length;if(qe>Se){var Ye=new e(Math.max(2*Se,qe));Ye.set(G),G=Ye}},U=Z.f||0,j=Z.p||0,X=Z.b||0,H=Z.l,ie=Z.d,ne=Z.m,re=Z.n,ue=8*B;do{if(!H){Z.f=U=D(V,j,1);var le=D(V,j+1,3);if(j+=3,!le){var fe=V[(Ee=((Y=j)/8|0)+(7&Y&&1)+4)-4]|V[Ee-3]<<8,we=Ee+fe;if(we>B){K&&R(0);break}q&&Q(X+fe),G.set(V.subarray(Ee,we),X),Z.b=X+=fe,Z.p=j=8*we;continue}if(le==1)H=E,ie=A,ne=9,re=5;else if(le==2){var pe=D(V,j,31)+257,xe=D(V,j+10,15)+4,Ve=pe+D(V,j+5,31)+1;j+=14;for(var ye=new e(Ve),Oe=new e(19),he=0;he<xe;++he)Oe[a[he]]=D(V,j+3*he,7);j+=3*xe;var Re=N(Oe),oe=(1<<Re)-1,Ue=_(Oe,Re);for(he=0;he<Ve;){var Ee,Pe=Ue[D(V,j,oe)];if(j+=15&Pe,(Ee=Pe>>>4)<16)ye[he++]=Ee;else{var Ze=0,ae=0;for(Ee==16?(ae=3+D(V,j,3),j+=2,Ze=ye[he-1]):Ee==17?(ae=3+D(V,j,7),j+=3):Ee==18&&(ae=11+D(V,j,127),j+=7);ae--;)ye[he++]=Ze}}var te=ye.subarray(0,pe),be=ye.subarray(pe);ne=N(te),re=N(be),H=_(te,ne),ie=_(be,re)}else R(1);if(j>ue){K&&R(0);break}}q&&Q(X+131072);for(var me=(1<<ne)-1,ge=(1<<re)-1,ke=j;;ke=j){var Xe=(Ze=H[P(V,j)&me])>>>4;if((j+=15&Ze)>ue){K&&R(0);break}if(Ze||R(2),Xe<256)G[X++]=Xe;else{if(Xe==256){ke=j,H=null;break}var Ae=Xe-254;if(Xe>264){var je=i[he=Xe-257];Ae=D(V,j,(1<<je)-1)+c[he],j+=je}var We=ie[P(V,j)&ge],De=We>>>4;if(We||R(3),j+=15&We,be=h[De],De>3&&(je=s[De],be+=P(V,j)&(1<<je)-1,j+=je),j>ue){K&&R(0);break}q&&Q(X+131072);for(var Be=X+Ae;X<Be;X+=4)G[X]=G[X-be],G[X+1]=G[X+1-be],G[X+2]=G[X+2-be],G[X+3]=G[X+3-be];X=Be}}Z.l=H,Z.p=ke,Z.b=X,H&&(U=1,Z.m=ne,Z.d=ie,Z.n=re)}while(!U);return X==G.length?G:(function(qe,Se,Ye){(Ye==null||Ye>qe.length)&&(Ye=qe.length);var dt=new(qe instanceof n?n:qe instanceof r?r:e)(Ye-Se);return dt.set(qe.subarray(Se,Ye)),dt})(G,0,X)},W=new e(0),F=typeof TextDecoder<"u"&&new TextDecoder;try{F.decode(W,{stream:!0})}catch{}return t.convert_streams=function(V){var G=new DataView(V),Z=0;function B(){var pe=G.getUint16(Z);return Z+=2,pe}function q(){var pe=G.getUint32(Z);return Z+=4,pe}function K(pe){fe.setUint16(we,pe),we+=2}function Y(pe){fe.setUint32(we,pe),we+=4}for(var Q={signature:q(),flavor:q(),length:q(),numTables:B(),reserved:B(),totalSfntSize:q(),majorVersion:B(),minorVersion:B(),metaOffset:q(),metaLength:q(),metaOrigLength:q(),privOffset:q(),privLength:q()},U=0;Math.pow(2,U)<=Q.numTables;)U++;U--;for(var j=16*Math.pow(2,U),X=16*Q.numTables-j,H=12,ie=[],ne=0;ne<Q.numTables;ne++)ie.push({tag:q(),offset:q(),compLength:q(),origLength:q(),origChecksum:q()}),H+=16;var re,ue=new Uint8Array(12+16*ie.length+ie.reduce((function(pe,xe){return pe+xe.origLength+4}),0)),le=ue.buffer,fe=new DataView(le),we=0;return Y(Q.flavor),K(Q.numTables),K(j),K(U),K(X),ie.forEach((function(pe){Y(pe.tag),Y(pe.origChecksum),Y(H),Y(pe.origLength),pe.outOffset=H,(H+=pe.origLength)%4!=0&&(H+=4-H%4)})),ie.forEach((function(pe){var xe,Ve=V.slice(pe.offset,pe.offset+pe.compLength);if(pe.compLength!=pe.origLength){var ye=new Uint8Array(pe.origLength);xe=new Uint8Array(Ve,2),O(xe,ye)}else ye=new Uint8Array(Ve);ue.set(ye,pe.outOffset);var Oe=0;(H=pe.outOffset+pe.origLength)%4!=0&&(Oe=4-H%4),ue.set(new Uint8Array(Oe).buffer,pe.outOffset+pe.origLength),re=H+Oe})),le.slice(0,re)},Object.defineProperty(t,"__esModule",{value:!0}),t})({}).convert_streams}function jCe(t,e){const n={M:2,L:2,Q:4,C:6,Z:0},r={C:"18g,ca,368,1kz",D:"17k,6,2,2+4,5+c,2+6,2+1,10+1,9+f,j+11,2+1,a,2,2+1,15+2,3,j+2,6+3,2+8,2,2,2+1,w+a,4+e,3+3,2,3+2,3+5,23+w,2f+4,3,2+9,2,b,2+3,3,1k+9,6+1,3+1,2+2,2+d,30g,p+y,1,1+1g,f+x,2,sd2+1d,jf3+4,f+3,2+4,2+2,b+3,42,2,4+2,2+1,2,3,t+1,9f+w,2,el+2,2+g,d+2,2l,2+1,5,3+1,2+1,2,3,6,16wm+1v",R:"17m+3,2,2,6+3,m,15+2,2+2,h+h,13,3+8,2,2,3+1,2,p+1,x,5+4,5,a,2,2,3,u,c+2,g+1,5,2+1,4+1,5j,6+1,2,b,2+2,f,2+1,1s+2,2,3+1,7,1ez0,2,2+1,4+4,b,4,3,b,42,2+2,4,3,2+1,2,o+3,ae,ep,x,2o+2,3+1,3,5+1,6",L:"x9u,jff,a,fd,jv",T:"4t,gj+33,7o+4,1+1,7c+18,2,2+1,2+1,2,21+a,2,1b+k,h,2u+6,3+5,3+1,2+3,y,2,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,3,7,6+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+d,1,1+1,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,ek,3+1,r+4,1e+4,6+5,2p+c,1+3,1,1+2,1+b,2db+2,3y,2p+v,ff+3,30+1,n9x,1+2,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,5s,6y+2,ea,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+9,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2,2b+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,470+8,at4+4,1o+6,t5,1s+3,2a,f5l+1,2+3,43o+2,a+7,1+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,1,gzau,v+2n,3l+6n"},i=1,s=2,a=4,o=8,l=16,c=32;let d;function h(L){if(!d){const R={R:s,L:i,D:a,C:l,U:c,T:o};d=new Map;for(let O in r){let W=0;r[O].split(",").forEach(F=>{let[V,G]=F.split("+");V=parseInt(V,36),G=G?parseInt(G,36):0,d.set(W+=V,R[O]);for(let Z=G;Z--;)d.set(++W,R[O])})}}return d.get(L)||c}const g=1,v=2,b=3,_=4,w=[null,"isol","init","fina","medi"];function S(L){const R=new Uint8Array(L.length);let O=c,W=g,F=-1;for(let V=0;V<L.length;V++){const G=L.codePointAt(V);let Z=h(G)|0,B=g;Z&o||(O&(i|a|l)?Z&(s|a|l)?(B=b,(W===g||W===b)&&R[F]++):Z&(i|c)&&(W===v||W===_)&&R[F]--:O&(s|c)&&(W===v||W===_)&&R[F]--,W=R[V]=B,O=Z,F=V,G>65535&&V++)}return R}function E(L,R){const O=[];for(let F=0;F<R.length;F++){const V=R.codePointAt(F);V>65535&&F++,O.push(t.U.codeToGlyph(L,V))}const W=L.GSUB;if(W){const{lookupList:F,featureList:V}=W;let G;const Z=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,B=[];V.forEach(q=>{if(Z.test(q.tag))for(let K=0;K<q.tab.length;K++){if(B[q.tab[K]])continue;B[q.tab[K]]=!0;const Y=F[q.tab[K]],Q=/^(isol|init|fina|medi)$/.test(q.tag);Q&&!G&&(G=S(R));for(let U=0;U<O.length;U++)(!G||!Q||w[G[U]]===q.tag)&&t.U._applySubs(O,U,Y,F)}})}return O}function A(L,R){const O=new Int16Array(R.length*3);let W=0;for(;W<R.length;W++){const Z=R[W];if(Z===-1)continue;O[W*3+2]=L.hmtx.aWidth[Z];const B=L.GPOS;if(B){const q=B.lookupList;for(let K=0;K<q.length;K++){const Y=q[K];for(let Q=0;Q<Y.tabs.length;Q++){const U=Y.tabs[Q];if(Y.ltype===1){if(t._lctf.coverageIndex(U.coverage,Z)!==-1&&U.pos){G(U.pos,W);break}}else if(Y.ltype===2){let j=null,X=F();if(X!==-1){const H=t._lctf.coverageIndex(U.coverage,R[X]);if(H!==-1){if(U.fmt===1){const ie=U.pairsets[H];for(let ne=0;ne<ie.length;ne++)ie[ne].gid2===Z&&(j=ie[ne])}else if(U.fmt===2){const ie=t.U._getGlyphClass(R[X],U.classDef1),ne=t.U._getGlyphClass(Z,U.classDef2);j=U.matrix[ie][ne]}if(j){j.val1&&G(j.val1,X),j.val2&&G(j.val2,W);break}}}}else if(Y.ltype===4){const j=t._lctf.coverageIndex(U.markCoverage,Z);if(j!==-1){const X=F(V),H=X===-1?-1:t._lctf.coverageIndex(U.baseCoverage,R[X]);if(H!==-1){const ie=U.markArray[j],ne=U.baseArray[H][ie.markClass];O[W*3]=ne.x-ie.x+O[X*3]-O[X*3+2],O[W*3+1]=ne.y-ie.y+O[X*3+1];break}}}else if(Y.ltype===6){const j=t._lctf.coverageIndex(U.mark1Coverage,Z);if(j!==-1){const X=F();if(X!==-1){const H=R[X];if(N(L,H)===3){const ie=t._lctf.coverageIndex(U.mark2Coverage,H);if(ie!==-1){const ne=U.mark1Array[j],re=U.mark2Array[ie][ne.markClass];O[W*3]=re.x-ne.x+O[X*3]-O[X*3+2],O[W*3+1]=re.y-ne.y+O[X*3+1];break}}}}}}}}else if(L.kern&&!L.cff){const q=F();if(q!==-1){const K=L.kern.glyph1.indexOf(R[q]);if(K!==-1){const Y=L.kern.rval[K].glyph2.indexOf(Z);Y!==-1&&(O[q*3+2]+=L.kern.rval[K].vals[Y])}}}}return O;function F(Z){for(let B=W-1;B>=0;B--)if(R[B]!==-1&&(!Z||Z(R[B])))return B;return-1}function V(Z){return N(L,Z)===1}function G(Z,B){for(let q=0;q<3;q++)O[B*3+q]+=Z[q]||0}}function N(L,R){const O=L.GDEF&&L.GDEF.glyphClassDef;return O?t.U._getGlyphClass(R,O):0}function D(...L){for(let R=0;R<L.length;R++)if(typeof L[R]=="number")return L[R]}function P(L){const R=Object.create(null),O=L["OS/2"],W=L.hhea,F=L.head.unitsPerEm,V=D(O&&O.sTypoAscender,W&&W.ascender,F),G={unitsPerEm:F,ascender:V,descender:D(O&&O.sTypoDescender,W&&W.descender,0),capHeight:D(O&&O.sCapHeight,V),xHeight:D(O&&O.sxHeight,V),lineGap:D(O&&O.sTypoLineGap,W&&W.lineGap),supportsCodePoint(Z){return t.U.codeToGlyph(L,Z)>0},forEachGlyph(Z,B,q,K){let Y=0;const Q=1/G.unitsPerEm*B,U=E(L,Z);let j=0;const X=A(L,U);return U.forEach((H,ie)=>{if(H!==-1){let ne=R[H];if(!ne){const{cmds:re,crds:ue}=t.U.glyphToPath(L,H);let le="",fe=0;for(let ye=0,Oe=re.length;ye<Oe;ye++){const he=n[re[ye]];le+=re[ye];for(let Re=1;Re<=he;Re++)le+=(Re>1?",":"")+ue[fe++]}let we,pe,xe,Ve;if(ue.length){we=pe=1/0,xe=Ve=-1/0;for(let ye=0,Oe=ue.length;ye<Oe;ye+=2){let he=ue[ye],Re=ue[ye+1];he<we&&(we=he),Re<pe&&(pe=Re),he>xe&&(xe=he),Re>Ve&&(Ve=Re)}}else we=xe=pe=Ve=0;ne=R[H]={index:H,advanceWidth:L.hmtx.aWidth[H],xMin:we,yMin:pe,xMax:xe,yMax:Ve,path:le}}K.call(null,ne,Y+X[ie*3]*Q,X[ie*3+1]*Q,j),Y+=X[ie*3+2]*Q,q&&(Y+=q*B)}j+=Z.codePointAt(j)>65535?2:1}),Y}};return G}return function(R){const O=new Uint8Array(R,0,4),W=t._bin.readASCII(O,0,4);if(W==="wOFF")R=e(R);else if(W==="wOF2")throw new Error("woff2 fonts not supported");return P(t.parse(R)[0])}}const FCe=Ly({name:"Typr Font Parser",dependencies:[LCe,zCe,jCe],init(t,e,n){const r=t(),i=e();return n(r,i)}});/*!
Custom bundle of @unicode-font-resolver/client v1.0.2 (https://github.com/lojjic/unicode-font-resolver)
for use in Troika text rendering. 
Original MIT license applies
*/function UCe(){return(function(t){var e=function(){this.buckets=new Map};e.prototype.add=function(A){var N=A>>5;this.buckets.set(N,(this.buckets.get(N)||0)|1<<(31&A))},e.prototype.has=function(A){var N=this.buckets.get(A>>5);return N!==void 0&&(N&1<<(31&A))!=0},e.prototype.serialize=function(){var A=[];return this.buckets.forEach((function(N,D){A.push((+D).toString(36)+":"+N.toString(36))})),A.join(",")},e.prototype.deserialize=function(A){var N=this;this.buckets.clear(),A.split(",").forEach((function(D){var P=D.split(":");N.buckets.set(parseInt(P[0],36),parseInt(P[1],36))}))};var n=Math.pow(2,8),r=n-1,i=~r;function s(A){var N=(function(P){return P&i})(A).toString(16),D=(function(P){return(P&i)+n-1})(A).toString(16);return"codepoint-index/plane"+(A>>16)+"/"+N+"-"+D+".json"}function a(A,N){var D=A&r,P=N.codePointAt(D/6|0);return((P=(P||48)-48)&1<<D%6)!=0}function o(A,N){var D;(D=A,D.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(P){return P.split("-").map((function(L){return parseInt(L.trim(),16)}))}))).forEach((function(P){var L=P[0],R=P[1];R===void 0&&(R=L),N(L,R)}))}function l(A,N){o(A,(function(D,P){for(var L=D;L<=P;L++)N(L)}))}var c={},d={},h=new WeakMap,g="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function v(A){var N=h.get(A);return N||(N=new e,l(A.ranges,(function(D){return N.add(D)})),h.set(A,N)),N}var b,_=new Map;function w(A,N,D){return A[N]?N:A[D]?D:(function(P){for(var L in P)return L})(A)}function S(A,N){var D=N;if(!A.includes(D)){D=1/0;for(var P=0;P<A.length;P++)Math.abs(A[P]-N)<Math.abs(D-N)&&(D=A[P])}return D}function E(A){return b||(b=new Set,l("9-D,20,85,A0,1680,2000-200A,2028-202F,205F,3000",(function(N){b.add(N)}))),b.has(A)}return t.CodePointSet=e,t.clearCache=function(){c={},d={}},t.getFontsForString=function(A,N){N===void 0&&(N={});var D,P=N.lang;P===void 0&&(P=new RegExp("\\p{Script=Hangul}","u").test(D=A)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(D)?"ja":"en");var L=N.category;L===void 0&&(L="sans-serif");var R=N.style;R===void 0&&(R="normal");var O=N.weight;O===void 0&&(O=400);var W=(N.dataUrl||g).replace(/\/$/g,""),F=new Map,V=new Uint8Array(A.length),G={},Z={},B=new Array(A.length),q=new Map,K=!1;function Y(j){var X=_.get(j);return X||(X=fetch(W+"/"+j).then((function(H){if(!H.ok)throw new Error(H.statusText);return H.json().then((function(ie){if(!Array.isArray(ie)||ie[0]!==1)throw new Error("Incorrect schema version; need 1, got "+ie[0]);return ie[1]}))})).catch((function(H){if(W!==g)return K||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+W+'", trying default CDN. '+H.message),K=!0),W=g,_.delete(j),Y(j);throw H})),_.set(j,X)),X}for(var Q=function(j){var X=A.codePointAt(j),H=s(X);B[j]=H,c[H]||q.has(H)||q.set(H,Y(H).then((function(ie){c[H]=ie}))),X>65535&&(j++,U=j)},U=0;U<A.length;U++)Q(U);return Promise.all(q.values()).then((function(){q.clear();for(var j=function(H){var ie=A.codePointAt(H),ne=null,re=c[B[H]],ue=void 0;for(var le in re){var fe=Z[le];if(fe===void 0&&(fe=Z[le]=new RegExp(le).test(P||"en")),fe){for(var we in ue=le,re[le])if(a(ie,re[le][we])){ne=we;break}break}}if(!ne){e:for(var pe in re)if(pe!==ue){for(var xe in re[pe])if(a(ie,re[pe][xe])){ne=xe;break e}}}ne||(console.debug("No font coverage for U+"+ie.toString(16)),ne="latin"),B[H]=ne,d[ne]||q.has(ne)||q.set(ne,Y("font-meta/"+ne+".json").then((function(Ve){d[ne]=Ve}))),ie>65535&&(H++,X=H)},X=0;X<A.length;X++)j(X);return Promise.all(q.values())})).then((function(){for(var j,X=null,H=0;H<A.length;H++){var ie=A.codePointAt(H);if(X&&(E(ie)||v(X).has(ie)))V[H]=V[H-1];else{X=d[B[H]];var ne=G[X.id];if(!ne){var re=X.typeforms,ue=w(re,L,"sans-serif"),le=w(re[ue],R,"normal"),fe=S((j=re[ue])===null||j===void 0?void 0:j[le],O);ne=G[X.id]=W+"/font-files/"+X.id+"/"+ue+"."+le+"."+fe+".woff"}var we=F.get(ne);we==null&&(we=F.size,F.set(ne,we)),V[H]=we}ie>65535&&(H++,V[H]=V[H-1])}return{fontUrls:Array.from(F.keys()),chars:V}}))},Object.defineProperty(t,"__esModule",{value:!0}),t})({})}function BCe(t,e){const n=Object.create(null),r=Object.create(null);function i(a,o){const l=c=>{console.error(`Failure loading font ${a}`,c)};try{const c=new XMLHttpRequest;c.open("get",a,!0),c.responseType="arraybuffer",c.onload=function(){if(c.status>=400)l(new Error(c.statusText));else if(c.status>0)try{const d=t(c.response);d.src=a,o(d)}catch(d){l(d)}},c.onerror=l,c.send()}catch(c){l(c)}}function s(a,o){let l=n[a];l?o(l):r[a]?r[a].push(o):(r[a]=[o],i(a,c=>{c.src=a,n[a]=c,r[a].forEach(d=>d(c)),delete r[a]}))}return function(a,o,{lang:l,fonts:c=[],style:d="normal",weight:h="normal",unicodeFontsURL:g}={}){const v=new Uint8Array(a.length),b=[];a.length||E();const _=new Map,w=[];if(d!=="italic"&&(d="normal"),typeof h!="number"&&(h=h==="bold"?700:400),c&&!Array.isArray(c)&&(c=[c]),c=c.slice().filter(N=>!N.lang||N.lang.test(l)).reverse(),c.length){let L=0;(function R(O=0){for(let W=O,F=a.length;W<F;W++){const V=a.codePointAt(W);if(L===1&&b[v[W-1]].supportsCodePoint(V)||W>0&&/\s/.test(a[W]))v[W]=v[W-1],L===2&&(w[w.length-1][1]=W);else for(let G=v[W],Z=c.length;G<=Z;G++)if(G===Z){const B=L===2?w[w.length-1]:w[w.length]=[W,W];B[1]=W,L=2}else{v[W]=G;const{src:B,unicodeRange:q}=c[G];if(!q||A(V,q)){const K=n[B];if(!K){s(B,()=>{R(W)});return}if(K.supportsCodePoint(V)){let Y=_.get(K);typeof Y!="number"&&(Y=b.length,b.push(K),_.set(K,Y)),v[W]=Y,L=1;break}}}V>65535&&W+1<F&&(v[W+1]=v[W],W++,L===2&&(w[w.length-1][1]=W))}S()})()}else w.push([0,a.length-1]),S();function S(){if(w.length){const N=w.map(D=>a.substring(D[0],D[1]+1)).join(`
`);e.getFontsForString(N,{lang:l||void 0,style:d,weight:h,dataUrl:g}).then(({fontUrls:D,chars:P})=>{const L=b.length;let R=0;w.forEach(W=>{for(let F=0,V=W[1]-W[0];F<=V;F++)v[W[0]+F]=P[R++]+L;R++});let O=0;D.forEach((W,F)=>{s(W,V=>{b[F+L]=V,++O===D.length&&E()})})})}else E()}function E(){o({chars:v,fonts:b})}function A(N,D){for(let P=0;P<D.length;P++){const[L,R=L]=D[P];if(L<=N&&N<=R)return!0}return!1}}}const HCe=Ly({name:"FontResolver",dependencies:[BCe,FCe,UCe],init(t,e,n){return t(e,n())}});function VCe(t,e){const r=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,i="[^\\S\\u00A0]",s=new RegExp(`${i}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function a({text:b,lang:_,fonts:w,style:S,weight:E,preResolvedFonts:A,unicodeFontsURL:N},D){const P=({chars:L,fonts:R})=>{let O,W;const F=[];for(let V=0;V<L.length;V++)L[V]!==W?(W=L[V],F.push(O={start:V,end:V,fontObj:R[L[V]]})):O.end=V;D(F)};A?P(A):t(b,P,{lang:_,fonts:w,style:S,weight:E,unicodeFontsURL:N})}function o({text:b="",font:_,lang:w,sdfGlyphSize:S=64,fontSize:E=400,fontWeight:A=1,fontStyle:N="normal",letterSpacing:D=0,lineHeight:P="normal",maxWidth:L=1/0,direction:R,textAlign:O="left",textIndent:W=0,whiteSpace:F="normal",overflowWrap:V="normal",anchorX:G=0,anchorY:Z=0,metricsOnly:B=!1,unicodeFontsURL:q,preResolvedFonts:K=null,includeCaretPositions:Y=!1,chunkedBoundsSize:Q=8192,colorRanges:U=null},j){const X=h(),H={fontLoad:0,typesetting:0};b.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),b=b.replace(/\r\n/g,`
`).replace(/\r/g,`
`)),E=+E,D=+D,L=+L,P=P||"normal",W=+W,a({text:b,lang:w,style:N,weight:A,fonts:typeof _=="string"?[{src:_}]:_,unicodeFontsURL:q,preResolvedFonts:K},ie=>{H.fontLoad=h()-X;const ne=isFinite(L);let re=null,ue=null,le=null,fe=null,we=null,pe=null,xe=null,Ve=null,ye=0,Oe=0,he=F!=="nowrap";const Re=new Map,oe=h();let Ue=W,Ee=0,Pe=new g;const Ze=[Pe];ie.forEach(ge=>{const{fontObj:ke}=ge,{ascender:Xe,descender:Ae,unitsPerEm:je,lineGap:We,capHeight:De,xHeight:Be}=ke;let qe=Re.get(ke);if(!qe){const st=E/je,ft=P==="normal"?(Xe-Ae+We)*st:P*E,mt=(ft-(Xe-Ae)*st)/2,tt=Math.min(ft,(Xe-Ae)*st),Qe=(Xe+Ae)/2*st+tt/2;qe={index:Re.size,src:ke.src,fontObj:ke,fontSizeMult:st,unitsPerEm:je,ascender:Xe*st,descender:Ae*st,capHeight:De*st,xHeight:Be*st,lineHeight:ft,baseline:-mt-Xe*st,caretTop:Qe,caretBottom:Qe-tt},Re.set(ke,qe)}const{fontSizeMult:Se}=qe,Ye=b.slice(ge.start,ge.end+1);let dt,Le;ke.forEachGlyph(Ye,E,D,(st,ft,mt,tt)=>{ft+=Ee,tt+=ge.start,dt=ft,Le=st;const Qe=b.charAt(tt),ze=st.advanceWidth*Se,Te=Pe.count;let He;if("isEmpty"in st||(st.isWhitespace=!!Qe&&new RegExp(i).test(Qe),st.canBreakAfter=!!Qe&&s.test(Qe),st.isEmpty=st.xMin===st.xMax||st.yMin===st.yMax||r.test(Qe)),!st.isWhitespace&&!st.isEmpty&&Oe++,he&&ne&&!st.isWhitespace&&ft+ze+Ue>L&&Te){if(Pe.glyphAt(Te-1).glyphObj.canBreakAfter)He=new g,Ue=-ft;else for(let ht=Te;ht--;)if(ht===0&&V==="break-word"){He=new g,Ue=-ft;break}else if(Pe.glyphAt(ht).glyphObj.canBreakAfter){He=Pe.splitAt(ht+1);const ct=He.glyphAt(0).x;Ue-=ct;for(let bt=He.count;bt--;)He.glyphAt(bt).x-=ct;break}He&&(Pe.isSoftWrapped=!0,Pe=He,Ze.push(Pe),ye=L)}let et=Pe.glyphAt(Pe.count);et.glyphObj=st,et.x=ft+Ue,et.y=mt,et.width=ze,et.charIndex=tt,et.fontData=qe,Qe===`
`&&(Pe=new g,Ze.push(Pe),Ue=-(ft+ze+D*E)+W)}),Ee=dt+Le.advanceWidth*Se+D*E});let ae=0;Ze.forEach(ge=>{let ke=!0;for(let Xe=ge.count;Xe--;){const Ae=ge.glyphAt(Xe);ke&&!Ae.glyphObj.isWhitespace&&(ge.width=Ae.x+Ae.width,ge.width>ye&&(ye=ge.width),ke=!1);let{lineHeight:je,capHeight:We,xHeight:De,baseline:Be}=Ae.fontData;je>ge.lineHeight&&(ge.lineHeight=je);const qe=Be-ge.baseline;qe<0&&(ge.baseline+=qe,ge.cap+=qe,ge.ex+=qe),ge.cap=Math.max(ge.cap,ge.baseline+We),ge.ex=Math.max(ge.ex,ge.baseline+De)}ge.baseline-=ae,ge.cap-=ae,ge.ex-=ae,ae+=ge.lineHeight});let te=0,be=0;if(G&&(typeof G=="number"?te=-G:typeof G=="string"&&(te=-ye*(G==="left"?0:G==="center"?.5:G==="right"?1:c(G)))),Z&&(typeof Z=="number"?be=-Z:typeof Z=="string"&&(be=Z==="top"?0:Z==="top-baseline"?-Ze[0].baseline:Z==="top-cap"?-Ze[0].cap:Z==="top-ex"?-Ze[0].ex:Z==="middle"?ae/2:Z==="bottom"?ae:Z==="bottom-baseline"?-Ze[Ze.length-1].baseline:c(Z)*ae)),!B){const ge=e.getEmbeddingLevels(b,R);re=new Uint16Array(Oe),ue=new Uint8Array(Oe),le=new Float32Array(Oe*2),fe={},xe=[1/0,1/0,-1/0,-1/0],Ve=[],Y&&(pe=new Float32Array(b.length*4)),U&&(we=new Uint8Array(Oe*3));let ke=0,Xe=-1,Ae=-1,je,We;if(Ze.forEach((De,Be)=>{let{count:qe,width:Se}=De;if(qe>0){let Ye=0;for(let tt=qe;tt--&&De.glyphAt(tt).glyphObj.isWhitespace;)Ye++;let dt=0,Le=0;if(O==="center")dt=(ye-Se)/2;else if(O==="right")dt=ye-Se;else if(O==="justify"&&De.isSoftWrapped){let tt=0;for(let Qe=qe-Ye;Qe--;)De.glyphAt(Qe).glyphObj.isWhitespace&&tt++;Le=(ye-Se)/tt}if(Le||dt){let tt=0;for(let Qe=0;Qe<qe;Qe++){let ze=De.glyphAt(Qe);const Te=ze.glyphObj;ze.x+=dt+tt,Le!==0&&Te.isWhitespace&&Qe<qe-Ye&&(tt+=Le,ze.width+=Le)}}const st=e.getReorderSegments(b,ge,De.glyphAt(0).charIndex,De.glyphAt(De.count-1).charIndex);for(let tt=0;tt<st.length;tt++){const[Qe,ze]=st[tt];let Te=1/0,He=-1/0;for(let et=0;et<qe;et++)if(De.glyphAt(et).charIndex>=Qe){let ht=et,ct=et;for(;ct<qe;ct++){let bt=De.glyphAt(ct);if(bt.charIndex>ze)break;ct<qe-Ye&&(Te=Math.min(Te,bt.x),He=Math.max(He,bt.x+bt.width))}for(let bt=ht;bt<ct;bt++){const wt=De.glyphAt(bt);wt.x=He-(wt.x+wt.width-Te)}break}}let ft;const mt=tt=>ft=tt;for(let tt=0;tt<qe;tt++){const Qe=De.glyphAt(tt);ft=Qe.glyphObj;const ze=ft.index,Te=ge.levels[Qe.charIndex]&1;if(Te){const He=e.getMirroredCharacter(b[Qe.charIndex]);He&&Qe.fontData.fontObj.forEachGlyph(He,0,0,mt)}if(Y){const{charIndex:He,fontData:et}=Qe,ht=Qe.x+te,ct=Qe.x+Qe.width+te;pe[He*4]=Te?ct:ht,pe[He*4+1]=Te?ht:ct,pe[He*4+2]=De.baseline+et.caretBottom+be,pe[He*4+3]=De.baseline+et.caretTop+be;const bt=He-Xe;bt>1&&d(pe,Xe,bt),Xe=He}if(U){const{charIndex:He}=Qe;for(;He>Ae;)Ae++,U.hasOwnProperty(Ae)&&(We=U[Ae])}if(!ft.isWhitespace&&!ft.isEmpty){const He=ke++,{fontSizeMult:et,src:ht,index:ct}=Qe.fontData,bt=fe[ht]||(fe[ht]={});bt[ze]||(bt[ze]={path:ft.path,pathBounds:[ft.xMin,ft.yMin,ft.xMax,ft.yMax]});const wt=Qe.x+te,Pt=Qe.y+De.baseline+be;le[He*2]=wt,le[He*2+1]=Pt;const $e=wt+ft.xMin*et,Tt=Pt+ft.yMin*et,Et=wt+ft.xMax*et,Ot=Pt+ft.yMax*et;$e<xe[0]&&(xe[0]=$e),Tt<xe[1]&&(xe[1]=Tt),Et>xe[2]&&(xe[2]=Et),Ot>xe[3]&&(xe[3]=Ot),He%Q===0&&(je={start:He,end:He,rect:[1/0,1/0,-1/0,-1/0]},Ve.push(je)),je.end++;const Gt=je.rect;if($e<Gt[0]&&(Gt[0]=$e),Tt<Gt[1]&&(Gt[1]=Tt),Et>Gt[2]&&(Gt[2]=Et),Ot>Gt[3]&&(Gt[3]=Ot),re[He]=ze,ue[He]=ct,U){const an=He*3;we[an]=We>>16&255,we[an+1]=We>>8&255,we[an+2]=We&255}}}}}),pe){const De=b.length-Xe;De>1&&d(pe,Xe,De)}}const me=[];Re.forEach(({index:ge,src:ke,unitsPerEm:Xe,ascender:Ae,descender:je,lineHeight:We,capHeight:De,xHeight:Be})=>{me[ge]={src:ke,unitsPerEm:Xe,ascender:Ae,descender:je,lineHeight:We,capHeight:De,xHeight:Be}}),H.typesetting=h()-oe,j({glyphIds:re,glyphFontIndices:ue,glyphPositions:le,glyphData:fe,fontData:me,caretPositions:pe,glyphColors:we,chunkedBounds:Ve,fontSize:E,topBaseline:be+Ze[0].baseline,blockBounds:[te,be-ae,te+ye,be],visibleBounds:xe,timings:H})})}function l(b,_){o({...b,metricsOnly:!0},w=>{const[S,E,A,N]=w.blockBounds;_({width:A-S,height:N-E})})}function c(b){let _=b.match(/^([\d.]+)%$/),w=_?parseFloat(_[1]):NaN;return isNaN(w)?0:w/100}function d(b,_,w){const S=b[_*4],E=b[_*4+1],A=b[_*4+2],N=b[_*4+3],D=(E-S)/w;for(let P=0;P<w;P++){const L=(_+P)*4;b[L]=S+D*P,b[L+1]=S+D*(P+1),b[L+2]=A,b[L+3]=N}}function h(){return(self.performance||Date).now()}function g(){this.data=[]}const v=["glyphObj","x","y","width","charIndex","fontData"];return g.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/v.length)},glyphAt(b){let _=g.flyweight;return _.data=this.data,_.index=b,_},splitAt(b){let _=new g;return _.data=this.data.splice(b*v.length),_}},g.flyweight=v.reduce((b,_,w,S)=>(Object.defineProperty(b,_,{get(){return this.data[this.index*v.length+w]},set(E){this.data[this.index*v.length+w]=E}}),b),{data:null,index:0}),{typeset:o,measure:l}}const Kg=()=>(self.performance||Date).now(),PE=zK();let eF;function GCe(t,e,n,r,i,s,a,o,l,c,d=!0){return d?$Ce(t,e,n,r,i,s,a,o,l,c).then(null,h=>(eF||(console.warn("WebGL SDF generation failed, falling back to JS",h),eF=!0),nF(t,e,n,r,i,s,a,o,l,c))):nF(t,e,n,r,i,s,a,o,l,c)}const WM=[],WCe=5;let u7=0;function FK(){const t=Kg();for(;WM.length&&Kg()-t<WCe;)WM.shift()();u7=WM.length?setTimeout(FK,0):0}const $Ce=(...t)=>new Promise((e,n)=>{WM.push(()=>{const r=Kg();try{PE.webgl.generateIntoCanvas(...t),e({timing:Kg()-r})}catch(i){n(i)}}),u7||(u7=setTimeout(FK,0))}),qCe=4,XCe=2e3,tF={};let YCe=0;function nF(t,e,n,r,i,s,a,o,l,c){const d="TroikaTextSDFGenerator_JS_"+YCe++%qCe;let h=tF[d];return h||(h=tF[d]={workerModule:Ly({name:d,workerId:d,dependencies:[zK,Kg],init(g,v){const b=g().javascript.generate;return function(..._){const w=v();return{textureData:b(..._),timing:v()-w}}},getTransferables(g){return[g.textureData.buffer]}}),requests:0,idleTimer:null}),h.requests++,clearTimeout(h.idleTimer),h.workerModule(t,e,n,r,i,s).then(({textureData:g,timing:v})=>{const b=Kg(),_=new Uint8Array(g.length*4);for(let w=0;w<g.length;w++)_[w*4+c]=g[w];return PE.webglUtils.renderImageData(a,_,o,l,t,e,1<<3-c),v+=Kg()-b,--h.requests===0&&(h.idleTimer=setTimeout(()=>{ECe(d)},XCe)),{timing:v}})}function KCe(t){t._warm||(PE.webgl.isSupported(t),t._warm=!0)}const ZCe=PE.webglUtils.resizeWebGLCanvasWithoutClearing,w_={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},QCe=new xn;function Jx(){return(self.performance||Date).now()}const rF=Object.create(null);function UK(t,e){t=tAe({},t);const n=Jx(),r=[];if(t.font&&r.push({label:"user",src:nAe(t.font)}),t.font=r,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||w_.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||w_.unicodeFontsURL,t.colorRanges!=null){let g={};for(let v in t.colorRanges)if(t.colorRanges.hasOwnProperty(v)){let b=t.colorRanges[v];typeof b!="number"&&(b=QCe.set(b).getHex()),g[v]=b}t.colorRanges=g}Object.freeze(t);const{textureWidth:i,sdfExponent:s}=w_,{sdfGlyphSize:a}=t,o=i/a*4;let l=rF[a];if(!l){const g=document.createElement("canvas");g.width=i,g.height=a*256/o,l=rF[a]={glyphCount:0,sdfGlyphSize:a,sdfCanvas:g,sdfTexture:new ra(g,void 0,void 0,void 0,rs,rs),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,JCe(l)}const{sdfTexture:c,sdfCanvas:d}=l;VK(t).then(g=>{const{glyphIds:v,glyphFontIndices:b,fontData:_,glyphPositions:w,fontSize:S,timings:E}=g,A=[],N=new Float32Array(v.length*4);let D=0,P=0;const L=Jx(),R=_.map(G=>{let Z=l.glyphsByFont.get(G.src);return Z||l.glyphsByFont.set(G.src,Z=new Map),Z});v.forEach((G,Z)=>{const B=b[Z],{src:q,unitsPerEm:K}=_[B];let Y=R[B].get(G);if(!Y){const{path:H,pathBounds:ie}=g.glyphData[q][G],ne=Math.max(ie[2]-ie[0],ie[3]-ie[1])/a*(w_.sdfMargin*a+.5),re=l.glyphCount++,ue=[ie[0]-ne,ie[1]-ne,ie[2]+ne,ie[3]+ne];R[B].set(G,Y={path:H,atlasIndex:re,sdfViewBox:ue}),A.push(Y)}const{sdfViewBox:Q}=Y,U=w[P++],j=w[P++],X=S/K;N[D++]=U+Q[0]*X,N[D++]=j+Q[1]*X,N[D++]=U+Q[2]*X,N[D++]=j+Q[3]*X,v[Z]=Y.atlasIndex}),E.quads=(E.quads||0)+(Jx()-L);const O=Jx();E.sdf={};const W=d.height,F=Math.ceil(l.glyphCount/o),V=Math.pow(2,Math.ceil(Math.log2(F*a)));V>W&&(console.info(`Increasing SDF texture size ${W}->${V}`),ZCe(d,i,V),c.dispose()),Promise.all(A.map(G=>BK(G,l,t.gpuAccelerateSDF).then(({timing:Z})=>{E.sdf[G.atlasIndex]=Z}))).then(()=>{A.length&&!l.contextLost&&(HK(l),c.needsUpdate=!0),E.sdfTotal=Jx()-O,E.total=Jx()-n,e(Object.freeze({parameters:t,sdfTexture:c,sdfGlyphSize:a,sdfExponent:s,glyphBounds:N,glyphAtlasIndices:v,glyphColors:g.glyphColors,caretPositions:g.caretPositions,chunkedBounds:g.chunkedBounds,ascender:g.ascender,descender:g.descender,lineHeight:g.lineHeight,capHeight:g.capHeight,xHeight:g.xHeight,topBaseline:g.topBaseline,blockBounds:g.blockBounds,visibleBounds:g.visibleBounds,timings:g.timings}))})}),Promise.resolve().then(()=>{l.contextLost||KCe(d)})}function BK({path:t,atlasIndex:e,sdfViewBox:n},{sdfGlyphSize:r,sdfCanvas:i,contextLost:s},a){if(s)return Promise.resolve({timing:-1});const{textureWidth:o,sdfExponent:l}=w_,c=Math.max(n[2]-n[0],n[3]-n[1]),d=Math.floor(e/4),h=d%(o/r)*r,g=Math.floor(d/(o/r))*r,v=e%4;return GCe(r,r,t,n,c,l,i,h,g,v,a)}function JCe(t){const e=t.sdfCanvas;e.addEventListener("webglcontextlost",n=>{console.log("Context Lost",n),n.preventDefault(),t.contextLost=!0}),e.addEventListener("webglcontextrestored",n=>{console.log("Context Restored",n),t.contextLost=!1;const r=[];t.glyphsByFont.forEach(i=>{i.forEach(s=>{r.push(BK(s,t,!0))})}),Promise.all(r).then(()=>{HK(t),t.sdfTexture.needsUpdate=!0})})}function eAe({font:t,characters:e,sdfGlyphSize:n},r){let i=Array.isArray(e)?e.join(`
`):""+e;UK({font:t,sdfGlyphSize:n,text:i},r)}function tAe(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}let MM;function nAe(t){return MM||(MM=typeof document>"u"?{}:document.createElement("a")),MM.href=t,MM.href}function HK(t){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:n}=t,{width:r,height:i}=e,s=t.sdfCanvas.getContext("webgl");let a=n.image.data;(!a||a.length!==r*i*4)&&(a=new Uint8Array(r*i*4),n.image={width:r,height:i,data:a},n.flipY=!1,n.isDataTexture=!0),s.readPixels(0,0,r,i,s.RGBA,s.UNSIGNED_BYTE,a)}}const rAe=Ly({name:"Typesetter",dependencies:[VCe,HCe,ACe],init(t,e,n){return t(e,n())}}),VK=Ly({name:"Typesetter",dependencies:[rAe],init(t){return function(e){return new Promise(n=>{t.typeset(e,n)})}},getTransferables(t){const e=[];for(let n in t)t[n]&&t[n].buffer&&e.push(t[n].buffer);return e}});VK.onMainThread;const iF={};function iAe(t){let e=iF[t];return e||(e=iF[t]=new Mp(1,1,t,t).translate(.5,.5,0)),e}const sAe="aTroikaGlyphBounds",sF="aTroikaGlyphIndex",aAe="aTroikaGlyphColor";class oAe extends CE{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new Va,this.boundingBox=new Ca}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let n=iAe(e);["position","normal","uv"].forEach(r=>{this.attributes[r]=n.attributes[r].clone()}),this.setIndex(n.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,n,r,i,s){this.updateAttributeData(sAe,e,4),this.updateAttributeData(sF,n,1),this.updateAttributeData(aAe,s,3),this._blockBounds=r,this._chunkedBounds=i,this.instanceCount=n.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:n,boundingBox:r}=this;if(n){const{PI:i,floor:s,min:a,max:o,sin:l,cos:c}=Math,d=i/2,h=i*2,g=Math.abs(n),v=e[0]/g,b=e[2]/g,_=s((v+d)/h)!==s((b+d)/h)?-g:a(l(v)*g,l(b)*g),w=s((v-d)/h)!==s((b-d)/h)?g:o(l(v)*g,l(b)*g),S=s((v+i)/h)!==s((b+i)/h)?g*2:o(g-c(v)*g,g-c(b)*g);r.min.set(_,e[1],n<0?-S:0),r.max.set(w,e[3],n<0?0:S)}else r.min.set(e[0],e[1],0),r.max.set(e[2],e[3],0);r.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let n=this.getAttribute(sF).count,r=this._chunkedBounds;if(r)for(let i=r.length;i--;){n=r[i].end;let s=r[i].rect;if(s[1]<e.w&&s[3]>e.y&&s[0]<e.z&&s[2]>e.x)break}this.instanceCount=n}updateAttributeData(e,n,r){const i=this.getAttribute(e);n?i&&i.array.length===n.length?(i.array.set(n),i.needsUpdate=!0):(this.setAttribute(e,new dv(n,r)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}}const lAe=`
uniform vec2 uTroikaSDFTextureSize;
uniform float uTroikaSDFGlyphSize;
uniform vec4 uTroikaTotalBounds;
uniform vec4 uTroikaClipRect;
uniform mat3 uTroikaOrient;
uniform bool uTroikaUseGlyphColors;
uniform float uTroikaEdgeOffset;
uniform float uTroikaBlurRadius;
uniform vec2 uTroikaPositionOffset;
uniform float uTroikaCurveRadius;
attribute vec4 aTroikaGlyphBounds;
attribute float aTroikaGlyphIndex;
attribute vec3 aTroikaGlyphColor;
varying vec2 vTroikaGlyphUV;
varying vec4 vTroikaTextureUVBounds;
varying float vTroikaTextureChannel;
varying vec3 vTroikaGlyphColor;
varying vec2 vTroikaGlyphDimensions;
`,cAe=`
vec4 bounds = aTroikaGlyphBounds;
bounds.xz += uTroikaPositionOffset.x;
bounds.yw -= uTroikaPositionOffset.y;

vec4 outlineBounds = vec4(
  bounds.xy - uTroikaEdgeOffset - uTroikaBlurRadius,
  bounds.zw + uTroikaEdgeOffset + uTroikaBlurRadius
);
vec4 clippedBounds = vec4(
  clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw),
  clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw)
);

vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy);

position.xy = mix(bounds.xy, bounds.zw, clippedXY);

uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy);

float rad = uTroikaCurveRadius;
if (rad != 0.0) {
  float angle = position.x / rad;
  position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad);
  normal.xz = vec2(sin(angle), cos(angle));
}
  
position = uTroikaOrient * position;
normal = uTroikaOrient * normal;

vTroikaGlyphUV = clippedXY.xy;
vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]);


float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize;
vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize;
vec2 txStartUV = txUvPerSquare * vec2(
  mod(floor(aTroikaGlyphIndex / 4.0), txCols),
  floor(floor(aTroikaGlyphIndex / 4.0) / txCols)
);
vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare);
vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0);
`,uAe=`
uniform sampler2D uTroikaSDFTexture;
uniform vec2 uTroikaSDFTextureSize;
uniform float uTroikaSDFGlyphSize;
uniform float uTroikaSDFExponent;
uniform float uTroikaEdgeOffset;
uniform float uTroikaFillOpacity;
uniform float uTroikaBlurRadius;
uniform vec3 uTroikaStrokeColor;
uniform float uTroikaStrokeWidth;
uniform float uTroikaStrokeOpacity;
uniform bool uTroikaSDFDebug;
varying vec2 vTroikaGlyphUV;
varying vec4 vTroikaTextureUVBounds;
varying float vTroikaTextureChannel;
varying vec2 vTroikaGlyphDimensions;

float troikaSdfValueToSignedDistance(float alpha) {
  // Inverse of exponential encoding in webgl-sdf-generator
  
  float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y);
  float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension;
  float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0);
  return signedDist;
}

float troikaGlyphUvToSdfValue(vec2 glyphUV) {
  vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV);
  vec4 rgba = texture2D(uTroikaSDFTexture, textureUV);
  float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1
  return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a;
}

float troikaGlyphUvToDistance(vec2 uv) {
  return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv));
}

float troikaGetAADist() {
  
  #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300
  return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5;
  #else
  return vTroikaGlyphDimensions.x / 64.0;
  #endif
}

float troikaGetFragDistValue() {
  vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize);
  float distance = troikaGlyphUvToDistance(clampedGlyphUV);
 
  // Extrapolate distance when outside bounds:
  distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : 
    length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions);

  

  return distance;
}

float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) {
  #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL)
  float alpha = step(-distanceOffset, -distance);
  #else

  float alpha = smoothstep(
    distanceOffset + aaDist,
    distanceOffset - aaDist,
    distance
  );
  #endif

  return alpha;
}
`,dAe=`
float aaDist = troikaGetAADist();
float fragDistance = troikaGetFragDistValue();
float edgeAlpha = uTroikaSDFDebug ?
  troikaGlyphUvToSdfValue(vTroikaGlyphUV) :
  troikaGetEdgeAlpha(fragDistance, uTroikaEdgeOffset, max(aaDist, uTroikaBlurRadius));

#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL)
vec4 fillRGBA = gl_FragColor;
fillRGBA.a *= uTroikaFillOpacity;
vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity);
if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb;
gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep(
  -uTroikaStrokeWidth - aaDist,
  -uTroikaStrokeWidth + aaDist,
  fragDistance
));
gl_FragColor.a *= edgeAlpha;
#endif

if (edgeAlpha == 0.0) {
  discard;
}
`;function fAe(t){const e=c7(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new zt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new ci(0,0,0,0)},uTroikaClipRect:{value:new ci(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new zt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new xn},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new yr},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:lAe,vertexTransform:cAe,fragmentDefs:uAe,fragmentColorTransform:dAe,customRewriter({vertexShader:n,fragmentShader:r}){let i=/\buniform\s+vec3\s+diffuse\b/;return i.test(r)&&(r=r.replace(i,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),i.test(n)||(n=n.replace(jK,`uniform vec3 diffuse;
$&
vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse;
`))),{vertexShader:n,fragmentShader:r}}});return e.transparent=!0,e.forceSinglePass=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const z9=new wp({color:16777215,side:Xc,transparent:!0}),aF=8421504,oF=new rr,TM=new Fe,U6=new Fe,u_=[],hAe=new Fe,B6="+x+y";function lF(t){return Array.isArray(t)?t[0]:t}let GK=()=>{const t=new Us(new Mp(1,1),z9);return GK=()=>t,t},WK=()=>{const t=new Us(new Mp(1,1,32,1),z9);return WK=()=>t,t};const pAe={type:"syncstart"},mAe={type:"synccomplete"},$K=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],gAe=$K.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let qK=class extends Us{constructor(){const e=new oAe;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.unicodeFontsURL=null,this.fontSize=.1,this.fontWeight="normal",this.fontStyle="normal",this.lang=null,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=aF,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=B6,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(pAe),UK({text:this.text,font:this.font,lang:this.lang,fontSize:this.fontSize||.1,fontWeight:this.fontWeight||"normal",fontStyle:this.fontStyle||"normal",letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF,unicodeFontsURL:this.unicodeFontsURL},n=>{this._isSyncing=!1,this._textRenderInfo=n,this.geometry.updateGlyphs(n.glyphBounds,n.glyphAtlasIndices,n.blockBounds,n.chunkedBounds,n.glyphColors);const r=this._queuedSyncs;r&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{r.forEach(i=>i&&i())})),this.dispatchEvent(mAe),e&&e()})))}onBeforeRender(e,n,r,i,s,a){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return fAe(e)}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=z9.clone());if((!e||!e.isDerivedFrom(n))&&(e=this._derivedMaterial=this.createDerivedMaterial(n),n.addEventListener("dispose",function r(){n.removeEventListener("dispose",r),e.dispose()})),this.hasOutline()){let r=e._outlineMtl;return r||(r=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),r.isTextOutlineMaterial=!0,r.depthWrite=!1,r.map=null,e.addEventListener("dispose",function i(){e.removeEventListener("dispose",i),r.dispose()})),[r,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}hasOutline(){return!!(this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY)}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return lF(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return lF(this.material).getDistanceMaterial()}set customDistanceMaterial(e){}_prepareForRender(e){const n=e.isTextOutlineMaterial,r=e.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:o,blockBounds:l}=i;r.uTroikaSDFTexture.value=o,r.uTroikaSDFTextureSize.value.set(o.image.width,o.image.height),r.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,r.uTroikaSDFExponent.value=i.sdfExponent,r.uTroikaTotalBounds.value.fromArray(l),r.uTroikaUseGlyphColors.value=!n&&!!i.glyphColors;let c=0,d=0,h=0,g,v,b,_=0,w=0;if(n){let{outlineWidth:E,outlineOffsetX:A,outlineOffsetY:N,outlineBlur:D,outlineOpacity:P}=this;c=this._parsePercent(E)||0,d=Math.max(0,this._parsePercent(D)||0),g=P,_=this._parsePercent(A)||0,w=this._parsePercent(N)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(b=this.strokeColor,r.uTroikaStrokeColor.value.set(b??aF),v=this.strokeOpacity,v==null&&(v=1)),g=this.fillOpacity;r.uTroikaEdgeOffset.value=c,r.uTroikaPositionOffset.value.set(_,w),r.uTroikaBlurRadius.value=d,r.uTroikaStrokeWidth.value=h,r.uTroikaStrokeOpacity.value=v,r.uTroikaFillOpacity.value=g??1,r.uTroikaCurveRadius.value=this.curveRadius||0;let S=this.clipRect;if(S&&Array.isArray(S)&&S.length===4)r.uTroikaClipRect.value.fromArray(S);else{const E=(this.fontSize||.1)*100;r.uTroikaClipRect.value.set(l[0]-E,l[1]-E,l[2]+E,l[3]+E)}this.geometry.applyClipRect(r.uTroikaClipRect.value)}r.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=n?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const o=e.hasOwnProperty("color")?e.color:e.color=new xn;(s!==o._input||typeof s=="object")&&o.set(o._input=s)}let a=this.orientation||B6;if(a!==e._orientation){let o=r.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let l=a!==B6&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,d,h,g]=l;TM.set(0,0,0)[d]=c==="-"?1:-1,U6.set(0,0,0)[g]=h==="-"?-1:1,oF.lookAt(hAe,TM.cross(U6),U6),o.setFromMatrix4(oF)}else o.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let n=e.match(/^(-?[\d.]+)%$/),r=n?parseFloat(n[1]):NaN;e=(isNaN(r)?0:r/100)*this.fontSize}return e}localPositionToTextCoords(e,n=new zt){n.copy(e);const r=this.curveRadius;return r&&(n.x=Math.atan2(e.x,Math.abs(r)-Math.abs(e.z))*Math.abs(r)),n}worldPositionToTextCoords(e,n=new zt){return TM.copy(e),this.localPositionToTextCoords(this.worldToLocal(TM),n)}raycast(e,n){const{textRenderInfo:r,curveRadius:i}=this;if(r){const s=r.blockBounds,a=i?WK():GK(),o=a.geometry,{position:l,uv:c}=o.attributes;for(let d=0;d<c.count;d++){let h=s[0]+c.getX(d)*(s[2]-s[0]);const g=s[1]+c.getY(d)*(s[3]-s[1]);let v=0;i&&(v=i-Math.cos(h/i)*i,h=Math.sin(h/i)*i),l.setXYZ(d,h,g,v)}o.boundingSphere=this.geometry.boundingSphere,o.boundingBox=this.geometry.boundingBox,a.matrixWorld=this.matrixWorld,a.material.side=this.material.side,u_.length=0,a.raycast(e,u_);for(let d=0;d<u_.length;d++)u_[d].object=this,n.push(u_[d])}}copy(e){const n=this.geometry;return super.copy(e),this.geometry=n,gAe.forEach(r=>{this[r]=e[r]}),this}clone(){return new this.constructor().copy(this)}};$K.forEach(t=>{const e="_private_"+t;Object.defineProperty(qK.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});new Ca;new xn;const pa=T.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:r,fontSize:i=1,children:s,characters:a,onSync:o,...l},c)=>{const d=$c(({invalidate:b})=>b),[h]=T.useState(()=>new qK),[g,v]=T.useMemo(()=>{const b=[];let _="";return T.Children.forEach(s,w=>{typeof w=="string"||typeof w=="number"?_+=w:b.push(w)}),[b,_]},[s]);return QTe(()=>new Promise(b=>eAe({font:r,characters:a},b)),["troika-text",r,a]),T.useLayoutEffect(()=>void h.sync(()=>{d(),o&&o(h)})),T.useEffect(()=>()=>h.dispose(),[h]),T.createElement("primitive",lh({object:h,ref:c,font:r,text:v,anchorX:e,anchorY:n,fontSize:i,sdfGlyphSize:t},l),g)}),om=T.forwardRef(({threshold:t=15,geometry:e,...n},r)=>{const i=T.useRef(null);T.useImperativeHandle(r,()=>i.current,[]);const s=T.useMemo(()=>[0,0,0,1,0,0],[]),a=T.useRef(null),o=T.useRef(null);return T.useLayoutEffect(()=>{const l=i.current.parent,c=e??(l==null?void 0:l.geometry);if(!c||a.current===c&&o.current===t)return;a.current=c,o.current=t;const h=new l9(c,t).attributes.position.array;i.current.geometry.setPositions(h),i.current.geometry.attributes.instanceStart.needsUpdate=!0,i.current.geometry.attributes.instanceEnd.needsUpdate=!0,i.current.computeLineDistances()}),T.createElement(_Ce,lh({segments:!0,points:s,ref:i,raycast:()=>null},n))}),vAe=T.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:a,onStart:o,onEnd:l,...c},d)=>{const h=$c(P=>P.invalidate),g=$c(P=>P.camera),v=$c(P=>P.gl),b=$c(P=>P.events),_=$c(P=>P.setEvents),w=$c(P=>P.set),S=$c(P=>P.get),E=$c(P=>P.performance),A=e||g,N=r||b.connected||v.domElement,D=T.useMemo(()=>new vCe(A),[A]);return RE(()=>{D.enabled&&D.update()},-1),T.useEffect(()=>(s&&D.connect(s===!0?N:s),D.connect(N),()=>void D.dispose()),[s,N,n,D,h]),T.useEffect(()=>{const P=O=>{h(),n&&E.regress(),a&&a(O)},L=O=>{o&&o(O)},R=O=>{l&&l(O)};return D.addEventListener("change",P),D.addEventListener("start",L),D.addEventListener("end",R),()=>{D.removeEventListener("start",L),D.removeEventListener("end",R),D.removeEventListener("change",P)}},[a,o,l,D,h,_]),T.useEffect(()=>{if(t){const P=S().controls;return w({controls:D}),()=>w({controls:P})}},[t,D]),T.createElement("primitive",lh({ref:d,object:D,enableDamping:i},c))}),Of=1e-5;function xAe(t,e,n){const r=new $0,i=n-Of;return r.absarc(Of,Of,Of,-Math.PI/2,-Math.PI,!0),r.absarc(Of,e-i*2,Of,Math.PI,Math.PI/2,!0),r.absarc(t-i*2,e-i*2,Of,Math.PI/2,0,!0),r.absarc(t-i*2,Of,Of,0,-Math.PI/2,!0),r}const Vu=T.forwardRef(function({args:[e=1,n=1,r=1]=[],radius:i=.05,steps:s=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:l=.4,children:c,...d},h){return T.createElement("mesh",lh({ref:h},d),T.createElement(yAe,{args:[e,n,r],radius:i,steps:s,smoothness:a,bevelSegments:o,creaseAngle:l}),c)}),yAe=T.forwardRef(function({args:[e=1,n=1,r=1]=[],radius:i=.05,steps:s=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:l=.4,...c},d){const h=T.useMemo(()=>xAe(e,n,i),[e,n,i]),g=T.useMemo(()=>({depth:r-i*2,bevelEnabled:!0,bevelSegments:o*2,steps:s,bevelSize:i-Of,bevelThickness:i,curveSegments:a}),[r,i,a,o,s]),v=T.useRef(null);return T.useLayoutEffect(()=>{v.current&&(v.current.center(),cCe(v.current,l))},[h,g,l]),T.useImperativeHandle(d,()=>v.current),T.createElement("extrudeGeometry",lh({ref:v,args:[h,g]},c))});function mi(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function Er(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){const e=Number(t);return Number.isFinite(e)?e:null}return null}function vo(t){return typeof t=="string"?t:""}function H6(t){return!!t}function j9(t){if(typeof t!="string")return null;let e=t.trim();if(!e)return null;for(let n=0;n<2&&typeof e=="string";n+=1)try{e=JSON.parse(e)}catch{return null}return mi(e)}function XK(t){if(!t)return null;const e=j9(t.setup);if(!e)return null;const n=vo(e.model),r=vo(e.schema_version),i=mi(e.cluster);if(!i)return null;const s=Array.isArray(i.nodes)?i.nodes:[],a=mi(e.trainer),o=mi(e.inference),l=new Map,c=Array.isArray(a==null?void 0:a.nodes)?a.nodes:[];for(const g of c){const v=mi(g);if(!v)continue;const b=Er(v.node_id);if(b===null)continue;const _=Array.isArray(v.gpus)?v.gpus:[];for(const w of _){const S=mi(w);if(!S)continue;const E=Er(S.gpu_index);E!==null&&l.set(`${b}-${E}`,{role:"trainer",gpu_index:E,rank:Er(S.rank)??void 0,dp_rank:Er(S.dp_rank)??void 0,tp_rank:Er(S.tp_rank)??void 0,pp_rank:Er(S.pp_rank)??void 0})}}const d=Array.isArray(o==null?void 0:o.nodes)?o.nodes:[];for(const g of d){const v=mi(g);if(!v)continue;const b=Er(v.node_id);if(b===null)continue;const _=Array.isArray(v.gpus)?v.gpus:[];for(const w of _){const S=mi(w);if(!S)continue;const E=Er(S.gpu_index);E!==null&&l.set(`${b}-${E}`,{role:"inference",gpu_index:E,server_idx:Er(S.server_idx)??void 0,tp_group_id:Er(S.tp_group_id)??void 0,port:Er(S.port)??void 0,url:vo(S.url)||void 0})}}const h=[];for(const g of s){const v=mi(g);if(!v)continue;const b=Er(v.node_id)??0,_=mi(v.hardware),w=mi(_==null?void 0:_.cpu),S={model:vo(w==null?void 0:w.model),cores:Er(w==null?void 0:w.cores)??0,logical_cores:Er(w==null?void 0:w.logical_cores)??0,sockets:Er(w==null?void 0:w.sockets)??1,architecture:vo(w==null?void 0:w.architecture),frequency_mhz:Er(w==null?void 0:w.frequency_mhz)??0},E=mi(_==null?void 0:_.memory),A={total_gb:Er(E==null?void 0:E.total_gb)??0},N=mi(_==null?void 0:_.gpu),P=(Array.isArray(N==null?void 0:N.devices)?N.devices:[]).map((G,Z)=>{const B=mi(G),q=Z,K=`${b}-${q}`,Y=l.get(K)??{role:"unassigned",gpu_index:q};return{hardware:{name:vo(B==null?void 0:B.name),memory_total_gb:Er(B==null?void 0:B.memory_total_gb)??0,pcie_gen:Er(B==null?void 0:B.pcie_gen)??0,pcie_width:Er(B==null?void 0:B.pcie_width)??0,serial:vo(B==null?void 0:B.serial),uuid:vo(B==null?void 0:B.uuid)},role:Y,local_index:q}}),L=mi(N==null?void 0:N.interconnect),R=L?{nvlink:H6(L.nvlink),topology:vo(L.topology),links_per_gpu:Er(L.links_per_gpu)??0,speed_gbps:Er(L.speed_gbps)??0,connections:Er(L.connections)??0}:null,O=mi(v.software),W=mi(O==null?void 0:O.os),F=mi(O==null?void 0:O.container),V=mi(O==null?void 0:O.packages);h.push({node_id:b,hostname:vo(v.hostname),ip:vo(v.ip),is_driver:H6(v.is_driver),cpu:S,memory:A,gpus:P,interconnect:R,os:vo(W==null?void 0:W.platform),container:F?{runtime:vo(F.runtime),is_container:H6(F.is_container)}:null,software:{cuda:vo(V==null?void 0:V.cuda),pytorch:vo(V==null?void 0:V.pytorch),python:vo(V==null?void 0:V.python)}})}return{model:n,schema_version:r,nodes:h,total_gpus:Er(i.total_gpus)??0,trainer_total_gpus:Er(a==null?void 0:a.total_gpus)??0,inference_total_gpus:Er(o==null?void 0:o.total_gpus)??0,trainer_config:a?{data_parallel_size:Er(a.data_parallel_size)??0,megatron_tensor_parallel_size:Er(a.megatron_tensor_parallel_size)??0,megatron_pipeline_parallel_size:Er(a.megatron_pipeline_parallel_size)??0,backend:vo(a.backend),world_size:Er(a.world_size)??0}:null,inference_config:o?{num_servers:Er(o.num_servers)??0,tensor_parallel_size:Er(o.tensor_parallel_size)??0,placement_strategy:vo(o.placement_strategy)}:null}}const wn={trainer:"#2563eb",inference:"#dc2626",unassigned:"#111111",nvlink:"#c7d5f0",platform:"#ffffff",platformBorder:"#111111",gpuBody:"#ffffff",gpuBodyHover:"#ffffff",moduleBody:"#ffffff",moduleBodyHover:"#ffffff",chip:"#ffffff",chipBorder:"#ededed",textBlack:"#000000",background:"#ffffff",gridColor:"#ffffff"};function bAe(t){const e=t.replace(/-\d+GB$/i,"").replace(/-/g," "),n=e.split(/\s+/);if(n.length<=1)return{brand:"",model:e};const r=n[0],i=n.slice(1).join(" ");return{brand:r,model:i}}function _Ae({position:t,gpu:e,nodeId:n,onHover:r,onUnhover:i,onClick:s,isHovered:a}){const o=e.role.role==="trainer"?wn.trainer:e.role.role==="inference"?wn.inference:wn.unassigned,l=e.role.role==="trainer"?"Trainer":e.role.role==="inference"?"Inference":"",{brand:c,model:d}=bAe(e.hardware.name),h=.095;return p.jsxs("group",{position:t,children:[p.jsxs(Vu,{args:[.95,.18,.6],radius:0,smoothness:4,onPointerOver:g=>{g.stopPropagation(),r()},onPointerOut:i,onClick:g=>{g.stopPropagation(),s()},children:[p.jsx("meshBasicMaterial",{color:a?wn.gpuBodyHover:wn.gpuBody}),p.jsx(om,{color:wn.platformBorder,threshold:1,scale:1.002})]}),e.role.role!=="unassigned"&&p.jsxs(p.Fragment,{children:[p.jsxs("mesh",{position:[-.34,h-.003,-.2],rotation:[-Math.PI/2,0,0],children:[p.jsx("planeGeometry",{args:[.055,.055]}),p.jsx("meshStandardMaterial",{color:o,side:Xc})]}),p.jsx(pa,{position:[-.285,h,-.2],rotation:[-Math.PI/2,0,0],fontSize:.04,color:wn.textBlack,anchorX:"left",anchorY:"middle",children:l})]}),p.jsx(pa,{position:[0,h,-.04],rotation:[-Math.PI/2,0,0],fontSize:.055,color:wn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:c}),p.jsx(pa,{position:[0,h,.07],rotation:[-Math.PI/2,0,0],fontSize:.07,color:wn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:d}),p.jsx(pa,{position:[.4,h,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:wn.textBlack,anchorX:"right",anchorY:"middle",children:`GPU ${e.local_index}`}),e.role.rank!==void 0&&p.jsx(pa,{position:[-.4,h,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:wn.textBlack,anchorX:"left",anchorY:"middle",children:`Rank ${e.role.rank}`}),e.role.server_idx!==void 0&&p.jsx(pa,{position:[-.4,h,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:wn.textBlack,anchorX:"left",anchorY:"middle",children:`Server ${e.role.server_idx}`}),a&&p.jsx(D9,{position:[0,.35,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:p.jsxs("div",{className:"bg-white border border-black rounded-none px-3 py-2 min-w-[180px]",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-1",children:e.hardware.name}),p.jsxs("div",{className:"text-[10px] text-black space-y-0.5",children:[p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"VRAM"}),p.jsxs("span",{className:"font-mono",children:[e.hardware.memory_total_gb," GB"]})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"PCIe"}),p.jsxs("span",{className:"font-mono",children:["Gen",e.hardware.pcie_gen," x",e.hardware.pcie_width]})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Role"}),p.jsxs("span",{className:"font-semibold",style:{color:o},children:[e.role.role.charAt(0).toUpperCase()+e.role.role.slice(1),e.role.rank!==void 0&&` (rank ${e.role.rank})`,e.role.server_idx!==void 0&&` (server ${e.role.server_idx})`]})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Node"}),p.jsxs("span",{className:"font-mono",children:["#",n]})]})]})]})})]})}function SAe({position:t,memoryGb:e,isHovered:n,onHover:r,onUnhover:i}){return p.jsxs("group",{position:t,children:[p.jsxs(Vu,{args:[.85,.12,.35],radius:0,smoothness:4,onPointerOver:a=>{a.stopPropagation(),r()},onPointerOut:i,children:[p.jsx("meshBasicMaterial",{color:n?wn.moduleBodyHover:wn.moduleBody}),p.jsx(om,{color:wn.platformBorder,threshold:1,scale:1.002})]}),p.jsx(pa,{position:[0,.063,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:"VRAM"}),p.jsx(pa,{position:[0,.063,.05],rotation:[-Math.PI/2,0,0],fontSize:.055,color:wn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`${e}GB`})]})}function wAe(t){return t.replace(/\b(AMD|Intel|ARM)\b/gi,"").replace(/\d+-Core Processor/gi,"").replace(/\bProcessor\b/gi,"").replace(/\(R\)|\(TM\)/gi,"").replace(/\s+/g," ").trim()||t}function MAe({position:t,cpu:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const a=wAe(e.model);return p.jsxs("group",{position:t,children:[p.jsxs(Vu,{args:[.6,.08,.6],radius:0,smoothness:4,onPointerOver:o=>{o.stopPropagation(),r()},onPointerOut:i,onClick:o=>{o.stopPropagation(),s()},children:[p.jsx("meshBasicMaterial",{color:n?wn.gpuBodyHover:wn.chip}),p.jsx(om,{color:wn.platformBorder,threshold:1,scale:1.002})]}),p.jsxs("mesh",{position:[0,.041,0],children:[p.jsx("boxGeometry",{args:[.45,.005,.45]}),p.jsx("meshBasicMaterial",{color:wn.platform}),p.jsx(om,{color:wn.platformBorder,threshold:1,scale:1.002})]}),p.jsx(pa,{position:[0,.05,-.12],rotation:[-Math.PI/2,0,0],fontSize:.032,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:a}),p.jsx(pa,{position:[0,.05,0],rotation:[-Math.PI/2,0,0],fontSize:.045,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:"CPU"}),p.jsx(pa,{position:[0,.05,.1],rotation:[-Math.PI/2,0,0],fontSize:.028,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:`${e.cores}C / ${e.logical_cores}T`}),n&&p.jsx(D9,{position:[0,.3,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:p.jsxs("div",{className:"bg-white border border-black rounded-none px-3 py-2 min-w-[180px]",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-1",children:e.model}),p.jsxs("div",{className:"text-[10px] text-black space-y-0.5",children:[p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Cores"}),p.jsx("span",{className:"font-mono",children:e.cores})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Threads"}),p.jsx("span",{className:"font-mono",children:e.logical_cores})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Sockets"}),p.jsx("span",{className:"font-mono",children:e.sockets})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Frequency"}),p.jsxs("span",{className:"font-mono",children:[(e.frequency_mhz/1e3).toFixed(2)," GHz"]})]}),p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Arch"}),p.jsx("span",{className:"font-mono",children:e.architecture})]})]})]})})]})}function TAe({position:t,memory:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){return p.jsxs("group",{position:t,children:[p.jsxs(Vu,{args:[.6,.12,.35],radius:0,smoothness:4,onPointerOver:o=>{o.stopPropagation(),r()},onPointerOut:i,onClick:o=>{o.stopPropagation(),s()},children:[p.jsx("meshBasicMaterial",{color:n?wn.moduleBodyHover:wn.moduleBody}),p.jsx(om,{color:wn.platformBorder,threshold:1,scale:1.002})]}),p.jsx(pa,{position:[0,.063,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:"RAM"}),p.jsx(pa,{position:[0,.063,.05],rotation:[-Math.PI/2,0,0],fontSize:.045,color:wn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`${Math.round(e.total_gb)}GB`}),n&&p.jsx(D9,{position:[0,.3,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:p.jsxs("div",{className:"bg-white border border-black rounded-none px-3 py-2 min-w-[140px]",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-1",children:"System Memory"}),p.jsx("div",{className:"text-[10px] text-black space-y-0.5",children:p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:"Total"}),p.jsxs("span",{className:"font-mono",children:[e.total_gb.toFixed(0)," GB"]})]})})]})})]})}function EAe({vramPositions:t,vramDepth:e,interconnect:n}){if(!(n!=null&&n.nvlink)||t.length<2)return null;const r=[...t].sort((h,g)=>h[0]-g[0]),i=r[0][0],s=r[r.length-1][0],a=(i+s)/2,o=s-i,c=t[0][2]-e/2-.18,d=.065;return p.jsxs("group",{children:[p.jsx(Vu,{args:[o,.02,.035],radius:.002,smoothness:4,position:[a,d,c],children:p.jsx("meshBasicMaterial",{color:wn.nvlink})}),t.map((h,g)=>{const v=h[2]-e/2,b=Math.abs(v-c),_=(v+c)/2;return p.jsx("group",{children:p.jsx(Vu,{args:[.02,.02,b],radius:.001,smoothness:2,position:[h[0],d,_],children:p.jsx("meshBasicMaterial",{color:wn.nvlink})})},g)}),p.jsx(pa,{position:[a,.035,c-.15],rotation:[-Math.PI/2,0,0],fontSize:.06,color:wn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`NVLink · ${n.links_per_gpu} links/GPU · ${n.speed_gbps} Gbps`})]})}function CAe({node:t,position:e,hoveredItem:n,setHoveredItem:r,setSelectedItem:i}){const s=t.gpus.length,a=1.15,o=s*a,l=Math.max(o+1.8,3.5),c=3.2,d=.6,h=.35,g=.6,v=.06,b=-.15,_=b-d/2-v-h/2,w=b+d/2+.08,S=w+.4+g/2,E=t.gpus.map((N,D)=>[D*a-(o-a)/2,.14,b]),A=t.gpus.map((N,D)=>[D*a-(o-a)/2,.11,_]);return p.jsxs("group",{position:e,children:[p.jsxs(Vu,{args:[l,.06,c],radius:0,smoothness:4,children:[p.jsx("meshBasicMaterial",{color:wn.platform}),p.jsx(om,{color:wn.platformBorder,threshold:1,scale:1.002})]}),p.jsxs(pa,{position:[0,.04,-c/2+.15],rotation:[-Math.PI/2,0,0],fontSize:.09,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:[`Node ${t.node_id}`,t.is_driver?" (Driver)":""]}),p.jsx(pa,{position:[0,.04,-c/2+.3],rotation:[-Math.PI/2,0,0],fontSize:.05,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:`${t.hostname} · ${t.ip}`}),t.gpus.map((N,D)=>{const P=E[D],L=[e[0]+P[0],e[1]+P[1],e[2]+P[2]];return p.jsxs("group",{children:[p.jsx(_Ae,{position:P,gpu:N,nodeId:t.node_id,isHovered:n===`gpu-${t.node_id}-${N.local_index}`,onHover:()=>r(`gpu-${t.node_id}-${N.local_index}`),onUnhover:()=>r(null),onClick:()=>i({type:"gpu",nodeId:t.node_id,gpuIndex:N.local_index,data:N,worldPosition:L})}),p.jsx(SAe,{position:A[D],memoryGb:N.hardware.memory_total_gb,isHovered:n===`vram-${t.node_id}-${N.local_index}`,onHover:()=>r(`vram-${t.node_id}-${N.local_index}`),onUnhover:()=>r(null)})]},D)}),p.jsx(EAe,{vramPositions:A,vramDepth:h,interconnect:t.interconnect}),(()=>{const N=[0,.09,S],D=[.75,.11,S],P=[e[0]+N[0],e[1]+N[1],e[2]+N[2]],L=[e[0]+D[0],e[1]+D[1],e[2]+D[2]];return p.jsxs(p.Fragment,{children:[p.jsx(MAe,{position:N,cpu:t.cpu,isHovered:n===`cpu-${t.node_id}`,onHover:()=>r(`cpu-${t.node_id}`),onUnhover:()=>r(null),onClick:()=>i({type:"cpu",nodeId:t.node_id,data:t.cpu,worldPosition:P})}),p.jsx(TAe,{position:D,memory:t.memory,isHovered:n===`mem-${t.node_id}`,onHover:()=>r(`mem-${t.node_id}`),onUnhover:()=>r(null),onClick:()=>i({type:"ram",nodeId:t.node_id,data:t.memory,worldPosition:L})})]})})(),(()=>{var q,K;const N=((q=t.gpus[0])==null?void 0:q.hardware.pcie_gen)??0,D=((K=t.gpus[0])==null?void 0:K.hardware.pcie_width)??0;if(N===0||s<1)return null;const P=[...E].sort((Y,Q)=>Y[0]-Q[0]),L=P[0][0],R=P[P.length-1][0],O=(L+R)/2,W=R-L,F=.065,V=w,G=S-g/2,Z=Math.abs(G-V),B=(V+G)/2;return p.jsxs("group",{children:[p.jsx(Vu,{args:[W,.02,.035],radius:.002,smoothness:4,position:[O,F,w],children:p.jsx("meshBasicMaterial",{color:wn.chipBorder})}),E.map((Y,Q)=>{const U=b+d/2,j=Math.abs(w-U),X=(U+w)/2;return p.jsx("group",{children:p.jsx(Vu,{args:[.02,.02,j],radius:.001,smoothness:2,position:[Y[0],F,X],children:p.jsx("meshBasicMaterial",{color:wn.chipBorder})})},Q)}),p.jsx(Vu,{args:[.02,.02,Z],radius:.001,smoothness:2,position:[0,F,B],children:p.jsx("meshBasicMaterial",{color:wn.chipBorder})}),p.jsx(pa,{position:[.15,.035,B],rotation:[-Math.PI/2,0,-Math.PI/2],fontSize:.06,maxWidth:Z-.1,color:wn.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,textAlign:"center",children:`PCIe Gen${N} x${D}`})]})})(),(()=>{const N=[];return t.software.cuda&&N.push(`CUDA ${t.software.cuda}`),t.software.pytorch&&N.push(`PyTorch ${t.software.pytorch}`),t.software.python&&N.push(`Python ${t.software.python}`),N.length===0?null:p.jsx(pa,{position:[0,.035,c/2-.1],rotation:[-Math.PI/2,0,0],fontSize:.03,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:N.join(" · ")})})()]})}function YK(){return p.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,-.05,0],children:[p.jsx("planeGeometry",{args:[50,50]}),p.jsx("meshBasicMaterial",{color:wn.background})]})}function AAe({node:t,position:e,onClick:n}){const[r,i]=T.useState(!1),s=T.useRef(null);T.useEffect(()=>()=>{document.body.style.cursor="auto"},[]);const a=t.gpus.filter(b=>b.role.role==="trainer").length,o=t.gpus.filter(b=>b.role.role==="inference").length,l=t.gpus.length,c=(()=>{const b=[`${l} GPUs`],_=[];return a>0&&_.push(`${a}T`),o>0&&_.push(`${o}I`),_.length>0&&b.push(_.join(" ")),b.join(" · ")})(),d=2.5,h=1.5,g=.5,v=g/2+.005;return RE(()=>{if(!s.current)return;const b=r?e[1]+.06:e[1];s.current.position.y+=(b-s.current.position.y)*.15}),p.jsxs("group",{ref:s,position:e,children:[p.jsxs(Vu,{args:[d,g,h],radius:0,smoothness:4,onPointerOver:b=>{b.stopPropagation(),i(!0),document.body.style.cursor="pointer"},onPointerOut:()=>{i(!1),document.body.style.cursor="auto"},onClick:b=>{b.stopPropagation(),document.body.style.cursor="auto",n()},children:[p.jsx("meshBasicMaterial",{color:wn.platform}),p.jsx(om,{color:r?wn.trainer:wn.platformBorder,threshold:1,scale:1.002})]}),t.gpus.map((b,_)=>{const A=-(l*.18+(l-1)*.06)/2+.18/2+_*(.18+.06),N=b.role.role==="trainer"?wn.trainer:b.role.role==="inference"?wn.inference:wn.unassigned;return p.jsxs("mesh",{position:[A,g/2+.025,-.15],children:[p.jsx("boxGeometry",{args:[.18,.04,.22]}),p.jsx("meshBasicMaterial",{color:N})]},_)}),p.jsxs(pa,{position:[-d/2+.15,v,-h/2+.15],rotation:[-Math.PI/2,0,0],fontSize:.12,color:wn.textBlack,anchorX:"left",anchorY:"middle",fontWeight:700,children:[`Node ${t.node_id}`,t.is_driver?"  DRIVER":""]}),p.jsx(pa,{position:[-d/2+.15,v,-h/2+.35],rotation:[-Math.PI/2,0,0],fontSize:.07,color:wn.textBlack,anchorX:"left",anchorY:"middle",children:t.hostname}),p.jsx(pa,{position:[-d/2+.15,v,.25],rotation:[-Math.PI/2,0,0],fontSize:.08,color:wn.textBlack,anchorX:"left",anchorY:"middle",children:c}),p.jsx(pa,{position:[-d/2+.15,v,.45],rotation:[-Math.PI/2,0,0],fontSize:.06,color:wn.textBlack,anchorX:"left",anchorY:"middle",children:`${t.cpu.cores}C CPU · ${Math.round(t.memory.total_gb)}GB RAM`})]})}function NAe({topology:t,onSelectNode:e}){const i=T.useMemo(()=>{const a=[],o=Math.ceil(Math.sqrt(t.nodes.length)),l=3.2,c=2.2;return t.nodes.forEach((d,h)=>{const g=Math.floor(h/o),v=h%o,_=-(Math.min(o,t.nodes.length-g*o)-1)*l/2;a.push([v*l+_,.3,g*c])}),a},[t.nodes]),s=T.useMemo(()=>{if(i.length===0)return{w:4,d:3,cx:0,cz:0};let a=1/0,o=-1/0,l=1/0,c=-1/0;for(const[h,,g]of i)a=Math.min(a,h-2.5/2),o=Math.max(o,h+2.5/2),l=Math.min(l,g-1.5/2),c=Math.max(c,g+1.5/2);const d=.6;return{w:o-a+d*2,d:c-l+d*2,cx:(a+o)/2,cz:(l+c)/2}},[i]);return p.jsxs(p.Fragment,{children:[p.jsx("color",{attach:"background",args:[wn.background]}),p.jsx("ambientLight",{intensity:.7}),p.jsx("directionalLight",{position:[8,12,5],intensity:.8}),p.jsx("directionalLight",{position:[-5,8,-5],intensity:.4}),p.jsx("hemisphereLight",{color:"#ffffff",groundColor:"#ffffff",intensity:.5}),p.jsx(YK,{}),p.jsx("gridHelper",{args:[50,50,wn.gridColor,wn.gridColor],position:[0,-.04,0]}),p.jsxs(Vu,{args:[s.w,.06,s.d],radius:0,smoothness:4,position:[s.cx,0,s.cz],children:[p.jsx("meshBasicMaterial",{color:wn.platform}),p.jsx(om,{color:wn.platformBorder,threshold:1,scale:1.002})]}),t.nodes.map((a,o)=>p.jsx(AAe,{node:a,position:i[o],onClick:()=>e(a.node_id)},a.node_id))]})}function RAe({focusTarget:t,overviewPosition:e,overviewLookAt:n}){const{camera:r}=$c(),i=$c(g=>g.controls),s=T.useRef(new Fe(...e)),a=T.useRef(new Fe(...n)),o=T.useRef(!1),l=T.useRef(null),c=T.useRef(e.join(",")),d=e.join(",");T.useEffect(()=>{c.current=d,!t&&i&&(r.position.set(...e),i.target.set(...n),i.update(),o.current=!1)},[d]);const h=t?t.position.join(","):null;return T.useEffect(()=>{if(l.current=h,t){const[g,v,b]=t.position;s.current.set(g+.8,v+1.2,b+1.4),a.current.set(g,v,b),o.current=!0}else o.current=!1},[h]),RE(()=>{if(!i||!o.current)return;const g=.06;r.position.lerp(s.current,g);const v=i;v.target.lerp(a.current,g),i.update();const b=r.position.distanceTo(s.current),_=v.target.distanceTo(a.current);b<.01&&_<.01&&(r.position.copy(s.current),v.target.copy(a.current),i.update(),o.current=!1)}),null}function Yi({label:t,value:e,mono:n=!0}){return p.jsxs("div",{className:"flex justify-between gap-4",children:[p.jsx("span",{children:t}),p.jsx("span",{className:n?"font-mono":"",children:e})]})}function kAe({topology:t,focusedItem:e,onClose:n}){return p.jsx("div",{className:"absolute top-4 right-4 w-72 max-h-[calc(100%-2rem)] overflow-auto",children:e?p.jsxs("div",{className:"bg-white border border-black rounded-none p-4",children:[e.type==="gpu"&&(()=>{const r=e.data,i=r.role.role==="trainer"?wn.trainer:r.role.role==="inference"?wn.inference:wn.unassigned;return p.jsxs("div",{className:"space-y-1 text-[11px] text-black",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-2",children:"GPU Details"}),p.jsx("div",{className:"font-mono text-black text-xs mb-1",children:r.hardware.name}),p.jsx(Yi,{label:"Node / Index",value:`#${e.nodeId} / GPU ${r.local_index}`}),p.jsx(Yi,{label:"Role",value:p.jsx("span",{className:"font-semibold",style:{color:i},children:r.role.role.charAt(0).toUpperCase()+r.role.role.slice(1)}),mono:!1}),r.role.rank!==void 0&&p.jsx(Yi,{label:"Rank",value:r.role.rank}),r.role.dp_rank!==void 0&&p.jsx(Yi,{label:"DP / TP / PP",value:`${r.role.dp_rank} / ${r.role.tp_rank} / ${r.role.pp_rank}`}),r.role.server_idx!==void 0&&p.jsx(Yi,{label:"Server",value:r.role.server_idx}),r.role.url&&p.jsx(Yi,{label:"URL",value:p.jsx("span",{className:"text-[9px]",children:r.role.url})}),p.jsx("div",{className:"border-t border-black mt-1.5 pt-1.5"}),p.jsx(Yi,{label:"VRAM",value:`${r.hardware.memory_total_gb} GB`}),p.jsx(Yi,{label:"PCIe",value:`Gen${r.hardware.pcie_gen} x${r.hardware.pcie_width}`}),p.jsx(Yi,{label:"Serial",value:p.jsx("span",{className:"text-[9px]",children:r.hardware.serial})}),p.jsx(Yi,{label:"UUID",value:p.jsx("span",{className:"text-[9px] break-all",children:r.hardware.uuid})})]})})(),e.type==="cpu"&&(()=>{const r=e.data;return p.jsxs("div",{className:"space-y-1 text-[11px] text-black",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-2",children:"CPU Details"}),p.jsx("div",{className:"font-mono text-black text-xs mb-1",children:r.model}),p.jsx(Yi,{label:"Node",value:`#${e.nodeId}`}),p.jsx(Yi,{label:"Architecture",value:r.architecture}),p.jsx(Yi,{label:"Cores",value:r.cores}),p.jsx(Yi,{label:"Logical Cores",value:r.logical_cores}),p.jsx(Yi,{label:"Sockets",value:r.sockets}),p.jsx(Yi,{label:"Frequency",value:`${(r.frequency_mhz/1e3).toFixed(2)} GHz`})]})})(),e.type==="ram"&&(()=>{const r=e.data;return p.jsxs("div",{className:"space-y-1 text-[11px] text-black",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-2",children:"System Memory"}),p.jsx(Yi,{label:"Node",value:`#${e.nodeId}`}),p.jsx(Yi,{label:"Total",value:`${r.total_gb.toFixed(0)} GB`})]})})(),p.jsx("button",{onClick:n,className:"mt-4 w-full py-1.5 text-xs font-medium text-black border border-black rounded-none hover:bg-black hover:text-white transition-colors",children:"Close"})]}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"bg-white border border-black rounded-none p-4 mb-3",children:[p.jsx("div",{className:"text-xs font-semibold text-black mb-2",children:"Cluster Overview"}),p.jsxs("div",{className:"space-y-1 text-[11px] text-black",children:[p.jsx(Yi,{label:"Model",value:p.jsx("span",{className:"text-black",children:t.model||"—"}),mono:!1}),p.jsx(Yi,{label:"Nodes",value:t.nodes.length}),p.jsx(Yi,{label:"Total GPUs",value:t.total_gpus}),t.trainer_config&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-black mt-2 pt-2 mb-1 text-[10px] font-semibold uppercase tracking-wider",style:{color:wn.trainer},children:"Trainer"}),p.jsx(Yi,{label:"GPUs",value:t.trainer_total_gpus}),p.jsx(Yi,{label:"Backend",value:t.trainer_config.backend}),p.jsx(Yi,{label:"DP × TP × PP",value:`${t.trainer_config.data_parallel_size} × ${t.trainer_config.megatron_tensor_parallel_size} × ${t.trainer_config.megatron_pipeline_parallel_size}`})]}),t.inference_config&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-black mt-2 pt-2 mb-1 text-[10px] font-semibold uppercase tracking-wider",style:{color:wn.inference},children:"Inference"}),p.jsx(Yi,{label:"GPUs",value:t.inference_total_gpus}),p.jsx(Yi,{label:"Servers",value:t.inference_config.num_servers}),p.jsx(Yi,{label:"TP Size",value:t.inference_config.tensor_parallel_size}),p.jsx(Yi,{label:"Placement",value:t.inference_config.placement_strategy})]})]})]}),p.jsxs("div",{className:"bg-white border border-black rounded-none p-3",children:[p.jsx("div",{className:"text-[10px] font-semibold text-black mb-1.5",children:"Legend"}),p.jsxs("div",{className:"space-y-1",children:[p.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-black",children:[p.jsx("div",{className:"w-3 h-2",style:{background:wn.trainer}}),"Trainer GPU"]}),p.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-black",children:[p.jsx("div",{className:"w-3 h-2",style:{background:wn.inference}}),"Inference GPU"]}),p.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-black",children:[p.jsx("div",{className:"w-3 h-2",style:{background:wn.unassigned}}),"Unassigned GPU"]}),p.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-black",children:[p.jsx("div",{className:"w-3 h-1",style:{background:wn.nvlink}}),"NVLink"]})]})]})]})})}function PAe({topology:t,hoveredItem:e,setHoveredItem:n,setSelectedItem:r,focusedItem:i}){const s=T.useMemo(()=>{const a=[],o=Math.ceil(Math.sqrt(t.nodes.length)),l=6.5,c=3.5;return t.nodes.forEach((d,h)=>{const g=Math.floor(h/o),v=h%o,_=-(Math.min(o,t.nodes.length-g*o)-1)*l/2;a.push([v*l+_,0,g*c])}),a},[t.nodes]);return p.jsxs(p.Fragment,{children:[p.jsx("color",{attach:"background",args:[wn.background]}),p.jsx("ambientLight",{intensity:.7}),p.jsx("directionalLight",{position:[8,12,5],intensity:.8}),p.jsx("directionalLight",{position:[-5,8,-5],intensity:.4}),p.jsx("hemisphereLight",{color:"#ffffff",groundColor:"#ffffff",intensity:.5}),p.jsx(YK,{}),p.jsx("gridHelper",{args:[50,50,wn.gridColor,wn.gridColor],position:[0,-.04,0]}),t.nodes.map((a,o)=>p.jsx(CAe,{node:a,position:s[o],hoveredItem:i?null:e,setHoveredItem:i?()=>{}:n,setSelectedItem:i?()=>{}:r},a.node_id))]})}function KK({topology:t}){const[e,n]=T.useState(null),[r,i]=T.useState(null),[s,a]=T.useState(null),o=t.nodes.length>1,l=o&&s===null,c=T.useMemo(()=>{if(!o||s===null)return t;const S=t.nodes.find(E=>E.node_id===s);return S?{...t,nodes:[S]}:t},[t,s,o]),d=T.useMemo(()=>{const S=l?t:c,E=S.nodes.length,A=Math.max(...S.nodes.map(D=>D.gpus.length),1);if(l){const D=Math.max(4,E*1.5);return[D*.6,D*.9,D*.6]}const N=Math.max(3.5,E*1.8,A*.8);return[N*.8,N*.7,N*.8]},[t,c,l]),h=T.useMemo(()=>[0,0,0],[]),g=T.useCallback(S=>{i(S),S&&n(null)},[]),v=T.useCallback(()=>{i(null)},[]),b=T.useCallback(()=>{a(null),i(null),n(null)},[]),_=T.useCallback(S=>{a(S),i(null),n(null)},[]),w=r!==null;return p.jsxs("div",{className:"relative w-full h-full bg-white",children:[p.jsxs(JEe,{camera:{position:d,fov:45,near:.1,far:100},gl:{antialias:!0,alpha:!1},onCreated:({gl:S})=>{S.setClearColor(wn.background),S.toneMapping=nu},children:[l?p.jsx(NAe,{topology:t,onSelectNode:_}):p.jsx(PAe,{topology:c,hoveredItem:e,setHoveredItem:n,setSelectedItem:g,focusedItem:r}),p.jsx(RAe,{focusTarget:!l&&r?{position:r.worldPosition}:null,overviewPosition:d,overviewLookAt:h}),p.jsx(vAe,{makeDefault:!0,enablePan:!0,enableZoom:!0,enableRotate:!0,minDistance:1,maxDistance:30,maxPolarAngle:Math.PI/2-.05,onStart:()=>{r&&v()}})]}),o&&s!==null&&p.jsx("button",{onClick:b,className:"absolute top-4 left-4 px-3 py-1.5 text-xs font-medium text-black bg-white border border-black rounded-none hover:bg-black hover:text-white transition-colors select-none",children:"← Back to cluster"}),p.jsx(kAe,{topology:l?t:c,focusedItem:r,onClose:v}),p.jsx("div",{className:"absolute bottom-4 left-4 text-[10px] text-black/60 select-none",children:l?"Click a node to inspect · Drag to orbit · Scroll to zoom":w?"Move to dismiss · Click Close to return":"Drag to orbit · Scroll to zoom · Right-click to pan · Click an object to focus"})]})}function ZK(t){if(t&&typeof t=="object"&&"value"in t)return ZK(t.value);if(Array.isArray(t)){const e=t.map(n=>typeof n=="string"?n.trim():n).map(n=>Number(n)).filter(n=>Number.isFinite(n));return Array.from(new Set(e))}if(typeof t=="number"&&Number.isFinite(t))return[t];if(typeof t=="string"){const n=(t.match(/-?\d+/g)??[]).map(r=>Number(r)).filter(r=>Number.isFinite(r));return Array.from(new Set(n))}return[]}const IAe=[1,5,10,30,60,120,300],V6=gT,cF=gT,DAe=["torch_allocated_gb"],OAe="__timeline_noop_metric__";function IE(t){return j9(t==null?void 0:t.setup)}function LAe(t){const e=IE(t),n={},r=mi(e==null?void 0:e.trainer),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const a=mi(s);if(!a)continue;const o=Er(a.node_id),l=Array.isArray(a.gpus)?a.gpus:[];for(const c of l){const d=mi(c);if(!d)continue;const h=Er(d.rank);h!==null&&(n[h]={node_id:o,local_rank:Er(d.local_rank)})}}return n}function zAe(t){const e=IE(t),n=mi(e==null?void 0:e.inference);return Er(n==null?void 0:n.num_servers)??void 0}function jAe(t){const e=IE(t),n={},r=mi(e==null?void 0:e.inference),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const a=mi(s);if(!a)continue;const o=Er(a.node_id),l=Array.isArray(a.gpus)?a.gpus:[];for(const c of l){const d=mi(c);if(!d)continue;const h=Er(d.server_idx);h!==null&&(h in n||(n[h]=o))}}return n}function uF(t){const e=IE(t),n=mi(e==null?void 0:e.cluster),r=Array.isArray(n==null?void 0:n.nodes)?n.nodes:[];return r.length>0?r.length:void 0}function FAe(t){const e=t.trim();if(!e)return null;const n=/^(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?$/i,r=e.match(n);if(r&&(r[1]||r[2]||r[3])){const s=parseInt(r[1]||"0",10),a=parseInt(r[2]||"0",10),o=parseInt(r[3]||"0",10),l=s*3600+a*60+o;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function UAe({value:t,onChange:e}){const[n,r]=T.useState(!1),[i,s]=T.useState(""),a=T.useRef(null),o=c=>{c&&(s(V6(t)),setTimeout(()=>{var d;return(d=a.current)==null?void 0:d.select()},0)),r(c)},l=()=>{const c=FAe(i);c!==null&&(e(c),r(!1))};return p.jsxs(aT,{open:n,onOpenChange:o,children:[p.jsx(oT,{asChild:!0,children:p.jsxs("button",{className:"inline-flex items-center gap-1 rounded-lg border border-input bg-transparent px-2 h-7 text-xs hover:bg-accent transition-colors select-none whitespace-nowrap",children:[V6(t),p.jsx(Vr,{className:"size-3 text-muted-foreground"})]})}),p.jsxs(lT,{align:"start",className:"w-40 p-1.5 gap-1",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("input",{ref:a,type:"text",value:i,onChange:c=>s(c.target.value),onKeyDown:c=>{c.key==="Enter"&&l()},className:"h-7 w-full rounded-md border border-input bg-transparent px-2 text-xs outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[2px]",placeholder:"e.g. 30s, 2m, 1h"}),p.jsx("button",{onClick:l,className:"shrink-0 h-7 px-2 rounded-md text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",children:"Go"})]}),p.jsx("div",{className:"flex flex-col",children:IAe.map(c=>p.jsx("button",{onClick:()=>{e(c),r(!1)},className:`text-left rounded-md px-2 py-1 text-xs transition-colors ${c===t?"bg-accent text-accent-foreground font-medium":"hover:bg-accent hover:text-accent-foreground"}`,children:V6(c)},c))})]})]})}function BAe(){var B,q,K,Y;const t=ki(ml),[e,n]=cn(kce),[r,i]=cn(Pce),s=!0,{data:a,isFetching:o,isPlaceholderData:l,error:c}=hue(t||"",e,r,!!t),{data:d}=ed(t||"",!!t,s),h=T.useMemo(()=>{var U;const Q=(U=d==null?void 0:d.config)==null?void 0:U.trainer_devices;return ZK(Q)},[(B=d==null?void 0:d.config)==null?void 0:B.trainer_devices]),g=(a==null?void 0:a.interval_start)??null,v=(a==null?void 0:a.interval_end)??null,b=o&&(l||!a),[_,w]=T.useState(()=>[...DAe]),S=T.useMemo(()=>{const Q=Array.from(new Set(_.filter(U=>typeof U=="string"&&U.trim().length>0))).sort((U,j)=>U.localeCompare(j));return Q.length>0?Q:[OAe]},[_]),E=T.useMemo(()=>LAe(d==null?void 0:d.summary),[d==null?void 0:d.summary]),A=T.useMemo(()=>{const Q={},U=(a==null?void 0:a.trainer_events)??[];for(const j of U){const X=j.rank;if(!Number.isFinite(X))continue;const H=Q[X]??{node_id:null,local_rank:null},ie=H.node_id!==null?H.node_id:typeof j.node_id=="number"&&Number.isFinite(j.node_id)?j.node_id:null,ne=H.local_rank!==null?H.local_rank:typeof j.local_rank=="number"&&Number.isFinite(j.local_rank)?j.local_rank:null;Q[X]={node_id:ie,local_rank:ne}}return Q},[a==null?void 0:a.trainer_events]),N=T.useMemo(()=>{const Q={};return new Set([...Object.keys(E).map(Number),...Object.keys(A).map(Number)]).forEach(j=>{const X=E[j],H=A[j];Q[j]={node_id:(X==null?void 0:X.node_id)??(H==null?void 0:H.node_id)??null,local_rank:(X==null?void 0:X.local_rank)??(H==null?void 0:H.local_rank)??null}}),Q},[E,A]),D=T.useMemo(()=>jAe(d==null?void 0:d.summary),[d==null?void 0:d.summary]),P=T.useMemo(()=>{const Q={},U=(a==null?void 0:a.inference_events)??[];for(const j of U){const X=j.server;Number.isFinite(X)&&Q[X]===void 0&&typeof j.node_id=="number"&&Number.isFinite(j.node_id)&&(Q[X]=j.node_id)}return Q},[a==null?void 0:a.inference_events]),L=T.useMemo(()=>{const Q={};return new Set([...Object.keys(D).map(Number),...Object.keys(P).map(Number)]).forEach(j=>{Q[j]=D[j]??P[j]??null}),Q},[D,P]),R=T.useMemo(()=>{const Q=((a==null?void 0:a.trainer_events)??[]).map(j=>j.rank).filter(j=>Number.isFinite(j)),U=Object.keys(N).map(Number);return Array.from(new Set([...Q,...U])).sort((j,X)=>j-X)},[a==null?void 0:a.trainer_events,N]),O=T.useMemo(()=>R.map(Q=>{var U,j;return{rank:Q,node_id:((U=N[Q])==null?void 0:U.node_id)??null,local_rank:((j=N[Q])==null?void 0:j.local_rank)??null}}),[R,N]),W=T.useMemo(()=>{const Q=[];let U=!1;return R.forEach(j=>{var H;const X=(H=N[j])==null?void 0:H.local_rank;X!=null&&(Q[j]=X,U=!0)}),U?Q:h},[N,R,h]),F=gue(t||"",S,O,g,v,!!t&&g!==null&&v!==null&&O.length>0),V=T.useMemo(()=>{const Q={};return O.forEach((U,j)=>{var H;const X=(H=F[j])==null?void 0:H.data;Q[U.rank]=(X==null?void 0:X.metrics)??[]}),Q},[O,F]),G=T.useMemo(()=>{const Q=[];F.forEach(X=>{const H=X.data;H!=null&&H.available_metrics&&H.available_metrics.forEach(ie=>{typeof ie=="string"&&Q.push(ie)})});const U=Array.from(new Set(Q));if(U.length>0)return U;const j=new Set;return F.forEach(X=>{var ie;const H=X.data;(ie=H==null?void 0:H.metrics)==null||ie.forEach(ne=>{typeof ne.metric_name=="string"&&j.add(ne.metric_name)})}),Array.from(j).sort((X,H)=>X.localeCompare(H))},[F]),Z=F.some(Q=>Q.isFetching);return t?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center gap-2 h-7",children:[p.jsx(jk,{currentPage:e,totalPages:(a==null?void 0:a.total_pages)??1,onPageChange:n}),p.jsx(UAe,{value:r,onChange:Q=>{const U=Math.floor(e*r/Q);i(Q),n(U)}}),g!==null&&v!==null&&(a==null?void 0:a.global_min_time)!=null&&p.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[cF(g-a.global_min_time)," – ",cF(v-a.global_min_time)]})]})})}),p.jsx("div",{className:"flex-1 overflow-auto p-6",children:p.jsxs("div",{className:"max-w-7xl mx-auto",children:[c&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error: ",c instanceof Error?c.message:"Unknown error"]})})}),p.jsx(Dbe,{orchestratorData:a==null?void 0:a.orchestrator_events,trainerData:a==null?void 0:a.trainer_events,inferenceData:a==null?void 0:a.inference_events,isLoading:b,intervalStart:(a==null?void 0:a.interval_start)??0,intervalEnd:(a==null?void 0:a.interval_end)??r,trainerGpuMetricsByRank:V,trainerGpuMetricsIsLoading:Z,trainerAvailableGpuMetrics:G,selectedTrainerGpuMetrics:_,onSelectedTrainerGpuMetricsChange:w,trainerSystemGpuIndices:W,trainerRankInfoByRank:N,totalSetupNodes:uF(d==null?void 0:d.summary),inferenceServerNodeMap:L,numInferenceServers:zAe(d==null?void 0:d.summary)??((q=d==null?void 0:d.config)==null?void 0:q.num_inference_servers),maxConcurrentPrompts:(K=d==null?void 0:d.config)==null?void 0:K.max_concurrent_prompts,groupSize:(Y=d==null?void 0:d.config)==null?void 0:Y.group_size})]})}),p.jsx(HAe,{runPath:t,trainerEvents:a==null?void 0:a.trainer_events,totalSetupNodes:uF(d==null?void 0:d.summary)})]}):p.jsx(mm,{description:"Select a run from the sidebar to view the timeline."})}function HAe({runPath:t,trainerEvents:e,totalSetupNodes:n}){const[r,i]=cn(SG),[s,a]=cn(_G),[o,l]=T.useState("inference"),[c,d]=T.useState(r),[h,g]=T.useState(s);r!==c&&(d(r),r&&l("inference")),s!==h&&(g(s),s&&l("trainer"));const{data:v}=pue(t??"",(r==null?void 0:r.groupId)??null,!!r&&!!t),b=T.useMemo(()=>{if(!r||!(v!=null&&v.events))return null;const ie={};for(const ne of v.events)ne.sample_id!==void 0&&(ie[ne.sample_id]||(ie[ne.sample_id]=[]),ie[ne.sample_id].push(ne));return ie},[r,v]),_=T.useMemo(()=>{if(!v)return null;const ie=v.environment_response_times??[],ne=v.compute_reward_times??[],re={};for(const le of ie)re[le.sample_idx]||(re[le.sample_idx]=[]),re[le.sample_idx].push({turn_order:le.turn_order,time:le.time});for(const le of Object.values(re))le.sort((fe,we)=>fe.turn_order-we.turn_order);const ue={};for(const le of ne)ue[le.sample_idx]=le.time;return{envBySample:re,rewardBySample:ue}},[v]),w=T.useMemo(()=>{if(!b)return null;let ie=1/0,ne=-1/0;for(const[re,ue]of Object.entries(b)){for(const le of ue){ie=Math.min(ie,le.start_time),ne=Math.max(ne,le.end_time);let fe=le.end_time;le.environment_response_time&&le.environment_response_time>0&&(fe+=le.environment_response_time),le.compute_reward_time&&le.compute_reward_time>0&&(fe+=le.compute_reward_time),ne=Math.max(ne,fe)}if(_){const le=Number(re),fe=[...ue].sort((Ve,ye)=>Ve.start_time-ye.start_time),we=_.envBySample[le]??[];let pe=-1/0;for(let Ve=0;Ve<fe.length;Ve++)pe=fe[Ve].end_time,Ve<we.length&&we[Ve].time>0&&(pe+=we[Ve].time);const xe=_.rewardBySample[le]??0;xe>0&&(pe+=xe),ne=Math.max(ne,pe)}}return ie===1/0?null:{start:ie,end:ne,duration:ne-ie}},[b,_]),{data:S}=mue(t??"",(s==null?void 0:s.eventType)??null,(s==null?void 0:s.rank)??null,(s==null?void 0:s.step)??null,!!t&&!!s),E=T.useMemo(()=>S!=null&&S.events&&S.events.length>0?S.events:e??[],[S,e]),A=T.useMemo(()=>{if(E.length===0)return{};const ie={};for(const ne of E)ie[ne.rank]||(ie[ne.rank]=[]),ie[ne.rank].push(ne);return ie},[E]),N=T.useMemo(()=>s?(A[s.rank]||[]).find(ne=>ne.event_type===s.eventType&&ne.step===s.step&&ne.rank===s.rank&&!ne.event_type.includes("/"))??null:null,[s,A]),D=T.useMemo(()=>s?(A[s.rank]||[]).filter(ne=>ne.event_type.startsWith(s.eventType+"/")&&ne.step===s.step):[],[s,A]),P=ki(dT),L=ki(bG),R=T.useMemo(()=>!r||!b?[]:Object.keys(b).map(Number).map(ie=>({group_id:r.groupId,sample_idx:ie})),[r,b]),{data:O}=w8(t??"",R,!!t&&R.length>0&&P),W=!P||R.length===0||!!O,F=T.useMemo(()=>!P||!(O!=null&&O.statuses)?!1:O.statuses.some(ie=>ie.kind==="rollouts_discarded"),[P,O]),V=T.useMemo(()=>b?Object.values(b).some(ie=>ie.some(ne=>ne.is_canceled)):!1,[b]),{data:G}=kG(t??"",(r==null?void 0:r.groupId)??null,(r==null?void 0:r.sampleId)??null,!!t&&!!r,r==null?void 0:r.isEval),Z=T.useMemo(()=>!G||G.kind!=="rollouts_discarded"?null:G.discard_reason,[G]),B=T.useMemo(()=>{if(!G||G.kind===null)return null;const ie=G.samples_data;if(!ie||ie.length===0)return null;const ne=ie.map(re=>re.reward).filter(re=>re!==null);return ne.length===0?null:ne.every(re=>re===0)?"all_zero":ne.every(re=>re>0)?"all_positive":null},[G]),q=ie=>{switch(ie){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return ie.split("_").map(ne=>ne.charAt(0).toUpperCase()+ne.slice(1)).join(" ")}},K=!!r,Y=!!s&&D.length>0&&!!N,Q=o==="inference"&&!K&&Y?"trainer":o==="trainer"&&!Y&&K?"inference":o;if(!K&&!Y)return null;const U=()=>{Q==="inference"?(i(null),Y&&l("trainer")):(a(null),K&&l("inference"))},j=N?RG(N.event_type,N.step,N.microbatch,N.minibatch):null,X=N?u2(N.event_type):void 0,H=K&&Y;return p.jsxs("footer",{className:"border-t bg-white shrink-0 h-[28vh] flex flex-col",children:[p.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 shrink-0",children:[H&&p.jsxs("div",{className:"flex items-center bg-muted rounded-md p-0.5 gap-0.5",children:[p.jsx("button",{onClick:()=>l("inference"),className:`text-[11px] font-medium px-2.5 py-1 rounded transition-colors ${Q==="inference"?"bg-white text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Inference"}),p.jsx("button",{onClick:()=>l("trainer"),className:`text-[11px] font-medium px-2.5 py-1 rounded transition-colors ${Q==="trainer"?"bg-white text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Trainer"})]}),Q==="inference"&&r&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:V?"#adadad":F?"#6b7280":r.isEval?"#047857":"#075985"}}),p.jsxs("span",{className:"text-xs font-medium",children:["Sample ",r.sampleId]})]}),p.jsx("span",{className:"text-muted-foreground",children:"/"}),p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("div",{className:`w-2.5 h-2.5 rounded-sm${W?"":" animate-pulse bg-muted"}`,style:W?{backgroundColor:V?"#c9c9c9":F?"#a1a1a1":r.isEval?"#10b981":"#0369a1"}:void 0}),p.jsxs("span",{className:"text-xs font-medium",children:["Group ",r.groupId]})]}),V&&p.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-gray-100 text-gray-500 border border-gray-200",children:"Canceled due to async policy"}),Z&&p.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-red-100 text-red-700 border border-red-200",children:q(Z)}),Z==="zero_advantage"&&B==="all_zero"&&p.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 border border-amber-200",children:"All Rewards = 0"}),Z==="zero_advantage"&&B==="all_positive"&&p.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-emerald-100 text-emerald-700 border border-emerald-200",children:"All Rewards > 0"})]}),Q==="trainer"&&j&&N&&p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:X}}),p.jsxs("span",{className:"text-xs font-medium",children:[j.primary," Breakdown"]}),p.jsxs("span",{className:"text-xs text-muted-foreground",children:["GPU ",N.rank]}),p.jsxs("span",{className:"text-xs text-muted-foreground",children:["(Step ",N.step,")"]})]}),p.jsx("button",{onClick:U,className:"ml-auto text-muted-foreground hover:text-foreground transition-colors p-1 rounded hover:bg-muted",children:p.jsx(Ju,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"overflow-auto flex-1 min-h-0",children:[Q==="inference"&&r&&b&&w&&p.jsx(Ybe,{eventsBySampleId:b,selectedSampleId:r.sampleId,timeBounds:w,groupId:r.groupId,runPath:t??"",envResponseTimesBySample:_==null?void 0:_.envBySample,computeRewardTimeBySample:L?_==null?void 0:_.rewardBySample:void 0,onSampleClick:ie=>{i({sampleId:ie,groupId:r.groupId,isEval:r.isEval})},showNodeLabel:typeof n=="number"&&n>1,isEval:r.isEval}),Q==="trainer"&&N&&D.length>0&&p.jsx(s_e,{parentEvent:N,childEvents:D})]})]})}function F9(t,e){const n=typeof IntersectionObserver>"u",[r,i]=T.useState(n),[s,a]=T.useState(n),o=T.useRef(null),l=(e==null?void 0:e.root)??null,c=(e==null?void 0:e.rootMargin)??"0px",d=(e==null?void 0:e.threshold)??0;return T.useEffect(()=>{const h=t.current;if(!h||typeof IntersectionObserver>"u")return;const g=new IntersectionObserver(([v])=>{const b=v.isIntersecting;i(b),b?(o.current&&(clearTimeout(o.current),o.current=null),a(!0)):(o.current&&clearTimeout(o.current),o.current=setTimeout(()=>{a(!1),o.current=null},2e3))},{root:l,rootMargin:c,threshold:d});return g.observe(h),()=>{g.disconnect(),o.current&&clearTimeout(o.current)}},[t,l,c,d]),r||s}const EM={rewards:{label:"Reward",metrics:[{prefix:"reward_sum",label:"Reward"},{prefix:"reward_gini_mean",label:"Reward Sparsity (Gini)",simple:!0}]},advantage:{label:"Advantage",metrics:[{prefix:"advantage",label:"Advantage"}],showZeroLine:!0},tokens:{label:"Rollouts",metrics:[{prefix:"length_prompt",label:"Tokens Prompt"},{prefix:"length_completion",label:"Tokens Completion"},{prefix:"length_sum",label:"Tokens Total"}],unit:"tokens"},rollouts_general:{label:"Rollouts",metrics:[{prefix:"stop_reason_length_pct",label:"% Stop Reason = Length",simple:!0,group:"General"},{prefix:"group_length_gini_mean",label:"Group Completion Length Gini",simple:!0,group:"General"},{prefix:"group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",simple:!0,group:"General"}]}},VAe={discarded_stats:{label:"Discarded Rollouts",metrics:[{prefix:"discarded_count",label:"Discarded Count",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_pct",label:"Zero Advantage %",simple:!0,group:"General"},{prefix:"discarded_max_async_pct",label:"Max Async %",simple:!0,group:"General"},{prefix:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length",simple:!0,group:"General"},{prefix:"discarded_group_length_gini_mean",label:"Group Completion Length Gini",simple:!0,group:"General"},{prefix:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_all_zero_pct",label:"Zero Adv (All Reward = 0) %",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_all_positive_pct",label:"Zero Adv (All Reward > 0) %",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_mean_reward",label:"Zero Adv Mean Reward",simple:!0,group:"General"},{prefix:"canceled_count",label:"Canceled Count",simple:!0,group:"Canceled"}]},discarded_tokens:{label:"Discarded Rollouts",metrics:[{prefix:"discarded_length_prompt",label:"Discarded Tokens Prompt"},{prefix:"discarded_length_completion",label:"Discarded Tokens Completion"},{prefix:"discarded_length_sum",label:"Discarded Tokens Total"}],unit:"tokens"}},GAe={timeline_full_step:{label:"Timeline",metrics:[{prefix:"timing_step_total",label:"Time per Step",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_step_active",label:"Time per Step Active",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_save_batch_total",label:"Batch Completion (Save Batch)",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_microbatch_count",label:"Microbatches per Step",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_forward_total",label:"Timing Forward",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_backward_total",label:"Timing Backward",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_loss_computation_total",label:"Timing Loss Computation",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_compute_kl_total",label:"Timing Compute KL",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_compute_entropy_total",label:"Timing Compute Entropy",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_data_to_device_total",label:"Timing Data to Device",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_prepare_tensors_total",label:"Timing Prepare Tensors",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_waiting_for_data",label:"Timing Waiting for Data",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_weight_sync_trainer_total",label:"Timing Weight Broadcast (Trainer)",simple:!0,group:"Full Step (Total Time)"},{prefix:"timing_weight_sync_inference_total",label:"Timing Weight Broadcast (Inference)",simple:!0,group:"Full Step (Total Time)"}]},timeline_microbatch:{label:"Timeline",metrics:[{prefix:"timing_forward_microbatch_mean",label:"Microbatch Timing Forward",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_backward_microbatch_mean",label:"Microbatch Timing Backward",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_loss_computation_microbatch_mean",label:"Microbatch Timing Loss Computation",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_compute_kl_microbatch_mean",label:"Microbatch Timing Compute KL",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_compute_entropy_microbatch_mean",label:"Microbatch Timing Compute Entropy",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_data_to_device_microbatch_mean",label:"Microbatch Timing Data to Device",simple:!0,group:"Microbatch (Mean Time)"},{prefix:"timing_prepare_tensors_microbatch_mean",label:"Microbatch Timing Prepare Tensors",simple:!0,group:"Microbatch (Mean Time)"}]}},d7=["mean","std","min","max"],o1="histogram",l1="distribution_over_time";function dF(t){return t==="reward_sum"?"reward_sum":t==="advantage"?"advantage":t==="length_prompt"?"length_prompt":t==="length_completion"?"length_completion":t==="length_sum"?"length_sum":(t.startsWith("reward_"),t)}function S0(t,e,n){for(const r of n.metrics){const i="simple"in r&&r.simple,s="group"in r?r.group:void 0,a="showZeroLine"in n?n.showZeroLine:!1,o="unit"in n?n.unit:void 0;if(i){t.push({category:e,categoryLabel:n.label,group:s,metricKey:r.prefix,label:r.label,prefix:r.prefix,suffix:"",showZeroLine:a,unit:o});continue}for(const d of d7){const h=`${r.prefix}_${d}`,g=d.charAt(0).toUpperCase()+d.slice(1);t.push({category:e,categoryLabel:n.label,group:s,metricKey:h,label:`${r.label} - ${g}`,prefix:r.prefix,suffix:d,showZeroLine:a,unit:o})}const l=`${r.prefix}_${o1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:l,label:`${r.label} - Histogram`,prefix:r.prefix,suffix:o1,showZeroLine:a,unit:o,isHistogram:!0,histogramMetricType:dF(r.prefix)});const c=`${r.prefix}_${l1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:c,label:`${r.label} - Distribution Over Time`,prefix:r.prefix,suffix:l1,showZeroLine:a,unit:o,isDistributionOverTime:!0,histogramMetricType:dF(r.prefix)})}}function WAe(t,e={},n=[]){const r=[];for(const[i,s]of Object.entries(e))for(const[a,o]of Object.entries(s)){const l=a?`custom_${i}_${a}`:`custom_${i}`;S0(r,l,{label:n1(i),metrics:o.map(c=>({prefix:c,label:n1(c),simple:!0,group:a?n1(a):void 0}))})}S0(r,"rewards",EM.rewards),t.length>0&&S0(r,"rollout_metrics",{label:"Samples Metrics",metrics:t.flatMap(i=>[{prefix:`reward_${i}`,label:n1(i)},{prefix:`reward_${i}_gini_mean`,label:`${n1(i)} Sparsity (Gini)`,simple:!0}])}),S0(r,"advantage",EM.advantage),r.push(...$Ae(n)),S0(r,"tokens",EM.tokens),S0(r,"rollouts_general",EM.rollouts_general);for(const[i,s]of Object.entries(VAe))S0(r,i,s);for(const[i,s]of Object.entries(GAe))S0(r,i,s);return r}function $Ae(t){const e=[];for(const n of t){const r=n.eval_name,i=`eval/${r}/`;for(const s of n.available_rollout_metric_names){const a=n1(s),o=`${r} / ${a}`,l=`${i}reward_${s}`,c="evals";for(const d of d7){const h=d.charAt(0).toUpperCase()+d.slice(1);e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${d}`,label:`${r} ${a} - ${h}`,prefix:l,suffix:d,isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${o1}`,label:`${r} ${a} - Histogram`,prefix:l,suffix:o1,isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${l1}`,label:`${r} ${a} - Distribution Over Time`,prefix:l,suffix:l1,isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}for(const s of["length_completion","length_prompt","length_sum"]){const a=s==="length_completion"?"Tokens Completion":s==="length_prompt"?"Tokens Prompt":"Tokens Total",o=`${r} / ${a}`,l=`${i}${s}`,c="evals";for(const d of d7){const h=d.charAt(0).toUpperCase()+d.slice(1);e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${d}`,label:`${r} ${a} - ${h}`,prefix:l,suffix:d,unit:"tokens",isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${o1}`,label:`${r} ${a} - Histogram`,prefix:l,suffix:o1,unit:"tokens",isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:o,metricKey:`${l}_${l1}`,label:`${r} ${a} - Distribution Over Time`,prefix:l,suffix:l1,unit:"tokens",isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}}return e}function n1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function qAe(t){const e={};for(const n of t)e[n.category]||(e[n.category]={label:n.categoryLabel,metrics:[]}),e[n.category].metrics.push(n);return e}function XAe(t){const e=new Map;for(const n of t)if(!e.has(n.prefix))if(n.suffix){const r=n.label.lastIndexOf(" - ");e.set(n.prefix,r>0?n.label.substring(0,r):n.label)}else e.set(n.prefix,n.label);return t.map(n=>({section:n.categoryLabel,group:n.group||(n.suffix?(()=>{const r=e.get(n.prefix);return r&&r!==n.categoryLabel?r:void 0})():void 0),metricKey:n.metricKey,label:n.label,plotType:n.isHistogram?"histogram":n.isDistributionOverTime?"distribution_over_time":n.isEvalMetric?"eval_metric":"step_metric",evalName:n.evalName,histogramMetricType:n.histogramMetricType,simple:!n.suffix}))}function U9({openAtom:t=x8}={}){const[e,n]=cn(t);return!ki(ml)||e?null:p.jsx(Tn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Metrics"})}function B9({currentStep:t,maxSelectableStep:e,openAtom:n=x8,selectedMetricsAtom:r=Fce,selectedStepAtom:i=uT,includeDiscardedDefaults:s=!1,evalConfig:a}){var fe,we;const[o,l]=cn(n),[c,d]=cn(r),[h,g]=T.useState(!1),v=h&&(a==null?void 0:a.selectedSampleIdx)!=null,[b,_]=T.useState(!1),[w,S]=T.useState(10),[E,A]=T.useState("10"),N=ki(ml),D=ki(cT),P=ki(fT),L=!0,R=!!a,{data:O}=pm(),{data:W}=ed(N||"",!!N,L),F=T.useMemo(()=>(W==null?void 0:W.available_rollout_metric_names)??[],[W==null?void 0:W.available_rollout_metric_names]),V=T.useMemo(()=>{var pe;return((pe=W==null?void 0:W.step_metrics_info)==null?void 0:pe.custom_metric_sections)??{}},[(fe=W==null?void 0:W.step_metrics_info)==null?void 0:fe.custom_metric_sections]),G=T.useMemo(()=>{var pe;return((pe=W==null?void 0:W.eval_info)==null?void 0:pe.evals)??[]},[(we=W==null?void 0:W.eval_info)==null?void 0:we.evals]),Z=T.useRef(!1);T.useEffect(()=>{if(R||Z.current)return;if(c.length>0){Z.current=!0;return}if(!W)return;Z.current=!0;const pe=["reward_sum_mean","reward_sum_distribution_over_time","advantage_distribution_over_time","length_completion_mean","length_completion_std","length_completion_min","length_completion_max","length_completion_distribution_over_time",...F.flatMap(xe=>[`reward_${xe}_mean`,`reward_${xe}_distribution_over_time`]),...s?["discarded_count","discarded_zero_advantage_pct","discarded_max_async_pct","discarded_zero_advantage_all_zero_pct","discarded_zero_advantage_all_positive_pct"]:[]];d(pe)},[W,F,R]);const B=T.useRef(new Set);T.useEffect(()=>{if(R||F.length===0)return;const pe=[];for(const xe of F){if(!B.current.has(xe)){const Ve=`reward_${xe}_mean`,ye=`reward_${xe}_distribution_over_time`;c.includes(Ve)||pe.push(Ve),c.includes(ye)||pe.push(ye)}B.current.add(xe)}pe.length>0&&d(xe=>[...xe,...pe])},[F,R]);const q=T.useRef("");T.useEffect(()=>{if(!R||!a)return;const pe=`${a.prefix}|${a.rewardNames.join(",")}`;if(pe===q.current)return;q.current=pe;const xe=a.prefix,Ve=[`${xe}length_completion_mean`,`${xe}length_completion_std`,`${xe}length_completion_min`,`${xe}length_completion_max`,`${xe}length_completion_distribution_over_time`,...a.rewardNames.flatMap(ye=>[`${xe}reward_${ye}_mean`,`${xe}reward_${ye}_distribution_over_time`])];d(Ve)},[a,R,d]);const K=T.useMemo(()=>{const pe=(O==null?void 0:O.runs)||[],xe=new Set(D);return N&&xe.add(N),pe.filter(Ve=>xe.has(Ve.run_id)).map(Ve=>({runPath:Ve.run_id,runName:Ve.name,color:Ve.color,isSelected:Ve.run_id===N}))},[N,D,O==null?void 0:O.runs]),Y=T.useMemo(()=>WAe(F,V,G),[F,V,G]),Q=T.useMemo(()=>qAe(Y),[Y]),U=T.useMemo(()=>{const pe=new Set(Y.map(xe=>xe.metricKey));return c.filter(xe=>pe.has(xe))},[c,Y]),j=T.useMemo(()=>XAe(Y),[Y]),X=T.useMemo(()=>U.map(pe=>{const xe=Y.find(Ve=>Ve.metricKey===pe);return{id:pe,metricKey:pe,label:(xe==null?void 0:xe.label)||pe,plotType:xe!=null&&xe.isHistogram?"histogram":xe!=null&&xe.isDistributionOverTime?"distribution_over_time":xe!=null&&xe.isEvalMetric?"eval_metric":"step_metric"}}),[U,Y]),H=pe=>{pe&&d(xe=>xe.includes(pe)?xe.filter(Ve=>Ve!==pe):[...xe,pe])},ie=pe=>{d(xe=>xe.filter(Ve=>Ve!==pe))},ne=pe=>Y.find(xe=>xe.metricKey===pe),[re,ue]=T.useState(null),le=T.useCallback(pe=>{if(!pe||!o){ue(null);return}const xe=pe.querySelector('[data-slot="scroll-area-viewport"]');xe&&ue(xe)},[o]);return!N||!o?null:p.jsxs("div",{className:"w-[320px] border-l border-border bg-card/50 backdrop-blur flex flex-col h-full min-h-0",children:[p.jsxs("div",{className:"px-4 py-2.5 border-b border-border flex items-center justify-between shrink-0",children:[p.jsx("h2",{className:"font-semibold text-sm",children:R?"Eval Metrics":"Training Metrics"}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l(!1),children:p.jsx(Kle,{className:"h-4 w-4"})})]}),p.jsx("div",{className:"px-4 py-2 border-b border-border shrink-0",children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Q1,{catalog:j,onSelect:pe=>H(pe.metricKey),existingPlots:X,children:p.jsxs("button",{type:"button",className:Rt("flex flex-1 items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs transition-colors select-none min-h-[28px]","border-input bg-transparent hover:bg-accent/50",U.length>0?"text-foreground":"text-muted-foreground"),children:[p.jsx("span",{className:"font-medium",children:"Charts"}),U.length>0&&p.jsx("span",{className:"text-[10px] bg-accent text-accent-foreground rounded px-1.5 py-0 font-medium",children:U.length}),p.jsx(Vr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 ml-auto"})]})}),p.jsx(dS,{label:"EMA",variant:"selecting",size:"sm",enabled:b,onEnabledChange:_,value:E,onValueChange:A,onValueCommit:pe=>{const xe=parseInt(pe,10);!isNaN(xe)&&xe>=2&&xe<=100?(S(xe),A(xe.toString())):A(w.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"})]})}),p.jsx(_v,{ref:le,className:"flex-1 min-h-0",children:p.jsxs("div",{className:"p-4 space-y-4",children:[R&&p.jsxs("div",{className:"flex items-center gap-1 mb-3",children:[p.jsx(Tn,{variant:h?"outline":"default",size:"sm",className:"h-6 px-2.5 text-xs",onClick:()=>g(!1),children:"All"}),p.jsx(Tn,{variant:h?"default":"outline",size:"sm",className:"h-6 px-2.5 text-xs",onClick:()=>g(!0),disabled:(a==null?void 0:a.selectedSampleIdx)==null,children:"Selected"})]}),U.length===0?p.jsx("div",{className:"h-32 flex items-center justify-center text-muted-foreground text-sm text-center px-4",children:"Click on a metric above to add charts"}):Object.entries(Q).map(([pe,{label:xe,metrics:Ve}])=>{const ye=Ve.filter(Oe=>U.includes(Oe.metricKey)).map(Oe=>Oe.metricKey);return ye.length===0?null:p.jsxs("div",{className:"space-y-3",children:[p.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:xe}),p.jsx("div",{className:"space-y-4",children:ye.map(Oe=>{const he=ne(Oe);if(v&&(he!=null&&he.isHistogram||he!=null&&he.isDistributionOverTime||he!=null&&he.suffix&&he.suffix!=="mean"&&he.suffix!==""))return null;const Re=R&&v?`/s/${a.selectedSampleIdx}/`:"/",Ue=R&&Oe.startsWith("eval/")?Oe.replace(/^(eval\/[^/]+)\//,`$1${Re}`):Oe,Ee=(he==null?void 0:he.histogramMetricType)||"",Pe=R&&Ee.startsWith("eval/")?Ee.replace(/^(eval\/[^/]+)\//,`$1${Re}`):Ee,Ze=v&&(he==null?void 0:he.suffix)==="mean"?(he.label||Oe).replace(/ - Mean$/,""):(he==null?void 0:he.label)||Oe;return he!=null&&he.isHistogram?p.jsx(QAe,{runPath:N,step:t,metricType:Pe,label:Ze,showZeroLine:he==null?void 0:he.showZeroLine,unit:he==null?void 0:he.unit,isTokenMetric:(he==null?void 0:he.category)==="tokens",onRemove:()=>ie(Oe),scrollRoot:re},Pe):he!=null&&he.isDistributionOverTime?p.jsx(e6e,{runPath:N,metricType:Pe,label:Ze,showZeroLine:he==null?void 0:he.showZeroLine,unit:he==null?void 0:he.unit,isTokenMetric:(he==null?void 0:he.category)==="tokens",currentStep:t,shouldPoll:L,onRemove:()=>ie(Oe),selectedStepAtom:i,maxSelectableStep:e,scrollRoot:re},Pe):p.jsx(KAe,{runs:K,shouldPoll:L,metricKey:Ue,label:Ze,showZeroLine:he==null?void 0:he.showZeroLine,unit:he==null?void 0:he.unit,isTokenMetric:(he==null?void 0:he.category)==="tokens",showEma:b,emaSpan:w,currentStep:t,onRemove:()=>ie(Oe),hoveredRunId:P,selectedStepAtom:i,maxSelectableStep:e,scrollRoot:re},Oe)})})]},pe)})]})})]})}function YAe(t){const e=t.match(/^eval\/([^/]+)\/s\/(\d+)\/(.+)$/);if(e)return{isEval:!0,evalName:e[1],rawMetricName:e[3],sampleIdx:parseInt(e[2],10)};const n=t.match(/^eval\/([^/]+)\/(.+)$/);return n?{isEval:!0,evalName:n[1],rawMetricName:n[2]}:{isEval:!1,evalName:"",rawMetricName:t}}function If(t,e,n,r){const{isEval:i,evalName:s,rawMetricName:a,sampleIdx:o}=YAe(e),l=PG(t,e,n&&!i,r),c=_ue(t,s,a,n&&i,r,o);return i?c:l}function KAe({runs:t,shouldPoll:e,metricKey:n,label:r,showZeroLine:i,unit:s,isTokenMetric:a,showEma:o=!1,emaSpan:l=10,currentStep:c,onRemove:d,hoveredRunId:h=null,selectedStepAtom:g=uT,maxSelectableStep:v,scrollRoot:b=null}){var Ve,ye,Oe,he,Re,oe,Ue,Ee,Pe,Ze;const _=zd(g),w=T.useRef(null),S=T.useRef(null),E=T.useRef(null),A=T.useRef(null),N=T.useRef(null),D=F9(w,{root:b,threshold:0}),P=If(((Ve=t[0])==null?void 0:Ve.runPath)||"",n,D&&!!t[0],e),L=If(((ye=t[1])==null?void 0:ye.runPath)||"",n,D&&!!t[1],e),R=If(((Oe=t[2])==null?void 0:Oe.runPath)||"",n,D&&!!t[2],e),O=If(((he=t[3])==null?void 0:he.runPath)||"",n,D&&!!t[3],e),W=If(((Re=t[4])==null?void 0:Re.runPath)||"",n,D&&!!t[4],e),F=If(((oe=t[5])==null?void 0:oe.runPath)||"",n,D&&!!t[5],e),V=If(((Ue=t[6])==null?void 0:Ue.runPath)||"",n,D&&!!t[6],e),G=If(((Ee=t[7])==null?void 0:Ee.runPath)||"",n,D&&!!t[7],e),Z=If(((Pe=t[8])==null?void 0:Pe.runPath)||"",n,D&&!!t[8],e),B=If(((Ze=t[9])==null?void 0:Ze.runPath)||"",n,D&&!!t[9],e),q=T.useMemo(()=>{const ae=t.filter(be=>!be.isSelected),te=t.filter(be=>be.isSelected);return[...ae,...te]},[t]),K=T.useMemo(()=>q.slice(0,10),[q]),Y=T.useMemo(()=>{const ae=new Map;return K.forEach((te,be)=>{ae.set(te.runPath,be)}),ae},[K]),{uplotData:Q,seriesConfig:U,isFetching:j,isRefetching:X,isPlaceholderData:H,hasData:ie,minStep:ne,maxStep:re}=T.useMemo(()=>{const ae=[P,L,R,O,W,F,V,G,Z,B],te=new Map;t.forEach((Be,qe)=>{qe<10&&te.set(Be.runPath,ae[qe])});const be=new Set,me=new Map;let ge=!1,ke=!1,Xe=!1;if(q.forEach((Be,qe)=>{var Le;if(qe>=10)return;const Se=te.get(Be.runPath);if(!Se)return;Se.isFetching&&(ge=!0),Se.isRefetching&&(ke=!0),Se.isPlaceholderData&&(Xe=!0);const Ye=((Le=Se.data)==null?void 0:Le.metrics)||[],dt=new Map;Ye.forEach(st=>{be.add(st.step),dt.set(st.step,st.value)}),me.set(qe,dt)}),be.size===0)return{uplotData:null,seriesConfig:[],isFetching:ge,isRefetching:ke,isPlaceholderData:Xe,hasData:!1,minStep:0,maxStep:0};const Ae=Array.from(be).sort((Be,qe)=>Be-qe),je=new Float64Array(Ae),We=[{label:"Step"}],De=[je];return q.forEach((Be,qe)=>{if(qe>=10)return;const Se=me.get(qe)||new Map,Ye=Ae.map(ft=>Se.get(ft)??null),dt=h===Be.runPath,Le=h!==null;let st;Le&&!dt?st=.1:st=o?.3:1,De.push(Ye),We.push({label:ov(Be),stroke:Be.color,width:1,alpha:st,spanGaps:!0,points:{show:!1}})}),o&&q.forEach((Be,qe)=>{if(qe>=10)return;const Se=me.get(qe)||new Map,Ye=2/(l+1);let dt=null;const Le=[];Ae.forEach(tt=>{const Qe=Se.get(tt);Qe!==void 0?(dt===null?dt=Qe:dt=Ye*Qe+(1-Ye)*dt,Le.push(dt)):Le.push(null)});const st=h===Be.runPath,ft=h!==null;let mt;ft&&!st?mt=.1:mt=1,De.push(Le),We.push({label:`${ov(Be)} (EMA)`,stroke:Be.color,width:1.5,alpha:mt,spanGaps:!0,points:{show:!1}})}),{uplotData:De,seriesConfig:We,isFetching:ge,isRefetching:ke,isPlaceholderData:Xe,hasData:!0,minStep:Ae[0],maxStep:Ae[Ae.length-1]}},[t,q,P,L,R,O,W,F,V,G,Z,B,o,l,h]),ue=n.split("_").pop()||"",le=T.useCallback(ae=>ae==null?"N/A":a&&(ue==="min"||ue==="max")?Math.round(ae).toLocaleString():qu(ae),[a,ue]),fe=T.useCallback(ae=>Math.abs(ae)>=1e3?`${parseFloat((ae/1e3).toFixed(1))}k`:a?ue==="min"||ue==="max"?Math.round(ae).toString():String(parseFloat(ae.toFixed(1))):Number.isInteger(ae)?ae.toLocaleString():Math.abs(ae)<.01&&ae!==0?ae.toExponential(1):String(parseFloat(ae.toFixed(2))),[a,ue]),we=T.useCallback(ae=>ae>=1e3?`${(ae/1e3).toFixed(0)}k`:ae.toString(),[]);T.useEffect(()=>{if(!S.current||!Q||!ie)return;const ae=S.current,te=ae.clientWidth,be=160;let me=1/0,ge=-1/0;for(let mt=1;mt<Q.length;mt++){const tt=Q[mt];for(let Qe=0;Qe<tt.length;Qe++){const ze=tt[Qe];ze!=null&&(ze<me&&(me=ze),ze>ge&&(ge=ze))}}const ke=ge-me,Xe=Math.max(Math.abs(ge),Math.abs(me)),Ae=Math.max(Xe*.05,1e-10),je=Math.max(ke*.1,Ae);let We,De;i?(We=Math.min(me-je,0),De=Math.max(ge+je,0)):(We=me-je,De=ge+je);const Be="rgba(128, 128, 128, 0.15)",qe="rgba(100, 100, 100, 0.9)",Se=(mt,tt)=>{if(!tt||tt.length===0)return 36;const Qe=Math.max(...tt.map(ze=>ze.length));return Math.max(36,Qe*6+12)},Ye=c!=null&&Number.isFinite(ne)&&Number.isFinite(re)&&c>=ne&&c<=re,dt={width:te,height:be,padding:[4,4,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[We,De]}},axes:[{stroke:qe,grid:{stroke:Be,width:1},ticks:{stroke:Be,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(mt,tt)=>tt.map(we)},{stroke:qe,grid:{stroke:Be,width:1},ticks:{stroke:Be,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:Se,values:(mt,tt)=>tt.map(fe)}],series:U,hooks:{draw:[mt=>{if(Ye&&c!=null){const tt=mt.ctx,Qe=mt.valToPos(c,"x",!0),ze=mt.valToPos(De,"y",!0),Te=mt.valToPos(We,"y",!0);tt.save(),tt.strokeStyle="rgba(128, 128, 128, 0.25)",tt.lineWidth=2,tt.beginPath(),tt.moveTo(Qe,ze),tt.lineTo(Qe,Te),tt.stroke(),tt.restore()}if(i&&We<0&&De>0){const tt=mt.ctx,Qe=mt.valToPos(0,"y",!0),ze=mt.valToPos(mt.scales.x.min,"x",!0),Te=mt.valToPos(mt.scales.x.max,"x",!0);tt.save(),tt.strokeStyle="rgba(128, 128, 128, 0.5)",tt.lineWidth=1,tt.setLineDash([5,5]),tt.beginPath(),tt.moveTo(ze,Qe),tt.lineTo(Te,Qe),tt.stroke(),tt.restore()}}],setCursor:[mt=>{if(!A.current)return;const{left:tt,idx:Qe}=mt.cursor;if(N.current=Qe??null,Qe==null||tt===void 0||tt<0){A.current.style.display="none";return}const ze=Q[0][Qe];if(ze===void 0){A.current.style.display="none";return}let Te=`<div class="font-medium mb-1">Step ${Number(ze).toLocaleString()}</div>`;const He=K.length;t.forEach(wt=>{var Ot,Gt;const Pt=Y.get(wt.runPath);if(Pt===void 0)return;const $e=Pt+1,Tt=(Ot=Q[$e])==null?void 0:Ot[Qe];let Et;if(o){const an=He+Pt+1;Et=(Gt=Q[an])==null?void 0:Gt[Qe]}Tt!=null&&(Te+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${wt.color}"></div>
                    <span>${X8(wt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${o?.7:1}">${le(Tt)}${s?` ${s}`:""}</span>
                    ${o&&Et!==void 0&&Et!==null?`<span class="text-muted-foreground">(EMA: ${le(Et)})</span>`:""}
                  </div>
                </div>
              `)}),A.current.innerHTML=Te,A.current.style.display="block",A.current.style.left="0px",A.current.style.top="0px";const et=A.current.getBoundingClientRect(),ht=S.current.getBoundingClientRect();let ct=ht.left+tt+15;ct+et.width+20>window.innerWidth&&(ct=ht.left+tt-et.width-15+mt.bbox.left),ct=Math.max(4,ct);let bt=ht.top-et.height+20;bt<4&&(bt=ht.bottom-20),A.current.style.left=`${ct-et.left}px`,A.current.style.top=`${bt-et.top}px`}]}};E.current&&E.current.destroy();const Le=new ma(dt,Q,ae);E.current=Le;const st=()=>{const mt=N.current;if(mt!=null){let tt=Q[0][mt];tt!==void 0&&!isNaN(tt)&&(v!=null&&tt>v&&(tt=v),_(tt))}};ae.addEventListener("click",st);const ft=new ResizeObserver(mt=>{for(const tt of mt){const{width:Qe}=tt.contentRect;Le&&Qe>0&&Le.setSize({width:Qe,height:be})}});return ft.observe(ae),()=>{ae.removeEventListener("click",st),ft.disconnect(),Le.destroy(),E.current=null}},[Q,U,ie,i,fe,we,le,q,o,s,c,ne,re,_,v,t,K,Y]);const pe=T.useCallback(()=>{A.current&&(A.current.style.display="none")},[]),xe=j&&(!X||H);return p.jsxs("div",{ref:w,className:Rt("group/card rounded-lg border border-gray-200 p-3 transition-opacity","bg-white",xe&&"opacity-50"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-2",children:[p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:r})}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("button",{onClick:d,className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 transition-opacity",children:p.jsx(Ju,{className:"h-3.5 w-3.5"})})})]}),ie?p.jsxs("div",{className:"h-40 cursor-pointer relative bg-white rounded",ref:S,onMouseLeave:pe,children:[p.jsx("div",{ref:A,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),X&&!H&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground text-xs rounded",children:j?"Loading...":"No data"})]})}function ZAe(t,e=20){if(t.length===0)return{binEdges:[],counts:[]};const n=Math.min(...t),r=Math.max(...t);if(n===r)return{binEdges:[n-.5,n+.5],counts:[t.length]};const i=(r-n)/e,s=[],a=new Array(e).fill(0);for(let o=0;o<=e;o++)s.push(n+o*i);for(const o of t){let l=Math.floor((o-n)/i);l>=e&&(l=e-1),a[l]++}return{binEdges:s,counts:a}}function QAe({runPath:t,step:e,metricType:n,label:r,showZeroLine:i,isTokenMetric:s,onRemove:a,scrollRoot:o=null}){const l=T.useRef(null),c=T.useRef(null),d=T.useRef(null),h=T.useRef(null),g=F9(l,{root:o,threshold:0}),{data:v,isFetching:b,isRefetching:_,isPlaceholderData:w}=wue(t,e??null,n,g&&!!t&&e!==null&&e!==void 0&&!!n),{histogramData:S,hasData:E}=T.useMemo(()=>{const P=(v==null?void 0:v.values)??[];if(P.length===0)return{histogramData:null,hasData:!1};const{binEdges:L,counts:R}=ZAe(P,25),O=L.slice(0,-1).map((W,F)=>(W+L[F+1])/2);return{histogramData:{binEdges:L,binCenters:O,counts:R,totalCount:P.length,min:Math.min(...P),max:Math.max(...P),mean:P.reduce((W,F)=>W+F,0)/P.length},hasData:!0}},[v==null?void 0:v.values]),A=T.useCallback(P=>P==null?"N/A":s?Math.round(P).toLocaleString():qu(P),[s]);T.useEffect(()=>{if(!c.current||!S||!E)return;const P=c.current,L=P.clientWidth,R=160,O=new Float64Array(S.binCenters),W=new Float64Array(S.counts),F=[O,W],G=Math.max(...S.counts)*1.1,Z="rgba(128, 128, 128, 0.15)",B="rgba(100, 100, 100, 0.9)",q="rgba(59, 130, 246, 0.7)",K=S.binEdges[1]-S.binEdges[0],Q={width:L,height:R,padding:[4,4,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[0,G]}},axes:[{stroke:B,grid:{stroke:Z,width:1},ticks:{stroke:Z,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(X,H)=>H.map(ie=>Math.abs(ie)>=1e3?`${parseFloat((ie/1e3).toFixed(1))}k`:Math.abs(ie)<.01&&ie!==0?ie.toExponential(1):String(parseFloat(ie.toFixed(2))))},{stroke:B,grid:{stroke:Z,width:1},ticks:{stroke:Z,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(X,H)=>{if(!H||H.length===0)return 36;const ie=Math.max(...H.map(ne=>ne.length));return Math.max(36,ie*6+12)},values:(X,H)=>H.map(ie=>ie>=1e3?`${(ie/1e3).toFixed(0)}k`:Math.round(ie).toString())}],series:[{label:"Value"},{label:"Count",stroke:q,fill:q,width:0,paths:(X,H)=>{const ie=new Path2D,{data:ne}=X,re=ne[0],ue=ne[H];for(let le=0;le<re.length;le++){const fe=re[le],we=ue[le];if(we==null||we===0)continue;const pe=X.valToPos(fe-K/2,"x",!0),xe=X.valToPos(fe+K/2,"x",!0),Ve=X.valToPos(0,"y",!0),ye=X.valToPos(we,"y",!0),Oe=Math.max(1,xe-pe-1);ie.rect(pe+.5,ye,Oe,Ve-ye)}return{stroke:ie,fill:ie}}}],hooks:{draw:[X=>{if(i&&S.min<0&&S.max>0){const H=X.ctx,ie=X.valToPos(0,"x",!0),ne=X.valToPos(0,"y",!0),re=X.valToPos(G,"y",!0);H.save(),H.strokeStyle="rgba(128, 128, 128, 0.5)",H.lineWidth=1,H.setLineDash([5,5]),H.beginPath(),H.moveTo(ie,ne),H.lineTo(ie,re),H.stroke(),H.restore()}}],setCursor:[X=>{if(!h.current)return;const{left:H,idx:ie}=X.cursor;if(ie==null||H===void 0||H<0){h.current.style.display="none";return}const ne=S.binCenters[ie],re=S.counts[ie],ue=S.binEdges[ie],le=S.binEdges[ie+1];if(ne===void 0||re===void 0){h.current.style.display="none";return}const fe=(re/S.totalCount*100).toFixed(1);h.current.innerHTML=`
              <div class="font-medium mb-1">Range: ${A(ue)} - ${A(le)}</div>
              <div class="text-muted-foreground">Count: ${re.toLocaleString()} (${fe}%)</div>
            `,h.current.style.display="block",h.current.style.left="0px",h.current.style.top="0px";const we=h.current.getBoundingClientRect(),pe=c.current.getBoundingClientRect();let xe=pe.left+H+15;xe+we.width+20>window.innerWidth&&(xe=pe.left+H-we.width-15+X.bbox.left),xe=Math.max(4,xe);let Ve=pe.top-we.height+20;Ve<4&&(Ve=pe.bottom-20),h.current.style.left=`${xe-we.left}px`,h.current.style.top=`${Ve-we.top}px`}]}};d.current&&d.current.destroy();const U=new ma(Q,F,P);d.current=U;const j=new ResizeObserver(X=>{for(const H of X){const{width:ie}=H.contentRect;U&&ie>0&&U.setSize({width:ie,height:R})}});return j.observe(P),()=>{j.disconnect(),U.destroy(),d.current=null}},[S,E,i,A]);const N=T.useCallback(()=>{h.current&&(h.current.style.display="none")},[]),D=b&&(!_||w);return p.jsxs("div",{ref:l,className:Rt("group/card rounded-lg border border-gray-200 p-3 transition-opacity","bg-white",D&&"opacity-50"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-2",children:[p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:r})}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("button",{onClick:a,className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 transition-opacity",children:p.jsx(Ju,{className:"h-3.5 w-3.5"})})})]}),E?p.jsxs("div",{className:"h-40 relative bg-white rounded",ref:c,onMouseLeave:N,children:[p.jsx("div",{ref:h,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),_&&!w&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground text-xs rounded",children:b?"Loading...":e==null?"Select a step to view histogram":"No data"})]})}const C5=100;function JAe(t,e,n){const r=t.length;if(r<=C5)return{steps:t,counts:e};const i=Math.ceil(r/C5),s=[],a=[],o=n.length-1;for(let l=0;l<r;l+=i){const c=Math.min(l+i,r),d=Math.floor((l+c-1)/2);s.push(t[d]);const h=new Array(o).fill(0);for(let g=l;g<c;g++){const v=e[g];for(let b=0;b<o;b++)h[b]+=v[b]||0}a.push(h)}return{steps:s,counts:a}}function e6e({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,currentStep:s,shouldPoll:a,onRemove:o,selectedStepAtom:l=uT,maxSelectableStep:c,scrollRoot:d=null}){const h=T.useRef(null),g=T.useRef(null),v=T.useRef(null),b=T.useRef(null),_=T.useRef(null),w=zd(l),S=F9(h,{root:d,threshold:0}),{data:E,isFetching:A,isRefetching:N,isPlaceholderData:D}=IG(t,e,S&&!!t&&!!e,a),P=E&&E.steps.length>0&&E.bin_edges.length>0,L=P&&E.steps.length>C5,R=T.useMemo(()=>!P||!E?null:L?JAe(E.steps,E.counts,E.bin_edges):{steps:E.steps,counts:E.counts},[P,E,L]),O=T.useCallback(q=>q==null?"N/A":i?Math.round(q).toLocaleString():qu(q),[i]),W=T.useCallback(q=>Math.abs(q)>=1e3?`${parseFloat((q/1e3).toFixed(1))}k`:i?Math.round(q).toString():Number.isInteger(q)?q.toLocaleString():Math.abs(q)<.01&&q!==0?q.toExponential(1):String(parseFloat(q.toFixed(2))),[i]),F=T.useCallback(()=>{const q={top:8,right:8,bottom:24,left:40};if(!v.current||!E)return q;const K=v.current.getContext("2d");if(!K)return q;const Y="10px system-ui, sans-serif",Q=5;let U=0;K.save(),K.setTransform(1,0,0,1,0,0),K.font=Y;for(let j=0;j<Q;j++){const X=(E.global_min??0)+j/(Q-1)*((E.global_max??0)-(E.global_min??0)),H=W(X);U=Math.max(U,K.measureText(H).width)}return K.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(U)+12)}},[E,W]);T.useEffect(()=>{if(!g.current||!v.current||!P||!E||!R)return;const q=g.current,K=v.current,Y=K.getContext("2d");if(!Y)return;const Q=q.clientWidth,U=160,j="rgba(100, 100, 100, 0.9)",X="rgba(128, 128, 128, 0.15)",H="10px system-ui, sans-serif",ie=window.devicePixelRatio||1;K.width=Q*ie,K.height=U*ie,K.style.width=`${Q}px`,K.style.height=`${U}px`,Y.scale(ie,ie),Y.font=H,Y.clearRect(0,0,Q,U);const ne=F(),re=Q-ne.left-ne.right,ue=U-ne.top-ne.bottom,le=R.steps,fe=E.bin_edges,we=R.counts,pe=le.length,xe=fe.length-1;if(pe===0||xe===0)return;let Ve=0;for(const Pe of we)for(const Ze of Pe)Ze>Ve&&(Ve=Ze);const ye=Math.min(5,pe),Oe=5,he=re/Math.max(pe,1),Re=Pe=>ne.left+(Pe+.5)*he,oe=Pe=>{const Ze=(E.global_max??1)-(E.global_min??0),ae=(Pe-(E.global_min??0))/(Ze||1);return ne.top+ue-ae*ue},Ue=Pe=>Pe===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(Pe/Ve)*.75})`;Y.strokeStyle=X,Y.lineWidth=1;for(let Pe=0;Pe<ye;Pe++){const Ze=Math.floor(Pe/Math.max(ye-1,1)*(pe-1)),ae=Re(Ze);Y.beginPath(),Y.moveTo(ae,ne.top),Y.lineTo(ae,U-ne.bottom),Y.stroke()}for(let Pe=0;Pe<Oe;Pe++){const Ze=(E.global_min??0)+Pe/(Oe-1)*((E.global_max??0)-(E.global_min??0)),ae=oe(Ze);Y.beginPath(),Y.moveTo(ne.left,ae),Y.lineTo(Q-ne.right,ae),Y.stroke()}const Ee=he;for(let Pe=0;Pe<pe;Pe++){const Ze=ne.left+Pe*he,ae=we[Pe];for(let te=0;te<xe;te++){const be=ae[te];if(be===0)continue;const me=fe[te+1],ge=fe[te],ke=oe(me),Xe=oe(ge),Ae=Math.max(1,Xe-ke);Y.fillStyle=Ue(be),Y.fillRect(Ze,ke,Ee,Ae)}}if(r&&(E.global_min??0)<0&&(E.global_max??0)>0){const Pe=oe(0);Y.strokeStyle="rgba(128, 128, 128, 0.5)",Y.lineWidth=1,Y.setLineDash([5,5]),Y.beginPath(),Y.moveTo(ne.left,Pe),Y.lineTo(Q-ne.right,Pe),Y.stroke(),Y.setLineDash([])}if(s!=null){let Pe=-1,Ze=1/0;for(let ae=0;ae<le.length;ae++){const te=Math.abs(le[ae]-s);te<Ze&&(Ze=te,Pe=ae)}if(Pe>=0){const ae=Re(Pe);Y.strokeStyle="rgba(128, 128, 128, 0.25)",Y.lineWidth=1,Y.beginPath(),Y.moveTo(ae,ne.top),Y.lineTo(ae,U-ne.bottom),Y.stroke()}}Y.strokeStyle=j,Y.lineWidth=1,Y.beginPath(),Y.moveTo(ne.left,U-ne.bottom),Y.lineTo(Q-ne.right,U-ne.bottom),Y.stroke(),Y.beginPath(),Y.moveTo(ne.left,ne.top),Y.lineTo(ne.left,U-ne.bottom),Y.stroke(),Y.fillStyle=j,Y.font=H,Y.textAlign="center";for(let Pe=0;Pe<ye;Pe++){const Ze=Math.floor(Pe/Math.max(ye-1,1)*(pe-1)),ae=le[Ze],te=Re(Ze),be=ae>=1e3?`${(ae/1e3).toFixed(0)}k`:ae.toString();Y.fillText(be,te,U-6)}Y.textAlign="right",Y.textBaseline="middle";for(let Pe=0;Pe<Oe;Pe++){const Ze=(E.global_min??0)+Pe/(Oe-1)*((E.global_max??0)-(E.global_min??0)),ae=oe(Ze);Y.fillText(W(Ze),ne.left-4,ae)}},[E,R,P,r,s,W,F]),T.useEffect(()=>{if(!g.current)return;const q=g.current,K=new ResizeObserver(()=>{if(v.current&&g.current){const Y=g.current.clientWidth;v.current.style.width=`${Y}px`}});return K.observe(q),()=>{K.disconnect()}},[]);const V=T.useCallback(q=>{if(!E||!R||!v.current||!g.current)return;const K=v.current.getBoundingClientRect(),Y=q.clientX-K.left,Q=g.current.clientWidth,U=F(),j=Q-U.left-U.right;if(j<=0)return;const X=(Y-U.left)/j,H=Math.round(X*(R.steps.length-1));if(H>=0&&H<R.steps.length){let ie=R.steps[H];c!=null&&ie>c&&(ie=c),w(ie)}},[E,R,F,w,c]),G=T.useCallback(q=>{var be;if(!E||!R||!b.current||!v.current||!g.current)return;const K=v.current.getBoundingClientRect(),Y=q.clientX-K.left,Q=q.clientY-K.top,U=g.current.clientWidth,j=160,X=F(),H=U-X.left-X.right,ie=j-X.top-X.bottom;if(H<=0||ie<=0){_.current&&(_.current.style.display="none");return}if(Y<X.left||Y>U-X.right||Q<X.top||Q>j-X.bottom){b.current.style.display="none",_.current&&(_.current.style.display="none");return}const ne=(Y-X.left)/H,re=Math.min(R.steps.length-1,Math.max(0,Math.round(ne*(R.steps.length-1)))),ue=R.steps[re];if(_.current){const me=H/Math.max(R.steps.length,1),ge=X.left+(re+.5)*me;_.current.style.display="block",_.current.style.left=`${ge}px`,_.current.style.top=`${X.top}px`,_.current.style.bottom=`${X.bottom}px`}const le=1-(Q-X.top)/ie,fe=E.bin_edges.length-1,we=Math.min(fe-1,Math.max(0,Math.floor(le*fe))),pe=E.bin_edges[we],xe=E.bin_edges[we+1],Ve=((be=R.counts[re])==null?void 0:be[we])??0,Oe=(R.counts[re]??[]).reduce((me,ge)=>me+ge,0),he=Oe>0?(Ve/Oe*100).toFixed(1):"0.0",oe=L&&E.steps.length>C5?" (aggregated)":"";b.current.innerHTML=`
        <div class="font-medium mb-1">Step ${ue.toLocaleString()}${oe}</div>
        <div class="text-muted-foreground">Range: ${O(pe)} to ${O(xe)}</div>
        <div class="text-muted-foreground">Count: ${Ve.toLocaleString()} (${he}%)</div>
      `,b.current.style.display="block",b.current.style.left="0px",b.current.style.top="0px";const Ue=b.current.getBoundingClientRect(),Ee=q.clientX;let Pe=Ee;Pe+Ue.width+20>window.innerWidth&&(Pe=Ee-Ue.width);const Ze=Math.max(4,window.innerWidth-Ue.width-4);Pe=Math.min(Math.max(4,Pe),Ze);const ae=g.current.getBoundingClientRect();let te=ae.top-Ue.height+20;te<4&&(te=ae.bottom-20),b.current.style.left=`${Pe-Ue.left}px`,b.current.style.top=`${te-Ue.top}px`},[E,R,O,F,L]),Z=T.useCallback(()=>{b.current&&(b.current.style.display="none"),_.current&&(_.current.style.display="none")},[]),B=A&&(!N||D);return p.jsxs("div",{ref:h,className:Rt("group/card rounded-lg border border-gray-200 p-3 transition-opacity","bg-white",B&&"opacity-50"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-2",children:[p.jsx("div",{className:"flex-1 min-w-0",children:p.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:n,children:n})}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsx("button",{onClick:o,className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 transition-opacity",children:p.jsx(Ju,{className:"h-3.5 w-3.5"})})})]}),P?p.jsxs("div",{className:"h-40 relative bg-white rounded",ref:g,children:[p.jsx("canvas",{className:"block w-full h-full max-w-full cursor-pointer",ref:v,onClick:V,onMouseMove:G,onMouseLeave:Z}),p.jsx("div",{ref:_,className:"absolute z-[2] border-l border-dashed border-gray-500/70 pointer-events-none",style:{display:"none"}}),p.jsx("div",{ref:b,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),N&&!D&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"})]}):p.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground text-xs rounded",children:A?"Loading...":"No data"})]})}function OS(t,e=60){if(!t)return"";const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"..."}function t6e(t){return t===null||Number.isNaN(t)?null:`hsl(${Math.max(0,Math.min(1,t))*120} 70% 38%)`}function G6(t,e,n,r){if(e==null||n==null||e>=n)return;let i=Math.max(0,Math.min(1,(t-e)/(n-e)));return r&&(i=1-i),`hsl(${(i*120).toFixed(0)} 80% 38%)`}function fF(t){if(t==null)return null;const e=typeof t=="object"&&t!==null&&"value"in t?t.value:t;if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=Number(e);if(Number.isFinite(n))return n}return null}function W6(t,e,n=85){if(t===null||e===null||e<=0)return null;const r=Math.max(0,Math.min(e,t));return`hsl(0 0% ${n-r/e*(n-5)}%)`}function H9({openAtom:t=y8}={}){const[e,n]=cn(t);return!ki(ml)||e?null:p.jsx(Tn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Samples"})}const hF=["gen_length","gen_length_sum","gen_length_avg","reward","advantage"];function V9({prompts:t,data:e,samplesData:n,rolloutMetrics:r,availableMetricNames:i,isLoading:s,step:a,currentStepIndex:o,totalSteps:l,onStepChange:c,hasSteps:d,stepValues:h,openAtom:g=y8,selectedGroupIdAtom:v=wG,selectedSampleIdxAtom:b=MG,viewModeAtom:_=EG,getGroupBadge:w,renderLeftControls:S,onGroupClick:E,hideRewardAdvantage:A=!1,envDetailsOverride:N}){var Ye,dt,Le,st,ft,mt,tt,Qe,ze;const[D,P]=cn(g),[L,R]=cn(v),[O,W]=cn(b),[F,V]=cn(_),[G,Z]=cn(Bce),[B,q]=cn(Hce),K=ki(ml),{data:Y}=ed(K||"",!!K,!0),Q=(Ye=Y==null?void 0:Y.config)==null?void 0:Ye.max_tokens,U=T.useMemo(()=>fF(Q),[Q]),j=(dt=Y==null?void 0:Y.config)==null?void 0:dt.group_size,X=T.useMemo(()=>fF(j),[j]),H=T.useMemo(()=>{if(X==null||X<=1)return null;const Te=Math.sqrt(X-1);return{min:-Te,max:Te}},[X]),ie=N??((Le=Y==null?void 0:Y.config)==null?void 0:Le.environments),ne=T.useMemo(()=>gw(ie),[ie]),re=T.useMemo(()=>{var ht;const Te=pp(ie),He=pp((ht=Y==null?void 0:Y.summary)==null?void 0:ht.env_details),et=vw(Y==null?void 0:Y.data_metric_ranges);return mp(mp(Te,He),et)},[ie,(st=Y==null?void 0:Y.summary)==null?void 0:st.env_details,Y==null?void 0:Y.data_metric_ranges]),ue=T.useMemo(()=>{var He;const Te=[ie,(He=Y==null?void 0:Y.summary)==null?void 0:He.env_details];for(const et of Te){const ht=zk(et);if(ht.length!==0)return ht.some(ct=>(ct==null?void 0:ct.is_multi_turn)===!0)}return!1},[ie,(ft=Y==null?void 0:Y.summary)==null?void 0:ft.env_details]),[le,fe]=T.useState(new Map),we=T.useMemo(()=>{if(!r)return null;const Te=new Map;for(const He of r){let et=Te.get(He.sample_idx);et||(et=new Map,Te.set(He.sample_idx,et)),et.set(He.metric_name,{value:He.value,env:He.env})}return Te},[r]);we!==null&&we!==le&&fe(we);const pe=we??le,[xe,Ve]=T.useState([]),ye=T.useMemo(()=>{if(i!=null&&i.length)return i;if(!r)return null;const Te=new Set;for(const He of r)Te.add(He.metric_name);return[...Te].sort()},[i,r]);ye!==null&&ye!==xe&&Ve(ye);const Oe=ye??xe,he=(Te,He)=>{Z(et=>He===!0?et.includes(Te)?et:[...et,Te]:et.filter(ht=>ht!==Te))};T.useEffect(()=>{if(!Oe.length&&!e)return;const Te=new Set;A&&(Te.add("reward"),Te.add("advantage")),ue?Te.add("gen_length"):(Te.add("gen_length_sum"),Te.add("gen_length_avg"));const He=hF.filter(ht=>!Te.has(ht)),et=new Set([...He,...Oe]);Z(ht=>{let ct=ht;!ue&&!ht.includes("gen_length")&&(ht.includes("gen_length_avg")||ht.includes("gen_length_sum"))?ct=[...ct.filter(wt=>wt!=="gen_length_avg"&&wt!=="gen_length_sum"),"gen_length"]:ue&&!ht.includes("gen_length_avg")&&ht.includes("gen_length")&&(ct=[...ct.filter(wt=>wt!=="gen_length"),"gen_length_avg"]);const bt=ct.filter(wt=>et.has(wt));return bt.length===ht.length&&bt.every((wt,Pt)=>wt===ht[Pt])?ht:bt})},[Oe,e,Z,A,ue]);const Re=T.useMemo(()=>{const Te=new Set;A&&(Te.add("reward"),Te.add("advantage")),ue?Te.add("gen_length"):(Te.add("gen_length_sum"),Te.add("gen_length_avg"));const He=[],et=new Set;for(const ht of hF)Te.has(ht)||G.includes(ht)&&!et.has(ht)&&(He.push(ht),et.add(ht));for(const ht of Oe)G.includes(ht)&&!et.has(ht)&&(He.push(ht),et.add(ht));return He},[G,Oe,A,ue]),[oe,Ue]=T.useState([]),Ee=T.useRef(0),Pe=T.useRef(null),Ze=T.useRef(a),ae=T.useRef(0);T.useEffect(()=>{var et;const Te=(et=Pe.current)==null?void 0:et.querySelector('[data-slot="scroll-area-viewport"]');if(!Te)return;const He=()=>{ae.current=Te.scrollTop};return Te.addEventListener("scroll",He,{passive:!0}),()=>Te.removeEventListener("scroll",He)},[D]),T.useEffect(()=>{var Te;if(a!==Ze.current){Ze.current=a,Ee.current=0,ae.current=0;const He=(Te=Pe.current)==null?void 0:Te.querySelector('[data-slot="scroll-area-viewport"]');He&&(He.scrollTop=0)}},[a]);const te=T.useMemo(()=>{if(!t)return new Map;const Te=new Map;for(const He of t)Te.set(He.group_id,He);return Te},[t]),be=T.useMemo(()=>{if(!n)return new Map;const Te=new Map;for(const He of n)Te.set(He.sample_idx,He);return Te},[n]),me=T.useMemo(()=>{if(!e)return null;const Te=new Map,He=new Map;for(const bt of e){const wt=Te.get(bt.sample_idx)||[];wt.push(bt),Te.set(bt.sample_idx,wt),He.set(bt.sample_idx,bt.group_id)}const et=new Map;for(const[bt,wt]of Te){const Pt=[...wt].sort((Nn,bn)=>Nn.turn_order-bn.turn_order),$e=He.get(bt)??-1,Tt=te.get($e)??null,Et=be.get(bt),Ot=Pt.find(Nn=>Nn.turn_type==="model"),Gt=(Ot==null?void 0:Ot.content)??"";let an=null,On=null,Bt=0,fn=0;for(const Nn of Pt)Nn.turn_type==="model"&&typeof Nn.tokens=="number"&&(Bt+=Nn.tokens,fn+=1);fn>0&&(an=Bt/fn,On=Bt);const Ht={sample_idx:bt,group_id:$e,prompt:Tt,responsePreview:Gt,turnsCount:Pt.length,turnsData:Pt,reward:(Et==null?void 0:Et.reward)??null,advantage:(Et==null?void 0:Et.advantage)??null,assistantTokens:an,assistantTokensTotal:On},In=et.get($e)||[];In.push(Ht),et.set($e,In)}const ht=[];for(const[bt,wt]of et){const Pt=te.get(bt)??null;wt.sort(($e,Tt)=>$e.sample_idx-Tt.sample_idx),ht.push({group_id:bt,prompt:Pt,samples:wt,sampleCount:wt.length})}return ht.sort((bt,wt)=>bt.group_id-wt.group_id)},[e,te,be]);me!==null&&me!==oe&&Ue(me);const ge=me??oe;T.useLayoutEffect(()=>{var He;const Te=(He=Pe.current)==null?void 0:He.querySelector('[data-slot="scroll-area-viewport"]');Te&&ae.current>0&&Te.scrollTop!==ae.current&&(Te.scrollTop=ae.current)},[ge]);const ke=T.useMemo(()=>L===null?null:ge.find(Te=>Te.group_id===L)??null,[ge,L]),Xe=ke!==null,Ae=T.useMemo(()=>{let Te=0;for(const He of ge)for(const et of He.samples)et.assistantTokens!==null&&et.assistantTokens>Te&&(Te=et.assistantTokens);return Te>0?Te:null},[ge]),je=U??Ae,We=T.useMemo(()=>{let Te=0;for(const He of ge)for(const et of He.samples)et.assistantTokensTotal!==null&&et.assistantTokensTotal>Te&&(Te=et.assistantTokensTotal);return Te>0?Te:null},[ge]),De=U!=null?Math.max(U,We??0)||null:We;T.useEffect(()=>{!Xe&&F==="samples"&&!s&&V("groups")},[Xe,F,V,s]);const Be=Te=>{var et;const He=(et=Pe.current)==null?void 0:et.querySelector('[data-slot="scroll-area-viewport"]');if(He&&(Ee.current=He.scrollTop),E){const ht=ge.find(ct=>ct.group_id===Te);ht&&E(Te,ht);return}R(Te),V("samples")},qe=Te=>{W(Te)},Se=Te=>{var He;if(Te==="samples"&&!Xe){V("groups");return}if(Te==="groups"||Te==="samples"){if(F==="groups"&&Te==="samples"){const et=(He=Pe.current)==null?void 0:He.querySelector('[data-slot="scroll-area-viewport"]');et&&(Ee.current=et.scrollTop)}V(Te)}};return T.useEffect(()=>{F==="groups"&&Ee.current>0&&requestAnimationFrame(()=>{var He;const Te=(He=Pe.current)==null?void 0:He.querySelector('[data-slot="scroll-area-viewport"]');Te&&(Te.scrollTop=Ee.current,ae.current=Ee.current)})},[F]),T.useEffect(()=>{F!=="samples"||O===null||requestAnimationFrame(()=>{var et;const Te=(et=Pe.current)==null?void 0:et.querySelector('[data-slot="scroll-area-viewport"]');if(!Te)return;const He=Te.querySelector(`[data-sample-idx="${O}"]`);He&&(He.scrollIntoView({block:"nearest",behavior:"smooth"}),setTimeout(()=>{ae.current=Te.scrollTop},350))})},[F,O]),!K||!D?null:p.jsxs("div",{className:"w-[260px] border-r border-border bg-card/50 backdrop-blur flex flex-col h-full min-h-0",children:[p.jsxs("div",{className:"border-b border-sidebar-border shrink-0",children:[p.jsx("div",{className:"py-2.5 px-1 flex items-center justify-center h-12",children:d?p.jsx(jk,{currentPage:o,totalPages:l,onPageChange:c,pageValues:h}):p.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Loading...":"No steps available"})}),p.jsxs("div",{className:"py-1.5 px-3 flex items-center justify-between border-t border-sidebar-border",children:[S?S({viewMode:F,setViewMode:V,hasSelectedGroupInStep:Xe,groups:ge}):p.jsxs(Z0,{type:"single",variant:"outline",size:"sm",value:F,onValueChange:Se,children:[p.jsx(Uo,{value:"groups",className:"text-xs px-2 py-1 h-7",children:"Groups"}),p.jsx(Uo,{value:"samples",className:"text-xs px-2 py-1 h-7",disabled:!Xe,children:"Samples"})]}),p.jsxs("div",{className:"flex items-center gap-0.5",children:[p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",children:p.jsx(dG,{className:"h-4 w-4"})})}),p.jsxs(pl,{align:"end",className:"min-w-[180px]",children:[p.jsx(nS,{children:"Settings"}),p.jsx(Hl,{}),p.jsx(vi,{checked:B,onCheckedChange:Te=>q(Te===!0),onSelect:Te=>Te.preventDefault(),children:"Show Tooltips"})]})]}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",children:p.jsx(jN,{className:"h-4 w-4"})})}),p.jsxs(pl,{align:"end",className:"min-w-[180px]",children:[p.jsx(nS,{children:"Display Metrics"}),p.jsx(Hl,{}),ue?p.jsxs(p.Fragment,{children:[p.jsx(vi,{checked:G.includes("gen_length_sum"),onCheckedChange:Te=>he("gen_length_sum",Te),onSelect:Te=>Te.preventDefault(),children:"Gen. Length Sum"}),p.jsx(vi,{checked:G.includes("gen_length_avg"),onCheckedChange:Te=>he("gen_length_avg",Te),onSelect:Te=>Te.preventDefault(),children:"Gen. Length Avg"})]}):p.jsx(vi,{checked:G.includes("gen_length"),onCheckedChange:Te=>he("gen_length",Te),onSelect:Te=>Te.preventDefault(),children:"Gen. Length"}),!A&&p.jsx(vi,{checked:G.includes("reward"),onCheckedChange:Te=>he("reward",Te),onSelect:Te=>Te.preventDefault(),children:"Reward"}),!A&&p.jsx(vi,{checked:G.includes("advantage"),onCheckedChange:Te=>he("advantage",Te),onSelect:Te=>Te.preventDefault(),children:"Advantage"}),Oe.length>0&&p.jsx(Hl,{}),Oe.map(Te=>p.jsx(vi,{checked:G.includes(Te),onCheckedChange:He=>he(Te,He),onSelect:He=>He.preventDefault(),children:f7(Te)},Te))]})]}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>P(!1),children:p.jsx(Xle,{className:"h-4 w-4"})})]})]})]}),p.jsx(_v,{ref:Pe,className:Rt("flex-1 min-h-0 transition-opacity",s&&"opacity-50"),children:ge.length===0?p.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:s?"Loading...":"No samples available"}):F==="groups"||!ke?p.jsx("div",{className:"p-2 space-y-1",children:ge.map(Te=>p.jsx(n6e,{group:Te,onClick:()=>Be(Te.group_id),isSelected:L===Te.group_id,tokenScaleMax:je,tokenScaleSumMax:De,envRewardRanges:ne,envMetricRanges:re,advantageRange:H,badge:w?w(Te):null,displayMetrics:Re,metricsBySampleIdx:pe,tooltipsEnabled:B},Te.group_id))}):p.jsxs("div",{className:"flex flex-col min-h-0",children:[p.jsxs(vv,{delayDuration:300,open:B?void 0:!1,children:[p.jsx(xv,{asChild:!0,children:p.jsxs("div",{className:"p-3 border-b border-border bg-muted/30 shrink-0 cursor-default",children:[((mt=ke.prompt)==null?void 0:mt.system_prompt)&&p.jsxs("div",{className:"mb-2",children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),p.jsx("p",{className:"text-xs text-foreground line-clamp-2 break-words overflow-hidden [overflow-wrap:anywhere]",children:OS(ke.prompt.system_prompt,100)})]}),p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),p.jsx("p",{className:"text-xs text-foreground line-clamp-3 break-words overflow-hidden [overflow-wrap:anywhere]",children:OS((tt=ke.prompt)==null?void 0:tt.prompt,150)})]})]})}),p.jsxs(yv,{side:"right",className:"max-w-xl max-h-[70vh] overflow-y-auto p-3 space-y-2 bg-popover text-popover-foreground border border-border shadow-md",children:[((Qe=ke.prompt)==null?void 0:Qe.system_prompt)&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:ke.prompt.system_prompt})]}),((ze=ke.prompt)==null?void 0:ze.prompt)&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:ke.prompt.prompt})]})]})]}),p.jsx("div",{className:"p-2 space-y-1",children:ke.samples.map(Te=>p.jsx("div",{"data-sample-idx":Te.sample_idx,children:p.jsx(a6e,{sample:Te,isSelected:O===Te.sample_idx,onClick:()=>qe(Te.sample_idx),envRewardRanges:ne,envMetricRanges:re,advantageRange:H,displayMetrics:Re,metricsBySampleIdx:pe,tokenScaleMax:je,tokenScaleSumMax:De,tooltipsEnabled:B})},Te.sample_idx))})]})})]})}function n6e({group:t,onClick:e,isSelected:n,tokenScaleMax:r,tokenScaleSumMax:i,envRewardRanges:s,envMetricRanges:a,advantageRange:o,badge:l,displayMetrics:c,metricsBySampleIdx:d,tooltipsEnabled:h}){var g,v,b,_;return p.jsxs(vv,{delayDuration:300,open:h?void 0:!1,children:[p.jsx(xv,{asChild:!0,children:p.jsx("button",{onClick:e,className:Rt("w-full text-left p-3 rounded-lg border transition-colors overflow-hidden",n?"border-primary/50 bg-primary/5":"border-sidebar-border hover:border-border hover:bg-muted/50"),children:p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[((g=t.prompt)==null?void 0:g.system_prompt)&&p.jsx("p",{className:"text-xs text-muted-foreground mb-1 line-clamp-1 break-words overflow-hidden [overflow-wrap:anywhere] break-all",children:OS(t.prompt.system_prompt,50)}),p.jsx("p",{className:"text-xs text-foreground line-clamp-2 break-words overflow-hidden [overflow-wrap:anywhere] break-all",children:OS((v=t.prompt)==null?void 0:v.prompt,80)}),l&&p.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:l})]}),c.length>0&&p.jsx("div",{className:"flex items-start gap-1 shrink-0 pt-0",children:c.map(w=>p.jsx("div",{className:"flex flex-col items-start gap-[0.5px]",children:t.samples.map(S=>{const E=h7(S,w,d,r,i,s,o,a);return p.jsx("div",{title:E.label,className:Rt("h-1.5 w-1.5 rounded-none",E.color?"":"bg-muted"),style:E.color?{backgroundColor:E.color}:void 0},S.sample_idx)})},w))})]})})}),p.jsxs(yv,{side:"right",className:"max-w-xl max-h-[70vh] overflow-y-auto p-3 space-y-2 bg-popover text-popover-foreground border border-border shadow-md",children:[((b=t.prompt)==null?void 0:b.system_prompt)&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:t.prompt.system_prompt})]}),((_=t.prompt)==null?void 0:_.prompt)&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:t.prompt.prompt})]})]})]})}function r6e(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function f7(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function QK(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function i6e(t,e){switch(e){case"gen_length":case"gen_length_sum":case"gen_length_avg":return Math.round(t).toString();default:return QK(t)}}function s6e(t,e,n){var r;if(t){if(e){const i=(r=t.get(e))==null?void 0:r.get(n);if(i)return i}for(const i of t.values()){const s=i.get(n);if(s)return s}}}function h7(t,e,n,r,i,s,a,o,l){var c,d;switch(e){case"gen_length":return{value:t.assistantTokensTotal,color:W6(t.assistantTokensTotal,i,l),label:t.assistantTokensTotal!==null?`Gen. Length: ${t.assistantTokensTotal}`:"Gen. Length: n/a"};case"gen_length_sum":return{value:t.assistantTokensTotal,color:W6(t.assistantTokensTotal,i,l),label:t.assistantTokensTotal!==null?`Gen. Length Sum: ${t.assistantTokensTotal}`:"Gen. Length Sum: n/a"};case"gen_length_avg":return{value:t.assistantTokens!==null?Math.round(t.assistantTokens):null,color:W6(t.assistantTokens,r,l),label:t.assistantTokens!==null?`Gen. Length Avg: ${Math.round(t.assistantTokens)}`:"Gen. Length Avg: n/a"};case"reward":{const h=((c=t.prompt)==null?void 0:c.env)??null,g=h?s==null?void 0:s.get(h):void 0;return{value:t.reward,color:t.reward!==null?G6(t.reward,(g==null?void 0:g.min)??null,(g==null?void 0:g.max)??null)??t6e(t.reward):null,label:t.reward!==null?`Reward: ${t.reward.toFixed(2)}`:"Reward: n/a"}}case"advantage":return{value:t.advantage,color:t.advantage!==null?G6(t.advantage,(a==null?void 0:a.min)??null,(a==null?void 0:a.max)??null)??null:null,label:t.advantage!==null?`Advantage: ${t.advantage.toFixed(2)}`:"Advantage: n/a"};default:{const h=n.get(t.sample_idx),g=h==null?void 0:h.get(e);if(!g)return{value:null,color:null,label:`${f7(e)}: n/a`};const v=g.env??((d=t.prompt)==null?void 0:d.env)??null,b=s6e(o,v,e),_=G6(g.value,(b==null?void 0:b.min)??null,(b==null?void 0:b.max)??null,b==null?void 0:b.invert);return{value:g.value,color:_??null,label:`${f7(e)}: ${QK(g.value)}`}}}}function a6e({sample:t,isSelected:e,onClick:n,envRewardRanges:r,envMetricRanges:i,advantageRange:s,displayMetrics:a,metricsBySampleIdx:o,tokenScaleMax:l,tokenScaleSumMax:c,tooltipsEnabled:d}){return p.jsxs(vv,{delayDuration:300,open:d?void 0:!1,children:[p.jsx(xv,{asChild:!0,children:p.jsx("button",{onClick:n,className:Rt("w-full text-left p-3 rounded-lg border transition-colors overflow-hidden",e?"border-primary/50 bg-primary/5":"border-sidebar-border hover:border-border hover:bg-muted/50"),children:p.jsxs("div",{className:"flex items-stretch justify-between gap-2 min-w-0",children:[p.jsx("p",{className:"text-xs text-foreground break-words flex-1 min-w-0 overflow-hidden",style:{display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:a.length>0?Math.max(2,a.filter(h=>h7(t,h,o,l,c,r,s,i,70).value!==null).length):2,overflowWrap:"anywhere"},children:OS(t.responsePreview,300)||"No response"}),a.length>0&&p.jsx("div",{className:"flex items-start gap-1 shrink-0",children:p.jsx("div",{className:"flex flex-col items-center gap-0.5",children:a.map(h=>{const g=h7(t,h,o,l,c,r,s,i,70);return g.value===null?null:p.jsx("span",{className:"text-[10px] font-semibold tabular-nums leading-none",style:g.color?{color:g.color}:void 0,title:g.label,children:i6e(g.value,h)},h)})})})]})})}),p.jsx(yv,{side:"right",className:"max-w-xl max-h-[70vh] overflow-y-auto p-3 bg-popover text-popover-foreground border border-border shadow-md",children:p.jsxs("div",{className:"space-y-3",children:[t.turnsData.map(h=>p.jsxs("div",{children:[p.jsxs("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5 flex items-center gap-2",children:[p.jsx("span",{children:r6e(h.turn_type)}),h.tokens!=null&&p.jsxs("span",{className:"font-normal normal-case",children:[h.tokens.toLocaleString()," tokens"]})]}),p.jsx("p",{className:"text-xs whitespace-pre-wrap break-words font-sans",children:h.content||"(empty)"})]},`${h.sample_idx}-${h.turn_order}`)),t.turnsData.length===0&&p.jsx("p",{className:"text-xs text-muted-foreground",children:"No turns available"})]})})]})}function o6e(){var ye,Oe,he,Re,oe;const t=ki(ml),[e]=T7(),[n,r]=cn(uT),[i,s]=cn(wG),[a,o]=cn(MG),l=ki(TG),[c,d]=cn(y8),[,h]=cn(EG),g=ki(x8),[v,b]=cn(hT),[_,w]=cn(pT),S=v.length+(_?1:0),E=Ue=>{b(Ee=>Ee.includes(Ue)?Ee.filter(Pe=>Pe!==Ue):[...Ee,Ue])},[A,N]=T.useState(0),[D,P]=T.useState(0),[L,R]=T.useState(!0),O=!0,W=T.useMemo(()=>{const Ue=e.get("step");if(!Ue)return null;const Ee=Number(Ue);return Number.isFinite(Ee)?Ee:null},[e]),F=T.useMemo(()=>{const Ue=e.get("sample");if(!Ue)return null;const Ee=Number(Ue);return Number.isFinite(Ee)?Ee:null},[e]),V=T.useMemo(()=>{const Ue=e.get("group");if(!Ue)return null;const Ee=Number(Ue);return Number.isFinite(Ee)?Ee:null},[e]),G=T.useRef(null),Z=T.useRef({group:null,sample:null});T.useEffect(()=>{if(!t){G.current=null,Z.current={group:null,sample:null};return}if(W==null){G.current=null;return}W!==G.current&&(r(W),G.current=W)},[W,t,r]),T.useEffect(()=>{t&&(V==null||F==null||Z.current.group===V&&Z.current.sample===F||(s(V),o(F),d(!0),h("samples"),Z.current={group:V,sample:F}))},[V,F,t,s,o,d,h]);const{data:B,isLoading:q,error:K}=cue(t||"",n,!!t),{data:Y}=ed(t||"",!!t,O),Q=T.useMemo(()=>{var Ue;return gw((Ue=Y==null?void 0:Y.config)==null?void 0:Ue.environments)},[(ye=Y==null?void 0:Y.config)==null?void 0:ye.environments]),U=T.useMemo(()=>{var Ze,ae;const Ue=pp((Ze=Y==null?void 0:Y.config)==null?void 0:Ze.environments),Ee=pp((ae=Y==null?void 0:Y.summary)==null?void 0:ae.env_details),Pe=vw(Y==null?void 0:Y.data_metric_ranges);return mp(mp(Ue,Ee),Pe)},[(Oe=Y==null?void 0:Y.config)==null?void 0:Oe.environments,(he=Y==null?void 0:Y.summary)==null?void 0:he.env_details,Y==null?void 0:Y.data_metric_ranges]),j=T.useMemo(()=>{var Ze;const Ue=(Ze=Y==null?void 0:Y.config)==null?void 0:Ze.group_size,Ee=typeof Ue=="object"&&Ue!==null&&"value"in Ue?Number(Ue.value):Number(Ue);if(!Ee||isNaN(Ee)||Ee<=1)return null;const Pe=Math.sqrt(Ee-1);return{min:-Pe,max:Pe}},[(Re=Y==null?void 0:Y.config)==null?void 0:Re.group_size]),X=T.useMemo(()=>{var Ue;return(Ue=B==null?void 0:B.available_steps)!=null&&Ue.length&&n===null?B.available_steps[B.available_steps.length-1]:null},[B,n]);T.useEffect(()=>{X!==null&&n===null&&W==null&&r(X)},[X,W,n,r]);const H=Ue=>{r(Ue)},[ie,ne]=T.useState([]),[re,ue]=T.useState(null);t!==re&&(ne([]),ue(t));const le=B==null?void 0:B.available_steps,fe=T.useMemo(()=>{const Ue=le??[];return[...new Set([...ie,...Ue])].sort((Pe,Ze)=>Pe-Ze)},[le,ie]);fe.length>ie.length&&ne(fe);const we=fe.length>0,pe=we?fe[fe.length-1]:0,xe=T.useMemo(()=>{if(n==null)return fe.length-1;const Ue=fe.indexOf(n);return Ue>=0?Ue:fe.length-1},[fe,n]),Ve=Ue=>{Ue>=0&&Ue<fe.length&&H(fe[Ue])};return t?p.jsxs("div",{className:"flex h-full overflow-hidden",children:[p.jsx(V9,{prompts:B==null?void 0:B.prompts,data:B==null?void 0:B.rollouts,samplesData:B==null?void 0:B.samples_data,rolloutMetrics:B==null?void 0:B.rollout_metrics,availableMetricNames:B==null?void 0:B.available_rollout_metric_names,isLoading:q,step:n??void 0,currentStepIndex:xe,totalSteps:fe.length,onStepChange:Ve,hasSteps:we,stepValues:fe}),p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center justify-between h-7",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(H9,{}),l&&p.jsxs("div",{className:"text-sm text-muted-foreground",children:[p.jsxs("span",{children:["Step ",((oe=l.sample.turns[0])==null?void 0:oe.step)??n]})," · ",p.jsxs("span",{children:["Group ",l.sample.group_id]})," · ",p.jsxs("span",{children:["Sample ",l.sample.sample_idx]})]}),(l==null?void 0:l.sample.raw_string)&&p.jsx(GT,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&p.jsxs(p.Fragment,{children:[p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(Ue=>Ue+1),R(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{P(Ue=>Ue+1),R(!0)},children:"Expand All"}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",S>0&&` (${S})`]})}),p.jsxs(pl,{align:"start",className:"w-auto",children:[p.jsx(vi,{checked:_,onCheckedChange:Ue=>w(!!Ue),onSelect:Ue=>Ue.preventDefault(),children:"Format Think"}),p.jsx(vi,{checked:v.includes("markdown"),onCheckedChange:()=>E("markdown"),onSelect:Ue=>Ue.preventDefault(),children:"Markdown"}),p.jsx(vi,{checked:v.includes("latex"),onCheckedChange:()=>E("latex"),onSelect:Ue=>Ue.preventDefault(),children:"LaTeX"}),p.jsx(vi,{checked:v.includes("code"),onCheckedChange:()=>E("code"),onSelect:Ue=>Ue.preventDefault(),children:"Code"})]})]})]})]}),p.jsx(U9,{})]})})}),p.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:p.jsxs("div",{className:c||g?"max-w-5xl mx-auto":"",children:[K&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",K instanceof Error?K.message:"Unknown error"]})})}),p.jsx(_1,{prompts:B==null?void 0:B.prompts,data:B==null?void 0:B.rollouts,samplesData:B==null?void 0:B.samples_data,rolloutMetrics:B==null?void 0:B.rollout_metrics,goldenAnswers:B==null?void 0:B.golden_answers,infoTurns:B==null?void 0:B.info_turns,isLoading:q,step:n??void 0,scrollToSampleId:F,filterGroupId:i,filterSampleIdx:a,collapseAllSignal:A,expandAllSignal:D,defaultSectionsOpen:L,envRewardRanges:Q,envMetricRanges:U,advantageRange:j,renderOptions:v,formatThinkBlocks:_})]})})]}),p.jsx(B9,{currentStep:n,maxSelectableStep:pe})]}):p.jsx(mm,{description:"Select a run from the sidebar to view rollouts."})}function l6e(){var me,ge,ke,Xe,Ae;const t=ki(ml),[e]=T7(),[n,r]=cn(GI),[i,s]=cn(WI),[a,o]=cn($I),l=ki(qI),[c,d]=cn(zC),[,h]=cn(XI),g=ki(LC),[v,b]=cn(hT),[_,w]=cn(pT),S=v.length+(_?1:0),E=je=>{b(We=>We.includes(je)?We.filter(De=>De!==je):[...We,je])},[A,N]=T.useState(0),[D,P]=T.useState(0),[L,R]=T.useState(!0),O=!0,W=T.useMemo(()=>{const je=e.get("step")??e.get("trainer_step");if(!je)return null;const We=Number(je);return Number.isFinite(We)?We:null},[e]),F=T.useMemo(()=>{const je=e.get("sample");if(!je)return null;const We=Number(je);return Number.isFinite(We)?We:null},[e]),V=T.useMemo(()=>{const je=e.get("group");if(!je)return null;const We=Number(je);return Number.isFinite(We)?We:null},[e]),G=T.useRef(null),Z=T.useRef({group:null,sample:null});T.useEffect(()=>{if(!t){G.current=null,Z.current={group:null,sample:null};return}if(W==null){G.current=null;return}W!==G.current&&(r(W),G.current=W)},[W,t,r]),T.useEffect(()=>{t&&(V==null||F==null||Z.current.group===V&&Z.current.sample===F||(s(V),o(F),d(!0),h("samples"),Z.current={group:V,sample:F}))},[V,F,t,s,o,d,h]);const{data:B,isLoading:q,error:K}=uue(t||"",n,!!t),{data:Y}=ed(t||"",!!t,O),Q=T.useMemo(()=>{var je;return gw((je=Y==null?void 0:Y.config)==null?void 0:je.environments)},[(me=Y==null?void 0:Y.config)==null?void 0:me.environments]),U=T.useMemo(()=>{var Be,qe;const je=pp((Be=Y==null?void 0:Y.config)==null?void 0:Be.environments),We=pp((qe=Y==null?void 0:Y.summary)==null?void 0:qe.env_details),De=vw(Y==null?void 0:Y.data_metric_ranges);return mp(mp(je,We),De)},[(ge=Y==null?void 0:Y.config)==null?void 0:ge.environments,(ke=Y==null?void 0:Y.summary)==null?void 0:ke.env_details,Y==null?void 0:Y.data_metric_ranges]),j=T.useMemo(()=>{var Be;const je=(Be=Y==null?void 0:Y.config)==null?void 0:Be.group_size,We=typeof je=="object"&&je!==null&&"value"in je?Number(je.value):Number(je);if(!We||isNaN(We)||We<=1)return null;const De=Math.sqrt(We-1);return{min:-De,max:De}},[(Xe=Y==null?void 0:Y.config)==null?void 0:Xe.group_size]),X=T.useMemo(()=>{var je;return(je=B==null?void 0:B.available_trainer_steps)!=null&&je.length&&n===null?B.available_trainer_steps[B.available_trainer_steps.length-1]:null},[B,n]);T.useEffect(()=>{X!==null&&n===null&&W==null&&r(X)},[X,W,n,r]);const H=je=>{r(je)},[ie,ne]=T.useState([]),[re,ue]=T.useState(null),[le,fe]=T.useState(new Map);t!==re&&(ne([]),ue(t),fe(new Map));const we=B==null?void 0:B.available_trainer_steps,pe=T.useMemo(()=>{const je=we??[];return[...new Set([...ie,...je])].sort((De,Be)=>De-Be)},[we,ie]);pe.length>ie.length&&ne(pe);const xe=pe.length>0,Ve=xe?pe[pe.length-1]:0,ye=T.useMemo(()=>{if(n==null)return pe.length-1;const je=pe.indexOf(n);return je>=0?je:pe.length-1},[pe,n]),Oe=je=>{je>=0&&je<pe.length&&H(pe[je])},he=T.useMemo(()=>{if(B!=null&&B.prompts)return B.prompts.map(je=>({step:je.trainer_step,group_id:je.group_id,env:je.env,system_prompt:je.system_prompt,tokens_system_prompt:je.tokens_system_prompt,prompt:je.prompt,tokens_prompt:je.tokens_prompt}))},[B]),Re=T.useMemo(()=>{if(B!=null&&B.rollouts)return B.rollouts.map(je=>({step:je.trainer_step,group_id:je.group_id,sample_idx:je.sample_idx,turn_order:je.turn_order,turn_type:je.turn_type,content:je.content,tokens:je.tokens}))},[B]),oe=T.useMemo(()=>{if(B!=null&&B.samples_data)return B.samples_data.map(je=>({step:je.trainer_step,group_id:je.group_id,sample_idx:je.sample_idx,reward:je.reward,advantage:je.advantage,turns:je.turns,total_tokens:je.total_tokens,raw_string:je.raw_string}))},[B]),Ue=T.useMemo(()=>{if(!(B!=null&&B.rollout_metrics))return;const je=n??0;return B.rollout_metrics.map(We=>({step:je,sample_idx:We.sample_idx,env:We.env,metric_name:We.metric_name,value:We.value}))},[B,n]),Ee=T.useMemo(()=>{if(!(B!=null&&B.golden_answers))return;const je=n??0;return B.golden_answers.map(We=>({step:je,sample_idx:We.sample_idx,env:We.env,key:We.key,value:We.value}))},[B,n]),Pe=T.useMemo(()=>{if(!(B!=null&&B.info_turns))return;const je=n??0;return B.info_turns.map(We=>({step:je,sample_idx:We.sample_idx,turn_order:We.turn_order,env:We.env,info_key:We.info_key,info_value:We.info_value,info_type:We.info_type}))},[B,n]),Ze=T.useMemo(()=>{if(!(B!=null&&B.prompts))return null;const je=new Map;for(const We of B.prompts)je.set(We.group_id,We.discard_reason);return je},[B]),ae=Ze??le;Ze&&Ze!==le&&fe(Ze);const te=je=>{switch(je){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return je.split("_").map(We=>We.charAt(0).toUpperCase()+We.slice(1)).join(" ")}},be=je=>{switch(je){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}};return t?p.jsxs("div",{className:"flex h-full overflow-hidden",children:[p.jsx(V9,{prompts:he,data:Re,samplesData:oe,rolloutMetrics:Ue,isLoading:q,step:n??void 0,currentStepIndex:ye,totalSteps:pe.length,onStepChange:Oe,hasSteps:xe,stepValues:pe,openAtom:zC,selectedGroupIdAtom:WI,selectedSampleIdxAtom:$I,viewModeAtom:XI,getGroupBadge:je=>{const We=ae.get(je.group_id);return We?p.jsx(q1,{variant:be(We),className:"text-[10px] h-4 px-1.5",children:te(We)}):null}}),p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center justify-between h-7",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(H9,{openAtom:zC}),l&&p.jsxs("div",{className:"text-sm text-muted-foreground",children:[p.jsxs("span",{children:["Step"," ",((Ae=l.sample.turns[0])==null?void 0:Ae.step)??n]})," · ",p.jsxs("span",{children:["Group ",l.sample.group_id]})," · ",p.jsxs("span",{children:["Sample ",l.sample.sample_idx]})]}),(l==null?void 0:l.sample.raw_string)&&p.jsx(GT,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&p.jsxs(p.Fragment,{children:[p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(je=>je+1),R(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{P(je=>je+1),R(!0)},children:"Expand All"}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",S>0&&` (${S})`]})}),p.jsxs(pl,{align:"start",className:"w-auto",children:[p.jsx(vi,{checked:_,onCheckedChange:je=>w(!!je),onSelect:je=>je.preventDefault(),children:"Format Think"}),p.jsx(vi,{checked:v.includes("markdown"),onCheckedChange:()=>E("markdown"),onSelect:je=>je.preventDefault(),children:"Markdown"}),p.jsx(vi,{checked:v.includes("latex"),onCheckedChange:()=>E("latex"),onSelect:je=>je.preventDefault(),children:"LaTeX"}),p.jsx(vi,{checked:v.includes("code"),onCheckedChange:()=>E("code"),onSelect:je=>je.preventDefault(),children:"Code"})]})]})]})]}),p.jsx(U9,{openAtom:LC})]})})}),p.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:p.jsxs("div",{className:c||g?"max-w-5xl mx-auto":"",children:[K&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",K instanceof Error?K.message:"Unknown error"]})})}),p.jsx(_1,{prompts:he,data:Re,samplesData:oe,rolloutMetrics:Ue,goldenAnswers:Ee,infoTurns:Pe,isLoading:q,step:n??void 0,scrollToSampleId:F,filterGroupId:i,filterSampleIdx:a,lastValidSampleAtom:qI,collapseAllSignal:A,expandAllSignal:D,defaultSectionsOpen:L,envRewardRanges:Q,envMetricRanges:U,advantageRange:j,renderOptions:v,formatThinkBlocks:_})]})})]}),p.jsx(B9,{currentStep:n,maxSelectableStep:Ve,openAtom:LC,selectedMetricsAtom:Uce,selectedStepAtom:GI,includeDiscardedDefaults:!0})]}):p.jsx(mm,{description:"Select a run from the sidebar to view discarded rollouts."})}function c6e(){const t=ki(ml),{data:e,error:n}=ed(t||"",!!t,!1),r=T.useMemo(()=>XK(e==null?void 0:e.summary),[e==null?void 0:e.summary]);return t?n?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load topology data"}),p.jsx("div",{className:"text-xs text-muted-foreground",children:n instanceof Error?n.message:"Unknown error"})]})}):e?!r||r.nodes.length===0?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No topology data available"}),p.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have setup information in its W&B summary."})]})}):p.jsx("div",{className:"h-full w-full",children:p.jsx(KK,{topology:r})}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading topology…"})}):p.jsx(mm,{description:"Select a run from the sidebar to view cluster topology."})}const fs=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],p7=["gpu_utilization_percent","gpu_memory_used_percent","gpu_memory_bandwidth_utilization_percent","gpu_memory_used_gb","gpu_memory_free_gb","gpu_memory_total_gb","gpu_temperature_c","gpu_power_w","gpu_power_limit_w","gpu_clock_sm_mhz","gpu_clock_mem_mhz","gpu_fan_speed_percent"],pF=["torch_allocated_gb","torch_reserved_gb","torch_max_allocated_gb"],mF=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],gF=["requests_running","requests_waiting","cache_usage","cache_hit_rate","requests_total","prompt_tokens_total","rollout_tokens_total","preemptions_total","cache_hits_total","cache_queries_total","ttft_mean","e2e_latency_mean","itl_mean"];function u6e(t){if(t.length===0)return{start:0,end:1};let e=1/0,n=-1/0;for(const r of t)r.timestamp<e&&(e=r.timestamp),r.timestamp>n&&(n=r.timestamp);return{start:e,end:n}}function A5(t,e,n){return n?`${t??"?"}:${e}`:`gpu:${e}`}function LS(t,e){if(t.startsWith("#")){const n=t.slice(1),r=n.length===3?n.split("").map(i=>i+i).join(""):n;if(r.length===6){const i=Number.parseInt(r.slice(0,2),16),s=Number.parseInt(r.slice(2,4),16),a=Number.parseInt(r.slice(4,6),16);return`rgba(${i}, ${s}, ${a}, ${e})`}}return t}function m7(t,e){const n=new Map,r=[...t].sort((i,s)=>{const a=typeof i.node_id=="number"&&Number.isFinite(i.node_id)?i.node_id:Number.MAX_SAFE_INTEGER,o=typeof s.node_id=="number"&&Number.isFinite(s.node_id)?s.node_id:Number.MAX_SAFE_INTEGER;return a!==o?a-o:i.gpu_index-s.gpu_index});for(const i of r){const s=typeof i.node_id=="number"&&Number.isFinite(i.node_id)?i.node_id:null,a=`${s??"?"}:${i.gpu_index}`;n.has(a)||n.set(a,{node_id:s,gpu_index:i.gpu_index})}return Array.from(n.values()).map((i,s)=>({seriesKey:A5(i.node_id,i.gpu_index,e),...i,label:e?`Node ${i.node_id??"?"} GPU ${i.gpu_index}`:`GPU ${i.gpu_index}`,color:e?fs[s%fs.length]:fs[i.gpu_index%fs.length]}))}function d6e(t,e){const n=new Map;for(const i of t){const s=`${i.node_id}:${i.gpu_index}`;n.has(s)||n.set(s,{node_id:i.node_id,gpu_index:i.gpu_index})}return Array.from(n.values()).sort((i,s)=>i.node_id-s.node_id||i.gpu_index-s.gpu_index).map((i,s)=>({seriesKey:A5(i.node_id,i.gpu_index,e),node_id:i.node_id,gpu_index:i.gpu_index,label:e?`Node ${i.node_id} GPU ${i.gpu_index}`:`GPU ${i.gpu_index}`,color:e?fs[s%fs.length]:fs[i.gpu_index%fs.length]}))}function g7({series:t,activeSeriesKeys:e,onSeriesHover:n,onSeriesToggle:r}){return t.length===0?null:p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mb-3",children:t.map(i=>{const s=!!(e!=null&&e.has(i.seriesKey)),a=!!e&&e.size>0&&!s;return p.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",r&&"cursor-pointer",s&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:a?.3:1},onPointerEnter:n?()=>n(i.seriesKey):void 0,onPointerLeave:n?()=>n(null):void 0,onClick:r?()=>r(i.seriesKey):void 0,children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?LS(i.color,.25):i.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:i.label})]},i.seriesKey)})})}function f6e({trainerLabels:t,inferenceLabels:e,activeSeriesKeys:n,onSeriesHover:r,onSeriesToggle:i}){return t.length===0&&e.length===0?null:p.jsxs("div",{className:"space-y-2 mb-3",children:[t.length>0&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground mb-1",children:"Trainer"}),p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:t.map(s=>{const a=!!(n!=null&&n.has(s.seriesKey)),o=!!n&&n.size>0&&!a;return p.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",i&&"cursor-pointer",a&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:o?.3:1},onPointerEnter:r?()=>r(s.seriesKey):void 0,onPointerLeave:r?()=>r(null):void 0,onClick:i?()=>i(s.seriesKey):void 0,children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o?LS(s.color,.25):s.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`trainer-${s.seriesKey}`)})})]}),e.length>0&&p.jsxs("div",{children:[p.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground mb-1",children:"Inference"}),p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:e.map(s=>{const a=!!(n!=null&&n.has(s.seriesKey)),o=!!n&&n.size>0&&!a;return p.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",i&&"cursor-pointer",a&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:o?.3:1},onPointerEnter:r?()=>r(s.seriesKey):void 0,onPointerLeave:r?()=>r(null):void 0,onClick:i?()=>i(s.seriesKey):void 0,children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o?LS(s.color,.25):s.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`inference-${s.seriesKey}`)})})]})]})}function JK(t){const e=Math.abs(t);if(e>=60)return mT(t);if(e>0&&e<1){const n=t*1e3,r=Math.abs(n);return r<1?`${parseFloat(n.toFixed(2))}ms`:r<10?`${parseFloat(n.toFixed(1))}ms`:`${Math.round(n)}ms`}return nv(t)}const eZ=28;function tZ(t,e,n,r){if(!t||t.length===0||n<0||n>=t.length)return null;const i=Number(e[n]),s=c=>r==null?!0:Math.abs(Number(e[c])-i)<=r,a=t[n];if(a!=null)return s(n)?n:null;let o=n-1,l=n+1;for(;o>=0||l<t.length;){const c=o>=0?t[o]:void 0,d=l<t.length?t[l]:void 0,h=c!=null,g=d!=null;if(h&&g){const v=Math.abs(Number(e[o])-i),_=Math.abs(Number(e[l])-i)<v?l:o;return s(_)?_:null}if(h)return s(o)?o:null;if(g)return s(l)?l:null;o-=1,l+=1}return null}function nZ(t){if(t.length<4)return null;const e=[...t].sort((c,d)=>c-d),n=e.length,r=(n-1)*.25,i=(n-1)*.75,s=e[Math.floor(r)]+r%1*(e[Math.ceil(r)]-e[Math.floor(r)]),a=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),o=a-s,l=6;return{lower:s-l*o,upper:a+l*o}}function M1({label:t,onRemove:e}){return p.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] bg-white border border-gray-400 text-gray-600 rounded-full cursor-pointer hover:bg-gray-50 transition-colors",onClick:n=>{n.stopPropagation(),e()},children:[t,p.jsx(Ju,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function h6e({metricName:t,data:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const a=T.useRef(null),o=T.useRef(null),l=T.useRef(null),[c,d]=T.useState(!1),[h,g]=T.useState(null),[v,b]=T.useState(null),_=NT[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:w,seriesConfig:S,hasData:E,nodeIds:A,timeRange:N,outlierBounds:D}=T.useMemo(()=>{if(e.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:[],timeRange:i??{start:0,end:1},outlierBounds:null};const O=new Set;let W=1/0,F=-1/0;const V=[];for(const j of e){const X=typeof j.node_id=="number"&&Number.isFinite(j.node_id)?j.node_id:0;O.add(X),j.timestamp<W&&(W=j.timestamp),j.timestamp>F&&(F=j.timestamp),V.push(j.value)}const G=Array.from(O).sort((j,X)=>j-X),Z=i??{start:W,end:F},B={},q=new Set;for(const j of e){const X=typeof j.node_id=="number"&&Number.isFinite(j.node_id)?j.node_id:0;q.add(j.timestamp),B[j.timestamp]||(B[j.timestamp]={}),B[j.timestamp][X]=j.value}const K=Array.from(q).sort((j,X)=>j-X);if(K.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:G,timeRange:Z,outlierBounds:null};const Y=K.map(j=>j-Z.start),Q=[{label:"Time"}],U=[Y];for(let j=0;j<G.length;j++){const X=G[j],H=K.map(ie=>{var ne;return((ne=B[ie])==null?void 0:ne[X])??null});U.push(H),Q.push({label:`Node ${X}`,stroke:fs[j%fs.length],width:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:U,seriesConfig:Q,hasData:!0,nodeIds:G,timeRange:Z,outlierBounds:nZ(V)}},[e,i]),P=A.length>1,L=T.useCallback(O=>Math.abs(O)>=1e3?`${parseFloat((O/1e3).toFixed(1))}k`:Number.isInteger(O)?O.toLocaleString():Math.abs(O)<.01&&O!==0?O.toExponential(1):String(parseFloat(O.toFixed(2))),[]);T.useEffect(()=>{if(!a.current||!w||!E)return;const O=a.current,W=O.clientWidth,F=192;let V=Number.POSITIVE_INFINITY,G=Number.NEGATIVE_INFINITY;for(let ne=1;ne<w.length;ne+=1){const re=w[ne];for(let ue=0;ue<re.length;ue+=1){const le=re[ue];le!=null&&(c&&D?le>=D.lower&&le<=D.upper&&(le<V&&(V=le),le>G&&(G=le)):(le<V&&(V=le),le>G&&(G=le)))}}V===Number.POSITIVE_INFINITY&&D&&(V=D.lower,G=D.upper);const Z=G-V,B=Math.max(Math.abs(G),Math.abs(V)),q=Math.max(B*.05,1e-10),K=Math.max(Z*.1,q),Y=[h!==null?h:Math.max(0,V-K),v!==null?v:G+K],Q="rgba(128, 128, 128, 0.15)",U="rgba(100, 100, 100, 0.9)",X={width:W,height:F,padding:[4,24,0,4],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!0,y:!1}},legend:{show:P},select:{show:!0,left:0,top:0,width:0,height:0},scales:{x:{time:!1,range:(ne,re,ue)=>{const le=N.end-N.start;return le>0?[0,le]:[re,ue]}},y:{range:Y}},axes:[{stroke:U,grid:{stroke:Q,width:1},ticks:{stroke:Q,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:(ne,re,ue,le)=>[ue,le],values:(ne,re)=>re.map(ue=>K0(N.start+Number(ue),N.end-N.start))},{stroke:U,grid:{stroke:Q,width:1},ticks:{stroke:Q,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(ne,re)=>{if(!re||re.length===0)return 40;const ue=Math.max(...re.map(le=>le.length));return Math.max(40,ue*7+14)},values:(ne,re)=>re.map(L)}],series:S,hooks:{setCursor:[ne=>{if(!l.current||!a.current)return;const{left:re,idx:ue}=ne.cursor;if(ue==null||re===void 0||re<0){l.current.style.display="none";return}const le=w[0][ue];if(le===void 0){l.current.style.display="none";return}const fe=w[0],we=(()=>{const Ee=ne.scales.x,Pe=Number(Ee.min),Ze=Number(Ee.max);if(!Number.isFinite(Pe)||!Number.isFinite(Ze))return null;const ae=Math.abs(Ze-Pe);if(ae<=0)return null;const te=Math.max(1,ne.bbox.width);return ae*eZ/te})(),pe=JK(Number(le)+s),xe=N.start+Number(le);let ye=`<div class="font-medium mb-1">${K0(xe,N.end-N.start)}</div>`;ye+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${pe}</div>`,ye+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${xe.toFixed(3)}</div>`;let Oe=!1;for(let Ee=0;Ee<A.length;Ee+=1){const Pe=w[Ee+1],Ze=tZ(Pe,fe,ue,we);if(Ze===null)continue;const ae=Pe==null?void 0:Pe[Ze];if(ae==null)continue;Oe=!0;const te=qu(ae);ye+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${fs[Ee%fs.length]}"></div>
                  <span class="text-muted-foreground">Node ${A[Ee]}:</span>
                  <span class="font-medium">${te} ${_.unit}</span>
                </div>
              `}if(!Oe){l.current.style.display="none";return}l.current.innerHTML=ye,l.current.style.display="block";const he=a.current.getBoundingClientRect(),Re=l.current.getBoundingClientRect();let oe=he.left+re+15;oe+Re.width+20>window.innerWidth&&(oe=he.left+re-Re.width-15+ne.bbox.left),oe=Math.max(4,oe);let Ue=he.top-Re.height+20;Ue<4&&(Ue=he.bottom-20),l.current.style.left=`${oe}px`,l.current.style.top=`${Ue}px`}]}};o.current&&o.current.destroy();const H=new ma(X,w,O);o.current=H;const ie=new ResizeObserver(ne=>{for(const re of ne){const{width:ue}=re.contentRect;H&&ue>0&&H.setSize({width:ue,height:F})}});return ie.observe(O),()=>{ie.disconnect(),H.destroy(),o.current=null}},[w,E,S,t,N,s,P,_.unit,A,L,c,D,h,v]);const R=T.useCallback(()=>{l.current&&(l.current.style.display="none")},[]);return p.jsxs("div",{className:Rt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white",n&&"opacity-60"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h4",{className:"text-xs font-medium truncate",title:t,children:_.label}),c&&p.jsx(M1,{label:"Ignore Outliers",onRemove:()=>d(!1)}),h!==null&&p.jsx(M1,{label:`Min Y: ${h}`,onRemove:()=>g(null)}),v!==null&&p.jsx(M1,{label:`Max Y: ${v}`,onRemove:()=>b(null)})]}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:p.jsx(aw,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(vi,{checked:c,onCheckedChange:d,children:"Ignore Outliers"}),p.jsx(Hl,{}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),p.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:h??"",onChange:O=>{const W=O.target.value;g(W===""?null:Number(W))},onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation()})]}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),p.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:v??"",onChange:O=>{const W=O.target.value;b(W===""?null:Number(W))},onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation()})]})]})]})})]}),E?p.jsxs("div",{className:"h-48 relative bg-white rounded",ref:a,onMouseLeave:R,children:[r&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"}),p.jsx("div",{ref:l,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}})]}):p.jsx("div",{className:"h-48 flex items-center justify-center text-muted-foreground text-xs rounded",children:n?"Loading...":`No data for ${_.label}`})]})}function v7({data:t,metricNames:e,intervalStart:n,intervalEnd:r,gpuIndices:i,seriesMode:s,isLoading:a,isRefetching:o,seriesRoles:l,activeSeriesKeys:c,xOffset:d=0}){const h=T.useMemo(()=>{const v=new Map;for(const b of t)v.set(b.metric_name,(v.get(b.metric_name)??0)+1);return e.filter(b=>(v.get(b)??0)>0)},[t,e]),g=T.useMemo(()=>a&&e.length>0?e:a&&e.length===0?p7:h,[a,e,h]);return g.length===0&&!a?p.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-gray-200 bg-white",children:"No GPU metrics data available"}):p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:g.map(v=>{const b=t.filter(_=>_.metric_name===v);return p.jsx(g$,{metricName:v,data:b,gpuIndices:i,intervalStart:n,intervalEnd:r,seriesMode:s,showLegend:!1,isLoading:a,isRefetching:o,seriesRoles:l,activeSeriesKeys:c,xOffset:d,xAxisMode:"clock",xAxisTicks:"bounds"},v)})})}function p6e({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const a=T.useMemo(()=>{const l=new Set;for(const d of t)d.metric_name.startsWith("cpu_core_")||l.add(d.metric_name);for(const d of e??[])d.startsWith("cpu_core_")||l.add(d);const c=mF.filter(d=>l.has(d));for(const d of l)c.includes(d)||c.push(d);return c},[t,e]),o=T.useMemo(()=>a.length>0?a:n?mF:a,[a,n]);return o.length===0&&!n?p.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-gray-200 bg-white",children:"No CPU metrics data available"}):p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:o.map(l=>{const c=t.filter(d=>d.metric_name===l);return p.jsx(h6e,{metricName:l,data:c,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s},l)})})}function m6e({metricName:t,data:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:a=0}){const o=T.useRef(null),l=T.useRef(null),c=T.useRef(null),[d,h]=T.useState(!1),[g,v]=T.useState(null),[b,_]=T.useState(null),w=NT[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:S,seriesConfig:E,hasData:A,serverIds:N,timeRange:D,outlierBounds:P}=T.useMemo(()=>{if(e.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:[],timeRange:s??{start:0,end:1},outlierBounds:null};const O=new Set;let W=1/0,F=-1/0;const V=[];for(const j of e)O.add(j.server),j.timestamp<W&&(W=j.timestamp),j.timestamp>F&&(F=j.timestamp),V.push(j.value);const G=Array.from(O).sort((j,X)=>j-X),Z=s??{start:W,end:F},B={},q=new Set;for(const j of e)q.add(j.timestamp),B[j.timestamp]||(B[j.timestamp]={}),B[j.timestamp][j.server]=j.value;const K=Array.from(q).sort((j,X)=>j-X);if(K.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:G,timeRange:Z,outlierBounds:null};const Y=K.map(j=>j-Z.start),Q=[{label:"Time"}],U=[Y];for(let j=0;j<G.length;j++){const X=G[j],H=K.map(ne=>{var re;return((re=B[ne])==null?void 0:re[X])??null}),ie=!!i&&i.size>0&&!i.has(X);U.push(H),Q.push({label:`Server ${X}`,stroke:ie?LS(fs[j%fs.length],.25):fs[j%fs.length],width:ie?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:U,seriesConfig:Q,hasData:!0,serverIds:G,timeRange:Z,outlierBounds:nZ(V)}},[e,s,i]),L=T.useCallback(O=>Math.abs(O)>=1e3?`${parseFloat((O/1e3).toFixed(1))}k`:Number.isInteger(O)?O.toLocaleString():Math.abs(O)<.01&&O!==0?O.toExponential(1):String(parseFloat(O.toFixed(2))),[]);T.useEffect(()=>{if(!o.current||!S||!A)return;const O=o.current,W=O.clientWidth,F=192;let V=Number.POSITIVE_INFINITY,G=Number.NEGATIVE_INFINITY;for(let ne=1;ne<S.length;ne+=1){const re=S[ne];for(let ue=0;ue<re.length;ue+=1){const le=re[ue];le!=null&&(d&&P?le>=P.lower&&le<=P.upper&&(le<V&&(V=le),le>G&&(G=le)):(le<V&&(V=le),le>G&&(G=le)))}}V===Number.POSITIVE_INFINITY&&P&&(V=P.lower,G=P.upper);const Z=G-V,B=Math.max(Math.abs(G),Math.abs(V)),q=Math.max(B*.05,1e-10),K=Math.max(Z*.1,q),Y=[g!==null?g:Math.max(0,V-K),b!==null?b:G+K],Q="rgba(128, 128, 128, 0.15)",U="rgba(100, 100, 100, 0.9)",X={width:W,height:F,padding:[4,24,0,4],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!0,y:!1}},legend:{show:!1},select:{show:!0,left:0,top:0,width:0,height:0},scales:{x:{time:!1,range:(ne,re,ue)=>{const le=D.end-D.start;return le>0?[0,le]:[re,ue]}},y:{range:Y}},axes:[{stroke:U,grid:{stroke:Q,width:1},ticks:{stroke:Q,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:(ne,re,ue,le)=>[ue,le],values:(ne,re)=>re.map(ue=>K0(D.start+Number(ue),D.end-D.start))},{stroke:U,grid:{stroke:Q,width:1},ticks:{stroke:Q,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(ne,re)=>{if(!re||re.length===0)return 40;const ue=Math.max(...re.map(le=>le.length));return Math.max(40,ue*7+14)},values:(ne,re)=>re.map(L)}],series:E,hooks:{setCursor:[ne=>{if(!c.current||!o.current)return;const{left:re,idx:ue}=ne.cursor;if(ue==null||re===void 0||re<0){c.current.style.display="none";return}const le=S[0][ue];if(le===void 0){c.current.style.display="none";return}const fe=S[0],we=(()=>{const Ee=ne.scales.x,Pe=Number(Ee.min),Ze=Number(Ee.max);if(!Number.isFinite(Pe)||!Number.isFinite(Ze))return null;const ae=Math.abs(Ze-Pe);if(ae<=0)return null;const te=Math.max(1,ne.bbox.width);return ae*eZ/te})(),pe=JK(Number(le)+a),xe=D.start+Number(le);let ye=`<div class="font-medium mb-1">${K0(xe,D.end-D.start)}</div>`;ye+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${pe}</div>`,ye+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${xe.toFixed(3)}</div>`;let Oe=!1;for(let Ee=0;Ee<N.length;Ee+=1){const Pe=S[Ee+1],Ze=tZ(Pe,fe,ue,we);if(Ze===null)continue;const ae=Pe==null?void 0:Pe[Ze];if(ae==null)continue;Oe=!0;const te=qu(ae);ye+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${fs[Ee%fs.length]}"></div>
                  <span class="text-muted-foreground">Server ${N[Ee]}:</span>
                  <span class="font-medium">${te} ${w.unit}</span>
                </div>
              `}if(!Oe){c.current.style.display="none";return}c.current.innerHTML=ye,c.current.style.display="block";const he=o.current.getBoundingClientRect(),Re=c.current.getBoundingClientRect();let oe=he.left+re+15;oe+Re.width+20>window.innerWidth&&(oe=he.left+re-Re.width-15+ne.bbox.left),oe=Math.max(4,oe);let Ue=he.top-Re.height+20;Ue<4&&(Ue=he.bottom-20),c.current.style.left=`${oe}px`,c.current.style.top=`${Ue}px`}]}};l.current&&l.current.destroy();const H=new ma(X,S,O);l.current=H;const ie=new ResizeObserver(ne=>{for(const re of ne){const{width:ue}=re.contentRect;H&&ue>0&&H.setSize({width:ue,height:F})}});return ie.observe(O),()=>{ie.disconnect(),H.destroy(),l.current=null}},[S,A,E,t,D,a,w.unit,N,L,d,P,g,b]);const R=T.useCallback(()=>{c.current&&(c.current.style.display="none")},[]);return p.jsxs("div",{className:Rt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white",n&&"opacity-60"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2",children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[p.jsx("h4",{className:"text-xs font-medium truncate",title:t,children:w.label}),d&&p.jsx(M1,{label:"Ignore Outliers",onRemove:()=>h(!1)}),g!==null&&p.jsx(M1,{label:`Min Y: ${g}`,onRemove:()=>v(null)}),b!==null&&p.jsx(M1,{label:`Max Y: ${b}`,onRemove:()=>_(null)})]}),p.jsx("div",{className:"flex items-center gap-2",children:p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsx("button",{className:"h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all opacity-0 group-hover/chart:opacity-100",children:p.jsx(aw,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(vi,{checked:d,onCheckedChange:h,children:"Ignore Outliers"}),p.jsx(Hl,{}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),p.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:g??"",onChange:O=>{const W=O.target.value;v(W===""?null:Number(W))},onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation()})]}),p.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[p.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),p.jsx("input",{type:"number",className:"w-20 h-6 px-2 text-xs rounded border border-border bg-background focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Auto",value:b??"",onChange:O=>{const W=O.target.value;_(W===""?null:Number(W))},onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation()})]})]})]})})]}),A?p.jsxs("div",{className:"h-48 relative bg-white rounded",ref:o,onMouseLeave:R,children:[r&&p.jsx(Kd,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-gray-600"}),p.jsx("div",{ref:c,className:"fixed z-[9999] max-w-[360px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}})]}):p.jsx("div",{className:"h-48 flex items-center justify-center text-muted-foreground text-xs rounded",children:n?"Loading...":`No data for ${w.label}`})]})}function g6e({data:t,activeServerIds:e,onServerHover:n,onServerToggle:r}){const i=T.useMemo(()=>{const s=new Set;for(const o of t)s.add(o.server);return Array.from(s).sort((o,l)=>o-l).map((o,l)=>({serverId:o,label:`Server ${o}`,color:fs[l%fs.length]}))},[t]);return i.length<=1?null:p.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mb-3",children:i.map(s=>{const a=!!(e!=null&&e.has(s.serverId)),o=!!e&&e.size>0&&!a;return p.jsxs("div",{className:Rt("flex items-center gap-1.5 select-none transition-opacity duration-150",r&&"cursor-pointer",a&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:o?.3:1},onPointerEnter:n?()=>n(s.serverId):void 0,onPointerLeave:n?()=>n(null):void 0,onClick:r?()=>r(s.serverId):void 0,children:[p.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o?LS(s.color,.25):s.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},s.label)})})}function v6e({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:a=0}){const o=T.useMemo(()=>{const c=new Set;for(const h of t)c.add(h.metric_name);for(const h of e??[])c.add(h);const d=gF.filter(h=>c.has(h));for(const h of c)d.includes(h)||d.push(h);return d},[t,e]),l=T.useMemo(()=>o.length>0?o:n?gF:o,[o,n]);return l.length===0&&!n?p.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-gray-200 bg-white",children:"No vLLM metrics data available"}):p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:l.map(c=>{const d=t.filter(h=>h.metric_name===c);return p.jsx(m6e,{metricName:c,data:d,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:a},c)})})}function x6e({nodeId:t,gpuCount:e,children:n}){const[r,i]=T.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return p.jsxs(Ki,{open:r,onOpenChange:i,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!r&&"-rotate-90")}),p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s}),p.jsxs("span",{className:"text-[11px] text-muted-foreground/80",children:[e," GPU",e!==1?"s":""]})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"mt-3",children:n})})]})}function vF({title:t,gpuData:e,gpuMetricNames:n,timeRange:r,nodeGpuMap:i,isLoading:s,isRefetching:a,open:o,onOpenChange:l,nodeMode:c,onNodeModeChange:d,xOffset:h=0}){const[g,v]=T.useState(!0),[b,_]=T.useState("combined"),w=o??g,S=l??v,E=c??b,A=d??_,[N,D]=T.useState(null),[P,L]=T.useState([]),R=i.size>1,O=T.useMemo(()=>{const Y=[],Q=Array.from(i.keys()).sort((U,j)=>U-j);for(const U of Q){const j=[...i.get(U)??[]].sort((X,H)=>X-H);for(const X of j)Y.push({nodeId:U,gpuIndex:X})}return Y.map((U,j)=>({seriesKey:A5(U.nodeId,U.gpuIndex,R),node_id:U.nodeId,gpu_index:U.gpuIndex,label:R?`Node ${U.nodeId} GPU ${U.gpuIndex}`:`GPU ${U.gpuIndex}`,color:R?fs[j%fs.length]:fs[U.gpuIndex%fs.length]}))},[i,R]),W=T.useMemo(()=>{const Y=m7(e,R);return Y.length>0?Y:O},[e,R,O]),F=T.useMemo(()=>{const Y=new Set;for(const Q of e)Y.add(Q.gpu_index);return Array.from(Y).sort((Q,U)=>Q-U)},[e]),V=T.useMemo(()=>{const Y=[],Q=Array.from(i.keys()).sort((U,j)=>U-j);for(const U of Q){const j=i.get(U),X=e.filter(ne=>(typeof ne.node_id=="number"?ne.node_id:null)===U&&j.includes(ne.gpu_index)),H=m7(X,!1),ie=H.length>0?H:j.map(ne=>({seriesKey:A5(U,ne,!1),node_id:U,gpu_index:ne,label:`GPU ${ne}`,color:fs[ne%fs.length]}));Y.push({nodeId:U,gpuIndices:j,data:X,labels:ie})}return Y},[e,i]),G=T.useMemo(()=>{const Y=new Set;return E==="combined"||!R?(W.forEach(Q=>Y.add(Q.seriesKey)),Y):(V.forEach(Q=>{Q.labels.forEach(U=>Y.add(U.seriesKey))}),Y)},[E,R,W,V]),Z=T.useCallback(Y=>{L(Q=>{const U=Q.filter(ne=>!G.has(ne)),j=Q.filter(ne=>G.has(ne)),H=j.includes(Y)?j.filter(ne=>ne!==Y):[...j,Y],ie=G.size>0&&H.length===G.size?[]:H;return[...U,...ie]})},[G]),B=T.useMemo(()=>G.size===0?P:P.filter(Y=>G.has(Y)),[P,G]),q=T.useMemo(()=>N&&(G.size===0||G.has(N))?N:null,[N,G]),K=T.useMemo(()=>B.length>0?new Set(B):q?new Set([q]):null,[B,q]);return p.jsxs(Ki,{open:w,onOpenChange:S,children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(Zi,{asChild:!0,children:p.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!w&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:t})]})}),w&&R&&p.jsxs(Z0,{type:"single",variant:"selecting",size:"sm",value:E,onValueChange:Y=>{Y&&A(Y)},children:[p.jsx(Uo,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"}),p.jsx(Uo,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Nodes"})]})]}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6",children:E==="combined"||!R?p.jsxs(p.Fragment,{children:[p.jsx(g7,{series:W,activeSeriesKeys:K,onSeriesHover:D,onSeriesToggle:Z}),p.jsx(v7,{data:e,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:F,seriesMode:R?"node_gpu":"gpu",isLoading:s,isRefetching:a,activeSeriesKeys:K,xOffset:h})]}):V.map(Y=>p.jsxs(x6e,{nodeId:Y.nodeId,gpuCount:Y.gpuIndices.length,children:[p.jsx(g7,{series:Y.labels,activeSeriesKeys:K,onSeriesHover:D,onSeriesToggle:Z}),p.jsx(v7,{data:Y.data,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:Y.gpuIndices,seriesMode:"gpu",isLoading:s,isRefetching:a,activeSeriesKeys:K,xOffset:h})]},Y.nodeId))})})]})}function y6e({gpuMetrics:t,cpuMetrics:e,vllmMetrics:n,availableGpuMetrics:r,availableCpuMetrics:i,availableVllmMetrics:s,trainerGpus:a,inferenceGpus:o,isLoading:l,isRefetching:c,systemMetricsOpen:d,onSystemMetricsOpenChange:h,cpuMetricsOpen:g,onCpuMetricsOpenChange:v,vllmMetricsOpen:b,onVllmMetricsOpenChange:_,roleMode:w,onRoleModeChange:S,trainerSectionOpen:E,onTrainerSectionOpenChange:A,inferenceSectionOpen:N,onInferenceSectionOpenChange:D,trainerNodeMode:P,onTrainerNodeModeChange:L,inferenceNodeMode:R,onInferenceNodeModeChange:O,overrideTimeRange:W,xOffset:F=0}){const[V,G]=T.useState(!0),[Z,B]=T.useState(!0),[q,K]=T.useState(!0),[Y,Q]=T.useState("separated"),U=d??V,j=h??G,X=g??Z,H=v??B,ie=b??q,ne=_??K,re=w??Y,ue=S??Q,[le,fe]=T.useState(null),[we,pe]=T.useState([]),[xe,Ve]=T.useState(null),[ye,Oe]=T.useState([]),he=T.useMemo(()=>W||u6e(t),[t,W]),Re=T.useMemo(()=>{const ze=new Set(r),Te=p7.filter(ct=>ze.has(ct)),He=pF.filter(ct=>ze.has(ct)),et=new Set([...p7,...pF]),ht=r.filter(ct=>!et.has(ct)).sort();return[...Te,...He,...ht]},[r]),oe=T.useMemo(()=>new Set(a.map(ze=>`${ze.node_id}:${ze.gpu_index}`)),[a]),Ue=T.useMemo(()=>new Set(o.map(ze=>`${ze.node_id}:${ze.gpu_index}`)),[o]),Ee=T.useMemo(()=>oe.size===0?[]:t.filter(ze=>{const Te=typeof ze.node_id=="number"&&Number.isFinite(ze.node_id)?ze.node_id:null;return Te===null?!1:oe.has(`${Te}:${ze.gpu_index}`)}),[t,oe]),Pe=T.useMemo(()=>Ue.size===0?[]:t.filter(ze=>{const Te=typeof ze.node_id=="number"&&Number.isFinite(ze.node_id)?ze.node_id:null;return Te===null?!1:Ue.has(`${Te}:${ze.gpu_index}`)}),[t,Ue]),Ze=T.useMemo(()=>{const ze=new Map;for(const Te of a){const He=ze.get(Te.node_id)??[];He.includes(Te.gpu_index)||He.push(Te.gpu_index),ze.set(Te.node_id,He)}for(const[Te,He]of ze)ze.set(Te,He.sort((et,ht)=>et-ht));return ze},[a]),ae=T.useMemo(()=>{const ze=new Map;for(const Te of o){const He=ze.get(Te.node_id)??[];He.includes(Te.gpu_index)||He.push(Te.gpu_index),ze.set(Te.node_id,He)}for(const[Te,He]of ze)ze.set(Te,He.sort((et,ht)=>et-ht));return ze},[o]),te=T.useMemo(()=>{const ze=new Set;for(const Te of t)ze.add(Te.gpu_index);return Array.from(ze).sort((Te,He)=>Te-He)},[t]),be=T.useMemo(()=>{const ze=new Set;for(const Te of t){const He=typeof Te.node_id=="number"&&Number.isFinite(Te.node_id)?Te.node_id:null;ze.add(He)}return ze.size>1},[t]),me=T.useMemo(()=>m7(t,be),[t,be]),ge=T.useMemo(()=>{if(a.length===0&&o.length===0)return[];const ze=[...a,...o],Te=new Set(ze.map(He=>He.node_id)).size>1;return d6e(ze,Te)},[a,o]),ke=T.useMemo(()=>{const ze=me.length>0?me:ge,Te=new Set(a.map(He=>`${He.node_id}:${He.gpu_index}`));return ze.filter(He=>{const et=`${He.node_id??"?"}:${He.gpu_index}`;return Te.has(et)||Te.has(`${He.node_id}:${He.gpu_index}`)})},[me,ge,a]),Xe=T.useMemo(()=>{const ze=me.length>0?me:ge,Te=new Set(o.map(He=>`${He.node_id}:${He.gpu_index}`));return ze.filter(He=>{const et=`${He.node_id??"?"}:${He.gpu_index}`;return Te.has(et)||Te.has(`${He.node_id}:${He.gpu_index}`)})},[me,ge,o]),Ae=T.useMemo(()=>{const ze={},Te=new Set(a.map(et=>`${et.node_id}:${et.gpu_index}`)),He=new Set(o.map(et=>`${et.node_id}:${et.gpu_index}`));if(be)for(const et of t){const ht=typeof et.node_id=="number"&&Number.isFinite(et.node_id)?et.node_id:null,ct=`${ht??"?"}:${et.gpu_index}`,bt=`${ht}:${et.gpu_index}`;Te.has(bt)||Te.has(ct)?ze[ct]="Trainer":(He.has(bt)||He.has(ct))&&(ze[ct]="Inference")}else{for(const et of a)ze[`gpu:${et.gpu_index}`]="Trainer";for(const et of o)ze[`gpu:${et.gpu_index}`]="Inference"}return ze},[t,a,o,be]),je=a.length>0||o.length>0,We=Ee.length>0||!!l&&a.length>0,De=Pe.length>0||!!l&&o.length>0,Be=T.useMemo(()=>{if(!je)return me;const ze=new Map;for(const Te of ke)ze.set(Te.seriesKey,Te);for(const Te of Xe)ze.set(Te.seriesKey,Te);return Array.from(ze.values())},[je,me,ke,Xe]),qe=T.useMemo(()=>new Set(Be.map(ze=>ze.seriesKey)),[Be]),Se=T.useMemo(()=>qe.size===0?we:we.filter(ze=>qe.has(ze)),[we,qe]),Ye=T.useCallback(ze=>{pe(Te=>{const He=Te.filter(wt=>!qe.has(wt)),et=Te.filter(wt=>qe.has(wt)),ct=et.includes(ze)?et.filter(wt=>wt!==ze):[...et,ze],bt=qe.size>0&&ct.length===qe.size?[]:ct;return[...He,...bt]})},[qe]),dt=T.useMemo(()=>le&&(qe.size===0||qe.has(le))?le:null,[le,qe]),Le=T.useMemo(()=>Se.length>0?qe.size>0&&Se.length===qe.size?null:new Set(Se):dt?new Set([dt]):null,[Se,dt,qe]),st=T.useMemo(()=>{const ze=new Set;for(const Te of n??[])ze.add(Te.server);return ze},[n]),ft=T.useMemo(()=>st.size===0?ye:ye.filter(ze=>st.has(ze)),[ye,st]),mt=T.useCallback(ze=>{Oe(Te=>{const He=Te.filter(wt=>!st.has(wt)),et=Te.filter(wt=>st.has(wt)),ct=et.includes(ze)?et.filter(wt=>wt!==ze):[...et,ze],bt=st.size>0&&ct.length===st.size?[]:ct;return[...He,...bt]})},[st]),tt=T.useMemo(()=>xe===null?null:st.size===0||st.has(xe)?xe:null,[xe,st]),Qe=T.useMemo(()=>ft.length>0?st.size>0&&ft.length===st.size?null:new Set(ft):tt!==null?new Set([tt]):null,[ft,tt,st]);return p.jsxs("div",{className:"space-y-4",children:[p.jsxs(Ki,{open:U,onOpenChange:j,children:[p.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!U&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"GPU Metrics"})]})})}),U&&je&&p.jsxs(Z0,{type:"single",variant:"selecting",size:"sm",value:re,onValueChange:ze=>{ze&&ue(ze)},children:[p.jsx(Uo,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Trainer/Inference"}),p.jsx(Uo,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"})]})]}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:re==="combined"||!je?p.jsxs(p.Fragment,{children:[je?p.jsx(f6e,{trainerLabels:ke,inferenceLabels:Xe,activeSeriesKeys:Le,onSeriesHover:fe,onSeriesToggle:Ye}):p.jsx(g7,{series:me,activeSeriesKeys:Le,onSeriesHover:fe,onSeriesToggle:Ye}),p.jsx(v7,{data:t,metricNames:Re,intervalStart:he.start,intervalEnd:he.end,gpuIndices:te,seriesMode:be?"node_gpu":"gpu",isLoading:l,isRefetching:c,seriesRoles:je?Ae:void 0,activeSeriesKeys:Le,xOffset:F})]}):p.jsxs(p.Fragment,{children:[We&&p.jsx(vF,{title:"Trainer",gpuData:Ee,gpuMetricNames:Re,timeRange:he,nodeGpuMap:Ze,isLoading:l,isRefetching:c,open:E,onOpenChange:A,nodeMode:P,onNodeModeChange:L,xOffset:F}),De&&p.jsxs(p.Fragment,{children:[We&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsx(vF,{title:"Inference",gpuData:Pe,gpuMetricNames:Re,timeRange:he,nodeGpuMap:ae,isLoading:l,isRefetching:c,open:N,onOpenChange:D,nodeMode:R,onNodeModeChange:O,xOffset:F})]}),!l&&Ee.length===0&&Pe.length===0&&p.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-gray-200 bg-white",children:"No GPU data matches the trainer/inference role configuration"})]})})})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:X,onOpenChange:H,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!X&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"CPU Metrics"})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"mt-3 mb-4",children:p.jsx(p6e,{data:e,availableMetricNames:i,isLoading:l,isRefetching:c,overrideTimeRange:W,xOffset:F})})})]}),n&&n.length>0||s&&s.length>0||l?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:ie,onOpenChange:ne,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Vr,{className:Rt("h-4 w-4 text-muted-foreground transition-transform",!ie&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"vLLM Metrics"})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[p.jsx(g6e,{data:n??[],activeServerIds:Qe,onServerHover:Ve,onServerToggle:mt}),p.jsx(v6e,{data:n??[],availableMetricNames:s,isLoading:l,isRefetching:c,activeServerIds:Qe,overrideTimeRange:W,xOffset:F})]})})]})]}):null]})}function b6e(t){if(!t||typeof t!="string")return null;const e=t.split(`
`);if(e.length===0)return null;const n=e[0].match(/^(\w[\w.]*)(\(.*)?$/);if(!n)return null;const r={name:"",type:n[1],args:"",children:[],depth:0,repeatCount:1,estimatedParams:0};if(e.length===1){const s=e[0].match(/^\w[\w.]*\((.+)\)\s*$/);return r.args=s?s[1]:"",r.estimatedParams=$6(r.type,r.args),r}const i=[r];for(let s=1;s<e.length;s++){const o=e[s].trimStart();if(!o||o===")"){o===")"&&i.length>1&&i.pop();continue}const l=o.match(/^\(([^)]*)\):\s*(\d+)\s*x\s+(\w[\w.]*)\((.*)$/);if(l){const b=l[1],_=parseInt(l[2],10),w=l[3];let S=l[4];const E=i[i.length-1];if(S.endsWith(")")){S=S.slice(0,-1);const A={name:b,type:w,args:S,children:[],depth:i.length,repeatCount:_,estimatedParams:0};A.estimatedParams=$6(w,S),E.children.push(A)}else{const A={name:b,type:w,args:"",children:[],depth:i.length,repeatCount:_,estimatedParams:0};E.children.push(A),i.push(A)}continue}const c=o.match(/^\(([^)]*)\):\s*(\w[\w.]*)\((.*)$/);if(!c)continue;const d=c[1],h=c[2];let g=c[3];const v=i[i.length-1];if(g.endsWith(")")){g=g.slice(0,-1);const b={name:d,type:h,args:g,children:[],depth:i.length,repeatCount:1,estimatedParams:0};b.estimatedParams=$6(h,g),v.children.push(b)}else{const b={name:d,type:h,args:"",children:[],depth:i.length,repeatCount:1,estimatedParams:0};v.children.push(b),i.push(b)}}return rZ(r),sZ(r),r}function xF(t){return/^\d+(-\d+)?$/.test(t)}function rZ(t){for(const r of t.children)rZ(r);if(t.children.length<2)return;const e=[];let n=0;for(;n<t.children.length;){const r=t.children[n];let i=1;for(;n+i<t.children.length&&xF(r.name)&&xF(t.children[n+i].name)&&iZ(r,t.children[n+i]);)i++;if(i>1){const s={...r,repeatCount:i};e.push(s)}else e.push(r);n+=i}t.children=e}function iZ(t,e){if(t.type!==e.type||t.args!==e.args||t.children.length!==e.children.length)return!1;for(let n=0;n<t.children.length;n++)if(!iZ(t.children[n],e.children[n]))return!1;return!0}function sZ(t){if(t.children.length===0)return t.estimatedParams*(t.repeatCount||1);let e=0;for(const n of t.children)e+=sZ(n);return t.estimatedParams=e,e*(t.repeatCount||1)}function $6(t,e){var s;if(!e)return 0;const n=((s=e.match(/\d+/g))==null?void 0:s.map(Number))??[],r=!e.includes("bias=False"),i=t.toLowerCase();if(i==="linear"&&n.length>=2){const a=n[0]*n[1];return r?a+n[1]:a}if(i==="embedding"&&n.length>=2)return n[0]*n[1];if((i.includes("norm")||i.includes("layernorm")||i.includes("rmsnorm"))&&n.length>=1){const a=n[0];return i.includes("rmsnorm")?a:r?a*2:a}if(i.startsWith("conv")&&n.length>=3){const[a,o,l]=n,c=a*o*l*(n[3]??l);return r?c+o:c}return 0}function _6e(t){const e={modelName:t.type,totalParams:0,numLayers:0,hiddenSize:null,vocabSize:null,intermediateSize:null,numAttentionHeads:null,numKvHeads:null,layerTypeCounts:{},paramsByCategory:{embedding:0,attention:0,feedforward:0,normalization:0,output:0,positional:0,activation:0,other:0}};return aZ(t,e,1),e}function aZ(t,e,n){var i,s;const r=(t.repeatCount||1)*n;if(t.children.length===0&&t.type){const a=t.type;e.layerTypeCounts[a]=(e.layerTypeCounts[a]||0)+r,e.totalParams+=t.estimatedParams*r;const o=S6e(t);e.paramsByCategory[o]+=t.estimatedParams*r;const l=((i=t.args.match(/\d+/g))==null?void 0:i.map(Number))??[],c=t.type.toLowerCase();if(c==="embedding"&&l.length>=2&&((!e.vocabSize||l[0]>e.vocabSize)&&(e.vocabSize=l[0]),e.hiddenSize||(e.hiddenSize=l[1])),c==="linear"&&l.length>=2){const d=Math.max(l[0],l[1]);e.hiddenSize&&d>e.hiddenSize&&(!e.intermediateSize||d>e.intermediateSize)&&(e.intermediateSize=d)}}else if(t.children.length>0){t.repeatCount>1&&t.depth>0&&(e.numLayers=Math.max(e.numLayers,t.repeatCount));for(const a of t.children)aZ(a,e,r)}if(t.children.length>0){const a=t.name.toLowerCase();if(a.includes("attn")||a.includes("attention")){for(const o of t.children)if(o.type.toLowerCase()==="linear"){const l=((s=o.args.match(/\d+/g))==null?void 0:s.map(Number))??[];if(l.length>=2){const c=o.name.toLowerCase();c.includes("q_proj")&&!e.numAttentionHeads&&e.hiddenSize,c.includes("k_proj")&&!e.numKvHeads&&e.hiddenSize&&l[1]<(e.hiddenSize??1/0)}}}}}function S6e(t){const e=t.type.toLowerCase(),n=t.name.toLowerCase();return e==="embedding"||n.includes("embed")?"embedding":e.includes("attention")||n.includes("attn")||n.includes("attention")||n.includes("q_proj")||n.includes("k_proj")||n.includes("v_proj")||n.includes("o_proj")?"attention":n.includes("mlp")||n.includes("feed_forward")||n.includes("ffn")||n.includes("gate_proj")||n.includes("up_proj")||n.includes("down_proj")||n.includes("fc1")||n.includes("fc2")?"feedforward":e.includes("norm")||n.includes("norm")?"normalization":n.includes("lm_head")||n.includes("output")||n.includes("head")?"output":e.includes("rotary")||e.includes("rope")||n.includes("rotary")||n.includes("rope")||n.includes("pos")?"positional":e.includes("relu")||e.includes("gelu")||e.includes("silu")||e.includes("swish")||e.includes("activation")||e==="silu"||e==="gelu"||e==="relu"?"activation":"other"}function uy(t){return t>=1e12?`${(t/1e12).toFixed(1)}T`:t>=1e9?`${(t/1e9).toFixed(1)}B`:t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(0)}K`:t>0?`${t}`:"0"}function oZ(t,e){if(!e)return"";let n=e;return n=n.replace(/in_features=/g,""),n=n.replace(/out_features=/g,""),n=n.replace(/num_embeddings=/g,""),n=n.replace(/embedding_dim=/g,""),n=n.replace(/,\s*bias=False/g,""),n=n.replace(/bias=False,?\s*/g,""),n=n.replace(/\((\d+),?\)/g,"$1"),t.toLowerCase().includes("norm")&&(n=n.replace(/,?\s*eps=[\d.eE+-]+/g,"")),n=n.replace(/,\s*$/,"").replace(/^\s*,\s*/,"").trim(),n}const yF={embedding:{border:"border-l-violet-500",bg:"bg-violet-500/10",text:"text-violet-600 dark:text-violet-400",bar:"bg-violet-500"},attention:{border:"border-l-blue-500",bg:"bg-blue-500/10",text:"text-blue-600 dark:text-blue-400",bar:"bg-blue-500"},feedforward:{border:"border-l-amber-500",bg:"bg-amber-500/10",text:"text-amber-600 dark:text-amber-400",bar:"bg-amber-500"},normalization:{border:"border-l-emerald-500",bg:"bg-emerald-500/10",text:"text-emerald-600 dark:text-emerald-400",bar:"bg-emerald-500"},output:{border:"border-l-rose-500",bg:"bg-rose-500/10",text:"text-rose-600 dark:text-rose-400",bar:"bg-rose-500"},positional:{border:"border-l-cyan-500",bg:"bg-cyan-500/10",text:"text-cyan-600 dark:text-cyan-400",bar:"bg-cyan-500"},activation:{border:"border-l-orange-500",bg:"bg-orange-500/10",text:"text-orange-600 dark:text-orange-400",bar:"bg-orange-500"},other:{border:"border-l-gray-500",bg:"bg-gray-500/10",text:"text-gray-600 dark:text-gray-400",bar:"bg-gray-500"}},bF={self_attn:"Self Attention",q_proj:"Q Proj",k_proj:"K Proj",v_proj:"V Proj",o_proj:"O Proj",gate_proj:"Gate Proj",up_proj:"Up Proj",down_proj:"Down Proj",act_fn:"Activation",input_layernorm:"Input LayerNorm",post_attention_layernorm:"Post-Attention LayerNorm",embed_tokens:"Embed Tokens",rotary_emb:"Rotary Embedding",lm_head:"LM Head",mlp:"MLP",norm:"Norm",model:"Model",layers:"Layers"};function DE(t){return t?bF[t]?bF[t]:t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function w6e(t){const e=[];function n(i){return i.name===""||i.name==="model"&&i.children.length>0||(i.type==="ModuleList"||i.type==="Sequential")&&i.children.length>0}function r(i){if(n(i))for(const s of i.children)r(s);else e.push(i)}return r(t),e}function N5(){return p.jsx("div",{className:"w-px h-4 bg-border mx-auto"})}function M6e({node:t}){const e=DE(t.name)||t.type,n=oZ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?uy(t.estimatedParams):null;return p.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full text-center",children:[p.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),r&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 break-all",children:r}),i&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:i})]})}function T6e({node:t}){const e=DE(t.name)||t.type,n=oZ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?uy(t.estimatedParams):null;return p.jsxs("div",{className:"rounded-md border bg-background px-2.5 py-2 flex-1 min-w-0 text-center",children:[p.jsx("div",{className:"text-xs font-medium text-foreground",children:e}),r&&p.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5 break-all",children:r}),i&&p.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:i})]})}function E6e({node:t}){const e=DE(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?uy(t.estimatedParams):null;return p.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full text-center",children:[p.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),n&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:n}),r&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r}),p.jsx("div",{className:"flex gap-1.5 flex-wrap mt-2",children:t.children.map((i,s)=>p.jsx(T6e,{node:i},s))})]})}function G9({node:t}){return t.children.length===0?p.jsx(M6e,{node:t}):t.repeatCount>1?p.jsx(C6e,{node:t}):t.children.every(n=>n.children.length===0)?p.jsx(E6e,{node:t}):p.jsx(A6e,{node:t})}function C6e({node:t}){return p.jsxs("div",{className:"relative w-full",children:[p.jsx("div",{className:"rounded-lg border-2 border-dashed border-muted-foreground/25 p-3 w-full",children:p.jsx("div",{className:"flex flex-col items-center w-full",children:t.children.map((e,n)=>p.jsxs("div",{className:"flex flex-col items-center w-full",children:[n>0&&p.jsx(N5,{}),p.jsx(G9,{node:e})]},n))})}),p.jsx("div",{className:"absolute left-full top-1/2 -translate-y-1/2 pl-5 pointer-events-none select-none",children:p.jsxs("span",{className:"text-4xl font-extralight text-muted-foreground/50 whitespace-nowrap leading-tight",children:["×",t.repeatCount,p.jsx("br",{}),p.jsx("span",{className:"text-2xl",children:"layers"})]})})]})}function A6e({node:t}){const e=DE(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?uy(t.estimatedParams):null;return p.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full",children:[p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),n&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:n}),r&&p.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r})]}),p.jsx("div",{className:"flex flex-col items-center w-full mt-2",children:t.children.map((i,s)=>p.jsxs("div",{className:"flex flex-col items-center w-full",children:[s>0&&p.jsx(N5,{}),p.jsx(G9,{node:i})]},s))})]})}function N6e({root:t}){const e=T.useMemo(()=>w6e(t),[t]);return p.jsxs("div",{className:"flex flex-col items-center py-8 px-6 max-w-2xl mx-auto",children:[p.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Input"}),e.map((n,r)=>p.jsxs("div",{className:"flex flex-col items-center w-full",children:[p.jsx(N5,{}),p.jsx(G9,{node:n})]},r)),p.jsx(N5,{}),p.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Output"})]})}function R6e({stats:t,rawRepr:e}){const[n,r]=T.useState(!1),i=t.totalParams,s=T.useMemo(()=>Object.entries(t.paramsByCategory).filter(([,o])=>o>0).sort((o,l)=>l[1]-o[1]),[t.paramsByCategory]),a=T.useMemo(()=>Object.entries(t.layerTypeCounts).sort((o,l)=>l[1]-o[1]),[t.layerTypeCounts]);return p.jsxs("div",{className:"w-72 shrink-0 border-l overflow-y-auto p-4 space-y-5",children:[p.jsxs("div",{children:[p.jsx("h2",{className:"text-base font-semibold",children:t.modelName}),i>0&&p.jsxs("p",{className:"text-sm text-muted-foreground",children:["~",uy(i)," parameters"]})]}),(t.numLayers>0||t.hiddenSize||t.vocabSize)&&p.jsxs("div",{children:[p.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Architecture"}),p.jsxs("div",{className:"space-y-1 text-sm",children:[t.numLayers>0&&p.jsx(CM,{label:"Layers",value:String(t.numLayers)}),t.hiddenSize&&p.jsx(CM,{label:"Hidden size",value:t.hiddenSize.toLocaleString()}),t.vocabSize&&p.jsx(CM,{label:"Vocab size",value:t.vocabSize.toLocaleString()}),t.intermediateSize&&p.jsx(CM,{label:"Intermediate",value:t.intermediateSize.toLocaleString()})]})]}),i>0&&s.length>0&&p.jsxs("div",{children:[p.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Parameters"}),p.jsx("div",{className:"flex h-2 rounded-full overflow-hidden mb-2.5",children:s.map(([o,l])=>p.jsx("div",{className:`${yF[o].bar}`,style:{width:`${l/i*100}%`,minWidth:l>0?"2px":0}},o))}),p.jsx("div",{className:"space-y-0.5",children:s.map(([o,l])=>p.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[p.jsx("div",{className:`w-2 h-2 rounded-sm shrink-0 ${yF[o].bar}`}),p.jsx("span",{className:"capitalize text-muted-foreground",children:o}),p.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:[uy(l)," (",(l/i*100).toFixed(0),"%)"]})]},o))})]}),a.length>0&&p.jsxs("div",{children:[p.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Layer Types"}),p.jsx("div",{className:"space-y-0.5",children:a.map(([o,l])=>p.jsxs("div",{className:"flex items-center text-xs",children:[p.jsx("span",{className:"text-foreground",children:o}),p.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:["×",l]})]},o))})]}),p.jsxs(Ki,{open:n,onOpenChange:r,children:[p.jsxs(Zi,{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider hover:text-foreground transition-colors",children:[n?p.jsx(Vr,{className:"size-3"}):p.jsx(f1,{className:"size-3"}),"Raw repr"]}),p.jsx(Qi,{children:p.jsx("pre",{className:"mt-2 text-[10px] leading-tight bg-muted/50 rounded-md p-2 overflow-x-auto max-h-96 overflow-y-auto whitespace-pre font-sans",children:e})})]})]})}function CM({label:t,value:e}){return p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:t}),p.jsx("span",{className:"font-medium tabular-nums",children:e})]})}function k6e({modelRepr:t}){const e=T.useMemo(()=>b6e(t),[t]),n=T.useMemo(()=>e?_6e(e):null,[e]);return!e||!n?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx(Hle,{className:"size-8 text-muted-foreground mx-auto mb-2"}),p.jsx("div",{className:"text-sm text-muted-foreground",children:"Could not parse model architecture"})]})}):p.jsxs("div",{className:"flex h-full",children:[p.jsx("div",{className:"flex-1 overflow-auto",children:p.jsx(N6e,{root:e})}),p.jsx(R6e,{stats:n,rawRepr:t})]})}function lZ(t){return j9(t==null?void 0:t.setup)}function P6e(t){const e=lZ(t),n=[],r=mi(e==null?void 0:e.trainer),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const a=mi(s);if(!a)continue;const o=Er(a.node_id);if(o===null)continue;const l=Array.isArray(a.gpus)?a.gpus:[];for(const c of l){const d=mi(c);if(!d)continue;const h=Er(d.gpu_index);h!==null&&n.push({node_id:o,gpu_index:h})}}return n}function I6e(t){const e=lZ(t),n=[],r=mi(e==null?void 0:e.inference),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const a=mi(s);if(!a)continue;const o=Er(a.node_id);if(o===null)continue;const l=Array.isArray(a.gpus)?a.gpus:[];for(const c of l){const d=mi(c);if(!d)continue;const h=Er(d.gpu_index);h!==null&&n.push({node_id:o,gpu_index:h})}}return n}const D6e=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],O6e=[1,5,10,30,60,120,300],q6=gT;function L6e(t){const e=t.trim();if(!e)return null;const n=/^(?:(\d+)\s*h)?\s*(?:(\d+)\s*m)?\s*(?:(\d+)\s*s)?$/i,r=e.match(n);if(r&&(r[1]||r[2]||r[3])){const s=parseInt(r[1]||"0",10),a=parseInt(r[2]||"0",10),o=parseInt(r[3]||"0",10),l=s*3600+a*60+o;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function AM(t){if(t<1)return`${t}s`;if(t<60)return`${Math.round(t)}s`;const e=Math.floor(t/60),n=Math.round(t%60);return n===0?`${e}m`:`${e}m ${n}s`}function z6e(t){const e=t.trim().toLowerCase();if(!e)return null;const n=e.match(/^(\d+(?:\.\d+)?)\s*ms$/i);if(n){const a=parseFloat(n[1]);return a>0?a/1e3:null}const r=/^(?:(\d+)\s*m)?\s*(?:(\d+(?:\.\d+)?)\s*s)?$/i,i=e.match(r);if(i&&(i[1]||i[2])){const a=parseInt(i[1]||"0",10),o=parseFloat(i[2]||"0"),l=a*60+o;return l>0?l:null}const s=parseFloat(e);return Number.isFinite(s)&&s>0?s:null}function j6e(t,e){if(e<=0||t.length===0)return t;const n=new Map;for(const i of t){const s=`${i.metric_name}|${i.gpu_index}|${i.node_id??""}`;let a=n.get(s);a||(a={key:{metric_name:i.metric_name,gpu_index:i.gpu_index,node_id:i.node_id,source:i.source,rank:i.rank,local_rank:i.local_rank},entries:[]},n.set(s,a)),a.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((a,o)=>a.timestamp-o.timestamp);const s=new Map;for(const a of i.entries){const o=Math.floor(a.timestamp/e);let l=s.get(o);l||(l={sum:0,count:0,ts:0},s.set(o,l)),l.sum+=a.value,l.count+=1,l.ts+=a.timestamp}for(const a of s.values())r.push({...i.key,timestamp:a.ts/a.count,value:a.sum/a.count})}return r}function F6e(t,e){if(e<=0||t.length===0)return t;const n=new Map;for(const i of t){const s=`${i.metric_name}|${i.node_id??""}`;let a=n.get(s);a||(a={key:{metric_name:i.metric_name,node_id:i.node_id,source:i.source},entries:[]},n.set(s,a)),a.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((a,o)=>a.timestamp-o.timestamp);const s=new Map;for(const a of i.entries){const o=Math.floor(a.timestamp/e);let l=s.get(o);l||(l={sum:0,count:0,ts:0},s.set(o,l)),l.sum+=a.value,l.count+=1,l.ts+=a.timestamp}for(const a of s.values())r.push({...i.key,timestamp:a.ts/a.count,value:a.sum/a.count})}return r}function U6e(t,e){if(e<=0||t.length===0)return t;const n=new Map;for(const i of t){const s=`${i.metric_name}|${i.server}`;let a=n.get(s);a||(a={key:{metric_name:i.metric_name,server:i.server,node_id:i.node_id,tp_group_id:i.tp_group_id,tp_size:i.tp_size},entries:[]},n.set(s,a)),a.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((a,o)=>a.timestamp-o.timestamp);const s=new Map;for(const a of i.entries){const o=Math.floor(a.timestamp/e);let l=s.get(o);l||(l={sum:0,count:0,ts:0},s.set(o,l)),l.sum+=a.value,l.count+=1,l.ts+=a.timestamp}for(const a of s.values())r.push({...i.key,timestamp:a.ts/a.count,value:a.sum/a.count})}return r}function B6e({value:t,onChange:e}){const[n,r]=T.useState(!1),[i,s]=T.useState(""),a=T.useRef(null),o=c=>{c&&(s(q6(t)),setTimeout(()=>{var d;return(d=a.current)==null?void 0:d.select()},0)),r(c)},l=()=>{const c=L6e(i);c!==null&&(e(c),r(!1))};return p.jsxs(aT,{open:n,onOpenChange:o,children:[p.jsx(oT,{asChild:!0,children:p.jsxs("button",{className:"inline-flex items-center gap-1 rounded-lg border border-input bg-transparent px-2 h-7 text-xs hover:bg-accent transition-colors select-none whitespace-nowrap",children:[q6(t),p.jsx(Vr,{className:"size-3 text-muted-foreground"})]})}),p.jsxs(lT,{align:"start",className:"w-40 p-1.5 gap-1",children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("input",{ref:a,type:"text",value:i,onChange:c=>s(c.target.value),onKeyDown:c=>{c.key==="Enter"&&l()},className:"h-7 w-full rounded-md border border-input bg-transparent px-2 text-xs outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[2px]",placeholder:"e.g. 30s, 2m, 1h"}),p.jsx("button",{onClick:l,className:"shrink-0 h-7 px-2 rounded-md text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors",children:"Go"})]}),p.jsx("div",{className:"flex flex-col",children:O6e.map(c=>p.jsx("button",{onClick:()=>{e(c),r(!1)},className:`text-left rounded-md px-2 py-1 text-xs transition-colors ${c===t?"bg-accent text-accent-foreground font-medium":"hover:bg-accent hover:text-accent-foreground"}`,children:q6(c)},c))})]})]})}function H6e(){var wt;const[t,e]=T.useState(null),n=T.useRef(0),r=ki(ml),i=!0,[s,a]=cn($ce),[o,l]=cn(qce),[c,d]=cn(Xce),[h,g]=cn(Yce),[v,b]=cn(Kce),[_,w]=cn(Zce),[S,E]=cn(Qce),[A,N]=cn(Jce),[D,P]=cn(eue),[L,R]=cn(tue),[O,W]=cn(aue),[F,V]=cn(nue),[G,Z]=cn(rue),[B,q]=cn(iue),[K,Y]=cn(sue),[Q,U]=T.useState(AM(_));T.useEffect(()=>{t&&(t.scrollTop=S,n.current=S)},[t]),T.useEffect(()=>{if(!t)return;const Pt=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",Pt,{passive:!0}),()=>{t.removeEventListener("scroll",Pt),E(n.current)}},[t]);const{data:j,error:X}=ed(r||"",!!r,i),H=T.useMemo(()=>XK(j==null?void 0:j.summary),[j==null?void 0:j.summary]),{data:ie,isFetching:ne,isPlaceholderData:re}=vue(r||"",o,c,h,!!r),ue=!!r&&ie!==void 0,{data:le,isFetching:fe,isPlaceholderData:we}=xue(r||"",o,c,(ie==null?void 0:ie.global_min_time)??null,h,D6e,ue),pe=!!r&&ie!==void 0,{data:xe,isFetching:Ve,isPlaceholderData:ye}=yue(r||"",o,c,(ie==null?void 0:ie.global_min_time)??null,h,null,pe),Oe=(ie==null?void 0:ie.total_pages)??(le==null?void 0:le.total_pages)??null,he=ie,Re=le,oe=xe,[Ue,Ee]=T.useState([]),[Pe,Ze]=T.useState([]),[ae,te]=T.useState([]);T.useEffect(()=>{he!=null&&he.available_metrics&&he.available_metrics.length>0&&Ee(he.available_metrics)},[he==null?void 0:he.available_metrics]),T.useEffect(()=>{Re!=null&&Re.available_metrics&&Re.available_metrics.length>0&&Ze(Re.available_metrics)},[Re==null?void 0:Re.available_metrics]),T.useEffect(()=>{oe!=null&&oe.available_metrics&&oe.available_metrics.length>0&&te(oe.available_metrics)},[oe==null?void 0:oe.available_metrics]);const[be,me]=T.useState(1),[ge,ke]=T.useState(null),[Xe,Ae]=T.useState(null),[je,We]=T.useState(null);T.useEffect(()=>{Oe!==null&&Oe>0&&me(Oe)},[Oe]),T.useEffect(()=>{const Pt=(he==null?void 0:he.global_min_time)??(Re==null?void 0:Re.global_min_time)??null;Pt!==null&&ke(Pt)},[he==null?void 0:he.global_min_time,Re==null?void 0:Re.global_min_time]),T.useEffect(()=>{const Pt=(he==null?void 0:he.interval_start)??(Re==null?void 0:Re.interval_start)??null,$e=(he==null?void 0:he.interval_end)??(Re==null?void 0:Re.interval_end)??null;Pt!==null&&$e!==null&&Ae({start:Pt,end:$e})},[he==null?void 0:he.interval_start,he==null?void 0:he.interval_end,Re==null?void 0:Re.interval_start,Re==null?void 0:Re.interval_end]),T.useEffect(()=>{me(1),ke(null),Ae(null),We(null)},[r]);const De=Oe??be,Be=(he==null?void 0:he.interval_start)??(Re==null?void 0:Re.interval_start)??null,qe=(he==null?void 0:he.interval_end)??(Re==null?void 0:Re.interval_end)??null,Se=(he==null?void 0:he.global_min_time)??(Re==null?void 0:Re.global_min_time)??ge;T.useEffect(()=>{if(h&&Oe!==null&&Oe>0){const Pt=Oe-1;o!==Pt&&l(Pt)}},[h,Oe,o,l]);const Ye=Pt=>{g(!1),l(Pt)},dt=Pt=>{if(!h){const $e=Math.floor(o*c/Pt);l($e)}d(Pt)},Le=()=>{h?g(!1):(g(!0),Oe!==null&&Oe>0&&l(Oe-1))};T.useEffect(()=>{U(AM(_))},[_]);const st=T.useMemo(()=>{const Pt=(he==null?void 0:he.metrics)??[];return!v||_<=0?Pt:j6e(Pt,_)},[he==null?void 0:he.metrics,v,_]),ft=T.useMemo(()=>{const Pt=(Re==null?void 0:Re.metrics)??[];return!v||_<=0?Pt:F6e(Pt,_)},[Re==null?void 0:Re.metrics,v,_]),mt=T.useMemo(()=>{const Pt=(oe==null?void 0:oe.metrics)??[];return!v||_<=0?Pt:U6e(Pt,_)},[oe==null?void 0:oe.metrics,v,_]),tt=T.useMemo(()=>{if(h){const Ot=[],Gt=[];if((he==null?void 0:he.interval_start)!=null&&Gt.push(he.interval_start),(he==null?void 0:he.interval_end)!=null&&Ot.push(he.interval_end),(Re==null?void 0:Re.interval_start)!=null&&Gt.push(Re.interval_start),(Re==null?void 0:Re.interval_end)!=null&&Ot.push(Re.interval_end),(oe==null?void 0:oe.interval_start)!=null&&Gt.push(oe.interval_start),(oe==null?void 0:oe.interval_end)!=null&&Ot.push(oe.interval_end),Ot.length===0)return null;const an=Math.min(...Ot),On=Math.max(Se??an,an-c),Bt=Gt.length>0?Math.max(...Gt):On;return{start:Math.min(an,Math.max(On,Bt)),end:an}}const Pt=(Xe==null?void 0:Xe.start)??null,$e=(Xe==null?void 0:Xe.end)??null,Tt=Be??Pt,Et=qe??$e;return Tt===null||Et===null?null:{start:Tt,end:Et}},[h,he==null?void 0:he.interval_end,he==null?void 0:he.interval_start,Re==null?void 0:Re.interval_end,Re==null?void 0:Re.interval_start,oe==null?void 0:oe.interval_end,oe==null?void 0:oe.interval_start,Se,c,Be,qe,Xe==null?void 0:Xe.start,Xe==null?void 0:Xe.end]);T.useEffect(()=>{tt&&We(tt)},[tt]);const Qe=tt??je,ze=T.useMemo(()=>!Qe||Se===null?0:Qe.start-Se,[Qe,Se]),Te=ne&&re||fe&&we||Ve&&ye,He=ne&&!he||ue&&fe&&!Re||pe&&Ve&&!oe,et=!Te&&!He&&(ne&&!!he||fe&&!!Re||Ve&&!!oe),ht=Te||He,ct=T.useMemo(()=>P6e(j==null?void 0:j.summary),[j==null?void 0:j.summary]),bt=T.useMemo(()=>I6e(j==null?void 0:j.summary),[j==null?void 0:j.summary]);return r?p.jsxs("div",{className:"flex flex-col h-full",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center gap-2 h-7",children:[p.jsxs(Z0,{type:"single",variant:"selecting",size:"sm",value:s,onValueChange:Pt=>{Pt&&a(Pt)},children:[p.jsx(Uo,{value:"metrics",className:"text-xs px-2 py-1 h-7",children:"Metrics"}),p.jsx(Uo,{value:"topology",className:"text-xs px-2 py-1 h-7",children:"Topology"}),p.jsx(Uo,{value:"model",className:"text-xs px-2 py-1 h-7",children:"Model"})]}),s==="metrics"&&p.jsxs(p.Fragment,{children:[p.jsx(jk,{currentPage:o,totalPages:De,onPageChange:Ye}),p.jsx(B6e,{value:c,onChange:dt}),Qe&&p.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[K0(Qe.start,Qe.end-Qe.start)," ","–"," ",K0(Qe.end,Qe.end-Qe.start)]}),p.jsx("button",{onClick:Le,className:`ml-1 inline-flex items-center rounded-lg px-2.5 h-7 text-xs font-medium transition-all select-none whitespace-nowrap ${h?"bg-emerald-500 text-white hover:bg-emerald-600":"bg-accent text-muted-foreground hover:bg-muted hover:text-foreground"}`,children:"Live"}),p.jsx(dS,{label:"Aggregate",variant:"selecting",size:"sm",inputType:"text",enabled:v,onEnabledChange:b,value:Q,onValueChange:U,onValueCommit:Pt=>{const $e=z6e(Pt);$e!==null?(w($e),U(AM($e))):U(AM(_))},inputWidth:"w-10"})]})]})})}),s==="metrics"&&p.jsx("div",{className:"flex-1 overflow-auto p-6",ref:e,children:p.jsxs("div",{className:"max-w-7xl mx-auto",children:[X&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",X instanceof Error?X.message:"Unknown error"]})})}),p.jsx(y6e,{gpuMetrics:st,cpuMetrics:ft,vllmMetrics:mt,availableGpuMetrics:(he==null?void 0:he.available_metrics)??Ue,availableCpuMetrics:(Re==null?void 0:Re.available_metrics)??Pe,availableVllmMetrics:(oe==null?void 0:oe.available_metrics)??ae,trainerGpus:ct,inferenceGpus:bt,isLoading:ht,isRefetching:et,roleMode:A,onRoleModeChange:N,systemMetricsOpen:D,onSystemMetricsOpenChange:P,cpuMetricsOpen:L,onCpuMetricsOpenChange:R,vllmMetricsOpen:O,onVllmMetricsOpenChange:W,trainerSectionOpen:F,onTrainerSectionOpenChange:V,inferenceSectionOpen:G,onInferenceSectionOpenChange:Z,trainerNodeMode:B,onTrainerNodeModeChange:q,inferenceNodeMode:K,onInferenceNodeModeChange:Y,overrideTimeRange:Qe,xOffset:ze})]})}),s==="topology"&&p.jsx("div",{className:"flex-1 overflow-hidden",children:X?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load topology data"}),p.jsx("div",{className:"text-xs text-muted-foreground",children:X instanceof Error?X.message:"Unknown error"})]})}):j?!H||H.nodes.length===0?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No topology data available"}),p.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have setup information in its W&B summary."})]})}):p.jsx("div",{className:"h-full w-full",children:p.jsx(KK,{topology:H})}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading topology…"})})}),s==="model"&&p.jsx("div",{className:"flex-1 overflow-hidden",children:X?p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load model data"}),p.jsx("div",{className:"text-xs text-muted-foreground",children:X instanceof Error?X.message:"Unknown error"})]})}):j?(wt=j.summary)!=null&&wt.model_architecture?p.jsx("div",{className:"h-full w-full",children:p.jsx(k6e,{modelRepr:j.summary.model_architecture})}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No model architecture available"}),p.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have model_architecture in its W&B summary."})]})}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading model architecture…"})})})]}):p.jsx(mm,{description:"Select a run from the sidebar to view infrastructure metrics."})}const cZ=1e4;function d_(t,e){return t*cZ+e}function V6e(){var ke,Xe;const t=ki(ml),[e]=T7(),[n,r]=cn(YI),[i,s]=cn(Gce),[a,o]=cn(KI),[l,c]=cn(ZI),d=ki(QI),[h]=cn(jC),[,g]=cn(JI),v=ki(FC),[b,_]=cn(hT),[w,S]=cn(pT),E=b.length+(w?1:0),A=Ae=>{_(je=>je.includes(Ae)?je.filter(We=>We!==Ae):[...je,Ae])},[N,D]=T.useState(0),[P,L]=T.useState(0),[R,O]=T.useState(!0),W=!0,F=T.useMemo(()=>{const Ae=e.get("step");if(!Ae)return null;const je=Number(Ae);return Number.isFinite(je)?je:null},[e]),V=T.useRef(null);T.useEffect(()=>{if(!t){V.current=null;return}if(F==null){V.current=null;return}F!==V.current&&(r(F),V.current=F)},[F,t,r]);const{data:G,isLoading:Z,error:B}=due(t||"",n,i,!!t),{data:q}=ed(t||"",!!t,W),K=((ke=q==null?void 0:q.summary)==null?void 0:ke.eval_env_details)??((Xe=q==null?void 0:q.config)==null?void 0:Xe.eval_env_details),Y=T.useMemo(()=>gw(K),[K]),Q=T.useMemo(()=>{const Ae=pp(K),je=vw(q==null?void 0:q.data_metric_ranges);return mp(Ae,je)},[K,q==null?void 0:q.data_metric_ranges]),[U,j]=T.useState([]),X=G==null?void 0:G.available_rollout_metric_names,H=X&&X.length>0?X:U;X&&X.length>0&&X!==U&&j(X);const ie=T.useMemo(()=>{if(i)return{prefix:`eval/${i}/`,rewardNames:H,selectedSampleIdx:a}},[i,H,a]);T.useEffect(()=>{if(!G)return;const Ae=G.available_eval_names;Ae.length&&(i&&Ae.includes(i)||s(Ae[0]))},[G==null?void 0:G.available_eval_names,i,s,G]);const ne=T.useMemo(()=>{var Ae;return(Ae=G==null?void 0:G.available_steps)!=null&&Ae.length&&n===null?G.available_steps[G.available_steps.length-1]:null},[G==null?void 0:G.available_steps,n]);T.useEffect(()=>{ne!==null&&n===null&&F==null&&r(ne)},[ne,F,n,r]);const re=Ae=>{r(Ae)},[ue,le]=T.useState([]),[fe,we]=T.useState(null);t!==fe&&(le([]),we(t));const pe=G==null?void 0:G.available_steps,xe=T.useMemo(()=>{const Ae=pe??[];return[...new Set([...ue,...Ae])].sort((We,De)=>We-De)},[pe,ue]);xe.length>ue.length&&le(xe);const Ve=xe.length>0,ye=Ve?xe[xe.length-1]:0,Oe=T.useMemo(()=>{if(n==null)return xe.length-1;const Ae=xe.indexOf(n);return Ae>=0?Ae:xe.length-1},[xe,n]),he=Ae=>{Ae>=0&&Ae<xe.length&&re(xe[Ae])},Re=T.useMemo(()=>{if(G!=null&&G.prompts)return G.prompts.map(Ae=>({step:Ae.step,group_id:Ae.sample_idx,env:Ae.env,system_prompt:Ae.system_prompt,tokens_system_prompt:Ae.tokens_system_prompt,prompt:Ae.prompt,tokens_prompt:Ae.tokens_prompt}))},[G]),oe=T.useMemo(()=>{if(G!=null&&G.rollouts)return G.rollouts.map(Ae=>({step:Ae.step,group_id:Ae.sample_idx,sample_idx:d_(Ae.sample_idx,Ae.completion_idx),turn_order:Ae.turn_order,turn_type:Ae.turn_type,content:Ae.content,tokens:Ae.tokens}))},[G]),Ue=T.useMemo(()=>{if(G!=null&&G.samples_data)return G.samples_data.map(Ae=>({step:Ae.step,group_id:Ae.sample_idx,sample_idx:d_(Ae.sample_idx,Ae.completion_idx),reward:null,advantage:null,turns:Ae.turns,total_tokens:null,raw_string:null}))},[G]),Ee=T.useMemo(()=>{if(G!=null&&G.rollout_metrics)return G.rollout_metrics.map(Ae=>({step:Ae.step,sample_idx:d_(Ae.sample_idx,Ae.completion_idx),env:Ae.env,metric_name:Ae.metric_name,value:Ae.value}))},[G]),Pe=T.useMemo(()=>{if(G!=null&&G.golden_answers)return G.golden_answers.map(Ae=>({step:Ae.step,sample_idx:d_(Ae.sample_idx,Ae.completion_idx),env:Ae.env,key:Ae.key,value:Ae.value}))},[G]),Ze=T.useMemo(()=>{if(G!=null&&G.info_turns)return G.info_turns.map(Ae=>({step:Ae.step,sample_idx:d_(Ae.sample_idx,Ae.completion_idx),turn_order:Ae.turn_order,env:Ae.env,info_key:Ae.info_key,info_value:Ae.info_value,info_type:Ae.info_type}))},[G]),ae=T.useMemo(()=>{if(!(G!=null&&G.samples_data))return new Map;const Ae=new Map;for(const je of G.samples_data)Ae.set(je.sample_idx,(Ae.get(je.sample_idx)??0)+1);return Ae},[G]),te=T.useCallback((Ae,je)=>{const We=ae.get(Ae)??je.samples.length;if(o(Ae),We<=1){const De=je.samples[0];De&&c(De.sample_idx)}else g("samples")},[ae,o,c,g]),be=T.useCallback(()=>{g("groups")},[g]),me=T.useCallback(({viewMode:Ae})=>p.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[Ae==="samples"&&p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:be,children:p.jsx(f8,{className:"h-4 w-4"})}),p.jsxs(Z8,{value:i??"",onValueChange:je=>{s(je),o(null),c(null),g("groups")},children:[p.jsx(J8,{className:"h-7 text-xs min-w-0 flex-1",children:p.jsx(Q8,{placeholder:"Select eval..."})}),p.jsx(ek,{children:((G==null?void 0:G.available_eval_names)??[]).map(je=>p.jsx(tk,{value:je,className:"text-xs",children:je},je))})]})]}),[i,G==null?void 0:G.available_eval_names,s,o,c,g,be]),ge=T.useMemo(()=>{var qe;if(!d)return null;const Ae=((qe=d.sample.turns[0])==null?void 0:qe.step)??n,je=d.sample.group_id,De=d.sample.sample_idx%cZ,Be=ae.get(je)??1;return{step:Ae,evalSampleIdx:je,completionIdx:De,numCompletions:Be}},[d,n,ae]);return t?p.jsxs("div",{className:"flex h-full overflow-hidden",children:[p.jsx(V9,{prompts:Re,data:oe,samplesData:Ue,rolloutMetrics:Ee,availableMetricNames:H,isLoading:Z,step:n??void 0,currentStepIndex:Oe,totalSteps:xe.length,onStepChange:he,hasSteps:Ve,stepValues:xe,openAtom:jC,selectedGroupIdAtom:KI,selectedSampleIdxAtom:ZI,viewModeAtom:JI,renderLeftControls:me,onGroupClick:te,hideRewardAdvantage:!0,envDetailsOverride:K}),p.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[p.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:p.jsx("div",{className:"py-2.5 px-4",children:p.jsxs("div",{className:"flex items-center justify-between h-7",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(H9,{openAtom:jC}),ge&&p.jsxs("div",{className:"text-sm text-muted-foreground",children:[p.jsxs("span",{children:["Step ",ge.step]}),i&&p.jsxs(p.Fragment,{children:[" · ",p.jsx("span",{children:i})]})," · ",p.jsxs("span",{children:["Sample ",ge.evalSampleIdx]}),ge.numCompletions>1&&p.jsxs(p.Fragment,{children:[" · ",p.jsxs("span",{children:["Completion ",ge.completionIdx]})]})]}),(d==null?void 0:d.sample.raw_string)&&p.jsx(GT,{rawString:d.sample.raw_string,totalTokens:d.sample.total_tokens,turns:d.sample.turns.length}),d&&p.jsxs(p.Fragment,{children:[p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{D(Ae=>Ae+1),O(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{L(Ae=>Ae+1),O(!0)},children:"Expand All"}),p.jsxs(fl,{children:[p.jsx(hl,{asChild:!0,children:p.jsxs(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",E>0&&` (${E})`]})}),p.jsxs(pl,{align:"start",className:"w-auto",children:[p.jsx(vi,{checked:w,onCheckedChange:Ae=>S(!!Ae),onSelect:Ae=>Ae.preventDefault(),children:"Format Think"}),p.jsx(vi,{checked:b.includes("markdown"),onCheckedChange:()=>A("markdown"),onSelect:Ae=>Ae.preventDefault(),children:"Markdown"}),p.jsx(vi,{checked:b.includes("latex"),onCheckedChange:()=>A("latex"),onSelect:Ae=>Ae.preventDefault(),children:"LaTeX"}),p.jsx(vi,{checked:b.includes("code"),onCheckedChange:()=>A("code"),onSelect:Ae=>Ae.preventDefault(),children:"Code"})]})]})]})]}),ie&&p.jsx(U9,{openAtom:FC})]})})}),p.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:p.jsxs("div",{className:h||v?"max-w-5xl mx-auto":"",children:[B&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(eh,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",B instanceof Error?B.message:"Unknown error"]})})}),p.jsx(_1,{prompts:Re,data:oe,samplesData:Ue,rolloutMetrics:Ee,goldenAnswers:Pe,infoTurns:Ze,isLoading:Z,step:n??void 0,filterGroupId:a,filterSampleIdx:l,lastValidSampleAtom:QI,collapseAllSignal:N,expandAllSignal:P,defaultSectionsOpen:R,envRewardRanges:Y,envMetricRanges:Q,renderOptions:b,formatThinkBlocks:w})]})})]}),ie&&p.jsx(B9,{currentStep:n,maxSelectableStep:ye,openAtom:FC,selectedMetricsAtom:Wce,selectedStepAtom:YI,evalConfig:ie})]}):p.jsx(mm,{description:"Select a run from the sidebar to view evals."})}function G6e(){return p.jsx("div",{className:"h-full flex items-center justify-center overflow-auto pb-40",children:p.jsxs("div",{className:"max-w-2xl px-6 py-12 text-center",children:[p.jsx("div",{className:"flex items-center justify-center mb-8",children:p.jsx("img",{src:"/logo-full.svg",alt:"Telescope",className:"h-12"})}),p.jsxs("div",{className:"space-y-4 text-base text-foreground/60 leading-relaxed text-justify",children:[p.jsx("p",{children:"Telescope is a framework to post-train LLMs with reinforcement learning for reasoning and agents."}),p.jsx("p",{children:"It comes with a trainer repository to run the training process easily, with a highly configurable setup that supports both simple and complex environments, tested on clusters with hundreds of GPUs."}),p.jsx("p",{children:"This visualization tool provides critical insight into your runs: metrics, rollouts, infrastructure, inference traces, trainer GPU events, and more."}),p.jsx("p",{children:"Telescope is built with a modern stack and focused on infrastructure, observability, scalability, and reliability."}),p.jsxs("p",{children:["You can find the documentation at"," ",p.jsx("a",{href:"https://docs.telescope.training",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-foreground transition-colors",children:"docs.telescope.training"}),"."]})]}),p.jsxs("div",{className:"mt-10 flex items-center justify-center gap-6 text-xs text-muted-foreground",children:[p.jsx("a",{href:"https://github.com/eduardoslonski/telescope",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Trainer"}),p.jsx("span",{className:"text-border",children:"|"}),p.jsx("a",{href:"https://github.com/eduardoslonski/telescope-ui",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"UI Visualization"}),p.jsx("span",{className:"text-border",children:"|"}),p.jsx("a",{href:"https://eduardoslonski.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Created by Eduardo Slonski"})]})]})})}function W6e(){return p.jsxs(sle,{children:[p.jsx(Vue,{}),p.jsx("main",{className:"ml-56 h-screen overflow-hidden bg-background",children:p.jsxs(XQ,{children:[p.jsx(Df,{path:"/",element:p.jsx(u0e,{})}),p.jsx(Df,{path:"/metrics",element:p.jsx(f0e,{})}),p.jsx(Df,{path:"/timeline",element:p.jsx(BAe,{})}),p.jsx(Df,{path:"/rollouts",element:p.jsx(o6e,{})}),p.jsx(Df,{path:"/rollouts-discarded",element:p.jsx(l6e,{})}),p.jsx(Df,{path:"/topology",element:p.jsx(c6e,{})}),p.jsx(Df,{path:"/infra",element:p.jsx(H6e,{})}),p.jsx(Df,{path:"/evals",element:p.jsx(V6e,{})}),p.jsx(Df,{path:"/about",element:p.jsx(G6e,{})})]})})]})}OF.createRoot(document.getElementById("root")).render(p.jsx(T.StrictMode,{children:p.jsx(yJ,{children:p.jsx(W6e,{})})}));
