var NP=t=>{throw TypeError(t)};var dC=(t,e,n)=>e.has(t)||NP("Cannot "+n);var at=(t,e,n)=>(dC(t,e,"read from private field"),n?n.call(t):e.get(t)),On=(t,e,n)=>e.has(t)?NP("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),dn=(t,e,n,r)=>(dC(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),pr=(t,e,n)=>(dC(t,e,"access private method"),n);var V3=(t,e,n,r)=>({set _(i){dn(t,e,i,n)},get _(){return at(t,e,r)}});function XZ(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 o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).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 uy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fC={exports:{}},jb={};/**
 * @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 RP;function YZ(){if(RP)return jb;RP=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,s){var o=null;if(s!==void 0&&(o=""+s),i.key!==void 0&&(o=""+i.key),"key"in i){s={};for(var a in i)a!=="key"&&(s[a]=i[a])}else s=i;return i=s.ref,{$$typeof:t,type:r,key:o,ref:i!==void 0?i:null,props:s}}return jb.Fragment=e,jb.jsx=n,jb.jsxs=n,jb}var kP;function KZ(){return kP||(kP=1,fC.exports=YZ()),fC.exports}var p=KZ(),hC={exports:{}},br={};/**
 * @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 PP;function ZZ(){if(PP)return br;PP=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"),o=Symbol.for("react.context"),a=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(z){return z===null||typeof z!="object"?null:(z=g&&z[g]||z["@@iterator"],typeof z=="function"?z:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,w={};function S(z,X,V){this.props=z,this.context=X,this.refs=w,this.updater=V||b}S.prototype.isReactComponent={},S.prototype.setState=function(z,X){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,X,"setState")},S.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function E(){}E.prototype=S.prototype;function A(z,X,V){this.props=z,this.context=X,this.refs=w,this.updater=V||b}var N=A.prototype=new E;N.constructor=A,_(N,S.prototype),N.isPureReactComponent=!0;var I=Array.isArray;function P(){}var L={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function O(z,X,V){var ie=V.ref;return{$$typeof:t,type:z,key:X,ref:ie!==void 0?ie:null,props:V}}function F(z,X){return O(z.type,X,z.props)}function U(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function q(z){var X={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(V){return X[V]})}var B=/\/+/g;function Z(z,X){return typeof z=="object"&&z!==null&&z.key!=null?q(""+z.key):X.toString(36)}function G(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(P,P):(z.status="pending",z.then(function(X){z.status==="pending"&&(z.status="fulfilled",z.value=X)},function(X){z.status==="pending"&&(z.status="rejected",z.reason=X)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function $(z,X,V,ie,ae){var re=typeof z;(re==="undefined"||re==="boolean")&&(z=null);var ce=!1;if(z===null)ce=!0;else switch(re){case"bigint":case"string":case"number":ce=!0;break;case"object":switch(z.$$typeof){case t:case e:ce=!0;break;case d:return ce=z._init,$(ce(z._payload),X,V,ie,ae)}}if(ce)return ae=ae(z),ce=ie===""?"."+Z(z,0):ie,I(ae)?(V="",ce!=null&&(V=ce.replace(B,"$&/")+"/"),$(ae,X,V,"",function(me){return me})):ae!=null&&(U(ae)&&(ae=F(ae,V+(ae.key==null||z&&z.key===ae.key?"":(""+ae.key).replace(B,"$&/")+"/")+ce)),X.push(ae)),1;ce=0;var oe=ie===""?".":ie+":";if(I(z))for(var fe=0;fe<z.length;fe++)ie=z[fe],re=oe+Z(ie,fe),ce+=$(ie,X,V,re,ae);else if(fe=v(z),typeof fe=="function")for(z=fe.call(z),fe=0;!(ie=z.next()).done;)ie=ie.value,re=oe+Z(ie,fe++),ce+=$(ie,X,V,re,ae);else if(re==="object"){if(typeof z.then=="function")return $(G(z),X,V,ie,ae);throw X=String(z),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ce}function K(z,X,V){if(z==null)return z;var ie=[],ae=0;return $(z,ie,"","",function(re){return X.call(V,re,ae++)}),ie}function Y(z){if(z._status===-1){var X=z._result;X=X(),X.then(function(V){(z._status===0||z._status===-1)&&(z._status=1,z._result=V)},function(V){(z._status===0||z._status===-1)&&(z._status=2,z._result=V)}),z._status===-1&&(z._status=0,z._result=X)}if(z._status===1)return z._result.default;throw z._result}var J=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}console.error(z)},H={map:K,forEach:function(z,X,V){K(z,function(){X.apply(this,arguments)},V)},count:function(z){var X=0;return K(z,function(){X++}),X},toArray:function(z){return K(z,function(X){return X})||[]},only:function(z){if(!U(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return br.Activity=h,br.Children=H,br.Component=S,br.Fragment=n,br.Profiler=i,br.PureComponent=A,br.StrictMode=r,br.Suspense=l,br.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,br.__COMPILER_RUNTIME={__proto__:null,c:function(z){return L.H.useMemoCache(z)}},br.cache=function(z){return function(){return z.apply(null,arguments)}},br.cacheSignal=function(){return null},br.cloneElement=function(z,X,V){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var ie=_({},z.props),ae=z.key;if(X!=null)for(re in X.key!==void 0&&(ae=""+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=V;else if(1<re){for(var ce=Array(re),oe=0;oe<re;oe++)ce[oe]=arguments[oe+2];ie.children=ce}return O(z.type,ae,ie)},br.createContext=function(z){return z={$$typeof:o,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:s,_context:z},z},br.createElement=function(z,X,V){var ie,ae={},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"&&(ae[ie]=X[ie]);var ce=arguments.length-2;if(ce===1)ae.children=V;else if(1<ce){for(var oe=Array(ce),fe=0;fe<ce;fe++)oe[fe]=arguments[fe+2];ae.children=oe}if(z&&z.defaultProps)for(ie in ce=z.defaultProps,ce)ae[ie]===void 0&&(ae[ie]=ce[ie]);return O(z,re,ae)},br.createRef=function(){return{current:null}},br.forwardRef=function(z){return{$$typeof:a,render:z}},br.isValidElement=U,br.lazy=function(z){return{$$typeof:d,_payload:{_status:-1,_result:z},_init:Y}},br.memo=function(z,X){return{$$typeof:c,type:z,compare:X===void 0?null:X}},br.startTransition=function(z){var X=L.T,V={};L.T=V;try{var ie=z(),ae=L.S;ae!==null&&ae(V,ie),typeof ie=="object"&&ie!==null&&typeof ie.then=="function"&&ie.then(P,J)}catch(re){J(re)}finally{X!==null&&V.types!==null&&(X.types=V.types),L.T=X}},br.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},br.use=function(z){return L.H.use(z)},br.useActionState=function(z,X,V){return L.H.useActionState(z,X,V)},br.useCallback=function(z,X){return L.H.useCallback(z,X)},br.useContext=function(z){return L.H.useContext(z)},br.useDebugValue=function(){},br.useDeferredValue=function(z,X){return L.H.useDeferredValue(z,X)},br.useEffect=function(z,X){return L.H.useEffect(z,X)},br.useEffectEvent=function(z){return L.H.useEffectEvent(z)},br.useId=function(){return L.H.useId()},br.useImperativeHandle=function(z,X,V){return L.H.useImperativeHandle(z,X,V)},br.useInsertionEffect=function(z,X){return L.H.useInsertionEffect(z,X)},br.useLayoutEffect=function(z,X){return L.H.useLayoutEffect(z,X)},br.useMemo=function(z,X){return L.H.useMemo(z,X)},br.useOptimistic=function(z,X){return L.H.useOptimistic(z,X)},br.useReducer=function(z,X,V){return L.H.useReducer(z,X,V)},br.useRef=function(z){return L.H.useRef(z)},br.useState=function(z){return L.H.useState(z)},br.useSyncExternalStore=function(z,X,V){return L.H.useSyncExternalStore(z,X,V)},br.useTransition=function(){return L.H.useTransition()},br.version="19.2.1",br}var DP;function GS(){return DP||(DP=1,hC.exports=ZZ()),hC.exports}var T=GS();const Jr=uy(T),PF=XZ({__proto__:null,default:Jr},[T]);var pC={exports:{}},Fb={},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 QZ(){return IP||(IP=1,(function(t){function e($,K){var Y=$.length;$.push(K);e:for(;0<Y;){var J=Y-1>>>1,H=$[J];if(0<i(H,K))$[J]=K,$[Y]=H,Y=J;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var K=$[0],Y=$.pop();if(Y!==K){$[0]=Y;e:for(var J=0,H=$.length,z=H>>>1;J<z;){var X=2*(J+1)-1,V=$[X],ie=X+1,ae=$[ie];if(0>i(V,Y))ie<H&&0>i(ae,V)?($[J]=ae,$[ie]=Y,J=ie):($[J]=V,$[X]=Y,J=X);else if(ie<H&&0>i(ae,Y))$[J]=ae,$[ie]=Y,J=ie;else break e}}return K}function i($,K){var Y=$.sortIndex-K.sortIndex;return Y!==0?Y:$.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 o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}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($){for(var K=n(c);K!==null;){if(K.callback===null)r(c);else if(K.startTime<=$)r(c),K.sortIndex=K.expirationTime,e(l,K);else break;K=n(c)}}function I($){if(_=!1,N($),!b)if(n(l)!==null)b=!0,P||(P=!0,q());else{var K=n(c);K!==null&&G(I,K.startTime-$)}}var P=!1,L=-1,R=5,O=-1;function F(){return w?!0:!(t.unstable_now()-O<R)}function U(){if(w=!1,P){var $=t.unstable_now();O=$;var K=!0;try{e:{b=!1,_&&(_=!1,E(L),L=-1),v=!0;var Y=g;try{t:{for(N($),h=n(l);h!==null&&!(h.expirationTime>$&&F());){var J=h.callback;if(typeof J=="function"){h.callback=null,g=h.priorityLevel;var H=J(h.expirationTime<=$);if($=t.unstable_now(),typeof H=="function"){h.callback=H,N($),K=!0;break t}h===n(l)&&r(l),N($)}else r(l);h=n(l)}if(h!==null)K=!0;else{var z=n(c);z!==null&&G(I,z.startTime-$),K=!1}}break e}finally{h=null,g=Y,v=!1}K=void 0}}finally{K?q():P=!1}}}var q;if(typeof A=="function")q=function(){A(U)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,Z=B.port2;B.port1.onmessage=U,q=function(){Z.postMessage(null)}}else q=function(){S(U,0)};function G($,K){L=S(function(){$(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($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_next=function($){switch(g){case 1:case 2:case 3:var K=3;break;default:K=g}var Y=g;g=K;try{return $()}finally{g=Y}},t.unstable_requestPaint=function(){w=!0},t.unstable_runWithPriority=function($,K){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var Y=g;g=$;try{return K()}finally{g=Y}},t.unstable_scheduleCallback=function($,K,Y){var J=t.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?J+Y:J):Y=J,$){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=Y+H,$={id:d++,callback:K,priorityLevel:$,startTime:Y,expirationTime:H,sortIndex:-1},Y>J?($.sortIndex=Y,e(c,$),n(l)===null&&$===n(c)&&(_?(E(L),L=-1):_=!0,G(I,Y-J))):($.sortIndex=H,e(l,$),b||v||(b=!0,P||(P=!0,q()))),$},t.unstable_shouldYield=F,t.unstable_wrapCallback=function($){var K=g;return function(){var Y=g;g=K;try{return $.apply(this,arguments)}finally{g=Y}}}})(gC)),gC}var OP;function DF(){return OP||(OP=1,mC.exports=QZ()),mC.exports}var vC={exports:{}},nl={};/**
 * @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 LP;function JZ(){if(LP)return nl;LP=1;var t=GS();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 o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function a(l,c){if(l==="font")return"";if(typeof c=="string")return c==="use-credentials"?c:""}return nl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,nl.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)},nl.flushSync=function(l){var c=o.T,d=r.p;try{if(o.T=null,r.p=2,l)return l()}finally{o.T=c,r.p=d,r.d.f()}},nl.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))},nl.prefetchDNS=function(l){typeof l=="string"&&r.d.D(l)},nl.preinit=function(l,c){if(typeof l=="string"&&c&&typeof c.as=="string"){var d=c.as,h=a(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})}},nl.preinitModule=function(l,c){if(typeof l=="string")if(typeof c=="object"&&c!==null){if(c.as==null||c.as==="script"){var d=a(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)},nl.preload=function(l,c){if(typeof l=="string"&&typeof c=="object"&&c!==null&&typeof c.as=="string"){var d=c.as,h=a(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})}},nl.preloadModule=function(l,c){if(typeof l=="string")if(c){var d=a(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)},nl.requestFormReset=function(l){r.d.r(l)},nl.unstable_batchedUpdates=function(l,c){return l(c)},nl.useFormState=function(l,c,d){return o.H.useFormState(l,c,d)},nl.useFormStatus=function(){return o.H.useHostTransitionStatus()},nl.version="19.2.1",nl}var zP;function IF(){if(zP)return vC.exports;zP=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=JZ(),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 jP;function eQ(){if(jP)return Fb;jP=1;var t=DF(),e=GS(),n=IF();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 o(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 a(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 D=y.return;if(D===null)break;var j=D.alternate;if(j===null){if(M=D.return,M!==null){y=M;continue}break}if(D.child===j.child){for(j=D.child;j;){if(j===y)return l(D),u;if(j===M)return l(D),f;j=j.sibling}throw Error(r(188))}if(y.return!==M.return)y=D,M=j;else{for(var ue=!1,Pe=D.child;Pe;){if(Pe===y){ue=!0,y=D,M=j;break}if(Pe===M){ue=!0,M=D,y=j;break}Pe=Pe.sibling}if(!ue){for(Pe=j.child;Pe;){if(Pe===y){ue=!0,y=j,M=D;break}if(Pe===M){ue=!0,M=j,y=D;break}Pe=Pe.sibling}if(!ue)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"),I=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"),F=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function q(u){return u===null||typeof u!="object"?null:(u=U&&u[U]||u["@@iterator"],typeof u=="function"?u:null)}var B=Symbol.for("react.client.reference");function Z(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===B?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 I: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 G=Array.isArray,$=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},J=[],H=-1;function z(u){return{current:u}}function X(u){0>H||(u.current=J[H],J[H]=null,H--)}function V(u,f){H++,J[H]=u.current,u.current=f}var ie=z(null),ae=z(null),re=z(null),ce=z(null);function oe(u,f){switch(V(re,f),V(ae,u),V(ie,null),f.nodeType){case 9:case 11:u=(u=f.documentElement)&&(u=u.namespaceURI)?Q9(u):0;break;default:if(u=f.tagName,f=f.namespaceURI)f=Q9(f),u=J9(f,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}X(ie),V(ie,u)}function fe(){X(ie),X(ae),X(re)}function me(u){u.memoizedState!==null&&V(ce,u);var f=ie.current,y=J9(f,u.type);f!==y&&(V(ae,u),V(ie,y))}function ye(u){ae.current===u&&(X(ie),X(ae)),ce.current===u&&(X(ce),Ib._currentValue=Y)}var Ee,Ge;function _e(u){if(Ee===void 0)try{throw Error()}catch(y){var f=y.stack.trim().match(/\n( *(at )?)/);Ee=f&&f[1]||"",Ge=-1<y.stack.indexOf(`
    at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Ee+u+Ge}var De=!1;function he(u,f){if(!u||De)return"";De=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var M={DetermineComponentFrameRoot:function(){try{if(f){var Vt=function(){throw Error()};if(Object.defineProperty(Vt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Vt,[])}catch(Ot){var At=Ot}Reflect.construct(u,[],Vt)}else{try{Vt.call()}catch(Ot){At=Ot}u.call(Vt.prototype)}}else{try{throw Error()}catch(Ot){At=Ot}(Vt=u())&&typeof Vt.catch=="function"&&Vt.catch(function(){})}}catch(Ot){if(Ot&&At&&typeof Ot.stack=="string")return[Ot.stack,At.stack]}return[null,null]}};M.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var D=Object.getOwnPropertyDescriptor(M.DetermineComponentFrameRoot,"name");D&&D.configurable&&Object.defineProperty(M.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var j=M.DetermineComponentFrameRoot(),ue=j[0],Pe=j[1];if(ue&&Pe){var rt=ue.split(`
`),Mt=Pe.split(`
`);for(D=M=0;M<rt.length&&!rt[M].includes("DetermineComponentFrameRoot");)M++;for(;D<Mt.length&&!Mt[D].includes("DetermineComponentFrameRoot");)D++;if(M===rt.length||D===Mt.length)for(M=rt.length-1,D=Mt.length-1;1<=M&&0<=D&&rt[M]!==Mt[D];)D--;for(;1<=M&&0<=D;M--,D--)if(rt[M]!==Mt[D]){if(M!==1||D!==1)do if(M--,D--,0>D||rt[M]!==Mt[D]){var zt=`
`+rt[M].replace(" at new "," at ");return u.displayName&&zt.includes("<anonymous>")&&(zt=zt.replace("<anonymous>",u.displayName)),zt}while(1<=M&&0<=D);break}}}finally{De=!1,Error.prepareStackTrace=y}return(y=u?u.displayName||u.name:"")?_e(y):""}function Le(u,f){switch(u.tag){case 26:case 27:case 5:return _e(u.type);case 16:return _e("Lazy");case 13:return u.child!==f&&f!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("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 _e("Activity");default:return""}}function ne(u){try{var f="",y=null;do f+=Le(u,y),y=u,u=u.return;while(u);return f}catch(M){return`
Error generating stack: `+M.message+`
`+M.stack}}var We=Object.prototype.hasOwnProperty,je=t.unstable_scheduleCallback,be=t.unstable_cancelCallback,Xe=t.unstable_shouldYield,le=t.unstable_requestPaint,te=t.unstable_now,Se=t.unstable_getCurrentPriorityLevel,ve=t.unstable_ImmediatePriority,ge=t.unstable_UserBlockingPriority,Te=t.unstable_NormalPriority,He=t.unstable_LowPriority,pe=t.unstable_IdlePriority,qe=t.log,xt=t.unstable_setDisableYieldValue,nt=null,tt=null;function Fe(u){if(typeof qe=="function"&&xt(u),tt&&typeof tt.setStrictMode=="function")try{tt.setStrictMode(nt,u)}catch{}}var we=Math.clz32?Math.clz32:Ne,ke=Math.log,Ze=Math.LN2;function Ne(u){return u>>>=0,u===0?32:31-(ke(u)/Ze|0)|0}var Ke=256,it=262144,ht=4194304;function Je(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 $e(u,f,y){var M=u.pendingLanes;if(M===0)return 0;var D=0,j=u.suspendedLanes,ue=u.pingedLanes;u=u.warmLanes;var Pe=M&134217727;return Pe!==0?(M=Pe&~j,M!==0?D=Je(M):(ue&=Pe,ue!==0?D=Je(ue):y||(y=Pe&~u,y!==0&&(D=Je(y))))):(Pe=M&~j,Pe!==0?D=Je(Pe):ue!==0?D=Je(ue):y||(y=M&~u,y!==0&&(D=Je(y)))),D===0?0:f!==0&&f!==D&&(f&j)===0&&(j=D&-D,y=f&-f,j>=y||j===32&&(y&4194048)!==0)?f:D}function Ae(u,f){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&f)===0}function Oe(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 Ye(){var u=ht;return ht<<=1,(ht&62914560)===0&&(ht=4194304),u}function st(u){for(var f=[],y=0;31>y;y++)f.push(u);return f}function Rt(u,f){u.pendingLanes|=f,f!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function yt(u,f,y,M,D,j){var ue=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 Pe=u.entanglements,rt=u.expirationTimes,Mt=u.hiddenUpdates;for(y=ue&~y;0<y;){var zt=31-we(y),Vt=1<<zt;Pe[zt]=0,rt[zt]=-1;var At=Mt[zt];if(At!==null)for(Mt[zt]=null,zt=0;zt<At.length;zt++){var Ot=At[zt];Ot!==null&&(Ot.lane&=-536870913)}y&=~Vt}M!==0&&Tt(u,M,0),j!==0&&D===0&&u.tag!==0&&(u.suspendedLanes|=j&~(ue&~f))}function Tt(u,f,y){u.pendingLanes|=f,u.suspendedLanes&=~f;var M=31-we(f);u.entangledLanes|=f,u.entanglements[M]=u.entanglements[M]|1073741824|y&261930}function Et(u,f){var y=u.entangledLanes|=f;for(u=u.entanglements;y;){var M=31-we(y),D=1<<M;D&f|u[M]&f&&(u[M]|=f),y&=~D}}function Dt(u,f){var y=f&-f;return y=(y&42)!==0?1:Ue(y),(y&(u.suspendedLanes|f))!==0?0:y}function Ue(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 ct(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function St(){var u=K.p;return u!==0?u:(u=window.event,u===void 0?32:SP(u.type))}function kt(u,f){var y=K.p;try{return K.p=u,f()}finally{K.p=y}}var Ut=Math.random().toString(36).slice(2),Xt="__reactFiber$"+Ut,hn="__reactProps$"+Ut,Lt="__reactContainer$"+Ut,on="__reactEvents$"+Ut,Ht="__reactListeners$"+Ut,kn="__reactHandles$"+Ut,Xn="__reactResources$"+Ut,zn="__reactMarker$"+Ut;function Qn(u){delete u[Xt],delete u[hn],delete u[on],delete u[Ht],delete u[kn]}function Pn(u){var f=u[Xt];if(f)return f;for(var y=u.parentNode;y;){if(f=y[Lt]||y[Xt]){if(y=f.alternate,f.child!==null||y!==null&&y.child!==null)for(u=oP(u);u!==null;){if(y=u[Xt])return y;u=oP(u)}return f}u=y,y=u.parentNode}return null}function lr(u){if(u=u[Xt]||u[Lt]){var f=u.tag;if(f===5||f===6||f===13||f===31||f===26||f===27||f===3)return u}return null}function ir(u){var f=u.tag;if(f===5||f===26||f===27||f===6)return u.stateNode;throw Error(r(33))}function xe(u){var f=u[Xn];return f||(f=u[Xn]={hoistableStyles:new Map,hoistableScripts:new Map}),f}function ot(u){u[zn]=!0}var bt=new Set,mt={};function pt(u,f){$t(u,f),$t(u+"Capture",f)}function $t(u,f){for(mt[u]=f,u=0;u<f.length;u++)bt.add(f[u])}var Zt=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]*$"),en={},Jt={};function Mn(u){return We.call(Jt,u)?!0:We.call(en,u)?!1:Zt.test(u)?Jt[u]=!0:(en[u]=!0,!1)}function jn(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 Gn(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 ln(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 sr(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Yr(u){var f=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function ti(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 D=M.get,j=M.set;return Object.defineProperty(u,f,{configurable:!0,get:function(){return D.call(this)},set:function(ue){y=""+ue,j.call(this,ue)}}),Object.defineProperty(u,f,{enumerable:M.enumerable}),{getValue:function(){return y},setValue:function(ue){y=""+ue},stopTracking:function(){u._valueTracker=null,delete u[f]}}}}function dr(u){if(!u._valueTracker){var f=Yr(u)?"checked":"value";u._valueTracker=ti(u,f,""+u[f])}}function kr(u){if(!u)return!1;var f=u._valueTracker;if(!f)return!0;var y=f.getValue(),M="";return u&&(M=Yr(u)?u.checked?"true":"false":u.value),u=M,u!==y?(f.setValue(u),!0):!1}function rn(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 Nn(u){return u.replace(ss,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function gs(u,f,y,M,D,j,ue,Pe){u.name="",ue!=null&&typeof ue!="function"&&typeof ue!="symbol"&&typeof ue!="boolean"?u.type=ue:u.removeAttribute("type"),f!=null?ue==="number"?(f===0&&u.value===""||u.value!=f)&&(u.value=""+sr(f)):u.value!==""+sr(f)&&(u.value=""+sr(f)):ue!=="submit"&&ue!=="reset"||u.removeAttribute("value"),f!=null?Di(u,ue,sr(f)):y!=null?Di(u,ue,sr(y)):M!=null&&u.removeAttribute("value"),D==null&&j!=null&&(u.defaultChecked=!!j),D!=null&&(u.checked=D&&typeof D!="function"&&typeof D!="symbol"),Pe!=null&&typeof Pe!="function"&&typeof Pe!="symbol"&&typeof Pe!="boolean"?u.name=""+sr(Pe):u.removeAttribute("name")}function Rs(u,f,y,M,D,j,ue,Pe){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(u.type=j),f!=null||y!=null){if(!(j!=="submit"&&j!=="reset"||f!=null)){dr(u);return}y=y!=null?""+sr(y):"",f=f!=null?""+sr(f):y,Pe||f===u.value||(u.value=f),u.defaultValue=f}M=M??D,M=typeof M!="function"&&typeof M!="symbol"&&!!M,u.checked=Pe?u.checked:!!M,u.defaultChecked=!!M,ue!=null&&typeof ue!="function"&&typeof ue!="symbol"&&typeof ue!="boolean"&&(u.name=ue),dr(u)}function Di(u,f,y){f==="number"&&rn(u.ownerDocument)===u||u.defaultValue===""+y||(u.defaultValue=""+y)}function vs(u,f,y,M){if(u=u.options,f){f={};for(var D=0;D<y.length;D++)f["$"+y[D]]=!0;for(y=0;y<u.length;y++)D=f.hasOwnProperty("$"+u[y].value),u[y].selected!==D&&(u[y].selected=D),D&&M&&(u[y].defaultSelected=!0)}else{for(y=""+sr(y),f=null,D=0;D<u.length;D++){if(u[D].value===y){u[D].selected=!0,M&&(u[D].defaultSelected=!0);return}f!==null||u[D].disabled||(f=u[D])}f!==null&&(f.selected=!0)}}function gr(u,f,y){if(f!=null&&(f=""+sr(f),f!==u.value&&(u.value=f),y==null)){u.defaultValue!==f&&(u.defaultValue=f);return}u.defaultValue=y!=null?""+sr(y):""}function fi(u,f,y,M){if(f==null){if(M!=null){if(y!=null)throw Error(r(92));if(G(M)){if(1<M.length)throw Error(r(93));M=M[0]}y=M}y==null&&(y=""),f=y}y=sr(f),u.defaultValue=y,M=u.textContent,M===y&&M!==""&&M!==null&&(u.value=M),dr(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 qo(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 ua(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 D in f)M=f[D],f.hasOwnProperty(D)&&y[D]!==M&&qo(u,D,M)}else for(var j in f)f.hasOwnProperty(j)&&qo(u,j,f[j])}function wa(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"]]),yl=/^[\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 da(u){return yl.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function Ps(){}var Xl=null;function Va(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Ma=null,Ta=null;function Pc(u){var f=lr(u);if(f&&(u=f.stateNode)){var y=u[hn]||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="'+Nn(""+f)+'"][type="radio"]'),f=0;f<y.length;f++){var M=y[f];if(M!==u&&M.form===u.form){var D=M[hn]||null;if(!D)throw Error(r(90));gs(M,D.value,D.defaultValue,D.defaultValue,D.checked,D.defaultChecked,D.type,D.name)}}for(f=0;f<y.length;f++)M=y[f],M.form===u.form&&kr(M)}break e;case"textarea":gr(u,y.value,y.defaultValue);break e;case"select":f=y.value,f!=null&&vs(u,!!y.multiple,f,!1)}}}var Dc=!1;function Yl(u,f,y){if(Dc)return u(f,y);Dc=!0;try{var M=u(f);return M}finally{if(Dc=!1,(Ma!==null||Ta!==null)&&(Bc(),Ma&&(f=Ma,u=Ta,Ta=Ma=null,Pc(f),u)))for(f=0;f<u.length;f++)Pc(u[f])}}function Xo(u,f){var y=u.stateNode;if(y===null)return null;var M=y[hn]||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 io=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ro=!1;if(io)try{var bl={};Object.defineProperty(bl,"passive",{get:function(){Ro=!0}}),window.addEventListener("test",bl,bl),window.removeEventListener("test",bl,bl)}catch{Ro=!1}var xs=null,Ga=null,Wa=null;function Ic(){if(Wa)return Wa;var u,f=Ga,y=f.length,M,D="value"in xs?xs.value:xs.textContent,j=D.length;for(u=0;u<y&&f[u]===D[u];u++);var ue=y-u;for(M=1;M<=ue&&f[y-M]===D[j-M];M++);return Wa=D.slice(u,1<M?1-M:void 0)}function ni(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 Fr(){return!0}function Yo(){return!1}function vr(u){function f(y,M,D,j,ue){this._reactName=y,this._targetInst=D,this.type=M,this.nativeEvent=j,this.target=ue,this.currentTarget=null;for(var Pe in u)u.hasOwnProperty(Pe)&&(y=u[Pe],this[Pe]=y?y(j):j[Pe]);return this.isDefaultPrevented=(j.defaultPrevented!=null?j.defaultPrevented:j.returnValue===!1)?Fr:Yo,this.isPropagationStopped=Yo,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=Fr)},stopPropagation:function(){var y=this.nativeEvent;y&&(y.stopPropagation?y.stopPropagation():typeof y.cancelBubble!="unknown"&&(y.cancelBubble=!0),this.isPropagationStopped=Fr)},persist:function(){},isPersistent:Fr}),f}var _i={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Oi=vr(_i),$r=h({},_i,{view:0,detail:0}),Ea=vr($r),_l,Kl,vo,mi=h({},$r,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Tp,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!==vo&&(vo&&u.type==="mousemove"?(_l=u.screenX-vo.screenX,Kl=u.screenY-vo.screenY):Kl=_l=0,vo=u),_l)},movementY:function(u){return"movementY"in u?u.movementY:Kl}}),xh=vr(mi),rd=h({},mi,{dataTransfer:0}),id=vr(rd),Qd=h({},$r,{relatedTarget:0}),fa=vr(Qd),Gi=h({},_i,{animationName:0,elapsedTime:0,pseudoElement:0}),Hs=vr(Gi),ys=h({},_i,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),Sl=vr(ys),xo=h({},_i,{data:0}),Mp=vr(xo),yh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ym={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 sd(u){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(u):(u=Jd[u])?!!f[u]:!1}function Tp(){return sd}var Ep=h({},$r,{key:function(u){if(u.key){var f=yh[u.key]||u.key;if(f!=="Unidentified")return f}return u.type==="keypress"?(u=ni(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?ym[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Tp,charCode:function(u){return u.type==="keypress"?ni(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?ni(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),od=vr(Ep),Zl=h({},mi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ql=vr(Zl),ad=h({},$r,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Tp}),bm=vr(ad),Cp=h({},_i,{propertyName:0,elapsedTime:0,pseudoElement:0}),_m=vr(Cp),Vs=h({},mi,{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}),Sm=vr(Vs),wm=h({},_i,{newState:0,oldState:0}),Mm=vr(wm),Tm=[9,13,27,32],du=io&&"CompositionEvent"in window,ld=null;io&&"documentMode"in document&&(ld=document.documentMode);var Ap=io&&"TextEvent"in window&&!ld,Np=io&&(!du||ld&&8<ld&&11>=ld),Em=" ",Jl=!1;function cd(u,f){switch(u){case"keyup":return Tm.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ds(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var fu=!1;function bs(u,f){switch(u){case"compositionend":return Ds(f);case"keypress":return f.which!==32?null:(Jl=!0,Em);case"textInput":return u=f.data,u===Em&&Jl?null:u;default:return null}}function Rp(u,f){if(fu)return u==="compositionend"||!du&&cd(u,f)?(u=Ic(),Wa=Ga=xs=null,fu=!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 Np&&f.locale!=="ko"?null:f.data;default:return null}}var bh={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 ud(u){var f=u&&u.nodeName&&u.nodeName.toLowerCase();return f==="input"?!!bh[u.type]:f==="textarea"}function kp(u,f,y,M){Ma?Ta?Ta.push(M):Ta=[M]:Ma=M,f=A3(f,"onChange"),0<f.length&&(y=new Oi("onChange","change",null,y,M),u.push({event:y,listeners:f}))}var hu=null,Oc=null;function de(u){$9(u,0)}function Ce(u){var f=ir(u);if(kr(f))return u}function Be(u,f){if(u==="change")return f}var Ve=!1;if(io){var ut;if(io){var _t="oninput"in document;if(!_t){var Ft=document.createElement("div");Ft.setAttribute("oninput","return;"),_t=typeof Ft.oninput=="function"}ut=_t}else ut=!1;Ve=ut&&(!document.documentMode||9<document.documentMode)}function Gt(){hu&&(hu.detachEvent("onpropertychange",Qt),Oc=hu=null)}function Qt(u){if(u.propertyName==="value"&&Ce(Oc)){var f=[];kp(f,Oc,u,Va(u)),Yl(de,f)}}function gn(u,f,y){u==="focusin"?(Gt(),hu=f,Oc=y,hu.attachEvent("onpropertychange",Qt)):u==="focusout"&&Gt()}function xn(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Ce(Oc)}function Sn(u,f){if(u==="click")return Ce(f)}function er(u,f){if(u==="input"||u==="change")return Ce(f)}function Kr(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var tr=typeof Object.is=="function"?Object.is:Kr;function fr(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 D=y[M];if(!We.call(f,D)||!tr(u[D],f[D]))return!1}return!0}function Bn(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function An(u,f){var y=Bn(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=Bn(y)}}function Wn(u,f){return u&&f?u===f?!0:u&&u.nodeType===3?!1:f&&f.nodeType===3?Wn(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=rn(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=rn(u.document)}return f}function Is(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 gi=io&&"documentMode"in document&&11>=document.documentMode,ai=null,os=null,Os=null,Ko=!1;function ko(u,f,y){var M=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;Ko||ai==null||ai!==rn(M)||(M=ai,"selectionStart"in M&&Is(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&&fr(Os,M)||(Os=M,M=A3(os,"onSelect"),0<M.length&&(f=new Oi("onSelect","select",null,f,y),u.push({event:f,listeners:M}),f.target=ai)))}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")},Po={},Ca={};io&&(Ca=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 so(u){if(Po[u])return Po[u];if(!Gs[u])return u;var f=Gs[u],y;for(y in f)if(f.hasOwnProperty(y)&&y in Ca)return Po[u]=f[y];return u}var oo=so("animationend"),yo=so("animationiteration"),Lc=so("animationstart"),Do=so("transitionrun"),Nv=so("transitionstart"),kw=so("transitioncancel"),Ly=so("transitionend"),ec=new Map,Cm="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(" ");Cm.push("scrollEnd");function tc(u,f){ec.set(u,f),pt(f,[u])}var Am=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=[],dd=0,Io=0;function Nm(){for(var u=dd,f=Io=dd=0;f<u;){var y=nc[f];nc[f++]=null;var M=nc[f];nc[f++]=null;var D=nc[f];nc[f++]=null;var j=nc[f];if(nc[f++]=null,M!==null&&D!==null){var ue=M.pending;ue===null?D.next=D:(D.next=ue.next,ue.next=D),M.pending=D}j!==0&&ef(y,D,j)}}function Oo(u,f,y,M){nc[dd++]=u,nc[dd++]=f,nc[dd++]=y,nc[dd++]=M,Io|=M,u.lanes|=M,u=u.alternate,u!==null&&(u.lanes|=M)}function Rv(u,f,y,M){return Oo(u,f,y,M),rc(u)}function Aa(u,f){return Oo(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 D=!1,j=u.return;j!==null;)j.childLanes|=y,M=j.alternate,M!==null&&(M.childLanes|=y),j.tag===22&&(u=j.stateNode,u===null||u._visibility&1||(D=!0)),u=j,j=j.return;return u.tag===3?(j=u.stateNode,D&&f!==null&&(D=31-we(y),u=j.hiddenUpdates,M=u[D],M===null?u[D]=[f]:M.push(f),f.lane=y|536870912),j):null}function rc(u){if(50<bf)throw bf=0,Fh=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 zy(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 zy(u,f,y,M)}function kv(u){return u=u.prototype,!(!u||!u.isReactComponent)}function $a(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 Pp(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 pu(u,f,y,M,D,j){var ue=0;if(M=u,typeof u=="function")kv(u)&&(ue=1);else if(typeof u=="string")ue=LZ(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,D),u.elementType=O,u.lanes=j,u;case _:return nf(y.children,D,j,f);case w:ue=8,D|=24;break;case S:return u=_s(12,y,f,D|2),u.elementType=S,u.lanes=j,u;case I:return u=_s(13,y,f,D),u.elementType=I,u.lanes=j,u;case P:return u=_s(19,y,f,D),u.elementType=P,u.lanes=j,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case A:ue=10;break e;case E:ue=9;break e;case N:ue=11;break e;case L:ue=14;break e;case R:ue=16,M=null;break e}ue=29,y=Error(r(130,u===null?"null":typeof u,"")),M=null}return f=_s(ue,y,f,D),f.elementType=u,f.type=M,f.lanes=j,f}function nf(u,f,y,M){return u=_s(7,u,M,f),u.lanes=y,u}function Pv(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 Rm=new WeakMap;function wl(u,f){if(typeof u=="object"&&u!==null){var y=Rm.get(u);return y!==void 0?y:(f={value:u,source:f,stack:ne(f)},Rm.set(u,f),f)}return{value:u,source:f,stack:ne(f)}}var rf=[],sf=0,Ip=null,Op=0,qa=[],as=0,fd=null,Ss=1,zc="";function mu(u,f){rf[sf++]=Op,rf[sf++]=Ip,Ip=u,Op=f}function Pw(u,f,y){qa[as++]=Ss,qa[as++]=zc,qa[as++]=fd,fd=u;var M=Ss;u=zc;var D=32-we(M)-1;M&=~(1<<D),y+=1;var j=32-we(f)+D;if(30<j){var ue=D-D%5;j=(M&(1<<ue)-1).toString(32),M>>=ue,D-=ue,Ss=1<<32-we(f)+D|y<<D|M,zc=j+u}else Ss=1<<j|y<<D|M,zc=u}function gu(u){u.return!==null&&(mu(u,1),Pw(u,1,0))}function Iv(u){for(;u===Ip;)Ip=rf[--sf],rf[sf]=null,Op=rf[--sf],rf[sf]=null;for(;u===fd;)fd=qa[--as],qa[as]=null,zc=qa[--as],qa[as]=null,Ss=qa[--as],qa[as]=null}function Ov(u,f){qa[as++]=Ss,qa[as++]=zc,qa[as++]=fd,Ss=f.id,zc=f.overflow,fd=u}var Ls=null,Wi=null,qr=!1,hd=null,Ml=!1,Lp=Error(r(519));function vu(u){var f=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw xu(wl(f,u)),Lp}function Dw(u){var f=u.stateNode,y=u.type,M=u.memoizedProps;switch(f[Xt]=u,f[hn]=M,y){case"dialog":Qr("cancel",f),Qr("close",f);break;case"iframe":case"object":case"embed":Qr("load",f);break;case"video":case"audio":for(y=0;y<gc.length;y++)Qr(gc[y],f);break;case"source":Qr("error",f);break;case"img":case"image":case"link":Qr("error",f),Qr("load",f);break;case"details":Qr("toggle",f);break;case"input":Qr("invalid",f),Rs(f,M.value,M.defaultValue,M.checked,M.defaultChecked,M.type,M.name,!0);break;case"select":Qr("invalid",f);break;case"textarea":Qr("invalid",f),fi(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||K9(f.textContent,y)?(M.popover!=null&&(Qr("beforetoggle",f),Qr("toggle",f)),M.onScroll!=null&&Qr("scroll",f),M.onScrollEnd!=null&&Qr("scrollend",f),M.onClick!=null&&(f.onclick=Ps),f=!0):f=!1,f||vu(u,!0)}function Iw(u){for(Ls=u.return;Ls;)switch(Ls.tag){case 5:case 31:case 13:Ml=!1;return;case 27:case 3:Ml=!0;return;default:Ls=Ls.return}}function zp(u){if(u!==Ls)return!1;if(!qr)return Iw(u),qr=!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&&vu(u),Iw(u),f===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Wi=sP(u)}else if(f===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Wi=sP(u)}else f===27?(f=Wi,r0(u.type)?(u=tC,tC=null,Wi=u):Wi=f):Wi=Ls?Pu(u.stateNode.nextSibling):null;return!0}function of(){Wi=Ls=null,qr=!1}function Lv(){var u=hd;return u!==null&&(js===null?js=u:js.push.apply(js,u),hd=null),u}function xu(u){hd===null?hd=[u]:hd.push(u)}var jp=z(null),af=null,yu=null;function pd(u,f,y){V(jp,f._currentValue),f._currentValue=y}function bu(u){u._currentValue=jp.current,X(jp)}function zv(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 jv(u,f,y,M){var D=u.child;for(D!==null&&(D.return=u);D!==null;){var j=D.dependencies;if(j!==null){var ue=D.child;j=j.firstContext;e:for(;j!==null;){var Pe=j;j=D;for(var rt=0;rt<f.length;rt++)if(Pe.context===f[rt]){j.lanes|=y,Pe=j.alternate,Pe!==null&&(Pe.lanes|=y),zv(j.return,y,u),M||(ue=null);break e}j=Pe.next}}else if(D.tag===18){if(ue=D.return,ue===null)throw Error(r(341));ue.lanes|=y,j=ue.alternate,j!==null&&(j.lanes|=y),zv(ue,y,u),ue=null}else ue=D.child;if(ue!==null)ue.return=D;else for(ue=D;ue!==null;){if(ue===u){ue=null;break}if(D=ue.sibling,D!==null){D.return=ue.return,ue=D;break}ue=ue.return}D=ue}}function _u(u,f,y,M){u=null;for(var D=f,j=!1;D!==null;){if(!j){if((D.flags&524288)!==0)j=!0;else if((D.flags&262144)!==0)break}if(D.tag===10){var ue=D.alternate;if(ue===null)throw Error(r(387));if(ue=ue.memoizedProps,ue!==null){var Pe=D.type;tr(D.pendingProps.value,ue.value)||(u!==null?u.push(Pe):u=[Pe])}}else if(D===ce.current){if(ue=D.alternate,ue===null)throw Error(r(387));ue.memoizedState.memoizedState!==D.memoizedState.memoizedState&&(u!==null?u.push(Ib):u=[Ib])}D=D.return}u!==null&&jv(f,u,y,M),f.flags|=262144}function km(u){for(u=u.firstContext;u!==null;){if(!tr(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function lf(u){af=u,yu=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function nr(u){return Ow(af,u)}function Fp(u,f){return af===null&&lf(u),Ow(u,f)}function Ow(u,f){var y=f._currentValue;if(f={context:f,memoizedValue:y,next:null},yu===null){if(u===null)throw Error(r(308));yu=f,u.dependencies={lanes:0,firstContext:f},u.flags|=524288}else yu=yu.next=f;return y}var Lw=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,ao={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function jy(){return{controller:new Lw,data:new Map,refCount:0}}function _h(u){u.refCount--,u.refCount===0&&OE(LE,function(){u.controller.abort()})}var Tl=null,Fv=0,md=0,ic=null;function Fy(u,f){if(Tl===null){var y=Tl=[];Fv=0,md=Pt(),ic={status:"pending",value:void 0,then:function(M){y.push(M)}}}return Fv++,f.then(Uy,Uy),f}function Uy(){if(--Fv===0&&Tl!==null){ic!==null&&(ic.status="fulfilled");var u=Tl;Tl=null,md=0,ic=null;for(var f=0;f<u.length;f++)(0,u[f])()}}function By(u,f){var y=[],M={status:"pending",value:null,reason:null,then:function(D){y.push(D)}};return u.then(function(){M.status="fulfilled",M.value=f;for(var D=0;D<y.length;D++)(0,y[D])(f)},function(D){for(M.status="rejected",M.reason=D,D=0;D<y.length;D++)(0,y[D])(void 0)}),M}var zw=$.S;$.S=function(u,f){Ab=te(),typeof f=="object"&&f!==null&&typeof f.then=="function"&&Fy(u,f),zw!==null&&zw(u,f)};var cf=z(null);function Uv(){var u=cf.current;return u!==null?u:cr.pooledCache}function Pm(u,f){f===null?V(cf,cf.current):V(cf,f.pool)}function Hy(){var u=Uv();return u===null?null:{parent:ao._currentValue,pool:u}}var Sh=Error(r(460)),Dm=Error(r(474)),Mr=Error(r(542)),Bv={then:function(){}};function Xa(u){return u=u.status,u==="fulfilled"||u==="rejected"}function Hv(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,Th(u),u;default:if(typeof f.status=="string")f.then(Ps,Ps);else{if(u=cr,u!==null&&100<u.shellSuspendCounter)throw Error(r(482));u=f,u.status="pending",u.then(function(M){if(f.status==="pending"){var D=f;D.status="fulfilled",D.value=M}},function(M){if(f.status==="pending"){var D=f;D.status="rejected",D.reason=M}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw u=f.reason,Th(u),u}throw Su=f,Sh}}function wh(u){try{var f=u._init;return f(u._payload)}catch(y){throw y!==null&&typeof y=="object"&&typeof y.then=="function"?(Su=y,Sh):y}}var Su=null;function Mh(){if(Su===null)throw Error(r(459));var u=Su;return Su=null,u}function Th(u){if(u===Sh||u===Mr)throw Error(r(483))}var Eh=null,Ch=0;function Im(u){var f=Ch;return Ch+=1,Eh===null&&(Eh=[]),Hv(Eh,u,f)}function sc(u,f){f=f.props.ref,u.ref=f!==void 0?f:null}function Up(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 Vv(u){function f(gt,dt){if(u){var wt=gt.deletions;wt===null?(gt.deletions=[dt],gt.flags|=16):wt.push(dt)}}function y(gt,dt){if(!u)return null;for(;dt!==null;)f(gt,dt),dt=dt.sibling;return null}function M(gt){for(var dt=new Map;gt!==null;)gt.key!==null?dt.set(gt.key,gt):dt.set(gt.index,gt),gt=gt.sibling;return dt}function D(gt,dt){return gt=$a(gt,dt),gt.index=0,gt.sibling=null,gt}function j(gt,dt,wt){return gt.index=wt,u?(wt=gt.alternate,wt!==null?(wt=wt.index,wt<dt?(gt.flags|=67108866,dt):wt):(gt.flags|=67108866,dt)):(gt.flags|=1048576,dt)}function ue(gt){return u&&gt.alternate===null&&(gt.flags|=67108866),gt}function Pe(gt,dt,wt,Bt){return dt===null||dt.tag!==6?(dt=Pv(wt,gt.mode,Bt),dt.return=gt,dt):(dt=D(dt,wt),dt.return=gt,dt)}function rt(gt,dt,wt,Bt){var Vn=wt.type;return Vn===_?zt(gt,dt,wt.props.children,Bt,wt.key):dt!==null&&(dt.elementType===Vn||typeof Vn=="object"&&Vn!==null&&Vn.$$typeof===R&&wh(Vn)===dt.type)?(dt=D(dt,wt.props),sc(dt,wt),dt.return=gt,dt):(dt=pu(wt.type,wt.key,wt.props,null,gt.mode,Bt),sc(dt,wt),dt.return=gt,dt)}function Mt(gt,dt,wt,Bt){return dt===null||dt.tag!==4||dt.stateNode.containerInfo!==wt.containerInfo||dt.stateNode.implementation!==wt.implementation?(dt=Dv(wt,gt.mode,Bt),dt.return=gt,dt):(dt=D(dt,wt.children||[]),dt.return=gt,dt)}function zt(gt,dt,wt,Bt,Vn){return dt===null||dt.tag!==7?(dt=nf(wt,gt.mode,Bt,Vn),dt.return=gt,dt):(dt=D(dt,wt),dt.return=gt,dt)}function Vt(gt,dt,wt){if(typeof dt=="string"&&dt!==""||typeof dt=="number"||typeof dt=="bigint")return dt=Pv(""+dt,gt.mode,wt),dt.return=gt,dt;if(typeof dt=="object"&&dt!==null){switch(dt.$$typeof){case v:return wt=pu(dt.type,dt.key,dt.props,null,gt.mode,wt),sc(wt,dt),wt.return=gt,wt;case b:return dt=Dv(dt,gt.mode,wt),dt.return=gt,dt;case R:return dt=wh(dt),Vt(gt,dt,wt)}if(G(dt)||q(dt))return dt=nf(dt,gt.mode,wt,null),dt.return=gt,dt;if(typeof dt.then=="function")return Vt(gt,Im(dt),wt);if(dt.$$typeof===A)return Vt(gt,Fp(gt,dt),wt);Up(gt,dt)}return null}function At(gt,dt,wt,Bt){var Vn=dt!==null?dt.key:null;if(typeof wt=="string"&&wt!==""||typeof wt=="number"||typeof wt=="bigint")return Vn!==null?null:Pe(gt,dt,""+wt,Bt);if(typeof wt=="object"&&wt!==null){switch(wt.$$typeof){case v:return wt.key===Vn?rt(gt,dt,wt,Bt):null;case b:return wt.key===Vn?Mt(gt,dt,wt,Bt):null;case R:return wt=wh(wt),At(gt,dt,wt,Bt)}if(G(wt)||q(wt))return Vn!==null?null:zt(gt,dt,wt,Bt,null);if(typeof wt.then=="function")return At(gt,dt,Im(wt),Bt);if(wt.$$typeof===A)return At(gt,dt,Fp(gt,wt),Bt);Up(gt,wt)}return null}function Ot(gt,dt,wt,Bt,Vn){if(typeof Bt=="string"&&Bt!==""||typeof Bt=="number"||typeof Bt=="bigint")return gt=gt.get(wt)||null,Pe(dt,gt,""+Bt,Vn);if(typeof Bt=="object"&&Bt!==null){switch(Bt.$$typeof){case v:return gt=gt.get(Bt.key===null?wt:Bt.key)||null,rt(dt,gt,Bt,Vn);case b:return gt=gt.get(Bt.key===null?wt:Bt.key)||null,Mt(dt,gt,Bt,Vn);case R:return Bt=wh(Bt),Ot(gt,dt,wt,Bt,Vn)}if(G(Bt)||q(Bt))return gt=gt.get(wt)||null,zt(dt,gt,Bt,Vn,null);if(typeof Bt.then=="function")return Ot(gt,dt,wt,Im(Bt),Vn);if(Bt.$$typeof===A)return Ot(gt,dt,wt,Fp(dt,Bt),Vn);Up(dt,Bt)}return null}function Rn(gt,dt,wt,Bt){for(var Vn=null,Si=null,Ln=dt,Pr=dt=0,ii=null;Ln!==null&&Pr<wt.length;Pr++){Ln.index>Pr?(ii=Ln,Ln=null):ii=Ln.sibling;var wi=At(gt,Ln,wt[Pr],Bt);if(wi===null){Ln===null&&(Ln=ii);break}u&&Ln&&wi.alternate===null&&f(gt,Ln),dt=j(wi,dt,Pr),Si===null?Vn=wi:Si.sibling=wi,Si=wi,Ln=ii}if(Pr===wt.length)return y(gt,Ln),qr&&mu(gt,Pr),Vn;if(Ln===null){for(;Pr<wt.length;Pr++)Ln=Vt(gt,wt[Pr],Bt),Ln!==null&&(dt=j(Ln,dt,Pr),Si===null?Vn=Ln:Si.sibling=Ln,Si=Ln);return qr&&mu(gt,Pr),Vn}for(Ln=M(Ln);Pr<wt.length;Pr++)ii=Ot(Ln,gt,Pr,wt[Pr],Bt),ii!==null&&(u&&ii.alternate!==null&&Ln.delete(ii.key===null?Pr:ii.key),dt=j(ii,dt,Pr),Si===null?Vn=ii:Si.sibling=ii,Si=ii);return u&&Ln.forEach(function(l0){return f(gt,l0)}),qr&&mu(gt,Pr),Vn}function Jn(gt,dt,wt,Bt){if(wt==null)throw Error(r(151));for(var Vn=null,Si=null,Ln=dt,Pr=dt=0,ii=null,wi=wt.next();Ln!==null&&!wi.done;Pr++,wi=wt.next()){Ln.index>Pr?(ii=Ln,Ln=null):ii=Ln.sibling;var l0=At(gt,Ln,wi.value,Bt);if(l0===null){Ln===null&&(Ln=ii);break}u&&Ln&&l0.alternate===null&&f(gt,Ln),dt=j(l0,dt,Pr),Si===null?Vn=l0:Si.sibling=l0,Si=l0,Ln=ii}if(wi.done)return y(gt,Ln),qr&&mu(gt,Pr),Vn;if(Ln===null){for(;!wi.done;Pr++,wi=wt.next())wi=Vt(gt,wi.value,Bt),wi!==null&&(dt=j(wi,dt,Pr),Si===null?Vn=wi:Si.sibling=wi,Si=wi);return qr&&mu(gt,Pr),Vn}for(Ln=M(Ln);!wi.done;Pr++,wi=wt.next())wi=Ot(Ln,gt,Pr,wi.value,Bt),wi!==null&&(u&&wi.alternate!==null&&Ln.delete(wi.key===null?Pr:wi.key),dt=j(wi,dt,Pr),Si===null?Vn=wi:Si.sibling=wi,Si=wi);return u&&Ln.forEach(function(qZ){return f(gt,qZ)}),qr&&mu(gt,Pr),Vn}function Xi(gt,dt,wt,Bt){if(typeof wt=="object"&&wt!==null&&wt.type===_&&wt.key===null&&(wt=wt.props.children),typeof wt=="object"&&wt!==null){switch(wt.$$typeof){case v:e:{for(var Vn=wt.key;dt!==null;){if(dt.key===Vn){if(Vn=wt.type,Vn===_){if(dt.tag===7){y(gt,dt.sibling),Bt=D(dt,wt.props.children),Bt.return=gt,gt=Bt;break e}}else if(dt.elementType===Vn||typeof Vn=="object"&&Vn!==null&&Vn.$$typeof===R&&wh(Vn)===dt.type){y(gt,dt.sibling),Bt=D(dt,wt.props),sc(Bt,wt),Bt.return=gt,gt=Bt;break e}y(gt,dt);break}else f(gt,dt);dt=dt.sibling}wt.type===_?(Bt=nf(wt.props.children,gt.mode,Bt,wt.key),Bt.return=gt,gt=Bt):(Bt=pu(wt.type,wt.key,wt.props,null,gt.mode,Bt),sc(Bt,wt),Bt.return=gt,gt=Bt)}return ue(gt);case b:e:{for(Vn=wt.key;dt!==null;){if(dt.key===Vn)if(dt.tag===4&&dt.stateNode.containerInfo===wt.containerInfo&&dt.stateNode.implementation===wt.implementation){y(gt,dt.sibling),Bt=D(dt,wt.children||[]),Bt.return=gt,gt=Bt;break e}else{y(gt,dt);break}else f(gt,dt);dt=dt.sibling}Bt=Dv(wt,gt.mode,Bt),Bt.return=gt,gt=Bt}return ue(gt);case R:return wt=wh(wt),Xi(gt,dt,wt,Bt)}if(G(wt))return Rn(gt,dt,wt,Bt);if(q(wt)){if(Vn=q(wt),typeof Vn!="function")throw Error(r(150));return wt=Vn.call(wt),Jn(gt,dt,wt,Bt)}if(typeof wt.then=="function")return Xi(gt,dt,Im(wt),Bt);if(wt.$$typeof===A)return Xi(gt,dt,Fp(gt,wt),Bt);Up(gt,wt)}return typeof wt=="string"&&wt!==""||typeof wt=="number"||typeof wt=="bigint"?(wt=""+wt,dt!==null&&dt.tag===6?(y(gt,dt.sibling),Bt=D(dt,wt),Bt.return=gt,gt=Bt):(y(gt,dt),Bt=Pv(wt,gt.mode,Bt),Bt.return=gt,gt=Bt),ue(gt)):y(gt,dt)}return function(gt,dt,wt,Bt){try{Ch=0;var Vn=Xi(gt,dt,wt,Bt);return Eh=null,Vn}catch(Ln){if(Ln===Sh||Ln===Mr)throw Ln;var Si=_s(29,Ln,null,gt.mode);return Si.lanes=Bt,Si.return=gt,Si}finally{}}}var gd=Vv(!0),Gv=Vv(!1),Na=!1;function Om(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vy(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 vd(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,(Fn&2)!==0){var D=M.pending;return D===null?f.next=f:(f.next=D.next,D.next=f),M.pending=f,f=rc(u),ef(u,null,y),f}return Oo(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,Et(u,y)}}function Hn(u,f){var y=u.updateQueue,M=u.alternate;if(M!==null&&(M=M.updateQueue,y===M)){var D=null,j=null;if(y=y.firstBaseUpdate,y!==null){do{var ue={lane:y.lane,tag:y.tag,payload:y.payload,callback:null,next:null};j===null?D=j=ue:j=j.next=ue,y=y.next}while(y!==null);j===null?D=j=f:j=j.next=f}else D=j=f;y={baseState:M.baseState,firstBaseUpdate:D,lastBaseUpdate:j,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 Gy=!1;function Lm(){if(Gy){var u=ic;if(u!==null)throw u}}function Bp(u,f,y,M){Gy=!1;var D=u.updateQueue;Na=!1;var j=D.firstBaseUpdate,ue=D.lastBaseUpdate,Pe=D.shared.pending;if(Pe!==null){D.shared.pending=null;var rt=Pe,Mt=rt.next;rt.next=null,ue===null?j=Mt:ue.next=Mt,ue=rt;var zt=u.alternate;zt!==null&&(zt=zt.updateQueue,Pe=zt.lastBaseUpdate,Pe!==ue&&(Pe===null?zt.firstBaseUpdate=Mt:Pe.next=Mt,zt.lastBaseUpdate=rt))}if(j!==null){var Vt=D.baseState;ue=0,zt=Mt=rt=null,Pe=j;do{var At=Pe.lane&-536870913,Ot=At!==Pe.lane;if(Ot?(wr&At)===At:(M&At)===At){At!==0&&At===md&&(Gy=!0),zt!==null&&(zt=zt.next={lane:0,tag:Pe.tag,payload:Pe.payload,callback:null,next:null});e:{var Rn=u,Jn=Pe;At=f;var Xi=y;switch(Jn.tag){case 1:if(Rn=Jn.payload,typeof Rn=="function"){Vt=Rn.call(Xi,Vt,At);break e}Vt=Rn;break e;case 3:Rn.flags=Rn.flags&-65537|128;case 0:if(Rn=Jn.payload,At=typeof Rn=="function"?Rn.call(Xi,Vt,At):Rn,At==null)break e;Vt=h({},Vt,At);break e;case 2:Na=!0}}At=Pe.callback,At!==null&&(u.flags|=64,Ot&&(u.flags|=8192),Ot=D.callbacks,Ot===null?D.callbacks=[At]:Ot.push(At))}else Ot={lane:At,tag:Pe.tag,payload:Pe.payload,callback:Pe.callback,next:null},zt===null?(Mt=zt=Ot,rt=Vt):zt=zt.next=Ot,ue|=At;if(Pe=Pe.next,Pe===null){if(Pe=D.shared.pending,Pe===null)break;Ot=Pe,Pe=Ot.next,Ot.next=null,D.lastBaseUpdate=Ot,D.shared.pending=null}}while(!0);zt===null&&(rt=Vt),D.baseState=rt,D.firstBaseUpdate=Mt,D.lastBaseUpdate=zt,j===null&&(D.shared.lanes=0),Nu|=ue,u.lanes=ue,u.memoizedState=Vt}}function Hp(u,f){if(typeof u!="function")throw Error(r(191,u));u.call(f)}function jw(u,f){var y=u.callbacks;if(y!==null)for(u.callbacks=null,u=0;u<y.length;u++)Hp(y[u],f)}var Vp=z(null),Wv=z(0);function Fw(u,f){u=Nl,V(Wv,u),V(Vp,f),Nl=u|f.baseLanes}function Wy(){V(Wv,Nl),V(Vp,Vp.current)}function zm(){Nl=Wv.current,X(Vp),X(Wv)}var Ya=z(null),Ra=null;function xd(u){var f=u.alternate;V(Xr,Xr.current&1),V(Ya,u),Ra===null&&(f===null||Vp.current!==null||f.memoizedState!==null)&&(Ra=u)}function $y(u){V(Xr,Xr.current),V(Ya,u),Ra===null&&(Ra=u)}function Uw(u){u.tag===22?(V(Xr,Xr.current),V(Ya,u),Ra===null&&(Ra=u)):Ka()}function Ka(){V(Xr,Xr.current),V(Ya,Ya.current)}function Ws(u){X(Ya),Ra===u&&(Ra=null),X(Xr)}var Xr=z(0);function El(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,xr=null,Li=null,Ur=null,oc=!1,Gp=!1,Ah=!1,$v=0,jm=0,Wp=null,qy=0;function ws(){throw Error(r(321))}function Xy(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 qv(u,f,y,M,D,j){return ls=j,xr=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,$.H=u===null||u.memoizedState===null?x3:pb,Ah=!1,j=y(M,D),Ah=!1,Gp&&(j=Nh(f,y,M,D)),Bw(u),j}function Bw(u){$.H=$p;var f=Li!==null&&Li.next!==null;if(ls=0,Ur=Li=xr=null,oc=!1,jm=0,Wp=null,f)throw Error(r(300));u===null||lo||(u=u.dependencies,u!==null&&km(u)&&(lo=!0))}function Nh(u,f,y,M){xr=u;var D=0;do{if(Gp&&(Wp=null),jm=0,Gp=!1,25<=D)throw Error(r(301));if(D+=1,Ur=Li=null,u.updateQueue!=null){var j=u.updateQueue;j.lastEffect=null,j.events=null,j.stores=null,j.memoCache!=null&&(j.memoCache.index=0)}$.H=ac,j=f(y,M)}while(Gp);return j}function Rh(){var u=$.H,f=u.useState()[0];return f=typeof f.then=="function"?Fm(f):f,u=u.useState()[0],(Li!==null?Li.memoizedState:null)!==u&&(xr.flags|=1024),f}function Yy(){var u=$v!==0;return $v=0,u}function Ky(u,f,y){f.updateQueue=u.updateQueue,f.flags&=-2053,u.lanes&=~y}function Zy(u){if(oc){for(u=u.memoizedState;u!==null;){var f=u.queue;f!==null&&(f.pending=null),u=u.next}oc=!1}ls=0,Ur=Li=xr=null,Gp=!1,jm=$v=0,Wp=null}function bo(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ur===null?xr.memoizedState=Ur=u:Ur=Ur.next=u,Ur}function $s(){if(Li===null){var u=xr.alternate;u=u!==null?u.memoizedState:null}else u=Li.next;var f=Ur===null?xr.memoizedState:Ur.next;if(f!==null)Ur=f,Li=u;else{if(u===null)throw xr.alternate===null?Error(r(467)):Error(r(310));Li=u,u={memoizedState:Li.memoizedState,baseState:Li.baseState,baseQueue:Li.baseQueue,queue:Li.queue,next:null},Ur===null?xr.memoizedState=Ur=u:Ur=Ur.next=u}return Ur}function Xv(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Fm(u){var f=jm;return jm+=1,Wp===null&&(Wp=[]),u=Hv(Wp,u,f),f=xr,(Ur===null?f.memoizedState:Ur.next)===null&&(f=f.alternate,$.H=f===null||f.memoizedState===null?x3:pb),u}function ff(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return Fm(u);if(u.$$typeof===A)return nr(u)}throw Error(r(438,String(u)))}function Qy(u){var f=null,y=xr.updateQueue;if(y!==null&&(f=y.memoCache),f==null){var M=xr.alternate;M!==null&&(M=M.updateQueue,M!==null&&(M=M.memoCache,M!=null&&(f={data:M.data.map(function(D){return D.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),y===null&&(y=Xv(),xr.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]=F;return f.index++,y}function yd(u,f){return typeof f=="function"?f(u):f}function Yv(u){var f=$s();return Jy(f,Li,u)}function Jy(u,f,y){var M=u.queue;if(M===null)throw Error(r(311));M.lastRenderedReducer=y;var D=u.baseQueue,j=M.pending;if(j!==null){if(D!==null){var ue=D.next;D.next=j.next,j.next=ue}f.baseQueue=D=j,M.pending=null}if(j=u.baseState,D===null)u.memoizedState=j;else{f=D.next;var Pe=ue=null,rt=null,Mt=f,zt=!1;do{var Vt=Mt.lane&-536870913;if(Vt!==Mt.lane?(wr&Vt)===Vt:(ls&Vt)===Vt){var At=Mt.revertLane;if(At===0)rt!==null&&(rt=rt.next={lane:0,revertLane:0,gesture:null,action:Mt.action,hasEagerState:Mt.hasEagerState,eagerState:Mt.eagerState,next:null}),Vt===md&&(zt=!0);else if((ls&At)===At){Mt=Mt.next,At===md&&(zt=!0);continue}else Vt={lane:0,revertLane:Mt.revertLane,gesture:null,action:Mt.action,hasEagerState:Mt.hasEagerState,eagerState:Mt.eagerState,next:null},rt===null?(Pe=rt=Vt,ue=j):rt=rt.next=Vt,xr.lanes|=At,Nu|=At;Vt=Mt.action,Ah&&y(j,Vt),j=Mt.hasEagerState?Mt.eagerState:y(j,Vt)}else At={lane:Vt,revertLane:Mt.revertLane,gesture:Mt.gesture,action:Mt.action,hasEagerState:Mt.hasEagerState,eagerState:Mt.eagerState,next:null},rt===null?(Pe=rt=At,ue=j):rt=rt.next=At,xr.lanes|=Vt,Nu|=Vt;Mt=Mt.next}while(Mt!==null&&Mt!==f);if(rt===null?ue=j:rt.next=Pe,!tr(j,u.memoizedState)&&(lo=!0,zt&&(y=ic,y!==null)))throw y;u.memoizedState=j,u.baseState=ue,u.baseQueue=rt,M.lastRenderedState=j}return D===null&&(M.lanes=0),[u.memoizedState,M.dispatch]}function eb(u){var f=$s(),y=f.queue;if(y===null)throw Error(r(311));y.lastRenderedReducer=u;var M=y.dispatch,D=y.pending,j=f.memoizedState;if(D!==null){y.pending=null;var ue=D=D.next;do j=u(j,ue.action),ue=ue.next;while(ue!==D);tr(j,f.memoizedState)||(lo=!0),f.memoizedState=j,f.baseQueue===null&&(f.baseState=j),y.lastRenderedState=j}return[j,M]}function Hw(u,f,y){var M=xr,D=$s(),j=qr;if(j){if(y===void 0)throw Error(r(407));y=y()}else y=f();var ue=!tr((Li||D).memoizedState,y);if(ue&&(D.memoizedState=y,lo=!0),D=D.queue,lb(Ww.bind(null,M,D,u),[u]),D.getSnapshot!==f||ue||Ur!==null&&Ur.memoizedState.tag&1){if(M.flags|=2048,hf(9,{destroy:void 0},Gw.bind(null,M,D,y,f),null),cr===null)throw Error(r(349));j||(ls&127)!==0||Vw(M,f,y)}return y}function Vw(u,f,y){u.flags|=16384,u={getSnapshot:f,value:y},f=xr.updateQueue,f===null?(f=Xv(),xr.updateQueue=f,f.stores=[u]):(y=f.stores,y===null?f.stores=[u]:y.push(u))}function Gw(u,f,y,M){f.value=y,f.getSnapshot=M,$w(f)&&qw(u)}function Ww(u,f,y){return y(function(){$w(f)&&qw(u)})}function $w(u){var f=u.getSnapshot;u=u.value;try{var y=f();return!tr(u,y)}catch{return!0}}function qw(u){var f=Aa(u,2);f!==null&&Er(f,u,2)}function tb(u){var f=bo();if(typeof u=="function"){var y=u;if(u=y(),Ah){Fe(!0);try{y()}finally{Fe(!1)}}}return f.memoizedState=f.baseState=u,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:yd,lastRenderedState:u},f}function nb(u,f,y,M){return u.baseState=y,Jy(u,Li,typeof M=="function"?M:yd)}function zE(u,f,y,M,D){if(Jv(u))throw Error(r(485));if(u=f.action,u!==null){var j={payload:D,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(ue){j.listeners.push(ue)}};$.T!==null?y(!0):j.isTransition=!1,M(j),y=f.pending,y===null?(j.next=f.pending=j,Xw(f,j)):(j.next=y.next,f.pending=y.next=j)}}function Xw(u,f){var y=f.action,M=f.payload,D=u.state;if(f.isTransition){var j=$.T,ue={};$.T=ue;try{var Pe=y(D,M),rt=$.S;rt!==null&&rt(ue,Pe),Yw(u,f,Pe)}catch(Mt){rb(u,f,Mt)}finally{j!==null&&ue.types!==null&&(j.types=ue.types),$.T=j}}else try{j=y(D,M),Yw(u,f,j)}catch(Mt){rb(u,f,Mt)}}function Yw(u,f,y){y!==null&&typeof y=="object"&&typeof y.then=="function"?y.then(function(M){Kw(u,f,M)},function(M){return rb(u,f,M)}):Kw(u,f,y)}function Kw(u,f,y){f.status="fulfilled",f.value=y,Zw(f),u.state=y,f=u.pending,f!==null&&(y=f.next,y===f?u.pending=null:(y=y.next,f.next=y,Xw(u,y)))}function rb(u,f,y){var M=u.pending;if(u.pending=null,M!==null){M=M.next;do f.status="rejected",f.reason=y,Zw(f),f=f.next;while(f!==M)}u.action=null}function Zw(u){u=u.listeners;for(var f=0;f<u.length;f++)(0,u[f])()}function ib(u,f){return f}function sb(u,f){if(qr){var y=cr.formState;if(y!==null){e:{var M=xr;if(qr){if(Wi){t:{for(var D=Wi,j=Ml;D.nodeType!==8;){if(!j){D=null;break t}if(D=Pu(D.nextSibling),D===null){D=null;break t}}j=D.data,D=j==="F!"||j==="F"?D:null}if(D){Wi=Pu(D.nextSibling),M=D.data==="F!";break e}}vu(M)}M=!1}M&&(f=y[0])}}return y=bo(),y.memoizedState=y.baseState=f,M={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ib,lastRenderedState:f},y.queue=M,y=m3.bind(null,xr,M),M.dispatch=y,M=tb(!1),j=hb.bind(null,xr,!1,M.queue),M=bo(),D={state:f,dispatch:null,action:u,pending:null},M.queue=D,y=zE.bind(null,xr,D,j,y),D.dispatch=y,M.memoizedState=u,[f,y,!1]}function Qw(u){var f=$s();return ob(f,Li,u)}function ob(u,f,y){if(f=Jy(u,f,ib)[0],u=Yv(yd)[0],typeof f=="object"&&f!==null&&typeof f.then=="function")try{var M=Fm(f)}catch(ue){throw ue===Sh?Mr:ue}else M=f;f=$s();var D=f.queue,j=D.dispatch;return y!==f.memoizedState&&(xr.flags|=2048,hf(9,{destroy:void 0},Jw.bind(null,D,y),null)),[M,j,u]}function Jw(u,f){u.action=f}function ab(u){var f=$s(),y=Li;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=xr.updateQueue,f===null&&(f=Xv(),xr.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 Kv(){return $s().memoizedState}function Zv(u,f,y,M){var D=bo();xr.flags|=u,D.memoizedState=hf(1|f,{destroy:void 0},y,M===void 0?null:M)}function Qv(u,f,y,M){var D=$s();M=M===void 0?null:M;var j=D.memoizedState.inst;Li!==null&&M!==null&&Xy(M,Li.memoizedState.deps)?D.memoizedState=hf(f,j,y,M):(xr.flags|=u,D.memoizedState=hf(1|f,j,y,M))}function e3(u,f){Zv(8390656,8,u,f)}function lb(u,f){Qv(2048,8,u,f)}function t3(u){xr.flags|=4;var f=xr.updateQueue;if(f===null)f=Xv(),xr.updateQueue=f,f.events=[u];else{var y=f.events;y===null?f.events=[u]:y.push(u)}}function n3(u){var f=$s().memoizedState;return t3({ref:f,nextImpl:u}),function(){if((Fn&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}function r3(u,f){return Qv(4,2,u,f)}function i3(u,f){return Qv(4,4,u,f)}function s3(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 o3(u,f,y){y=y!=null?y.concat([u]):null,Qv(4,4,s3.bind(null,f,u),y)}function cb(){}function a3(u,f){var y=$s();f=f===void 0?null:f;var M=y.memoizedState;return f!==null&&Xy(f,M[1])?M[0]:(y.memoizedState=[u,f],u)}function l3(u,f){var y=$s();f=f===void 0?null:f;var M=y.memoizedState;if(f!==null&&Xy(f,M[1]))return M[0];if(M=u(),Ah){Fe(!0);try{u()}finally{Fe(!1)}}return y.memoizedState=[M,f],M}function ub(u,f,y){return y===void 0||(ls&1073741824)!==0&&(wr&261930)===0?u.memoizedState=f:(u.memoizedState=y,u=Or(),xr.lanes|=u,Nu|=u,y)}function c3(u,f,y,M){return tr(y,f)?y:Vp.current!==null?(u=ub(u,y,M),tr(u,f)||(lo=!0),u):(ls&42)===0||(ls&1073741824)!==0&&(wr&261930)===0?(lo=!0,u.memoizedState=y):(u=Or(),xr.lanes|=u,Nu|=u,f)}function u3(u,f,y,M,D){var j=K.p;K.p=j!==0&&8>j?j:8;var ue=$.T,Pe={};$.T=Pe,hb(u,!1,f,y);try{var rt=D(),Mt=$.S;if(Mt!==null&&Mt(Pe,rt),rt!==null&&typeof rt=="object"&&typeof rt.then=="function"){var zt=By(rt,M);Um(u,f,zt,kl(u))}else Um(u,f,M,kl(u))}catch(Vt){Um(u,f,{then:function(){},status:"rejected",reason:Vt},kl())}finally{K.p=j,ue!==null&&Pe.types!==null&&(ue.types=Pe.types),$.T=ue}}function jE(){}function db(u,f,y,M){if(u.tag!==5)throw Error(r(476));var D=d3(u).queue;u3(u,D,f,Y,y===null?jE:function(){return f3(u),y(M)})}function d3(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:yd,lastRenderedState:Y},next:null};var y={};return f.next={memoizedState:y,baseState:y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:yd,lastRenderedState:y},next:null},u.memoizedState=f,u=u.alternate,u!==null&&(u.memoizedState=f),f}function f3(u){var f=d3(u);f.next===null&&(f=u.alternate.memoizedState),Um(u,f.next.queue,{},kl())}function fb(){return nr(Ib)}function h3(){return $s().memoizedState}function p3(){return $s().memoizedState}function FE(u){for(var f=u.return;f!==null;){switch(f.tag){case 24:case 3:var y=kl();u=vd(y);var M=uf(f,u,y);M!==null&&(Er(M,f,y),df(M,f,y)),f={cache:jy()},u.payload=f;return}f=f.return}}function UE(u,f,y){var M=kl();y={lane:M,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},Jv(u)?g3(f,y):(y=Rv(u,f,y,M),y!==null&&(Er(y,u,M),v3(y,f,M)))}function m3(u,f,y){var M=kl();Um(u,f,y,M)}function Um(u,f,y,M){var D={lane:M,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null};if(Jv(u))g3(f,D);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=f.lastRenderedReducer,j!==null))try{var ue=f.lastRenderedState,Pe=j(ue,y);if(D.hasEagerState=!0,D.eagerState=Pe,tr(Pe,ue))return Oo(u,f,D,0),cr===null&&Nm(),!1}catch{}finally{}if(y=Rv(u,f,D,M),y!==null)return Er(y,u,M),v3(y,f,M),!0}return!1}function hb(u,f,y,M){if(M={lane:2,revertLane:Pt(),gesture:null,action:M,hasEagerState:!1,eagerState:null,next:null},Jv(u)){if(f)throw Error(r(479))}else f=Rv(u,y,M,2),f!==null&&Er(f,u,2)}function Jv(u){var f=u.alternate;return u===xr||f!==null&&f===xr}function g3(u,f){Gp=oc=!0;var y=u.pending;y===null?f.next=f:(f.next=y.next,y.next=f),u.pending=f}function v3(u,f,y){if((y&4194048)!==0){var M=f.lanes;M&=u.pendingLanes,y|=M,f.lanes=y,Et(u,y)}}var $p={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};$p.useEffectEvent=ws;var x3={readContext:nr,use:ff,useCallback:function(u,f){return bo().memoizedState=[u,f===void 0?null:f],u},useContext:nr,useEffect:e3,useImperativeHandle:function(u,f,y){y=y!=null?y.concat([u]):null,Zv(4194308,4,s3.bind(null,f,u),y)},useLayoutEffect:function(u,f){return Zv(4194308,4,u,f)},useInsertionEffect:function(u,f){Zv(4,2,u,f)},useMemo:function(u,f){var y=bo();f=f===void 0?null:f;var M=u();if(Ah){Fe(!0);try{u()}finally{Fe(!1)}}return y.memoizedState=[M,f],M},useReducer:function(u,f,y){var M=bo();if(y!==void 0){var D=y(f);if(Ah){Fe(!0);try{y(f)}finally{Fe(!1)}}}else D=f;return M.memoizedState=M.baseState=D,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:D},M.queue=u,u=u.dispatch=UE.bind(null,xr,u),[M.memoizedState,u]},useRef:function(u){var f=bo();return u={current:u},f.memoizedState=u},useState:function(u){u=tb(u);var f=u.queue,y=m3.bind(null,xr,f);return f.dispatch=y,[u.memoizedState,y]},useDebugValue:cb,useDeferredValue:function(u,f){var y=bo();return ub(y,u,f)},useTransition:function(){var u=tb(!1);return u=u3.bind(null,xr,u.queue,!0,!1),bo().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,f,y){var M=xr,D=bo();if(qr){if(y===void 0)throw Error(r(407));y=y()}else{if(y=f(),cr===null)throw Error(r(349));(wr&127)!==0||Vw(M,f,y)}D.memoizedState=y;var j={value:y,getSnapshot:f};return D.queue=j,e3(Ww.bind(null,M,j,u),[u]),M.flags|=2048,hf(9,{destroy:void 0},Gw.bind(null,M,j,y,f),null),y},useId:function(){var u=bo(),f=cr.identifierPrefix;if(qr){var y=zc,M=Ss;y=(M&~(1<<32-we(M)-1)).toString(32)+y,f="_"+f+"R_"+y,y=$v++,0<y&&(f+="H"+y.toString(32)),f+="_"}else y=qy++,f="_"+f+"r_"+y.toString(32)+"_";return u.memoizedState=f},useHostTransitionStatus:fb,useFormState:sb,useActionState:sb,useOptimistic:function(u){var f=bo();f.memoizedState=f.baseState=u;var y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=y,f=hb.bind(null,xr,!0,y),y.dispatch=f,[u,f]},useMemoCache:Qy,useCacheRefresh:function(){return bo().memoizedState=FE.bind(null,xr)},useEffectEvent:function(u){var f=bo(),y={impl:u};return f.memoizedState=y,function(){if((Fn&2)!==0)throw Error(r(440));return y.impl.apply(void 0,arguments)}}},pb={readContext:nr,use:ff,useCallback:a3,useContext:nr,useEffect:lb,useImperativeHandle:o3,useInsertionEffect:r3,useLayoutEffect:i3,useMemo:l3,useReducer:Yv,useRef:Kv,useState:function(){return Yv(yd)},useDebugValue:cb,useDeferredValue:function(u,f){var y=$s();return c3(y,Li.memoizedState,u,f)},useTransition:function(){var u=Yv(yd)[0],f=$s().memoizedState;return[typeof u=="boolean"?u:Fm(u),f]},useSyncExternalStore:Hw,useId:h3,useHostTransitionStatus:fb,useFormState:Qw,useActionState:Qw,useOptimistic:function(u,f){var y=$s();return nb(y,Li,u,f)},useMemoCache:Qy,useCacheRefresh:p3};pb.useEffectEvent=n3;var ac={readContext:nr,use:ff,useCallback:a3,useContext:nr,useEffect:lb,useImperativeHandle:o3,useInsertionEffect:r3,useLayoutEffect:i3,useMemo:l3,useReducer:eb,useRef:Kv,useState:function(){return eb(yd)},useDebugValue:cb,useDeferredValue:function(u,f){var y=$s();return Li===null?ub(y,u,f):c3(y,Li.memoizedState,u,f)},useTransition:function(){var u=eb(yd)[0],f=$s().memoizedState;return[typeof u=="boolean"?u:Fm(u),f]},useSyncExternalStore:Hw,useId:h3,useHostTransitionStatus:fb,useFormState:ab,useActionState:ab,useOptimistic:function(u,f){var y=$s();return Li!==null?nb(y,Li,u,f):(y.baseState=u,[u,y.queue.dispatch])},useMemoCache:Qy,useCacheRefresh:p3};ac.useEffectEvent=n3;function ex(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 Bm={enqueueSetState:function(u,f,y){u=u._reactInternals;var M=kl(),D=vd(M);D.payload=f,y!=null&&(D.callback=y),f=uf(u,D,M),f!==null&&(Er(f,u,M),df(f,u,M))},enqueueReplaceState:function(u,f,y){u=u._reactInternals;var M=kl(),D=vd(M);D.tag=1,D.payload=f,y!=null&&(D.callback=y),f=uf(u,D,M),f!==null&&(Er(f,u,M),df(f,u,M))},enqueueForceUpdate:function(u,f){u=u._reactInternals;var y=kl(),M=vd(y);M.tag=2,f!=null&&(M.callback=f),f=uf(u,M,y),f!==null&&(Er(f,u,y),df(f,u,y))}};function mb(u,f,y,M,D,j,ue){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(M,j,ue):f.prototype&&f.prototype.isPureReactComponent?!fr(y,M)||!fr(D,j):!0}function gb(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&&Bm.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 D in u)y[D]===void 0&&(y[D]=u[D])}return y}function y3(u){Am(u)}function vb(u){console.error(u)}function xb(u){Am(u)}function tx(u,f){try{var y=u.onUncaughtError;y(f.value,{componentStack:f.stack})}catch(M){setTimeout(function(){throw M})}}function b3(u,f,y){try{var M=u.onCaughtError;M(y.value,{componentStack:y.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(D){setTimeout(function(){throw D})}}function yb(u,f,y){return y=vd(y),y.tag=3,y.payload={element:null},y.callback=function(){tx(u,f)},y}function bb(u){return u=vd(u),u.tag=3,u}function _3(u,f,y,M){var D=y.type.getDerivedStateFromError;if(typeof D=="function"){var j=M.value;u.payload=function(){return D(j)},u.callback=function(){b3(f,y,M)}}var ue=y.stateNode;ue!==null&&typeof ue.componentDidCatch=="function"&&(u.callback=function(){b3(f,y,M),typeof D!="function"&&(Ys===null?Ys=new Set([this]):Ys.add(this));var Pe=M.stack;this.componentDidCatch(M.value,{componentStack:Pe!==null?Pe:""})})}function _o(u,f,y,M,D){if(y.flags|=32768,M!==null&&typeof M=="object"&&typeof M.then=="function"){if(f=y.alternate,f!==null&&_u(f,y,D,!0),y=Ya.current,y!==null){switch(y.tag){case 31:case 13:return Ra===null?Jp():y.alternate===null&&Ms===0&&(Ms=3),y.flags&=-257,y.flags|=65536,y.lanes=D,M===Bv?y.flags|=16384:(f=y.updateQueue,f===null?y.updateQueue=new Set([M]):f.add(M),Jm(u,M,D)),!1;case 22:return y.flags|=65536,M===Bv?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)),Jm(u,M,D)),!1}throw Error(r(435,y.tag))}return Jm(u,M,D),Jp(),!1}if(qr)return f=Ya.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=D,M!==Lp&&(u=Error(r(422),{cause:M}),xu(wl(u,y)))):(M!==Lp&&(f=Error(r(423),{cause:M}),xu(wl(f,y))),u=u.current.alternate,u.flags|=65536,D&=-D,u.lanes|=D,M=wl(M,y),D=yb(u.stateNode,M,D),Hn(u,D),Ms!==4&&(Ms=2)),!1;var j=Error(r(520),{cause:M});if(j=wl(j,y),jh===null?jh=[j]:jh.push(j),Ms!==4&&(Ms=2),f===null)return!0;M=wl(M,y),y=f;do{switch(y.tag){case 3:return y.flags|=65536,u=D&-D,y.lanes|=u,u=yb(y.stateNode,M,u),Hn(y,u),!1;case 1:if(f=y.type,j=y.stateNode,(y.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||j!==null&&typeof j.componentDidCatch=="function"&&(Ys===null||!Ys.has(j))))return y.flags|=65536,D&=-D,y.lanes|=D,D=bb(D),_3(D,u,y,M),Hn(y,D),!1}y=y.return}while(y!==null);return!1}var nx=Error(r(461)),lo=!1;function Lo(u,f,y,M){f.child=u===null?Gv(f,null,y,M):gd(f,u.child,y,M)}function _b(u,f,y,M,D){y=y.render;var j=f.ref;if("ref"in M){var ue={};for(var Pe in M)Pe!=="ref"&&(ue[Pe]=M[Pe])}else ue=M;return lf(f),M=qv(u,f,y,ue,j,D),Pe=Yy(),u!==null&&!lo?(Ky(u,f,D),qs(u,f,D)):(qr&&Pe&&gu(f),f.flags|=1,Lo(u,f,M,D),f.child)}function kh(u,f,y,M,D){if(u===null){var j=y.type;return typeof j=="function"&&!kv(j)&&j.defaultProps===void 0&&y.compare===null?(f.tag=15,f.type=j,rx(u,f,j,M,D)):(u=pu(y.type,null,M,f,f.mode,D),u.ref=f.ref,u.return=f,f.child=u)}if(j=u.child,!cx(u,D)){var ue=j.memoizedProps;if(y=y.compare,y=y!==null?y:fr,y(ue,M)&&u.ref===f.ref)return qs(u,f,D)}return f.flags|=1,u=$a(j,M),u.ref=f.ref,u.return=f,f.child=u}function rx(u,f,y,M,D){if(u!==null){var j=u.memoizedProps;if(fr(j,M)&&u.ref===f.ref)if(lo=!1,f.pendingProps=M=j,cx(u,D))(u.flags&131072)!==0&&(lo=!0);else return f.lanes=u.lanes,qs(u,f,D)}return qp(u,f,y,M,D)}function Ph(u,f,y,M){var D=M.children,j=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(j=j!==null?j.baseLanes|y:y,u!==null){for(M=f.child=u.child,D=0;M!==null;)D=D|M.lanes|M.childLanes,M=M.sibling;M=D&~j}else M=0,f.child=null;return Za(u,f,j,y,M)}if((y&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},u!==null&&Pm(f,j!==null?j.cachePool:null),j!==null?Fw(f,j):Wy(),Uw(f);else return M=f.lanes=536870912,Za(u,f,j!==null?j.baseLanes|y:y,y,M)}else j!==null?(Pm(f,j.cachePool),Fw(f,j),Ka(),f.memoizedState=null):(u!==null&&Pm(f,null),Wy(),Ka());return Lo(u,f,D,y),f.child}function wu(u,f){return u!==null&&u.tag===22||f.stateNode!==null||(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.sibling}function Za(u,f,y,M,D){var j=Uv();return j=j===null?null:{parent:ao._currentValue,pool:j},f.memoizedState={baseLanes:y,cachePool:j},u!==null&&Pm(f,null),Wy(),Uw(f),u!==null&&_u(u,f,M,!0),f.childLanes=D,null}function ix(u,f){return f=lx({mode:f.mode,children:f.children},u.mode),f.ref=u.ref,u.child=f,f.return=u,f}function S3(u,f,y){return gd(f,u.child,null,y),u=ix(f,f.pendingProps),u.flags|=2,Ws(f),f.memoizedState=null,u}function sx(u,f,y){var M=f.pendingProps,D=(f.flags&128)!==0;if(f.flags&=-129,u===null){if(qr){if(M.mode==="hidden")return u=ix(f,M),f.lanes=536870912,wu(null,u);if($y(f),(u=Wi)?(u=iP(u,Ml),u=u!==null&&u.data==="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:fd!==null?{id:Ss,overflow:zc}:null,retryLane:536870912,hydrationErrors:null},y=Dp(u),y.return=f,f.child=y,Ls=f,Wi=null)):u=null,u===null)throw vu(f);return f.lanes=536870912,null}return ix(f,M)}var j=u.memoizedState;if(j!==null){var ue=j.dehydrated;if($y(f),D)if(f.flags&256)f.flags&=-257,f=S3(u,f,y);else if(f.memoizedState!==null)f.child=u.child,f.flags|=128,f=null;else throw Error(r(558));else if(lo||_u(u,f,y,!1),D=(y&u.childLanes)!==0,lo||D){if(M=cr,M!==null&&(ue=Dt(M,y),ue!==0&&ue!==j.retryLane))throw j.retryLane=ue,Aa(u,ue),Er(M,u,ue),nx;Jp(),f=S3(u,f,y)}else u=j.treeContext,Wi=Pu(ue.nextSibling),Ls=f,qr=!0,hd=null,Ml=!1,u!==null&&Ov(f,u),f=ix(f,M),f.flags|=4096;return f}return u=$a(u.child,{mode:M.mode,children:M.children}),u.ref=f.ref,f.child=u,u.return=f,u}function Dh(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 qp(u,f,y,M,D){return lf(f),y=qv(u,f,y,M,void 0,D),M=Yy(),u!==null&&!lo?(Ky(u,f,D),qs(u,f,D)):(qr&&M&&gu(f),f.flags|=1,Lo(u,f,y,D),f.child)}function Hm(u,f,y,M,D,j){return lf(f),f.updateQueue=null,y=Nh(f,M,y,D),Bw(u),M=Yy(),u!==null&&!lo?(Ky(u,f,j),qs(u,f,j)):(qr&&M&&gu(f),f.flags|=1,Lo(u,f,y,j),f.child)}function ox(u,f,y,M,D){if(lf(f),f.stateNode===null){var j=tf,ue=y.contextType;typeof ue=="object"&&ue!==null&&(j=nr(ue)),j=new y(M,j),f.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,j.updater=Bm,f.stateNode=j,j._reactInternals=f,j=f.stateNode,j.props=M,j.state=f.memoizedState,j.refs={},Om(f),ue=y.contextType,j.context=typeof ue=="object"&&ue!==null?nr(ue):tf,j.state=f.memoizedState,ue=y.getDerivedStateFromProps,typeof ue=="function"&&(ex(f,y,ue,M),j.state=f.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof j.getSnapshotBeforeUpdate=="function"||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(ue=j.state,typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount(),ue!==j.state&&Bm.enqueueReplaceState(j,j.state,null),Bp(f,M,j,D),Lm(),j.state=f.memoizedState),typeof j.componentDidMount=="function"&&(f.flags|=4194308),M=!0}else if(u===null){j=f.stateNode;var Pe=f.memoizedProps,rt=pf(y,Pe);j.props=rt;var Mt=j.context,zt=y.contextType;ue=tf,typeof zt=="object"&&zt!==null&&(ue=nr(zt));var Vt=y.getDerivedStateFromProps;zt=typeof Vt=="function"||typeof j.getSnapshotBeforeUpdate=="function",Pe=f.pendingProps!==Pe,zt||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(Pe||Mt!==ue)&&gb(f,j,M,ue),Na=!1;var At=f.memoizedState;j.state=At,Bp(f,M,j,D),Lm(),Mt=f.memoizedState,Pe||At!==Mt||Na?(typeof Vt=="function"&&(ex(f,y,Vt,M),Mt=f.memoizedState),(rt=Na||mb(f,y,rt,M,At,Mt,ue))?(zt||typeof j.UNSAFE_componentWillMount!="function"&&typeof j.componentWillMount!="function"||(typeof j.componentWillMount=="function"&&j.componentWillMount(),typeof j.UNSAFE_componentWillMount=="function"&&j.UNSAFE_componentWillMount()),typeof j.componentDidMount=="function"&&(f.flags|=4194308)):(typeof j.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=M,f.memoizedState=Mt),j.props=M,j.state=Mt,j.context=ue,M=rt):(typeof j.componentDidMount=="function"&&(f.flags|=4194308),M=!1)}else{j=f.stateNode,Vy(u,f),ue=f.memoizedProps,zt=pf(y,ue),j.props=zt,Vt=f.pendingProps,At=j.context,Mt=y.contextType,rt=tf,typeof Mt=="object"&&Mt!==null&&(rt=nr(Mt)),Pe=y.getDerivedStateFromProps,(Mt=typeof Pe=="function"||typeof j.getSnapshotBeforeUpdate=="function")||typeof j.UNSAFE_componentWillReceiveProps!="function"&&typeof j.componentWillReceiveProps!="function"||(ue!==Vt||At!==rt)&&gb(f,j,M,rt),Na=!1,At=f.memoizedState,j.state=At,Bp(f,M,j,D),Lm();var Ot=f.memoizedState;ue!==Vt||At!==Ot||Na||u!==null&&u.dependencies!==null&&km(u.dependencies)?(typeof Pe=="function"&&(ex(f,y,Pe,M),Ot=f.memoizedState),(zt=Na||mb(f,y,zt,M,At,Ot,rt)||u!==null&&u.dependencies!==null&&km(u.dependencies))?(Mt||typeof j.UNSAFE_componentWillUpdate!="function"&&typeof j.componentWillUpdate!="function"||(typeof j.componentWillUpdate=="function"&&j.componentWillUpdate(M,Ot,rt),typeof j.UNSAFE_componentWillUpdate=="function"&&j.UNSAFE_componentWillUpdate(M,Ot,rt)),typeof j.componentDidUpdate=="function"&&(f.flags|=4),typeof j.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof j.componentDidUpdate!="function"||ue===u.memoizedProps&&At===u.memoizedState||(f.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||ue===u.memoizedProps&&At===u.memoizedState||(f.flags|=1024),f.memoizedProps=M,f.memoizedState=Ot),j.props=M,j.state=Ot,j.context=rt,M=zt):(typeof j.componentDidUpdate!="function"||ue===u.memoizedProps&&At===u.memoizedState||(f.flags|=4),typeof j.getSnapshotBeforeUpdate!="function"||ue===u.memoizedProps&&At===u.memoizedState||(f.flags|=1024),M=!1)}return j=M,Dh(u,f),M=(f.flags&128)!==0,j||M?(j=f.stateNode,y=M&&typeof y.getDerivedStateFromError!="function"?null:j.render(),f.flags|=1,u!==null&&M?(f.child=gd(f,u.child,null,D),f.child=gd(f,null,y,D)):Lo(u,f,y,D),f.memoizedState=j.state,u=f.child):u=qs(u,f,D),u}function w3(u,f,y,M){return of(),f.flags|=256,Lo(u,f,y,M),f.child}var Sb={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function ha(u){return{baseLanes:u,cachePool:Hy()}}function ax(u,f,y){return u=u!==null?u.childLanes&~y:0,f&&(u|=Da),u}function M3(u,f,y){var M=f.pendingProps,D=!1,j=(f.flags&128)!==0,ue;if((ue=j)||(ue=u!==null&&u.memoizedState===null?!1:(Xr.current&2)!==0),ue&&(D=!0,f.flags&=-129),ue=(f.flags&32)!==0,f.flags&=-33,u===null){if(qr){if(D?xd(f):Ka(),(u=Wi)?(u=iP(u,Ml),u=u!==null&&u.data!=="&"?u:null,u!==null&&(f.memoizedState={dehydrated:u,treeContext:fd!==null?{id:Ss,overflow:zc}:null,retryLane:536870912,hydrationErrors:null},y=Dp(u),y.return=f,f.child=y,Ls=f,Wi=null)):u=null,u===null)throw vu(f);return eC(u)?f.lanes=32:f.lanes=536870912,null}var Pe=M.children;return M=M.fallback,D?(Ka(),D=f.mode,Pe=lx({mode:"hidden",children:Pe},D),M=nf(M,D,y,null),Pe.return=f,M.return=f,Pe.sibling=M,f.child=Pe,M=f.child,M.memoizedState=ha(y),M.childLanes=ax(u,ue,y),f.memoizedState=Sb,wu(null,M)):(xd(f),Vm(f,Pe))}var rt=u.memoizedState;if(rt!==null&&(Pe=rt.dehydrated,Pe!==null)){if(j)f.flags&256?(xd(f),f.flags&=-257,f=wb(u,f,y)):f.memoizedState!==null?(Ka(),f.child=u.child,f.flags|=128,f=null):(Ka(),Pe=M.fallback,D=f.mode,M=lx({mode:"visible",children:M.children},D),Pe=nf(Pe,D,y,null),Pe.flags|=2,M.return=f,Pe.return=f,M.sibling=Pe,f.child=M,gd(f,u.child,null,y),M=f.child,M.memoizedState=ha(y),M.childLanes=ax(u,ue,y),f.memoizedState=Sb,f=wu(null,M));else if(xd(f),eC(Pe)){if(ue=Pe.nextSibling&&Pe.nextSibling.dataset,ue)var Mt=ue.dgst;ue=Mt,M=Error(r(419)),M.stack="",M.digest=ue,xu({value:M,source:null,stack:null}),f=wb(u,f,y)}else if(lo||_u(u,f,y,!1),ue=(y&u.childLanes)!==0,lo||ue){if(ue=cr,ue!==null&&(M=Dt(ue,y),M!==0&&M!==rt.retryLane))throw rt.retryLane=M,Aa(u,M),Er(ue,u,M),nx;JE(Pe)||Jp(),f=wb(u,f,y)}else JE(Pe)?(f.flags|=192,f.child=u.child,f=null):(u=rt.treeContext,Wi=Pu(Pe.nextSibling),Ls=f,qr=!0,hd=null,Ml=!1,u!==null&&Ov(f,u),f=Vm(f,M.children),f.flags|=4096);return f}return D?(Ka(),Pe=M.fallback,D=f.mode,rt=u.child,Mt=rt.sibling,M=$a(rt,{mode:"hidden",children:M.children}),M.subtreeFlags=rt.subtreeFlags&65011712,Mt!==null?Pe=$a(Mt,Pe):(Pe=nf(Pe,D,y,null),Pe.flags|=2),Pe.return=f,M.return=f,M.sibling=Pe,f.child=M,wu(null,M),M=f.child,Pe=u.child.memoizedState,Pe===null?Pe=ha(y):(D=Pe.cachePool,D!==null?(rt=ao._currentValue,D=D.parent!==rt?{parent:rt,pool:rt}:D):D=Hy(),Pe={baseLanes:Pe.baseLanes|y,cachePool:D}),M.memoizedState=Pe,M.childLanes=ax(u,ue,y),f.memoizedState=Sb,wu(u.child,M)):(xd(f),y=u.child,u=y.sibling,y=$a(y,{mode:"visible",children:M.children}),y.return=f,y.sibling=null,u!==null&&(ue=f.deletions,ue===null?(f.deletions=[u],f.flags|=16):ue.push(u)),f.child=y,f.memoizedState=null,y)}function Vm(u,f){return f=lx({mode:"visible",children:f},u.mode),f.return=u,u.child=f}function lx(u,f){return u=_s(22,u,null,f),u.lanes=0,u}function wb(u,f,y){return gd(f,u.child,null,y),u=Vm(f,f.pendingProps.children),u.flags|=2,f.memoizedState=null,u}function T3(u,f,y){u.lanes|=f;var M=u.alternate;M!==null&&(M.lanes|=f),zv(u.return,f,y)}function Ih(u,f,y,M,D,j){var ue=u.memoizedState;ue===null?u.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:M,tail:y,tailMode:D,treeForkCount:j}:(ue.isBackwards=f,ue.rendering=null,ue.renderingStartTime=0,ue.last=M,ue.tail=y,ue.tailMode=D,ue.treeForkCount=j)}function Qa(u,f,y){var M=f.pendingProps,D=M.revealOrder,j=M.tail;M=M.children;var ue=Xr.current,Pe=(ue&2)!==0;if(Pe?(ue=ue&1|2,f.flags|=128):ue&=1,V(Xr,ue),Lo(u,f,M,y),M=qr?Op:0,!Pe&&u!==null&&(u.flags&128)!==0)e:for(u=f.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&T3(u,y,f);else if(u.tag===19)T3(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(D){case"forwards":for(y=f.child,D=null;y!==null;)u=y.alternate,u!==null&&El(u)===null&&(D=y),y=y.sibling;y=D,y===null?(D=f.child,f.child=null):(D=y.sibling,y.sibling=null),Ih(f,!1,D,y,j,M);break;case"backwards":case"unstable_legacy-backwards":for(y=null,D=f.child,f.child=null;D!==null;){if(u=D.alternate,u!==null&&El(u)===null){f.child=D;break}u=D.sibling,D.sibling=y,y=D,D=u}Ih(f,!0,y,null,j,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),Nu|=f.lanes,(y&f.childLanes)===0)if(u!==null){if(_u(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=$a(u,u.pendingProps),f.child=y,y.return=f;u.sibling!==null;)u=u.sibling,y=y.sibling=$a(u,u.pendingProps),y.return=f;y.sibling=null}return f.child}function cx(u,f){return(u.lanes&f)!==0?!0:(u=u.dependencies,!!(u!==null&&km(u)))}function BE(u,f,y){switch(f.tag){case 3:oe(f,f.stateNode.containerInfo),pd(f,ao,u.memoizedState.cache),of();break;case 27:case 5:me(f);break;case 4:oe(f,f.stateNode.containerInfo);break;case 10:pd(f,f.type,f.memoizedProps.value);break;case 31:if(f.memoizedState!==null)return f.flags|=128,$y(f),null;break;case 13:var M=f.memoizedState;if(M!==null)return M.dehydrated!==null?(xd(f),f.flags|=128,null):(y&f.child.childLanes)!==0?M3(u,f,y):(xd(f),u=qs(u,f,y),u!==null?u.sibling:null);xd(f);break;case 19:var D=(u.flags&128)!==0;if(M=(y&f.childLanes)!==0,M||(_u(u,f,y,!1),M=(y&f.childLanes)!==0),D){if(M)return Qa(u,f,y);f.flags|=128}if(D=f.memoizedState,D!==null&&(D.rendering=null,D.tail=null,D.lastEffect=null),V(Xr,Xr.current),M)break;return null;case 22:return f.lanes=0,Ph(u,f,y,f.pendingProps);case 24:pd(f,ao,u.memoizedState.cache)}return qs(u,f,y)}function ux(u,f,y){if(u!==null)if(u.memoizedProps!==f.pendingProps)lo=!0;else{if(!cx(u,y)&&(f.flags&128)===0)return lo=!1,BE(u,f,y);lo=(u.flags&131072)!==0}else lo=!1,qr&&(f.flags&1048576)!==0&&Pw(f,Op,f.index);switch(f.lanes=0,f.tag){case 16:e:{var M=f.pendingProps;if(u=wh(f.elementType),f.type=u,typeof u=="function")kv(u)?(M=pf(u,M),f.tag=1,f=ox(null,f,u,M,y)):(f.tag=0,f=qp(null,f,u,M,y));else{if(u!=null){var D=u.$$typeof;if(D===N){f.tag=11,f=_b(null,f,u,M,y);break e}else if(D===L){f.tag=14,f=kh(null,f,u,M,y);break e}}throw f=Z(u)||u,Error(r(306,f,""))}}return f;case 0:return qp(u,f,f.type,f.pendingProps,y);case 1:return M=f.type,D=pf(M,f.pendingProps),ox(u,f,M,D,y);case 3:e:{if(oe(f,f.stateNode.containerInfo),u===null)throw Error(r(387));M=f.pendingProps;var j=f.memoizedState;D=j.element,Vy(u,f),Bp(f,M,null,y);var ue=f.memoizedState;if(M=ue.cache,pd(f,ao,M),M!==j.cache&&jv(f,[ao],y,!0),Lm(),M=ue.element,j.isDehydrated)if(j={element:M,isDehydrated:!1,cache:ue.cache},f.updateQueue.baseState=j,f.memoizedState=j,f.flags&256){f=w3(u,f,M,y);break e}else if(M!==D){D=wl(Error(r(424)),f),xu(D),f=w3(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=Pu(u.firstChild),Ls=f,qr=!0,hd=null,Ml=!0,y=Gv(f,null,M,y),f.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling}else{if(of(),M===D){f=qs(u,f,y);break e}Lo(u,f,M,y)}f=f.child}return f;case 26:return Dh(u,f),u===null?(y=uP(f.type,null,f.pendingProps,null))?f.memoizedState=y:qr||(y=f.type,u=f.pendingProps,M=N3(re.current).createElement(y),M[Xt]=f,M[hn]=u,Oa(M,y,u),ot(M),f.stateNode=M):f.memoizedState=uP(f.type,u.memoizedProps,f.pendingProps,u.memoizedState),null;case 27:return me(f),u===null&&qr&&(M=f.stateNode=aP(f.type,f.pendingProps,re.current),Ls=f,Ml=!0,D=Wi,r0(f.type)?(tC=D,Wi=Pu(M.firstChild)):Wi=D),Lo(u,f,f.pendingProps.children,y),Dh(u,f),u===null&&(f.flags|=4194304),f.child;case 5:return u===null&&qr&&((D=M=Wi)&&(M=wZ(M,f.type,f.pendingProps,Ml),M!==null?(f.stateNode=M,Ls=f,Wi=Pu(M.firstChild),Ml=!1,D=!0):D=!1),D||vu(f)),me(f),D=f.type,j=f.pendingProps,ue=u!==null?u.memoizedProps:null,M=j.children,KE(D,j)?M=null:ue!==null&&KE(D,ue)&&(f.flags|=32),f.memoizedState!==null&&(D=qv(u,f,Rh,null,null,y),Ib._currentValue=D),Dh(u,f),Lo(u,f,M,y),f.child;case 6:return u===null&&qr&&((u=y=Wi)&&(y=MZ(y,f.pendingProps,Ml),y!==null?(f.stateNode=y,Ls=f,Wi=null,u=!0):u=!1),u||vu(f)),null;case 13:return M3(u,f,y);case 4:return oe(f,f.stateNode.containerInfo),M=f.pendingProps,u===null?f.child=gd(f,null,M,y):Lo(u,f,M,y),f.child;case 11:return _b(u,f,f.type,f.pendingProps,y);case 7:return Lo(u,f,f.pendingProps,y),f.child;case 8:return Lo(u,f,f.pendingProps.children,y),f.child;case 12:return Lo(u,f,f.pendingProps.children,y),f.child;case 10:return M=f.pendingProps,pd(f,f.type,M.value),Lo(u,f,M.children,y),f.child;case 9:return D=f.type._context,M=f.pendingProps.children,lf(f),D=nr(D),M=M(D),f.flags|=1,Lo(u,f,M,y),f.child;case 14:return kh(u,f,f.type,f.pendingProps,y);case 15:return rx(u,f,f.type,f.pendingProps,y);case 19:return Qa(u,f,y);case 31:return sx(u,f,y);case 22:return Ph(u,f,y,f.pendingProps);case 24:return lf(f),M=nr(ao),u===null?(D=Uv(),D===null&&(D=cr,j=jy(),D.pooledCache=j,j.refCount++,j!==null&&(D.pooledCacheLanes|=y),D=j),f.memoizedState={parent:M,cache:D},Om(f),pd(f,ao,D)):((u.lanes&y)!==0&&(Vy(u,f),Bp(f,null,null,y),Lm()),D=u.memoizedState,j=f.memoizedState,D.parent!==M?(D={parent:M,cache:M},f.memoizedState=D,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=D),pd(f,ao,M)):(M=j.cache,pd(f,ao,M),M!==D.cache&&jv(f,[ao],y,!0))),Lo(u,f,f.pendingProps.children,y),f.child;case 29:throw f.pendingProps}throw Error(r(156,f.tag))}function Mu(u){u.flags|=4}function Gm(u,f,y,M,D){if((f=(u.mode&32)!==0)&&(f=!1),f){if(u.flags|=16777216,(D&335544128)===D)if(u.stateNode.complete)u.flags|=8192;else if(Es())u.flags|=8192;else throw Su=Bv,Dm}else u.flags&=-16777217}function Mb(u,f){if(f.type!=="stylesheet"||(f.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!mP(f))if(Es())u.flags|=8192;else throw Su=Bv,Dm}function bd(u,f){f!==null&&(u.flags|=4),u.flags&16384&&(f=u.tag!==22?Ye():536870912,u.lanes|=f,es|=f)}function Tu(u,f){if(!qr)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 zi(u){var f=u.alternate!==null&&u.alternate.child===u.child,y=0,M=0;if(f)for(var D=u.child;D!==null;)y|=D.lanes|D.childLanes,M|=D.subtreeFlags&65011712,M|=D.flags&65011712,D.return=u,D=D.sibling;else for(D=u.child;D!==null;)y|=D.lanes|D.childLanes,M|=D.subtreeFlags,M|=D.flags,D.return=u,D=D.sibling;return u.subtreeFlags|=M,u.childLanes=y,f}function Wm(u,f,y){var M=f.pendingProps;switch(Iv(f),f.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return zi(f),null;case 1:return zi(f),null;case 3:return y=f.stateNode,M=null,u!==null&&(M=u.memoizedState.cache),f.memoizedState.cache!==M&&(f.flags|=2048),bu(ao),fe(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(u===null||u.child===null)&&(zp(f)?Mu(f):u===null||u.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,Lv())),zi(f),null;case 26:var D=f.type,j=f.memoizedState;return u===null?(Mu(f),j!==null?(zi(f),Mb(f,j)):(zi(f),Gm(f,D,null,M,y))):j?j!==u.memoizedState?(Mu(f),zi(f),Mb(f,j)):(zi(f),f.flags&=-16777217):(u=u.memoizedProps,u!==M&&Mu(f),zi(f),Gm(f,D,u,M,y)),null;case 27:if(ye(f),y=re.current,D=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==M&&Mu(f);else{if(!M){if(f.stateNode===null)throw Error(r(166));return zi(f),null}u=ie.current,zp(f)?Dw(f):(u=aP(D,M,y),f.stateNode=u,Mu(f))}return zi(f),null;case 5:if(ye(f),D=f.type,u!==null&&f.stateNode!=null)u.memoizedProps!==M&&Mu(f);else{if(!M){if(f.stateNode===null)throw Error(r(166));return zi(f),null}if(j=ie.current,zp(f))Dw(f);else{var ue=N3(re.current);switch(j){case 1:j=ue.createElementNS("http://www.w3.org/2000/svg",D);break;case 2:j=ue.createElementNS("http://www.w3.org/1998/Math/MathML",D);break;default:switch(D){case"svg":j=ue.createElementNS("http://www.w3.org/2000/svg",D);break;case"math":j=ue.createElementNS("http://www.w3.org/1998/Math/MathML",D);break;case"script":j=ue.createElement("div"),j.innerHTML="<script><\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof M.is=="string"?ue.createElement("select",{is:M.is}):ue.createElement("select"),M.multiple?j.multiple=!0:M.size&&(j.size=M.size);break;default:j=typeof M.is=="string"?ue.createElement(D,{is:M.is}):ue.createElement(D)}}j[Xt]=f,j[hn]=M;e:for(ue=f.child;ue!==null;){if(ue.tag===5||ue.tag===6)j.appendChild(ue.stateNode);else if(ue.tag!==4&&ue.tag!==27&&ue.child!==null){ue.child.return=ue,ue=ue.child;continue}if(ue===f)break e;for(;ue.sibling===null;){if(ue.return===null||ue.return===f)break e;ue=ue.return}ue.sibling.return=ue.return,ue=ue.sibling}f.stateNode=j;e:switch(Oa(j,D,M),D){case"button":case"input":case"select":case"textarea":M=!!M.autoFocus;break e;case"img":M=!0;break e;default:M=!1}M&&Mu(f)}}return zi(f),Gm(f,f.type,u===null?null:u.memoizedProps,f.pendingProps,y),null;case 6:if(u&&f.stateNode!=null)u.memoizedProps!==M&&Mu(f);else{if(typeof M!="string"&&f.stateNode===null)throw Error(r(166));if(u=re.current,zp(f)){if(u=f.stateNode,y=f.memoizedProps,M=null,D=Ls,D!==null)switch(D.tag){case 27:case 5:M=D.memoizedProps}u[Xt]=f,u=!!(u.nodeValue===y||M!==null&&M.suppressHydrationWarning===!0||K9(u.nodeValue,y)),u||vu(f,!0)}else u=N3(u).createTextNode(M),u[Xt]=f,f.stateNode=u}return zi(f),null;case 31:if(y=f.memoizedState,u===null||u.memoizedState!==null){if(M=zp(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[Xt]=f}else of(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;zi(f),u=!1}else y=Lv(),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 zi(f),null;case 13:if(M=f.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(D=zp(f),M!==null&&M.dehydrated!==null){if(u===null){if(!D)throw Error(r(318));if(D=f.memoizedState,D=D!==null?D.dehydrated:null,!D)throw Error(r(317));D[Xt]=f}else of(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;zi(f),D=!1}else D=Lv(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=D),D=!0;if(!D)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,D=null,M.alternate!==null&&M.alternate.memoizedState!==null&&M.alternate.memoizedState.cachePool!==null&&(D=M.alternate.memoizedState.cachePool.pool),j=null,M.memoizedState!==null&&M.memoizedState.cachePool!==null&&(j=M.memoizedState.cachePool.pool),j!==D&&(M.flags|=2048)),y!==u&&y&&(f.child.flags|=8192),bd(f,f.updateQueue),zi(f),null);case 4:return fe(),u===null&&WE(f.stateNode.containerInfo),zi(f),null;case 10:return bu(f.type),zi(f),null;case 19:if(X(Xr),M=f.memoizedState,M===null)return zi(f),null;if(D=(f.flags&128)!==0,j=M.rendering,j===null)if(D)Tu(M,!1);else{if(Ms!==0||u!==null&&(u.flags&128)!==0)for(u=f.child;u!==null;){if(j=El(u),j!==null){for(f.flags|=128,Tu(M,!1),u=j.updateQueue,f.updateQueue=u,bd(f,u),f.subtreeFlags=0,u=y,y=f.child;y!==null;)Pp(y,u),y=y.sibling;return V(Xr,Xr.current&1|2),qr&&mu(f,M.treeForkCount),f.child}u=u.sibling}M.tail!==null&&te()>Xs&&(f.flags|=128,D=!0,Tu(M,!1),f.lanes=4194304)}else{if(!D)if(u=El(j),u!==null){if(f.flags|=128,D=!0,u=u.updateQueue,f.updateQueue=u,bd(f,u),Tu(M,!0),M.tail===null&&M.tailMode==="hidden"&&!j.alternate&&!qr)return zi(f),null}else 2*te()-M.renderingStartTime>Xs&&y!==536870912&&(f.flags|=128,D=!0,Tu(M,!1),f.lanes=4194304);M.isBackwards?(j.sibling=f.child,f.child=j):(u=M.last,u!==null?u.sibling=j:f.child=j,M.last=j)}return M.tail!==null?(u=M.tail,M.rendering=u,M.tail=u.sibling,M.renderingStartTime=te(),u.sibling=null,y=Xr.current,V(Xr,D?y&1|2:y&1),qr&&mu(f,M.treeForkCount),u):(zi(f),null);case 22:case 23:return Ws(f),zm(),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&&(zi(f),f.subtreeFlags&6&&(f.flags|=8192)):zi(f),y=f.updateQueue,y!==null&&bd(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),bu(ao),zi(f),null;case 25:return null;case 30:return null}throw Error(r(156,f.tag))}function lc(u,f){switch(Iv(f),f.tag){case 1:return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return bu(ao),fe(),u=f.flags,(u&65536)!==0&&(u&128)===0?(f.flags=u&-65537|128,f):null;case 26:case 27:case 5:return ye(f),null;case 31:if(f.memoizedState!==null){if(Ws(f),f.alternate===null)throw Error(r(340));of()}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));of()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return X(Xr),null;case 4:return fe(),null;case 10:return bu(f.type),null;case 22:case 23:return Ws(f),zm(),u!==null&&X(cf),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 24:return bu(ao),null;case 25:return null;default:return null}}function Cl(u,f){switch(Iv(f),f.tag){case 3:bu(ao),fe();break;case 26:case 27:case 5:ye(f);break;case 4:fe();break;case 31:f.memoizedState!==null&&Ws(f);break;case 13:Ws(f);break;case 19:X(Xr);break;case 10:bu(f.type);break;case 22:case 23:Ws(f),zm(),u!==null&&X(cf);break;case 24:bu(ao)}}function cc(u,f){try{var y=f.updateQueue,M=y!==null?y.lastEffect:null;if(M!==null){var D=M.next;y=D;do{if((y.tag&u)===u){M=void 0;var j=y.create,ue=y.inst;M=j(),ue.destroy=M}y=y.next}while(y!==D)}}catch(Pe){li(f,f.return,Pe)}}function Zo(u,f,y){try{var M=f.updateQueue,D=M!==null?M.lastEffect:null;if(D!==null){var j=D.next;M=j;do{if((M.tag&u)===u){var ue=M.inst,Pe=ue.destroy;if(Pe!==void 0){ue.destroy=void 0,D=f;var rt=y,Mt=Pe;try{Mt()}catch(zt){li(D,rt,zt)}}}M=M.next}while(M!==j)}}catch(zt){li(f,f.return,zt)}}function jc(u){var f=u.updateQueue;if(f!==null){var y=u.stateNode;try{jw(f,y)}catch(M){li(u,u.return,M)}}}function zo(u,f,y){y.props=pf(u.type,u.memoizedProps),y.state=u.memoizedState;try{y.componentWillUnmount()}catch(M){li(u,f,M)}}function _d(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(D){li(u,f,D)}}function Qo(u,f){var y=u.ref,M=u.refCleanup;if(y!==null)if(typeof M=="function")try{M()}catch(D){li(u,f,D)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof y=="function")try{y(null)}catch(D){li(u,f,D)}else y.current=null}function $m(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(D){li(u,u.return,D)}}function So(u,f,y){try{var M=u.stateNode;vZ(M,u.type,y,f),M[hn]=f}catch(D){li(u,u.return,D)}}function cs(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&r0(u.type)||u.tag===4}function Br(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&&r0(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 Eu(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&&r0(u.type)&&(y=u.stateNode,f=null),u=u.child,u!==null))for(Eu(u,f,y),u=u.sibling;u!==null;)Eu(u,f,y),u=u.sibling}function ka(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&&r0(u.type)&&(y=u.stateNode),u=u.child,u!==null))for(ka(u,f,y),u=u.sibling;u!==null;)ka(u,f,y),u=u.sibling}function dx(u){var f=u.stateNode,y=u.memoizedProps;try{for(var M=u.type,D=f.attributes;D.length;)f.removeAttributeNode(D[0]);Oa(f,M,y),f[Xt]=u,f[hn]=y}catch(j){li(u,u.return,j)}}var uc=!1,$i=!1,Fc=!1,E3=typeof WeakSet=="function"?WeakSet:Set,jo=null;function HE(u,f){if(u=u.containerInfo,XE=L3,u=Ji(u),Is(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 D=M.anchorOffset,j=M.focusNode;M=M.focusOffset;try{y.nodeType,j.nodeType}catch{y=null;break e}var ue=0,Pe=-1,rt=-1,Mt=0,zt=0,Vt=u,At=null;t:for(;;){for(var Ot;Vt!==y||D!==0&&Vt.nodeType!==3||(Pe=ue+D),Vt!==j||M!==0&&Vt.nodeType!==3||(rt=ue+M),Vt.nodeType===3&&(ue+=Vt.nodeValue.length),(Ot=Vt.firstChild)!==null;)At=Vt,Vt=Ot;for(;;){if(Vt===u)break t;if(At===y&&++Mt===D&&(Pe=ue),At===j&&++zt===M&&(rt=ue),(Ot=Vt.nextSibling)!==null)break;Vt=At,At=Vt.parentNode}Vt=Ot}y=Pe===-1||rt===-1?null:{start:Pe,end:rt}}else y=null}y=y||{start:0,end:0}}else y=null;for(YE={focusedElem:u,selectionRange:y},L3=!1,jo=f;jo!==null;)if(f=jo,u=f.child,(f.subtreeFlags&1028)!==0&&u!==null)u.return=f,jo=u;else for(;jo!==null;){switch(f=jo,j=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++)D=u[y],D.ref.impl=D.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&j!==null){u=void 0,y=f,D=j.memoizedProps,j=j.memoizedState,M=y.stateNode;try{var Rn=pf(y.type,D);u=M.getSnapshotBeforeUpdate(Rn,j),M.__reactInternalSnapshotBeforeUpdate=u}catch(Jn){li(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,jo=u;break}jo=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(ue){li(y,y.return,ue)}else{var D=pf(y.type,f.memoizedProps);f=f.memoizedState;try{u.componentDidUpdate(D,f,u.__reactInternalSnapshotBeforeUpdate)}catch(ue){li(y,y.return,ue)}}M&64&&jc(y),M&512&&_d(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{jw(u,f)}catch(ue){li(y,y.return,ue)}}break;case 27:f===null&&M&4&&dx(y);case 26:case 5:hc(u,y),f===null&&M&4&&$m(y),M&512&&_d(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&&Xp(u,y),M&64&&(u=y.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(y=C.bind(null,y),TZ(u,y))));break;case 22:if(M=y.memoizedState!==null||uc,!M){f=f!==null&&f.memoizedState!==null||$i,D=uc;var j=$i;uc=M,($i=f)&&!j?Pa(u,y,(y.subtreeFlags&8772)!==0):hc(u,y),uc=D,$i=j}break;case 30:break;default:hc(u,y)}}function qm(u){var f=u.alternate;f!==null&&(u.alternate=null,qm(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&Qn(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 Ci=null,pa=!1;function dc(u,f,y){for(y=y.child;y!==null;)fx(u,f,y),y=y.sibling}function fx(u,f,y){if(tt&&typeof tt.onCommitFiberUnmount=="function")try{tt.onCommitFiberUnmount(nt,y)}catch{}switch(y.tag){case 26:$i||Qo(y,f),dc(u,f,y),y.memoizedState?y.memoizedState.count--:y.stateNode&&(y=y.stateNode,y.parentNode.removeChild(y));break;case 27:$i||Qo(y,f);var M=Ci,D=pa;r0(y.type)&&(Ci=y.stateNode,pa=!1),dc(u,f,y),kb(y.stateNode),Ci=M,pa=D;break;case 5:$i||Qo(y,f);case 6:if(M=Ci,D=pa,Ci=null,dc(u,f,y),Ci=M,pa=D,Ci!==null)if(pa)try{(Ci.nodeType===9?Ci.body:Ci.nodeName==="HTML"?Ci.ownerDocument.body:Ci).removeChild(y.stateNode)}catch(j){li(y,f,j)}else try{Ci.removeChild(y.stateNode)}catch(j){li(y,f,j)}break;case 18:Ci!==null&&(pa?(u=Ci,nP(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,y.stateNode),bx(u)):nP(Ci,y.stateNode));break;case 4:M=Ci,D=pa,Ci=y.stateNode.containerInfo,pa=!0,dc(u,f,y),Ci=M,pa=D;break;case 0:case 11:case 14:case 15:Zo(2,y,f),$i||Zo(4,y,f),dc(u,f,y);break;case 1:$i||(Qo(y,f),M=y.stateNode,typeof M.componentWillUnmount=="function"&&zo(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{bx(u)}catch(y){li(f,f.return,y)}}}function Xp(u,f){if(f.memoizedState===null&&(u=f.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{bx(u)}catch(y){li(f,f.return,y)}}function Tb(u){switch(u.tag){case 31:case 13:case 19:var f=u.stateNode;return f===null&&(f=u.stateNode=new E3),f;case 22:return u=u.stateNode,f=u._retryCache,f===null&&(f=u._retryCache=new E3),f;default:throw Error(r(435,u.tag))}}function Sd(u,f){var y=Tb(u);f.forEach(function(M){if(!y.has(M)){y.add(M);var D=k.bind(null,u,M);M.then(D,D)}})}function wo(u,f){var y=f.deletions;if(y!==null)for(var M=0;M<y.length;M++){var D=y[M],j=u,ue=f,Pe=ue;e:for(;Pe!==null;){switch(Pe.tag){case 27:if(r0(Pe.type)){Ci=Pe.stateNode,pa=!1;break e}break;case 5:Ci=Pe.stateNode,pa=!1;break e;case 3:case 4:Ci=Pe.stateNode.containerInfo,pa=!0;break e}Pe=Pe.return}if(Ci===null)throw Error(r(160));fx(j,ue,D),Ci=null,pa=!1,j=D.alternate,j!==null&&(j.return=null),D.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:wo(f,u),Mo(u),M&4&&(Zo(3,u,u.return),cc(3,u),Zo(5,u,u.return));break;case 1:wo(f,u),Mo(u),M&512&&($i||y===null||Qo(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 D=fc;if(wo(f,u),Mo(u),M&512&&($i||y===null||Qo(y,y.return)),M&4){var j=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,D=D.ownerDocument||D;t:switch(M){case"title":j=D.getElementsByTagName("title")[0],(!j||j[zn]||j[Xt]||j.namespaceURI==="http://www.w3.org/2000/svg"||j.hasAttribute("itemprop"))&&(j=D.createElement(M),D.head.insertBefore(j,D.querySelector("head > title"))),Oa(j,M,y),j[Xt]=u,ot(j),M=j;break e;case"link":var ue=hP("link","href",D).get(M+(y.href||""));if(ue){for(var Pe=0;Pe<ue.length;Pe++)if(j=ue[Pe],j.getAttribute("href")===(y.href==null||y.href===""?null:y.href)&&j.getAttribute("rel")===(y.rel==null?null:y.rel)&&j.getAttribute("title")===(y.title==null?null:y.title)&&j.getAttribute("crossorigin")===(y.crossOrigin==null?null:y.crossOrigin)){ue.splice(Pe,1);break t}}j=D.createElement(M),Oa(j,M,y),D.head.appendChild(j);break;case"meta":if(ue=hP("meta","content",D).get(M+(y.content||""))){for(Pe=0;Pe<ue.length;Pe++)if(j=ue[Pe],j.getAttribute("content")===(y.content==null?null:""+y.content)&&j.getAttribute("name")===(y.name==null?null:y.name)&&j.getAttribute("property")===(y.property==null?null:y.property)&&j.getAttribute("http-equiv")===(y.httpEquiv==null?null:y.httpEquiv)&&j.getAttribute("charset")===(y.charSet==null?null:y.charSet)){ue.splice(Pe,1);break t}}j=D.createElement(M),Oa(j,M,y),D.head.appendChild(j);break;default:throw Error(r(468,M))}j[Xt]=u,ot(j),M=j}u.stateNode=M}else pP(D,u.type,u.stateNode);else u.stateNode=fP(D,M,u.memoizedProps);else j!==M?(j===null?y.stateNode!==null&&(y=y.stateNode,y.parentNode.removeChild(y)):j.count--,M===null?pP(D,u.type,u.stateNode):fP(D,M,u.memoizedProps)):M===null&&u.stateNode!==null&&So(u,u.memoizedProps,y.memoizedProps)}break;case 27:wo(f,u),Mo(u),M&512&&($i||y===null||Qo(y,y.return)),y!==null&&M&4&&So(u,u.memoizedProps,y.memoizedProps);break;case 5:if(wo(f,u),Mo(u),M&512&&($i||y===null||Qo(y,y.return)),u.flags&32){D=u.stateNode;try{ks(D,"")}catch(Rn){li(u,u.return,Rn)}}M&4&&u.stateNode!=null&&(D=u.memoizedProps,So(u,D,y!==null?y.memoizedProps:D)),M&1024&&(Fc=!0);break;case 6:if(wo(f,u),Mo(u),M&4){if(u.stateNode===null)throw Error(r(162));M=u.memoizedProps,y=u.stateNode;try{y.nodeValue=M}catch(Rn){li(u,u.return,Rn)}}break;case 3:if(P3=null,D=fc,fc=R3(f.containerInfo),wo(f,u),fc=D,Mo(u),M&4&&y!==null&&y.memoizedState.isDehydrated)try{bx(f.containerInfo)}catch(Rn){li(u,u.return,Rn)}Fc&&(Fc=!1,hx(u));break;case 4:M=fc,fc=R3(u.stateNode.containerInfo),wo(f,u),Mo(u),fc=M;break;case 12:wo(f,u),Mo(u);break;case 31:wo(f,u),Mo(u),M&4&&(M=u.updateQueue,M!==null&&(u.updateQueue=null,Sd(u,M)));break;case 13:wo(f,u),Mo(u),u.child.flags&8192&&u.memoizedState!==null!=(y!==null&&y.memoizedState!==null)&&(Yp=te()),M&4&&(M=u.updateQueue,M!==null&&(u.updateQueue=null,Sd(u,M)));break;case 22:D=u.memoizedState!==null;var rt=y!==null&&y.memoizedState!==null,Mt=uc,zt=$i;if(uc=Mt||D,$i=zt||rt,wo(f,u),$i=zt,uc=Mt,Mo(u),M&8192)e:for(f=u.stateNode,f._visibility=D?f._visibility&-2:f._visibility|1,D&&(y===null||rt||uc||$i||Cu(u)),y=null,f=u;;){if(f.tag===5||f.tag===26){if(y===null){rt=y=f;try{if(j=rt.stateNode,D)ue=j.style,typeof ue.setProperty=="function"?ue.setProperty("display","none","important"):ue.display="none";else{Pe=rt.stateNode;var Vt=rt.memoizedProps.style,At=Vt!=null&&Vt.hasOwnProperty("display")?Vt.display:null;Pe.style.display=At==null||typeof At=="boolean"?"":(""+At).trim()}}catch(Rn){li(rt,rt.return,Rn)}}}else if(f.tag===6){if(y===null){rt=f;try{rt.stateNode.nodeValue=D?"":rt.memoizedProps}catch(Rn){li(rt,rt.return,Rn)}}}else if(f.tag===18){if(y===null){rt=f;try{var Ot=rt.stateNode;D?rP(Ot,!0):rP(rt.stateNode,!1)}catch(Rn){li(rt,rt.return,Rn)}}}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,Sd(u,y))));break;case 19:wo(f,u),Mo(u),M&4&&(M=u.updateQueue,M!==null&&(u.updateQueue=null,Sd(u,M)));break;case 30:break;case 21:break;default:wo(f,u),Mo(u)}}function Mo(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 D=y.stateNode,j=Br(u);ka(u,j,D);break;case 5:var ue=y.stateNode;y.flags&32&&(ks(ue,""),y.flags&=-33);var Pe=Br(u);ka(u,Pe,ue);break;case 3:case 4:var rt=y.stateNode.containerInfo,Mt=Br(u);Eu(u,Mt,rt);break;default:throw Error(r(161))}}catch(zt){li(u,u.return,zt)}u.flags&=-3}f&4096&&(u.flags&=-4097)}function hx(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var f=u;hx(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 Cu(u){for(u=u.child;u!==null;){var f=u;switch(f.tag){case 0:case 11:case 14:case 15:Zo(4,f,f.return),Cu(f);break;case 1:Qo(f,f.return);var y=f.stateNode;typeof y.componentWillUnmount=="function"&&zo(f,f.return,y),Cu(f);break;case 27:kb(f.stateNode);case 26:case 5:Qo(f,f.return),Cu(f);break;case 22:f.memoizedState===null&&Cu(f);break;case 30:Cu(f);break;default:Cu(f)}u=u.sibling}}function Pa(u,f,y){for(y=y&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var M=f.alternate,D=u,j=f,ue=j.flags;switch(j.tag){case 0:case 11:case 15:Pa(D,j,y),cc(4,j);break;case 1:if(Pa(D,j,y),M=j,D=M.stateNode,typeof D.componentDidMount=="function")try{D.componentDidMount()}catch(Mt){li(M,M.return,Mt)}if(M=j,D=M.updateQueue,D!==null){var Pe=M.stateNode;try{var rt=D.shared.hiddenCallbacks;if(rt!==null)for(D.shared.hiddenCallbacks=null,D=0;D<rt.length;D++)Hp(rt[D],Pe)}catch(Mt){li(M,M.return,Mt)}}y&&ue&64&&jc(j),_d(j,j.return);break;case 27:dx(j);case 26:case 5:Pa(D,j,y),y&&M===null&&ue&4&&$m(j),_d(j,j.return);break;case 12:Pa(D,j,y);break;case 31:Pa(D,j,y),y&&ue&4&&mf(D,j);break;case 13:Pa(D,j,y),y&&ue&4&&Xp(D,j);break;case 22:j.memoizedState===null&&Pa(D,j,y),_d(j,j.return);break;case 30:break;default:Pa(D,j,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&&_h(y))}function Oh(u,f){u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&_h(u))}function Jo(u,f,y,M){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)Eb(u,f,y,M),f=f.sibling}function Eb(u,f,y,M){var D=f.flags;switch(f.tag){case 0:case 11:case 15:Jo(u,f,y,M),D&2048&&cc(9,f);break;case 1:Jo(u,f,y,M);break;case 3:Jo(u,f,y,M),D&2048&&(u=null,f.alternate!==null&&(u=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==u&&(f.refCount++,u!=null&&_h(u)));break;case 12:if(D&2048){Jo(u,f,y,M),u=f.stateNode;try{var j=f.memoizedProps,ue=j.id,Pe=j.onPostCommit;typeof Pe=="function"&&Pe(ue,f.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(rt){li(f,f.return,rt)}}else Jo(u,f,y,M);break;case 31:Jo(u,f,y,M);break;case 13:Jo(u,f,y,M);break;case 23:break;case 22:j=f.stateNode,ue=f.alternate,f.memoizedState!==null?j._visibility&2?Jo(u,f,y,M):Au(u,f):j._visibility&2?Jo(u,f,y,M):(j._visibility|=2,ea(u,f,y,M,(f.subtreeFlags&10256)!==0||!1)),D&2048&&vf(ue,f);break;case 24:Jo(u,f,y,M),D&2048&&Oh(f.alternate,f);break;default:Jo(u,f,y,M)}}function ea(u,f,y,M,D){for(D=D&&((f.subtreeFlags&10256)!==0||!1),f=f.child;f!==null;){var j=u,ue=f,Pe=y,rt=M,Mt=ue.flags;switch(ue.tag){case 0:case 11:case 15:ea(j,ue,Pe,rt,D),cc(8,ue);break;case 23:break;case 22:var zt=ue.stateNode;ue.memoizedState!==null?zt._visibility&2?ea(j,ue,Pe,rt,D):Au(j,ue):(zt._visibility|=2,ea(j,ue,Pe,rt,D)),D&&Mt&2048&&vf(ue.alternate,ue);break;case 24:ea(j,ue,Pe,rt,D),D&&Mt&2048&&Oh(ue.alternate,ue);break;default:ea(j,ue,Pe,rt,D)}f=f.sibling}}function Au(u,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var y=u,M=f,D=M.flags;switch(M.tag){case 22:Au(y,M),D&2048&&vf(M.alternate,M);break;case 24:Au(y,M),D&2048&&Oh(M.alternate,M);break;default:Au(y,M)}f=f.sibling}}var Lh=8192;function Al(u,f,y){if(u.subtreeFlags&Lh)for(u=u.child;u!==null;)px(u,f,y),u=u.sibling}function px(u,f,y){switch(u.tag){case 26:Al(u,f,y),u.flags&Lh&&u.memoizedState!==null&&zZ(y,fc,u.memoizedState,u.memoizedProps);break;case 5:Al(u,f,y);break;case 3:case 4:var M=fc;fc=R3(u.stateNode.containerInfo),Al(u,f,y),fc=M;break;case 22:u.memoizedState===null&&(M=u.alternate,M!==null&&M.memoizedState!==null?(M=Lh,Lh=16777216,Al(u,f,y),Lh=M):Al(u,f,y));break;default:Al(u,f,y)}}function zh(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];jo=M,zs(M,u)}zh(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)Ja(u),u=u.sibling}function Ja(u){switch(u.tag){case 0:case 11:case 15:xf(u),u.flags&2048&&Zo(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,el(u)):xf(u);break;default:xf(u)}}function el(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];jo=M,zs(M,u)}zh(u)}for(u=u.child;u!==null;){switch(f=u,f.tag){case 0:case 11:case 15:Zo(8,f,f.return),el(f);break;case 22:y=f.stateNode,y._visibility&2&&(y._visibility&=-3,el(f));break;default:el(f)}u=u.sibling}}function zs(u,f){for(;jo!==null;){var y=jo;switch(y.tag){case 0:case 11:case 15:Zo(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:_h(y.memoizedState.cache)}if(M=y.child,M!==null)M.return=y,jo=M;else e:for(y=u;jo!==null;){M=jo;var D=M.sibling,j=M.return;if(qm(M),M===y){jo=null;break e}if(D!==null){D.return=j,jo=D;break e}jo=j}}}var wd={getCacheForType:function(u){var f=nr(ao),y=f.data.get(u);return y===void 0&&(y=u(),f.data.set(u,y)),y},cacheSignal:function(){return nr(ao).controller.signal}},yr=typeof WeakMap=="function"?WeakMap:Map,Fn=0,cr=null,Tr=null,wr=0,Zr=0,ma=null,pc=!1,Uc=!1,Cb=!1,Nl=0,Ms=0,Nu=0,yf=0,Xm=0,Da=0,es=0,jh=null,js=null,Fs=!1,Yp=0,Ab=0,Xs=1/0,Ts=null,Ys=null,Ai=0,Rl=null,Kp=null,mc=0,Zp=0,Qp=null,Ym=null,bf=0,Fh=null;function kl(){return(Fn&2)!==0&&wr!==0?wr&-wr:$.T!==null?Pt():St()}function Or(){if(Da===0)if((wr&536870912)===0||qr){var u=it;it<<=1,(it&3932160)===0&&(it=262144),Da=u}else Da=536870912;return u=Ya.current,u!==null&&(u.flags|=32),Da}function Er(u,f,y){(u===cr&&(Zr===2||Zr===9)||u.cancelPendingCommit!==null)&&(Sf(u,0),co(u,wr,Da,!1)),Rt(u,y),((Fn&2)===0||u!==cr)&&(u===cr&&((Fn&2)===0&&(yf|=y),Ms===4&&co(u,wr,Da,!1)),Yt(u))}function Lr(u,f,y){if((Fn&6)!==0)throw Error(r(327));var M=!y&&(f&127)===0&&(f&u.expiredLanes)===0||Ae(u,f),D=M?Km(u,f):Ia(u,f,!0),j=M;do{if(D===0){Uc&&!M&&co(u,f,0,!1);break}else{if(y=u.current.alternate,j&&!Ni(y)){D=Ia(u,f,!1),j=!1;continue}if(D===2){if(j=f,u.errorRecoveryDisabledLanes&j)var ue=0;else ue=u.pendingLanes&-536870913,ue=ue!==0?ue:ue&536870912?536870912:0;if(ue!==0){f=ue;e:{var Pe=u;D=jh;var rt=Pe.current.memoizedState.isDehydrated;if(rt&&(Sf(Pe,ue).flags|=256),ue=Ia(Pe,ue,!1),ue!==2){if(Cb&&!rt){Pe.errorRecoveryDisabledLanes|=j,yf|=j,D=4;break e}j=js,js=D,j!==null&&(js===null?js=j:js.push.apply(js,j))}D=ue}if(j=!1,D!==2)continue}}if(D===1){Sf(u,0),co(u,f,0,!0);break}e:{switch(M=u,j=D,j){case 0:case 1:throw Error(r(345));case 4:if((f&4194048)!==f)break;case 6:co(M,f,Da,!pc);break e;case 2:js=null;break;case 3:case 5:break;default:throw Error(r(329))}if((f&62914560)===f&&(D=Yp+300-te(),10<D)){if(co(M,f,Da,!pc),$e(M,0,!0)!==0)break e;mc=f,M.timeoutHandle=eP(Hr.bind(null,M,y,js,Ts,Fs,f,Da,yf,es,pc,j,"Throttled",-0,0),D);break e}Hr(M,y,js,Ts,Fs,f,Da,yf,es,pc,j,null,-0,0)}}break}while(!0);Yt(u)}function Hr(u,f,y,M,D,j,ue,Pe,rt,Mt,zt,Vt,At,Ot){if(u.timeoutHandle=-1,Vt=f.subtreeFlags,Vt&8192||(Vt&16785408)===16785408){Vt={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ps},px(f,j,Vt);var Rn=(j&62914560)===j?Yp-te():(j&4194048)===j?Ab-te():0;if(Rn=jZ(Vt,Rn),Rn!==null){mc=j,u.cancelPendingCommit=Rn(Td.bind(null,u,f,j,y,M,D,ue,Pe,rt,zt,Vt,null,At,Ot)),co(u,j,ue,!Mt);return}}Td(u,f,j,y,M,D,ue,Pe,rt)}function Ni(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 D=y[M],j=D.getSnapshot;D=D.value;try{if(!tr(j(),D))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 co(u,f,y,M){f&=~Xm,f&=~yf,u.suspendedLanes|=f,u.pingedLanes&=~f,M&&(u.warmLanes|=f),M=u.expirationTimes;for(var D=f;0<D;){var j=31-we(D),ue=1<<j;M[j]=-1,D&=~ue}y!==0&&Tt(u,y,f)}function Bc(){return(Fn&6)===0?(bn(0),!1):!0}function _f(){if(Tr!==null){if(Zr===0)var u=Tr.return;else u=Tr,yu=af=null,Zy(u),Eh=null,Ch=0,u=Tr;for(;u!==null;)Cl(u.alternate,u),u=u.return;Tr=null}}function Sf(u,f){var y=u.timeoutHandle;y!==-1&&(u.timeoutHandle=-1,bZ(y)),y=u.cancelPendingCommit,y!==null&&(u.cancelPendingCommit=null,y()),mc=0,_f(),cr=u,Tr=y=$a(u.current,null),wr=f,Zr=0,ma=null,pc=!1,Uc=Ae(u,f),Cb=!1,es=Da=Xm=yf=Nu=Ms=0,js=jh=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 D=31-we(M),j=1<<D;f|=u[D],M&=~j}return Nl=f,Nm(),y}function Ru(u,f){xr=null,$.H=$p,f===Sh||f===Mr?(f=Mh(),Zr=3):f===Dm?(f=Mh(),Zr=4):Zr=f===nx?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,ma=f,Tr===null&&(Ms=1,tx(u,wl(f,u.current)))}function Es(){var u=Ya.current;return u===null?!0:(wr&4194048)===wr?Ra===null:(wr&62914560)===wr||(wr&536870912)!==0?u===Ra:!1}function Md(){var u=$.H;return $.H=$p,u===null?$p:u}function wf(){var u=$.A;return $.A=wd,u}function Jp(){Ms=4,pc||(wr&4194048)!==wr&&Ya.current!==null||(Uc=!0),(Nu&134217727)===0&&(yf&134217727)===0||cr===null||co(cr,wr,Da,!1)}function Ia(u,f,y){var M=Fn;Fn|=2;var D=Md(),j=wf();(cr!==u||wr!==f)&&(Ts=null,Sf(u,f)),f=!1;var ue=Ms;e:do try{if(Zr!==0&&Tr!==null){var Pe=Tr,rt=ma;switch(Zr){case 8:_f(),ue=6;break e;case 3:case 2:case 9:case 6:Ya.current===null&&(f=!0);var Mt=Zr;if(Zr=0,ma=null,Uh(u,Pe,rt,Mt),y&&Uc){ue=0;break e}break;default:Mt=Zr,Zr=0,ma=null,Uh(u,Pe,rt,Mt)}}e0(),ue=Ms;break}catch(zt){Ru(u,zt)}while(!0);return f&&u.shellSuspendCounter++,yu=af=null,Fn=M,$.H=D,$.A=j,Tr===null&&(cr=null,wr=0,Nm()),ue}function e0(){for(;Tr!==null;)mx(Tr)}function Km(u,f){var y=Fn;Fn|=2;var M=Md(),D=wf();cr!==u||wr!==f?(Ts=null,Xs=te()+500,Sf(u,f)):Uc=Ae(u,f);e:do try{if(Zr!==0&&Tr!==null){f=Tr;var j=ma;t:switch(Zr){case 1:Zr=0,ma=null,Uh(u,f,j,1);break;case 2:case 9:if(Xa(j)){Zr=0,ma=null,Zm(f);break}f=function(){Zr!==2&&Zr!==9||cr!==u||(Zr=7),Yt(u)},j.then(f,f);break e;case 3:Zr=7;break e;case 4:Zr=5;break e;case 7:Xa(j)?(Zr=0,ma=null,Zm(f)):(Zr=0,ma=null,Uh(u,f,j,7));break;case 5:var ue=null;switch(Tr.tag){case 26:ue=Tr.memoizedState;case 5:case 27:var Pe=Tr;if(ue?mP(ue):Pe.stateNode.complete){Zr=0,ma=null;var rt=Pe.sibling;if(rt!==null)Tr=rt;else{var Mt=Pe.return;Mt!==null?(Tr=Mt,Mf(Mt)):Tr=null}break t}}Zr=0,ma=null,Uh(u,f,j,5);break;case 6:Zr=0,ma=null,Uh(u,f,j,6);break;case 8:_f(),Ms=6;break e;default:throw Error(r(462))}}tl();break}catch(zt){Ru(u,zt)}while(!0);return yu=af=null,$.H=M,$.A=D,Fn=y,Tr!==null?0:(cr=null,wr=0,Nm(),Ms)}function tl(){for(;Tr!==null&&!Xe();)mx(Tr)}function mx(u){var f=ux(u.alternate,u,Nl);u.memoizedProps=u.pendingProps,f===null?Mf(u):Tr=f}function Zm(u){var f=u,y=f.alternate;switch(f.tag){case 15:case 0:f=Hm(y,f,f.pendingProps,f.type,void 0,wr);break;case 11:f=Hm(y,f,f.pendingProps,f.type.render,f.ref,wr);break;case 5:Zy(f);default:Cl(y,f),f=Tr=Pp(f,Nl),f=ux(y,f,Nl)}u.memoizedProps=u.pendingProps,f===null?Mf(u):Tr=f}function Uh(u,f,y,M){yu=af=null,Zy(f),Eh=null,Ch=0;var D=f.return;try{if(_o(u,D,f,y,wr)){Ms=1,tx(u,wl(y,u.current)),Tr=null;return}}catch(j){if(D!==null)throw Tr=D,j;Ms=1,tx(u,wl(y,u.current)),Tr=null;return}f.flags&32768?(qr||M===1?u=!0:Uc||(wr&536870912)!==0?u=!1:(pc=u=!0,(M===2||M===9||M===3||M===6)&&(M=Ya.current,M!==null&&M.tag===13&&(M.flags|=16384))),Qm(f,u)):Mf(f)}function Mf(u){var f=u;do{if((f.flags&32768)!==0){Qm(f,pc);return}u=f.return;var y=Wm(f.alternate,f,Nl);if(y!==null){Tr=y;return}if(f=f.sibling,f!==null){Tr=f;return}Tr=f=u}while(f!==null);Ms===0&&(Ms=5)}function Qm(u,f){do{var y=lc(u.alternate,u);if(y!==null){y.flags&=32767,Tr=y;return}if(y=u.return,y!==null&&(y.flags|=32768,y.subtreeFlags=0,y.deletions=null),!f&&(u=u.sibling,u!==null)){Tr=u;return}Tr=u=y}while(u!==null);Ms=6,Tr=null}function Td(u,f,y,M,D,j,ue,Pe,rt){u.cancelPendingCommit=null;do t0();while(Ai!==0);if((Fn&6)!==0)throw Error(r(327));if(f!==null){if(f===u.current)throw Error(r(177));if(j=f.lanes|f.childLanes,j|=Io,yt(u,y,j,ue,Pe,rt),u===cr&&(Tr=cr=null,wr=0),Kp=f,Rl=u,mc=y,Zp=j,Qp=D,Ym=M,(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,W(Te,function(){return gx(),null})):(u.callbackNode=null,u.callbackPriority=0),M=(f.flags&13878)!==0,(f.subtreeFlags&13878)!==0||M){M=$.T,$.T=null,D=K.p,K.p=2,ue=Fn,Fn|=4;try{HE(u,f,y)}finally{Fn=ue,K.p=D,$.T=M}}Ai=1,uo(),Ed(),Bh()}}function uo(){if(Ai===1){Ai=0;var u=Rl,f=Kp,y=(f.flags&13878)!==0;if((f.subtreeFlags&13878)!==0||y){y=$.T,$.T=null;var M=K.p;K.p=2;var D=Fn;Fn|=4;try{gf(f,u);var j=YE,ue=Ji(u.containerInfo),Pe=j.focusedElem,rt=j.selectionRange;if(ue!==Pe&&Pe&&Pe.ownerDocument&&Wn(Pe.ownerDocument.documentElement,Pe)){if(rt!==null&&Is(Pe)){var Mt=rt.start,zt=rt.end;if(zt===void 0&&(zt=Mt),"selectionStart"in Pe)Pe.selectionStart=Mt,Pe.selectionEnd=Math.min(zt,Pe.value.length);else{var Vt=Pe.ownerDocument||document,At=Vt&&Vt.defaultView||window;if(At.getSelection){var Ot=At.getSelection(),Rn=Pe.textContent.length,Jn=Math.min(rt.start,Rn),Xi=rt.end===void 0?Jn:Math.min(rt.end,Rn);!Ot.extend&&Jn>Xi&&(ue=Xi,Xi=Jn,Jn=ue);var gt=An(Pe,Jn),dt=An(Pe,Xi);if(gt&&dt&&(Ot.rangeCount!==1||Ot.anchorNode!==gt.node||Ot.anchorOffset!==gt.offset||Ot.focusNode!==dt.node||Ot.focusOffset!==dt.offset)){var wt=Vt.createRange();wt.setStart(gt.node,gt.offset),Ot.removeAllRanges(),Jn>Xi?(Ot.addRange(wt),Ot.extend(dt.node,dt.offset)):(wt.setEnd(dt.node,dt.offset),Ot.addRange(wt))}}}}for(Vt=[],Ot=Pe;Ot=Ot.parentNode;)Ot.nodeType===1&&Vt.push({element:Ot,left:Ot.scrollLeft,top:Ot.scrollTop});for(typeof Pe.focus=="function"&&Pe.focus(),Pe=0;Pe<Vt.length;Pe++){var Bt=Vt[Pe];Bt.element.scrollLeft=Bt.left,Bt.element.scrollTop=Bt.top}}L3=!!XE,YE=XE=null}finally{Fn=D,K.p=M,$.T=y}}u.current=f,Ai=2}}function Ed(){if(Ai===2){Ai=0;var u=Rl,f=Kp,y=(f.flags&8772)!==0;if((f.subtreeFlags&8772)!==0||y){y=$.T,$.T=null;var M=K.p;K.p=2;var D=Fn;Fn|=4;try{us(u,f.alternate,f)}finally{Fn=D,K.p=M,$.T=y}}Ai=3}}function Bh(){if(Ai===4||Ai===3){Ai=0,le();var u=Rl,f=Kp,y=mc,M=Ym;(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?Ai=5:(Ai=0,Kp=Rl=null,ku(u,u.pendingLanes));var D=u.pendingLanes;if(D===0&&(Ys=null),ct(y),f=f.stateNode,tt&&typeof tt.onCommitFiberRoot=="function")try{tt.onCommitFiberRoot(nt,f,void 0,(f.current.flags&128)===128)}catch{}if(M!==null){f=$.T,D=K.p,K.p=2,$.T=null;try{for(var j=u.onRecoverableError,ue=0;ue<M.length;ue++){var Pe=M[ue];j(Pe.value,{componentStack:Pe.stack})}}finally{$.T=f,K.p=D}}(mc&3)!==0&&t0(),Yt(u),D=u.pendingLanes,(y&261930)!==0&&(D&42)!==0?u===Fh?bf++:(bf=0,Fh=u):bf=0,bn(0)}}function ku(u,f){(u.pooledCacheLanes&=f)===0&&(f=u.pooledCache,f!=null&&(u.pooledCache=null,_h(f)))}function t0(){return uo(),Ed(),Bh(),gx()}function gx(){if(Ai!==5)return!1;var u=Rl,f=Zp;Zp=0;var y=ct(mc),M=$.T,D=K.p;try{K.p=32>y?32:y,$.T=null,y=Qp,Qp=null;var j=Rl,ue=mc;if(Ai=0,Kp=Rl=null,mc=0,(Fn&6)!==0)throw Error(r(331));var Pe=Fn;if(Fn|=4,Ja(j.current),Eb(j,j.current,ue,y),Fn=Pe,bn(0,!1),tt&&typeof tt.onPostCommitFiberRoot=="function")try{tt.onPostCommitFiberRoot(nt,j)}catch{}return!0}finally{K.p=D,$.T=M,ku(u,f)}}function Nb(u,f,y){f=wl(y,f),f=yb(u.stateNode,f,2),u=uf(u,f,2),u!==null&&(Rt(u,2),Yt(u))}function li(u,f,y){if(u.tag===3)Nb(u,u,y);else for(;f!==null;){if(f.tag===3){Nb(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=wl(y,u),y=bb(2),M=uf(f,y,2),M!==null&&(_3(y,M,f,u),Rt(M,2),Yt(M));break}}f=f.return}}function Jm(u,f,y){var M=u.pingCache;if(M===null){M=u.pingCache=new yr;var D=new Set;M.set(f,D)}else D=M.get(f),D===void 0&&(D=new Set,M.set(f,D));D.has(y)||(Cb=!0,D.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,cr===u&&(wr&y)===y&&(Ms===4||Ms===3&&(wr&62914560)===wr&&300>te()-Yp?(Fn&2)===0&&Sf(u,0):Xm|=y,es===wr&&(es=0)),Yt(u)}function x(u,f){f===0&&(f=Ye()),u=Aa(u,f),u!==null&&(Rt(u,f),Yt(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,D=u.memoizedState;D!==null&&(y=D.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 W(u,f){return je(u,f)}var ee=null,Re=null,lt=!1,It=!1,Wt=!1,cn=0;function Yt(u){u!==Re&&u.next===null&&(Re===null?ee=Re=u:Re=Re.next=u),It=!0,lt||(lt=!0,vt())}function bn(u,f){if(!Wt&&It){Wt=!0;do for(var y=!1,M=ee;M!==null;){if(u!==0){var D=M.pendingLanes;if(D===0)var j=0;else{var ue=M.suspendedLanes,Pe=M.pingedLanes;j=(1<<31-we(42|u)+1)-1,j&=D&~(ue&~Pe),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(y=!0,Ct(M,j))}else j=wr,j=$e(M,M===cr?j:0,M.cancelPendingCommit!==null||M.timeoutHandle!==-1),(j&3)===0||Ae(M,j)||(y=!0,Ct(M,j));M=M.next}while(y);Wt=!1}}function hr(){Ks()}function Ks(){It=lt=!1;var u=0;cn!==0&&yZ()&&(u=cn);for(var f=te(),y=null,M=ee;M!==null;){var D=M.next,j=n0(M,f);j===0?(M.next=null,y===null?ee=D:y.next=D,D===null&&(Re=y)):(y=M,(u!==0||(j&3)!==0)&&(It=!0)),M=D}Ai!==0&&Ai!==5||bn(u),cn!==0&&(cn=0)}function n0(u,f){for(var y=u.suspendedLanes,M=u.pingedLanes,D=u.expirationTimes,j=u.pendingLanes&-62914561;0<j;){var ue=31-we(j),Pe=1<<ue,rt=D[ue];rt===-1?((Pe&y)===0||(Pe&M)!==0)&&(D[ue]=Oe(Pe,f)):rt<=f&&(u.expiredLanes|=Pe),j&=~Pe}if(f=cr,y=wr,y=$e(u,u===f?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),M=u.callbackNode,y===0||u===f&&(Zr===2||Zr===9)||u.cancelPendingCommit!==null)return M!==null&&M!==null&&be(M),u.callbackNode=null,u.callbackPriority=0;if((y&3)===0||Ae(u,y)){if(f=y&-y,f===u.callbackPriority)return f;switch(M!==null&&be(M),ct(y)){case 2:case 8:y=ge;break;case 32:y=Te;break;case 268435456:y=pe;break;default:y=Te}return M=Tf.bind(null,u),y=je(y,M),u.callbackPriority=f,u.callbackNode=y,f}return M!==null&&M!==null&&be(M),u.callbackPriority=2,u.callbackNode=null,2}function Tf(u,f){if(Ai!==0&&Ai!==5)return u.callbackNode=null,u.callbackPriority=0,null;var y=u.callbackNode;if(t0()&&u.callbackNode!==y)return null;var M=wr;return M=$e(u,u===cr?M:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),M===0?null:(Lr(u,M,f),n0(u,te()),u.callbackNode!=null&&u.callbackNode===y?Tf.bind(null,u):null)}function Ct(u,f){if(t0())return null;Lr(u,f,!0)}function vt(){_Z(function(){(Fn&6)!==0?je(ve,hr):Ks()})}function Pt(){if(cn===0){var u=md;u===0&&(u=Ke,Ke<<=1,(Ke&261888)===0&&(Ke=256)),cn=u}return cn}function sn(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:da(""+u)}function $n(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,D){if(f==="submit"&&y&&y.stateNode===D){var j=sn((D[hn]||null).action),ue=M.submitter;ue&&(f=(f=ue[hn]||null)?sn(f.formAction):ue.getAttribute("formAction"),f!==null&&(j=f,ue=null));var Pe=new Oi("action","action",null,M,D);u.push({event:Pe,listeners:[{instance:null,listener:function(){if(M.defaultPrevented){if(cn!==0){var rt=ue?$n(D,ue):new FormData(D);db(y,{pending:!0,data:rt,method:D.method,action:j},null,rt)}}else typeof j=="function"&&(Pe.preventDefault(),rt=ue?$n(D,ue):new FormData(D),db(y,{pending:!0,data:rt,method:D.method,action:j},j,rt))},currentTarget:D}]})}}for(var Yn=0;Yn<Cm.length;Yn++){var ri=Cm[Yn],Fo=ri.toLowerCase(),hi=ri[0].toUpperCase()+ri.slice(1);tc(Fo,"on"+hi)}tc(oo,"onAnimationEnd"),tc(yo,"onAnimationIteration"),tc(Lc,"onAnimationStart"),tc("dblclick","onDoubleClick"),tc("focusin","onFocus"),tc("focusout","onBlur"),tc(Do,"onTransitionRun"),tc(Nv,"onTransitionStart"),tc(kw,"onTransitionCancel"),tc(Ly,"onTransitionEnd"),$t("onMouseEnter",["mouseout","mouseover"]),$t("onMouseLeave",["mouseout","mouseover"]),$t("onPointerEnter",["pointerout","pointerover"]),$t("onPointerLeave",["pointerout","pointerover"]),pt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),pt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),pt("onBeforeInput",["compositionend","keypress","textInput","paste"]),pt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),pt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),pt("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 $9(u,f){f=(f&4)!==0;for(var y=0;y<u.length;y++){var M=u[y],D=M.event;M=M.listeners;e:{var j=void 0;if(f)for(var ue=M.length-1;0<=ue;ue--){var Pe=M[ue],rt=Pe.instance,Mt=Pe.currentTarget;if(Pe=Pe.listener,rt!==j&&D.isPropagationStopped())break e;j=Pe,D.currentTarget=Mt;try{j(D)}catch(zt){Am(zt)}D.currentTarget=null,j=rt}else for(ue=0;ue<M.length;ue++){if(Pe=M[ue],rt=Pe.instance,Mt=Pe.currentTarget,Pe=Pe.listener,rt!==j&&D.isPropagationStopped())break e;j=Pe,D.currentTarget=Mt;try{j(D)}catch(zt){Am(zt)}D.currentTarget=null,j=rt}}}}function Qr(u,f){var y=f[on];y===void 0&&(y=f[on]=new Set);var M=u+"__bubble";y.has(M)||(q9(f,u,2,!1),y.add(M))}function GE(u,f,y){var M=0;f&&(M|=4),q9(y,u,M,f)}var C3="_reactListening"+Math.random().toString(36).slice(2);function WE(u){if(!u[C3]){u[C3]=!0,bt.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[C3]||(f[C3]=!0,GE("selectionchange",!1,f))}}function q9(u,f,y,M){switch(SP(f)){case 2:var D=BZ;break;case 8:D=HZ;break;default:D=oC}y=D.bind(null,f,y,u),D=void 0,!Ro||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(D=!0),M?D!==void 0?u.addEventListener(f,y,{capture:!0,passive:D}):u.addEventListener(f,y,!0):D!==void 0?u.addEventListener(f,y,{passive:D}):u.addEventListener(f,y,!1)}function $E(u,f,y,M,D){var j=M;if((f&1)===0&&(f&2)===0&&M!==null)e:for(;;){if(M===null)return;var ue=M.tag;if(ue===3||ue===4){var Pe=M.stateNode.containerInfo;if(Pe===D)break;if(ue===4)for(ue=M.return;ue!==null;){var rt=ue.tag;if((rt===3||rt===4)&&ue.stateNode.containerInfo===D)return;ue=ue.return}for(;Pe!==null;){if(ue=Pn(Pe),ue===null)return;if(rt=ue.tag,rt===5||rt===6||rt===26||rt===27){M=j=ue;continue e}Pe=Pe.parentNode}}M=M.return}Yl(function(){var Mt=j,zt=Va(y),Vt=[];e:{var At=ec.get(u);if(At!==void 0){var Ot=Oi,Rn=u;switch(u){case"keypress":if(ni(y)===0)break e;case"keydown":case"keyup":Ot=od;break;case"focusin":Rn="focus",Ot=fa;break;case"focusout":Rn="blur",Ot=fa;break;case"beforeblur":case"afterblur":Ot=fa;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":Ot=xh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ot=id;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ot=bm;break;case oo:case yo:case Lc:Ot=Hs;break;case Ly:Ot=_m;break;case"scroll":case"scrollend":Ot=Ea;break;case"wheel":Ot=Sm;break;case"copy":case"cut":case"paste":Ot=Sl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ot=Ql;break;case"toggle":case"beforetoggle":Ot=Mm}var Jn=(f&4)!==0,Xi=!Jn&&(u==="scroll"||u==="scrollend"),gt=Jn?At!==null?At+"Capture":null:At;Jn=[];for(var dt=Mt,wt;dt!==null;){var Bt=dt;if(wt=Bt.stateNode,Bt=Bt.tag,Bt!==5&&Bt!==26&&Bt!==27||wt===null||gt===null||(Bt=Xo(dt,gt),Bt!=null&&Jn.push(Rb(dt,Bt,wt))),Xi)break;dt=dt.return}0<Jn.length&&(At=new Ot(At,Rn,null,y,zt),Vt.push({event:At,listeners:Jn}))}}if((f&7)===0){e:{if(At=u==="mouseover"||u==="pointerover",Ot=u==="mouseout"||u==="pointerout",At&&y!==Xl&&(Rn=y.relatedTarget||y.fromElement)&&(Pn(Rn)||Rn[Lt]))break e;if((Ot||At)&&(At=zt.window===zt?zt:(At=zt.ownerDocument)?At.defaultView||At.parentWindow:window,Ot?(Rn=y.relatedTarget||y.toElement,Ot=Mt,Rn=Rn?Pn(Rn):null,Rn!==null&&(Xi=s(Rn),Jn=Rn.tag,Rn!==Xi||Jn!==5&&Jn!==27&&Jn!==6)&&(Rn=null)):(Ot=null,Rn=Mt),Ot!==Rn)){if(Jn=xh,Bt="onMouseLeave",gt="onMouseEnter",dt="mouse",(u==="pointerout"||u==="pointerover")&&(Jn=Ql,Bt="onPointerLeave",gt="onPointerEnter",dt="pointer"),Xi=Ot==null?At:ir(Ot),wt=Rn==null?At:ir(Rn),At=new Jn(Bt,dt+"leave",Ot,y,zt),At.target=Xi,At.relatedTarget=wt,Bt=null,Pn(zt)===Mt&&(Jn=new Jn(gt,dt+"enter",Rn,y,zt),Jn.target=wt,Jn.relatedTarget=Xi,Bt=Jn),Xi=Bt,Ot&&Rn)t:{for(Jn=pZ,gt=Ot,dt=Rn,wt=0,Bt=gt;Bt;Bt=Jn(Bt))wt++;Bt=0;for(var Vn=dt;Vn;Vn=Jn(Vn))Bt++;for(;0<wt-Bt;)gt=Jn(gt),wt--;for(;0<Bt-wt;)dt=Jn(dt),Bt--;for(;wt--;){if(gt===dt||dt!==null&&gt===dt.alternate){Jn=gt;break t}gt=Jn(gt),dt=Jn(dt)}Jn=null}else Jn=null;Ot!==null&&X9(Vt,At,Ot,Jn,!1),Rn!==null&&Xi!==null&&X9(Vt,Xi,Rn,Jn,!0)}}e:{if(At=Mt?ir(Mt):window,Ot=At.nodeName&&At.nodeName.toLowerCase(),Ot==="select"||Ot==="input"&&At.type==="file")var Si=Be;else if(ud(At))if(Ve)Si=er;else{Si=xn;var Ln=gn}else Ot=At.nodeName,!Ot||Ot.toLowerCase()!=="input"||At.type!=="checkbox"&&At.type!=="radio"?Mt&&wa(Mt.elementType)&&(Si=Be):Si=Sn;if(Si&&(Si=Si(u,Mt))){kp(Vt,Si,y,zt);break e}Ln&&Ln(u,At,Mt),u==="focusout"&&Mt&&At.type==="number"&&Mt.memoizedProps.value!=null&&Di(At,"number",At.value)}switch(Ln=Mt?ir(Mt):window,u){case"focusin":(ud(Ln)||Ln.contentEditable==="true")&&(ai=Ln,os=Mt,Os=null);break;case"focusout":Os=os=ai=null;break;case"mousedown":Ko=!0;break;case"contextmenu":case"mouseup":case"dragend":Ko=!1,ko(Vt,y,zt);break;case"selectionchange":if(gi)break;case"keydown":case"keyup":ko(Vt,y,zt)}var Pr;if(du)e:{switch(u){case"compositionstart":var ii="onCompositionStart";break e;case"compositionend":ii="onCompositionEnd";break e;case"compositionupdate":ii="onCompositionUpdate";break e}ii=void 0}else fu?cd(u,y)&&(ii="onCompositionEnd"):u==="keydown"&&y.keyCode===229&&(ii="onCompositionStart");ii&&(Np&&y.locale!=="ko"&&(fu||ii!=="onCompositionStart"?ii==="onCompositionEnd"&&fu&&(Pr=Ic()):(xs=zt,Ga="value"in xs?xs.value:xs.textContent,fu=!0)),Ln=A3(Mt,ii),0<Ln.length&&(ii=new Mp(ii,u,null,y,zt),Vt.push({event:ii,listeners:Ln}),Pr?ii.data=Pr:(Pr=Ds(y),Pr!==null&&(ii.data=Pr)))),(Pr=Ap?bs(u,y):Rp(u,y))&&(ii=A3(Mt,"onBeforeInput"),0<ii.length&&(Ln=new Mp("onBeforeInput","beforeinput",null,y,zt),Vt.push({event:Ln,listeners:ii}),Ln.data=Pr)),Cs(Vt,u,Mt,y,zt)}$9(Vt,f)})}function Rb(u,f,y){return{instance:u,listener:f,currentTarget:y}}function A3(u,f){for(var y=f+"Capture",M=[];u!==null;){var D=u,j=D.stateNode;if(D=D.tag,D!==5&&D!==26&&D!==27||j===null||(D=Xo(u,y),D!=null&&M.unshift(Rb(u,D,j)),D=Xo(u,f),D!=null&&M.push(Rb(u,D,j))),u.tag===3)return M;u=u.return}return[]}function pZ(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function X9(u,f,y,M,D){for(var j=f._reactName,ue=[];y!==null&&y!==M;){var Pe=y,rt=Pe.alternate,Mt=Pe.stateNode;if(Pe=Pe.tag,rt!==null&&rt===M)break;Pe!==5&&Pe!==26&&Pe!==27||Mt===null||(rt=Mt,D?(Mt=Xo(y,j),Mt!=null&&ue.unshift(Rb(y,Mt,rt))):D||(Mt=Xo(y,j),Mt!=null&&ue.push(Rb(y,Mt,rt)))),y=y.return}ue.length!==0&&u.push({event:f,listeners:ue})}var mZ=/\r\n?/g,gZ=/\u0000|\uFFFD/g;function Y9(u){return(typeof u=="string"?u:""+u).replace(mZ,`
`).replace(gZ,"")}function K9(u,f){return f=Y9(f),Y9(u)===f}function qi(u,f,y,M,D,j){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":Gn(u,"class",M);break;case"tabIndex":Gn(u,"tabindex",M);break;case"dir":case"role":case"viewBox":case"width":case"height":Gn(u,y,M);break;case"style":ua(u,M,j);break;case"data":if(f!=="object"){Gn(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=da(""+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 j=="function"&&(y==="formAction"?(f!=="input"&&qi(u,f,"name",D.name,D,null),qi(u,f,"formEncType",D.formEncType,D,null),qi(u,f,"formMethod",D.formMethod,D,null),qi(u,f,"formTarget",D.formTarget,D,null)):(qi(u,f,"encType",D.encType,D,null),qi(u,f,"method",D.method,D,null),qi(u,f,"target",D.target,D,null)));if(M==null||typeof M=="symbol"||typeof M=="boolean"){u.removeAttribute(y);break}M=da(""+M),u.setAttribute(y,M);break;case"onClick":M!=null&&(u.onclick=Ps);break;case"onScroll":M!=null&&Qr("scroll",u);break;case"onScrollEnd":M!=null&&Qr("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(D.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=da(""+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":Qr("beforetoggle",u),Qr("toggle",u),jn(u,"popover",M);break;case"xlinkActuate":ln(u,"http://www.w3.org/1999/xlink","xlink:actuate",M);break;case"xlinkArcrole":ln(u,"http://www.w3.org/1999/xlink","xlink:arcrole",M);break;case"xlinkRole":ln(u,"http://www.w3.org/1999/xlink","xlink:role",M);break;case"xlinkShow":ln(u,"http://www.w3.org/1999/xlink","xlink:show",M);break;case"xlinkTitle":ln(u,"http://www.w3.org/1999/xlink","xlink:title",M);break;case"xlinkType":ln(u,"http://www.w3.org/1999/xlink","xlink:type",M);break;case"xmlBase":ln(u,"http://www.w3.org/XML/1998/namespace","xml:base",M);break;case"xmlLang":ln(u,"http://www.w3.org/XML/1998/namespace","xml:lang",M);break;case"xmlSpace":ln(u,"http://www.w3.org/XML/1998/namespace","xml:space",M);break;case"is":jn(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,jn(u,y,M))}}function qE(u,f,y,M,D,j){switch(y){case"style":ua(u,M,j);break;case"dangerouslySetInnerHTML":if(M!=null){if(typeof M!="object"||!("__html"in M))throw Error(r(61));if(y=M.__html,y!=null){if(D.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&&Qr("scroll",u);break;case"onScrollEnd":M!=null&&Qr("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(!mt.hasOwnProperty(y))e:{if(y[0]==="o"&&y[1]==="n"&&(D=y.endsWith("Capture"),f=y.slice(2,D?y.length-7:void 0),j=u[hn]||null,j=j!=null?j[y]:null,typeof j=="function"&&u.removeEventListener(f,j,D),typeof M=="function")){typeof j!="function"&&j!==null&&(y in u?u[y]=null:u.hasAttribute(y)&&u.removeAttribute(y)),u.addEventListener(f,M,D);break e}y in u?u[y]=M:M===!0?u.setAttribute(y,""):jn(u,y,M)}}}function Oa(u,f,y){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Qr("error",u),Qr("load",u);var M=!1,D=!1,j;for(j in y)if(y.hasOwnProperty(j)){var ue=y[j];if(ue!=null)switch(j){case"src":M=!0;break;case"srcSet":D=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:qi(u,f,j,ue,y,null)}}D&&qi(u,f,"srcSet",y.srcSet,y,null),M&&qi(u,f,"src",y.src,y,null);return;case"input":Qr("invalid",u);var Pe=j=ue=D=null,rt=null,Mt=null;for(M in y)if(y.hasOwnProperty(M)){var zt=y[M];if(zt!=null)switch(M){case"name":D=zt;break;case"type":ue=zt;break;case"checked":rt=zt;break;case"defaultChecked":Mt=zt;break;case"value":j=zt;break;case"defaultValue":Pe=zt;break;case"children":case"dangerouslySetInnerHTML":if(zt!=null)throw Error(r(137,f));break;default:qi(u,f,M,zt,y,null)}}Rs(u,j,Pe,rt,Mt,ue,D,!1);return;case"select":Qr("invalid",u),M=ue=j=null;for(D in y)if(y.hasOwnProperty(D)&&(Pe=y[D],Pe!=null))switch(D){case"value":j=Pe;break;case"defaultValue":ue=Pe;break;case"multiple":M=Pe;default:qi(u,f,D,Pe,y,null)}f=j,y=ue,u.multiple=!!M,f!=null?vs(u,!!M,f,!1):y!=null&&vs(u,!!M,y,!0);return;case"textarea":Qr("invalid",u),j=D=M=null;for(ue in y)if(y.hasOwnProperty(ue)&&(Pe=y[ue],Pe!=null))switch(ue){case"value":M=Pe;break;case"defaultValue":D=Pe;break;case"children":j=Pe;break;case"dangerouslySetInnerHTML":if(Pe!=null)throw Error(r(91));break;default:qi(u,f,ue,Pe,y,null)}fi(u,M,D,j);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":Qr("beforetoggle",u),Qr("toggle",u),Qr("cancel",u),Qr("close",u);break;case"iframe":case"object":Qr("load",u);break;case"video":case"audio":for(M=0;M<gc.length;M++)Qr(gc[M],u);break;case"image":Qr("error",u),Qr("load",u);break;case"details":Qr("toggle",u);break;case"embed":case"source":case"link":Qr("error",u),Qr("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(Mt in y)if(y.hasOwnProperty(Mt)&&(M=y[Mt],M!=null))switch(Mt){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:qi(u,f,Mt,M,y,null)}return;default:if(wa(f)){for(zt in y)y.hasOwnProperty(zt)&&(M=y[zt],M!==void 0&&qE(u,f,zt,M,y,void 0));return}}for(Pe in y)y.hasOwnProperty(Pe)&&(M=y[Pe],M!=null&&qi(u,f,Pe,M,y,null))}function vZ(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 D=null,j=null,ue=null,Pe=null,rt=null,Mt=null,zt=null;for(Ot in y){var Vt=y[Ot];if(y.hasOwnProperty(Ot)&&Vt!=null)switch(Ot){case"checked":break;case"value":break;case"defaultValue":rt=Vt;default:M.hasOwnProperty(Ot)||qi(u,f,Ot,null,M,Vt)}}for(var At in M){var Ot=M[At];if(Vt=y[At],M.hasOwnProperty(At)&&(Ot!=null||Vt!=null))switch(At){case"type":j=Ot;break;case"name":D=Ot;break;case"checked":Mt=Ot;break;case"defaultChecked":zt=Ot;break;case"value":ue=Ot;break;case"defaultValue":Pe=Ot;break;case"children":case"dangerouslySetInnerHTML":if(Ot!=null)throw Error(r(137,f));break;default:Ot!==Vt&&qi(u,f,At,Ot,M,Vt)}}gs(u,ue,Pe,rt,Mt,zt,j,D);return;case"select":Ot=ue=Pe=At=null;for(j in y)if(rt=y[j],y.hasOwnProperty(j)&&rt!=null)switch(j){case"value":break;case"multiple":Ot=rt;default:M.hasOwnProperty(j)||qi(u,f,j,null,M,rt)}for(D in M)if(j=M[D],rt=y[D],M.hasOwnProperty(D)&&(j!=null||rt!=null))switch(D){case"value":At=j;break;case"defaultValue":Pe=j;break;case"multiple":ue=j;default:j!==rt&&qi(u,f,D,j,M,rt)}f=Pe,y=ue,M=Ot,At!=null?vs(u,!!y,At,!1):!!M!=!!y&&(f!=null?vs(u,!!y,f,!0):vs(u,!!y,y?[]:"",!1));return;case"textarea":Ot=At=null;for(Pe in y)if(D=y[Pe],y.hasOwnProperty(Pe)&&D!=null&&!M.hasOwnProperty(Pe))switch(Pe){case"value":break;case"children":break;default:qi(u,f,Pe,null,M,D)}for(ue in M)if(D=M[ue],j=y[ue],M.hasOwnProperty(ue)&&(D!=null||j!=null))switch(ue){case"value":At=D;break;case"defaultValue":Ot=D;break;case"children":break;case"dangerouslySetInnerHTML":if(D!=null)throw Error(r(91));break;default:D!==j&&qi(u,f,ue,D,M,j)}gr(u,At,Ot);return;case"option":for(var Rn in y)if(At=y[Rn],y.hasOwnProperty(Rn)&&At!=null&&!M.hasOwnProperty(Rn))switch(Rn){case"selected":u.selected=!1;break;default:qi(u,f,Rn,null,M,At)}for(rt in M)if(At=M[rt],Ot=y[rt],M.hasOwnProperty(rt)&&At!==Ot&&(At!=null||Ot!=null))switch(rt){case"selected":u.selected=At&&typeof At!="function"&&typeof At!="symbol";break;default:qi(u,f,rt,At,M,Ot)}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)At=y[Jn],y.hasOwnProperty(Jn)&&At!=null&&!M.hasOwnProperty(Jn)&&qi(u,f,Jn,null,M,At);for(Mt in M)if(At=M[Mt],Ot=y[Mt],M.hasOwnProperty(Mt)&&At!==Ot&&(At!=null||Ot!=null))switch(Mt){case"children":case"dangerouslySetInnerHTML":if(At!=null)throw Error(r(137,f));break;default:qi(u,f,Mt,At,M,Ot)}return;default:if(wa(f)){for(var Xi in y)At=y[Xi],y.hasOwnProperty(Xi)&&At!==void 0&&!M.hasOwnProperty(Xi)&&qE(u,f,Xi,void 0,M,At);for(zt in M)At=M[zt],Ot=y[zt],!M.hasOwnProperty(zt)||At===Ot||At===void 0&&Ot===void 0||qE(u,f,zt,At,M,Ot);return}}for(var gt in y)At=y[gt],y.hasOwnProperty(gt)&&At!=null&&!M.hasOwnProperty(gt)&&qi(u,f,gt,null,M,At);for(Vt in M)At=M[Vt],Ot=y[Vt],!M.hasOwnProperty(Vt)||At===Ot||At==null&&Ot==null||qi(u,f,Vt,At,M,Ot)}function Z9(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function xZ(){if(typeof performance.getEntriesByType=="function"){for(var u=0,f=0,y=performance.getEntriesByType("resource"),M=0;M<y.length;M++){var D=y[M],j=D.transferSize,ue=D.initiatorType,Pe=D.duration;if(j&&Pe&&Z9(ue)){for(ue=0,Pe=D.responseEnd,M+=1;M<y.length;M++){var rt=y[M],Mt=rt.startTime;if(Mt>Pe)break;var zt=rt.transferSize,Vt=rt.initiatorType;zt&&Z9(Vt)&&(rt=rt.responseEnd,ue+=zt*(rt<Pe?1:(Pe-Mt)/(rt-Mt)))}if(--M,f+=8*(j+ue)/(D.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 N3(u){return u.nodeType===9?u:u.ownerDocument}function Q9(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 J9(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 yZ(){var u=window.event;return u&&u.type==="popstate"?u===ZE?!1:(ZE=u,!0):(ZE=null,!1)}var eP=typeof setTimeout=="function"?setTimeout:void 0,bZ=typeof clearTimeout=="function"?clearTimeout:void 0,tP=typeof Promise=="function"?Promise:void 0,_Z=typeof queueMicrotask=="function"?queueMicrotask:typeof tP<"u"?function(u){return tP.resolve(null).then(u).catch(SZ)}:eP;function SZ(u){setTimeout(function(){throw u})}function r0(u){return u==="head"}function nP(u,f){var y=f,M=0;do{var D=y.nextSibling;if(u.removeChild(y),D&&D.nodeType===8)if(y=D.data,y==="/$"||y==="/&"){if(M===0){u.removeChild(D),bx(f);return}M--}else if(y==="$"||y==="$?"||y==="$~"||y==="$!"||y==="&")M++;else if(y==="html")kb(u.ownerDocument.documentElement);else if(y==="head"){y=u.ownerDocument.head,kb(y);for(var j=y.firstChild;j;){var ue=j.nextSibling,Pe=j.nodeName;j[zn]||Pe==="SCRIPT"||Pe==="STYLE"||Pe==="LINK"&&j.rel.toLowerCase()==="stylesheet"||y.removeChild(j),j=ue}}else y==="body"&&kb(u.ownerDocument.body);y=D}while(y);bx(f)}function rP(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),Qn(y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(y.rel.toLowerCase()==="stylesheet")continue}u.removeChild(y)}}function wZ(u,f,y,M){for(;u.nodeType===1;){var D=y;if(u.nodeName.toLowerCase()!==f.toLowerCase()){if(!M&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(M){if(!u[zn])switch(f){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(j=u.getAttribute("rel"),j==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(j!==D.rel||u.getAttribute("href")!==(D.href==null||D.href===""?null:D.href)||u.getAttribute("crossorigin")!==(D.crossOrigin==null?null:D.crossOrigin)||u.getAttribute("title")!==(D.title==null?null:D.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(j=u.getAttribute("src"),(j!==(D.src==null?null:D.src)||u.getAttribute("type")!==(D.type==null?null:D.type)||u.getAttribute("crossorigin")!==(D.crossOrigin==null?null:D.crossOrigin))&&j&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(f==="input"&&u.type==="hidden"){var j=D.name==null?null:""+D.name;if(D.type==="hidden"&&u.getAttribute("name")===j)return u}else return u;if(u=Pu(u.nextSibling),u===null)break}return null}function MZ(u,f,y){if(f==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!y||(u=Pu(u.nextSibling),u===null))return null;return u}function iP(u,f){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!f||(u=Pu(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 TZ(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 Pu(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 sP(u){u=u.nextSibling;for(var f=0;u;){if(u.nodeType===8){var y=u.data;if(y==="/$"||y==="/&"){if(f===0)return Pu(u.nextSibling);f--}else y!=="$"&&y!=="$!"&&y!=="$?"&&y!=="$~"&&y!=="&"||f++}u=u.nextSibling}return null}function oP(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=N3(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 kb(u){for(var f=u.attributes;f.length;)u.removeAttributeNode(f[0]);Qn(u)}var Du=new Map,lP=new Set;function R3(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var Hh=K.d;K.d={f:EZ,r:CZ,D:AZ,C:NZ,L:RZ,m:kZ,X:DZ,S:PZ,M:IZ};function EZ(){var u=Hh.f(),f=Bc();return u||f}function CZ(u){var f=lr(u);f!==null&&f.tag===5&&f.type==="form"?f3(f):Hh.r(u)}var vx=typeof document>"u"?null:document;function cP(u,f,y){var M=vx;if(M&&typeof f=="string"&&f){var D=Nn(f);D='link[rel="'+u+'"][href="'+D+'"]',typeof y=="string"&&(D+='[crossorigin="'+y+'"]'),lP.has(D)||(lP.add(D),u={rel:u,crossOrigin:y,href:f},M.querySelector(D)===null&&(f=M.createElement("link"),Oa(f,"link",u),ot(f),M.head.appendChild(f)))}}function AZ(u){Hh.D(u),cP("dns-prefetch",u,null)}function NZ(u,f){Hh.C(u,f),cP("preconnect",u,f)}function RZ(u,f,y){Hh.L(u,f,y);var M=vx;if(M&&u&&f){var D='link[rel="preload"][as="'+Nn(f)+'"]';f==="image"&&y&&y.imageSrcSet?(D+='[imagesrcset="'+Nn(y.imageSrcSet)+'"]',typeof y.imageSizes=="string"&&(D+='[imagesizes="'+Nn(y.imageSizes)+'"]')):D+='[href="'+Nn(u)+'"]';var j=D;switch(f){case"style":j=xx(u);break;case"script":j=yx(u)}Du.has(j)||(u=h({rel:"preload",href:f==="image"&&y&&y.imageSrcSet?void 0:u,as:f},y),Du.set(j,u),M.querySelector(D)!==null||f==="style"&&M.querySelector(Pb(j))||f==="script"&&M.querySelector(Db(j))||(f=M.createElement("link"),Oa(f,"link",u),ot(f),M.head.appendChild(f)))}}function kZ(u,f){Hh.m(u,f);var y=vx;if(y&&u){var M=f&&typeof f.as=="string"?f.as:"script",D='link[rel="modulepreload"][as="'+Nn(M)+'"][href="'+Nn(u)+'"]',j=D;switch(M){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=yx(u)}if(!Du.has(j)&&(u=h({rel:"modulepreload",href:u},f),Du.set(j,u),y.querySelector(D)===null)){switch(M){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(y.querySelector(Db(j)))return}M=y.createElement("link"),Oa(M,"link",u),ot(M),y.head.appendChild(M)}}}function PZ(u,f,y){Hh.S(u,f,y);var M=vx;if(M&&u){var D=xe(M).hoistableStyles,j=xx(u);f=f||"default";var ue=D.get(j);if(!ue){var Pe={loading:0,preload:null};if(ue=M.querySelector(Pb(j)))Pe.loading=5;else{u=h({rel:"stylesheet",href:u,"data-precedence":f},y),(y=Du.get(j))&&nC(u,y);var rt=ue=M.createElement("link");ot(rt),Oa(rt,"link",u),rt._p=new Promise(function(Mt,zt){rt.onload=Mt,rt.onerror=zt}),rt.addEventListener("load",function(){Pe.loading|=1}),rt.addEventListener("error",function(){Pe.loading|=2}),Pe.loading|=4,k3(ue,f,M)}ue={type:"stylesheet",instance:ue,count:1,state:Pe},D.set(j,ue)}}}function DZ(u,f){Hh.X(u,f);var y=vx;if(y&&u){var M=xe(y).hoistableScripts,D=yx(u),j=M.get(D);j||(j=y.querySelector(Db(D)),j||(u=h({src:u,async:!0},f),(f=Du.get(D))&&rC(u,f),j=y.createElement("script"),ot(j),Oa(j,"link",u),y.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},M.set(D,j))}}function IZ(u,f){Hh.M(u,f);var y=vx;if(y&&u){var M=xe(y).hoistableScripts,D=yx(u),j=M.get(D);j||(j=y.querySelector(Db(D)),j||(u=h({src:u,async:!0,type:"module"},f),(f=Du.get(D))&&rC(u,f),j=y.createElement("script"),ot(j),Oa(j,"link",u),y.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},M.set(D,j))}}function uP(u,f,y,M){var D=(D=re.current)?R3(D):null;if(!D)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof y.precedence=="string"&&typeof y.href=="string"?(f=xx(y.href),y=xe(D).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=xx(y.href);var j=xe(D).hoistableStyles,ue=j.get(u);if(ue||(D=D.ownerDocument||D,ue={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(u,ue),(j=D.querySelector(Pb(u)))&&!j._p&&(ue.instance=j,ue.state.loading=5),Du.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},Du.set(u,y),j||OZ(D,u,y,ue.state))),f&&M===null)throw Error(r(528,""));return ue}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=yx(y),y=xe(D).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 xx(u){return'href="'+Nn(u)+'"'}function Pb(u){return'link[rel="stylesheet"]['+u+"]"}function dP(u){return h({},u,{"data-precedence":u.precedence,precedence:null})}function OZ(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}),Oa(f,"link",y),ot(f),u.head.appendChild(f))}function yx(u){return'[src="'+Nn(u)+'"]'}function Db(u){return"script[async]"+u}function fP(u,f,y){if(f.count++,f.instance===null)switch(f.type){case"style":var M=u.querySelector('style[data-href~="'+Nn(y.href)+'"]');if(M)return f.instance=M,ot(M),M;var D=h({},y,{"data-href":y.href,"data-precedence":y.precedence,href:null,precedence:null});return M=(u.ownerDocument||u).createElement("style"),ot(M),Oa(M,"style",D),k3(M,y.precedence,u),f.instance=M;case"stylesheet":D=xx(y.href);var j=u.querySelector(Pb(D));if(j)return f.state.loading|=4,f.instance=j,ot(j),j;M=dP(y),(D=Du.get(D))&&nC(M,D),j=(u.ownerDocument||u).createElement("link"),ot(j);var ue=j;return ue._p=new Promise(function(Pe,rt){ue.onload=Pe,ue.onerror=rt}),Oa(j,"link",M),f.state.loading|=4,k3(j,y.precedence,u),f.instance=j;case"script":return j=yx(y.src),(D=u.querySelector(Db(j)))?(f.instance=D,ot(D),D):(M=y,(D=Du.get(j))&&(M=h({},y),rC(M,D)),u=u.ownerDocument||u,D=u.createElement("script"),ot(D),Oa(D,"link",M),u.head.appendChild(D),f.instance=D);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,k3(M,y.precedence,u));return f.instance}function k3(u,f,y){for(var M=y.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),D=M.length?M[M.length-1]:null,j=D,ue=0;ue<M.length;ue++){var Pe=M[ue];if(Pe.dataset.precedence===f)j=Pe;else if(j!==D)break}j?j.parentNode.insertBefore(u,j.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 P3=null;function hP(u,f,y){if(P3===null){var M=new Map,D=P3=new Map;D.set(y,M)}else D=P3,M=D.get(y),M||(M=new Map,D.set(y,M));if(M.has(u))return M;for(M.set(u,null),y=y.getElementsByTagName(u),D=0;D<y.length;D++){var j=y[D];if(!(j[zn]||j[Xt]||u==="link"&&j.getAttribute("rel")==="stylesheet")&&j.namespaceURI!=="http://www.w3.org/2000/svg"){var ue=j.getAttribute(f)||"";ue=u+ue;var Pe=M.get(ue);Pe?Pe.push(j):M.set(ue,[j])}}return M}function pP(u,f,y){u=u.ownerDocument||u,u.head.insertBefore(y,f==="title"?u.querySelector("head > title"):null)}function LZ(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 mP(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function zZ(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 D=xx(M.href),j=f.querySelector(Pb(D));if(j){f=j._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(u.count++,u=D3.bind(u),f.then(u,u)),y.state.loading|=4,y.instance=j,ot(j);return}j=f.ownerDocument||f,M=dP(M),(D=Du.get(D))&&nC(M,D),j=j.createElement("link"),ot(j);var ue=j;ue._p=new Promise(function(Pe,rt){ue.onload=Pe,ue.onerror=rt}),Oa(j,"link",M),y.instance=j}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(y,f),(f=y.state.preload)&&(y.state.loading&3)===0&&(u.count++,y=D3.bind(u),f.addEventListener("load",y),f.addEventListener("error",y))}}var iC=0;function jZ(u,f){return u.stylesheets&&u.count===0&&O3(u,u.stylesheets),0<u.count||0<u.imgCount?function(y){var M=setTimeout(function(){if(u.stylesheets&&O3(u,u.stylesheets),u.unsuspend){var j=u.unsuspend;u.unsuspend=null,j()}},6e4+f);0<u.imgBytes&&iC===0&&(iC=62500*xZ());var D=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&O3(u,u.stylesheets),u.unsuspend)){var j=u.unsuspend;u.unsuspend=null,j()}},(u.imgBytes>iC?50:800)+f);return u.unsuspend=y,function(){u.unsuspend=null,clearTimeout(M),clearTimeout(D)}}:null}function D3(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)O3(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var I3=null;function O3(u,f){u.stylesheets=null,u.unsuspend!==null&&(u.count++,I3=new Map,f.forEach(FZ,u),I3=null,D3.call(u))}function FZ(u,f){if(!(f.state.loading&4)){var y=I3.get(u);if(y)var M=y.get(null);else{y=new Map,I3.set(u,y);for(var D=u.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j<D.length;j++){var ue=D[j];(ue.nodeName==="LINK"||ue.getAttribute("media")!=="not all")&&(y.set(ue.dataset.precedence,ue),M=ue)}M&&y.set(null,M)}D=f.instance,ue=D.getAttribute("data-precedence"),j=y.get(ue)||M,j===M&&y.set(null,D),y.set(ue,D),this.count++,M=D3.bind(this),D.addEventListener("load",M),D.addEventListener("error",M),j?j.parentNode.insertBefore(D,j.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(D,u.firstChild)),f.state.loading|=4}}var Ib={$$typeof:A,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function UZ(u,f,y,M,D,j,ue,Pe,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=st(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=st(0),this.hiddenUpdates=st(null),this.identifierPrefix=M,this.onUncaughtError=D,this.onCaughtError=j,this.onRecoverableError=ue,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=rt,this.incompleteTransitions=new Map}function gP(u,f,y,M,D,j,ue,Pe,rt,Mt,zt,Vt){return u=new UZ(u,f,y,ue,rt,Mt,zt,Vt,Pe),f=1,j===!0&&(f|=24),j=_s(3,null,null,f),u.current=j,j.stateNode=u,f=jy(),f.refCount++,u.pooledCache=f,f.refCount++,j.memoizedState={element:M,isDehydrated:y,cache:f},Om(j),u}function vP(u){return u?(u=tf,u):tf}function xP(u,f,y,M,D,j){D=vP(D),M.context===null?M.context=D:M.pendingContext=D,M=vd(f),M.payload={element:y},j=j===void 0?null:j,j!==null&&(M.callback=j),y=uf(u,M,f),y!==null&&(Er(y,u,f),df(y,u,f))}function yP(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){yP(u,f),(u=u.alternate)&&yP(u,f)}function bP(u){if(u.tag===13||u.tag===31){var f=Aa(u,67108864);f!==null&&Er(f,u,67108864),sC(u,67108864)}}function _P(u){if(u.tag===13||u.tag===31){var f=kl();f=Ue(f);var y=Aa(u,f);y!==null&&Er(y,u,f),sC(u,f)}}var L3=!0;function BZ(u,f,y,M){var D=$.T;$.T=null;var j=K.p;try{K.p=2,oC(u,f,y,M)}finally{K.p=j,$.T=D}}function HZ(u,f,y,M){var D=$.T;$.T=null;var j=K.p;try{K.p=8,oC(u,f,y,M)}finally{K.p=j,$.T=D}}function oC(u,f,y,M){if(L3){var D=aC(M);if(D===null)$E(u,f,M,z3,y),wP(u,M);else if(GZ(D,u,f,y,M))M.stopPropagation();else if(wP(u,M),f&4&&-1<VZ.indexOf(u)){for(;D!==null;){var j=lr(D);if(j!==null)switch(j.tag){case 3:if(j=j.stateNode,j.current.memoizedState.isDehydrated){var ue=Je(j.pendingLanes);if(ue!==0){var Pe=j;for(Pe.pendingLanes|=2,Pe.entangledLanes|=2;ue;){var rt=1<<31-we(ue);Pe.entanglements[1]|=rt,ue&=~rt}Yt(j),(Fn&6)===0&&(Xs=te()+500,bn(0))}}break;case 31:case 13:Pe=Aa(j,2),Pe!==null&&Er(Pe,j,2),Bc(),sC(j,2)}if(j=aC(M),j===null&&$E(u,f,M,z3,y),j===D)break;D=j}D!==null&&M.stopPropagation()}else $E(u,f,M,null,y)}}function aC(u){return u=Va(u),lC(u)}var z3=null;function lC(u){if(z3=null,u=Pn(u),u!==null){var f=s(u);if(f===null)u=null;else{var y=f.tag;if(y===13){if(u=o(f),u!==null)return u;u=null}else if(y===31){if(u=a(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 z3=u,null}function SP(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(Se()){case ve:return 2;case ge:return 8;case Te:case He:return 32;case pe:return 268435456;default:return 32}default:return 32}}var cC=!1,i0=null,s0=null,o0=null,Ob=new Map,Lb=new Map,a0=[],VZ="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 wP(u,f){switch(u){case"focusin":case"focusout":i0=null;break;case"dragenter":case"dragleave":s0=null;break;case"mouseover":case"mouseout":o0=null;break;case"pointerover":case"pointerout":Ob.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lb.delete(f.pointerId)}}function zb(u,f,y,M,D,j){return u===null||u.nativeEvent!==j?(u={blockedOn:f,domEventName:y,eventSystemFlags:M,nativeEvent:j,targetContainers:[D]},f!==null&&(f=lr(f),f!==null&&bP(f)),u):(u.eventSystemFlags|=M,f=u.targetContainers,D!==null&&f.indexOf(D)===-1&&f.push(D),u)}function GZ(u,f,y,M,D){switch(f){case"focusin":return i0=zb(i0,u,f,y,M,D),!0;case"dragenter":return s0=zb(s0,u,f,y,M,D),!0;case"mouseover":return o0=zb(o0,u,f,y,M,D),!0;case"pointerover":var j=D.pointerId;return Ob.set(j,zb(Ob.get(j)||null,u,f,y,M,D)),!0;case"gotpointercapture":return j=D.pointerId,Lb.set(j,zb(Lb.get(j)||null,u,f,y,M,D)),!0}return!1}function MP(u){var f=Pn(u.target);if(f!==null){var y=s(f);if(y!==null){if(f=y.tag,f===13){if(f=o(y),f!==null){u.blockedOn=f,kt(u.priority,function(){_P(y)});return}}else if(f===31){if(f=a(y),f!==null){u.blockedOn=f,kt(u.priority,function(){_P(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 j3(u){if(u.blockedOn!==null)return!1;for(var f=u.targetContainers;0<f.length;){var y=aC(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=lr(y),f!==null&&bP(f),u.blockedOn=y,!1;f.shift()}return!0}function TP(u,f,y){j3(u)&&y.delete(f)}function WZ(){cC=!1,i0!==null&&j3(i0)&&(i0=null),s0!==null&&j3(s0)&&(s0=null),o0!==null&&j3(o0)&&(o0=null),Ob.forEach(TP),Lb.forEach(TP)}function F3(u,f){u.blockedOn===f&&(u.blockedOn=null,cC||(cC=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,WZ)))}var U3=null;function EP(u){U3!==u&&(U3=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){U3===u&&(U3=null);for(var f=0;f<u.length;f+=3){var y=u[f],M=u[f+1],D=u[f+2];if(typeof M!="function"){if(lC(M||y)===null)continue;break}var j=lr(y);j!==null&&(u.splice(f,3),f-=3,db(j,{pending:!0,data:D,method:y.method,action:M},M,D))}}))}function bx(u){function f(rt){return F3(rt,u)}i0!==null&&F3(i0,u),s0!==null&&F3(s0,u),o0!==null&&F3(o0,u),Ob.forEach(f),Lb.forEach(f);for(var y=0;y<a0.length;y++){var M=a0[y];M.blockedOn===u&&(M.blockedOn=null)}for(;0<a0.length&&(y=a0[0],y.blockedOn===null);)MP(y),y.blockedOn===null&&a0.shift();if(y=(u.ownerDocument||u).$$reactFormReplay,y!=null)for(M=0;M<y.length;M+=3){var D=y[M],j=y[M+1],ue=D[hn]||null;if(typeof j=="function")ue||EP(y);else if(ue){var Pe=null;if(j&&j.hasAttribute("formAction")){if(D=j,ue=j[hn]||null)Pe=ue.formAction;else if(lC(D)!==null)continue}else Pe=ue.action;typeof Pe=="function"?y[M+1]=Pe:(y.splice(M,3),M-=3),EP(y)}}}function CP(){function u(j){j.canIntercept&&j.info==="react-transition"&&j.intercept({handler:function(){return new Promise(function(ue){return D=ue})},focusReset:"manual",scroll:"manual"})}function f(){D!==null&&(D(),D=null),M||setTimeout(y,20)}function y(){if(!M&&!navigation.transition){var j=navigation.currentEntry;j&&j.url!=null&&navigation.navigate(j.url,{state:j.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var M=!1,D=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),D!==null&&(D(),D=null)}}}function uC(u){this._internalRoot=u}B3.prototype.render=uC.prototype.render=function(u){var f=this._internalRoot;if(f===null)throw Error(r(409));var y=f.current,M=kl();xP(y,M,u,f,null,null)},B3.prototype.unmount=uC.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var f=u.containerInfo;xP(u.current,2,null,u,null,null),Bc(),f[Lt]=null}};function B3(u){this._internalRoot=u}B3.prototype.unstable_scheduleHydration=function(u){if(u){var f=St();u={blockedOn:null,target:u,priority:f};for(var y=0;y<a0.length&&f!==0&&f<a0[y].priority;y++);a0.splice(y,0,u),y===0&&MP(u)}};var AP=e.version;if(AP!=="19.2.1")throw Error(r(527,AP,"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 $Z={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var H3=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!H3.isDisabled&&H3.supportsFiber)try{nt=H3.inject($Z),tt=H3}catch{}}return Fb.createRoot=function(u,f){if(!i(u))throw Error(r(299));var y=!1,M="",D=y3,j=vb,ue=xb;return f!=null&&(f.unstable_strictMode===!0&&(y=!0),f.identifierPrefix!==void 0&&(M=f.identifierPrefix),f.onUncaughtError!==void 0&&(D=f.onUncaughtError),f.onCaughtError!==void 0&&(j=f.onCaughtError),f.onRecoverableError!==void 0&&(ue=f.onRecoverableError)),f=gP(u,1,!1,null,null,y,M,null,D,j,ue,CP),u[Lt]=f.current,WE(u),new uC(f)},Fb.hydrateRoot=function(u,f,y){if(!i(u))throw Error(r(299));var M=!1,D="",j=y3,ue=vb,Pe=xb,rt=null;return y!=null&&(y.unstable_strictMode===!0&&(M=!0),y.identifierPrefix!==void 0&&(D=y.identifierPrefix),y.onUncaughtError!==void 0&&(j=y.onUncaughtError),y.onCaughtError!==void 0&&(ue=y.onCaughtError),y.onRecoverableError!==void 0&&(Pe=y.onRecoverableError),y.formState!==void 0&&(rt=y.formState)),f=gP(u,1,!0,f,y??null,M,D,rt,j,ue,Pe,CP),f.context=vP(null),y=f.current,M=kl(),M=Ue(M),D=vd(M),D.callback=null,uf(y,D,M),y=M,f.current.lanes=y,Rt(f,y),Yt(f),u[Lt]=f.current,WE(u),new B3(f)},Fb.version="19.2.1",Fb}var FP;function tQ(){if(FP)return pC.exports;FP=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=eQ(),pC.exports}var OF=tQ();/**
 * 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 UP="popstate";function BP(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function nQ(t={}){function e(r,i){var c;let s=(c=i.state)==null?void 0:c.masked,{pathname:o,search:a,hash:l}=s||r.location;return X6("",{pathname:o,search:a,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:X_(i)}return iQ(e,n,null,t)}function no(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Gd(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function rQ(){return Math.random().toString(36).substring(2,10)}function HP(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"?dy(e):e,state:n,key:e&&e.key||r||rQ(),unstable_mask:i}}function X_({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 dy(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 iQ(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a="POP",l=null,c=d();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function d(){return(o.state||{idx:null}).idx}function h(){a="POP";let w=d(),S=w==null?null:w-c;c=w,l&&l({action:a,location:_.location,delta:S})}function g(w,S){a="PUSH";let E=BP(w)?w:X6(_.location,w,S);c=d()+1;let A=HP(E,c),N=_.createHref(E.unstable_mask||E);try{o.pushState(A,"",N)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;i.location.assign(N)}s&&l&&l({action:a,location:_.location,delta:1})}function v(w,S){a="REPLACE";let E=BP(w)?w:X6(_.location,w,S);c=d();let A=HP(E,c),N=_.createHref(E.unstable_mask||E);o.replaceState(A,"",N),s&&l&&l({action:a,location:_.location,delta:0})}function b(w){return sQ(w)}let _={get action(){return a},get location(){return t(i,o)},listen(w){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(UP,h),l=w,()=>{i.removeEventListener(UP,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 o.go(w)}};return _}function sQ(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),no(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:X_(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function LF(t,e,n="/"){return oQ(t,e,n,!1)}function oQ(t,e,n,r){let i=typeof e=="string"?dy(e):e,s=dp(i.pathname||"/",n);if(s==null)return null;let o=zF(t);aQ(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=xQ(s);a=gQ(o[l],c,r)}return a}function zF(t,e=[],n=[],r="",i=!1){let s=(o,a,l=i,c)=>{let d={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(d.relativePath.startsWith("/")){if(!d.relativePath.startsWith(r)&&l)return;no(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=Jf([r,d.relativePath]),g=n.concat(d);o.children&&o.children.length>0&&(no(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),zF(o.children,e,g,h,l)),!(o.path==null&&!o.index)&&e.push({path:h,score:pQ(h,o.index),routesMeta:g})};return t.forEach((o,a)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))s(o,a);else for(let c of jF(o.path))s(o,a,!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 o=jF(r.join("/")),a=[];return a.push(...o.map(l=>l===""?s:[s,l].join("/"))),i&&a.push(...o),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function aQ(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:mQ(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var lQ=/^:[\w-]+$/,cQ=3,uQ=2,dQ=1,fQ=10,hQ=-2,VP=t=>t==="*";function pQ(t,e){let n=t.split("/"),r=n.length;return n.some(VP)&&(r+=hQ),e&&(r+=uQ),n.filter(i=>!VP(i)).reduce((i,s)=>i+(lQ.test(s)?cQ:s===""?dQ:fQ),r)}function mQ(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 gQ(t,e,n=!1){let{routesMeta:r}=t,i={},s="/",o=[];for(let a=0;a<r.length;++a){let l=r[a],c=a===r.length-1,d=s==="/"?e:e.slice(s.length)||"/",h=XM({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},d),g=l.route;if(!h&&c&&n&&!r[r.length-1].route.index&&(h=XM({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},d)),!h)return null;Object.assign(i,h.params),o.push({params:i,pathname:Jf([s,h.pathname]),pathnameBase:SQ(Jf([s,h.pathnameBase])),route:g}),h.pathnameBase!=="/"&&(s=Jf([s,h.pathnameBase]))}return o}function XM(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=vQ(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],o=s.replace(/(.)\/+$/,"$1"),a=i.slice(1);return{params:r.reduce((c,{paramName:d,isOptional:h},g)=>{if(d==="*"){let b=a[g]||"";o=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const v=a[g];return h&&!v?c[d]=void 0:c[d]=(v||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:t}}function vQ(t,e=!1,n=!0){Gd(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,(o,a,l,c,d)=>{if(r.push({paramName:a,isOptional:l!=null}),l){let h=d.charAt(c+o.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 xQ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Gd(!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 dp(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 yQ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function bQ(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?dy(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=GP(n.substring(1),"/"):s=GP(n,e)):s=e,{pathname:s,search:wQ(r),hash:MQ(i)}}function GP(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 _Q(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function FF(t){let e=_Q(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=dy(t):(i={...t},no(!i.pathname||!i.pathname.includes("?"),xC("?","pathname","search",i)),no(!i.pathname||!i.pathname.includes("#"),xC("#","pathname","hash",i)),no(!i.search||!i.search.includes("#"),xC("#","search","hash",i)));let s=t===""||i.pathname==="",o=s?"/":i.pathname,a;if(o==null)a=n;else{let h=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),h-=1;i.pathname=g.join("/")}a=h>=0?e[h]:"/"}let l=bQ(i,a),c=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||d)&&(l.pathname+="/"),l}var Jf=t=>t.join("/").replace(/\/\/+/g,"/"),SQ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),wQ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,MQ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,TQ=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 EQ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function CQ(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"||!yQ.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),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),a=dp(o.pathname,e);o.origin===s.origin&&a!=null?n=a+o.search+o.hash:i=!0}catch{Gd(!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 AQ=["GET",...HF];new Set(AQ);var fy=T.createContext(null);fy.displayName="DataRouter";var P5=T.createContext(null);P5.displayName="DataRouterState";var NQ=T.createContext(!1),VF=T.createContext({isTransitioning:!1});VF.displayName="ViewTransition";var RQ=T.createContext(new Map);RQ.displayName="Fetchers";var kQ=T.createContext(null);kQ.displayName="Await";var Qu=T.createContext(null);Qu.displayName="Navigation";var WS=T.createContext(null);WS.displayName="Location";var vp=T.createContext({outlet:null,matches:[],isDataRoute:!1});vp.displayName="Route";var b7=T.createContext(null);b7.displayName="RouteError";var GF="REACT_ROUTER_ERROR",PQ="REDIRECT",DQ="ROUTE_ERROR_RESPONSE";function IQ(t){if(t.startsWith(`${GF}:${PQ}:{`))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 OQ(t){if(t.startsWith(`${GF}:${DQ}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new TQ(e.status,e.statusText,e.data)}catch{}}function LQ(t,{relative:e}={}){no($S(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=T.useContext(Qu),{hash:i,pathname:s,search:o}=qS(t,{relative:e}),a=s;return n!=="/"&&(a=s==="/"?n:Jf([n,s])),r.createHref({pathname:a,search:o,hash:i})}function $S(){return T.useContext(WS)!=null}function uh(){return no($S(),"useLocation() may be used only in the context of a <Router> component."),T.useContext(WS).location}var WF="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function $F(t){T.useContext(Qu).static||T.useLayoutEffect(t)}function D5(){let{isDataRoute:t}=T.useContext(vp);return t?YQ():zQ()}function zQ(){no($S(),"useNavigate() may be used only in the context of a <Router> component.");let t=T.useContext(fy),{basename:e,navigator:n}=T.useContext(Qu),{matches:r}=T.useContext(vp),{pathname:i}=uh(),s=JSON.stringify(FF(r)),o=T.useRef(!1);return $F(()=>{o.current=!0}),T.useCallback((l,c={})=>{if(Gd(o.current,WF),!o.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:Jf([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,i,t])}T.createContext(null);function qS(t,{relative:e}={}){let{matches:n}=T.useContext(vp),{pathname:r}=uh(),i=JSON.stringify(FF(n));return T.useMemo(()=>y7(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function jQ(t,e){return qF(t,e)}function qF(t,e,n){var w;no($S(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=T.useContext(Qu),{matches:i}=T.useContext(vp),s=i[i.length-1],o=s?s.params:{},a=s?s.pathname:"/",l=s?s.pathnameBase:"/",c=s&&s.route;{let S=c&&c.path||"";YF(a,!c||S.endsWith("*")||S.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${a}" (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=uh(),h;if(e){let S=typeof e=="string"?dy(e):e;no(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});Gd(c||b!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),Gd(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 _=VQ(b&&b.map(S=>Object.assign({},S,{params:Object.assign({},o,S.params),pathname:Jf([l,r.encodeLocation?r.encodeLocation(S.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?l:Jf([l,r.encodeLocation?r.encodeLocation(S.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),i,n);return e&&_?T.createElement(WS.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},_):_}function FQ(){let t=XQ(),e=EQ(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},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=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,o)}var UQ=T.createElement(FQ,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=OQ(t.digest);n&&(t=n)}let e=t!==void 0?T.createElement(vp.Provider,{value:this.props.routeContext},T.createElement(b7.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?T.createElement(BQ,{error:t},e):e}};XF.contextType=NQ;var yC=new WeakMap;function BQ({children:t,error:e}){let{basename:n}=T.useContext(Qu);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=IQ(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 o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(s.to,{replace:r.replace}));throw yC.set(e,o),o}return T.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function HQ({routeContext:t,match:e,children:n}){let r=T.useContext(fy);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),T.createElement(vp.Provider,{value:t},n)}function VQ(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);no(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 o=!1,a=-1;if(n&&r){o=r.renderFallback;for(let d=0;d<i.length;d++){let h=i[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(a=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&&(o=!0),a>=0?i=i.slice(0,a+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:CQ(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||UQ,o&&(a<0&&g===0?(YF("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,w=null):a===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(HQ,{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 GQ(t){let e=T.useContext(fy);return no(e,_7(t)),e}function WQ(t){let e=T.useContext(P5);return no(e,_7(t)),e}function $Q(t){let e=T.useContext(vp);return no(e,_7(t)),e}function S7(t){let e=$Q(t),n=e.matches[e.matches.length-1];return no(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function qQ(){return S7("useRouteId")}function XQ(){var r;let t=T.useContext(b7),e=WQ("useRouteError"),n=S7("useRouteError");return t!==void 0?t:(r=e.errors)==null?void 0:r[n]}function YQ(){let{router:t}=GQ("useNavigate"),e=S7("useNavigate"),n=T.useRef(!1);return $F(()=>{n.current=!0}),T.useCallback(async(i,s={})=>{Gd(n.current,WF),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var WP={};function YF(t,e,n){!e&&!WP[t]&&(WP[t]=!0,Gd(!1,n))}T.memo(KQ);function KQ({routes:t,future:e,state:n,isStatic:r,onError:i}){return qF(t,void 0,{state:n,isStatic:r,onError:i})}function If(t){no(!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 ZQ({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){no(!$S(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=T.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof n=="string"&&(n=dy(n));let{pathname:c="/",search:d="",hash:h="",state:g=null,key:v="default",unstable_mask:b}=n,_=T.useMemo(()=>{let w=dp(c,a);return w==null?null:{location:{pathname:w,search:d,hash:h,state:g,key:v,unstable_mask:b},navigationType:r}},[a,c,d,h,g,v,r,b]);return Gd(_!=null,`<Router basename="${a}"> 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(Qu.Provider,{value:l},T.createElement(WS.Provider,{children:e,value:_}))}function QQ({children:t,location:e}){return jQ(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}no(r.type===If,`[${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>`),no(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={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&&(o.children=Y6(r.props.children,s)),n.push(o)}),n}var kM="get",PM="application/x-www-form-urlencoded";function I5(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function JQ(t){return I5(t)&&t.tagName.toLowerCase()==="button"}function eJ(t){return I5(t)&&t.tagName.toLowerCase()==="form"}function tJ(t){return I5(t)&&t.tagName.toLowerCase()==="input"}function nJ(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function rJ(t,e){return t.button===0&&(!e||e==="_self")&&!nJ(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 iJ(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 G3=null;function sJ(){if(G3===null)try{new FormData(document.createElement("form"),0),G3=!1}catch{G3=!0}return G3}var oJ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function bC(t){return t!=null&&!oJ.has(t)?(Gd(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${PM}"`),null):t}function aJ(t,e){let n,r,i,s,o;if(eJ(t)){let a=t.getAttribute("action");r=a?dp(a,e):null,n=t.getAttribute("method")||kM,i=bC(t.getAttribute("enctype"))||PM,s=new FormData(t)}else if(JQ(t)||tJ(t)&&(t.type==="submit"||t.type==="image")){let a=t.form;if(a==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||a.getAttribute("action");if(r=l?dp(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||kM,i=bC(t.getAttribute("formenctype"))||bC(a.getAttribute("enctype"))||PM,s=new FormData(a,t),!sJ()){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(I5(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=kM,r=null,i=PM,o=t}return s&&i==="text/plain"&&(o=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function w7(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function lJ(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&&dp(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function cJ(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 uJ(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 dJ(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await cJ(s,n);return o.links?o.links():[]}return[]}));return mJ(r.flat(1).filter(uJ).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function $P(t,e,n,r,i,s){let o=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,a=(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)=>o(l,c)||a(l,c)):s==="data"?e.filter((l,c)=>{var h;let d=r.routes[l.route.id];if(!d||!d.hasLoader)return!1;if(o(l,c)||a(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 fJ(t,e,{includeHydrateFallback:n}={}){return hJ(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 hJ(t){return[...new Set(t)]}function pJ(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function mJ(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(pJ(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function KF(){let t=T.useContext(fy);return w7(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function gJ(){let t=T.useContext(P5);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 vJ(t,e){let n=T.useContext(M7),[r,i]=T.useState(!1),[s,o]=T.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:c,onMouseLeave:d,onTouchStart:h}=e,g=T.useRef(null);T.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let _=S=>{S.forEach(E=>{o(E.isIntersecting)})},w=new IntersectionObserver(_,{threshold:.5});return g.current&&w.observe(g.current),()=>{w.disconnect()}}},[t]),T.useEffect(()=>{if(r){let _=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(_)}}},[r]);let v=()=>{i(!0)},b=()=>{i(!1),o(!1)};return n?t!=="intent"?[s,g,{}]:[s,g,{onFocus:Ub(a,v),onBlur:Ub(l,b),onMouseEnter:Ub(c,v),onMouseLeave:Ub(d,b),onTouchStart:Ub(h,v)}]:[!1,g,{}]}function Ub(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function xJ({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(bJ,{page:t,matches:r,...e}):null}function yJ(t){let{manifest:e,routeModules:n}=ZF(),[r,i]=T.useState([]);return T.useEffect(()=>{let s=!1;return dJ(t,e,n).then(o=>{s||i(o)}),()=>{s=!0}},[t,e,n]),r}function bJ({page:t,matches:e,...n}){let r=uh(),{future:i,manifest:s,routeModules:o}=ZF(),{basename:a}=KF(),{loaderData:l,matches:c}=gJ(),d=T.useMemo(()=>$P(t,e,c,s,r,"data"),[t,e,c,s,r]),h=T.useMemo(()=>$P(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(I=>I.route.id===E.route.id)&&E.route.id in l&&((N=o[E.route.id])!=null&&N.shouldRevalidate)||A.hasClientLoader?w=!0:_.add(E.route.id))}),_.size===0)return[];let S=lJ(t,a,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]},[a,i.unstable_trailingSlashAwareDataRequests,l,r,s,d,e,t,o]),v=T.useMemo(()=>fJ(h,s),[h,s]),b=yJ(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 _J(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var SJ=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{SJ&&(window.__reactRouterVersion="7.13.1")}catch{}function wJ({basename:t,children:e,unstable_useTransitions:n,window:r}){let i=T.useRef();i.current==null&&(i.current=nQ({window:r,v5Compat:!0}));let s=i.current,[o,a]=T.useState({action:s.action,location:s.location}),l=T.useCallback(c=>{n===!1?a(c):T.startTransition(()=>a(c))},[n]);return T.useLayoutEffect(()=>s.listen(l),[s,l]),T.createElement(ZQ,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:s,unstable_useTransitions:n})}var QF=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,YM=T.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:s,replace:o,unstable_mask:a,state:l,target:c,to:d,preventScrollReset:h,viewTransition:g,unstable_defaultShouldRevalidate:v,...b},_){let{basename:w,navigator:S,unstable_useTransitions:E}=T.useContext(Qu),A=typeof d=="string"&&QF.test(d),N=BF(d,w);d=N.to;let I=LQ(d,{relative:i}),P=uh(),L=null;if(a){let G=y7(a,[],P.unstable_mask?P.unstable_mask.pathname:"/",!0);w!=="/"&&(G.pathname=G.pathname==="/"?w:Jf([w,G.pathname])),L=S.createHref(G)}let[R,O,F]=vJ(r,b),U=CJ(d,{replace:o,unstable_mask:a,state:l,target:c,preventScrollReset:h,relative:i,viewTransition:g,unstable_defaultShouldRevalidate:v,unstable_useTransitions:E});function q(G){e&&e(G),G.defaultPrevented||U(G)}let B=!(N.isExternal||s),Z=T.createElement("a",{...b,...F,href:(B?L:void 0)||N.absoluteURL||I,onClick:B?q:e,ref:_J(_,O),target:c,"data-discover":!A&&n==="render"?"true":void 0});return R&&!A?T.createElement(T.Fragment,null,Z,T.createElement(xJ,{page:I})):Z});YM.displayName="Link";var MJ=T.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},d){let h=qS(o,{relative:c.relative}),g=uh(),v=T.useContext(P5),{navigator:b,basename:_}=T.useContext(Qu),w=v!=null&&PJ(h)&&a===!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=dp(A,_)||A);const N=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let I=E===S||!i&&E.startsWith(S)&&E.charAt(N)==="/",P=A!=null&&(A===S||!i&&A.startsWith(S)&&A.charAt(S.length)==="/"),L={isActive:I,isPending:P,isTransitioning:w},R=I?e:void 0,O;typeof r=="function"?O=r(L):O=[r,I?"active":null,P?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let F=typeof s=="function"?s(L):s;return T.createElement(YM,{...c,"aria-current":R,className:O,ref:d,style:F,to:o,viewTransition:a},typeof l=="function"?l(L):l)});MJ.displayName="NavLink";var TJ=T.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:o=kM,action:a,onSubmit:l,relative:c,preventScrollReset:d,viewTransition:h,unstable_defaultShouldRevalidate:g,...v},b)=>{let{unstable_useTransitions:_}=T.useContext(Qu),w=RJ(),S=kJ(a,{relative:c}),E=o.toLowerCase()==="get"?"get":"post",A=typeof a=="string"&&QF.test(a),N=I=>{if(l&&l(I),I.defaultPrevented)return;I.preventDefault();let P=I.nativeEvent.submitter,L=(P==null?void 0:P.getAttribute("formmethod"))||o,R=()=>w(P||I.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})});TJ.displayName="Form";function EJ(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(fy);return no(e,EJ(t)),e}function CJ(t,{target:e,replace:n,unstable_mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:l,unstable_useTransitions:c}={}){let d=D5(),h=uh(),g=qS(t,{relative:o});return T.useCallback(v=>{if(rJ(v,e)){v.preventDefault();let b=n!==void 0?n:X_(h)===X_(g),_=()=>d(t,{replace:b,unstable_mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:l});c?T.startTransition(()=>_()):_()}},[h,d,g,n,r,i,e,t,s,o,a,l,c])}function T7(t){Gd(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=uh(),i=T.useMemo(()=>iJ(r.search,n.current?null:e.current),[r.search]),s=D5(),o=T.useCallback((a,l)=>{const c=K6(typeof a=="function"?a(new URLSearchParams(i)):a);n.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var AJ=0,NJ=()=>`__${String(++AJ)}__`;function RJ(){let{router:t}=JF("useSubmit"),{basename:e}=T.useContext(Qu),n=qQ(),r=t.fetch,i=t.navigate;return T.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:d,body:h}=aJ(s,e);if(o.navigate===!1){let g=o.fetcherKey||NJ();await r(g,n,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:h,formMethod:o.method||l,formEncType:o.encType||c,flushSync:o.flushSync})}else await i(o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:d,body:h,formMethod:o.method||l,formEncType:o.encType||c,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,i,e,n])}function kJ(t,{relative:e}={}){let{basename:n}=T.useContext(Qu),r=T.useContext(vp);no(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...qS(t||".",{relative:e})},o=uh();if(t==null){s.search=o.search;let a=new URLSearchParams(s.search),l=a.getAll("index");if(l.some(d=>d==="")){a.delete("index"),l.filter(h=>h).forEach(h=>a.append("index",h));let d=a.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:Jf([n,s.pathname])),X_(s)}function PJ(t,{relative:e}={}){let n=T.useContext(VF);no(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=qS(t,{relative:e});if(!n.isTransitioning)return!1;let s=dp(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=dp(n.nextLocation.pathname,r)||n.nextLocation.pathname;return XM(i.pathname,o)!=null||XM(i.pathname,s)!=null}var zd=IF();const DJ=uy(zd);var hy=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(){}},IJ={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},N0,x7,_F,OJ=(_F=class{constructor(){On(this,N0,IJ);On(this,x7,!1)}setTimeoutProvider(t){dn(this,N0,t)}setTimeout(t,e){return at(this,N0).setTimeout(t,e)}clearTimeout(t){at(this,N0).clearTimeout(t)}setInterval(t,e){return at(this,N0).setInterval(t,e)}clearInterval(t){at(this,N0).clearInterval(t)}},N0=new WeakMap,x7=new WeakMap,_F),Ag=new OJ;function LJ(t){setTimeout(t,0)}var Kg=typeof window>"u"||"Deno"in globalThis;function Ll(){}function zJ(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 H0(t,e){return typeof t=="function"?t(e):t}function ju(t,e){return typeof t=="function"?t(e):t}function qP(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==E7(o,e.options))return!1}else if(!K_(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function XP(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(Y_(e.options.mutationKey)!==Y_(s))return!1}else if(!K_(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)||Y_)(t)}function Y_(t){return JSON.stringify(t,(e,n)=>Q6(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function K_(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>K_(t[n],e[n])):!1}var jJ=Object.prototype.hasOwnProperty;function C7(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=YP(t)&&YP(e);if(!r&&!(Q6(t)&&Q6(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let c=0;for(let d=0;d<a;d++){const h=r?d:o[d],g=t[h],v=e[h];if(g===v){l[h]=g,(r?d<s:jJ.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===a&&c===s?t:l}function KM(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 YP(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function Q6(t){if(!KP(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!KP(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function KP(t){return Object.prototype.toString.call(t)==="[object Object]"}function FJ(t){return new Promise(e=>{Ag.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 UJ(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function BJ(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 HJ(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 Ig,R0,w1,SF,VJ=(SF=class extends hy{constructor(){super();On(this,Ig);On(this,R0);On(this,w1);dn(this,w1,e=>{if(!Kg&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){at(this,R0)||this.setEventListener(at(this,w1))}onUnsubscribe(){var e;this.hasListeners()||((e=at(this,R0))==null||e.call(this),dn(this,R0,void 0))}setEventListener(e){var n;dn(this,w1,e),(n=at(this,R0))==null||n.call(this),dn(this,R0,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){at(this,Ig)!==e&&(dn(this,Ig,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof at(this,Ig)=="boolean"?at(this,Ig):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ig=new WeakMap,R0=new WeakMap,w1=new WeakMap,SF),N7=new VJ;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 GJ=LJ;function WJ(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=GJ;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Vo=WJ(),M1,k0,T1,wF,$J=(wF=class extends hy{constructor(){super();On(this,M1,!0);On(this,k0);On(this,T1);dn(this,T1,e=>{if(!Kg&&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(){at(this,k0)||this.setEventListener(at(this,T1))}onUnsubscribe(){var e;this.hasListeners()||((e=at(this,k0))==null||e.call(this),dn(this,k0,void 0))}setEventListener(e){var n;dn(this,T1,e),(n=at(this,k0))==null||n.call(this),dn(this,k0,e(this.setOnline.bind(this)))}setOnline(e){at(this,M1)!==e&&(dn(this,M1,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return at(this,M1)}},M1=new WeakMap,k0=new WeakMap,T1=new WeakMap,wF),ZM=new $J;function qJ(t){return Math.min(1e3*2**t,3e4)}function rU(t){return(t??"online")==="online"?ZM.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",o=_=>{var w;if(!s()){const S=new tN(_);g(S),(w=t.onCancel)==null||w.call(t,S)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>N7.isFocused()&&(t.networkMode==="always"||ZM.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??(Kg?0:3),A=t.retryDelay??qJ,N=typeof A=="function"?A(n,S):A,I=E===!0||typeof E=="number"&&n<E||typeof E=="function"&&E(n,S);if(e||!I){g(S);return}n++,(P=t.onFail)==null||P.call(t,n,S),FJ(N).then(()=>c()?void 0:v()).then(()=>{e?g(S):b()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?b():v().then(b),i)}}var Og,MF,sU=(MF=class{constructor(){On(this,Og)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Z6(this.gcTime)&&dn(this,Og,Ag.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Kg?1/0:300*1e3))}clearGcTimeout(){at(this,Og)&&(Ag.clearTimeout(at(this,Og)),dn(this,Og,void 0))}},Og=new WeakMap,MF),Lg,E1,Lu,zg,xa,OS,jg,Pd,Zh,TF,XJ=(TF=class extends sU{constructor(e){super();On(this,Pd);On(this,Lg);On(this,E1);On(this,Lu);On(this,zg);On(this,xa);On(this,OS);On(this,jg);dn(this,jg,!1),dn(this,OS,e.defaultOptions),this.setOptions(e.options),this.observers=[],dn(this,zg,e.client),dn(this,Lu,at(this,zg).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,dn(this,Lg,QP(this.options)),this.state=e.state??at(this,Lg),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=at(this,xa))==null?void 0:e.promise}setOptions(e){if(this.options={...at(this,OS),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=QP(this.options);n.data!==void 0&&(this.setState(ZP(n.data,n.dataUpdatedAt)),dn(this,Lg,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&at(this,Lu).remove(this)}setData(e,n){const r=J6(this.state.data,e,this.options);return pr(this,Pd,Zh).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){pr(this,Pd,Zh).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=at(this,xa))==null?void 0:r.promise;return(i=at(this,xa))==null||i.cancel(e),n?n.then(Ll).catch(Ll):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(at(this,Lg))}isActive(){return this.observers.some(e=>ju(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=>H0(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=at(this,xa))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=at(this,xa))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),at(this,Lu).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(at(this,xa)&&(at(this,jg)?at(this,xa).cancel({revert:!0}):at(this,xa).cancelRetry()),this.scheduleGc()),at(this,Lu).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pr(this,Pd,Zh).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=at(this,xa))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(at(this,xa))return at(this,xa).continueRetry(),at(this,xa).promise}if(e&&this.setOptions(e),!this.options.queryFn){const N=this.observers.find(I=>I.options.queryFn);N&&this.setOptions(N.options)}const r=new AbortController,i=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(dn(this,jg,!0),r.signal)})},s=()=>{const N=tU(this.options,n),P=(()=>{const L={client:at(this,zg),queryKey:this.queryKey,meta:this.meta};return i(L),L})();return dn(this,jg,!1),this.options.persister?this.options.persister(N,P,this):N(P)},a=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:at(this,zg),state:this.state,fetchFn:s};return i(N),N})();(c=this.options.behavior)==null||c.onFetch(a,this),dn(this,E1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&pr(this,Pd,Zh).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta}),dn(this,xa,iU({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:N=>{N instanceof tN&&N.revert&&this.setState({...at(this,E1),fetchStatus:"idle"}),r.abort()},onFail:(N,I)=>{pr(this,Pd,Zh).call(this,{type:"failed",failureCount:N,error:I})},onPause:()=>{pr(this,Pd,Zh).call(this,{type:"pause"})},onContinue:()=>{pr(this,Pd,Zh).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const N=await at(this,xa).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(v=(g=at(this,Lu).config).onSuccess)==null||v.call(g,N,this),(_=(b=at(this,Lu).config).onSettled)==null||_.call(b,N,this.state.error,this),N}catch(N){if(N instanceof tN){if(N.silent)return at(this,xa).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw pr(this,Pd,Zh).call(this,{type:"error",error:N}),(S=(w=at(this,Lu).config).onError)==null||S.call(w,N,this),(A=(E=at(this,Lu).config).onSettled)==null||A.call(E,this.state.data,N,this),N}finally{this.scheduleGc()}}},Lg=new WeakMap,E1=new WeakMap,Lu=new WeakMap,zg=new WeakMap,xa=new WeakMap,OS=new WeakMap,jg=new WeakMap,Pd=new WeakSet,Zh=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,...oU(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...ZP(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return dn(this,E1,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),Vo.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),at(this,Lu).notify({query:this,type:"updated",action:e})})},TF);function oU(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:rU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function ZP(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function QP(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,ci,LS,Ol,Fg,C1,tp,P0,zS,A1,N1,Ug,Bg,D0,R1,Bi,d_,nN,rN,iN,sN,oN,aN,lN,aU,EF,R7=(EF=class extends hy{constructor(e,n){super();On(this,Bi);On(this,bc);On(this,ci);On(this,LS);On(this,Ol);On(this,Fg);On(this,C1);On(this,tp);On(this,P0);On(this,zS);On(this,A1);On(this,N1);On(this,Ug);On(this,Bg);On(this,D0);On(this,R1,new Set);this.options=n,dn(this,bc,e),dn(this,P0,null),dn(this,tp,eN()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(at(this,ci).addObserver(this),JP(at(this,ci),this.options)?pr(this,Bi,d_).call(this):this.updateResult(),pr(this,Bi,sN).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return cN(at(this,ci),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return cN(at(this,ci),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pr(this,Bi,oN).call(this),pr(this,Bi,aN).call(this),at(this,ci).removeObserver(this)}setOptions(e){const n=this.options,r=at(this,ci);if(this.options=at(this,bc).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ju(this.options.enabled,at(this,ci))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pr(this,Bi,lN).call(this),at(this,ci).setOptions(this.options),n._defaulted&&!KM(this.options,n)&&at(this,bc).getQueryCache().notify({type:"observerOptionsUpdated",query:at(this,ci),observer:this});const i=this.hasListeners();i&&eD(at(this,ci),r,this.options,n)&&pr(this,Bi,d_).call(this),this.updateResult(),i&&(at(this,ci)!==r||ju(this.options.enabled,at(this,ci))!==ju(n.enabled,at(this,ci))||H0(this.options.staleTime,at(this,ci))!==H0(n.staleTime,at(this,ci)))&&pr(this,Bi,nN).call(this);const s=pr(this,Bi,rN).call(this);i&&(at(this,ci)!==r||ju(this.options.enabled,at(this,ci))!==ju(n.enabled,at(this,ci))||s!==at(this,D0))&&pr(this,Bi,iN).call(this,s)}getOptimisticResult(e){const n=at(this,bc).getQueryCache().build(at(this,bc),e),r=this.createResult(n,e);return KJ(this,r)&&(dn(this,Ol,r),dn(this,C1,this.options),dn(this,Fg,at(this,ci).state)),r}getCurrentResult(){return at(this,Ol)}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&&at(this,tp).status==="pending"&&at(this,tp).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){at(this,R1).add(e)}getCurrentQuery(){return at(this,ci)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=at(this,bc).defaultQueryOptions(e),r=at(this,bc).getQueryCache().build(at(this,bc),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return pr(this,Bi,d_).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),at(this,Ol)))}createResult(e,n){var O;const r=at(this,ci),i=this.options,s=at(this,Ol),o=at(this,Fg),a=at(this,C1),c=e!==r?e.state:at(this,LS),{state:d}=e;let h={...d},g=!1,v;if(n._optimisticResults){const F=this.hasListeners(),U=!F&&JP(e,n),q=F&&eD(e,r,n,i);(U||q)&&(h={...h,...oU(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 F;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(F=s.data,S=!0):F=typeof n.placeholderData=="function"?n.placeholderData((O=at(this,N1))==null?void 0:O.state.data,at(this,N1)):n.placeholderData,F!==void 0&&(w="success",v=J6(s==null?void 0:s.data,F,n),g=!0)}if(n.select&&v!==void 0&&!S)if(s&&v===(o==null?void 0:o.data)&&n.select===at(this,zS))v=at(this,A1);else try{dn(this,zS,n.select),v=n.select(v),v=J6(s==null?void 0:s.data,v,n),dn(this,A1,v),dn(this,P0,null)}catch(F){dn(this,P0,F)}at(this,P0)&&(b=at(this,P0),v=at(this,A1),_=Date.now(),w="error");const E=h.fetchStatus==="fetching",A=w==="pending",N=w==="error",I=A&&E,P=v!==void 0,R={status:w,fetchStatus:h.fetchStatus,isPending:A,isSuccess:w==="success",isError:N,isInitialLoading:I,isLoading:I,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:at(this,tp),isEnabled:ju(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const F=R.data!==void 0,U=R.status==="error"&&!F,q=G=>{U?G.reject(R.error):F&&G.resolve(R.data)},B=()=>{const G=dn(this,tp,R.promise=eN());q(G)},Z=at(this,tp);switch(Z.status){case"pending":e.queryHash===r.queryHash&&q(Z);break;case"fulfilled":(U||R.data!==Z.value)&&B();break;case"rejected":(!U||R.error!==Z.reason)&&B();break}}return R}updateResult(){const e=at(this,Ol),n=this.createResult(at(this,ci),this.options);if(dn(this,Fg,at(this,ci).state),dn(this,C1,this.options),at(this,Fg).data!==void 0&&dn(this,N1,at(this,ci)),KM(n,e))return;dn(this,Ol,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!at(this,R1).size)return!0;const o=new Set(s??at(this,R1));return this.options.throwOnError&&o.add("error"),Object.keys(at(this,Ol)).some(a=>{const l=a;return at(this,Ol)[l]!==e[l]&&o.has(l)})};pr(this,Bi,aU).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pr(this,Bi,sN).call(this)}},bc=new WeakMap,ci=new WeakMap,LS=new WeakMap,Ol=new WeakMap,Fg=new WeakMap,C1=new WeakMap,tp=new WeakMap,P0=new WeakMap,zS=new WeakMap,A1=new WeakMap,N1=new WeakMap,Ug=new WeakMap,Bg=new WeakMap,D0=new WeakMap,R1=new WeakMap,Bi=new WeakSet,d_=function(e){pr(this,Bi,lN).call(this);let n=at(this,ci).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Ll)),n},nN=function(){pr(this,Bi,oN).call(this);const e=H0(this.options.staleTime,at(this,ci));if(Kg||at(this,Ol).isStale||!Z6(e))return;const r=eU(at(this,Ol).dataUpdatedAt,e)+1;dn(this,Ug,Ag.setTimeout(()=>{at(this,Ol).isStale||this.updateResult()},r))},rN=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(at(this,ci)):this.options.refetchInterval)??!1},iN=function(e){pr(this,Bi,aN).call(this),dn(this,D0,e),!(Kg||ju(this.options.enabled,at(this,ci))===!1||!Z6(at(this,D0))||at(this,D0)===0)&&dn(this,Bg,Ag.setInterval(()=>{(this.options.refetchIntervalInBackground||N7.isFocused())&&pr(this,Bi,d_).call(this)},at(this,D0)))},sN=function(){pr(this,Bi,nN).call(this),pr(this,Bi,iN).call(this,pr(this,Bi,rN).call(this))},oN=function(){at(this,Ug)&&(Ag.clearTimeout(at(this,Ug)),dn(this,Ug,void 0))},aN=function(){at(this,Bg)&&(Ag.clearInterval(at(this,Bg)),dn(this,Bg,void 0))},lN=function(){const e=at(this,bc).getQueryCache().build(at(this,bc),this.options);if(e===at(this,ci))return;const n=at(this,ci);dn(this,ci,e),dn(this,LS,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},aU=function(e){Vo.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(at(this,Ol))}),at(this,bc).getQueryCache().notify({query:at(this,ci),type:"observerResultsUpdated"})})},EF);function YJ(t,e){return ju(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function JP(t,e){return YJ(t,e)||t.state.data!==void 0&&cN(t,e,e.refetchOnMount)}function cN(t,e,n){if(ju(e.enabled,t)!==!1&&H0(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&k7(t,e)}return!1}function eD(t,e,n,r){return(t!==e||ju(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&k7(t,n)}function k7(t,e){return ju(e.enabled,t)!==!1&&t.isStaleByTime(H0(e.staleTime,t))}function KJ(t,e){return!KM(t.getCurrentResult(),e)}function tD(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)||[],o=((b=e.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let _=!1;const w=A=>{HJ(A,()=>e.signal,()=>_=!0)},S=tU(e.options,e.fetchOptions),E=async(A,N,I)=>{if(_)return Promise.reject();if(N==null&&A.pages.length)return Promise.resolve(A);const L=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:N,direction:I?"backward":"forward",meta:e.options.meta};return w(U),U})(),R=await S(L),{maxPages:O}=e.options,F=I?BJ:UJ;return{pages:F(A.pages,R,O),pageParams:F(A.pageParams,N,O)}};if(i&&s.length){const A=i==="backward",N=A?ZJ:nD,I={pages:s,pageParams:o},P=N(r,I);a=await E(I,P,A)}else{const A=t??s.length;do{const N=l===0?o[0]??r.initialPageParam:nD(r,a);if(l>0&&N==null)break;a=await E(a,N),l++}while(l<A)}return a};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 nD(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 ZJ(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 jS,zf,ol,Hg,jf,S0,CF,QJ=(CF=class extends sU{constructor(e){super();On(this,jf);On(this,jS);On(this,zf);On(this,ol);On(this,Hg);dn(this,jS,e.client),this.mutationId=e.mutationId,dn(this,ol,e.mutationCache),dn(this,zf,[]),this.state=e.state||JJ(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){at(this,zf).includes(e)||(at(this,zf).push(e),this.clearGcTimeout(),at(this,ol).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){dn(this,zf,at(this,zf).filter(n=>n!==e)),this.scheduleGc(),at(this,ol).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){at(this,zf).length||(this.state.status==="pending"?this.scheduleGc():at(this,ol).remove(this))}continue(){var e;return((e=at(this,Hg))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,d,h,g,v,b,_,w,S,E,A,N,I,P,L;const n=()=>{pr(this,jf,S0).call(this,{type:"continue"})},r={client:at(this,jS),meta:this.options.meta,mutationKey:this.options.mutationKey};dn(this,Hg,iU({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,O)=>{pr(this,jf,S0).call(this,{type:"failed",failureCount:R,error:O})},onPause:()=>{pr(this,jf,S0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>at(this,ol).canRun(this)}));const i=this.state.status==="pending",s=!at(this,Hg).canStart();try{if(i)n();else{pr(this,jf,S0).call(this,{type:"pending",variables:e,isPaused:s}),at(this,ol).config.onMutate&&await at(this,ol).config.onMutate(e,this,r);const O=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));O!==this.state.context&&pr(this,jf,S0).call(this,{type:"pending",context:O,variables:e,isPaused:s})}const R=await at(this,Hg).start();return await((c=(l=at(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=at(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)),pr(this,jf,S0).call(this,{type:"success",data:R}),R}catch(R){try{await((S=(w=at(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((I=(N=at(this,ol).config).onSettled)==null?void 0:I.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 pr(this,jf,S0).call(this,{type:"error",error:R}),R}finally{at(this,ol).runNext(this)}}},jS=new WeakMap,zf=new WeakMap,ol=new WeakMap,Hg=new WeakMap,jf=new WeakSet,S0=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),Vo.batch(()=>{at(this,zf).forEach(r=>{r.onMutationUpdate(e)}),at(this,ol).notify({mutation:this,type:"updated",action:e})})},CF);function JJ(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var np,Dd,FS,AF,eee=(AF=class extends hy{constructor(e={}){super();On(this,np);On(this,Dd);On(this,FS);this.config=e,dn(this,np,new Set),dn(this,Dd,new Map),dn(this,FS,0)}build(e,n,r){const i=new QJ({client:e,mutationCache:this,mutationId:++V3(this,FS)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){at(this,np).add(e);const n=W3(e);if(typeof n=="string"){const r=at(this,Dd).get(n);r?r.push(e):at(this,Dd).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(at(this,np).delete(e)){const n=W3(e);if(typeof n=="string"){const r=at(this,Dd).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&at(this,Dd).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=W3(e);if(typeof n=="string"){const r=at(this,Dd).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=W3(e);if(typeof n=="string"){const i=(r=at(this,Dd).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(){Vo.batch(()=>{at(this,np).forEach(e=>{this.notify({type:"removed",mutation:e})}),at(this,np).clear(),at(this,Dd).clear()})}getAll(){return Array.from(at(this,np))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>XP(n,r))}findAll(e={}){return this.getAll().filter(n=>XP(e,n))}notify(e){Vo.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Vo.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ll))))}},np=new WeakMap,Dd=new WeakMap,FS=new WeakMap,AF);function W3(t){var e;return(e=t.options.scope)==null?void 0:e.id}function rD(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function tee(t,e,n){const r=t.slice(0);return r[e]=n,r}var k1,$c,P1,D1,zu,I0,US,BS,HS,VS,Ba,uN,dN,fN,hN,pN,NF,nee=(NF=class extends hy{constructor(e,n,r){super();On(this,Ba);On(this,k1);On(this,$c);On(this,P1);On(this,D1);On(this,zu);On(this,I0);On(this,US);On(this,BS);On(this,HS);On(this,VS,[]);dn(this,k1,e),dn(this,D1,r),dn(this,P1,[]),dn(this,zu,[]),dn(this,$c,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&at(this,zu).forEach(e=>{e.subscribe(n=>{pr(this,Ba,hN).call(this,e,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,at(this,zu).forEach(e=>{e.destroy()})}setQueries(e,n){dn(this,P1,e),dn(this,D1,n),Vo.batch(()=>{const r=at(this,zu),i=pr(this,Ba,fN).call(this,at(this,P1));i.forEach(h=>h.observer.setOptions(h.defaultedQueryOptions));const s=i.map(h=>h.observer),o=s.map(h=>h.getCurrentResult()),a=r.length!==s.length,l=s.some((h,g)=>h!==r[g]),c=a||l,d=c?!0:o.some((h,g)=>{const v=at(this,$c)[g];return!v||!KM(h,v)});!c&&!d||(c&&(dn(this,VS,i),dn(this,zu,s)),dn(this,$c,o),this.hasListeners()&&(c&&(rD(r,s).forEach(h=>{h.destroy()}),rD(s,r).forEach(h=>{h.subscribe(g=>{pr(this,Ba,hN).call(this,h,g)})})),pr(this,Ba,pN).call(this)))})}getCurrentResult(){return at(this,$c)}getQueries(){return at(this,zu).map(e=>e.getCurrentQuery())}getObservers(){return at(this,zu)}getOptimisticResult(e,n){const r=pr(this,Ba,fN).call(this,e),i=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),s=r.map(o=>o.defaultedQueryOptions.queryHash);return[i,o=>pr(this,Ba,dN).call(this,o??i,n,s),()=>pr(this,Ba,uN).call(this,i,r)]}},k1=new WeakMap,$c=new WeakMap,P1=new WeakMap,D1=new WeakMap,zu=new WeakMap,I0=new WeakMap,US=new WeakMap,BS=new WeakMap,HS=new WeakMap,VS=new WeakMap,Ba=new WeakSet,uN=function(e,n){return n.map((r,i)=>{const s=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?s:r.observer.trackResult(s,o=>{n.forEach(a=>{a.observer.trackProp(o)})})})},dN=function(e,n,r){if(n){const i=at(this,HS),s=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((o,a)=>o!==i[a]));return(!at(this,I0)||at(this,$c)!==at(this,BS)||s||n!==at(this,US))&&(dn(this,US,n),dn(this,BS,at(this,$c)),r!==void 0&&dn(this,HS,r),dn(this,I0,C7(at(this,I0),n(e)))),at(this,I0)}return e},fN=function(e){const n=new Map;at(this,zu).forEach(i=>{const s=i.options.queryHash;if(!s)return;const o=n.get(s);o?o.push(i):n.set(s,[i])});const r=[];return e.forEach(i=>{var l;const s=at(this,k1).defaultQueryOptions(i),a=((l=n.get(s.queryHash))==null?void 0:l.shift())??new R7(at(this,k1),s);r.push({defaultedQueryOptions:s,observer:a})}),r},hN=function(e,n){const r=at(this,zu).indexOf(e);r!==-1&&(dn(this,$c,tee(at(this,$c),r,n)),pr(this,Ba,pN).call(this))},pN=function(){var e;if(this.hasListeners()){const n=at(this,I0),r=pr(this,Ba,uN).call(this,at(this,$c),at(this,VS)),i=pr(this,Ba,dN).call(this,r,(e=at(this,D1))==null?void 0:e.combine);n!==i&&Vo.batch(()=>{this.listeners.forEach(s=>{s(at(this,$c))})})}},NF),Ff,RF,ree=(RF=class extends hy{constructor(e={}){super();On(this,Ff);this.config=e,dn(this,Ff,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??E7(i,n);let o=this.get(s);return o||(o=new XJ({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){at(this,Ff).has(e.queryHash)||(at(this,Ff).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=at(this,Ff).get(e.queryHash);n&&(e.destroy(),n===e&&at(this,Ff).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Vo.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return at(this,Ff).get(e)}getAll(){return[...at(this,Ff).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>qP(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>qP(e,r)):n}notify(e){Vo.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Vo.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Vo.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ff=new WeakMap,RF),po,O0,L0,I1,O1,z0,L1,z1,kF,iee=(kF=class{constructor(t={}){On(this,po);On(this,O0);On(this,L0);On(this,I1);On(this,O1);On(this,z0);On(this,L1);On(this,z1);dn(this,po,t.queryCache||new ree),dn(this,O0,t.mutationCache||new eee),dn(this,L0,t.defaultOptions||{}),dn(this,I1,new Map),dn(this,O1,new Map),dn(this,z0,0)}mount(){V3(this,z0)._++,at(this,z0)===1&&(dn(this,L1,N7.subscribe(async t=>{t&&(await this.resumePausedMutations(),at(this,po).onFocus())})),dn(this,z1,ZM.subscribe(async t=>{t&&(await this.resumePausedMutations(),at(this,po).onOnline())})))}unmount(){var t,e;V3(this,z0)._--,at(this,z0)===0&&((t=at(this,L1))==null||t.call(this),dn(this,L1,void 0),(e=at(this,z1))==null||e.call(this),dn(this,z1,void 0))}isFetching(t){return at(this,po).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return at(this,O0).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=at(this,po).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=at(this,po).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(H0(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return at(this,po).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=at(this,po).get(r.queryHash),s=i==null?void 0:i.state.data,o=zJ(e,s);if(o!==void 0)return at(this,po).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Vo.batch(()=>at(this,po).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=at(this,po).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=at(this,po);Vo.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=at(this,po);return Vo.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Vo.batch(()=>at(this,po).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Ll).catch(Ll)}invalidateQueries(t,e={}){return Vo.batch(()=>(at(this,po).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=Vo.batch(()=>at(this,po).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ll)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ll)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=at(this,po).build(this,e);return n.isStaleByTime(H0(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ll).catch(Ll)}fetchInfiniteQuery(t){return t.behavior=tD(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ll).catch(Ll)}ensureInfiniteQueryData(t){return t.behavior=tD(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return ZM.isOnline()?at(this,O0).resumePausedMutations():Promise.resolve()}getQueryCache(){return at(this,po)}getMutationCache(){return at(this,O0)}getDefaultOptions(){return at(this,L0)}setDefaultOptions(t){dn(this,L0,t)}setQueryDefaults(t,e){at(this,I1).set(Y_(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...at(this,I1).values()],n={};return e.forEach(r=>{K_(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){at(this,O1).set(Y_(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...at(this,O1).values()],n={};return e.forEach(r=>{K_(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...at(this,L0).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:{...at(this,L0).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){at(this,po).clear(),at(this,O0).clear()}},po=new WeakMap,O0=new WeakMap,L0=new WeakMap,I1=new WeakMap,O1=new WeakMap,z0=new WeakMap,L1=new WeakMap,z1=new WeakMap,kF),lU=T.createContext(void 0),py=t=>{const e=T.useContext(lU);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},see=({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 oee(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var aee=T.createContext(oee()),dU=()=>T.useContext(aee),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))}},lee=(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 cee({queries:t,...e},n){const r=py(),i=uU(),s=dU(),o=T.useMemo(()=>t.map(_=>{const w=r.defaultQueryOptions(_);return w._optimisticResults=i?"isRestoring":"optimistic",w}),[t,r,i]);o.forEach(_=>{mU(_);const w=r.getQueryCache().get(_.queryHash);fU(_,s,w)}),hU(s);const[a]=T.useState(()=>new nee(r,o,e)),[l,c,d]=a.getOptimisticResult(o,e.combine),h=!i&&e.subscribed!==!1;T.useSyncExternalStore(T.useCallback(_=>h?a.subscribe(Vo.batchCalls(_)):Ll,[a,h]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),T.useEffect(()=>{a.setQueries(o,e)},[o,e,a]);const v=l.some((_,w)=>mN(o[w],_))?l.flatMap((_,w)=>{const S=o[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=o[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 uee(t,e,n){var g,v,b,_;const r=uU(),i=dU(),s=py(),o=s.defaultQueryOptions(t);(v=(g=s.getDefaultOptions().queries)==null?void 0:g._experimental_beforeQuery)==null||v.call(g,o);const a=s.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",mU(o),fU(o,i,a),hU(i);const l=!s.getQueryCache().get(o.queryHash),[c]=T.useState(()=>new e(s,o)),d=c.getOptimisticResult(o),h=!r&&t.subscribed!==!1;if(T.useSyncExternalStore(T.useCallback(w=>{const S=h?c.subscribe(Vo.batchCalls(w)):Ll;return c.updateResult(),S},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),T.useEffect(()=>{c.setOptions(o)},[o,c]),mN(o,d))throw gN(o,c,i);if(pU({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw d.error;if((_=(b=s.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||_.call(b,o,d),o.experimental_prefetchInRender&&!Kg&&lee(d,r)){const w=l?gN(o,c,i):a==null?void 0:a.promise;w==null||w.catch(Ll).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?d:c.trackResult(d)}function ps(t,e){return uee(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 iD(t){return"v"in t||"e"in t}function QM(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 JM(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 dee=(t,e,...n)=>e.read(...n),fee=(t,e,...n)=>e.write(...n),hee=(t,e)=>{var n;return(n=e.INTERNAL_onInit)==null?void 0:n.call(e,t)},pee=(t,e,n)=>{var r;return(r=e.onMount)==null?void 0:r.call(e,n)},mee=(t,e)=>{var n;const r=sa(t),i=r[0],s=r[6],o=r[9];if((Bf?"production":void 0)!=="production"&&!e)throw new Error("Atom is undefined or null");let a=i.get(e);return a||(a={d:new Map,p:new Set,n:0},i.set(e,a),(n=s.i)==null||n.call(s,e),o==null||o(t,e)),a},gee=t=>{const e=sa(t),n=e[1],r=e[3],i=e[4],s=e[5],o=e[6],a=e[13],l=[],c=d=>{try{d()}catch(h){l.push(h)}};do{o.f&&c(o.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&&a(t)}while(r.size||s.size||i.size);if(l.length)throw new AggregateError(l)},vee=t=>{const e=sa(t),n=e[1],r=e[2],i=e[3],s=e[11],o=e[14],a=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}_&&(o(t,v),a(t,v)),r.delete(v)}},xN=new WeakSet,xee=(t,e)=>{var n,r;const i=sa(t),s=i[1],o=i[2],a=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(iD(E)){if(s.has(e)&&o.get(e)!==E.n)return E;let B=!1;for(const[Z,G]of E.d)if(v(t,Z).n!==G){B=!0;break}if(!B)return E}let A=!0;const N=new Set(E.d.keys()),I=new Map,P=()=>{for(const B of N)I.has(B)||E.d.delete(B)},L=()=>{if(s.has(e)){const B=!a.size;_(t,e),B&&(g(t),h(t))}},R=B=>{var Z;if(B===e){const $=d(t,B);if(!iD($))if(gU(B))w(t,B,B.init);else throw new Error("no atom init");return QM($)}const G=v(t,B);try{return QM(G)}finally{I.set(B,G.n),E.d.set(B,G.n),JM(E.v)&&vU(e,E.v,G),s.has(e)&&((Z=s.get(B))==null||Z.t.add(e)),A||L()}};let O,F;const U={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"),!F&&vN(e)&&(F=(...B)=>{if((Bf?"production":void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)try{return b(t,e,...B)}finally{g(t),h(t)}}),F}},q=E.n;try{(Bf?"production":void 0)!=="production"&&xN.delete(t);const B=c(t,e,R,U);if((Bf?"production":void 0)!=="production"&&xN.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),w(t,e,B),JM(B)){S(t,B,()=>O==null?void 0:O.abort());const Z=()=>{P(),L()};B.then(Z,Z)}else P();return(n=l.r)==null||n.call(l,e),E}catch(B){return delete E.v,E.e=B,++E.n,E}finally{A=!1,q!==E.n&&o.get(e)===q&&(o.set(e,E.n),a.add(e),(r=l.c)==null||r.call(l,e))}},yee=(t,e)=>{const n=sa(t),r=n[1],i=n[2],s=n[11],o=[e];for(;o.length;){const a=o.pop(),l=s(t,a);for(const c of xU(a,l,r)){const d=s(t,c);i.get(c)!==d.n&&(i.set(c,d.n),o.push(c))}}},bee=(t,e,...n)=>{const r=sa(t),i=r[3],s=r[6],o=r[8],a=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=>QM(d(t,E)),S=(E,...A)=>{var N;const I=a(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=I.n,L=A[0];b(t,E,L),v(t,E),P!==I.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 o(t,e,w,S,...n)}finally{_=!1}},_ee=(t,e)=>{var n;const r=sa(t),i=r[1],s=r[3],o=r[6],a=r[11],l=r[15],c=r[18],d=r[19],h=a(t,e),g=i.get(e);if(g){for(const[v,b]of h.d)if(!g.d.has(v)){const _=a(t,v);c(t,v).t.add(e),g.d.add(v),b!==_.n&&(s.add(v),l(t,v),(n=o.c)==null||n.call(o,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)}}},See=(t,e)=>{var n;const r=sa(t),i=r[1],s=r[4],o=r[6],a=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=a(t,e,E);A&&(_.u=()=>{S=!0;try{A()}finally{S=!1}})}finally{S=!1}};s.add(w)}(n=o.m)==null||n.call(o,e)}return _},wee=(t,e)=>{var n,r;const i=sa(t),s=i[1],o=i[5],a=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&&o.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=a.u)==null||r.call(a,e);return}return h},Mee=(t,e,n)=>{const r=sa(t),i=r[11],s=r[27],o=i(t,e),a="v"in o,l=o.v;if(JM(n))for(const c of o.d.keys())vU(e,n,i(t,c));o.v=n,delete o.e,(!a||!Object.is(l,o.v))&&(++o.n,JM(l)&&s(t,l))},Tee=(t,e)=>{const n=sa(t)[14];return QM(n(t,e))},Eee=(t,e,...n)=>{const r=sa(t),i=r[12],s=r[13],o=r[16];try{return o(t,e,...n)}finally{s(t),i(t)}},Cee=(t,e,n)=>{const r=sa(t),i=r[12],s=r[18],o=r[19],l=s(t,e).l;return l.add(n),i(t),()=>{l.delete(n),o(t,e),i(t)}},Aee=(t,e,n)=>{const i=sa(t)[25];let s=i.get(e);if(!s){s=new Set,i.set(e,s);const o=()=>i.delete(e);e.then(o,o)}s.add(n)},Nee=(t,e)=>{const i=sa(t)[25].get(e);i==null||i.forEach(s=>s())},yU=new WeakMap,sa=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 Ree(t){const e=sa(t),n=e[24];return n?n(e):e}function kee(...t){const e={get(r){const i=sa(e)[21];return i(e,r)},set(r,...i){const s=sa(e)[22];return s(e,r,...i)},sub(r,i){const s=sa(e)[23];return s(e,r,i)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},dee,fee,hee,pee,mee,gee,vee,xee,yee,bee,_ee,See,wee,Mee,Tee,Eee,Cee,void 0,new WeakMap,Aee,Nee].map((r,i)=>t[i]||r);return yU.set(e,Object.freeze(n)),e}const bU={};let Pee=0;function ei(t,e){const n=`atom${++Pee}`,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=Dee,r.write=Iee),e&&(r.write=e),r}function Dee(t){return t(this)}function Iee(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}function _U(){return kee()}let Bb;function Oee(){return Bb||(Bb=_U(),(bU?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Bb),globalThis.__JOTAI_DEFAULT_STORE__!==Bb&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Bb}const Lee={},yN=T.createContext(void 0);function SU(t){return T.useContext(yN)||Oee()}function zee({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}))},jee=Jr.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,sD=(t,e,n)=>{const i=Ree(t)[26];let s=_C.get(e);return s||(s=new Promise((o,a)=>{let l=e;const c=g=>v=>{l===g&&o(v)},d=g=>v=>{l===g&&a(v)},h=()=>{try{const g=n();bN(g)?(_C.set(g,s),l=g,g.then(c(g),d(g)),i(t,g,h)):o(g)}catch(g){a(g)}};e.then(c(e),d(e)),i(t,e,h)}),_C.set(e,s)),s};function Pi(t,e){const{delay:n,unstable_promiseStatus:r=!Jr.use}={},i=SU(),[[s,o,a],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((o!==i||a!==t)&&(l(),c=i.get(t)),T.useEffect(()=>{const d=i.sub(t,()=>{if(r)try{const h=i.get(t);bN(h)&&_N(sD(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=sD(i,c,()=>i.get(t));return r&&_N(d),jee(d)}return c}function jd(t,e){const n=SU();return T.useCallback((...i)=>{if((Lee?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...i)},[n,t])}function un(t,e){return[Pi(t),jd(t)]}function oD(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function O5(...t){return e=>{let n=!1;const r=t.map(i=>{const s=oD(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():oD(t[i],null)}}}}function jr(...t){return T.useCallback(O5(...t),t)}function W0(t){const e=Fee(t),n=T.forwardRef((r,i)=>{const{children:s,...o}=r,a=T.Children.toArray(s),l=a.find(Uee);if(l){const c=l.props.children,d=a.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,{...o,ref:i,children:T.isValidElement(c)?T.cloneElement(c,void 0,d):null})}return p.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var wU=W0("Slot");function Fee(t){const e=T.forwardRef((n,r)=>{const{children:i,...s}=n;if(T.isValidElement(i)){const o=Hee(i),a=Bee(s,i.props);return i.type!==T.Fragment&&(a.ref=r?O5(r,o):o),T.cloneElement(i,a)}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 Uee(t){return T.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===MU}function Bee(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]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function Hee(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 Vee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ar=Vee.reduce((t,e)=>{const n=W0(`Primitive.${e}`),r=T.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function EU(t,e){t&&zd.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"}),Gee="VisuallyHidden",AU=T.forwardRef((t,e)=>p.jsx(ar.span,{...t,ref:e,style:{...CU,...t.style}}));AU.displayName=Gee;var Wee=AU;function $ee(t,e){const n=T.createContext(e),r=s=>{const{children:o,...a}=s,l=T.useMemo(()=>a,Object.values(a));return p.jsx(n.Provider,{value:l,children:o})};r.displayName=t+"Provider";function i(s){const o=T.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[r,i]}function lu(t,e=[]){let n=[];function r(s,o){const a=T.createContext(o),l=n.length;n=[...n,o];const c=h=>{var S;const{scope:g,children:v,...b}=h,_=((S=g==null?void 0:g[t])==null?void 0:S[l])||a,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])||a,b=T.useContext(v);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(o=>T.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return T.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,qee(i,...e)]}function qee(...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 o=r.reduce((a,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...a,...h}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function P7(t){const e=t+"CollectionProvider",[n,r]=lu(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=_=>{const{scope:w,children:S}=_,E=Jr.useRef(null),A=Jr.useRef(new Map).current;return p.jsx(i,{scope:w,itemMap:A,collectionRef:E,children:S})};o.displayName=e;const a=t+"CollectionSlot",l=W0(a),c=Jr.forwardRef((_,w)=>{const{scope:S,children:E}=_,A=s(a,S),N=jr(w,A.collectionRef);return p.jsx(l,{ref:N,children:E})});c.displayName=a;const d=t+"CollectionItemSlot",h="data-radix-collection-item",g=W0(d),v=Jr.forwardRef((_,w)=>{const{scope:S,children:E,...A}=_,N=Jr.useRef(null),I=jr(w,N),P=s(d,S);return Jr.useEffect(()=>(P.itemMap.set(N,{ref:N,...A}),()=>void P.itemMap.delete(N))),p.jsx(g,{[h]:"",ref:I,children:E})});v.displayName=d;function b(_){const w=s(t+"CollectionConsumer",_);return Jr.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:o,Slot:c,ItemSlot:v},b,r]}function vn(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 _a=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{},Xee=PF[" useInsertionEffect ".trim().toString()]||_a;function qu({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=Yee({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=T.useRef(t!==void 0);T.useEffect(()=>{const h=d.current;h!==a&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${a?"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=a},[a,r])}const c=T.useCallback(d=>{var h;if(a){const g=Kee(d)?d(t):d;g!==t&&((h=o.current)==null||h.call(o,g))}else s(d)},[a,t,s,o]);return[l,c]}function Yee({defaultProp:t,onChange:e}){const[n,r]=T.useState(t),i=T.useRef(n),s=T.useRef(e);return Xee(()=>{s.current=e},[e]),T.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function Kee(t){return typeof t=="function"}function Zee(t,e){return T.useReducer((n,r)=>e[n][r]??n,t)}var Ha=t=>{const{present:e,children:n}=t,r=Qee(e),i=typeof n=="function"?n({present:r.isPresent}):T.Children.only(n),s=jr(r.ref,Jee(i));return typeof n=="function"||r.isPresent?T.cloneElement(i,{ref:s}):null};Ha.displayName="Presence";function Qee(t){const[e,n]=T.useState(),r=T.useRef(null),i=T.useRef(t),s=T.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Zee(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const c=$3(r.current);s.current=a==="mounted"?c:"none"},[a]),_a(()=>{const c=r.current,d=i.current;if(d!==t){const g=s.current,v=$3(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]),_a(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,h=v=>{const _=$3(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=$3(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(a),ref:T.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function $3(t){return(t==null?void 0:t.animationName)||"none"}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 ete=PF[" useId ".trim().toString()]||(()=>{}),tte=0;function Ec(t){const[e,n]=T.useState(ete());return _a(()=>{n(r=>r??String(tte++))},[t]),t||(e?`radix-${e}`:"")}var L5="Collapsible",[nte]=lu(L5),[rte,D7]=nte(L5),NU=T.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[l,c]=qu({prop:r,defaultProp:i??!1,onChange:o,caller:L5});return p.jsx(rte,{scope:n,disabled:s,contentId:Ec(),open:l,onOpenToggle:T.useCallback(()=>c(d=>!d),[c]),children:p.jsx(ar.div,{"data-state":O7(l),"data-disabled":s?"":void 0,...a,ref:e})})});NU.displayName=L5;var RU="CollapsibleTrigger",kU=T.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=D7(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:vn(t.onClick,i.onOpenToggle)})});kU.displayName=RU;var I7="CollapsibleContent",PU=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=D7(I7,t.__scopeCollapsible);return p.jsx(Ha,{present:n||i.open,children:({present:s})=>p.jsx(ite,{...r,ref:e,present:s})})});PU.displayName=I7;var ite=T.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=t,o=D7(I7,n),[a,l]=T.useState(r),c=T.useRef(null),d=jr(e,c),h=T.useRef(0),g=h.current,v=T.useRef(0),b=v.current,_=o.open||a,w=T.useRef(_),S=T.useRef(void 0);return T.useEffect(()=>{const E=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(E)},[]),_a(()=>{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)}},[o.open,r]),p.jsx(ar.div,{"data-state":O7(o.open),"data-disabled":o.disabled?"":void 0,id:o.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 ste=NU,ote=kU,ate=PU,lte=T.createContext(void 0);function XS(t){const e=T.useContext(lte);return t||e||"ltr"}function ba(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 cte(t,e=globalThis==null?void 0:globalThis.document){const n=ba(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 ute="DismissableLayer",SN="dismissableLayer.update",dte="dismissableLayer.pointerDownOutside",fte="dismissableLayer.focusOutside",aD,DU=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),my=T.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=T.useContext(DU),[d,h]=T.useState(null),g=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,v]=T.useState({}),b=jr(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,I=mte(L=>{const R=L.target,O=[...c.branches].some(F=>F.contains(R));!N||O||(i==null||i(L),o==null||o(L),L.defaultPrevented||a==null||a())},g),P=gte(L=>{const R=L.target;[...c.branches].some(F=>F.contains(R))||(s==null||s(L),o==null||o(L),L.defaultPrevented||a==null||a())},g);return cte(L=>{E===c.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&a&&(L.preventDefault(),a()))},g),T.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(aD=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),lD(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(g.body.style.pointerEvents=aD)}},[d,g,n,c]),T.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),lD())},[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:vn(t.onFocusCapture,P.onFocusCapture),onBlurCapture:vn(t.onBlurCapture,P.onBlurCapture),onPointerDownCapture:vn(t.onPointerDownCapture,I.onPointerDownCapture)})});my.displayName=ute;var hte="DismissableLayerBranch",pte=T.forwardRef((t,e)=>{const n=T.useContext(DU),r=T.useRef(null),i=jr(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})});pte.displayName=hte;function mte(t,e=globalThis==null?void 0:globalThis.document){const n=ba(t),r=T.useRef(!1),i=T.useRef(()=>{});return T.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){IU(dte,n,c,{discrete:!0})};const c={originalEvent:a};a.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},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function gte(t,e=globalThis==null?void 0:globalThis.document){const n=ba(t),r=T.useRef(!1);return T.useEffect(()=>{const i=s=>{s.target&&!r.current&&IU(fte,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 lD(){const t=new CustomEvent(SN);document.dispatchEvent(t)}function IU(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",cD={bubbles:!1,cancelable:!0},vte="FocusScope",YS=T.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=T.useState(null),c=ba(i),d=ba(s),h=T.useRef(null),g=jr(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||!a)return;const N=A.target;a.contains(N)?h.current=N:w0(h.current,{select:!0})},w=function(A){if(v.paused||!a)return;const N=A.relatedTarget;N!==null&&(a.contains(N)||w0(h.current,{select:!0}))},S=function(A){if(document.activeElement===document.body)for(const I of A)I.removedNodes.length>0&&w0(a)};document.addEventListener("focusin",_),document.addEventListener("focusout",w);const E=new MutationObserver(S);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",w),E.disconnect()}}},[r,a,v.paused]),T.useEffect(()=>{if(a){dD.add(v);const _=document.activeElement;if(!a.contains(_)){const S=new CustomEvent(SC,cD);a.addEventListener(SC,c),a.dispatchEvent(S),S.defaultPrevented||(xte(wte(OU(a)),{select:!0}),document.activeElement===_&&w0(a))}return()=>{a.removeEventListener(SC,c),setTimeout(()=>{const S=new CustomEvent(wC,cD);a.addEventListener(wC,d),a.dispatchEvent(S),S.defaultPrevented||w0(_??document.body,{select:!0}),a.removeEventListener(wC,d),dD.remove(v)},0)}}},[a,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]=yte(E);A&&N?!_.shiftKey&&S===N?(_.preventDefault(),n&&w0(A,{select:!0})):_.shiftKey&&S===A&&(_.preventDefault(),n&&w0(N,{select:!0})):S===E&&_.preventDefault()}},[n,r,v.paused]);return p.jsx(ar.div,{tabIndex:-1,...o,ref:g,onKeyDown:b})});YS.displayName=vte;function xte(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(w0(r,{select:e}),document.activeElement!==n)return}function yte(t){const e=OU(t),n=uD(e,t),r=uD(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 uD(t,e){for(const n of t)if(!bte(n,{upTo:e}))return n}function bte(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 _te(t){return t instanceof HTMLInputElement&&"select"in t}function w0(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&_te(t)&&e&&t.select()}}var dD=Ste();function Ste(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=fD(t,e),t.unshift(e)},remove(e){var n;t=fD(t,e),(n=t[0])==null||n.resume()}}}function fD(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function wte(t){return t.filter(e=>e.tagName!=="A")}var Mte="Portal",gy=T.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=T.useState(!1);_a(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?DJ.createPortal(p.jsx(ar.div,{...r,ref:e}),o):null});gy.displayName=Mte;var MC=0;function z5(){T.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??hD()),document.body.insertAdjacentElement("beforeend",t[1]??hD()),MC++,()=>{MC===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),MC--}},[])}function hD(){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 Tte(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 DM="right-scroll-bar-position",IM="width-before-scroll-bar",Ete="with-scroll-bars-hidden",Cte="--removed-body-scroll-bar-size";function TC(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Ate(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 Nte=typeof window<"u"?T.useLayoutEffect:T.useEffect,pD=new WeakMap;function Rte(t,e){var n=Ate(null,function(r){return t.forEach(function(i){return TC(i,r)})});return Nte(function(){var r=pD.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||TC(a,null)}),s.forEach(function(a){i.has(a)||TC(a,o)})}pD.set(n,t)},[t]),n}function kte(t){return t}function Pte(t,e){e===void 0&&(e=kte);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 o=e(s,r);return n.push(o),function(){n=n.filter(function(a){return a!==o})}},assignSyncMedium:function(s){for(r=!0;n.length;){var o=n;n=[],o.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var o=[];if(n.length){var a=n;n=[],a.forEach(s),o=n}var l=function(){var d=o;o=[],d.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(d){o.push(d),c()},filter:function(d){return o=o.filter(d),n}}}};return i}function Dte(t){t===void 0&&(t={});var e=Pte(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 Ite(t,e){return t.useMedium(e),zU}var jU=Dte(),EC=function(){},j5=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],o=t.forwardProps,a=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"]),I=g,P=Rte([n,e]),L=Hf(Hf({},N),i);return T.createElement(T.Fragment,null,d&&T.createElement(I,{sideCar:jU,removeScrollBar:c,shards:h,noRelative:v,noIsolation:b,inert:_,setCallbacks:s,allowPinchZoom:!!w,lockRef:n,gapMode:A}),o?T.cloneElement(T.Children.only(a),Hf(Hf({},L),{ref:P})):T.createElement(E,Hf({},L,{className:l,ref:P}),a))});j5.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};j5.classNames={fullWidth:IM,zeroRight:DM};var Ote=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Lte(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Ote();return e&&t.setAttribute("nonce",e),t}function zte(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function jte(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var Fte=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Lte())&&(zte(e,n),jte(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Ute=function(){var t=Fte();return function(e,n){T.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},FU=function(){var t=Ute(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},Bte={left:0,top:0,right:0,gap:0},CC=function(t){return parseInt(t||"",10)||0},Hte=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)]},Vte=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Bte;var e=Hte(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])}},Gte=FU(),l1="data-scroll-locked",Wte=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),`
  .`.concat(Ete,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(a,"px ").concat(r,`;
  }
  body[`).concat(l1,`] {
    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(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(a,"px ").concat(r,`;
    `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(DM,` {
    right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(IM,` {
    margin-right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(DM," .").concat(DM,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(IM," .").concat(IM,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(l1,`] {
    `).concat(Cte,": ").concat(a,`px;
  }
`)},mD=function(){var t=parseInt(document.body.getAttribute(l1)||"0",10);return isFinite(t)?t:0},$te=function(){T.useEffect(function(){return document.body.setAttribute(l1,(mD()+1).toString()),function(){var t=mD()-1;t<=0?document.body.removeAttribute(l1):document.body.setAttribute(l1,t.toString())}},[])},qte=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;$te();var s=T.useMemo(function(){return Vte(i)},[i]);return T.createElement(Gte,{styles:Wte(s,!e,i,n?"":"!important")})},wN=!1;if(typeof window<"u")try{var q3=Object.defineProperty({},"passive",{get:function(){return wN=!0,!0}});window.addEventListener("test",q3,q3),window.removeEventListener("test",q3,q3)}catch{wN=!1}var _x=wN?{passive:!1}:!1,Xte=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&&!Xte(t)&&n[e]==="visible")},Yte=function(t){return UU(t,"overflowY")},Kte=function(t){return UU(t,"overflowX")},gD=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),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Zte=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Qte=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},BU=function(t,e){return t==="v"?Yte(e):Kte(e)},HU=function(t,e){return t==="v"?Zte(e):Qte(e)},Jte=function(t,e){return t==="h"&&e==="rtl"?-1:1},ene=function(t,e,n,r,i){var s=Jte(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,d=o>0,h=0,g=0;do{if(!a)break;var v=HU(t,a),b=v[0],_=v[1],w=v[2],S=_-w-s*b;(b||S)&&BU(t,a)&&(h+=S,g+=b);var E=a.parentNode;a=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&Math.abs(h)<1||!d&&Math.abs(g)<1)&&(c=!0),c},X3=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},vD=function(t){return[t.deltaX,t.deltaY]},xD=function(t){return t&&"current"in t?t.current:t},tne=function(t,e){return t[0]===e[0]&&t[1]===e[1]},nne=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},rne=0,Sx=[];function ine(t){var e=T.useRef([]),n=T.useRef([0,0]),r=T.useRef(),i=T.useState(rne++)[0],s=T.useState(FU)[0],o=T.useRef(t);T.useEffect(function(){o.current=t},[t]),T.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var _=Tte([t.lockRef.current],(t.shards||[]).map(xD),!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 a=T.useCallback(function(_,w){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!o.current.allowPinchZoom;var S=X3(_),E=n.current,A="deltaX"in _?_.deltaX:E[0]-S[0],N="deltaY"in _?_.deltaY:E[1]-S[1],I,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,F=O?O===P||O.contains(P):!1;if(F)return!1;var U=gD(L,P);if(!U)return!0;if(U?I=L:(I=L==="v"?"h":"v",U=gD(L,P)),!U)return!1;if(!r.current&&"changedTouches"in _&&(A||N)&&(r.current=I),!I)return!0;var q=r.current||I;return ene(q,w,_,q==="h"?A:N)},[]),l=T.useCallback(function(_){var w=_;if(!(!Sx.length||Sx[Sx.length-1]!==s)){var S="deltaY"in w?vD(w):X3(w),E=e.current.filter(function(I){return I.name===w.type&&(I.target===w.target||w.target===I.shadowParent)&&tne(I.delta,S)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var A=(o.current.shards||[]).map(xD).filter(Boolean).filter(function(I){return I.contains(w.target)}),N=A.length>0?a(w,A[0]):!o.current.noIsolation;N&&w.cancelable&&w.preventDefault()}}},[]),c=T.useCallback(function(_,w,S,E){var A={name:_,delta:w,target:S,should:E,shadowParent:sne(S)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(N){return N!==A})},1)},[]),d=T.useCallback(function(_){n.current=X3(_),r.current=void 0},[]),h=T.useCallback(function(_){c(_.type,vD(_),_.target,a(_,t.lockRef.current))},[]),g=T.useCallback(function(_){c(_.type,X3(_),_.target,a(_,t.lockRef.current))},[]);T.useEffect(function(){return Sx.push(s),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",l,_x),document.addEventListener("touchmove",l,_x),document.addEventListener("touchstart",d,_x),function(){Sx=Sx.filter(function(_){return _!==s}),document.removeEventListener("wheel",l,_x),document.removeEventListener("touchmove",l,_x),document.removeEventListener("touchstart",d,_x)}},[]);var v=t.removeScrollBar,b=t.inert;return T.createElement(T.Fragment,null,b?T.createElement(s,{styles:nne(i)}):null,v?T.createElement(qte,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function sne(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const one=Ite(jU,ine);var KS=T.forwardRef(function(t,e){return T.createElement(j5,Hf({},t,{ref:e,sideCar:one}))});KS.classNames=j5.classNames;var ane=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},wx=new WeakMap,Y3=new WeakMap,K3={},AC=0,VU=function(t){return t&&(t.host||VU(t.parentNode))},lne=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})},cne=function(t,e,n,r){var i=lne(e,Array.isArray(t)?t:[t]);K3[n]||(K3[n]=new WeakMap);var s=K3[n],o=[],a=new Set,l=new Set(i),c=function(h){!h||a.has(h)||(a.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(a.has(g))d(g);else try{var v=g.getAttribute(r),b=v!==null&&v!=="false",_=(wx.get(g)||0)+1,w=(s.get(g)||0)+1;wx.set(g,_),s.set(g,w),o.push(g),_===1&&b&&Y3.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),a.clear(),AC++,function(){o.forEach(function(h){var g=wx.get(h)-1,v=s.get(h)-1;wx.set(h,g),s.set(h,v),g||(Y3.has(h)||h.removeAttribute(r),Y3.delete(h)),v||h.removeAttribute(n)}),AC--,AC||(wx=new WeakMap,wx=new WeakMap,Y3=new WeakMap,K3={})}},F5=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=ane(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),cne(r,i,n,"aria-hidden")):function(){return null}},U5="Dialog",[GU,WU]=lu(U5),[une,Yd]=GU(U5),$U=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=T.useRef(null),l=T.useRef(null),[c,d]=qu({prop:r,defaultProp:i??!1,onChange:s,caller:U5});return p.jsx(une,{scope:e,triggerRef:a,contentRef:l,contentId:Ec(),titleId:Ec(),descriptionId:Ec(),open:c,onOpenChange:d,onOpenToggle:T.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};$U.displayName=U5;var qU="DialogTrigger",XU=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(qU,n),s=jr(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:vn(t.onClick,i.onOpenToggle)})});XU.displayName=qU;var L7="DialogPortal",[dne,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(dne,{scope:e,forceMount:n,children:T.Children.map(r,o=>p.jsx(Ha,{present:n||s.open,children:p.jsx(gy,{asChild:!0,container:i,children:o})}))})};KU.displayName=L7;var e2="DialogOverlay",ZU=T.forwardRef((t,e)=>{const n=YU(e2,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Yd(e2,t.__scopeDialog);return s.modal?p.jsx(Ha,{present:r||s.open,children:p.jsx(hne,{...i,ref:e})}):null});ZU.displayName=e2;var fne=W0("DialogOverlay.RemoveScroll"),hne=T.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Yd(e2,n);return p.jsx(KS,{as:fne,allowPinchZoom:!0,shards:[i.contentRef],children:p.jsx(ar.div,{"data-state":j7(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Zg="DialogContent",QU=T.forwardRef((t,e)=>{const n=YU(Zg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Yd(Zg,t.__scopeDialog);return p.jsx(Ha,{present:r||s.open,children:s.modal?p.jsx(pne,{...i,ref:e}):p.jsx(mne,{...i,ref:e})})});QU.displayName=Zg;var pne=T.forwardRef((t,e)=>{const n=Yd(Zg,t.__scopeDialog),r=T.useRef(null),i=jr(e,n.contentRef,r);return T.useEffect(()=>{const s=r.current;if(s)return F5(s)},[]),p.jsx(JU,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vn(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:vn(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:vn(t.onFocusOutside,s=>s.preventDefault())})}),mne=T.forwardRef((t,e)=>{const n=Yd(Zg,t.__scopeDialog),r=T.useRef(!1),i=T.useRef(!1);return p.jsx(JU,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.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 o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&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,...o}=t,a=Yd(Zg,n),l=T.useRef(null),c=jr(e,l);return z5(),p.jsxs(p.Fragment,{children:[p.jsx(YS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(my,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":j7(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(vne,{titleId:a.titleId}),p.jsx(yne,{contentRef:l,descriptionId:a.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:vn(t.onClick,()=>i.onOpenChange(!1))})});iB.displayName=rB;function j7(t){return t?"open":"closed"}var sB="DialogTitleWarning",[gne,oB]=$ee(sB,{contentName:Zg,titleName:z7,docsSlug:"dialog"}),vne=({titleId:t})=>{const e=oB(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},xne="DialogDescriptionWarning",yne=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${oB(xne).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},aB=$U,lB=XU,cB=KU,uB=ZU,dB=QU,fB=eB,hB=nB,F7=iB,pB="AlertDialog",[bne]=lu(pB,[WU]),xp=WU(),mB=t=>{const{__scopeAlertDialog:e,...n}=t,r=xp(e);return p.jsx(aB,{...r,...n,modal:!0})};mB.displayName=pB;var _ne="AlertDialogTrigger",Sne=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=xp(n);return p.jsx(lB,{...i,...r,ref:e})});Sne.displayName=_ne;var wne="AlertDialogPortal",gB=t=>{const{__scopeAlertDialog:e,...n}=t,r=xp(e);return p.jsx(cB,{...r,...n})};gB.displayName=wne;var Mne="AlertDialogOverlay",vB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=xp(n);return p.jsx(uB,{...i,...r,ref:e})});vB.displayName=Mne;var c1="AlertDialogContent",[Tne,Ene]=bne(c1),Cne=TU("AlertDialogContent"),xB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,s=xp(n),o=T.useRef(null),a=jr(e,o),l=T.useRef(null);return p.jsx(gne,{contentName:c1,titleName:yB,docsSlug:"alert-dialog",children:p.jsx(Tne,{scope:n,cancelRef:l,children:p.jsxs(dB,{role:"alertdialog",...s,...i,ref:a,onOpenAutoFocus:vn(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(Cne,{children:r}),p.jsx(Nne,{contentRef:o})]})})})});xB.displayName=c1;var yB="AlertDialogTitle",bB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=xp(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=xp(n);return p.jsx(hB,{...i,...r,ref:e})});SB.displayName=_B;var Ane="AlertDialogAction",wB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=xp(n);return p.jsx(F7,{...i,...r,ref:e})});wB.displayName=Ane;var MB="AlertDialogCancel",TB=T.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=Ene(MB,n),s=xp(n),o=jr(e,i);return p.jsx(F7,{...s,...r,ref:o})});TB.displayName=MB;var Nne=({contentRef:t})=>{const e=`\`${c1}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${c1}\` 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 \`${c1}\`. 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},Rne=mB,kne=gB,Pne=vB,Dne=xB,Ine=wB,One=TB,Lne=bB,zne=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 yD;function jne(){if(yD)return RC;yD=1;var t=GS();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,o=t.useDebugValue;function a(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]),o(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:a;return RC.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,RC}var bD;function Fne(){return bD||(bD=1,NC.exports=jne()),NC.exports}function Une(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 Bne(t){const[e,n]=T.useState(void 0);return _a(()=>{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 o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}const Hne=["top","right","bottom","left"],$0=Math.min,Xc=Math.max,t2=Math.round,Z3=Math.floor,eh=t=>({x:t,y:t}),Vne={left:"right",right:"left",bottom:"top",top:"bottom"},Gne={start:"end",end:"start"};function MN(t,e,n){return Xc(t,$0(e,n))}function fp(t,e){return typeof t=="function"?t(e):t}function hp(t){return t.split("-")[0]}function vy(t){return t.split("-")[1]}function U7(t){return t==="x"?"y":"x"}function B7(t){return t==="y"?"height":"width"}const Wne=new Set(["top","bottom"]);function $f(t){return Wne.has(hp(t))?"y":"x"}function H7(t){return U7($f(t))}function $ne(t,e,n){n===void 0&&(n=!1);const r=vy(t),i=H7(t),s=B7(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=n2(o)),[o,n2(o)]}function qne(t){const e=n2(t);return[TN(t),e,TN(e)]}function TN(t){return t.replace(/start|end/g,e=>Gne[e])}const _D=["left","right"],SD=["right","left"],Xne=["top","bottom"],Yne=["bottom","top"];function Kne(t,e,n){switch(t){case"top":case"bottom":return n?e?SD:_D:e?_D:SD;case"left":case"right":return e?Xne:Yne;default:return[]}}function Zne(t,e,n,r){const i=vy(t);let s=Kne(hp(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(TN)))),s}function n2(t){return t.replace(/left|right|bottom|top/g,e=>Vne[e])}function Qne(t){return{top:0,right:0,bottom:0,left:0,...t}}function EB(t){return typeof t!="number"?Qne(t):{top:t,right:t,bottom:t,left:t}}function r2(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 wD(t,e,n){let{reference:r,floating:i}=t;const s=$f(e),o=H7(e),a=B7(o),l=hp(e),c=s==="y",d=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,g=r[a]/2-i[a]/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(vy(e)){case"start":v[o]-=g*(n&&c?-1:1);break;case"end":v[o]+=g*(n&&c?-1:1);break}return v}async function Jne(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:g=!1,padding:v=0}=fp(e,t),b=EB(v),w=a[g?h==="floating"?"reference":"floating":h],S=r2(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(a.floating)),boundary:c,rootBoundary:d,strategy:l})),E=h==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.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},I=r2(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:A,strategy:l}):E);return{top:(S.top-I.top+b.top)/N.y,bottom:(I.bottom-S.bottom+b.bottom)/N.y,left:(S.left-I.left+b.left)/N.x,right:(I.right-S.right+b.right)/N.x}}const ere=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:h}=wD(c,r,l),g=r,v={},b=0;for(let w=0;w<a.length;w++){var _;const{name:S,fn:E}=a[w],{x:A,y:N,data:I,reset:P}=await E({x:d,y:h,initialPlacement:r,placement:g,strategy:i,middlewareData:v,rects:c,platform:{...o,detectOverflow:(_=o.detectOverflow)!=null?_:Jne},elements:{reference:t,floating:e}});d=A??d,h=N??h,v={...v,[S]:{...v[S],...I}},P&&b<=50&&(b++,typeof P=="object"&&(P.placement&&(g=P.placement),P.rects&&(c=P.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):P.rects),{x:d,y:h}=wD(c,g,l)),w=-1)}return{x:d,y:h,placement:g,strategy:i,middlewareData:v}},tre=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:d=0}=fp(t,e)||{};if(c==null)return{};const h=EB(d),g={x:n,y:r},v=H7(i),b=B7(v),_=await o.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],I=g[v]-s.reference[v],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let L=P?P[A]:0;(!L||!await(o.isElement==null?void 0:o.isElement(P)))&&(L=a.floating[A]||s.floating[b]);const R=N/2-I/2,O=L/2-_[b]/2-1,F=$0(h[S],O),U=$0(h[E],O),q=F,B=L-_[b]-U,Z=L/2-_[b]/2+R,G=MN(q,Z,B),$=!l.arrow&&vy(i)!=null&&Z!==G&&s.reference[b]/2-(Z<q?F:U)-_[b]/2<0,K=$?Z<q?Z-q:Z-B:0;return{[v]:g[v]+K,data:{[v]:G,centerOffset:Z-G-K,...$&&{alignmentOffset:K}},reset:$}}}),nre=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:_=!0,...w}=fp(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const S=hp(i),E=$f(a),A=hp(a)===a,N=await(l.isRTL==null?void 0:l.isRTL(c.floating)),I=g||(A||!_?[n2(a)]:qne(a)),P=b!=="none";!g&&P&&I.push(...Zne(a,_,b,N));const L=[a,...I],R=await l.detectOverflow(e,w),O=[];let F=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&O.push(R[S]),h){const Z=$ne(i,o,N);O.push(R[Z[0]],R[Z[1]])}if(F=[...F,{placement:i,overflows:O}],!O.every(Z=>Z<=0)){var U,q;const Z=(((U=s.flip)==null?void 0:U.index)||0)+1,G=L[Z];if(G&&(!(h==="alignment"?E!==$f(G):!1)||F.every(Y=>$f(Y.placement)===E?Y.overflows[0]>0:!0)))return{data:{index:Z,overflows:F},reset:{placement:G}};let $=(q=F.filter(K=>K.overflows[0]<=0).sort((K,Y)=>K.overflows[1]-Y.overflows[1])[0])==null?void 0:q.placement;if(!$)switch(v){case"bestFit":{var B;const K=(B=F.filter(Y=>{if(P){const J=$f(Y.placement);return J===E||J==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(J=>J>0).reduce((J,H)=>J+H,0)]).sort((Y,J)=>Y[1]-J[1])[0])==null?void 0:B[0];K&&($=K);break}case"initialPlacement":$=a;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function MD(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function TD(t){return Hne.some(e=>t[e]>=0)}const rre=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=fp(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=MD(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:TD(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=MD(o,n.floating);return{data:{escapedOffsets:a,escaped:TD(a)}}}default:return{}}}}},CB=new Set(["left","top"]);async function ire(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=hp(n),a=vy(n),l=$f(n)==="y",c=CB.has(o)?-1:1,d=s&&l?-1:1,h=fp(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 a&&typeof b=="number"&&(v=a==="end"?b*-1:b),l?{x:v*d,y:g*c}:{x:g*c,y:v*d}}const sre=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await ire(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},ore=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:o=!0,crossAxis:a=!1,limiter:l={fn:S=>{let{x:E,y:A}=S;return{x:E,y:A}}},...c}=fp(t,e),d={x:n,y:r},h=await s.detectOverflow(e,c),g=$f(hp(i)),v=U7(g);let b=d[v],_=d[g];if(o){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(a){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]:o,[g]:a}}}}}},are=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=fp(t,e),d={x:n,y:r},h=$f(i),g=U7(h);let v=d[g],b=d[h];const _=fp(a,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,I=s.reference[g]+s.reference[A]-w.mainAxis;v<N?v=N:v>I&&(v=I)}if(c){var S,E;const A=g==="y"?"width":"height",N=CB.has(hp(i)),I=s.reference[h]-s.floating[A]+(N&&((S=o.offset)==null?void 0:S[h])||0)+(N?0:w.crossAxis),P=s.reference[h]+s.reference[A]+(N?0:((E=o.offset)==null?void 0:E[h])||0)-(N?w.crossAxis:0);b<I?b=I:b>P&&(b=P)}return{[g]:v,[h]:b}}}},lre=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=fp(t,e),d=await o.detectOverflow(e,c),h=hp(i),g=vy(i),v=$f(i)==="y",{width:b,height:_}=s.floating;let w,S;h==="top"||h==="bottom"?(w=h,S=g===(await(o.isRTL==null?void 0:o.isRTL(a.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=$0(_-d[w],E),I=$0(b-d[S],A),P=!e.middlewareData.shift;let L=N,R=I;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=A),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(L=E),P&&!g){const F=Xc(d.left,0),U=Xc(d.right,0),q=Xc(d.top,0),B=Xc(d.bottom,0);v?R=b-2*(F!==0||U!==0?F+U:Xc(d.left,d.right)):L=_-2*(q!==0||B!==0?q+B:Xc(d.top,d.bottom))}await l({...e,availableWidth:R,availableHeight:L});const O=await o.getDimensions(a.floating);return b!==O.width||_!==O.height?{reset:{rects:!0}}:{}}}};function B5(){return typeof window<"u"}function xy(t){return AB(t)?(t.nodeName||"").toLowerCase():"#document"}function eu(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function dh(t){var e;return(e=(AB(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function AB(t){return B5()?t instanceof Node||t instanceof eu(t).Node:!1}function Wd(t){return B5()?t instanceof Element||t instanceof eu(t).Element:!1}function rh(t){return B5()?t instanceof HTMLElement||t instanceof eu(t).HTMLElement:!1}function ED(t){return!B5()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof eu(t).ShadowRoot}const cre=new Set(["inline","contents"]);function ZS(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=$d(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!cre.has(i)}const ure=new Set(["table","td","th"]);function dre(t){return ure.has(xy(t))}const fre=[":popover-open",":modal"];function H5(t){return fre.some(e=>{try{return t.matches(e)}catch{return!1}})}const hre=["transform","translate","scale","rotate","perspective"],pre=["transform","translate","scale","rotate","perspective","filter"],mre=["paint","layout","strict","content"];function V7(t){const e=G7(),n=Wd(t)?$d(t):t;return hre.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)||pre.some(r=>(n.willChange||"").includes(r))||mre.some(r=>(n.contain||"").includes(r))}function gre(t){let e=q0(t);for(;rh(e)&&!j1(e);){if(V7(e))return e;if(H5(e))return null;e=q0(e)}return null}function G7(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const vre=new Set(["html","body","#document"]);function j1(t){return vre.has(xy(t))}function $d(t){return eu(t).getComputedStyle(t)}function V5(t){return Wd(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function q0(t){if(xy(t)==="html")return t;const e=t.assignedSlot||t.parentNode||ED(t)&&t.host||dh(t);return ED(e)?e.host:e}function NB(t){const e=q0(t);return j1(e)?t.ownerDocument?t.ownerDocument.body:t.body:rh(e)&&ZS(e)?e:NB(e)}function Z_(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),o=eu(i);if(s){const a=EN(o);return e.concat(o,o.visualViewport||[],ZS(i)?i:[],a&&n?Z_(a):[])}return e.concat(i,Z_(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=rh(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=t2(n)!==s||t2(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function W7(t){return Wd(t)?t:t.contextElement}function u1(t){const e=W7(t);if(!rh(e))return eh(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=RB(e);let o=(s?t2(n.width):n.width)/r,a=(s?t2(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const xre=eh(0);function kB(t){const e=eu(t);return!G7()||!e.visualViewport?xre:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function yre(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==eu(t)?!1:e}function Qg(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=W7(t);let o=eh(1);e&&(r?Wd(r)&&(o=u1(r)):o=u1(t));const a=yre(s,n,r)?kB(s):eh(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,d=i.width/o.x,h=i.height/o.y;if(s){const g=eu(s),v=r&&Wd(r)?eu(r):r;let b=g,_=EN(b);for(;_&&r&&v!==b;){const w=u1(_),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=eu(_),_=EN(b)}}return r2({width:d,height:h,x:l,y:c})}function G5(t,e){const n=V5(t).scrollLeft;return e?e.left+n:Qg(dh(t)).left+n}function PB(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-G5(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function bre(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=dh(r),a=e?H5(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=eh(1);const d=eh(0),h=rh(r);if((h||!h&&!s)&&((xy(r)!=="body"||ZS(o))&&(l=V5(r)),rh(r))){const v=Qg(r);c=u1(r),d.x=v.x+r.clientLeft,d.y=v.y+r.clientTop}const g=o&&!h&&!s?PB(o,l):eh(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 _re(t){return Array.from(t.getClientRects())}function Sre(t){const e=dh(t),n=V5(t),r=t.ownerDocument.body,i=Xc(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Xc(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+G5(t);const a=-n.scrollTop;return $d(r).direction==="rtl"&&(o+=Xc(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const CD=25;function wre(t,e){const n=eu(t),r=dh(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const d=G7();(!d||d&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=G5(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<=CD&&(s-=b)}else c<=CD&&(s+=c);return{width:s,height:o,x:a,y:l}}const Mre=new Set(["absolute","fixed"]);function Tre(t,e){const n=Qg(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=rh(t)?u1(t):eh(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function AD(t,e,n){let r;if(e==="viewport")r=wre(t,n);else if(e==="document")r=Sre(dh(t));else if(Wd(e))r=Tre(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 r2(r)}function DB(t,e){const n=q0(t);return n===e||!Wd(n)||j1(n)?!1:$d(n).position==="fixed"||DB(n,e)}function Ere(t,e){const n=e.get(t);if(n)return n;let r=Z_(t,[],!1).filter(a=>Wd(a)&&xy(a)!=="body"),i=null;const s=$d(t).position==="fixed";let o=s?q0(t):t;for(;Wd(o)&&!j1(o);){const a=$d(o),l=V7(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&Mre.has(i.position)||ZS(o)&&!l&&DB(t,o))?r=r.filter(d=>d!==o):i=a,o=q0(o)}return e.set(t,r),r}function Cre(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?H5(e)?[]:Ere(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,d)=>{const h=AD(e,d,i);return c.top=Xc(h.top,c.top),c.right=$0(h.right,c.right),c.bottom=$0(h.bottom,c.bottom),c.left=Xc(h.left,c.left),c},AD(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Are(t){const{width:e,height:n}=RB(t);return{width:e,height:n}}function Nre(t,e,n){const r=rh(e),i=dh(e),s=n==="fixed",o=Qg(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=eh(0);function c(){l.x=G5(i)}if(r||!r&&!s)if((xy(e)!=="body"||ZS(i))&&(a=V5(e)),r){const v=Qg(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,a):eh(0),h=o.left+a.scrollLeft-l.x-d.x,g=o.top+a.scrollTop-l.y-d.y;return{x:h,y:g,width:o.width,height:o.height}}function kC(t){return $d(t).position==="static"}function ND(t,e){if(!rh(t)||$d(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return dh(t)===n&&(n=n.ownerDocument.body),n}function IB(t,e){const n=eu(t);if(H5(t))return n;if(!rh(t)){let i=q0(t);for(;i&&!j1(i);){if(Wd(i)&&!kC(i))return i;i=q0(i)}return n}let r=ND(t,e);for(;r&&dre(r)&&kC(r);)r=ND(r,e);return r&&j1(r)&&kC(r)&&!V7(r)?n:r||gre(t)||n}const Rre=async function(t){const e=this.getOffsetParent||IB,n=this.getDimensions,r=await n(t.floating);return{reference:Nre(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function kre(t){return $d(t).direction==="rtl"}const Pre={convertOffsetParentRelativeRectToViewportRelativeRect:bre,getDocumentElement:dh,getClippingRect:Cre,getOffsetParent:IB,getElementRects:Rre,getClientRects:_re,getDimensions:Are,getScale:u1,isElement:Wd,isRTL:kre};function OB(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Dre(t,e){let n=null,r;const i=dh(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=t.getBoundingClientRect(),{left:d,top:h,width:g,height:v}=c;if(a||e(),!g||!v)return;const b=Z3(h),_=Z3(i.clientWidth-(d+g)),w=Z3(i.clientHeight-(h+v)),S=Z3(d),A={rootMargin:-b+"px "+-_+"px "+-w+"px "+-S+"px",threshold:Xc(0,$0(1,l))||1};let N=!0;function I(P){const L=P[0].intersectionRatio;if(L!==l){if(!N)return o();L?o(!1,L):r=setTimeout(()=>{o(!1,1e-7)},1e3)}L===1&&!OB(c,t.getBoundingClientRect())&&o(),N=!1}try{n=new IntersectionObserver(I,{...A,root:i.ownerDocument})}catch{n=new IntersectionObserver(I,A)}n.observe(t)}return o(!0),s}function Ire(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=W7(t),d=i||s?[...c?Z_(c):[],...Z_(e)]:[];d.forEach(S=>{i&&S.addEventListener("scroll",n,{passive:!0}),s&&S.addEventListener("resize",n)});const h=c&&a?Dre(c,n):null;let g=-1,v=null;o&&(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?Qg(t):null;l&&w();function w(){const S=Qg(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 Ore=sre,Lre=ore,zre=nre,jre=lre,Fre=rre,RD=tre,Ure=are,Bre=(t,e,n)=>{const r=new Map,i={platform:Pre,...n},s={...i.platform,_c:r};return ere(t,e,{...i,platform:s})};var Hre=typeof document<"u",Vre=function(){},OM=Hre?T.useLayoutEffect:Vre;function i2(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(!i2(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)&&!i2(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 kD(t,e){const n=LB(t);return Math.round(e*n)/n}function PC(t){const e=T.useRef(t);return OM(()=>{e.current=t}),e}function Gre(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!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);i2(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,I=o||w,P=T.useRef(null),L=T.useRef(null),R=T.useRef(d),O=l!=null,F=PC(l),U=PC(i),q=PC(c),B=T.useCallback(()=>{if(!P.current||!L.current)return;const Y={placement:e,strategy:n,middleware:g};U.current&&(Y.platform=U.current),Bre(P.current,L.current,Y).then(J=>{const H={...J,isPositioned:q.current!==!1};Z.current&&!i2(R.current,H)&&(R.current=H,zd.flushSync(()=>{h(H)}))})},[g,e,n,U,q]);OM(()=>{c===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,h(Y=>({...Y,isPositioned:!1})))},[c]);const Z=T.useRef(!1);OM(()=>(Z.current=!0,()=>{Z.current=!1}),[]),OM(()=>{if(N&&(P.current=N),I&&(L.current=I),N&&I){if(F.current)return F.current(N,I,B);B()}},[N,I,B,F,O]);const G=T.useMemo(()=>({reference:P,floating:L,setReference:E,setFloating:A}),[E,A]),$=T.useMemo(()=>({reference:N,floating:I}),[N,I]),K=T.useMemo(()=>{const Y={position:n,left:0,top:0};if(!$.floating)return Y;const J=kD($.floating,d.x),H=kD($.floating,d.y);return a?{...Y,transform:"translate("+J+"px, "+H+"px)",...LB($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:H}},[n,a,$.floating,d.x,d.y]);return T.useMemo(()=>({...d,update:B,refs:G,elements:$,floatingStyles:K}),[d,B,G,$,K])}const Wre=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?RD({element:r.current,padding:i}).fn(n):{}:r?RD({element:r,padding:i}).fn(n):{}}}},$re=(t,e)=>({...Ore(t),options:[t,e]}),qre=(t,e)=>({...Lre(t),options:[t,e]}),Xre=(t,e)=>({...Ure(t),options:[t,e]}),Yre=(t,e)=>({...zre(t),options:[t,e]}),Kre=(t,e)=>({...jre(t),options:[t,e]}),Zre=(t,e)=>({...Fre(t),options:[t,e]}),Qre=(t,e)=>({...Wre(t),options:[t,e]});var Jre="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=Jre;var eie=zB,$7="Popper",[jB,sm]=lu($7),[tie,FB]=jB($7),UB=t=>{const{__scopePopper:e,children:n}=t,[r,i]=T.useState(null);return p.jsx(tie,{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),o=T.useRef(null),a=jr(e,o),l=T.useRef(null);return T.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:p.jsx(ar.div,{...i,ref:a})});HB.displayName=BB;var q7="PopperContent",[nie,rie]=jB(q7),VB=T.forwardRef((t,e)=>{var ce,oe,fe,me,ye,Ee;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=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=jr(e,Ge=>E(Ge)),[N,I]=T.useState(null),P=Bne(N),L=(P==null?void 0:P.width)??0,R=(P==null?void 0:P.height)??0,O=r+(s!=="center"?"-"+s:""),F=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},U=Array.isArray(c)?c:[c],q=U.length>0,B={padding:F,boundary:U.filter(sie),altBoundary:q},{refs:Z,floatingStyles:G,placement:$,isPositioned:K,middlewareData:Y}=Gre({strategy:"fixed",placement:O,whileElementsMounted:(...Ge)=>Ire(...Ge,{animationFrame:v==="always"}),elements:{reference:w.anchor},middleware:[$re({mainAxis:i+R,alignmentAxis:o}),l&&qre({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Xre():void 0,...B}),l&&Yre({...B}),Kre({...B,apply:({elements:Ge,rects:_e,availableWidth:De,availableHeight:he})=>{const{width:Le,height:ne}=_e.reference,We=Ge.floating.style;We.setProperty("--radix-popper-available-width",`${De}px`),We.setProperty("--radix-popper-available-height",`${he}px`),We.setProperty("--radix-popper-anchor-width",`${Le}px`),We.setProperty("--radix-popper-anchor-height",`${ne}px`)}}),N&&Qre({element:N,padding:a}),oie({arrowWidth:L,arrowHeight:R}),g&&Zre({strategy:"referenceHidden",...B})]}),[J,H]=$B($),z=ba(b);_a(()=>{K&&(z==null||z())},[K,z]);const X=(ce=Y.arrow)==null?void 0:ce.x,V=(oe=Y.arrow)==null?void 0:oe.y,ie=((fe=Y.arrow)==null?void 0:fe.centerOffset)!==0,[ae,re]=T.useState();return _a(()=>{S&&re(window.getComputedStyle(S).zIndex)},[S]),p.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:K?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(me=Y.transformOrigin)==null?void 0:me.x,(ye=Y.transformOrigin)==null?void 0:ye.y].join(" "),...((Ee=Y.hide)==null?void 0:Ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:p.jsx(nie,{scope:n,placedSide:J,onArrowChange:I,arrowX:X,arrowY:V,shouldHideArrow:ie,children:p.jsx(ar.div,{"data-side":J,"data-align":H,..._,ref:A,style:{..._.style,animation:K?void 0:"none"}})})})});VB.displayName=q7;var GB="PopperArrow",iie={top:"bottom",right:"left",bottom:"top",left:"right"},WB=T.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=rie(GB,r),o=iie[s.placedSide];return p.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]: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(eie,{...i,ref:n,style:{...i.style,display:"block"}})})});WB.displayName=GB;function sie(t){return t!==null}var oie=t=>({name:"transformOrigin",options:t,fn(e){var w,S,E;const{placement:n,rects:r,middlewareData:i}=e,o=((w=i.arrow)==null?void 0:w.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?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)+a/2,v=(((E=i.arrow)==null?void 0:E.y)??0)+l/2;let b="",_="";return c==="bottom"?(b=o?h:`${g}px`,_=`${-l}px`):c==="top"?(b=o?h:`${g}px`,_=`${r.floating.height+l}px`):c==="right"?(b=`${-l}px`,_=o?h:`${v}px`):c==="left"&&(b=`${r.floating.width+l}px`,_=o?h:`${v}px`),{data:{x:b,y:_}}}});function $B(t){const[e,n="center"]=t.split("-");return[e,n]}var QS=UB,JS=HB,W5=VB,$5=WB,DC="rovingFocusGroup.onEntryFocus",aie={bubbles:!1,cancelable:!0},ew="RovingFocusGroup",[CN,qB,lie]=P7(ew),[cie,q5]=lu(ew,[lie]),[uie,die]=cie(ew),XB=T.forwardRef((t,e)=>p.jsx(CN.Provider,{scope:t.__scopeRovingFocusGroup,children:p.jsx(CN.Slot,{scope:t.__scopeRovingFocusGroup,children:p.jsx(fie,{...t,ref:e})})}));XB.displayName=ew;var fie=T.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...h}=t,g=T.useRef(null),v=jr(e,g),b=XS(s),[_,w]=qu({prop:o,defaultProp:a??null,onChange:l,caller:ew}),[S,E]=T.useState(!1),A=ba(c),N=qB(n),I=T.useRef(!1),[P,L]=T.useState(0);return T.useEffect(()=>{const R=g.current;if(R)return R.addEventListener(DC,A),()=>R.removeEventListener(DC,A)},[A]),p.jsx(uie,{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:vn(t.onMouseDown,()=>{I.current=!0}),onFocus:vn(t.onFocus,R=>{const O=!I.current;if(R.target===R.currentTarget&&O&&!S){const F=new CustomEvent(DC,aie);if(R.currentTarget.dispatchEvent(F),!F.defaultPrevented){const U=N().filter($=>$.focusable),q=U.find($=>$.active),B=U.find($=>$.id===_),G=[q,B,...U].filter(Boolean).map($=>$.ref.current);ZB(G,d)}}I.current=!1}),onBlur:vn(t.onBlur,()=>E(!1))})})}),YB="RovingFocusGroupItem",KB=T.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=t,l=Ec(),c=s||l,d=die(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,...a,ref:e,onMouseDown:vn(t.onMouseDown,w=>{r?d.onItemFocus(c):w.preventDefault()}),onFocus:vn(t.onFocus,()=>d.onItemFocus(c)),onKeyDown:vn(t.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){d.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const S=mie(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?gie(A,N+1):A.slice(N+1)}setTimeout(()=>ZB(A))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:_!=null}):o})})});KB.displayName=YB;var hie={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function pie(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function mie(t,e,n){const r=pie(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return hie[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 gie(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var QB=XB,JB=KB,AN=["Enter"," "],vie=["ArrowDown","PageUp","Home"],eH=["ArrowUp","PageDown","End"],xie=[...vie,...eH],yie={ltr:[...AN,"ArrowRight"],rtl:[...AN,"ArrowLeft"]},bie={ltr:["ArrowLeft"],rtl:["ArrowRight"]},tw="Menu",[Q_,_ie,Sie]=P7(tw),[pv,tH]=lu(tw,[Sie,sm,q5]),nw=sm(),nH=q5(),[rH,om]=pv(tw),[wie,rw]=pv(tw),iH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,a=nw(e),[l,c]=T.useState(null),d=T.useRef(!1),h=ba(s),g=XS(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(QS,{...a,children:p.jsx(rH,{scope:e,open:n,onOpenChange:h,content:l,onContentChange:c,children:p.jsx(wie,{scope:e,onClose:T.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:d,dir:g,modal:o,children:r})})})};iH.displayName=tw;var Mie="MenuAnchor",X7=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=nw(n);return p.jsx(JS,{...i,...r,ref:e})});X7.displayName=Mie;var Y7="MenuPortal",[Tie,sH]=pv(Y7,{forceMount:void 0}),oH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=om(Y7,e);return p.jsx(Tie,{scope:e,forceMount:n,children:p.jsx(Ha,{present:n||s.open,children:p.jsx(gy,{asChild:!0,container:i,children:r})})})};oH.displayName=Y7;var Wu="MenuContent",[Eie,K7]=pv(Wu),aH=T.forwardRef((t,e)=>{const n=sH(Wu,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=om(Wu,t.__scopeMenu),o=rw(Wu,t.__scopeMenu);return p.jsx(Q_.Provider,{scope:t.__scopeMenu,children:p.jsx(Ha,{present:r||s.open,children:p.jsx(Q_.Slot,{scope:t.__scopeMenu,children:o.modal?p.jsx(Cie,{...i,ref:e}):p.jsx(Aie,{...i,ref:e})})})})}),Cie=T.forwardRef((t,e)=>{const n=om(Wu,t.__scopeMenu),r=T.useRef(null),i=jr(e,r);return T.useEffect(()=>{const s=r.current;if(s)return F5(s)},[]),p.jsx(Z7,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:vn(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Aie=T.forwardRef((t,e)=>{const n=om(Wu,t.__scopeMenu);return p.jsx(Z7,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Nie=W0("MenuContent.ScrollLock"),Z7=T.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:h,onInteractOutside:g,onDismiss:v,disableOutsideScroll:b,..._}=t,w=om(Wu,n),S=rw(Wu,n),E=nw(n),A=nH(n),N=_ie(n),[I,P]=T.useState(null),L=T.useRef(null),R=jr(e,L,w.onContentChange),O=T.useRef(0),F=T.useRef(""),U=T.useRef(0),q=T.useRef(null),B=T.useRef("right"),Z=T.useRef(0),G=b?KS:T.Fragment,$=b?{as:Nie,allowPinchZoom:!0}:void 0,K=J=>{var ce,oe;const H=F.current+J,z=N().filter(fe=>!fe.disabled),X=document.activeElement,V=(ce=z.find(fe=>fe.ref.current===X))==null?void 0:ce.textValue,ie=z.map(fe=>fe.textValue),ae=Bie(ie,H,V),re=(oe=z.find(fe=>fe.textValue===ae))==null?void 0:oe.ref.current;(function fe(me){F.current=me,window.clearTimeout(O.current),me!==""&&(O.current=window.setTimeout(()=>fe(""),1e3))})(H),re&&setTimeout(()=>re.focus())};T.useEffect(()=>()=>window.clearTimeout(O.current),[]),z5();const Y=T.useCallback(J=>{var z,X;return B.current===((z=q.current)==null?void 0:z.side)&&Vie(J,(X=q.current)==null?void 0:X.area)},[]);return p.jsx(Eie,{scope:n,searchRef:F,onItemEnter:T.useCallback(J=>{Y(J)&&J.preventDefault()},[Y]),onItemLeave:T.useCallback(J=>{var H;Y(J)||((H=L.current)==null||H.focus(),P(null))},[Y]),onTriggerLeave:T.useCallback(J=>{Y(J)&&J.preventDefault()},[Y]),pointerGraceTimerRef:U,onPointerGraceIntentChange:T.useCallback(J=>{q.current=J},[]),children:p.jsx(G,{...$,children:p.jsx(YS,{asChild:!0,trapped:i,onMountAutoFocus:vn(s,J=>{var H;J.preventDefault(),(H=L.current)==null||H.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:p.jsx(my,{asChild:!0,disableOutsidePointerEvents:a,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:I,onCurrentTabStopIdChange:P,onEntryFocus:vn(l,J=>{S.isUsingKeyboardRef.current||J.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(W5,{role:"menu","aria-orientation":"vertical","data-state":MH(w.open),"data-radix-menu-content":"",dir:S.dir,...E,..._,ref:R,style:{outline:"none",..._.style},onKeyDown:vn(_.onKeyDown,J=>{const z=J.target.closest("[data-radix-menu-content]")===J.currentTarget,X=J.ctrlKey||J.altKey||J.metaKey,V=J.key.length===1;z&&(J.key==="Tab"&&J.preventDefault(),!X&&V&&K(J.key));const ie=L.current;if(J.target!==ie||!xie.includes(J.key))return;J.preventDefault();const re=N().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);eH.includes(J.key)&&re.reverse(),Fie(re)}),onBlur:vn(t.onBlur,J=>{J.currentTarget.contains(J.target)||(window.clearTimeout(O.current),F.current="")}),onPointerMove:vn(t.onPointerMove,J_(J=>{const H=J.target,z=Z.current!==J.clientX;if(J.currentTarget.contains(H)&&z){const X=J.clientX>Z.current?"right":"left";B.current=X,Z.current=J.clientX}}))})})})})})})});aH.displayName=Wu;var Rie="MenuGroup",Q7=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return p.jsx(ar.div,{role:"group",...r,ref:e})});Q7.displayName=Rie;var kie="MenuLabel",lH=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return p.jsx(ar.div,{...r,ref:e})});lH.displayName=kie;var s2="MenuItem",PD="menu.itemSelect",X5=T.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=T.useRef(null),o=rw(s2,t.__scopeMenu),a=K7(s2,t.__scopeMenu),l=jr(e,s),c=T.useRef(!1),d=()=>{const h=s.current;if(!n&&h){const g=new CustomEvent(PD,{bubbles:!0,cancelable:!0});h.addEventListener(PD,v=>r==null?void 0:r(v),{once:!0}),EU(h,g),g.defaultPrevented?c.current=!1:o.onClose()}};return p.jsx(cH,{...i,ref:l,disabled:n,onClick:vn(t.onClick,d),onPointerDown:h=>{var g;(g=t.onPointerDown)==null||g.call(t,h),c.current=!0},onPointerUp:vn(t.onPointerUp,h=>{var g;c.current||(g=h.currentTarget)==null||g.click()}),onKeyDown:vn(t.onKeyDown,h=>{const g=a.searchRef.current!=="";n||g&&h.key===" "||AN.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});X5.displayName=s2;var cH=T.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=K7(s2,n),a=nH(n),l=T.useRef(null),c=jr(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(Q_.ItemSlot,{scope:n,disabled:r,textValue:i??g,children:p.jsx(JB,{asChild:!0,...a,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:vn(t.onPointerMove,J_(b=>{r?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:vn(t.onPointerLeave,J_(b=>o.onItemLeave(b))),onFocus:vn(t.onFocus,()=>h(!0)),onBlur:vn(t.onBlur,()=>h(!1))})})})}),Pie="MenuCheckboxItem",uH=T.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return p.jsx(mH,{scope:t.__scopeMenu,checked:n,children:p.jsx(X5,{role:"menuitemcheckbox","aria-checked":o2(n)?"mixed":n,...i,ref:e,"data-state":t8(n),onSelect:vn(i.onSelect,()=>r==null?void 0:r(o2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});uH.displayName=Pie;var dH="MenuRadioGroup",[Die,Iie]=pv(dH,{value:void 0,onValueChange:()=>{}}),fH=T.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=ba(r);return p.jsx(Die,{scope:t.__scopeMenu,value:n,onValueChange:s,children:p.jsx(Q7,{...i,ref:e})})});fH.displayName=dH;var hH="MenuRadioItem",pH=T.forwardRef((t,e)=>{const{value:n,...r}=t,i=Iie(hH,t.__scopeMenu),s=n===i.value;return p.jsx(mH,{scope:t.__scopeMenu,checked:s,children:p.jsx(X5,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":t8(s),onSelect:vn(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});pH.displayName=hH;var J7="MenuItemIndicator",[mH,Oie]=pv(J7,{checked:!1}),gH=T.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=Oie(J7,n);return p.jsx(Ha,{present:r||o2(s.checked)||s.checked===!0,children:p.jsx(ar.span,{...i,ref:e,"data-state":t8(s.checked)})})});gH.displayName=J7;var Lie="MenuSeparator",vH=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return p.jsx(ar.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});vH.displayName=Lie;var zie="MenuArrow",xH=T.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=nw(n);return p.jsx($5,{...i,...r,ref:e})});xH.displayName=zie;var e8="MenuSub",[jie,yH]=pv(e8),bH=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:i}=t,s=om(e8,e),o=nw(e),[a,l]=T.useState(null),[c,d]=T.useState(null),h=ba(i);return T.useEffect(()=>(s.open===!1&&h(!1),()=>h(!1)),[s.open,h]),p.jsx(QS,{...o,children:p.jsx(rH,{scope:e,open:r,onOpenChange:h,content:c,onContentChange:d,children:p.jsx(jie,{scope:e,contentId:Ec(),triggerId:Ec(),trigger:a,onTriggerChange:l,children:n})})})};bH.displayName=e8;var f_="MenuSubTrigger",_H=T.forwardRef((t,e)=>{const n=om(f_,t.__scopeMenu),r=rw(f_,t.__scopeMenu),i=yH(f_,t.__scopeMenu),s=K7(f_,t.__scopeMenu),o=T.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},d=T.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return T.useEffect(()=>d,[d]),T.useEffect(()=>{const h=a.current;return()=>{window.clearTimeout(h),l(null)}},[a,l]),p.jsx(X7,{asChild:!0,...c,children:p.jsx(cH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":MH(n.open),...t,ref:O5(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:vn(t.onPointerMove,J_(h=>{s.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:vn(t.onPointerLeave,J_(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(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(h),h.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:vn(t.onKeyDown,h=>{var v;const g=s.searchRef.current!=="";t.disabled||g&&h.key===" "||yie[r.dir].includes(h.key)&&(n.onOpenChange(!0),(v=n.content)==null||v.focus(),h.preventDefault())})})})});_H.displayName=f_;var SH="MenuSubContent",wH=T.forwardRef((t,e)=>{const n=sH(Wu,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=om(Wu,t.__scopeMenu),o=rw(Wu,t.__scopeMenu),a=yH(SH,t.__scopeMenu),l=T.useRef(null),c=jr(e,l);return p.jsx(Q_.Provider,{scope:t.__scopeMenu,children:p.jsx(Ha,{present:r||s.open,children:p.jsx(Q_.Slot,{scope:t.__scopeMenu,children:p.jsx(Z7,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:c,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var h;o.isUsingKeyboardRef.current&&((h=l.current)==null||h.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:vn(t.onFocusOutside,d=>{d.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:vn(t.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:vn(t.onKeyDown,d=>{var v;const h=d.currentTarget.contains(d.target),g=bie[o.dir].includes(d.key);h&&g&&(s.onOpenChange(!1),(v=a.trigger)==null||v.focus(),d.preventDefault())})})})})})});wH.displayName=SH;function MH(t){return t?"open":"closed"}function o2(t){return t==="indeterminate"}function t8(t){return o2(t)?"indeterminate":t?"checked":"unchecked"}function Fie(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Uie(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Bie(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 o=Uie(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Hie(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s],l=e[o],c=a.x,d=a.y,h=l.x,g=l.y;d>r!=g>r&&n<(h-c)*(r-d)/(g-d)+c&&(i=!i)}return i}function Vie(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Hie(n,e)}function J_(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Gie=iH,Wie=X7,$ie=oH,qie=aH,Xie=Q7,Yie=lH,Kie=X5,Zie=uH,Qie=fH,Jie=pH,ese=gH,tse=vH,nse=xH,rse=bH,ise=_H,sse=wH,Y5="DropdownMenu",[ose]=lu(Y5,[tH]),gl=tH(),[ase,TH]=ose(Y5),EH=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,l=gl(e),c=T.useRef(null),[d,h]=qu({prop:i,defaultProp:s??!1,onChange:o,caller:Y5});return p.jsx(ase,{scope:e,triggerId:Ec(),triggerRef:c,contentId:Ec(),open:d,onOpenChange:h,onOpenToggle:T.useCallback(()=>h(g=>!g),[h]),modal:a,children:p.jsx(Gie,{...l,open:d,onOpenChange:h,dir:r,modal:a,children:n})})};EH.displayName=Y5;var CH="DropdownMenuTrigger",AH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=TH(CH,n),o=gl(n);return p.jsx(Wie,{asChild:!0,...o,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:O5(e,s.triggerRef),onPointerDown:vn(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:vn(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});AH.displayName=CH;var lse="DropdownMenuPortal",NH=t=>{const{__scopeDropdownMenu:e,...n}=t,r=gl(e);return p.jsx($ie,{...r,...n})};NH.displayName=lse;var RH="DropdownMenuContent",kH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=TH(RH,n),s=gl(n),o=T.useRef(!1);return p.jsx(qie,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:vn(t.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:vn(t.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;(!i.modal||d)&&(o.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)"}})});kH.displayName=RH;var cse="DropdownMenuGroup",use=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gl(n);return p.jsx(Xie,{...i,...r,ref:e})});use.displayName=cse;var dse="DropdownMenuLabel",PH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gl(n);return p.jsx(Yie,{...i,...r,ref:e})});PH.displayName=dse;var fse="DropdownMenuItem",DH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gl(n);return p.jsx(Kie,{...i,...r,ref:e})});DH.displayName=fse;var hse="DropdownMenuCheckboxItem",IH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gl(n);return p.jsx(Zie,{...i,...r,ref:e})});IH.displayName=hse;var pse="DropdownMenuRadioGroup",mse=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gl(n);return p.jsx(Qie,{...i,...r,ref:e})});mse.displayName=pse;var gse="DropdownMenuRadioItem",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="DropdownMenuItemIndicator",OH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gl(n);return p.jsx(ese,{...i,...r,ref:e})});OH.displayName=xse;var yse="DropdownMenuSeparator",LH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gl(n);return p.jsx(tse,{...i,...r,ref:e})});LH.displayName=yse;var bse="DropdownMenuArrow",_se=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gl(n);return p.jsx(nse,{...i,...r,ref:e})});_se.displayName=bse;var Sse=t=>{const{__scopeDropdownMenu:e,children:n,open:r,onOpenChange:i,defaultOpen:s}=t,o=gl(e),[a,l]=qu({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return p.jsx(rse,{...o,open:a,onOpenChange:l,children:n})},wse="DropdownMenuSubTrigger",zH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gl(n);return p.jsx(ise,{...i,...r,ref:e})});zH.displayName=wse;var Mse="DropdownMenuSubContent",jH=T.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=gl(n);return p.jsx(sse,{...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)"}})});jH.displayName=Mse;var Tse=EH,Ese=AH,Cse=NH,Ase=kH,Nse=PH,Rse=DH,kse=IH,Pse=OH,Dse=LH,Ise=Sse,Ose=zH,Lse=jH,zse="Label",FH=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())}}));FH.displayName=zse;var jse=FH;function NN(t,[e,n]){return Math.min(n,Math.max(e,t))}var K5="Popover",[UH]=lu(K5,[sm]),iw=sm(),[Fse,am]=UH(K5),BH=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=iw(e),l=T.useRef(null),[c,d]=T.useState(!1),[h,g]=qu({prop:r,defaultProp:i??!1,onChange:s,caller:K5});return p.jsx(QS,{...a,children:p.jsx(Fse,{scope:e,contentId:Ec(),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:o,children:n})})};BH.displayName=K5;var HH="PopoverAnchor",Use=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=am(HH,n),s=iw(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return T.useEffect(()=>(o(),()=>a()),[o,a]),p.jsx(JS,{...s,...r,ref:e})});Use.displayName=HH;var VH="PopoverTrigger",GH=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=am(VH,n),s=iw(n),o=jr(e,i.triggerRef),a=p.jsx(ar.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":YH(i.open),...r,ref:o,onClick:vn(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:p.jsx(JS,{asChild:!0,...s,children:a})});GH.displayName=VH;var n8="PopoverPortal",[Bse,Hse]=UH(n8,{forceMount:void 0}),WH=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=am(n8,e);return p.jsx(Bse,{scope:e,forceMount:n,children:p.jsx(Ha,{present:n||s.open,children:p.jsx(gy,{asChild:!0,container:i,children:r})})})};WH.displayName=n8;var F1="PopoverContent",$H=T.forwardRef((t,e)=>{const n=Hse(F1,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=am(F1,t.__scopePopover);return p.jsx(Ha,{present:r||s.open,children:s.modal?p.jsx(Gse,{...i,ref:e}):p.jsx(Wse,{...i,ref:e})})});$H.displayName=F1;var Vse=W0("PopoverContent.RemoveScroll"),Gse=T.forwardRef((t,e)=>{const n=am(F1,t.__scopePopover),r=T.useRef(null),i=jr(e,r),s=T.useRef(!1);return T.useEffect(()=>{const o=r.current;if(o)return F5(o)},[]),p.jsx(KS,{as:Vse,allowPinchZoom:!0,children:p.jsx(qH,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vn(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:vn(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:vn(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Wse=T.forwardRef((t,e)=>{const n=am(F1,t.__scopePopover),r=T.useRef(!1),i=T.useRef(!1);return p.jsx(qH,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.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 o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),qH=T.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...h}=t,g=am(F1,n),v=iw(n);return z5(),p.jsx(YS,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(my,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>g.onOpenChange(!1),children:p.jsx(W5,{"data-state":YH(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)"}})})})}),XH="PopoverClose",$se=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=am(XH,n);return p.jsx(ar.button,{type:"button",...r,ref:e,onClick:vn(t.onClick,()=>i.onOpenChange(!1))})});$se.displayName=XH;var qse="PopoverArrow",Xse=T.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=iw(n);return p.jsx($5,{...i,...r,ref:e})});Xse.displayName=qse;function YH(t){return t?"open":"closed"}var Yse=BH,Kse=GH,Zse=WH,Qse=$H;function Jse(t,e){return T.useReducer((n,r)=>e[n][r]??n,t)}var r8="ScrollArea",[KH]=lu(r8),[eoe,Ju]=KH(r8),ZH=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,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),[I,P]=T.useState(!1),[L,R]=T.useState(!1),O=jr(e,U=>l(U)),F=XS(i);return p.jsx(eoe,{scope:n,type:r,dir:F,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:d,content:h,onContentChange:g,scrollbarX:v,onScrollbarXChange:b,scrollbarXEnabled:I,onScrollbarXEnabledChange:P,scrollbarY:_,onScrollbarYChange:w,scrollbarYEnabled:L,onScrollbarYEnabledChange:R,onCornerWidthChange:E,onCornerHeightChange:N,children:p.jsx(ar.div,{dir:F,...o,ref:O,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});ZH.displayName=r8;var QH="ScrollAreaViewport",JH=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:i,...s}=t,o=Ju(QH,n),a=T.useRef(null),l=jr(e,a,o.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:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:p.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});JH.displayName=QH;var fh="ScrollAreaScrollbar",eV=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Ju(fh,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return T.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?p.jsx(toe,{...r,ref:e,forceMount:n}):i.type==="scroll"?p.jsx(noe,{...r,ref:e,forceMount:n}):i.type==="auto"?p.jsx(tV,{...r,ref:e,forceMount:n}):i.type==="always"?p.jsx(i8,{...r,ref:e}):null});eV.displayName=fh;var toe=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Ju(fh,t.__scopeScrollArea),[s,o]=T.useState(!1);return T.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},d=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),p.jsx(Ha,{present:n||s,children:p.jsx(tV,{"data-state":s?"visible":"hidden",...r,ref:e})})}),noe=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Ju(fh,t.__scopeScrollArea),s=t.orientation==="horizontal",o=Q5(()=>l("SCROLL_END"),100),[a,l]=Jse("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(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,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"),o()),h=v};return c.addEventListener("scroll",g),()=>c.removeEventListener("scroll",g)}},[i.viewport,s,l,o]),p.jsx(Ha,{present:n||a!=="hidden",children:p.jsx(i8,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:vn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:vn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),tV=T.forwardRef((t,e)=>{const n=Ju(fh,t.__scopeScrollArea),{forceMount:r,...i}=t,[s,o]=T.useState(!1),a=t.orientation==="horizontal",l=Q5(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;o(a?c:d)}},10);return U1(n.viewport,l),U1(n.content,l),p.jsx(Ha,{present:r||s,children:p.jsx(i8,{"data-state":s?"visible":"hidden",...i,ref:e})})}),i8=T.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,i=Ju(fh,t.__scopeScrollArea),s=T.useRef(null),o=T.useRef(0),[a,l]=T.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=oV(a.viewport,a.content),d={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:g=>o.current=g};function h(g,v){return loe(g,o.current,a,v)}return n==="horizontal"?p.jsx(roe,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const g=i.viewport.scrollLeft,v=DD(g,a,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(ioe,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const g=i.viewport.scrollTop,v=DD(g,a);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}),roe=T.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=Ju(fh,t.__scopeScrollArea),[o,a]=T.useState(),l=T.useRef(null),c=jr(e,l,s.onScrollbarXChange);return T.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),p.jsx(rV,{"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),lV(g,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:l2(o.paddingLeft),paddingEnd:l2(o.paddingRight)}})}})}),ioe=T.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=Ju(fh,t.__scopeScrollArea),[o,a]=T.useState(),l=T.useRef(null),c=jr(e,l,s.onScrollbarYChange);return T.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),p.jsx(rV,{"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),lV(g,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:l2(o.paddingTop),paddingEnd:l2(o.paddingBottom)}})}})}),[soe,nV]=KH(fh),rV=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:h,...g}=t,v=Ju(fh,n),[b,_]=T.useState(null),w=jr(e,O=>_(O)),S=T.useRef(null),E=T.useRef(""),A=v.viewport,N=r.content-r.viewport,I=ba(d),P=ba(l),L=Q5(h,10);function R(O){if(S.current){const F=O.clientX-S.current.left,U=O.clientY-S.current.top;c({x:F,y:U})}}return T.useEffect(()=>{const O=F=>{const U=F.target;(b==null?void 0:b.contains(U))&&I(F,N)};return document.addEventListener("wheel",O,{passive:!1}),()=>document.removeEventListener("wheel",O,{passive:!1})},[A,b,N,I]),T.useEffect(P,[r,P]),U1(b,L),U1(v.content,L),p.jsx(soe,{scope:n,scrollbar:b,hasThumb:i,onThumbChange:ba(s),onThumbPointerUp:ba(o),onThumbPositionChange:P,onThumbPointerDown:ba(a),children:p.jsx(ar.div,{...g,ref:w,style:{position:"absolute",...g.style},onPointerDown:vn(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:vn(t.onPointerMove,R),onPointerUp:vn(t.onPointerUp,O=>{const F=O.target;F.hasPointerCapture(O.pointerId)&&F.releasePointerCapture(O.pointerId),document.body.style.webkitUserSelect=E.current,v.viewport&&(v.viewport.style.scrollBehavior=""),S.current=null})})})}),a2="ScrollAreaThumb",iV=T.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=nV(a2,t.__scopeScrollArea);return p.jsx(Ha,{present:n||i.hasThumb,children:p.jsx(ooe,{ref:e,...r})})}),ooe=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,s=Ju(a2,n),o=nV(a2,n),{onThumbPositionChange:a}=o,l=jr(e,h=>o.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=coe(h,a);c.current=v,a()}};return a(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,d,a]),p.jsx(ar.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:vn(t.onPointerDownCapture,h=>{const v=h.target.getBoundingClientRect(),b=h.clientX-v.left,_=h.clientY-v.top;o.onThumbPointerDown({x:b,y:_})}),onPointerUp:vn(t.onPointerUp,o.onThumbPointerUp)})});iV.displayName=a2;var s8="ScrollAreaCorner",sV=T.forwardRef((t,e)=>{const n=Ju(s8,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?p.jsx(aoe,{...t,ref:e}):null});sV.displayName=s8;var aoe=T.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=Ju(s8,n),[s,o]=T.useState(0),[a,l]=T.useState(0),c=!!(s&&a);return U1(i.scrollbarX,()=>{var h;const d=((h=i.scrollbarX)==null?void 0:h.offsetHeight)||0;i.onCornerHeightChange(d),l(d)}),U1(i.scrollbarY,()=>{var h;const d=((h=i.scrollbarY)==null?void 0:h.offsetWidth)||0;i.onCornerWidthChange(d),o(d)}),c?p.jsx(ar.div,{...r,ref:e,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function l2(t){return t?parseInt(t,10):0}function oV(t,e){const n=t/e;return isNaN(n)?0:n}function Z5(t){const e=oV(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function loe(t,e,n,r="ltr"){const i=Z5(n),s=i/2,o=e||s,a=i-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,h=r==="ltr"?[0,d]:[d*-1,0];return aV([l,c],h)(t)}function DD(t,e,n="ltr"){const r=Z5(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,a=s-r,l=n==="ltr"?[0,o]:[o*-1,0],c=NN(t,l);return aV([0,o],[0,a])(c)}function aV(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 lV(t,e){return t>0&&t<e}var coe=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function i(){const s={left:t.scrollLeft,top:t.scrollTop},o=n.left!==s.left,a=n.top!==s.top;(o||a)&&e(),n=s,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Q5(t,e){const n=ba(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 U1(t,e){const n=ba(e);_a(()=>{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 uoe=ZH,doe=JH,foe=sV,hoe=[" ","Enter","ArrowUp","ArrowDown"],poe=[" ","Enter"],Jg="Select",[J5,eT,moe]=P7(Jg),[yy]=lu(Jg,[moe,sm]),tT=sm(),[goe,lm]=yy(Jg),[voe,xoe]=yy(Jg),cV=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,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,I]=T.useState(!1),P=XS(c),[L,R]=qu({prop:r,defaultProp:i??!1,onChange:s,caller:Jg}),[O,F]=qu({prop:o,defaultProp:a,onChange:l,caller:Jg}),U=T.useRef(null),q=w?b||!!w.closest("form"):!0,[B,Z]=T.useState(new Set),G=Array.from(B).map($=>$.props.value).join(";");return p.jsx(QS,{..._,children:p.jsxs(goe,{required:v,scope:e,trigger:w,onTriggerChange:S,valueNode:E,onValueNodeChange:A,valueNodeHasChildren:N,onValueNodeHasChildrenChange:I,contentId:Ec(),value:O,onValueChange:F,open:L,onOpenChange:R,dir:P,triggerPointerDownPosRef:U,disabled:g,children:[p.jsx(J5.Provider,{scope:e,children:p.jsx(voe,{scope:t.__scopeSelect,onNativeOptionAdd:T.useCallback($=>{Z(K=>new Set(K).add($))},[]),onNativeOptionRemove:T.useCallback($=>{Z(K=>{const Y=new Set(K);return Y.delete($),Y})},[]),children:n})}),q?p.jsxs(kV,{"aria-hidden":!0,required:v,tabIndex:-1,name:d,autoComplete:h,value:O,onChange:$=>F($.target.value),disabled:g,form:b,children:[O===void 0?p.jsx("option",{value:""}):null,Array.from(B)]},G):null]})})};cV.displayName=Jg;var uV="SelectTrigger",dV=T.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=tT(n),o=lm(uV,n),a=o.disabled||r,l=jr(e,o.onTriggerChange),c=eT(n),d=T.useRef("touch"),[h,g,v]=DV(_=>{const w=c().filter(A=>!A.disabled),S=w.find(A=>A.value===o.value),E=IV(w,_,S);E!==void 0&&o.onValueChange(E.value)}),b=_=>{a||(o.onOpenChange(!0),v()),_&&(o.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return p.jsx(JS,{asChild:!0,...s,children:p.jsx(ar.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":PV(o.value)?"":void 0,...i,ref:l,onClick:vn(i.onClick,_=>{_.currentTarget.focus(),d.current!=="mouse"&&b(_)}),onPointerDown:vn(i.onPointerDown,_=>{d.current=_.pointerType;const w=_.target;w.hasPointerCapture(_.pointerId)&&w.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(b(_),_.preventDefault())}),onKeyDown:vn(i.onKeyDown,_=>{const w=h.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&g(_.key),!(w&&_.key===" ")&&hoe.includes(_.key)&&(b(),_.preventDefault())})})})});dV.displayName=uV;var fV="SelectValue",hV=T.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...a}=t,l=lm(fV,n),{onValueNodeHasChildrenChange:c}=l,d=s!==void 0,h=jr(e,l.onValueNodeChange);return _a(()=>{c(d)},[c,d]),p.jsx(ar.span,{...a,ref:h,style:{pointerEvents:"none"},children:PV(l.value)?p.jsx(p.Fragment,{children:o}):s})});hV.displayName=fV;var yoe="SelectIcon",pV=T.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return p.jsx(ar.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});pV.displayName=yoe;var boe="SelectPortal",mV=t=>p.jsx(gy,{asChild:!0,...t});mV.displayName=boe;var ev="SelectContent",gV=T.forwardRef((t,e)=>{const n=lm(ev,t.__scopeSelect),[r,i]=T.useState();if(_a(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?zd.createPortal(p.jsx(vV,{scope:t.__scopeSelect,children:p.jsx(J5.Slot,{scope:t.__scopeSelect,children:p.jsx("div",{children:t.children})})}),s):null}return p.jsx(xV,{...t,ref:e})});gV.displayName=ev;var kd=10,[vV,cm]=yy(ev),_oe="SelectContentImpl",Soe=W0("SelectContent.RemoveScroll"),xV=T.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:_,avoidCollisions:w,...S}=t,E=lm(ev,n),[A,N]=T.useState(null),[I,P]=T.useState(null),L=jr(e,ce=>N(ce)),[R,O]=T.useState(null),[F,U]=T.useState(null),q=eT(n),[B,Z]=T.useState(!1),G=T.useRef(!1);T.useEffect(()=>{if(A)return F5(A)},[A]),z5();const $=T.useCallback(ce=>{const[oe,...fe]=q().map(Ee=>Ee.ref.current),[me]=fe.slice(-1),ye=document.activeElement;for(const Ee of ce)if(Ee===ye||(Ee==null||Ee.scrollIntoView({block:"nearest"}),Ee===oe&&I&&(I.scrollTop=0),Ee===me&&I&&(I.scrollTop=I.scrollHeight),Ee==null||Ee.focus(),document.activeElement!==ye))return},[q,I]),K=T.useCallback(()=>$([R,A]),[$,R,A]);T.useEffect(()=>{B&&K()},[B,K]);const{onOpenChange:Y,triggerPointerDownPosRef:J}=E;T.useEffect(()=>{if(A){let ce={x:0,y:0};const oe=me=>{var ye,Ee;ce={x:Math.abs(Math.round(me.pageX)-(((ye=J.current)==null?void 0:ye.x)??0)),y:Math.abs(Math.round(me.pageY)-(((Ee=J.current)==null?void 0:Ee.y)??0))}},fe=me=>{ce.x<=10&&ce.y<=10?me.preventDefault():A.contains(me.target)||Y(!1),document.removeEventListener("pointermove",oe),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",oe),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",oe),document.removeEventListener("pointerup",fe,{capture:!0})}}},[A,Y,J]),T.useEffect(()=>{const ce=()=>Y(!1);return window.addEventListener("blur",ce),window.addEventListener("resize",ce),()=>{window.removeEventListener("blur",ce),window.removeEventListener("resize",ce)}},[Y]);const[H,z]=DV(ce=>{const oe=q().filter(ye=>!ye.disabled),fe=oe.find(ye=>ye.ref.current===document.activeElement),me=IV(oe,ce,fe);me&&setTimeout(()=>me.ref.current.focus())}),X=T.useCallback((ce,oe,fe)=>{const me=!G.current&&!fe;(E.value!==void 0&&E.value===oe||me)&&(O(ce),me&&(G.current=!0))},[E.value]),V=T.useCallback(()=>A==null?void 0:A.focus(),[A]),ie=T.useCallback((ce,oe,fe)=>{const me=!G.current&&!fe;(E.value!==void 0&&E.value===oe||me)&&U(ce)},[E.value]),ae=r==="popper"?RN:yV,re=ae===RN?{side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:h,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:_,avoidCollisions:w}:{};return p.jsx(vV,{scope:n,content:A,viewport:I,onViewportChange:P,itemRefCallback:X,selectedItem:R,onItemLeave:V,itemTextRefCallback:ie,focusSelectedItem:K,selectedItemText:F,position:r,isPositioned:B,searchRef:H,children:p.jsx(KS,{as:Soe,allowPinchZoom:!0,children:p.jsx(YS,{asChild:!0,trapped:E.open,onMountAutoFocus:ce=>{ce.preventDefault()},onUnmountAutoFocus:vn(i,ce=>{var oe;(oe=E.trigger)==null||oe.focus({preventScroll:!0}),ce.preventDefault()}),children:p.jsx(my,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:ce=>ce.preventDefault(),onDismiss:()=>E.onOpenChange(!1),children:p.jsx(ae,{role:"listbox",id:E.contentId,"data-state":E.open?"open":"closed",dir:E.dir,onContextMenu:ce=>ce.preventDefault(),...S,...re,onPlaced:()=>Z(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:vn(S.onKeyDown,ce=>{const oe=ce.ctrlKey||ce.altKey||ce.metaKey;if(ce.key==="Tab"&&ce.preventDefault(),!oe&&ce.key.length===1&&z(ce.key),["ArrowUp","ArrowDown","Home","End"].includes(ce.key)){let me=q().filter(ye=>!ye.disabled).map(ye=>ye.ref.current);if(["ArrowUp","End"].includes(ce.key)&&(me=me.slice().reverse()),["ArrowUp","ArrowDown"].includes(ce.key)){const ye=ce.target,Ee=me.indexOf(ye);me=me.slice(Ee+1)}setTimeout(()=>$(me)),ce.preventDefault()}})})})})})})});xV.displayName=_oe;var woe="SelectItemAlignedPosition",yV=T.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=lm(ev,n),o=cm(ev,n),[a,l]=T.useState(null),[c,d]=T.useState(null),h=jr(e,L=>d(L)),g=eT(n),v=T.useRef(!1),b=T.useRef(!0),{viewport:_,selectedItem:w,selectedItemText:S,focusSelectedItem:E}=o,A=T.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&_&&w&&S){const L=s.trigger.getBoundingClientRect(),R=c.getBoundingClientRect(),O=s.valueNode.getBoundingClientRect(),F=S.getBoundingClientRect();if(s.dir!=="rtl"){const ye=F.left-R.left,Ee=O.left-ye,Ge=L.left-Ee,_e=L.width+Ge,De=Math.max(_e,R.width),he=window.innerWidth-kd,Le=NN(Ee,[kd,Math.max(kd,he-De)]);a.style.minWidth=_e+"px",a.style.left=Le+"px"}else{const ye=R.right-F.right,Ee=window.innerWidth-O.right-ye,Ge=window.innerWidth-L.right-Ee,_e=L.width+Ge,De=Math.max(_e,R.width),he=window.innerWidth-kd,Le=NN(Ee,[kd,Math.max(kd,he-De)]);a.style.minWidth=_e+"px",a.style.right=Le+"px"}const U=g(),q=window.innerHeight-kd*2,B=_.scrollHeight,Z=window.getComputedStyle(c),G=parseInt(Z.borderTopWidth,10),$=parseInt(Z.paddingTop,10),K=parseInt(Z.borderBottomWidth,10),Y=parseInt(Z.paddingBottom,10),J=G+$+B+Y+K,H=Math.min(w.offsetHeight*5,J),z=window.getComputedStyle(_),X=parseInt(z.paddingTop,10),V=parseInt(z.paddingBottom,10),ie=L.top+L.height/2-kd,ae=q-ie,re=w.offsetHeight/2,ce=w.offsetTop+re,oe=G+$+ce,fe=J-oe;if(oe<=ie){const ye=U.length>0&&w===U[U.length-1].ref.current;a.style.bottom="0px";const Ee=c.clientHeight-_.offsetTop-_.offsetHeight,Ge=Math.max(ae,re+(ye?V:0)+Ee+K),_e=oe+Ge;a.style.height=_e+"px"}else{const ye=U.length>0&&w===U[0].ref.current;a.style.top="0px";const Ge=Math.max(ie,G+_.offsetTop+(ye?X:0)+re)+fe;a.style.height=Ge+"px",_.scrollTop=oe-ie+_.offsetTop}a.style.margin=`${kd}px 0`,a.style.minHeight=H+"px",a.style.maxHeight=q+"px",r==null||r(),requestAnimationFrame(()=>v.current=!0)}},[g,s.trigger,s.valueNode,a,c,_,w,S,s.dir,r]);_a(()=>A(),[A]);const[N,I]=T.useState();_a(()=>{c&&I(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(Toe,{scope:n,contentWrapper:a,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}})})})});yV.displayName=woe;var Moe="SelectPopperPosition",RN=T.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=kd,...s}=t,o=tT(n);return p.jsx(W5,{...o,...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=Moe;var[Toe,o8]=yy(ev,{}),kN="SelectViewport",bV=T.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=cm(kN,n),o=o8(kN,n),a=jr(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:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:vn(i.onScroll,c=>{const d=c.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&h){const v=Math.abs(l.current-d.scrollTop);if(v>0){const b=window.innerHeight-kd*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})})})]})});bV.displayName=kN;var _V="SelectGroup",[Eoe,Coe]=yy(_V),Aoe=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Ec();return p.jsx(Eoe,{scope:n,id:i,children:p.jsx(ar.div,{role:"group","aria-labelledby":i,...r,ref:e})})});Aoe.displayName=_V;var SV="SelectLabel",Noe=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Coe(SV,n);return p.jsx(ar.div,{id:i.id,...r,ref:e})});Noe.displayName=SV;var c2="SelectItem",[Roe,wV]=yy(c2),MV=T.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=t,a=lm(c2,n),l=cm(c2,n),c=a.value===r,[d,h]=T.useState(s??""),[g,v]=T.useState(!1),b=jr(e,E=>{var A;return(A=l.itemRefCallback)==null?void 0:A.call(l,E,r,i)}),_=Ec(),w=T.useRef("touch"),S=()=>{i||(a.onValueChange(r),a.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(Roe,{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,...o,ref:b,onFocus:vn(o.onFocus,()=>v(!0)),onBlur:vn(o.onBlur,()=>v(!1)),onClick:vn(o.onClick,()=>{w.current!=="mouse"&&S()}),onPointerUp:vn(o.onPointerUp,()=>{w.current==="mouse"&&S()}),onPointerDown:vn(o.onPointerDown,E=>{w.current=E.pointerType}),onPointerMove:vn(o.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:vn(o.onPointerLeave,E=>{var A;E.currentTarget===document.activeElement&&((A=l.onItemLeave)==null||A.call(l))}),onKeyDown:vn(o.onKeyDown,E=>{var N;((N=l.searchRef)==null?void 0:N.current)!==""&&E.key===" "||(poe.includes(E.key)&&S(),E.key===" "&&E.preventDefault())})})})})});MV.displayName=c2;var h_="SelectItemText",TV=T.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,o=lm(h_,n),a=cm(h_,n),l=wV(h_,n),c=xoe(h_,n),[d,h]=T.useState(null),g=jr(e,S=>h(S),l.onItemTextChange,S=>{var E;return(E=a.itemTextRefCallback)==null?void 0:E.call(a,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 _a(()=>(_(b),()=>w(b)),[_,w,b]),p.jsxs(p.Fragment,{children:[p.jsx(ar.span,{id:l.textId,...s,ref:g}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?zd.createPortal(s.children,o.valueNode):null]})});TV.displayName=h_;var EV="SelectItemIndicator",CV=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return wV(EV,n).isSelected?p.jsx(ar.span,{"aria-hidden":!0,...r,ref:e}):null});CV.displayName=EV;var PN="SelectScrollUpButton",AV=T.forwardRef((t,e)=>{const n=cm(PN,t.__scopeSelect),r=o8(PN,t.__scopeSelect),[i,s]=T.useState(!1),o=jr(e,r.onScrollButtonChange);return _a(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?p.jsx(RV,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});AV.displayName=PN;var DN="SelectScrollDownButton",NV=T.forwardRef((t,e)=>{const n=cm(DN,t.__scopeSelect),r=o8(DN,t.__scopeSelect),[i,s]=T.useState(!1),o=jr(e,r.onScrollButtonChange);return _a(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)<c;s(d)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?p.jsx(RV,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});NV.displayName=DN;var RV=T.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=cm("SelectScrollButton",n),o=T.useRef(null),a=eT(n),l=T.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return T.useEffect(()=>()=>l(),[l]),_a(()=>{var d;const c=a().find(h=>h.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),p.jsx(ar.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:vn(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:vn(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:vn(i.onPointerLeave,()=>{l()})})}),koe="SelectSeparator",Poe=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return p.jsx(ar.div,{"aria-hidden":!0,...r,ref:e})});Poe.displayName=koe;var IN="SelectArrow",Doe=T.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=tT(n),s=lm(IN,n),o=cm(IN,n);return s.open&&o.position==="popper"?p.jsx($5,{...i,...r,ref:e}):null});Doe.displayName=IN;var Ioe="SelectBubbleInput",kV=T.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=T.useRef(null),s=jr(r,i),o=Une(e);return T.useEffect(()=>{const a=i.current;if(!a)return;const l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&d){const h=new Event("change",{bubbles:!0});d.call(a,e),a.dispatchEvent(h)}},[o,e]),p.jsx(ar.select,{...n,style:{...CU,...n.style},ref:s,defaultValue:e})});kV.displayName=Ioe;function PV(t){return t===""||t===void 0}function DV(t){const e=ba(t),n=T.useRef(""),r=T.useRef(0),i=T.useCallback(o=>{const a=n.current+o;e(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[e]),s=T.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return T.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function IV(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 o=Ooe(t,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Ooe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Loe=cV,zoe=dV,joe=hV,Foe=pV,Uoe=mV,Boe=gV,Hoe=bV,Voe=MV,Goe=TV,Woe=CV,$oe=AV,qoe=NV,OV="Toggle",a8=T.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...s}=t,[o,a]=qu({prop:n,onChange:i,defaultProp:r??!1,caller:OV});return p.jsx(ar.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...s,ref:e,onClick:vn(t.onClick,()=>{t.disabled||a(!o)})})});a8.displayName=OV;var Xoe=a8,um="ToggleGroup",[LV]=lu(um,[q5]),zV=q5(),l8=Jr.forwardRef((t,e)=>{const{type:n,...r}=t;if(n==="single"){const i=r;return p.jsx(Yoe,{...i,ref:e})}if(n==="multiple"){const i=r;return p.jsx(Koe,{...i,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${um}\``)});l8.displayName=um;var[jV,FV]=LV(um),Yoe=Jr.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o,a]=qu({prop:n,defaultProp:r??"",onChange:i,caller:um});return p.jsx(jV,{scope:t.__scopeToggleGroup,type:"single",value:Jr.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:Jr.useCallback(()=>a(""),[a]),children:p.jsx(UV,{...s,ref:e})})}),Koe=Jr.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o,a]=qu({prop:n,defaultProp:r??[],onChange:i,caller:um}),l=Jr.useCallback(d=>a((h=[])=>[...h,d]),[a]),c=Jr.useCallback(d=>a((h=[])=>h.filter(g=>g!==d)),[a]);return p.jsx(jV,{scope:t.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:l,onItemDeactivate:c,children:p.jsx(UV,{...s,ref:e})})});l8.displayName=um;var[Zoe,Qoe]=LV(um),UV=Jr.forwardRef((t,e)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:s,dir:o,loop:a=!0,...l}=t,c=zV(n),d=XS(o),h={role:"group",dir:d,...l};return p.jsx(Zoe,{scope:n,rovingFocus:i,disabled:r,children:i?p.jsx(QB,{asChild:!0,...c,orientation:s,dir:d,loop:a,children:p.jsx(ar.div,{...h,ref:e})}):p.jsx(ar.div,{...h,ref:e})})}),u2="ToggleGroupItem",BV=Jr.forwardRef((t,e)=>{const n=FV(u2,t.__scopeToggleGroup),r=Qoe(u2,t.__scopeToggleGroup),i=zV(t.__scopeToggleGroup),s=n.value.includes(t.value),o=r.disabled||t.disabled,a={...t,pressed:s,disabled:o},l=Jr.useRef(null);return r.rovingFocus?p.jsx(JB,{asChild:!0,...i,focusable:!o,active:s,ref:l,children:p.jsx(ID,{...a,ref:e})}):p.jsx(ID,{...a,ref:e})});BV.displayName=u2;var ID=Jr.forwardRef((t,e)=>{const{__scopeToggleGroup:n,value:r,...i}=t,s=FV(u2,n),o={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},a=s.type==="single"?o:void 0;return p.jsx(a8,{...a,...i,ref:e,onPressedChange:l=>{l?s.onItemActivate(r):s.onItemDeactivate(r)}})}),Joe=l8,eae=BV,[nT]=lu("Tooltip",[sm]),rT=sm(),HV="TooltipProvider",tae=700,ON="tooltip.open",[nae,c8]=nT(HV),VV=t=>{const{__scopeTooltip:e,delayDuration:n=tae,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,o=T.useRef(!0),a=T.useRef(!1),l=T.useRef(0);return T.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),p.jsx(nae,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:T.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:T.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:T.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})};VV.displayName=HV;var eS="Tooltip",[rae,sw]=nT(eS),GV=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=t,l=c8(eS,t.__scopeTooltip),c=rT(e),[d,h]=T.useState(null),g=Ec(),v=T.useRef(0),b=o??l.disableHoverableContent,_=a??l.delayDuration,w=T.useRef(!1),[S,E]=qu({prop:r,defaultProp:i??!1,onChange:L=>{L?(l.onOpen(),document.dispatchEvent(new CustomEvent(ON))):l.onClose(),s==null||s(L)},caller:eS}),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]),I=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(QS,{...c,children:p.jsx(rae,{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?I():(window.clearTimeout(v.current),v.current=0)},[I,b]),onOpen:N,onClose:I,disableHoverableContent:b,children:n})})};GV.displayName=eS;var LN="TooltipTrigger",WV=T.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=sw(LN,n),s=c8(LN,n),o=rT(n),a=T.useRef(null),l=jr(e,a,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(JS,{asChild:!0,...o,children:p.jsx(ar.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:vn(t.onPointerMove,g=>{g.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:vn(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:vn(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:vn(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:vn(t.onBlur,i.onClose),onClick:vn(t.onClick,i.onClose)})})});WV.displayName=LN;var u8="TooltipPortal",[iae,sae]=nT(u8,{forceMount:void 0}),$V=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=sw(u8,e);return p.jsx(iae,{scope:e,forceMount:n,children:p.jsx(Ha,{present:n||s.open,children:p.jsx(gy,{asChild:!0,container:i,children:r})})})};$V.displayName=u8;var B1="TooltipContent",qV=T.forwardRef((t,e)=>{const n=sae(B1,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=sw(B1,t.__scopeTooltip);return p.jsx(Ha,{present:r||o.open,children:o.disableHoverableContent?p.jsx(XV,{side:i,...s,ref:e}):p.jsx(oae,{side:i,...s,ref:e})})}),oae=T.forwardRef((t,e)=>{const n=sw(B1,t.__scopeTooltip),r=c8(B1,t.__scopeTooltip),i=T.useRef(null),s=jr(e,i),[o,a]=T.useState(null),{trigger:l,onClose:c}=n,d=i.current,{onPointerInTransitChange:h}=r,g=T.useCallback(()=>{a(null),h(!1)},[h]),v=T.useCallback((b,_)=>{const w=b.currentTarget,S={x:b.clientX,y:b.clientY},E=dae(S,w.getBoundingClientRect()),A=fae(S,E),N=hae(_.getBoundingClientRect()),I=mae([...A,...N]);a(I),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(o){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=!pae(S,o);E?g():A&&(g(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[l,d,o,c,g]),p.jsx(XV,{...t,ref:s})}),[aae,lae]=nT(eS,{isInside:!1}),cae=TU("TooltipContent"),XV=T.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=t,l=sw(B1,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(my,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:p.jsxs(W5,{"data-state":l.stateAttribute,...c,...a,ref:e,style:{...a.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(cae,{children:r}),p.jsx(aae,{scope:n,isInside:!0,children:p.jsx(Wee,{id:l.contentId,role:"tooltip",children:i||r})})]})})});qV.displayName=B1;var YV="TooltipArrow",uae=T.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=rT(n);return lae(YV,n).isInside?null:p.jsx($5,{...i,...r,ref:e})});uae.displayName=YV;function dae(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 fae(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 hae(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 pae(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,o=e.length-1;s<e.length;o=s++){const a=e[s],l=e[o],c=a.x,d=a.y,h=l.x,g=l.y;d>r!=g>r&&n<(h-c)*(r-d)/(g-d)+c&&(i=!i)}return i}function mae(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),gae(e)}function gae(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],o=e[e.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.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],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.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 vae=VV,xae=GV,yae=WV,bae=$V,_ae=qV;function KV(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=KV(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function ZV(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=KV(t))&&(r&&(r+=" "),r+=e);return r}const Sae=(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},wae=(t,e)=>({classGroupId:t,validator:e}),QV=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),d2="-",OD=[],Mae="arbitrary..",Tae=t=>{const e=Cae(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return Eae(o);const a=o.split(d2),l=a[0]===""&&a.length>1?1:0;return JV(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?Sae(c,l):l:c||OD}return n[o]||OD}}},JV=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const c=JV(t,e+1,s);if(c)return c}const o=n.validators;if(o===null)return;const a=e===0?t.join(d2):t.slice(e).join(d2),l=o.length;for(let c=0;c<l;c++){const d=o[c];if(d.validator(a))return d.classGroupId}},Eae=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?Mae+r:void 0})(),Cae=t=>{const{theme:e,classGroups:n}=t;return Aae(n,e)},Aae=(t,e)=>{const n=QV();for(const r in t){const i=t[r];d8(i,n,r,e)}return n},d8=(t,e,n,r)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];Nae(o,e,n,r)}},Nae=(t,e,n,r)=>{if(typeof t=="string"){Rae(t,e,n);return}if(typeof t=="function"){kae(t,e,n,r);return}Pae(t,e,n,r)},Rae=(t,e,n)=>{const r=t===""?e:eG(e,t);r.classGroupId=n},kae=(t,e,n,r)=>{if(Dae(t)){d8(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(wae(n,t))},Pae=(t,e,n,r)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];d8(l,eG(e,a),n,r)}},eG=(t,e)=>{let n=t;const r=e.split(d2),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=QV(),n.nextPart.set(o,a)),n=a}return n},Dae=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Iae=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(s,o)=>{n[s]=o,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(s){let o=n[s];if(o!==void 0)return o;if((o=r[s])!==void 0)return i(s,o),o},set(s,o){s in n?n[s]=o:i(s,o)}}},zN="!",LD=":",Oae=[],zD=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Lae=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let o=0,a=0,l=0,c;const d=i.length;for(let _=0;_<d;_++){const w=i[_];if(o===0&&a===0){if(w===LD){s.push(i.slice(l,_)),l=_+1;continue}if(w==="/"){c=_;continue}}w==="["?o++:w==="]"?o--:w==="("?a++:w===")"&&a--}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 zD(s,v,g,b)};if(e){const i=e+LD,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):zD(Oae,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},zae=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 o=n[s],a=o[0]==="[",l=e.has(o);a||l?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(o)):i.push(o)}return i.length>0&&(i.sort(),r.push(...i)),r}},jae=t=>({cache:Iae(t.cacheSize),parseClassName:Lae(t),sortModifiers:zae(t),...Tae(t)}),Fae=/\s+/,Uae=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(Fae);let l="";for(let c=a.length-1;c>=0;c-=1){const d=a[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(o.indexOf(N)>-1)continue;o.push(N);const I=i(S,w);for(let P=0;P<I.length;++P){const L=I[P];o.push(A+L)}l=d+(l.length>0?" "+l:l)}return l},Bae=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=tG(n))&&(i&&(i+=" "),i+=r);return i},tG=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=tG(t[r]))&&(n&&(n+=" "),n+=e);return n},Hae=(t,...e)=>{let n,r,i,s;const o=l=>{const c=e.reduce((d,h)=>h(d),t());return n=jae(c),r=n.cache.get,i=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const d=Uae(l,n);return i(l,d),d};return s=o,(...l)=>s(Bae(...l))},Vae=[],ta=t=>{const e=n=>n[t]||Vae;return e.isThemeGetter=!0,e},nG=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rG=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Gae=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Wae=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$ae=/\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$/,qae=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Xae=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Yae=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,c0=t=>Gae.test(t),Vr=t=>!!t&&!Number.isNaN(Number(t)),u0=t=>!!t&&Number.isInteger(Number(t)),IC=t=>t.endsWith("%")&&Vr(t.slice(0,-1)),Vh=t=>Wae.test(t),iG=()=>!0,Kae=t=>$ae.test(t)&&!qae.test(t),f8=()=>!1,Zae=t=>Xae.test(t),Qae=t=>Yae.test(t),Jae=t=>!Dn(t)&&!In(t),ele=t=>dm(t,aG,f8),Dn=t=>nG.test(t),eg=t=>dm(t,lG,Kae),jD=t=>dm(t,lle,Vr),tle=t=>dm(t,uG,iG),nle=t=>dm(t,cG,f8),FD=t=>dm(t,sG,f8),rle=t=>dm(t,oG,Qae),Q3=t=>dm(t,dG,Zae),In=t=>rG.test(t),Hb=t=>mv(t,lG),ile=t=>mv(t,cG),UD=t=>mv(t,sG),sle=t=>mv(t,aG),ole=t=>mv(t,oG),J3=t=>mv(t,dG,!0),ale=t=>mv(t,uG,!0),dm=(t,e,n)=>{const r=nG.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},mv=(t,e,n=!1)=>{const r=rG.exec(t);return r?r[1]?e(r[1]):n:!1},sG=t=>t==="position"||t==="percentage",oG=t=>t==="image"||t==="url",aG=t=>t==="length"||t==="size"||t==="bg-size",lG=t=>t==="length",lle=t=>t==="number",cG=t=>t==="family-name",uG=t=>t==="number"||t==="weight",dG=t=>t==="shadow",cle=()=>{const t=ta("color"),e=ta("font"),n=ta("text"),r=ta("font-weight"),i=ta("tracking"),s=ta("leading"),o=ta("breakpoint"),a=ta("container"),l=ta("spacing"),c=ta("radius"),d=ta("shadow"),h=ta("inset-shadow"),g=ta("text-shadow"),v=ta("drop-shadow"),b=ta("blur"),_=ta("perspective"),w=ta("aspect"),S=ta("ease"),E=ta("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"],I=()=>[...N(),In,Dn],P=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],R=()=>[In,Dn,l],O=()=>[c0,"full","auto",...R()],F=()=>[u0,"none","subgrid",In,Dn],U=()=>["auto",{span:["full",u0,In,Dn]},u0,In,Dn],q=()=>[u0,"auto",In,Dn],B=()=>["auto","min","max","fr",In,Dn],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],G=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...R()],K=()=>[c0,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],Y=()=>[c0,"screen","full","dvw","lvw","svw","min","max","fit",...R()],J=()=>[c0,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],H=()=>[t,In,Dn],z=()=>[...N(),UD,FD,{position:[In,Dn]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",sle,ele,{size:[In,Dn]}],ie=()=>[IC,Hb,eg],ae=()=>["","none","full",c,In,Dn],re=()=>["",Vr,Hb,eg],ce=()=>["solid","dashed","dotted","double"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[Vr,IC,UD,FD],me=()=>["","none",b,In,Dn],ye=()=>["none",Vr,In,Dn],Ee=()=>["none",Vr,In,Dn],Ge=()=>[Vr,In,Dn],_e=()=>[c0,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Vh],breakpoint:[Vh],color:[iG],container:[Vh],"drop-shadow":[Vh],ease:["in","out","in-out"],font:[Jae],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Vh],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Vh],shadow:[Vh],spacing:["px",Vr],text:[Vh],"text-shadow":[Vh],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",c0,Dn,In,w]}],container:["container"],columns:[{columns:[Vr,Dn,In,a]}],"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:I()}],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:[u0,"auto",In,Dn]}],basis:[{basis:[c0,"full","auto",a,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Vr,c0,"auto","initial","none",Dn]}],grow:[{grow:["",Vr,In,Dn]}],shrink:[{shrink:["",Vr,In,Dn]}],order:[{order:[u0,"first","last","none",In,Dn]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":B()}],"auto-rows":[{"auto-rows":B()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[...G(),"normal"]}],"justify-self":[{"justify-self":["auto",...G()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[...G(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...G(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[...G(),"baseline"]}],"place-self":[{"place-self":["auto",...G()]}],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:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"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",...J()]}],"min-block-size":[{"min-block":["auto",...J()]}],"max-block-size":[{"max-block":["none",...J()]}],w:[{w:[a,"screen",...K()]}],"min-w":[{"min-w":[a,"screen","none",...K()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...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,Hb,eg]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ale,tle]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",IC,Dn]}],"font-family":[{font:[ile,nle,e]}],"font-features":[{"font-features":[Dn]}],"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,In,Dn]}],"line-clamp":[{"line-clamp":[Vr,"none",In,jD]}],leading:[{leading:[s,...R()]}],"list-image":[{"list-image":["none",In,Dn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",In,Dn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[Vr,"from-font","auto",In,eg]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[Vr,"auto",In,Dn]}],"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",In,Dn]}],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",In,Dn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:z()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},u0,In,Dn],radial:["",In,Dn],conic:[u0,In,Dn]},ole,rle]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"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:[...ce(),"hidden","none"]}],"divide-style":[{divide:[...ce(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-bs":[{"border-bs":H()}],"border-color-be":[{"border-be":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Vr,In,Dn]}],"outline-w":[{outline:["",Vr,Hb,eg]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",d,J3,Q3]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",h,J3,Q3]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[Vr,eg]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",g,J3,Q3]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[Vr,In,Dn]}],"mix-blend":[{"mix-blend":[...oe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":oe()}],"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":[Vr]}],"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":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"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":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"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":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"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":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"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":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"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":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"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":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[In,Dn]}],"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":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"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":[Vr]}],"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":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:z()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",In,Dn]}],filter:[{filter:["","none",In,Dn]}],blur:[{blur:me()}],brightness:[{brightness:[Vr,In,Dn]}],contrast:[{contrast:[Vr,In,Dn]}],"drop-shadow":[{"drop-shadow":["","none",v,J3,Q3]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",Vr,In,Dn]}],"hue-rotate":[{"hue-rotate":[Vr,In,Dn]}],invert:[{invert:["",Vr,In,Dn]}],saturate:[{saturate:[Vr,In,Dn]}],sepia:[{sepia:["",Vr,In,Dn]}],"backdrop-filter":[{"backdrop-filter":["","none",In,Dn]}],"backdrop-blur":[{"backdrop-blur":me()}],"backdrop-brightness":[{"backdrop-brightness":[Vr,In,Dn]}],"backdrop-contrast":[{"backdrop-contrast":[Vr,In,Dn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Vr,In,Dn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Vr,In,Dn]}],"backdrop-invert":[{"backdrop-invert":["",Vr,In,Dn]}],"backdrop-opacity":[{"backdrop-opacity":[Vr,In,Dn]}],"backdrop-saturate":[{"backdrop-saturate":[Vr,In,Dn]}],"backdrop-sepia":[{"backdrop-sepia":["",Vr,In,Dn]}],"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",In,Dn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Vr,"initial",In,Dn]}],ease:[{ease:["linear","initial",S,In,Dn]}],delay:[{delay:[Vr,In,Dn]}],animate:[{animate:["none",E,In,Dn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,In,Dn]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:ye()}],"rotate-x":[{"rotate-x":ye()}],"rotate-y":[{"rotate-y":ye()}],"rotate-z":[{"rotate-z":ye()}],scale:[{scale:Ee()}],"scale-x":[{"scale-x":Ee()}],"scale-y":[{"scale-y":Ee()}],"scale-z":[{"scale-z":Ee()}],"scale-3d":["scale-3d"],skew:[{skew:Ge()}],"skew-x":[{"skew-x":Ge()}],"skew-y":[{"skew-y":Ge()}],transform:[{transform:[In,Dn,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:_e()}],"translate-x":[{"translate-x":_e()}],"translate-y":[{"translate-y":_e()}],"translate-z":[{"translate-z":_e()}],"translate-none":["translate-none"],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"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",In,Dn]}],"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",In,Dn]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[Vr,Hb,eg,jD]}],stroke:[{stroke:["none",...H()]}],"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"]}},ule=Hae(cle);function Nt(...t){return ule(ZV(t))}function fG({delayDuration:t=0,...e}){return p.jsx(vae,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function gv({...t}){return p.jsx(fG,{children:p.jsx(xae,{"data-slot":"tooltip",...t})})}function vv({...t}){return p.jsx(yae,{"data-slot":"tooltip-trigger",...t})}function xv({className:t,sideOffset:e=4,children:n,...r}){return p.jsx(bae,{children:p.jsx(_ae,{"data-slot":"tooltip-content",sideOffset:e,className:Nt("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 dle({children:t}){const[e]=T.useState(()=>new iee({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1}}}));return p.jsx(zee,{children:p.jsx(see,{client:e,children:p.jsx(fG,{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 fle=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),hle=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),BD=t=>{const e=hle(t);return e.charAt(0).toUpperCase()+e.slice(1)},hG=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),ple=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 mle={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 gle=T.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>T.createElement("svg",{ref:l,...mle,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:hG("lucide",i),...!s&&!ple(a)&&{"aria-hidden":"true"},...a},[...o.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 Ei=(t,e)=>{const n=T.forwardRef(({className:r,...i},s)=>T.createElement(gle,{ref:s,iconNode:e,className:hG(`lucide-${fle(BD(t))}`,`lucide-${t}`,r),...i}));return n.displayName=BD(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 vle=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],xle=Ei("arrow-down",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 yle=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],OC=Ei("arrow-left",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:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],_le=Ei("arrow-right",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 Sle=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],wle=Ei("arrow-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 Mle=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],yv=Ei("check",Mle);/**
 * @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 9 6 6 6-6",key:"qrunsl"}]],Wr=Ei("chevron-down",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 Ele=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],h8=Ei("chevron-left",Ele);/**
 * @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=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vg=Ei("chevron-right",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 Ale=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],p8=Ei("chevron-up",Ale);/**
 * @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=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Rle=Ei("chevrons-left",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=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Ple=Ei("chevrons-right",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 Dle=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ile=Ei("circle-check",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 Ole=[["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"}]],Lle=Ei("circle-x",Ole);/**
 * @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=[["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=Ei("copy",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 jle=[["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"}]],Fle=Ei("database",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=[["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"}]],Ble=Ei("file-code-corner",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 Hle=[["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"}]],Vle=Ei("folder-open",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 Gle=[["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"}]],Wle=Ei("folder",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 $le=[["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"}]],m8=Ei("grip-vertical",$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 qle=[["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"}]],Xle=Ei("layers",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=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Kd=Ei("loader-circle",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 Kle=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],jN=Ei("menu",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 Zle=[["path",{d:"M5 12h14",key:"1ays0h"}]],Qle=Ei("minus",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 Jle=[["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"}]],ece=Ei("panel-left-close",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 tce=[["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"}]],nce=Ei("panel-right-close",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.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"}]],pG=Ei("pencil",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 ice=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],sp=Ei("plus",ice);/**
 * @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:"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"}]],mG=Ei("settings",sce);/**
 * @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 oce=[["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"}]],ow=Ei("sliders-horizontal",oce);/**
 * @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 ace=[["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"}]],lce=Ei("trash-2",ace);/**
 * @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 cce=[["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"}]],uce=Ei("triangle-alert",cce);/**
 * @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 dce=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ed=Ei("x",dce);function qf({...t}){return p.jsx(aB,{"data-slot":"dialog",...t})}function sT({...t}){return p.jsx(lB,{"data-slot":"dialog-trigger",...t})}function fce({...t}){return p.jsx(cB,{"data-slot":"dialog-portal",...t})}function hce({className:t,...e}){return p.jsx(uB,{"data-slot":"dialog-overlay",className:Nt("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 Xf({className:t,children:e,...n}){return p.jsxs(fce,{children:[p.jsx(hce,{}),p.jsxs(dB,{"data-slot":"dialog-content",className:Nt("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(ed,{}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Fd({className:t,...e}){return p.jsx("div",{"data-slot":"dialog-header",className:Nt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function g8({className:t,...e}){return p.jsx("div",{"data-slot":"dialog-footer",className:Nt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function Ud({className:t,...e}){return p.jsx(fB,{"data-slot":"dialog-title",className:Nt("text-lg leading-none font-semibold",t),...e})}function Ng({className:t,...e}){return p.jsx(hB,{"data-slot":"dialog-description",className:Nt("text-muted-foreground text-sm",t),...e})}function fl({...t}){return p.jsx(Tse,{"data-slot":"dropdown-menu",...t})}function hl({...t}){return p.jsx(Ese,{"data-slot":"dropdown-menu-trigger",...t})}function pl({className:t,align:e="start",sideOffset:n=4,...r}){return p.jsx(Cse,{children:p.jsx(Ase,{"data-slot":"dropdown-menu-content",sideOffset:n,align:e,className:Nt("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(Rse,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:Nt("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 pi({className:t,children:e,checked:n,...r}){return p.jsxs(kse,{"data-slot":"dropdown-menu-checkbox-item",className:Nt("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(Pse,{children:p.jsx(yv,{})})}),e]})}function H1({className:t,inset:e,...n}){return p.jsx(Nse,{"data-slot":"dropdown-menu-label","data-inset":e,className:Nt("text-muted-foreground px-1.5 py-1 text-xs font-medium data-[inset]:pl-8",t),...n})}function ul({className:t,...e}){return p.jsx(Dse,{"data-slot":"dropdown-menu-separator",className:Nt("bg-border -mx-1 my-1 h-px",t),...e})}function pce({...t}){return p.jsx(Ise,{"data-slot":"dropdown-menu-sub",...t})}function mce({className:t,inset:e,children:n,...r}){return p.jsxs(Ose,{"data-slot":"dropdown-menu-sub-trigger","data-inset":e,className:Nt("focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground 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 flex cursor-default items-center outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...r,children:[n,p.jsx(Vg,{className:"ml-auto"})]})}function gce({className:t,...e}){return p.jsx(Lse,{"data-slot":"dropdown-menu-sub-content",className:Nt("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-[96px] rounded-md p-1 shadow-lg ring-1 duration-100 z-50 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden",t),...e})}const HD=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,VD=ZV,v8=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return VD(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=e,o=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=HD(d)||HD(h);return i[c][g]}),a=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,...a}[_]):{...s,...a}[_]===w})?[...c,h,g]:c},[]);return VD(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},vce=v8("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:Nt(vce({variant:e,size:n,className:t})),...i})}function V0({className:t,type:e,...n}){return p.jsx("input",{type:e,"data-slot":"input",className:Nt("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 xce({className:t,...e}){return p.jsx(jse,{"data-slot":"label",className:Nt("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 al({className:t,...e}){return p.jsx(Kd,{role:"status","aria-label":"Loading",className:Nt("size-4 animate-spin",t),...e})}function bv({className:t,children:e,...n}){return p.jsxs(uoe,{"data-slot":"scroll-area",className:Nt("relative",t),...n,children:[p.jsx(doe,{"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(yce,{}),p.jsx(foe,{})]})}function yce({className:t,orientation:e="vertical",...n}){return p.jsx(eV,{"data-slot":"scroll-area-scrollbar","data-orientation":e,orientation:e,className:Nt("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(iV,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function oT({...t}){return p.jsx(Yse,{"data-slot":"popover",...t})}function aT({...t}){return p.jsx(Kse,{"data-slot":"popover-trigger",...t})}function lT({className:t,align:e="center",sideOffset:n=4,...r}){return p.jsx(Zse,{children:p.jsx(Qse,{"data-slot":"popover-content",align:e,sideOffset:n,className:Nt("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(Rne,{"data-slot":"alert-dialog",...t})}function bce({...t}){return p.jsx(kne,{"data-slot":"alert-dialog-portal",...t})}function _ce({className:t,...e}){return p.jsx(Pne,{"data-slot":"alert-dialog-overlay",className:Nt("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(bce,{children:[p.jsx(_ce,{}),p.jsx(Dne,{"data-slot":"alert-dialog-content","data-size":e,className:Nt("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:Nt("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:Nt("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 Sce({className:t,...e}){return p.jsx("div",{"data-slot":"alert-dialog-media",className:Nt("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(Lne,{"data-slot":"alert-dialog-title",className:Nt("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(zne,{"data-slot":"alert-dialog-description",className:Nt("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(Ine,{"data-slot":"alert-dialog-action",className:Nt(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(One,{"data-slot":"alert-dialog-cancel",className:Nt(t),...r})})}const x8={},wce=Symbol((x8?"production":void 0)!=="production"?"RESET":""),gG=t=>typeof(t==null?void 0:t.then)=="function";function Mce(t=()=>{try{return window.localStorage}catch(n){(x8?"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 gG(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)}},o=l=>(c,d,h)=>l(c,g=>{let v;try{v=JSON.parse(g||"")}catch{v=h}d(v)});let a;try{a=(n=t())==null?void 0:n.subscribe}catch{}return!a&&typeof window<"u"&&typeof window.addEventListener=="function"&&window.Storage&&(a=(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)}}),a&&(s.subscribe=o(a)),s}const Tce=Mce();function No(t,e,n=Tce,r){const i=ei(e);return(x8?"production":void 0)!=="production"&&(i.debugPrivate=!0),i.onMount=o=>{o(n.getItem(t,e));let a;return n.subscribe&&(a=n.subscribe(t,o,e)),a},ei(o=>o(i),(o,a,l)=>{const c=typeof l=="function"?l(o(i)):l;return c===wce?(a(i,e),n.removeItem(t)):gG(c)?c.then(d=>(a(i,d),n.setItem(t,d))):(a(i,c),n.setItem(t,c))})}const vG=ei(!1),xG=ei(!1),yG=ei(!1),ml=No("selected-run-path",null),cT=No("visible-runs",[]),bG=ei(!1),_G=ei(!1);function ms(t){const e=ei({});return ei(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 o=n(e),a=Object.prototype.hasOwnProperty.call(o,s)?o[s]:t,l=typeof i=="function"?i(a):i;r(e,{...o,[s]:l})})}const SG=ei(!1),Ece=No("overview-show-ema",!1),Cce=No("overview-ema-span",10),Ace=No("overview-show-all-runs",!1),Nce=[{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"}],Rce=No("overview-plots",Nce),kce=ei(!1),Pce=ei(10),Dce=ei("step"),Ice=ei(!1),Oce=ei(100),Lce=ei(3600),zce=ei(0),jce=ei("all"),wG=ei({}),Fce=ms(0),Uce=ei(30),uT=ms(null),GD=ms(null),Bce=ei(0),Hce=ei(0),dT=ei(!0),Vce=ei(!0),MG=ei(!1),Gce=ei(14),Wce=ei(0),$ce=No("inference-max-lanes",128),TG=ms(null),EG=ms(null),qce=No("rollouts-selected-metrics",[]),Xce=No("rollouts-discarded-selected-metrics",[]),y8=No("rollouts-metrics-sidebar-open",!0),LC=No("rollouts-discarded-metrics-sidebar-open",!0),b8=No("rollouts-sample-picker-sidebar-open",!0),zC=No("rollouts-discarded-sample-picker-sidebar-open",!0),CG=ms(null),WD=ms(null),AG=ms(null),$D=ms(null),NG=ms(null),qD=ms(null),RG=ei("groups"),Yce=No("rollouts-sample-picker-display-metrics",["gen_length_avg","reward"]),Kce=No("rollouts-sample-picker-tooltips",!0),Zce=No("rollouts-sample-view-metrics",[]),XD=ei("groups"),YD=ms(null),Qce=ms(null),KD=ms(null),ZD=ms(null),QD=ms(null),jC=No("evals-sample-picker-sidebar-open",!0),JD=ei("groups"),FC=No("evals-metrics-sidebar-open",!0),Jce=No("evals-selected-metrics",[]),eue=ei("metrics"),tue=ms(0),nue=ei(60),rue=ei(!0),iue=ei(!1),sue=ei(1),oue=ms(0),aue=ms("separated"),lue=ms(!0),cue=ms(!0),uue=ms(!0),due=ms(!0),fue=ms("combined"),hue=ms("combined"),pue=ms(!0),fT=ei(null),hT=No("rollouts-render-options",["markdown","latex","code"]),pT=No("rollouts-format-think",!0),kG=ei(null),Rr="",Sa=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"},e4={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"},LM="#0284c7",BC="#10b981",qN="#ababab",PG="#c9c9c9",eI={request:LM,weight_broadcast:"#f97316"},V1="#e6e9ed",_8="#6b7280";function S8(t){if(UC[t])return UC[t];for(const[e,n]of Object.entries(UC))if(t.startsWith(e))return n;return _8}function f2(t){if(e4[t])return e4[t];if(t.includes("/")){const e=t.split("/")[0];if(e4[e])return e4[e]}return _8}function DG(t){return eI[t]?eI[t]:_8}function w8(t){return t.replace(/_step_\d+$/,"").replace(/_/g," ")}function IG(t,e,n,r){const i=t.replace(/_/g," ").split(" ").map(o=>o.charAt(0).toUpperCase()+o.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 fm(){return ps({queryKey:["runs"],queryFn:async()=>{const t=await fetch(`${Rr}/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:Sa}})}function mue(t=!0){return ps({queryKey:["removed-runs"],queryFn:async()=>{const e=await fetch(`${Rr}/removed-runs`);if(!e.ok)throw new Error("Failed to fetch removed runs");return e.json()},enabled:t})}function gue(t=!0){return ps({queryKey:["known-projects"],queryFn:async()=>{const e=await fetch(`${Rr}/known-projects`);if(!e.ok)throw new Error("Failed to fetch known projects");return e.json()},enabled:t})}function vue(t,e,n,r){return ps({queryKey:["rollouts",t,e],queryFn:async()=>{const i=await fetch(`${Rr}/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:Sa})}function xue(t,e,n,r){return ps({queryKey:["rollouts-discarded",t,e],queryFn:async()=>{const i=await fetch(`${Rr}/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:Sa})}function yue(t,e,n,r,i){return ps({queryKey:["evals",t,e,n],queryFn:async()=>{const s=await fetch(`${Rr}/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:Sa})}function OG(t,e,n,r,i){return ps({queryKey:["sample-details",t,e,n,i??!1],queryFn:async()=>{const s=await fetch(`${Rr}/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 M8(t,e,n){const r=T.useMemo(()=>{const s=new Set,o=[];for(const a of e){const l=`${a.group_id}:${a.sample_idx}`;s.has(l)||(s.add(l),o.push(a))}return o.sort((a,l)=>a.group_id-l.group_id||a.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(`${Rr}/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 td(t,e,n){return ps({queryKey:["run-summary",t],queryFn:async()=>{const r=await fetch(`${Rr}/run-summary/${encodeURIComponent(t)}`);if(!r.ok)throw new Error("Failed to fetch run summary");return r.json()},enabled:e&&!!t,refetchInterval:n?Sa:!1})}function tI(t,e){return ps({queryKey:["run-code-tree",t],queryFn:async()=>{const n=await fetch(`${Rr}/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 nI(t,e,n){return ps({queryKey:["run-code-file",t,e],queryFn:async()=>{const r=await fetch(`${Rr}/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 bue(t,e,n){return ps({queryKey:["run-code-diff-summary",t,e],queryFn:async()=>{const r=await fetch(`${Rr}/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 _ue(t,e,n,r,i){return ps({queryKey:["timeline-paginated",t,e,n],queryFn:async()=>{const s=await fetch(`${Rr}/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:Sa,placeholderData:Xd,gcTime:0})}function Sue(t,e,n){return ps({queryKey:["inference-events-by-group",t,e],queryFn:async()=>{const r=await fetch(`${Rr}/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 wue(t,e,n,r,i){return ps({queryKey:["trainer-breakdown-events",t,e,n,r],queryFn:async()=>{const s=await fetch(`${Rr}/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 Mue(t,e,n,r,i,s,o){const a=n.filter(l=>Number.isFinite(l.rank));return cee({queries:a.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(`${Rr}/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:Sa,placeholderData:Xd}))})}function Tue(t,e,n,r,i,s){return ps({queryKey:["gpu-metrics-paginated",t,e,n,r],queryFn:async()=>{const o=await fetch(`${Rr}/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(!o.ok)throw new Error("Failed to fetch paginated GPU metrics");return o.json()},enabled:i&&!!t,refetchInterval:Sa,placeholderData:Xd})}function Eue(t,e,n,r,i,s,o,a){return ps({queryKey:["cpu-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${Rr}/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:o&&!!t,refetchInterval:Sa,placeholderData:Xd})}function Cue(t,e,n,r,i,s,o,a){return ps({queryKey:["vllm-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${Rr}/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:o&&!!t,refetchInterval:Sa,placeholderData:Xd})}function Aue(t,e,n,r,i){const s=py(),o=T.useRef([]),a=t.join("\0"),l=o.current.join("\0");if(a!==l){const c=o.current;if(c.length>0&&t.length<c.length){const d=new Set(c);if(t.every(g=>d.has(g))){const g=["step-metrics-multi",c,e,i],v=s.getQueryData(g);if(v){const b=new Set(t),_=["step-metrics-multi",t,e,i];s.setQueryData(_,{runs:v.runs.filter(w=>b.has(w.run_path))})}}}o.current=t}return ps({queryKey:["step-metrics-multi",t,e,i],queryFn:async()=>{const c={run_paths:t,metric_names:e,limit:1e5};i&&Object.keys(i).length>0&&(c.tag_filters=i);const d=await fetch(`${Rr}/step-metrics/multi`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)throw new Error("Failed to fetch step metrics (multi-run)");return d.json()},enabled:n&&t.length>0,refetchInterval:r?Sa:!1,staleTime:Sa})}function zr(t,e,n){return ps({queryKey:["step-times",t],queryFn:async()=>{const r=await fetch(`${Rr}/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?Sa:!1})}function LG(t,e,n,r){return ps({queryKey:["step-metric-single",t,e],queryFn:async()=>{const i=await fetch(`${Rr}/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?Sa:!1,placeholderData:Xd})}function Nue(t,e,n,r,i,s){return ps({queryKey:["eval-step-metric-single",t,e,n,s??null],queryFn:async()=>{const o={run_path:t,eval_name:e,metric_names:[n],limit:1e5};s!==void 0&&(o.sample_idx=s);const a=await fetch(`${Rr}/eval-step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!a.ok)throw new Error("Failed to fetch eval step metric");return a.json()},enabled:r&&!!t&&!!e&&!!n,refetchInterval:i?Sa:!1,placeholderData:Xd})}function Rue(t,e,n,r,i){const s=py(),o=T.useRef([]),a=t.join("\0"),l=o.current.join("\0");if(a!==l){const c=o.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))})}}}o.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(`${Rr}/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?Sa:!1,staleTime:Sa})}function kue(t,e,n,r){return ps({queryKey:["step-histogram",t,e,n],queryFn:async()=>{const i=await fetch(`${Rr}/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 zG(t,e,n,r){return ps({queryKey:["step-distribution-over-time",t,e],queryFn:async()=>{const i=await fetch(`${Rr}/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?Sa:!1,staleTime:3e4,placeholderData:Xd})}function jG(){return ps({queryKey:["custom-metrics-layout"],queryFn:async()=>{const t=await fetch(`${Rr}/custom-metrics-layout`);if(!t.ok)throw new Error("Failed to fetch custom metrics layout");return t.json()},staleTime:6e4})}function X0(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 op(t){return`${t.toFixed(0)}s`}function Xu(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 FG(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`${FG(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 rI(t){const e=`${FG(t)}s`;return t<60?e:`${mT(t)} <span class="text-muted-foreground font-normal">(${e})</span>`}function tv(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 G1(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)),o=Math.floor(i/(1e3*60*60)),a=Math.floor(i/(1e3*60*60*24)),l=Math.floor(a/30),c=Math.floor(a/365);return c>=1?`${c}y`:l>=1?`${l}mo`:a>=1?`${a}d`:o>=1?`${o}h`:`${Math.max(1,s)}m`}const d1=16,Pue=6,iI=4,Due=2;function UG(t,e=d1){const n=Math.max(Pue,e);if(!t||t.length<=n)return{prefix:t,suffix:"",isTruncated:!1};const r=Math.max(Due,n-iI);return{prefix:t.slice(0,r),suffix:t.slice(-iI),isTruncated:!0}}function Ki({...t}){return p.jsx(ste,{"data-slot":"collapsible",...t})}function Zi({...t}){return p.jsx(ote,{"data-slot":"collapsible-trigger",...t})}function Qi({...t}){return p.jsx(ate,{"data-slot":"collapsible-content",...t})}function Iue(t,e=0){try{return JSON.stringify(t,(r,i)=>i&&typeof i=="object"&&!Array.isArray(i)?Object.keys(i).sort().reduce((s,o)=>(s[o]=i[o],s),{}):i,e)??String(t)}catch{return String(t)}}function Oue(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 Lue(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"?Iue(t,2):String(t)}function zue(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 sI(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 jue(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=Oue(c),h=l==="environments"?zue(d):d;let g=!1;for(const v of e)if(v.match(l)){n.get(v.key).items.push({key:l,displayKey:sI(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:sI(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"],o=[];for(const l of i){const c=n.get(l);c&&c.items.length>0&&o.push(c)}const a=[];for(const l of s)if(l==="hardware")o.length>0&&a.push({key:"hardware",label:"Hardware & Environment",items:[],subcategories:o});else{const c=n.get(l);c&&c.items.length>0&&a.push(c)}return a}function Fue({displayKey:t,value:e}){const n=Lue(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 Uue="ml-[22px]",Bue="ml-[38px]";function BG({category:t,defaultOpen:e=!1,nested:n=!1,collapseAllSignal:r=0,expandAllSignal:i=0}){const[s,o]=T.useState(e),[a,l]=T.useState(r),[c,d]=T.useState(i);r!==a&&(l(r),o(!1)),i!==c&&(d(i),o(!0));const h=t.subcategories&&t.subcategories.length>0;return p.jsxs(Ki,{open:s,onOpenChange:o,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:Nt("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(Wr,{className:Nt("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(BG,{category:g,nested:!0,collapseAllSignal:r,expandAllSignal:i},g.key))}):p.jsx("div",{className:Nt("mt-1",n?Bue:Uue),children:t.items.map(g=>p.jsx(Fue,{displayKey:g.displayKey,value:g.value},g.key))})})]})}function HG({config:t,collapseAllSignal:e=0,expandAllSignal:n=0}){const r=T.useMemo(()=>jue(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(BG,{category:s,defaultOpen:i.has(s.key),collapseAllSignal:e,expandAllSignal:n},s.key))})}const VG="#e67439",Hue="linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",Vue=["#865ed6","#f07fdd","#e67439","#87cec0","#dc4cdc","#ffb83e","#5ac5db","#239487","#fab796","#9bc750","#ad6f51","#c2337a","#a2a9ad","#538ae6","#f1444f","#479a60"];function f1(t){return Math.max(0,Math.min(1,t))}function Gg(t){return Math.max(0,Math.min(255,Math.round(t)))}function h2({r:t,g:e,b:n}){const r=i=>i.toString(16).padStart(2,"0");return`#${r(Gg(t))}${r(Gg(e))}${r(Gg(n))}`}function T8(t){const e=t.trim(),n=/^#([0-9a-f]{3})$/i.exec(e);if(n){const[i,s,o]=n[1].split("");return{r:Number.parseInt(i+i,16),g:Number.parseInt(s+s,16),b:Number.parseInt(o+o,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 Gue({r:t,g:e,b:n}){const r=t/255,i=e/255,s=n/255,o=Math.max(r,i,s),a=Math.min(r,i,s),l=o-a;let c=0;return l!==0&&(o===r?c=60*((i-s)/l%6):o===i?c=60*((s-r)/l+2):c=60*((r-i)/l+4)),c<0&&(c+=360),{h:c,s:o===0?0:l/o,v:o}}function Wue({h:t,s:e,v:n}){const r=(t%360+360)%360,i=f1(e),s=f1(n),o=s*i,a=o*(1-Math.abs(r/60%2-1)),l=s-o;let c=0,d=0,h=0;return r<60?(c=o,d=a):r<120?(c=a,d=o):r<180?(d=o,h=a):r<240?(d=a,h=o):r<300?(c=a,h=o):(c=o,h=a),{r:Gg((c+l)*255),g:Gg((d+l)*255),b:Gg((h+l)*255)}}function $ue(t,e){const n=T8(t);if(!n)return"#000000";const r=f1(1-e);return h2({r:n.r*r,g:n.g*r,b:n.b*r})}function w_(t,e=VG){const n=T8(t);return n?h2(n):e}function que({value:t,onChange:e,className:n}){const r=T.useMemo(()=>w_(t,VG),[t]),i=T.useMemo(()=>T8(r),[r]),s=T.useMemo(()=>Gue(i),[i]),[o,a]=T.useState(r.slice(1).toUpperCase());T.useEffect(()=>{a(r.slice(1).toUpperCase())},[r]);const l=T.useCallback(v=>{const b=h2(Wue(v));e(b)},[e]),c=T.useCallback(v=>{const b=v.currentTarget.getBoundingClientRect(),_=f1((v.clientX-b.left)/b.width),w=f1((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(),_=f1((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=`#${o.replace(/[^0-9a-f]/gi,"")}`,_=w_(b,r);a(_.slice(1).toUpperCase()),_!==r&&e(_)},[o,r,e]),g=T.useCallback((v,b)=>{const _=Number.parseInt(b,10);if(Number.isNaN(_))return;const w={...i,[v]:Gg(_)};e(h2(w))},[e,i]);return p.jsxs("div",{className:Nt("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:Hue},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(V0,{value:o,onChange:v=>{a(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(V0,{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:Vue.map(v=>p.jsx("button",{type:"button",className:Nt("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:$ue(v,.2)},onClick:()=>e(v),"aria-label":`Use color ${v}`},v))})]})}const GG=[{key:"pausing_syncs",label:"Pausing syncs"},{key:"exporting",label:"Exporting database"},{key:"importing",label:"Compressing data"},{key:"finalizing",label:"Finalizing"}],Xue=GG.map(t=>t.key);function Yue(t){return Xue.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 Kue({open:t,onOpenChange:e}){const[n,r]=T.useState(null),[i,s]=T.useState(!1),[o,a]=T.useState(null),l=T.useRef(null),c=o!=null&&o.status!=="idle"&&o.status!=="done"&&o.status!=="error",d=T.useCallback(async()=>{s(!0);try{const S=await fetch(`${Rr}/database-info`);if(S.ok){const E=await S.json();r(E.size_bytes)}}catch{}finally{s(!1)}},[]);T.useEffect(()=>(t&&(d(),a(null)),()=>{l.current&&clearInterval(l.current),l.current=null}),[t,d]);const h=async()=>{try{const S=await fetch(`${Rr}/compact-database`,{method:"POST"});if(!S.ok){const E=await S.json().catch(()=>({}));a({status:"error",error:E.detail||"Failed to start compaction",size_before:null,size_after:null});return}a({status:"pausing_syncs",error:null,size_before:null,size_after:null}),l.current=setInterval(async()=>{try{const E=await fetch(`${Rr}/compact-database/status`);if(E.ok){const A=await E.json();a(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){a({status:"error",error:S instanceof Error?S.message:"Unknown error",size_before:null,size_after:null})}},g=S=>{c&&!S||e(S)},v=o?Yue(o.status):-1,b=(o==null?void 0:o.status)==="done",_=(o==null?void 0:o.status)==="error",w=o!=null&&o.status!=="idle";return p.jsx(qf,{open:t,onOpenChange:g,children:p.jsxs(Xf,{className:Nt("sm:max-w-md",c&&"[&>[data-slot=dialog-close]]:hidden"),onInteractOutside:S=>{c&&S.preventDefault()},onEscapeKeyDown:S=>{c&&S.preventDefault()},children:[p.jsxs(Fd,{children:[p.jsxs(Ud,{className:"flex items-center gap-2",children:[p.jsx(Fle,{className:"h-4 w-4"}),"Database"]}),!w&&p.jsx(Ng,{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(al,{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:[GG.map((S,E)=>{const A=S.key===o.status,N=b||v>E||_&&v>E,I=_&&S.key===o.status;return p.jsxs("div",{className:"flex items-center gap-2.5",children:[N?p.jsx(Ile,{className:"h-4 w-4 text-green-500 shrink-0"}):I?p.jsx(Lle,{className:"h-4 w-4 text-destructive shrink-0"}):A?p.jsx(al,{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:Nt("text-sm",N&&"text-muted-foreground",A&&!_&&"text-foreground font-medium",I&&"text-destructive font-medium",!N&&!A&&!I&&"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&&o.size_before!=null&&o.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(o.size_before)})," → ",p.jsx("span",{className:"font-medium text-green-600 dark:text-green-400",children:HC(o.size_after)}),p.jsxs("span",{className:"text-muted-foreground ml-1.5",children:["(",Math.round((1-o.size_after/o.size_before)*100),"% reduction)"]})]})}),_&&o.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:o.error}),p.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"The original database has been restored."})]})]}),p.jsxs(g8,{children:[!w&&p.jsx(Tn,{onClick:h,disabled:i||n==null,children:"Compress Database"}),(b||_)&&p.jsx(Tn,{onClick:()=>e(!1),children:"Close"})]})]})})}function t4({name:t,className:e,maxChars:n=d1}){const r=e??"text-xs font-sans",{isTruncated:i,prefix:s,suffix:o}=UG(t,n);return i?p.jsxs(gv,{delayDuration:300,children:[p.jsx(vv,{asChild:!0,children:p.jsxs("span",{className:Nt("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:o})]})}),p.jsx(xv,{side:"top",className:"max-w-56 break-all text-xs font-sans",children:t})]}):p.jsx("span",{className:Nt("truncate",r),children:s})}function Zue(){const{pathname:t}=uh(),e=py(),[n,r]=un(ml),[i,s]=un(cT),[o,a]=un(vG),[l,c]=un(xG),d=jd(fT),h=jd(SG),[g,v]=T.useState(!1),[b,_]=un(yG),[w,S]=T.useState(""),[E,A]=T.useState(!1),[N,I]=T.useState(null),[P,L]=T.useState(null),[R,O]=T.useState(!1),[F,U]=T.useState(""),[q,B]=T.useState(!1),[Z,G]=T.useState(!1),[$,K]=T.useState(null),[Y,J]=T.useState(null),[H,z]=T.useState("removed_at"),[X,V]=T.useState("desc"),[ie,ae]=T.useState(null),[re,ce]=T.useState(null),[oe,fe]=T.useState(null),[me,ye]=T.useState(null),[Ee,Ge]=T.useState(!1),[_e,De]=T.useState(""),[he,Le]=T.useState(null),[ne,We]=T.useState(!1),[je,be]=T.useState(null),[Xe,le]=T.useState({}),te=jd(_G),Se=jd(bG),{data:ve,isLoading:ge}=fm(),{data:Te,isLoading:He}=mue(g),{data:pe,refetch:qe}=gue(b),xt=T.useRef(new Map);T.useEffect(()=>{if(!(ve!=null&&ve.runs))return;const Ue=xt.current,ct=[];for(const St of ve.runs){const kt=Ue.get(St.run_id);kt!=null&&kt.is_syncing&&!St.is_syncing&&ct.push(St.run_id),kt!=null&&kt.is_tracking&&!St.is_tracking&&ct.push(St.run_id),Ue.set(St.run_id,{is_syncing:St.is_syncing,is_tracking:St.is_tracking})}if(ct.length>0){const St=[...new Set(ct)];for(const kt of St)e.invalidateQueries({predicate:Ut=>{const Xt=Ut.queryKey;return Array.isArray(Xt)?Xt.some(hn=>!!(hn===kt||Array.isArray(hn)&&hn.includes(kt))):!1}});e.invalidateQueries({queryKey:["runs"]})}},[ve==null?void 0:ve.runs,e]),T.useEffect(()=>{if(!(ve!=null&&ve.runs)||!n)return;const Ue=ve.runs.find(ct=>ct.run_id===n);Ue&&(te(Ue.is_syncing),Se(Ue.is_tracking))},[ve==null?void 0:ve.runs,n,te,Se]),T.useEffect(()=>{t!=="/"&&h(!1)},[t,h]),T.useEffect(()=>{if(!(ve!=null&&ve.runs))return;const Ue=new Set(ve.runs.map(ct=>ct.run_id));s(ct=>{const St=ct.filter(kt=>Ue.has(kt));return St.length===ct.length?ct:St}),n&&!Ue.has(n)&&(r(null),te(!1),Se(!1))},[ve==null?void 0:ve.runs,n,r,s,te,Se]);const nt=T.useMemo(()=>{const Ue=(Te==null?void 0:Te.runs)??[];return Ue.length===0?Ue:[...Ue].sort((ct,St)=>{const kt=H;let Ut,Xt;if(kt==="run_id"?(Ut=ct.run_id.split("/").pop()??ct.run_id,Xt=St.run_id.split("/").pop()??St.run_id):(Ut=ct[kt],Xt=St[kt]),Ut==null&&Xt==null)return 0;if(Ut==null)return 1;if(Xt==null)return-1;const hn=Ut.localeCompare(Xt);return X==="asc"?hn:-hn})},[Te==null?void 0:Te.runs,H,X]),tt=Ue=>{H===Ue?V(ct=>ct==="asc"?"desc":"asc"):(z(Ue),V("asc"))},Fe=async Ue=>{Ue.preventDefault();const ct=q?{use_netrc:!0}:{api_key:F.trim(),use_netrc:!1};if(!(!q&&!F.trim())){G(!0);try{const St=await fetch(`${Rr}/wandb-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ct)});if(!St.ok){const kt=await St.json();throw new Error(kt.detail||"Failed to configure W&B")}a(!0),e.invalidateQueries({queryKey:["runs"]}),c(!1),U("")}catch(St){console.error("Failed to configure W&B:",St)}finally{G(!1)}}},we=Ue=>{v(!1),r(Ue),fetch(`${Rr}/add-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ue})}).then(ct=>{if(!ct.ok)return ct.json().then(St=>{throw new Error(St.detail||"Failed to add run")})}).then(()=>{e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}).catch(ct=>{console.error("Failed to add run:",ct)})},ke=async()=>{const Ue=w.trim();if(Ue){A(!0),I(null);try{const ct=await fetch(`${Rr}/add-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:Ue})});if(!ct.ok){const St=await ct.json();I(St.detail||"Failed to add project");return}S(""),_(!1),qe(),e.invalidateQueries({queryKey:["runs"]})}catch{I("Failed to add project")}finally{A(!1)}}},Ze=async Ue=>{L(Ue);try{const ct=await fetch(`${Rr}/remove-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:Ue})});if(!ct.ok){const St=await ct.json();throw new Error(St.detail||"Failed to remove project")}qe()}catch(ct){console.error("Failed to remove project:",ct)}finally{L(null)}},Ne=async Ue=>{if(Ue){K(Ue);try{const ct=await fetch(`${Rr}/remove-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ue})});if(!ct.ok){const St=await ct.json();throw new Error(St.detail||"Failed to remove run")}s(St=>St.filter(kt=>kt!==Ue)),n===Ue&&r(null),e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}catch(ct){console.error("Failed to remove run:",ct)}finally{K(null),J(null)}}},Ke=Ue=>{s(ct=>ct.includes(Ue)?ct.filter(St=>St!==Ue):[...ct,Ue])},it=T.useCallback((Ue,ct)=>{e.setQueryData(["runs"],St=>St&&{...St,runs:St.runs.map(kt=>kt.run_id===Ue?{...kt,color:ct}:kt)})},[e]),ht=T.useCallback(async(Ue,ct,St)=>{const kt=w_(ct,St);if(kt.toLowerCase()!==St.toLowerCase()){it(Ue,kt);try{const Ut=await fetch(`${Rr}/set-run-color`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ue,color:kt})});if(!Ut.ok){let Xt="Failed to update run color";try{Xt=(await Ut.json()).detail??Xt}catch{}throw new Error(Xt)}}catch(Ut){console.error("Failed to update run color:",Ut),it(Ue,St)}finally{e.invalidateQueries({queryKey:["runs"]})}}},[e,it]),Je=T.useCallback((Ue,ct,St)=>{if(ct){be(Ue),le(Ut=>Ut[Ue]===St?Ut:{...Ut,[Ue]:St});return}be(Ut=>Ut===Ue?null:Ut);const kt=Xe[Ue];kt&&ht(Ue,kt,St),le(Ut=>{if(!(Ue in Ut))return Ut;const Xt={...Ut};return delete Xt[Ue],Xt})},[ht,Xe]),$e=T.useCallback(async Ue=>{fe(Ue);try{const ct=ve==null?void 0:ve.runs.find(kt=>kt.run_id===Ue);ct!=null&&ct.is_tracking&&await fetch(`${Rr}/stop-tracking`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ue})});const St=await fetch(`${Rr}/delete-run-data`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ue})});if(!St.ok){const kt=await St.json();throw new Error(kt.detail||"Failed to delete run data")}await fetch(`${Rr}/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ue})}),e.invalidateQueries({queryKey:["run-summary",Ue]}),e.invalidateQueries({queryKey:["runs"]})}catch(ct){console.error("Failed to force full resync:",ct)}finally{fe(null),ce(null)}},[ve==null?void 0:ve.runs,e]),Ae=T.useCallback(async Ue=>{ye(Ue);try{const ct=await fetch(`${Rr}/sync-evals-after-training`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Ue})});if(!ct.ok){const St=await ct.json();throw new Error(St.detail||"Failed to start evals sync")}e.invalidateQueries({queryKey:["run-summary",Ue]}),e.invalidateQueries({queryKey:["runs"]})}catch(ct){console.error("Failed to sync evals after training:",ct)}finally{ye(null)}},[e]),Oe=_e.trimStart().toLowerCase().startsWith("config:"),Ye=T.useCallback(async()=>{const ct=_e.trimStart().slice(7).trim();if(ct){We(!0);try{const St=await fetch(`${Rr}/search-runs-by-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filters:ct})});if(!St.ok){Le([]);return}const kt=await St.json();Le(kt.run_ids??[])}catch{Le([])}finally{We(!1)}}},[_e]);T.useEffect(()=>{Oe||Le(null)},[Oe]);const st=(ve==null?void 0:ve.runs)||[],Rt=ve==null?void 0:ve.discovery,yt=(ve==null?void 0:ve.has_wandb_key)??o,Tt=(ve==null?void 0:ve.has_netrc_wandb_key)??!1,Et=(ve==null?void 0:ve.wandb_key_source)??"unconfigured";T.useEffect(()=>{l&&B(Et==="netrc")},[l,Et]);const Dt=[{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(YM,{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:Dt.map(Ue=>p.jsx(YM,{to:Ue.href,onClick:()=>{Ue.href==="/"&&h(!1)},className:Nt("rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",Ue.isActive&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),children:Ue.title},Ue.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(V0,{type:"text",placeholder:"Search runs…",value:_e,onChange:Ue=>De(Ue.target.value),onKeyDown:Ue=>{Ue.key==="Enter"&&Oe&&(Ue.preventDefault(),Ye())},className:Nt("h-6 text-[11px] w-full placeholder:text-muted-foreground/60 placeholder:text-[10px]",Oe&&"pr-10")}),Oe&&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:Ye,disabled:ne,children:ne?p.jsx(al,{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"," ",yt?p.jsx("span",{className:"!text-green-500 ml-1",children:"added"}):p.jsx("span",{className:"!text-red-500 ml-1",children:"missing"})]}),p.jsx(ul,{}),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:()=>Ge(Ue=>!Ue),children:["Only Show Selected",p.jsx(yv,{className:Nt("h-3.5 w-3.5",Ee?"opacity-100":"opacity-0")})]}),p.jsx(ul,{}),p.jsx(_c,{className:"text-xs flex items-center gap-1.5",onClick:()=>O(!0),children:"Database"})]})]})]}),(Rt==null?void 0:Rt.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(al,{className:"h-3 w-3 shrink-0"}),(Rt==null?void 0:Rt.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(bv,{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(al,{className:"h-4 w-4"})}):p.jsxs("div",{className:"flex flex-col",children:[st.filter(Ue=>{if(Ee&&n!==Ue.run_id&&!i.includes(Ue.run_id))return!1;if(Oe){if(he!==null&&!he.includes(Ue.run_id))return!1}else if(_e.trim()){const ct=_e.trim().toLowerCase(),St=(Ue.name||"").toLowerCase(),kt=Ue.run_id.toLowerCase();if(!St.includes(ct)&&!kt.includes(ct))return!1}return!0}).map(Ue=>{const ct=n===Ue.run_id,St=ct||i.includes(Ue.run_id),kt=Xe[Ue.run_id],Ut=w_(kt??Ue.color,Ue.color),Xt=Ue.last_rollout_step===-1&&!Ue.is_syncing&&!Ue.is_tracking,hn=Number(Ue.is_tracking)+Number(Ue.is_syncing),Lt=hn>=2?d1-4:hn===1?d1-2:d1-1,on=Ue.name||Ue.run_id.split("/").pop()||Ue.run_id;return p.jsxs("div",{className:Nt("group flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors w-full cursor-pointer",!ct&&"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [--run-item-bg:var(--sidebar)] hover:[--run-item-bg:var(--sidebar-accent)]",ct&&"bg-[var(--sidebar-selected)] text-sidebar-accent-foreground [--run-item-bg:var(--sidebar-selected)]"),onClick:()=>r(Ue.run_id),onMouseEnter:()=>{St&&d(Ue.run_id)},onMouseLeave:()=>d(null),children:[p.jsx("button",{onClick:Ht=>{Ht.stopPropagation(),ct||Ke(Ue.run_id)},disabled:ct,className:Nt("w-3 h-3 rounded-sm border shrink-0 flex items-center justify-center transition-colors",St?"bg-foreground border-foreground":"border-muted-foreground/50",ct&&"opacity-50 cursor-not-allowed"),children:St&&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(oT,{open:je===Ue.run_id,onOpenChange:Ht=>Je(Ue.run_id,Ht,Ue.color),children:[p.jsx(aT,{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:Ut},onClick:Ht=>Ht.stopPropagation(),"aria-label":`Change color for ${on}`})}),p.jsx(lT,{side:"right",align:"start",className:"w-auto p-1.5",onClick:Ht=>Ht.stopPropagation(),onOpenAutoFocus:Ht=>Ht.preventDefault(),children:p.jsx(que,{value:Ut,onChange:Ht=>{le(kn=>({...kn,[Ue.run_id]:w_(Ht,Ue.color)}))}})})]}),p.jsx("div",{className:Nt("flex-1 min-w-0 text-left",Xt&&"text-muted-foreground/60"),children:p.jsx(t4,{name:on,maxChars:Lt})}),Ue.is_tracking&&p.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0",title:"Live"}),Ue.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:G1(Ue.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:$===Ue.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(H1,{className:"text-xs font-normal",children:p.jsx("span",{className:"font-sans",children:Ue.run_id})}),p.jsx(ul,{}),p.jsx(_c,{disabled:oe===Ue.run_id,onClick:Ht=>{Ht.stopPropagation(),ce(Ue.run_id)},children:oe===Ue.run_id?"Resyncing...":"Force Full Resync"}),p.jsx(_c,{disabled:me===Ue.run_id,onClick:Ht=>{Ht.stopPropagation(),Ae(Ue.run_id)},children:me===Ue.run_id?"Syncing evals...":"Sync Evals After Training"}),p.jsx(_c,{className:"text-destructive",disabled:$===Ue.run_id,onClick:Ht=>{Ht.stopPropagation(),J(Ue.run_id)},children:"Remove"})]})]})]})]},Ue.run_id)}),st.length===0&&p.jsx("div",{className:"text-center py-4 px-2",children:yt?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(qf,{open:l,onOpenChange:c,children:p.jsxs(Xf,{className:"sm:max-w-md",children:[p.jsxs(Fd,{children:[p.jsx(Ud,{children:"Configure W&B"}),p.jsx(Ng,{children:q?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:Fe,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:q,onChange:Ue=>B(Ue.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"})]}),q&&!Tt&&p.jsxs("span",{className:"text-[11px] text-red-500 font-medium",children:["Not found — run"," ",p.jsx("code",{className:"text-[10px]",children:"wandb login"})]}),q&&Tt&&p.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Found"})]}),!q&&p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(xce,{htmlFor:"config-api-key",children:"W&B API Key"}),yt&&Et==="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(V0,{id:"config-api-key",type:"password",placeholder:"Enter API key",value:F,onChange:Ue=>U(Ue.target.value),required:!0})]})]}),p.jsxs(g8,{children:[p.jsx(Tn,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),p.jsx(Tn,{type:"submit",disabled:Z||(q?!Tt:!F.trim()),children:Z?p.jsxs(p.Fragment,{children:[p.jsx(al,{className:"mr-2 h-4 w-4"}),"Saving..."]}):"Ok"})]})]})]})}),p.jsx(qf,{open:g,onOpenChange:v,children:p.jsxs(Xf,{className:"sm:max-w-3xl !grid-rows-[auto_1fr] !gap-0 max-h-[80vh] overflow-hidden",onOpenAutoFocus:Ue=>{Ue.preventDefault();const ct=Ue.currentTarget;ct==null||ct.focus()},children:[p.jsxs(Fd,{className:"pb-3",children:[p.jsx(Ud,{children:"Add Run"}),p.jsx(Ng,{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(Ue=>p.jsxs("button",{className:Nt("flex items-center gap-0.5 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors whitespace-nowrap select-none",Ue.cls),onClick:()=>tt(Ue.key),children:[Ue.label,H===Ue.key&&(X==="asc"?p.jsx(wle,{className:"h-2.5 w-2.5"}):p.jsx(xle,{className:"h-2.5 w-2.5"}))]},Ue.key)),p.jsx("span",{className:"text-[10px] font-medium text-muted-foreground text-center",children:"Config"})]}),p.jsx("div",{className:"py-1",children:He?p.jsx("div",{className:"flex items-center justify-center py-6",children:p.jsx(al,{className:"h-4 w-4"})}):p.jsxs(p.Fragment,{children:[nt.map(Ue=>{const ct=Ue.run_id.split("/").pop()??Ue.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:Ue.color??"#888"},onClick:()=>we(Ue.run_id)}),p.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>we(Ue.run_id),children:p.jsx(t4,{name:Ue.name??"Unnamed"})}),p.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>we(Ue.run_id),children:p.jsx(t4,{name:Ue.entity??"—",className:"text-xs font-sans text-muted-foreground"})}),p.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>we(Ue.run_id),children:p.jsx(t4,{name:Ue.project??"—",className:"text-xs font-sans text-muted-foreground"})}),p.jsx("span",{className:"text-xs font-sans text-muted-foreground truncate cursor-pointer",onClick:()=>we(Ue.run_id),children:ct}),p.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap cursor-pointer",onClick:()=>we(Ue.run_id),children:Ue.created_at?new Date(Ue.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:()=>we(Ue.run_id),children:Ue.removed_at?G1(Ue.removed_at):"—"}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:St=>{St.stopPropagation(),ae(Ue)},disabled:!Ue.config,children:"View"})]},Ue.run_id)}),nt.length===0&&p.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"No removed runs"})]})})]})]})}),p.jsx(qf,{open:b,onOpenChange:_,children:p.jsxs(Xf,{className:"sm:max-w-lg max-h-[70vh] !grid-rows-[auto_1fr] !gap-0 overflow-hidden",children:[p.jsxs(Fd,{className:"pb-3",children:[p.jsx(Ud,{children:"Known Projects"}),p.jsx(Ng,{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(V0,{className:"h-7 text-xs flex-1",placeholder:"entity/project",value:w,onChange:Ue=>{S(Ue.target.value),N&&I(null)},onKeyDown:Ue=>{Ue.key==="Enter"&&ke()}}),p.jsx(Tn,{variant:"default",size:"sm",className:"h-7 px-3 text-xs",onClick:ke,disabled:E||!w.trim(),children:E?p.jsx(al,{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:[pe==null?void 0:pe.projects.map(Ue=>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:Ue.project}),p.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[Ue.source==="user"?"User-added":"From existing runs",Ue.added_at&&` · ${new Date(Ue.added_at).toLocaleDateString()}`]})]}),Ue.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:()=>Ze(Ue.project),disabled:P===Ue.project,children:P===Ue.project?p.jsx(al,{className:"h-3 w-3"}):p.jsx(lce,{className:"h-3 w-3"})})]},Ue.project)),(pe==null?void 0:pe.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(qf,{open:!!ie,onOpenChange:Ue=>{Ue||ae(null)},children:p.jsxs(Xf,{className:"sm:max-w-2xl max-h-[85vh] !grid-rows-[auto_1fr] overflow-hidden",children:[p.jsxs(Fd,{children:[p.jsxs(Ud,{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(Ng,{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(HG,{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:Ue=>{Ue||J(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&&Ne(Y)},children:"Remove"})]})]})}),p.jsx(FN,{open:!!re,onOpenChange:Ue=>{Ue||ce(null)},children:p.jsxs(UN,{children:[p.jsxs(BN,{children:[p.jsx(Sce,{className:"bg-destructive/10",children:p.jsx(uce,{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&&$e(re)},children:"Yes, Delete & Resync"})]})]})}),p.jsx(Kue,{open:R,onOpenChange:O})]})}function Que(){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 by(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function E8(t){return"nodeType"in t}function Ac(t){var e,n;return t?by(t)?t:E8(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function C8(t){const{Document:e}=Ac(t);return t instanceof e}function aw(t){return by(t)?!1:t instanceof Ac(t).HTMLElement}function WG(t){return t instanceof Ac(t).SVGElement}function _y(t){return t?by(t)?t.document:E8(t)?C8(t)?t:aw(t)||WG(t)?t.ownerDocument:document:document:document}const ih=vT?T.useLayoutEffect:T.useEffect;function A8(t){const e=T.useRef(t);return ih(()=>{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 Jue(){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 tS(t,e){e===void 0&&(e=[t]);const n=T.useRef(t);return ih(()=>{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 p2(t){const e=A8(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 $G(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,o)=>{const a=Object.entries(o);for(const[l,c]of a){const d=s[l];d!=null&&(s[l]=d+t*c)}return s},{...e})}}const h1=$G(1),nS=$G(-1);function ede(t){return"clientX"in t&&"clientY"in t}function N8(t){if(!t)return!1;const{KeyboardEvent:e}=Ac(t.target);return e&&t instanceof e}function tde(t){if(!t)return!1;const{TouchEvent:e}=Ac(t.target);return e&&t instanceof e}function YN(t){if(tde(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 ede(t)?{x:t.clientX,y:t.clientY}:null}const W1=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[W1.Translate.toString(t),W1.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),oI="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function nde(t){return t.matches(oI)?t:t.querySelector(oI)}const rde={display:"none"};function ide(t){let{id:e,value:n}=t;return Jr.createElement("div",{id:e,style:rde},n)}function sde(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 Jr.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function ode(){const[t,e]=T.useState("");return{announce:T.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const qG=T.createContext(null);function ade(t){const e=T.useContext(qG);T.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function lde(){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(o=>{var a;return(a=o[i])==null?void 0:a.call(o,s)})},[t]),e]}const cde={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.
  `},ude={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 dde(t){let{announcements:e=ude,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=cde}=t;const{announce:s,announcement:o}=ode(),a=cw("DndLiveRegion"),[l,c]=T.useState(!1);if(T.useEffect(()=>{c(!0)},[]),ade(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=Jr.createElement(Jr.Fragment,null,Jr.createElement(ide,{id:r,value:i.draggable}),Jr.createElement(sde,{id:a,announcement:o}));return n?zd.createPortal(d,n):d}var ia;(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"})(ia||(ia={}));function m2(){}function Yf(t,e){return T.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function rS(){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 XG(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function YG(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function fde(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function aI(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 KG(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function lI(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 iS=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=lI(e,e.left,e.top),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=XG(lI(l),i);s.push({id:a,data:{droppableContainer:o,value:c}})}}return s.sort(YG)},hde=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=aI(e),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=aI(l),d=i.reduce((g,v,b)=>g+XG(c[b],v),0),h=Number((d/4).toFixed(4));s.push({id:a,data:{droppableContainer:o,value:h}})}}return s.sort(YG)};function pde(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),o=i-r,a=s-n;if(r<i&&n<s){const l=e.width*e.height,c=t.width*t.height,d=o*a,h=d/(l+c-d);return Number(h.toFixed(4))}return 0}const mde=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const s of r){const{id:o}=s,a=n.get(o);if(a){const l=pde(a,e);l>0&&i.push({id:o,data:{droppableContainer:s,value:l}})}}return i.sort(fde)};function gde(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function ZG(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:qd}function vde(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((o,a)=>({...o,top:o.top+t*a.y,bottom:o.bottom+t*a.y,left:o.left+t*a.x,right:o.right+t*a.x}),{...n})}}const xde=vde(1);function yde(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 bde(t,e,n){const r=yde(e);if(!r)return t;const{scaleX:i,scaleY:s,x:o,y:a}=r,l=t.left-o-(1-i)*parseFloat(n),c=t.top-a-(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 _de={ignoreTransform:!1};function Sy(t,e){e===void 0&&(e=_de);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:d}=Ac(t).getComputedStyle(t);c&&(n=bde(n,c,d))}const{top:r,left:i,width:s,height:o,bottom:a,right:l}=n;return{top:r,left:i,width:s,height:o,bottom:a,right:l}}function cI(t){return Sy(t,{ignoreTransform:!0})}function Sde(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function wde(t,e){return e===void 0&&(e=Ac(t).getComputedStyle(t)),e.position==="fixed"}function Mde(t,e){e===void 0&&(e=Ac(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(C8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!aw(i)||WG(i)||n.includes(i))return n;const s=Ac(t).getComputedStyle(i);return i!==t&&Mde(i,s)&&n.push(i),wde(i,s)?n:r(i.parentNode)}return t?r(t):n}function QG(t){const[e]=xT(t,1);return e??null}function GC(t){return!vT||!t?null:by(t)?t:E8(t)?C8(t)||t===_y(t).scrollingElement?window:aw(t)?t:null:null}function JG(t){return by(t)?t.scrollX:t.scrollLeft}function eW(t){return by(t)?t.scrollY:t.scrollTop}function KN(t){return{x:JG(t),y:eW(t)}}var ya;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(ya||(ya={}));function tW(t){return!vT||!t?!1:t===document.scrollingElement}function nW(t){const e={x:0,y:0},n=tW(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,o=t.scrollTop>=r.y,a=t.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:o,isRight:a,maxScroll:r,minScroll:e}}const Tde={x:.2,y:.2};function Ede(t,e,n,r,i){let{top:s,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=Tde);const{isTop:c,isBottom:d,isLeft:h,isRight:g}=nW(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=ya.Backward,b.y=r*Math.abs((e.top+_.height-s)/_.height)):!d&&l>=e.bottom-_.height&&(v.y=ya.Forward,b.y=r*Math.abs((e.bottom-_.height-l)/_.height)),!g&&a>=e.right-_.width?(v.x=ya.Forward,b.x=r*Math.abs((e.right-_.width-a)/_.width)):!h&&o<=e.left+_.width&&(v.x=ya.Backward,b.x=r*Math.abs((e.left+_.width-o)/_.width)),{direction:v,speed:b}}function Cde(t){if(t===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}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 rW(t){return t.reduce((e,n)=>h1(e,KN(n)),qd)}function Ade(t){return t.reduce((e,n)=>e+JG(n),0)}function Nde(t){return t.reduce((e,n)=>e+eW(n),0)}function Rde(t,e){if(e===void 0&&(e=Sy),!t)return;const{top:n,left:r,bottom:i,right:s}=e(t);QG(t)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const kde=[["x",["left","right"],Ade],["y",["top","bottom"],Nde]];class R8{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=rW(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,o,a]of kde)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(r),d=i[s]-c;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class M_{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 Pde(t){const{EventTarget:e}=Ac(t);return t instanceof e?t:_y(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 Fu;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Fu||(Fu={}));function uI(t){t.preventDefault()}function Dde(t){t.stopPropagation()}var ui;(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"})(ui||(ui={}));const iW={start:[ui.Space,ui.Enter],cancel:[ui.Esc],end:[ui.Space,ui.Enter,ui.Tab]},Ide=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case ui.Right:return{...n,x:n.x+25};case ui.Left:return{...n,x:n.x-25};case ui.Down:return{...n,y:n.y+25};case ui.Up:return{...n,y:n.y-25}}};class nv{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 M_(_y(n)),this.windowListeners=new M_(Ac(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Fu.Resize,this.handleCancel),this.windowListeners.add(Fu.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Fu.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Rde(r),n(qd)}handleKeyDown(e){if(N8(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=iW,coordinateGetter:o=Ide,scrollBehavior:a="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=o(e,{active:n,context:r.current,currentCoordinates:d});if(h){const g=nS(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:I,minScroll:P}=nW(_),L=Cde(_),R={x:Math.min(w===ui.Right?L.right-L.width/2:L.right,Math.max(w===ui.Right?L.left:L.left+L.width/2,h.x)),y:Math.min(w===ui.Down?L.bottom-L.height/2:L.bottom,Math.max(w===ui.Down?L.top:L.top+L.height/2,h.y))},O=w===ui.Right&&!E||w===ui.Left&&!A,F=w===ui.Down&&!N||w===ui.Up&&!S;if(O&&R.x!==h.x){const U=_.scrollLeft+g.x,q=w===ui.Right&&U<=I.x||w===ui.Left&&U>=P.x;if(q&&!g.y){_.scrollTo({left:U,behavior:a});return}q?v.x=_.scrollLeft-U:v.x=w===ui.Right?_.scrollLeft-I.x:_.scrollLeft-P.x,v.x&&_.scrollBy({left:-v.x,behavior:a});break}else if(F&&R.y!==h.y){const U=_.scrollTop+g.y,q=w===ui.Down&&U<=I.y||w===ui.Up&&U>=P.y;if(q&&!g.x){_.scrollTo({top:U,behavior:a});return}q?v.y=_.scrollTop-U:v.y=w===ui.Down?_.scrollTop-I.y:_.scrollTop-P.y,v.y&&_.scrollBy({top:-v.y,behavior:a});break}}this.handleMove(e,h1(nS(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()}}nv.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=iW,onActivation:i}=e,{active:s}=n;const{code:o}=t.nativeEvent;if(r.start.includes(o)){const a=s.activatorNode.current;return a&&t.target!==a?!1:(t.preventDefault(),i==null||i({event:t.nativeEvent}),!0)}return!1}}];function dI(t){return!!(t&&"distance"in t)}function fI(t){return!!(t&&"delay"in t)}class k8{constructor(e,n,r){var i;r===void 0&&(r=Pde(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:o}=s;this.props=e,this.events=n,this.document=_y(o),this.documentListeners=new M_(this.document),this.listeners=new M_(r),this.windowListeners=new M_(Ac(o)),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(Fu.Resize,this.handleCancel),this.windowListeners.add(Fu.DragStart,uI),this.windowListeners.add(Fu.VisibilityChange,this.handleCancel),this.windowListeners.add(Fu.ContextMenu,uI),this.documentListeners.add(Fu.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(fI(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(dI(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(Fu.Click,Dde,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Fu.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:o,options:{activationConstraint:a}}=s;if(!i)return;const l=(n=YN(e))!=null?n:qd,c=nS(i,l);if(!r&&a){if(dI(a)){if(a.tolerance!=null&&WC(c,a.tolerance))return this.handleCancel();if(WC(c,a.distance))return this.handleStart()}if(fI(a)&&WC(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}e.cancelable&&e.preventDefault(),o(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===ui.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Ode={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class rv extends k8{constructor(e){const{event:n}=e,r=_y(n.target);super(e,Ode,r)}}rv.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 Lde={move:{name:"mousemove"},end:{name:"mouseup"}};var ZN;(function(t){t[t.RightClick=2]="RightClick"})(ZN||(ZN={}));class zde extends k8{constructor(e){super(e,Lde,_y(e.event.target))}}zde.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 jde extends k8{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(){}}}jde.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 T_;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(T_||(T_={}));var g2;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(g2||(g2={}));function Fde(t){let{acceleration:e,activator:n=T_.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:a=g2.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:d,delta:h,threshold:g}=t;const v=Bde({delta:h,disabled:!s}),[b,_]=Jue(),w=T.useRef({x:0,y:0}),S=T.useRef({x:0,y:0}),E=T.useMemo(()=>{switch(n){case T_.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case T_.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)},[]),I=T.useMemo(()=>a===g2.TreeOrder?[...c].reverse():c,[a,c]);T.useEffect(()=>{if(!s||!c.length||!E){_();return}for(const P of I){if((r==null?void 0:r(P))===!1)continue;const L=c.indexOf(P),R=d[L];if(!R)continue;const{direction:O,speed:F}=Ede(P,R,E,e,g);for(const U of["x","y"])v[U][O[U]]||(F[U]=0,O[U]=0);if(F.x>0||F.y>0){_(),A.current=P,b(N,o),w.current=F,S.current=O;return}}w.current={x:0,y:0},S.current={x:0,y:0},_()},[e,N,r,_,s,o,JSON.stringify(E),JSON.stringify(v),b,c,I,d,JSON.stringify(g)])}const Ude={x:{[ya.Backward]:!1,[ya.Forward]:!1},y:{[ya.Backward]:!1,[ya.Forward]:!1}};function Bde(t){let{delta:e,disabled:n}=t;const r=XN(e);return lw(i=>{if(n||!r||!i)return Ude;const s={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[ya.Backward]:i.x[ya.Backward]||s.x===-1,[ya.Forward]:i.x[ya.Forward]||s.x===1},y:{[ya.Backward]:i.y[ya.Backward]||s.y===-1,[ya.Forward]:i.y[ya.Forward]||s.y===1}}},[n,e,r])}function Hde(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 Vde(t,e){return T.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(o=>({eventName:o.eventName,handler:e(o.handler,r)}));return[...n,...s]},[]),[t,e])}var sS;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(sS||(sS={}));var QN;(function(t){t.Optimized="optimized"})(QN||(QN={}));const hI=new Map;function Gde(t,e){let{dragging:n,dependencies:r,config:i}=e;const[s,o]=T.useState(null),{frequency:a,measure:l,strategy:c}=i,d=T.useRef(t),h=w(),g=tS(h),v=T.useCallback(function(S){S===void 0&&(S=[]),!g.current&&o(E=>E===null?S:E.concat(S.filter(A=>!E.includes(A))))},[g]),b=T.useRef(null),_=lw(S=>{if(h&&!n)return hI;if(!S||S===hI||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,I=N?new R8(l(N),N):null;A.rect.current=I,I&&E.set(A.id,I)}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&&o(null)},[JSON.stringify(s)]),T.useEffect(()=>{h||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{v(),b.current=null},a))},[a,h,v,...r]),{droppableRects:_,measureDroppableContainers:v,measuringScheduled:s!=null};function w(){switch(c){case sS.Always:return!1;case sS.BeforeDragging:return n;default:return!n}}}function sW(t,e){return lw(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Wde(t,e){return sW(t,e)}function $de(t){let{callback:e,disabled:n}=t;const r=A8(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=A8(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 qde(t){return new R8(Sy(t),t)}function pI(t,e,n){e===void 0&&(e=qde);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 o=$de({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}}}}),a=yT({callback:s});return ih(()=>{s(),t?(a==null||a.observe(t),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[t]),r}function Xde(t){const e=sW(t);return ZG(t,e)}const mI=[];function Yde(t){const e=T.useRef(t),n=lw(r=>t?r&&r!==mI&&t&&e.current&&t.parentNode===e.current.parentNode?r:xT(t):mI,[t]);return T.useEffect(()=>{e.current=t},[t]),n}function Kde(t){const[e,n]=T.useState(null),r=T.useRef(t),i=T.useCallback(s=>{const o=GC(s.target);o&&n(a=>a?(a.set(o,KN(o)),new Map(a)):null)},[]);return T.useEffect(()=>{const s=r.current;if(t!==s){o(s);const a=t.map(l=>{const c=GC(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,KN(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=t}return()=>{o(t),o(s)};function o(a){a.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,o)=>h1(s,o),qd):rW(t):qd,[t,e])}function gI(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?nS(t,n.current):qd}function Zde(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 Qde(t,e){return T.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,e)},n},{}),[t,e])}function oW(t){return T.useMemo(()=>t?Sde(t):null,[t])}const vI=[];function Jde(t,e){e===void 0&&(e=Sy);const[n]=t,r=oW(n?Ac(n):null),[i,s]=T.useState(vI);function o(){s(()=>t.length?t.map(l=>tW(l)?r:new R8(e(l),l)):vI)}const a=yT({callback:o});return ih(()=>{a==null||a.disconnect(),o(),t.forEach(l=>a==null?void 0:a.observe(l))},[t]),i}function efe(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return aw(e)?e:t}function tfe(t){let{measure:e}=t;const[n,r]=T.useState(null),i=T.useCallback(c=>{for(const{target:d}of c)if(aw(d)){r(h=>{const g=e(d);return h?{...h,width:g.width,height:g.height}:g});break}},[e]),s=yT({callback:i}),o=T.useCallback(c=>{const d=efe(c);s==null||s.disconnect(),d&&(s==null||s.observe(d)),r(d?e(d):null)},[e,s]),[a,l]=p2(o);return T.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const nfe=[{sensor:rv,options:{}},{sensor:nv,options:{}}],rfe={current:{}},zM={draggable:{measure:cI},droppable:{measure:cI,strategy:sS.WhileDragging,frequency:QN.Optimized},dragOverlay:{measure:Sy}};class E_ 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 ife={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new E_,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:m2},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:zM,measureDroppableContainers:m2,windowRect:null,measuringScheduled:!1},sfe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:m2,draggableNodes:new Map,over:null,measureDroppableContainers:m2},bT=T.createContext(sfe),aW=T.createContext(ife);function ofe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new E_}}}function afe(t,e){switch(e.type){case ia.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ia.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 ia.DragEnd:case ia.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ia.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new E_(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case ia.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const o=new E_(t.droppable.containers);return o.set(n,{...s,disabled:i}),{...t,droppable:{...t.droppable,containers:o}}}case ia.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const s=new E_(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function lfe(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=T.useContext(bT),s=XN(r),o=XN(n==null?void 0:n.id);return T.useEffect(()=>{if(!e&&!r&&s&&o!=null){if(!N8(s)||document.activeElement===s.target)return;const a=i.get(o);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const d of[l.current,c.current]){if(!d)continue;const h=nde(d);if(h){h.focus();break}}})}},[r,e,i,o,s]),null}function cfe(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,s)=>s({transform:i,...r}),n):n}function ufe(t){return T.useMemo(()=>({draggable:{...zM.draggable,...t==null?void 0:t.draggable},droppable:{...zM.droppable,...t==null?void 0:t.droppable},dragOverlay:{...zM.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 dfe(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const s=T.useRef(!1),{x:o,y:a}=typeof i=="boolean"?{x:i,y:i}:i;ih(()=>{if(!o&&!a||!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=ZG(d,r);if(o||(h.x=0),a||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const g=QG(c);g&&g.scrollBy({top:h.y,left:h.x})}},[e,o,a,r,n])}const lW=T.createContext({...qd,scaleX:1,scaleY:1});var M0;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(M0||(M0={}));const oS=T.memo(function(e){var n,r,i,s;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:d=nfe,collisionDetection:h=mde,measuring:g,modifiers:v,...b}=e;const _=T.useReducer(afe,void 0,ofe),[w,S]=_,[E,A]=lde(),[N,I]=T.useState(M0.Uninitialized),P=N===M0.Initialized,{draggable:{active:L,nodes:R,translate:O},droppable:{containers:F}}=w,U=L!=null?R.get(L):null,q=T.useRef({initial:null,translated:null}),B=T.useMemo(()=>{var ht;return L!=null?{id:L,data:(ht=U==null?void 0:U.data)!=null?ht:rfe,rect:q}:null},[L,U]),Z=T.useRef(null),[G,$]=T.useState(null),[K,Y]=T.useState(null),J=tS(b,Object.values(b)),H=cw("DndDescribedBy",o),z=T.useMemo(()=>F.getEnabled(),[F]),X=ufe(g),{droppableRects:V,measureDroppableContainers:ie,measuringScheduled:ae}=Gde(z,{dragging:P,dependencies:[O.x,O.y],config:X.droppable}),re=Hde(R,L),ce=T.useMemo(()=>K?YN(K):null,[K]),oe=it(),fe=Wde(re,X.draggable.measure);dfe({activeNode:L!=null?R.get(L):null,config:oe.layoutShiftCompensation,initialRect:fe,measure:X.draggable.measure});const me=pI(re,X.draggable.measure,fe),ye=pI(re?re.parentElement:null),Ee=T.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:V,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:F,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ge=F.getNodeFor((n=Ee.current.over)==null?void 0:n.id),_e=tfe({measure:X.dragOverlay.measure}),De=(r=_e.nodeRef.current)!=null?r:re,he=P?(i=_e.rect)!=null?i:me:null,Le=!!(_e.nodeRef.current&&_e.rect),ne=Xde(Le?null:me),We=oW(De?Ac(De):null),je=Yde(P?Ge??re:null),be=Jde(je),Xe=cfe(v,{transform:{x:O.x-ne.x,y:O.y-ne.y,scaleX:1,scaleY:1},activatorEvent:K,active:B,activeNodeRect:me,containerNodeRect:ye,draggingNodeRect:he,over:Ee.current.over,overlayNodeRect:_e.rect,scrollableAncestors:je,scrollableAncestorRects:be,windowRect:We}),le=ce?h1(ce,O):null,te=Kde(je),Se=gI(te),ve=gI(te,[me]),ge=h1(Xe,Se),Te=he?xde(he,Xe):null,He=B&&Te?h({active:B,collisionRect:Te,droppableRects:V,droppableContainers:z,pointerCoordinates:le}):null,pe=KG(He,"id"),[qe,xt]=T.useState(null),nt=Le?Xe:h1(Xe,ve),tt=gde(nt,(s=qe==null?void 0:qe.rect)!=null?s:null,me),Fe=T.useRef(null),we=T.useCallback((ht,Je)=>{let{sensor:$e,options:Ae}=Je;if(Z.current==null)return;const Oe=R.get(Z.current);if(!Oe)return;const Ye=ht.nativeEvent,st=new $e({active:Z.current,activeNode:Oe,event:Ye,options:Ae,context:Ee,onAbort(yt){if(!R.get(yt))return;const{onDragAbort:Et}=J.current,Dt={id:yt};Et==null||Et(Dt),E({type:"onDragAbort",event:Dt})},onPending(yt,Tt,Et,Dt){if(!R.get(yt))return;const{onDragPending:ct}=J.current,St={id:yt,constraint:Tt,initialCoordinates:Et,offset:Dt};ct==null||ct(St),E({type:"onDragPending",event:St})},onStart(yt){const Tt=Z.current;if(Tt==null)return;const Et=R.get(Tt);if(!Et)return;const{onDragStart:Dt}=J.current,Ue={activatorEvent:Ye,active:{id:Tt,data:Et.data,rect:q}};zd.unstable_batchedUpdates(()=>{Dt==null||Dt(Ue),I(M0.Initializing),S({type:ia.DragStart,initialCoordinates:yt,active:Tt}),E({type:"onDragStart",event:Ue}),$(Fe.current),Y(Ye)})},onMove(yt){S({type:ia.DragMove,coordinates:yt})},onEnd:Rt(ia.DragEnd),onCancel:Rt(ia.DragCancel)});Fe.current=st;function Rt(yt){return async function(){const{active:Et,collisions:Dt,over:Ue,scrollAdjustedTranslate:ct}=Ee.current;let St=null;if(Et&&ct){const{cancelDrop:kt}=J.current;St={activatorEvent:Ye,active:Et,collisions:Dt,delta:ct,over:Ue},yt===ia.DragEnd&&typeof kt=="function"&&await Promise.resolve(kt(St))&&(yt=ia.DragCancel)}Z.current=null,zd.unstable_batchedUpdates(()=>{S({type:yt}),I(M0.Uninitialized),xt(null),$(null),Y(null),Fe.current=null;const kt=yt===ia.DragEnd?"onDragEnd":"onDragCancel";if(St){const Ut=J.current[kt];Ut==null||Ut(St),E({type:kt,event:St})}})}}},[R]),ke=T.useCallback((ht,Je)=>($e,Ae)=>{const Oe=$e.nativeEvent,Ye=R.get(Ae);if(Z.current!==null||!Ye||Oe.dndKit||Oe.defaultPrevented)return;const st={active:Ye};ht($e,Je.options,st)===!0&&(Oe.dndKit={capturedBy:Je.sensor},Z.current=Ae,we($e,Je))},[R,we]),Ze=Vde(d,ke);Zde(d),ih(()=>{me&&N===M0.Initializing&&I(M0.Initialized)},[me,N]),T.useEffect(()=>{const{onDragMove:ht}=J.current,{active:Je,activatorEvent:$e,collisions:Ae,over:Oe}=Ee.current;if(!Je||!$e)return;const Ye={active:Je,activatorEvent:$e,collisions:Ae,delta:{x:ge.x,y:ge.y},over:Oe};zd.unstable_batchedUpdates(()=>{ht==null||ht(Ye),E({type:"onDragMove",event:Ye})})},[ge.x,ge.y]),T.useEffect(()=>{const{active:ht,activatorEvent:Je,collisions:$e,droppableContainers:Ae,scrollAdjustedTranslate:Oe}=Ee.current;if(!ht||Z.current==null||!Je||!Oe)return;const{onDragOver:Ye}=J.current,st=Ae.get(pe),Rt=st&&st.rect.current?{id:st.id,rect:st.rect.current,data:st.data,disabled:st.disabled}:null,yt={active:ht,activatorEvent:Je,collisions:$e,delta:{x:Oe.x,y:Oe.y},over:Rt};zd.unstable_batchedUpdates(()=>{xt(Rt),Ye==null||Ye(yt),E({type:"onDragOver",event:yt})})},[pe]),ih(()=>{Ee.current={activatorEvent:K,active:B,activeNode:re,collisionRect:Te,collisions:He,droppableRects:V,draggableNodes:R,draggingNode:De,draggingNodeRect:he,droppableContainers:F,over:qe,scrollableAncestors:je,scrollAdjustedTranslate:ge},q.current={initial:he,translated:Te}},[B,re,He,Te,R,De,he,V,F,qe,je,ge]),Fde({...oe,delta:O,draggingRect:Te,pointerCoordinates:le,scrollableAncestors:je,scrollableAncestorRects:be});const Ne=T.useMemo(()=>({active:B,activeNode:re,activeNodeRect:me,activatorEvent:K,collisions:He,containerNodeRect:ye,dragOverlay:_e,draggableNodes:R,droppableContainers:F,droppableRects:V,over:qe,measureDroppableContainers:ie,scrollableAncestors:je,scrollableAncestorRects:be,measuringConfiguration:X,measuringScheduled:ae,windowRect:We}),[B,re,me,K,He,ye,_e,R,F,V,qe,ie,je,be,X,ae,We]),Ke=T.useMemo(()=>({activatorEvent:K,activators:Ze,active:B,activeNodeRect:me,ariaDescribedById:{draggable:H},dispatch:S,draggableNodes:R,over:qe,measureDroppableContainers:ie}),[K,Ze,B,me,S,H,R,qe,ie]);return Jr.createElement(qG.Provider,{value:A},Jr.createElement(bT.Provider,{value:Ke},Jr.createElement(aW.Provider,{value:Ne},Jr.createElement(lW.Provider,{value:tt},c)),Jr.createElement(lfe,{disabled:(a==null?void 0:a.restoreFocus)===!1})),Jr.createElement(dde,{...a,hiddenTextDescribedById:H}));function it(){const ht=(G==null?void 0:G.autoScrollEnabled)===!1,Je=typeof l=="object"?l.enabled===!1:l===!1,$e=P&&!ht&&!Je;return typeof l=="object"?{...l,enabled:$e}:{enabled:$e}}}),ffe=T.createContext(null),xI="button",hfe="Draggable";function pfe(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const s=cw(hfe),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:d,draggableNodes:h,over:g}=T.useContext(bT),{role:v=xI,roleDescription:b="draggable",tabIndex:_=0}=i??{},w=(l==null?void 0:l.id)===e,S=T.useContext(w?lW:ffe),[E,A]=p2(),[N,I]=p2(),P=Qde(o,e),L=tS(n);ih(()=>(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===xI?!0:void 0,"aria-roledescription":b,"aria-describedby":d.draggable}),[r,v,_,w,b,d.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:R,isDragging:w,listeners:r?void 0:P,node:E,over:g,setNodeRef:A,setActivatorNodeRef:I,transform:S}}function mfe(){return T.useContext(aW)}const gfe="Droppable",vfe={timeout:25};function xfe(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const s=cw(gfe),{active:o,dispatch:a,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}={...vfe,...i},S=tS(_??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||!o}),N=T.useCallback((R,O)=>{A&&(O&&(A.unobserve(O),h.current=!1),R&&A.observe(R))},[A]),[I,P]=p2(N),L=tS(e);return T.useEffect(()=>{!A||!I.current||(A.disconnect(),h.current=!1,A.observe(I.current))},[I,A]),T.useEffect(()=>(a({type:ia.RegisterDroppable,element:{id:r,key:s,disabled:n,node:I,rect:g,data:L}}),()=>a({type:ia.UnregisterDroppable,key:s,id:r})),[r]),T.useEffect(()=>{n!==d.current.disabled&&(a({type:ia.SetDroppableDisabled,id:r,key:s,disabled:n}),d.current.disabled=n)},[r,s,n,a]),{active:o,rect:g,isOver:(l==null?void 0:l.id)===r,node:I,over:l,setNodeRef:P}}function iv(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function yfe(t,e){return t.reduce((n,r,i)=>{const s=e.get(r);return s&&(n[i]=s),n},Array(t.length))}function n4(t){return t!==null&&t>=0}function bfe(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 _fe(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=iv(e,r,n),o=e[i],a=s[i];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},r4={scaleX:1,scaleY:1},cW=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:i,rects:s,overIndex:o}=t;const a=(e=s[n])!=null?e:r;if(!a)return null;if(i===n){const c=s[o];return c?{x:0,y:n<o?c.top+c.height-(a.top+a.height):c.top-a.top,...r4}:null}const l=Sfe(s,i,n);return i>n&&i<=o?{x:0,y:-a.height-l,...r4}:i<n&&i>=o?{x:0,y:a.height+l,...r4}:{x:0,y:0,...r4}};function Sfe(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 uW="Sortable",dW=Jr.createContext({activeIndex:-1,containerId:uW,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:uw,disabled:{draggable:!1,droppable:!1}});function aS(t){let{children:e,id:n,items:r,strategy:i=uw,disabled:s=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:d}=mfe(),h=cw(uW,n),g=a.rect!==null,v=T.useMemo(()=>r.map(P=>typeof P=="object"&&"id"in P?P.id:P),[r]),b=o!=null,_=o?v.indexOf(o.id):-1,w=c?v.indexOf(c.id):-1,S=T.useRef(v),E=!bfe(v,S.current),A=w!==-1&&_===-1||E,N=_fe(s);ih(()=>{E&&b&&d(v)},[E,v,b,d]),T.useEffect(()=>{S.current=v},[v]);const I=T.useMemo(()=>({activeIndex:_,containerId:h,disabled:N,disableTransforms:A,items:v,overIndex:w,useDragOverlay:g,sortedRects:yfe(v,l),strategy:i}),[_,h,N.draggable,N.droppable,A,v,w,l,g,i]);return Jr.createElement(dW.Provider,{value:I},e)}const wfe=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return iv(n,r,i).indexOf(e)},Mfe=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:s,newIndex:o,previousItems:a,previousContainerId:l,transition:c}=t;return!c||!r||a!==s&&i===o?!1:n?!0:o!==i&&e===l},Tfe={duration:200,easing:"ease"},fW="transform",Efe=W1.Transition.toString({property:fW,duration:0,easing:"linear"}),Cfe={roleDescription:"sortable"};function Afe(t){let{disabled:e,index:n,node:r,rect:i}=t;const[s,o]=T.useState(null),a=T.useRef(n);return ih(()=>{if(!e&&n!==a.current&&r.current){const l=i.current;if(l){const c=Sy(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)&&o(d)}}n!==a.current&&(a.current=n)},[e,n,r,i]),T.useEffect(()=>{s&&o(null)},[s]),s}function P8(t){let{animateLayoutChanges:e=Mfe,attributes:n,disabled:r,data:i,getNewIndex:s=wfe,id:o,strategy:a,resizeObserverConfig:l,transition:c=Tfe}=t;const{items:d,containerId:h,activeIndex:g,disabled:v,disableTransforms:b,sortedRects:_,overIndex:w,useDragOverlay:S,strategy:E}=T.useContext(dW),A=Nfe(r,v),N=d.indexOf(o),I=T.useMemo(()=>({sortable:{containerId:h,index:N,items:d},...i}),[h,i,N,d]),P=T.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:L,node:R,isOver:O,setNodeRef:F}=xfe({id:o,data:I,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...l}}),{active:U,activatorEvent:q,activeNodeRect:B,attributes:Z,setNodeRef:G,listeners:$,isDragging:K,over:Y,setActivatorNodeRef:J,transform:H}=pfe({id:o,data:I,attributes:{...Cfe,...n},disabled:A.draggable}),z=Que(F,G),X=!!U,V=X&&!b&&n4(g)&&n4(w),ie=!S&&K,ae=ie&&V?H:null,ce=V?ae??(a??E)({rects:_,activeNodeRect:B,activeIndex:g,overIndex:w,index:N}):null,oe=n4(g)&&n4(w)?s({id:o,items:d,activeIndex:g,overIndex:w}):N,fe=U==null?void 0:U.id,me=T.useRef({activeId:fe,items:d,newIndex:oe,containerId:h}),ye=d!==me.current.items,Ee=e({active:U,containerId:h,isDragging:K,isSorting:X,id:o,index:N,items:d,newIndex:me.current.newIndex,previousItems:me.current.items,previousContainerId:me.current.containerId,transition:c,wasDragging:me.current.activeId!=null}),Ge=Afe({disabled:!Ee,index:N,node:R,rect:L});return T.useEffect(()=>{X&&me.current.newIndex!==oe&&(me.current.newIndex=oe),h!==me.current.containerId&&(me.current.containerId=h),d!==me.current.items&&(me.current.items=d)},[X,oe,h,d]),T.useEffect(()=>{if(fe===me.current.activeId)return;if(fe!=null&&me.current.activeId==null){me.current.activeId=fe;return}const De=setTimeout(()=>{me.current.activeId=fe},50);return()=>clearTimeout(De)},[fe]),{active:U,activeIndex:g,attributes:Z,data:I,rect:L,index:N,newIndex:oe,items:d,isOver:O,isSorting:X,isDragging:K,listeners:$,node:R,overIndex:w,over:Y,setNodeRef:z,setActivatorNodeRef:J,setDroppableNodeRef:F,setDraggableNodeRef:G,transform:Ge??ce,transition:_e()};function _e(){if(Ge||ye&&me.current.newIndex===N)return Efe;if(!(ie&&!N8(q)||!c)&&(X||Ee))return W1.Transition.toString({...c,property:fW})}}function Nfe(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 v2(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 Rfe=[ui.Down,ui.Right,ui.Up,ui.Left],lS=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:s,over:o,scrollableAncestors:a}}=e;if(Rfe.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 ui.Down:r.top<g.top&&l.push(h);break;case ui.Up:r.top>g.top&&l.push(h);break;case ui.Left:r.left>g.left&&l.push(h);break;case ui.Right:r.left<g.left&&l.push(h);break}});const c=hde({collisionRect:r,droppableRects:i,droppableContainers:l});let d=KG(c,"id");if(d===(o==null?void 0:o.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)=>a[L]!==P),S=hW(h,g),E=kfe(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:nS(N,A)}}}};function hW(t,e){return!v2(t)||!v2(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function kfe(t,e){return!v2(t)||!v2(e)||!hW(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:Nt("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 yI({className:t,...e}){return p.jsx("div",{"data-slot":"card-header",className:Nt("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 i4({className:t,...e}){return p.jsx("div",{"data-slot":"card-title",className:Nt("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",t),...e})}function s4({className:t,...e}){return p.jsx("div",{"data-slot":"card-description",className:Nt("text-muted-foreground text-sm",t),...e})}function th({className:t,...e}){return p.jsx("div",{"data-slot":"card-content",className:Nt("px-4 group-data-[size=sm]/card:px-3",t),...e})}function Qh({className:t,...e}){return p.jsx("div",{"data-slot":"skeleton",className:Nt("bg-muted rounded-md animate-pulse",t),...e})}const pW=v8("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 p1({className:t,variant:e="default",size:n="default",...r}){return p.jsx(Xoe,{"data-slot":"toggle",className:Nt(pW({variant:e,size:n,className:t})),...r})}function cS({label:t,enabled:e,onEnabledChange:n,value:r,onValueChange:i,onValueCommit:s,inputType:o="number",inputMin:a,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:Nt("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(p1,{variant:h,size:g,pressed:e,onPressedChange:n,className:Nt("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:o,min:a,max:l,value:r,onChange:S=>i(S.target.value),onKeyDown:b,onBlur:_,className:Nt("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 Pfe=v8("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 $1({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:Nt(Pfe({variant:e}),t),...r})}const mW=T.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function sv({className:t,variant:e,size:n,spacing:r=0,orientation:i="horizontal",children:s,...o}){return p.jsx(Joe,{"data-slot":"toggle-group","data-variant":e,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:Nt("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),...o,children:p.jsx(mW.Provider,{value:{variant:e,size:n,spacing:r,orientation:i},children:s})})}function Ul({className:t,children:e,variant:n="default",size:r="default",...i}){const s=T.useContext(mW);return p.jsx(eae,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:Nt("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",pW({variant:s.variant||n,size:s.size||r}),t),...i,children:e})}const gW="...";function Dfe(t,e){if(!t||e<=0||t.length<=e)return{prefix:t,suffix:"",isTruncated:!1};const n=e-gW.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 n1({text:t,className:e,tooltipClassName:n,ellipsisClassName:r,ellipsisFadeClassName:i,tooltipDelay:s=300}){const o=T.useRef(null),a=T.useRef(null),[l,c]=T.useState({prefix:t,suffix:"",isTruncated:!1}),d=T.useCallback(()=>{const g=o.current,v=a.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=Dfe(t,S);c(A=>A.prefix===E.prefix&&A.suffix===E.suffix&&A.isTruncated===E.isTruncated?A:E)},[t]);T.useLayoutEffect(()=>{d();const g=o.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:o,className:Nt("relative flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",e),children:[p.jsx("span",{ref:a,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:Nt("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:gW}),p.jsx("span",{className:"shrink-0",children:l.suffix})]}):p.jsx("span",{className:"truncate",children:t})]});return l.isTruncated?p.jsxs(gv,{delayDuration:s,children:[p.jsx(vv,{asChild:!0,children:h}),p.jsx(xv,{side:"top",className:Nt("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 vW(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 bI(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 _I(t){const e=t.split("/");return e[e.length-1].replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function D8(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 Ife(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=vW(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:_I(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:_I(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"],o=[];for(const l of i){const c=n.get(l);c&&c.items.length>0&&o.push(c)}const a=[];for(const l of s)if(l==="hardware")o.length>0&&a.push({key:"hardware",label:"Hardware & Environment",items:[],subcategories:o});else{const c=n.get(l);c&&c.items.length>0&&a.push(c)}return a}function SI(t){const e=new Map;for(const[n,r]of Object.entries(t)){if(n==="_wandb")continue;const i=vW(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!D8(i,s)})}function Ofe({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:Nt("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(n1,{text:s,className:"text-sm font-medium"})}),p.jsx("div",{className:"truncate text-xs text-muted-foreground",children:r.run_id})]}),i&&p.jsx($1,{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:G1(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 wI({value:t,formatted:e,isDifferent:n}){const r=e.length>20,i=p.jsx("span",{className:Nt("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(gv,{children:[p.jsx(vv,{asChild:!0,children:i}),p.jsx(xv,{side:"top",className:"max-w-xs break-all font-sans text-xs",children:e})]}):i}function Lfe({displayKey:t,value1:e,value2:n,showOnlyDifferences:r}){const i=bI(e),s=bI(n),o=!D8(e,n);return r&&!o?null:p.jsxs("div",{className:Nt("grid grid-cols-[1fr_2fr_2fr] gap-3 py-1.5 rounded-md transition-colors min-w-0",o?"hover:bg-muted/50":"opacity-40 hover:opacity-60"),children:[p.jsxs(gv,{children:[p.jsx(vv,{asChild:!0,children:p.jsx("span",{className:Nt("text-sm truncate min-w-0",o?"text-foreground":"text-muted-foreground"),children:t})}),p.jsx(xv,{side:"left",className:"text-xs",children:t})]}),p.jsx("div",{className:"min-w-0 overflow-hidden",children:p.jsx(wI,{value:e,formatted:i,isDifferent:o})}),p.jsx("div",{className:"min-w-0 overflow-hidden",children:p.jsx(wI,{value:n,formatted:s,isDifferent:o})})]})}const zfe="ml-[22px]",jfe="ml-[38px]";function xW({category:t,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:i=!1,defaultOpen:s}){const o=I8(t,e,n),[a,l]=T.useState(s??o);if(r&&!o)return null;const c=t.subcategories&&t.subcategories.length>0;return p.jsxs(Ki,{open:a,onOpenChange:l,children:[p.jsx(Zi,{asChild:!0,children:p.jsx("div",{className:Nt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-gray-50 rounded transition-colors",i&&"ml-4",!o&&"opacity-40"),children:p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!a&&"-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(xW,{category:d,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:!0},d.key))}):p.jsx("div",{className:Nt("mt-1",i?jfe:zfe),children:t.items.map(d=>p.jsx(Lfe,{displayKey:d.displayKey,value1:e.get(d.key),value2:n.get(d.key),showOnlyDifferences:r},d.key))})})]})}function Ffe({config1:t,config2:e,run1Name:n,run2Name:r,run1Path:i,run2Path:s,run1Color:o,run2Color:a}){const[l,c]=T.useState(!0),d=T.useMemo(()=>SI(t),[t]),h=T.useMemo(()=>SI(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(()=>Ife(g),[g]),b=T.useMemo(()=>{let _=0;for(const[w,S]of d){const E=h.get(w);D8(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($1,{variant:"secondary",className:"text-xs",children:[b," difference",b!==1?"s":""]})}),p.jsxs(sv,{type:"single",value:l?"differences":"everything",onValueChange:_=>{_&&c(_==="differences")},variant:"outline",size:"sm",children:[p.jsx(Ul,{value:"everything",className:"text-xs px-3",children:"Everything"}),p.jsx(Ul,{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:o}}),p.jsx(n1,{text:n,className:"text-sm font-medium min-w-0"})]}),p.jsx("div",{className:"ml-4",children:p.jsx(n1,{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:a}}),p.jsx(n1,{text:r,className:"text-sm font-medium min-w-0"})]}),p.jsx("div",{className:"ml-4",children:p.jsx(n1,{text:s,className:"text-xs font-normal text-muted-foreground min-w-0"})})]})]}),p.jsx(bv,{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(xW,{category:_,config1Map:d,config2Map:h,showOnlyDifferences:l,defaultOpen:w},_.key)})})})]})}function Ufe({currentRunId:t,currentConfig:e}){const[n,r]=T.useState(!1),[i,s]=T.useState(null),{data:o,isLoading:a}=fm(),l=(o==null?void 0:o.runs)||[],{data:c,isLoading:d}=td(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(qf,{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(Xf,{className:"sm:max-w-4xl max-h-[95vh]",children:i?p.jsxs(p.Fragment,{children:[p.jsx(Fd,{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(Ud,{children:"Configuration Comparison"})})]})}),d?p.jsxs("div",{className:"flex items-center justify-center py-16",children:[p.jsx(al,{className:"h-6 w-6"}),p.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading configuration..."})]}):c!=null&&c.config?p.jsx(Ffe,{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(Fd,{children:[p.jsx(Ud,{children:"Compare Configuration"}),p.jsxs(Ng,{children:["Select another run to compare its configuration with"," ",p.jsx("span",{className:"font-sans text-foreground",children:E})]})]}),p.jsx(bv,{className:"h-[500px] pr-4",children:a?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx(al,{className:"h-5 w-5"})}):p.jsx(Ofe,{runs:l,currentRunId:t,onSelect:_})})]})})]})}class Bfe{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(e,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;const o=E=>{if(E=this.postProcess(E,r),i){setTimeout(function(){i(E)},0);return}else return E},a=n.length,l=e.length;let c=1,d=a+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>=a)return o(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],I=v[E+1];N&&(v[E-1]=void 0);let P=!1;if(I){const R=I.oldPos-E;P=I&&0<=R&&R<a}const L=N&&N.oldPos+1<l;if(!P&&!L){v[E]=void 0;continue}if(!L||P&&N.oldPos<I.oldPos?A=this.addToPath(I,!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>=a)return o(this.buildValues(A.lastComponent,n,e))||!0;v[E]=A,A.oldPos+1>=l&&(w=Math.min(w,E-1)),b+1>=a&&(_=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 o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(e,n,r,i,s){const o=n.length,a=r.length;let l=e.oldPos,c=l-i,d=0;for(;c+1<o&&l+1<a&&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 o=i.length;let a=0,l=0,c=0;for(;a<o;a++){const d=i[a];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 Hfe extends Bfe{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const Vfe=new Hfe;function Gfe(t,e,n){return Vfe.diff(t,e,n)}function Wfe({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,o=i.run_id===n,a=i.name||i.run_id.split("/").pop()||i.run_id;return p.jsxs("button",{onClick:()=>!s&&r(i.run_id),disabled:s,className:Nt("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left transition-colors",s?"cursor-not-allowed opacity-40":Nt("cursor-pointer hover:bg-muted",o&&"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(n1,{text:a,className:"text-sm font-medium"})}),p.jsx("div",{className:"truncate text-xs text-muted-foreground",children:i.run_id})]}),s&&p.jsx($1,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),!s&&o&&p.jsx($1,{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:G1(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 MI({currentRunId:t,selectedCompareRunId:e,onSelectCompareRun:n,disabled:r=!1}){const[i,s]=T.useState(!1),{data:o,isLoading:a}=fm(),l=(o==null?void 0:o.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(qf,{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(Xf,{className:"sm:max-w-4xl max-h-[90vh]",children:[p.jsxs(Fd,{children:[p.jsx(Ud,{children:"Select Run To Compare"}),p.jsxs(Ng,{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(bv,{className:"h-[480px] pr-4",children:a?p.jsx("div",{className:"flex items-center justify-center py-8",children:p.jsx(al,{className:"h-5 w-5"})}):p.jsx(Wfe,{runs:l,currentRunId:t,selectedCompareRunId:e,onSelect:v=>{n(v),s(!1)}})})]})]})}const $fe={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"]},qfe=new Set(["python","bash","yaml","toml"]),Xfe=new Set(["sql"]);function Yfe(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Kfe(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 Zfe(t){return qfe.has(t)?"#.*$":Xfe.has(t)?"--.*$":t==="json"?null:"//.*$"}function T0(t,e){if(t.length===0)return[{text:" "}];const n=$fe[e]??[],r=new Set(n),i="\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|`(?:\\\\.|[^`\\\\])*`",s=Zfe(e),o=n.length>0?`\\b(?:${n.map(g=>Yfe(g)).join("|")})\\b`:null,a="\\b\\d+(?:\\.\\d+)?\\b",l=[i];s&&l.push(s),o&&l.push(o),l.push(a);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 Qfe(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=>T0(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(...T0(b,e)),i.push(_);continue}const o=Qfe(s);if(!o){i.push(T0(s,e));continue}const a=s.indexOf(o.quote,o.index+3),l=s.slice(0,o.index);if(a===-1){const g=[];l.length>0&&g.push(...T0(l,e)),g.push({text:s.slice(o.index),className:"text-muted-foreground"}),i.push(g),r=o.quote;continue}const c=[],d=s.slice(o.index,a+3),h=s.slice(a+3);l.length>0&&c.push(...T0(l,e)),c.push({text:d,className:"text-muted-foreground"}),h.length>0&&c.push(...T0(h,e)),i.push(c)}return i}function TI(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 Jfe(t,e){const n=TI(t),r=TI(e),i=Gfe(n,r),s=[];let o=1,a=1;for(const l of i)for(const c of l.value)l.added?(s.push({kind:"add",text:c,leftLine:null,rightLine:a}),a+=1):l.removed?(s.push({kind:"remove",text:c,leftLine:o,rightLine:null}),o+=1):(s.push({kind:"context",text:c,leftLine:o,rightLine:a}),o+=1,a+=1);return s}function yW(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)?yW(e.children):void 0}})}function bW(t,e){const n=new Map(t.map(o=>[o.name,o])),r=new Map(e.map(o=>[o.name,o])),i=Array.from(new Set([...n.keys(),...r.keys()]));i.sort((o,a)=>{const l=n.get(o)??r.get(o),c=n.get(a)??r.get(a);return!l||!c?o.localeCompare(a):l.type!==c.type?l.type==="directory"?-1:1:l.name.localeCompare(c.name)});const s=[];for(const o of i){const a=n.get(o),l=r.get(o);if(!a&&!l)continue;const c=a??l;if(!c)continue;const d=a?l?"common":"removed":"added";if(c.type==="directory"){const h=bW((a==null?void 0:a.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"&&(a==null?void 0:a.hash)!=null&&(l==null?void 0:l.hash)!=null&&a.hash!==l.hash?"modified":d;s.push({name:c.name,path:c.path,type:"file",status:h})}}return s}function ehe(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 the(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 _W(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=_W(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 SW(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)&&SW(r.children,e))return!0;return!1}function EI(t){const e=new Set;for(const n of t)n.type==="directory"&&e.add(n.path);return e}function nhe({runPath:t,onBack:e}){const[n,r]=T.useState(null),[i,s]=T.useState(null),[o,a]=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}=fm(),N=(A==null?void 0:A.runs.find(Lt=>Lt.run_id===t))??null,I=(N==null?void 0:N.name)||t.split("/").pop()||t,P=(A==null?void 0:A.runs.find(Lt=>Lt.run_id===o))??null,L=(P==null?void 0:P.name)||(o==null?void 0:o.split("/").pop())||o,{data:R,isLoading:O,error:F}=tI(t,!!t),{data:U,isLoading:q,error:B}=tI(o||"",!!o),{data:Z,isFetching:G}=bue(o||"",t,!!o&&!!(R!=null&&R.available)&&!!(U!=null&&U.available)&&!q),$=T.useMemo(()=>R!=null&&R.available?R.tree:[],[R]),K=T.useMemo(()=>U!=null&&U.available?U.tree:[],[U]),Y=o!==null,J=Y&&!q&&(U==null?void 0:U.available)===!0,H=T.useMemo(()=>J?bW(K,$):yW($),[J,$,K]),z=EI(H),X=n??z,V=H.length===0?null:i&&SW(H,i)?i:_W(H),ie=Kfe(V),ae=!!V&&eR($,V),re=!!V&&eR(K,V),{data:ce,isLoading:oe,isFetching:fe,error:me}=nI(t,V??"",!!t&&!!V&&!!(R!=null&&R.available)&&ae),{data:ye,isLoading:Ee,isFetching:Ge,error:_e}=nI(o??"",V??"",!!o&&!!V&&!!(U!=null&&U.available)&&re),De=ae?ce:null,he=re?ye:null,Le=V&&(De==null?void 0:De.file_path)===V?De:null,ne=V&&(he==null?void 0:he.file_path)===V?he:null,We=(De==null?void 0:De.content)??null,je=(Le==null?void 0:Le.content)??null,be=(ne==null?void 0:ne.content)??null,Xe=ae?je:"",le=re?be:"",te=V&&(g==null?void 0:g.targetPath)===V?g:null,ve=Y&&!(Xe!==null&&le!==null)&&te!==null,ge=ve?te.rightContent:Xe,Te=ve?te.leftContent:le,He=Lt=>{r(on=>{const Ht=new Set(on??z);return Ht.has(Lt)?Ht.delete(Lt):Ht.add(Lt),Ht})},pe=(Lt,on)=>Lt.map(Ht=>{var Qn;const kn=Ht.status==="added"?"text-emerald-700 dark:text-emerald-400":Ht.status==="removed"?"text-[#f27c7e] line-through":Ht.status==="modified"?"text-[#ab6100]":"",Xn=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 Pn=X.has(Ht.path);return p.jsxs("div",{children:[p.jsxs("button",{type:"button",onClick:()=>He(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:`${on*14+6}px`},children:[p.jsx("span",{className:Nt("inline-flex h-4 w-4 items-center justify-center",Xn),children:Pn?p.jsx(Wr,{className:"h-3 w-3"}):p.jsx(Vg,{className:"h-3 w-3"})}),Pn?p.jsx(Vle,{className:Nt("h-3.5 w-3.5",Xn)}):p.jsx(Wle,{className:Nt("h-3.5 w-3.5",Xn)}),p.jsx("span",{className:Nt("truncate",kn),children:Ht.name})]}),Pn&&((Qn=Ht.children)!=null&&Qn.length)?pe(Ht.children,on+1):null]},Ht.path)}const zn=V===Ht.path;return p.jsxs("button",{type:"button",ref:Pn=>{_.current[Ht.path]=Pn},onClick:()=>{kt(Ht.path),s(Ht.path),Y&&(h(0),w.current=!0,S.current=Ht.path)},className:Nt("flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",zn&&"bg-muted font-medium"),style:{paddingLeft:`${on*14+26}px`},children:[p.jsx(Ble,{className:Nt("h-3.5 w-3.5",Xn)}),p.jsx("span",{className:Nt("truncate",kn),children:Ht.name})]},Ht.path)}),qe=T.useMemo(()=>qC(We??"",ie),[We,ie]),xt=T.useMemo(()=>qC(Te??"",ie),[Te,ie]),nt=T.useMemo(()=>qC(ge??"",ie),[ge,ie]),tt=T.useMemo(()=>!Y||!V?[]:Jfe(Te??"",ge??""),[Y,V,Te,ge]),Fe=!!V&&Y&&!ve&&(ae&&Xe===null&&!me||re&&le===null&&!_e),we=!!V&&Y&&(ae&&fe||re&&Ge),ke=!ae||Le!==null&&!oe&&!fe,Ze=!re||ne!==null&&!Ee&&!Ge,Ne=!!(ne!=null&&ne.is_binary),Ke=!!(De!=null&&De.is_binary),it=!!(Le!=null&&Le.is_binary),ht=Y?ae?ge:re?Te:null:We,$e=!!V&&ht!==null&&!(Y?ae?it:re?Ne:!1:Ke),Ae=T.useMemo(()=>the(tt),[tt]),Oe=T.useMemo(()=>ehe(H),[H]),Ye=V?Oe.indexOf(V):-1,st=Ae.length>0?(d%Ae.length+Ae.length)%Ae.length:0,Rt=Ae.length>0?st+1:0,yt=Oe.length>0&&Ye>=0?Ye+1:0,Tt=T.useMemo(()=>tt.reduce((Lt,on)=>Lt+(on.kind==="add"?1:0),0),[tt]),Et=T.useMemo(()=>tt.reduce((Lt,on)=>Lt+(on.kind==="remove"?1:0),0),[tt]),Dt=(Z==null?void 0:Z.added_lines)??0,Ue=(Z==null?void 0:Z.removed_lines)??0,ct=l!==null&&l===V,St=async()=>{!$e||ht===null||(await navigator.clipboard.writeText(ht),c(V),setTimeout(()=>c(null),2e3))},kt=Lt=>{Y&&v({targetPath:Lt,leftContent:Te??"",rightContent:ge??""})},Ut=Lt=>{var kn;if(Ae.length===0)return;const on=(st+Lt+Ae.length)%Ae.length;h(on);const Ht=Ae[on].startRowIndex;(kn=b.current[Ht])==null||kn.scrollIntoView({behavior:"smooth",block:"center"})},Xt=Lt=>{if(Oe.length===0)return;const on=Ye<0?Lt===1?0:Oe.length-1:(Ye+Lt+Oe.length)%Oe.length;if(on===Ye)return;const Ht=Oe[on];kt(Ht),s(Ht),r(kn=>{const Xn=new Set(kn??z);for(const zn of XC(Ht))Xn.add(zn);return Xn}),h(0),w.current=!0,S.current=Ht,setTimeout(()=>{var kn;(kn=_.current[Ht])==null||kn.scrollIntoView({behavior:"smooth",block:"center"})},0)},hn=()=>{if(Oe.length===0)return;const Lt=Oe[0];kt(Lt),s(Lt),r(on=>{const Ht=new Set(on??z);for(const kn of XC(Lt))Ht.add(kn);return Ht}),h(0),w.current=!0,S.current=Lt,setTimeout(()=>{var on;(on=_.current[Lt])==null||on.scrollIntoView({behavior:"smooth",block:"center"})},0)};return T.useEffect(()=>{E.current=o,o===null&&(w.current=!1,S.current=null)},[o]),T.useEffect(()=>{if(!Y||!o||!J||E.current!==o||(E.current=null,Oe.length===0))return;const Lt=Oe[0];w.current=!0,S.current=Lt;const on=window.setTimeout(()=>{var Ht;V!==Lt&&(v({targetPath:Lt,leftContent:Te??"",rightContent:ge??""}),s(Lt),r(kn=>{const Xn=new Set(kn??EI(H));for(const zn of XC(Lt))Xn.add(zn);return Xn})),h(0),(Ht=_.current[Lt])==null||Ht.scrollIntoView({behavior:"smooth",block:"center"})},0);return()=>window.clearTimeout(on)},[Y,o,J,Oe,V,Te,ge,H]),T.useEffect(()=>{if(!Y||!V||!w.current||S.current!==null&&S.current!==V||!ke||!Ze)return;const Lt=Ae.length>0?Ae[0].startRowIndex:null,on=requestAnimationFrame(()=>{var Ht;Lt!==null&&((Ht=b.current[Lt])==null||Ht.scrollIntoView({behavior:"smooth",block:"center"})),w.current=!1,S.current=null});return()=>cancelAnimationFrame(on)},[Y,V,Ae,ke,Ze]),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:G1(P.created_at)})]}),p.jsx(_le,{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:I}),(N==null?void 0:N.created_at)&&p.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:G1(N.created_at)})]})]}),p.jsxs("div",{className:"ml-2 flex shrink-0 items-center gap-2 tabular-nums",children:[p.jsxs("span",{className:Nt("text-emerald-700 transition-opacity dark:text-emerald-400",G&&"opacity-70"),children:["+",Dt]}),p.jsxs("span",{className:Nt("text-red-500 transition-opacity dark:text-red-300",G&&"opacity-70"),children:["-",Ue]})]}),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:()=>{a(null),v(null),h(0),w.current=!1,S.current=null},children:p.jsx(ed,{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"}):F?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(MI,{currentRunId:t,selectedCompareRunId:o,onSelectCompareRun:a,disabled:!V})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-2",children:pe(H,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:V??"Select a file"}),V&&p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button",onClick:St,disabled:!$e,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:ct?"Copied!":"Copy code",children:ct?p.jsx(yv,{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&&V&&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:["+",Tt]}),p.jsxs("span",{className:"text-red-500 dark:text-red-300",children:["-",Et]})]})]}),p.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[p.jsx("div",{className:Nt("h-full overflow-auto",Y&&"pb-14"),children:V?Y?q&&!U?p.jsx("div",{className:"h-full"}):B?p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load compared run code."}):o&&!q&&U&&!U.available?p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Compared run has no downloaded code snapshot."}):Fe?p.jsx("div",{className:"h-full"}):ae&&me&&!Le||re&&_e&&!ne?p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load one side of the comparison."}):it||Ne?p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Binary file comparison is not supported."}):p.jsx("div",{className:Nt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",we&&"opacity-50"),children:tt.map((Lt,on)=>{const Ht=Lt.kind==="add"?nt[(Lt.rightLine??1)-1]??T0(Lt.text.length>0?Lt.text:" ",ie):xt[(Lt.leftLine??1)-1]??T0(Lt.text.length>0?Lt.text:" ",ie);return p.jsxs("div",{ref:kn=>{Lt.kind!=="context"&&(b.current[on]=kn)},className:Nt("flex",Lt.kind==="add"&&"bg-emerald-500/18",Lt.kind==="remove"&&"bg-red-400/10"),children:[p.jsxs("div",{className:Nt("sticky left-0 z-10 flex shrink-0 bg-background",Lt.kind==="add"&&"border-l-2 border-emerald-500/60",Lt.kind==="remove"&&"border-l-2 border-red-400/35"),children:[p.jsx("span",{className:Nt("select-none w-6 px-1.5 py-0.5 text-right text-[11px]",Lt.kind==="add"&&"bg-emerald-500/18 text-emerald-700 dark:text-emerald-400",Lt.kind==="remove"&&"bg-red-400/10 text-red-500 dark:text-red-300",Lt.kind==="context"&&"text-muted-foreground"),children:Lt.kind==="add"?"+":Lt.kind==="remove"?"-":" "}),p.jsx("span",{className:Nt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",Lt.kind==="add"&&"bg-emerald-500/18",Lt.kind==="remove"&&"bg-red-400/10"),children:Lt.leftLine??""}),p.jsx("span",{className:Nt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",Lt.kind==="add"&&"bg-emerald-500/18",Lt.kind==="remove"&&"bg-red-400/10"),children:Lt.rightLine??""})]}),p.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:Ht.map((kn,Xn)=>p.jsx("span",{className:Nt(kn.className),children:kn.text},`diff-line-${on}-token-${Xn}`))})]},`diff-line-${on}`)})}):oe&&!De?p.jsx("div",{className:"h-full"}):me&&!De?p.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load file content."}):Ke?p.jsx("div",{className:Nt("p-4 text-sm text-muted-foreground transition-opacity",fe&&"opacity-50"),children:"Binary file preview is not supported."}):p.jsxs("div",{className:Nt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",fe&&"opacity-50"),children:[(De==null?void 0:De.truncated)&&p.jsx("div",{className:"border-b px-3 py-1 text-[11px] text-muted-foreground",children:"Showing first 2MB of this file."}),qe.map((Lt,on)=>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:on+1})}),p.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:Lt.map((Ht,kn)=>p.jsx("span",{className:Nt(Ht.className),children:Ht.text},`line-${on}-token-${kn}`))})]},`line-${on}`))]}):p.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Select a file on the left to view its source."})}),Y&&V&&p.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",children:Ae.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:hn,disabled:Oe.length===0,children:p.jsxs("span",{className:"inline-flex items-center gap-1",children:[p.jsx("span",{children:"See Changes"}),p.jsx(Vg,{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:()=>Ut(-1),disabled:Ae.length===0,children:p.jsx(p8,{className:"h-3.5 w-3.5"})}),p.jsxs("span",{className:"min-w-[4rem] text-center tabular-nums",children:[Rt," / ",Ae.length]}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Ut(1),disabled:Ae.length===0,children:p.jsx(Wr,{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:()=>Xt(-1),disabled:Oe.length===0,children:p.jsx(h8,{className:"h-3.5 w-3.5"})}),p.jsxs("span",{className:"min-w-[6rem] text-center tabular-nums",children:[yt," / ",Oe.length," files"]}),p.jsx(Tn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Xt(1),disabled:Oe.length===0,children:p.jsx(Vg,{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(MI,{currentRunId:t,selectedCompareRunId:o,onSelectCompareRun:a,disabled:!V})]}),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 hm({description:t}){const e=Pi(vG),n=jd(xG),r=jd(yG),{data:i,isLoading:s}=fm(),o=(i==null?void 0:i.runs)??[],a=i==null?void 0:i.discovery,l=(i==null?void 0:i.has_wandb_key)??e,c=o.length>0,d=(i==null?void 0:i.has_known_projects)??!1,h=(a==null?void 0:a.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(yI,{className:"items-center text-center",children:[p.jsx(i4,{children:"Fetching runs from W&B…"}),p.jsxs(s4,{className:"flex items-center gap-1.5 font-medium",children:[p.jsx(al,{className:"h-3 w-3 shrink-0"}),(a==null?void 0:a.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(yI,{className:"text-center items-center",children:g?p.jsxs(p.Fragment,{children:[p.jsx(i4,{children:"No wandb key added yet"}),p.jsx(s4,{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(i4,{children:"Add a project"}),p.jsx(s4,{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(i4,{children:"No Run Selected"}),p.jsx(s4,{children:t})]})})})})}const rhe=!0,ca="u-",ihe="uplot",she=ca+"hz",ohe=ca+"vt",ahe=ca+"title",lhe=ca+"wrap",che=ca+"under",uhe=ca+"over",dhe=ca+"axis",Eg=ca+"off",fhe=ca+"select",hhe=ca+"cursor-x",phe=ca+"cursor-y",mhe=ca+"cursor-pt",ghe=ca+"legend",vhe=ca+"live",xhe=ca+"inline",yhe=ca+"series",bhe=ca+"marker",CI=ca+"label",_he=ca+"value",p_="width",m_="height",Vb="top",AI="bottom",Mx="left",YC="right",O8="#000",NI=O8+"0",KC="mousemove",RI="mousedown",ZC="mouseup",kI="mouseenter",PI="mouseleave",DI="dblclick",She="resize",whe="scroll",II="change",x2="dppxchange",L8="--",wy=typeof window<"u",tR=wy?document:null,m1=wy?window:null,Mhe=wy?navigator:null;let Ri,o4;function nR(){let t=devicePixelRatio;Ri!=t&&(Ri=t,o4&&iR(II,o4,nR),o4=matchMedia(`(min-resolution: ${Ri-.001}dppx) and (max-resolution: ${Ri+.001}dppx)`),Wg(II,o4,nR),m1.dispatchEvent(new CustomEvent(x2)))}function Wc(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 Rd(t,e,n,r){let i=tR.createElement(t);return e!=null&&Wc(i,e),n!=null&&n.insertBefore(i,r),i}function Ou(t,e){return Rd("div",t,e)}const OI=new WeakMap;function Ef(t,e,n,r,i){let s="translate("+e+"px,"+n+"px)",o=OI.get(t);s!=o&&(t.style.transform=s,OI.set(t,s),e<0||n<0||e>r||n>i?Wc(t,Eg):rR(t,Eg))}const LI=new WeakMap;function zI(t,e,n){let r=e+n,i=LI.get(t);r!=i&&(LI.set(t,r),t.style.background=e,t.style.borderColor=n)}const jI=new WeakMap;function FI(t,e,n,r){let i=e+""+n,s=jI.get(t);i!=s&&(jI.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 z8={passive:!0},The={...z8,capture:!0};function Wg(t,e,n,r){e.addEventListener(t,n,r?The:z8)}function iR(t,e,n,r){e.removeEventListener(t,n,z8)}wy&&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:tu((n+r)/2),e[i]<t?n=i:r=i;return t-e[n]<=e[r]-t?n:r}function wW(t){return(n,r,i)=>{let s=-1,o=-1;for(let a=r;a<=i;a++)if(t(n[a])){s=a;break}for(let a=i;a>=r;a--)if(t(n[a])){o=a;break}return[s,o]}}const MW=t=>t!=null,TW=t=>t!=null&&t>0,_T=wW(MW),Ehe=wW(TW);function Che(t,e,n,r=0,i=!1){let s=i?Ehe:_T,o=i?TW:MW;[e,n]=s(t,e,n);let a=t[e],l=t[e];if(e>-1)if(r==1)a=t[e],l=t[n];else if(r==-1)a=t[n],l=t[e];else for(let c=e;c<=n;c++){let d=t[c];o(d)&&(d<a?a=d:d>l&&(l=d))}return[a??ts,l??-ts]}function ST(t,e,n,r){let i=HI(t),s=HI(e);t==e&&(i==-1?(t*=n,e/=n):(t/=n,e*=n));let o=n==10?ap:EW,a=i==1?tu:Uu,l=s==1?Uu:tu,c=a(o(ra(t))),d=l(o(ra(e))),h=q1(n,c),g=q1(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=RW(t,h),e=wT(e,g)),[t,e]}function j8(t,e,n,r){let i=ST(t,e,n,r);return t==0&&(i[0]=0),e==0&&(i[1]=0),i}const F8=.1,UI={mode:3,pad:F8},C_={pad:0,soft:null,mode:0},Ahe={min:C_,max:C_};function y2(t,e,n,r){return MT(n)?BI(t,e,n):(C_.pad=n,C_.soft=r?0:null,C_.mode=r?3:0,BI(t,e,Ahe))}function Mi(t,e){return t??e}function Nhe(t,e,n){for(e=Mi(e,0),n=Mi(n,t.length-1);e<=n;){if(t[e]!=null)return!0;e++}return!1}function BI(t,e,n){let r=n.min,i=n.max,s=Mi(r.pad,0),o=Mi(i.pad,0),a=Mi(r.hard,-ts),l=Mi(i.hard,ts),c=Mi(r.soft,ts),d=Mi(i.soft,-ts),h=Mi(r.mode,0),g=Mi(i.mode,0),v=e-t,b=ap(v),_=Bl(ra(t),ra(e)),w=ap(_),S=ra(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&&(o=0)));let E=v||_||1e3,A=ap(E),N=q1(10,tu(A)),I=E*(v==0?t==0?.1:1:s),P=ns(RW(t-I,N/10),24),L=t>=c&&(h==1||h==3&&P<=c||h==2&&P>=c)?c:ts,R=Bl(a,P<L&&t>=L?L:Ld(L,P)),O=E*(v==0?e==0?.1:1:o),F=ns(wT(e+O,N/10),24),U=e<=d&&(g==1||g==3&&F>=d||g==2&&F<=d)?d:-ts,q=Ld(l,F>U&&e<=U?U:Bl(U,F));return R==q&&R==0&&(q=100),[R,q]}const Rhe=new Intl.NumberFormat(wy?Mhe.language:"en-US"),U8=t=>Rhe.format(t),cu=Math,jM=cu.PI,ra=cu.abs,tu=cu.floor,na=cu.round,Uu=cu.ceil,Ld=cu.min,Bl=cu.max,q1=cu.pow,HI=cu.sign,ap=cu.log10,EW=cu.log2,khe=(t,e=1)=>cu.sinh(t)*e,QC=(t,e=1)=>cu.asinh(t/e),ts=1/0;function VI(t){return(ap((t^t>>31)-(t>>31))|0)+1}function sR(t,e,n){return Ld(Bl(t,e),n)}function CW(t){return typeof t=="function"}function si(t){return CW(t)?t:()=>t}const Phe=()=>{},AW=t=>t,NW=(t,e)=>e,Dhe=t=>null,GI=t=>!0,WI=(t,e)=>t==e,Ihe=/\.\d*?(?=9{6,}|0{6,})/gm,ov=t=>{if(PW(t)||Y0.has(t))return t;const e=`${t}`,n=e.match(Ihe);if(n==null)return t;let r=n[0].length-1;if(e.indexOf("e-")!=-1){let[i,s]=e.split("e");return+`${ov(i)}e${s}`}return ns(t,r)};function _g(t,e){return ov(ns(ov(t/e))*e)}function wT(t,e){return ov(Uu(ov(t/e))*e)}function RW(t,e){return ov(tu(ov(t/e))*e)}function ns(t,e=0){if(PW(t))return t;let n=10**e,r=t*n*(1+Number.EPSILON);return na(r)/n}const Y0=new Map;function kW(t){return((""+t).split(".")[1]||"").length}function uS(t,e,n,r){let i=[],s=r.map(kW);for(let o=e;o<n;o++){let a=ra(o),l=ns(q1(t,o),a);for(let c=0;c<r.length;c++){let d=t==10?+`${r[c]}e${o}`:r[c]*l,h=(o>=0?0:a)+(o>=s[c]?0:s[c]),g=t==10?d:ns(d,h);i.push(g),Y0.set(g,h)}}return i}const A_={},B8=[],X1=[null,null],E0=Array.isArray,PW=Number.isInteger,Ohe=t=>t===void 0;function $I(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 Lhe(t){return t!=null&&typeof t=="object"}const zhe=Object.getPrototypeOf(Uint8Array),DW="__proto__";function Y1(t,e=MT){let n;if(E0(t)){let r=t.find(i=>i!=null);if(E0(r)||e(r)){n=Array(t.length);for(let i=0;i<t.length;i++)n[i]=Y1(t[i],e)}else n=t.slice()}else if(t instanceof zhe)n=t.slice();else if(e(t)){n={};for(let r in t)r!=DW&&(n[r]=Y1(t[r],e))}else n=t;return n}function Ho(t){let e=arguments;for(let n=1;n<e.length;n++){let r=e[n];for(let i in r)i!=DW&&(MT(t[i])?Ho(t[i],Y1(r[i])):t[i]=Y1(r[i]))}return t}const jhe=0,Fhe=1,Uhe=2;function Bhe(t,e,n){for(let r=0,i,s=-1;r<e.length;r++){let o=e[r];if(o>s){for(i=o-1;i>=0&&t[i]==null;)t[i--]=null;for(i=o+1;i<n&&t[i]==null;)t[s=i++]=null}}}function Hhe(t,e){if(Whe(t)){let o=t[0].slice();for(let a=1;a<t.length;a++)o.push(...t[a].slice(1));return $he(o[0])||(o=Ghe(o)),o}let n=new Set;for(let o=0;o<t.length;o++){let l=t[o][0],c=l.length;for(let d=0;d<c;d++)n.add(l[d])}let r=[Array.from(n).sort((o,a)=>o-a)],i=r[0].length,s=new Map;for(let o=0;o<i;o++)s.set(r[0][o],o);for(let o=0;o<t.length;o++){let a=t[o],l=a[0];for(let c=1;c<a.length;c++){let d=a[c],h=Array(i).fill(void 0),g=e?e[o][c]:Fhe,v=[];for(let b=0;b<d.length;b++){let _=d[b],w=s.get(l[b]);_===null?g!=jhe&&(h[w]=_,g==Uhe&&v.push(w)):h[w]=_}Bhe(h,v,i),r.push(h)}}return r}const Vhe=typeof queueMicrotask>"u"?t=>Promise.resolve().then(t):queueMicrotask;function Ghe(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,o)=>e[s]-e[o]);let i=[];for(let s=0;s<t.length;s++){let o=t[s],a=Array(n);for(let l=0;l<n;l++)a[l]=o[r[l]];i.push(a)}return i}function Whe(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 $he(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=Bl(1,tu((i-r+1)/e));for(let o=t[r],a=r+s;a<=i;a+=s){const l=t[a];if(l!=null){if(l<=o)return!1;o=l}}return!0}const IW=["January","February","March","April","May","June","July","August","September","October","November","December"],OW=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function LW(t){return t.slice(0,3)}const qhe=OW.map(LW),Xhe=IW.map(LW),Yhe={MMMM:IW,MMM:Xhe,WWWW:OW,WWW:qhe};function Gb(t){return(t<10?"0":"")+t}function Khe(t){return(t<10?"00":t<100?"0":"")+t}const Zhe={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=>Gb(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>Gb(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>Gb(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=>Gb(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>Gb(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>Khe(t.getMilliseconds())};function H8(t,e){e=e||Yhe;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(t);)n.push(i[0][0]=="{"?Zhe[i[1]]:i[0]);return s=>{let o="";for(let a=0;a<n.length;a++)o+=typeof n[a]=="string"?n[a]:n[a](s,e);return o}}const Qhe=new Intl.DateTimeFormat().resolvedOptions().timeZone;function Jhe(t,e){let n;return e=="UTC"||e=="Etc/UTC"?n=new Date(+t+t.getTimezoneOffset()*6e4):e==Qhe?n=t:(n=new Date(t.toLocaleString("en-US",{timeZone:e})),n.setMilliseconds(t.getMilliseconds())),n}const zW=t=>t%1==0,b2=[1,2,2.5,5],epe=uS(10,-32,0,b2),jW=uS(10,0,32,b2),tpe=jW.filter(zW),Sg=epe.concat(jW),V8=`
`,FW="{YYYY}",qI=V8+FW,UW="{M}/{D}",g_=V8+UW,a4=g_+"/{YY}",BW="{aa}",npe="{h}:{mm}",Jx=npe+BW,XI=V8+Jx,YI=":{ss}",ji=null;function HW(t){let e=t*1e3,n=e*60,r=n*60,i=r*24,s=i*30,o=i*365,l=(t==1?uS(10,0,3,b2).filter(zW):uS(10,-3,0,b2)).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,o,o*2,o*5,o*10,o*25,o*50,o*100]);const c=[[o,FW,ji,ji,ji,ji,ji,ji,1],[i*28,"{MMM}",qI,ji,ji,ji,ji,ji,1],[i,UW,qI,ji,ji,ji,ji,ji,1],[r,"{h}"+BW,a4,ji,g_,ji,ji,ji,1],[n,Jx,a4,ji,g_,ji,ji,ji,1],[e,YI,a4+" "+Jx,ji,g_+" "+Jx,ji,XI,ji,1],[t,YI+".{fff}",a4+" "+Jx,ji,g_+" "+Jx,ji,XI,ji,1]];function d(h){return(g,v,b,_,w,S)=>{let E=[],A=w>=o,N=w>=s&&w<o,I=h(b),P=ns(I*t,3),L=JC(I.getFullYear(),A?0:I.getMonth(),N||A?1:I.getDate()),R=ns(L*t,3);if(N||A){let O=N?w/s:0,F=A?w/o:0,U=P==R?P:ns(JC(L.getFullYear()+F,L.getMonth()+O,1)*t,3),q=new Date(na(U/t)),B=q.getFullYear(),Z=q.getMonth();for(let G=0;U<=_;G++){let $=JC(B+F*G,Z+O*G,1),K=$-h(ns($*t,3));U=ns((+$+K)*t,3),U<=_&&E.push(U)}}else{let O=w>=i?i:w,F=tu(b)-tu(P),U=R+F+wT(P-R,O);E.push(U);let q=h(U),B=q.getHours()+q.getMinutes()/n+q.getSeconds()/r,Z=w/r,G=g.axes[v]._space,$=S/G;for(;U=ns(U+w,t==1?0:3),!(U>_);)if(Z>1){let K=tu(ns(B+Z,6))%24,H=h(U).getHours()-K;H>1&&(H=-1),U-=H*r,B=(B+Z)%24;let z=E[E.length-1];ns((U-z)/w,3)*$>=.7&&E.push(U)}else E.push(U)}return E}}return[l,c,d]}const[rpe,ipe,spe]=HW(1),[ope,ape,lpe]=HW(.001);uS(2,-53,53,[1]);function KI(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 ZI(t,e){return(n,r,i,s,o)=>{let a=e.find(b=>o>=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(),I=_.getSeconds(),P=w!=l&&a[2]||S!=c&&a[3]||E!=d&&a[4]||A!=h&&a[5]||N!=g&&a[6]||I!=v&&a[7]||a[1];return l=w,c=S,d=E,h=A,g=N,v=I,P(_)})}}function cpe(t,e){let n=H8(e);return(r,i,s,o,a)=>i.map(l=>n(t(l)))}function JC(t,e,n){return new Date(t,e,n)}function QI(t,e){return e(t)}const upe="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function JI(t,e){return(n,r,i,s)=>s==null?L8:e(t(r))}function dpe(t,e){let n=t.series[e];return n.width?n.stroke(t,e):n.points.width?n.points.stroke(t,e):null}function fpe(t,e){return t.series[e].fill(t,e)}const hpe={show:!0,live:!0,isolate:!1,mount:Phe,markers:{show:!0,width:2,stroke:dpe,fill:fpe,dash:"solid"},idx:null,idxs:null,values:[]};function ppe(t,e){let n=t.cursor.points,r=Ou(),i=n.size(t,e);As(r,p_,i),As(r,m_,i);let s=i/-2;As(r,"marginLeft",s),As(r,"marginTop",s);let o=n.width(t,e,i);return o&&As(r,"borderWidth",o),r}function mpe(t,e){let n=t.series[e].points;return n._fill||n._stroke}function gpe(t,e){let n=t.series[e].points;return n._stroke||n._fill}function vpe(t,e){return t.series[e].points.size}const eA=[0,0];function xpe(t,e,n){return eA[0]=e,eA[1]=n,eA}function l4(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 ype={show:!0,x:!0,y:!0,lock:!1,move:xpe,points:{one:!1,show:ppe,size:vpe,width:0,stroke:gpe,fill:mpe},bind:{mousedown:l4,mouseup:l4,click:l4,dblclick:l4,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},VW={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},G8=Ho({},VW,{filter:NW}),GW=Ho({},G8,{size:10}),WW=Ho({},VW,{show:!1}),W8='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"',$W="bold "+W8,qW=1.5,eO={show:!0,scale:"x",stroke:O8,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:$W,side:2,grid:G8,ticks:GW,border:WW,font:W8,lineGap:qW,rotate:0},bpe="Value",_pe="Time",tO={show:!0,scale:"x",auto:!1,sorted:1,min:ts,max:-ts,idxs:[]};function Spe(t,e,n,r,i){return e.map(s=>s==null?"":U8(s))}function wpe(t,e,n,r,i,s,o){let a=[],l=Y0.get(i)||0;n=o?n:ns(wT(n,i),l);for(let c=n;c<=r;c=ns(c+i,l))a.push(Object.is(c,-0)?0:c);return a}function oR(t,e,n,r,i,s,o){const a=[],l=t.scales[t.axes[e].scale].log,c=l==10?ap:EW,d=tu(c(n));i=q1(l,d),l==10&&(i=Sg[Id(i,Sg)]);let h=n,g=i*l;l==10&&(g=Sg[Id(g,Sg)]);do a.push(h),h=h+i,l==10&&!Y0.has(h)&&(h=ns(h,Y0.get(i))),h>=g&&(i=h,g=i*l,l==10&&(g=Sg[Id(g,Sg)]));while(h<=r);return a}function Mpe(t,e,n,r,i,s,o){let l=t.scales[t.axes[e].scale].asinh,c=r>l?oR(t,e,Bl(l,n),r,i):[l],d=r>=0&&n<=0?[0]:[];return(n<-l?oR(t,e,Bl(l,-r),-n,i):[l]).reverse().map(g=>-g).concat(d,c)}const XW=/./,Tpe=/[12357]/,Epe=/[125]/,nO=/1/,aR=(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 Cpe(t,e,n,r,i){let s=t.axes[n],o=s.scale,a=t.scales[o],l=t.valToPos,c=s._space,d=l(10,o),h=l(9,o)-d>=c?XW:l(7,o)-d>=c?Tpe:l(5,o)-d>=c?Epe:nO;if(h==nO){let g=ra(l(1,o)-d);if(g<c)return aR(e.slice().reverse(),a.distr,h,Uu(c/g)).reverse()}return aR(e,a.distr,h,1)}function Ape(t,e,n,r,i){let s=t.axes[n],o=s.scale,a=s._space,l=t.valToPos,c=ra(l(1,o)-l(2,o));return c<a?aR(e.slice().reverse(),3,XW,Uu(a/c)).reverse():e}function Npe(t,e,n,r){return r==null?L8:e==null?"":U8(e)}const rO={show:!0,scale:"y",stroke:O8,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:$W,side:3,grid:G8,ticks:GW,border:WW,font:W8,lineGap:qW,rotate:0};function Rpe(t,e){let n=3+(t||1)*2;return ns(n*e,3)}function kpe(t,e){let{scale:n,idxs:r}=t.series[0],i=t._data[0],s=t.valToPos(i[r[0]],n,!0),o=t.valToPos(i[r[1]],n,!0),a=ra(o-s),l=t.series[e],c=a/(l.points.space*Ri);return r[1]-r[0]<=c}const iO={scale:null,auto:!0,sorted:0,min:ts,max:-ts},YW=(t,e,n,r,i)=>i,sO={show:!0,auto:!0,sorted:0,gaps:YW,alpha:1,facets:[Ho({},iO,{scale:"x"}),Ho({},iO,{scale:"y"})]},oO={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:YW,alpha:1,points:{show:kpe,filter:null},values:null,min:ts,max:-ts,idxs:[],path:null,clip:null};function Ppe(t,e,n,r,i){return n/10}const KW={time:rhe,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},Dpe=Ho({},KW,{time:!1,ori:1}),aO={};function ZW(t,e){let n=aO[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,o,a,l,c){for(let d=0;d<n.plots.length;d++)n.plots[d]!=i&&n.plots[d].pub(r,i,s,o,a,l,c)}},t!=null&&(aO[t]=n)),n}const K1=1,lR=2;function _v(t,e,n){const r=t.mode,i=t.series[e],s=r==2?t._data[e]:t._data,o=t.scales,a=t.bbox;let l=s[0],c=r==2?s[1]:s[e],d=r==2?o[i.facets[0].scale]:o[t.series[0].scale],h=r==2?o[i.facets[1].scale]:o[i.scale],g=a.left,v=a.top,b=a.width,_=a.height,w=t.valToPosH,S=t.valToPosV;return d.ori==0?n(i,l,c,d,h,w,S,g,v,b,_,ET,My,AT,JW,t$):n(i,l,c,d,h,S,w,v,g,_,b,CT,Ty,X8,e$,n$)}function $8(t,e){let n=0,r=0,i=Mi(t.bands,B8);for(let s=0;s<i.length;s++){let o=i[s];o.series[0]==e?n=o.dir:o.series[1]==e&&(o.dir==1?r|=1:r|=2)}return[n,r==1?-1:r==2?1:r==3?2:0]}function Ipe(t,e,n,r,i){let s=t.mode,o=t.series[e],a=s==2?o.facets[1].scale:o.scale,l=t.scales[a];return i==-1?l.min:i==1?l.max:l.distr==3?l.dir==1?l.min:l.max:0}function lp(t,e,n,r,i,s){return _v(t,e,(o,a,l,c,d,h,g,v,b,_,w)=>{let S=o.pxRound;const E=c.dir*(c.ori==0?1:-1),A=c.ori==0?My:Ty;let N,I;E==1?(N=n,I=r):(N=r,I=n);let P=S(h(a[N],c,_,v)),L=S(g(l[N],d,w,b)),R=S(h(a[I],c,_,v)),O=S(g(s==1?d.max:d.min,d,w,b)),F=new Path2D(i);return A(F,R,O),A(F,P,O),A(F,P,L),F})}function TT(t,e,n,r,i,s){let o=null;if(t.length>0){o=new Path2D;const a=e==0?AT:X8;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&&a(o,l,r,v,r+s),l=g[1]}}let c=n+i-l,d=10;c>0&&a(o,l,r-d/2,c,r+s+d)}return o}function Ope(t,e,n){let r=t[t.length-1];r&&r[0]==e?r[1]=n:t.push([e,n])}function q8(t,e,n,r,i,s,o){let a=[],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=o<=0&&_>=0&&_<l?s(t[_]):v;let S=g+i;b=o>=0&&S>=0&&S<l?s(t[S]):b,b>=v&&a.push([v,b])}return a}function lO(t){return t==0?AW:t==1?na:e=>_g(e,t)}function QW(t){let e=t==0?ET:CT,n=t==0?(i,s,o,a,l,c)=>{i.arcTo(s,o,a,l,c)}:(i,s,o,a,l,c)=>{i.arcTo(o,s,l,a,c)},r=t==0?(i,s,o,a,l)=>{i.rect(s,o,a,l)}:(i,s,o,a,l)=>{i.rect(o,s,l,a)};return(i,s,o,a,l,c=0,d=0)=>{c==0&&d==0?r(i,s,o,a,l):(c=Ld(c,a/2,l/2),d=Ld(d,a/2,l/2),e(i,s+c,o),n(i,s+a,o,s+a,o+l,c),n(i,s+a,o+l,s,o+l,d),n(i,s,o+l,s,o,d),n(i,s,o,s+a,o,c),i.closePath())}}const ET=(t,e,n)=>{t.moveTo(e,n)},CT=(t,e,n)=>{t.moveTo(n,e)},My=(t,e,n)=>{t.lineTo(e,n)},Ty=(t,e,n)=>{t.lineTo(n,e)},AT=QW(0),X8=QW(1),JW=(t,e,n,r,i,s)=>{t.arc(e,n,r,i,s)},e$=(t,e,n,r,i,s)=>{t.arc(n,e,r,i,s)},t$=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(e,n,r,i,s,o)},n$=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(n,e,i,r,o,s)};function r$(t){return(e,n,r,i,s)=>_v(e,n,(o,a,l,c,d,h,g,v,b,_,w)=>{let{pxRound:S,points:E}=o,A,N;c.ori==0?(A=ET,N=JW):(A=CT,N=e$);const I=ns(E.width*Ri,3);let P=(E.size-E.width)/2*Ri,L=ns(P*2,3),R=new Path2D,O=new Path2D,{left:F,top:U,width:q,height:B}=e.bbox;AT(O,F-L,U-L,q+L*2,B+L*2);const Z=G=>{if(l[G]!=null){let $=S(h(a[G],c,_,v)),K=S(g(l[G],d,w,b));A(R,$+P,K),N(R,$,K,P,0,jM*2)}};if(s)s.forEach(Z);else for(let G=r;G<=i;G++)Z(G);return{stroke:I>0?R:null,fill:R,clip:O,flags:K1|lR}})}function i$(t){return(e,n,r,i,s,o)=>{r!=i&&(s!=r&&o!=r&&t(e,n,r),s!=i&&o!=i&&t(e,n,i),t(e,n,o))}}const Lpe=i$(My),zpe=i$(Ty);function s$(t){const e=Mi(t==null?void 0:t.alignGaps,0);return(n,r,i,s)=>_v(n,r,(o,a,l,c,d,h,g,v,b,_,w)=>{[i,s]=_T(l,i,s);let S=o.pxRound,E=B=>S(h(B,c,_,v)),A=B=>S(g(B,d,w,b)),N,I;c.ori==0?(N=My,I=Lpe):(N=Ty,I=zpe);const P=c.dir*(c.ori==0?1:-1),L={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:K1},R=L.stroke;let O=!1;if(s-i>=_*4){let B=V=>n.posToVal(V,c.key,!0),Z=null,G=null,$,K,Y,J=E(a[P==1?i:s]),H=E(a[i]),z=E(a[s]),X=B(P==1?H+1:z-1);for(let V=P==1?i:s;V>=i&&V<=s;V+=P){let ie=a[V],re=(P==1?ie<X:ie>X)?J:E(ie),ce=l[V];re==J?ce!=null?(K=ce,Z==null?(N(R,re,A(K)),$=Z=G=K):K<Z?Z=K:K>G&&(G=K)):ce===null&&(O=!0):(Z!=null&&I(R,J,A(Z),A(G),A($),A(K)),ce!=null?(K=ce,N(R,re,A(K)),Z=G=$=K):(Z=G=null,ce===null&&(O=!0)),J=re,X=B(J+P))}Z!=null&&Z!=G&&Y!=J&&I(R,J,A(Z),A(G),A($),A(K))}else for(let B=P==1?i:s;B>=i&&B<=s;B+=P){let Z=l[B];Z===null?O=!0:Z!=null&&N(R,E(a[B]),A(Z))}let[U,q]=$8(n,r);if(o.fill!=null||U!=0){let B=L.fill=new Path2D(R),Z=o.fillTo(n,r,o.min,o.max,U),G=A(Z),$=E(a[i]),K=E(a[s]);P==-1&&([K,$]=[$,K]),N(B,K,G),N(B,$,G)}if(!o.spanGaps){let B=[];O&&B.push(...q8(a,l,i,s,P,E,e)),L.gaps=B=o.gaps(n,r,i,s,B),L.clip=TT(B,c.ori,v,b,_,w)}return q!=0&&(L.band=q==2?[lp(n,r,i,s,R,-1),lp(n,r,i,s,R,1)]:lp(n,r,i,s,R,q)),L})}function jpe(t){const e=Mi(t.align,1),n=Mi(t.ascDesc,!1),r=Mi(t.alignGaps,0),i=Mi(t.extend,!1);return(s,o,a,l)=>_v(s,o,(c,d,h,g,v,b,_,w,S,E,A)=>{[a,l]=_T(h,a,l);let N=c.pxRound,{left:I,width:P}=s.bbox,L=H=>N(b(H,g,E,w)),R=H=>N(_(H,v,A,S)),O=g.ori==0?My:Ty;const F={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:K1},U=F.stroke,q=g.dir*(g.ori==0?1:-1);let B=R(h[q==1?a:l]),Z=L(d[q==1?a:l]),G=Z,$=Z;i&&e==-1&&($=I,O(U,$,B)),O(U,Z,B);for(let H=q==1?a:l;H>=a&&H<=l;H+=q){let z=h[H];if(z==null)continue;let X=L(d[H]),V=R(z);e==1?O(U,X,B):O(U,G,V),O(U,X,V),B=V,G=X}let K=G;i&&e==1&&(K=I+P,O(U,K,B));let[Y,J]=$8(s,o);if(c.fill!=null||Y!=0){let H=F.fill=new Path2D(U),z=c.fillTo(s,o,c.min,c.max,Y),X=R(z);O(H,K,X),O(H,$,X)}if(!c.spanGaps){let H=[];H.push(...q8(d,h,a,l,q,L,r));let z=c.width*Ri/2,X=n||e==1?z:-z,V=n||e==-1?-z:z;H.forEach(ie=>{ie[0]+=X,ie[1]+=V}),F.gaps=H=c.gaps(s,o,a,l,H),F.clip=TT(H,g.ori,w,S,E,A)}return J!=0&&(F.band=J==2?[lp(s,o,a,l,U,-1),lp(s,o,a,l,U,1)]:lp(s,o,a,l,U,J)),F})}function cO(t,e,n,r,i,s,o=ts){if(t.length>1){let a=null;for(let l=0,c=1/0;l<t.length;l++)if(e[l]!==void 0){if(a!=null){let d=ra(t[l]-t[a]);d<c&&(c=d,o=ra(n(t[l],r,i,s)-n(t[a],r,i,s)))}a=l}}return o}function Fpe(t){t=t||A_;const e=Mi(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=si(i),o=1-e[0],a=Mi(e[1],ts),l=Mi(e[2],1),c=Mi(t.disp,A_),d=Mi(t.each,v=>{}),{fill:h,stroke:g}=c;return(v,b,_,w)=>_v(v,b,(S,E,A,N,I,P,L,R,O,F,U)=>{let q=S.pxRound,B=n,Z=r*Ri,G=a*Ri,$=l*Ri,K,Y;N.ori==0?[K,Y]=s(v,b):[Y,K]=s(v,b);const J=N.dir*(N.ori==0?1:-1);let H=N.ori==0?AT:X8,z=N.ori==0?d:(Se,ve,ge,Te,He,pe,qe)=>{d(Se,ve,ge,He,Te,qe,pe)},X=Mi(v.bands,B8).find(Se=>Se.series[0]==b),V=X!=null?X.dir:0,ie=S.fillTo(v,b,S.min,S.max,V),ae=q(L(ie,I,U,O)),re,ce,oe,fe=F,me=q(S.width*Ri),ye=!1,Ee=null,Ge=null,_e=null,De=null;h!=null&&(me==0||g!=null)&&(ye=!0,Ee=h.values(v,b,_,w),Ge=new Map,new Set(Ee).forEach(Se=>{Se!=null&&Ge.set(Se,new Path2D)}),me>0&&(_e=g.values(v,b,_,w),De=new Map,new Set(_e).forEach(Se=>{Se!=null&&De.set(Se,new Path2D)})));let{x0:he,size:Le}=c;if(he!=null&&Le!=null){B=1,E=he.values(v,b,_,w),he.unit==2&&(E=E.map(ge=>v.posToVal(R+ge*F,N.key,!0)));let Se=Le.values(v,b,_,w);Le.unit==2?ce=Se[0]*F:ce=P(Se[0],N,F,R)-P(0,N,F,R),fe=cO(E,A,P,N,F,R,fe),oe=fe-ce+Z}else fe=cO(E,A,P,N,F,R,fe),oe=fe*o+Z,ce=fe-oe;oe<1&&(oe=0),me>=ce/2&&(me=0),oe<5&&(q=AW);let ne=oe>0,We=fe-oe-(ne?me:0);ce=q(sR(We,$,G)),re=(B==0?ce/2:B==J?0:ce)-B*J*((B==0?Z/2:0)+(ne?me/2:0));const je={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},be=ye?null:new Path2D;let Xe=null;if(X!=null)Xe=v.data[X.series[1]];else{let{y0:Se,y1:ve}=c;Se!=null&&ve!=null&&(A=ve.values(v,b,_,w),Xe=Se.values(v,b,_,w))}let le=K*ce,te=Y*ce;for(let Se=J==1?_:w;Se>=_&&Se<=w;Se+=J){let ve=A[Se];if(ve==null)continue;if(Xe!=null){let tt=Xe[Se]??0;if(ve-tt==0)continue;ae=L(tt,I,U,O)}let ge=N.distr!=2||c!=null?E[Se]:Se,Te=P(ge,N,F,R),He=L(Mi(ve,ie),I,U,O),pe=q(Te-re),qe=q(Bl(He,ae)),xt=q(Ld(He,ae)),nt=qe-xt;if(ve!=null){let tt=ve<0?te:le,Fe=ve<0?le:te;ye?(me>0&&_e[Se]!=null&&H(De.get(_e[Se]),pe,xt+tu(me/2),ce,Bl(0,nt-me),tt,Fe),Ee[Se]!=null&&H(Ge.get(Ee[Se]),pe,xt+tu(me/2),ce,Bl(0,nt-me),tt,Fe)):H(be,pe,xt+tu(me/2),ce,Bl(0,nt-me),tt,Fe),z(v,b,Se,pe-me/2,xt,ce+me,nt)}}return me>0?je.stroke=ye?De:be:ye||(je._fill=S.width==0?S._fill:S._stroke??S._fill,je.width=0),je.fill=ye?Ge:be,je})}function Upe(t,e){const n=Mi(e==null?void 0:e.alignGaps,0);return(r,i,s,o)=>_v(r,i,(a,l,c,d,h,g,v,b,_,w,S)=>{[s,o]=_T(c,s,o);let E=a.pxRound,A=K=>E(g(K,d,w,b)),N=K=>E(v(K,h,S,_)),I,P,L;d.ori==0?(I=ET,L=My,P=t$):(I=CT,L=Ty,P=n$);const R=d.dir*(d.ori==0?1:-1);let O=A(l[R==1?s:o]),F=O,U=[],q=[];for(let K=R==1?s:o;K>=s&&K<=o;K+=R)if(c[K]!=null){let J=l[K],H=A(J);U.push(F=H),q.push(N(c[K]))}const B={stroke:t(U,q,I,L,P,E),fill:null,clip:null,band:null,gaps:null,flags:K1},Z=B.stroke;let[G,$]=$8(r,i);if(a.fill!=null||G!=0){let K=B.fill=new Path2D(Z),Y=a.fillTo(r,i,a.min,a.max,G),J=N(Y);L(K,F,J),L(K,O,J)}if(!a.spanGaps){let K=[];K.push(...q8(l,c,s,o,R,A,n)),B.gaps=K=a.gaps(r,i,s,o,K),B.clip=TT(K,d.ori,b,_,w,S)}return $!=0&&(B.band=$==2?[lp(r,i,s,o,Z,-1),lp(r,i,s,o,Z,1)]:lp(r,i,s,o,Z,$)),B})}function Bpe(t){return Upe(Hpe,t)}function Hpe(t,e,n,r,i,s){const o=t.length;if(o<2)return null;const a=new Path2D;if(n(a,t[0],e[0]),o==2)r(a,t[1],e[1]);else{let l=Array(o),c=Array(o-1),d=Array(o-1),h=Array(o-1);for(let g=0;g<o-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<o-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[o-1]=c[o-2];for(let g=0;g<o-1;g++)i(a,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 a}const cR=new Set;function uO(){for(let t of cR)t.syncRect(!0)}wy&&(Wg(She,m1,uO),Wg(whe,m1,uO,!0),Wg(x2,m1,()=>{go.pxRatio=Ri}));const Vpe=s$(),Gpe=r$();function dO(t,e,n,r){return(r?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map((s,o)=>uR(s,o,e,n))}function Wpe(t,e){return t.map((n,r)=>r==0?{}:Ho({},e,n))}function uR(t,e,n,r){return Ho({},e==0?n:r,t)}function o$(t,e,n){return e==null?X1:[e,n]}const $pe=o$;function qpe(t,e,n){return e==null?X1:y2(e,n,F8,!0)}function a$(t,e,n,r){return e==null?X1:ST(e,n,t.scales[r].log,!1)}const Xpe=a$;function l$(t,e,n,r){return e==null?X1:j8(e,n,t.scales[r].log,!1)}const Ype=l$;function Kpe(t,e,n,r,i){let s=Bl(VI(t),VI(e)),o=e-t,a=Id(i/r*o,n);do{let l=n[a],c=r*l/o;if(c>=i&&s+(l<5?Y0.get(l):0)<=17)return[l,c]}while(++a<n.length);return[0,0]}function fO(t){let e,n;return t=t.replace(/(\d+)px/,(r,i)=>(e=na((n=+i)*Ri))+"px"),[t,e,n]}function Zpe(t){t.show&&[t.font,t.labelFont].forEach(e=>{let n=ns(e[2]*Ri,1);e[0]=e[0].replace(/[0-9.]+px/,n+"px"),e[1]=n})}function go(t,e,n){const r={mode:Mi(t.mode,1)},i=r.mode;function s(de,Ce,Be,Ve){let ut=Ce.valToPct(de);return Ve+Be*(Ce.dir==-1?1-ut:ut)}function o(de,Ce,Be,Ve){let ut=Ce.valToPct(de);return Ve+Be*(Ce.dir==-1?ut:1-ut)}function a(de,Ce,Be,Ve){return Ce.ori==0?s(de,Ce,Be,Ve):o(de,Ce,Be,Ve)}r.valToPosH=s,r.valToPosV=o;let l=!1;r.status=0;const c=r.root=Ou(ihe);if(t.id!=null&&(c.id=t.id),Wc(c,t.class),t.title){let de=Ou(ahe,c);de.textContent=t.title}const d=Rd("canvas"),h=r.ctx=d.getContext("2d"),g=Ou(lhe,c);Wg("click",g,de=>{de.target===b&&(ni!=xs||Fr!=Ga)&&vr.click(r,de)},!0);const v=r.under=Ou(che,g);g.appendChild(d);const b=r.over=Ou(uhe,g);t=Y1(t);const _=+Mi(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,oO,!1):Wpe(t.series||[null],sO),A=r.axes=dO(t.axes||[],eO,rO,!0),N=r.scales={},I=r.bands=t.bands||[];I.forEach(de=>{de.fill=si(de.fill||null),de.dir=Mi(de.dir,-1)});const P=i==2?E[1].facets[0].scale:E[0].scale,L={axes:wa,series:ss},R=(t.drawOrder||["axes","series"]).map(de=>L[de]);function O(de){const Ce=de.distr==3?Be=>ap(Be>0?Be:de.clamp(r,Be,de.min,de.max,de.key)):de.distr==4?Be=>QC(Be,de.asinh):de.distr==100?Be=>de.fwd(Be):Be=>Be;return Be=>{let Ve=Ce(Be),{_min:ut,_max:_t}=de,Ft=_t-ut;return(Ve-ut)/Ft}}function F(de){let Ce=N[de];if(Ce==null){let Be=(t.scales||A_)[de]||A_;if(Be.from!=null){F(Be.from);let Ve=Ho({},N[Be.from],Be,{key:de});Ve.valToPct=O(Ve),N[de]=Ve}else{Ce=N[de]=Ho({},de==P?KW:Dpe,Be),Ce.key=de;let Ve=Ce.time,ut=Ce.range,_t=E0(ut);if((de!=P||i==2&&!Ve)&&(_t&&(ut[0]==null||ut[1]==null)&&(ut={min:ut[0]==null?UI:{mode:1,hard:ut[0],soft:ut[0]},max:ut[1]==null?UI:{mode:1,hard:ut[1],soft:ut[1]}},_t=!1),!_t&&MT(ut))){let Ft=ut;ut=(Gt,Qt,gn)=>Qt==null?X1:y2(Qt,gn,Ft)}Ce.range=si(ut||(Ve?$pe:de==P?Ce.distr==3?Xpe:Ce.distr==4?Ype:o$:Ce.distr==3?a$:Ce.distr==4?l$:qpe)),Ce.auto=si(_t?!1:Ce.auto),Ce.clamp=si(Ce.clamp||Ppe),Ce._min=Ce._max=null,Ce.valToPct=O(Ce)}}}F("x"),F("y"),i==1&&E.forEach(de=>{F(de.scale)}),A.forEach(de=>{F(de.scale)});for(let de in t.scales)F(de);const U=N[P],q=U.distr;let B,Z;U.ori==0?(Wc(c,she),B=s,Z=o):(Wc(c,ohe),B=o,Z=s);const G={};for(let de in N){let Ce=N[de];(Ce.min!=null||Ce.max!=null)&&(G[de]={min:Ce.min,max:Ce.max},Ce.min=Ce.max=null)}const $=t.tzDate||(de=>new Date(na(de/S))),K=t.fmtDate||H8,Y=S==1?spe($):lpe($),J=ZI($,KI(S==1?ipe:ape,K)),H=JI($,QI(upe,K)),z=[],X=r.legend=Ho({},hpe,t.legend),V=r.cursor=Ho({},ype,{drag:{y:i==2}},t.cursor),ie=X.show,ae=V.show,re=X.markers;X.idxs=z,re.width=si(re.width),re.dash=si(re.dash),re.stroke=si(re.stroke),re.fill=si(re.fill);let ce,oe,fe,me=[],ye=[],Ee,Ge=!1,_e={};if(X.live){const de=E[1]?E[1].values:null;Ge=de!=null,Ee=Ge?de(r,1,0):{_:0};for(let Ce in Ee)_e[Ce]=L8}if(ie)if(ce=Rd("table",ghe,c),fe=Rd("tbody",null,ce),X.mount(r,ce),Ge){oe=Rd("thead",null,ce,fe);let de=Rd("tr",null,oe);Rd("th",null,de);for(var De in Ee)Rd("th",CI,de).textContent=De}else Wc(ce,xhe),X.live&&Wc(ce,vhe);const he={show:!0},Le={show:!1};function ne(de,Ce){if(Ce==0&&(Ge||!X.live||i==2))return X1;let Be=[],Ve=Rd("tr",yhe,fe,fe.childNodes[Ce]);Wc(Ve,de.class),de.show||Wc(Ve,Eg);let ut=Rd("th",null,Ve);if(re.show){let Gt=Ou(bhe,ut);if(Ce>0){let Qt=re.width(r,Ce);Qt&&(Gt.style.border=Qt+"px "+re.dash(r,Ce)+" "+re.stroke(r,Ce)),Gt.style.background=re.fill(r,Ce)}}let _t=Ou(CI,ut);de.label instanceof HTMLElement?_t.appendChild(de.label):_t.textContent=de.label,Ce>0&&(re.show||(_t.style.color=de.width>0?re.stroke(r,Ce):re.fill(r,Ce)),je("click",ut,Gt=>{if(V._lock)return;Rt(Gt);let Qt=E.indexOf(de);if((Gt.ctrlKey||Gt.metaKey)!=X.isolate){let gn=E.some((xn,Sn)=>Sn>0&&Sn!=Qt&&xn.show);E.forEach((xn,Sn)=>{Sn>0&&mi(Sn,gn?Sn==Qt?he:Le:he,!0,bs.setSeries)})}else mi(Qt,{show:!de.show},!0,bs.setSeries)},!1),Et&&je(kI,ut,Gt=>{V._lock||(Rt(Gt),mi(E.indexOf(de),ys,!0,bs.setSeries))},!1));for(var Ft in Ee){let Gt=Rd("td",_he,Ve);Gt.textContent="--",Be.push(Gt)}return[Ve,Be]}const We=new Map;function je(de,Ce,Be,Ve=!0){const ut=We.get(Ce)||{},_t=V.bind[de](r,Ce,Be,Ve);_t&&(Wg(de,Ce,ut[de]=_t),We.set(Ce,ut))}function be(de,Ce,Be){const Ve=We.get(Ce)||{};for(let ut in Ve)(de==null||ut==de)&&(iR(ut,Ce,Ve[ut]),delete Ve[ut]);de==null&&We.delete(Ce)}let Xe=0,le=0,te=0,Se=0,ve=0,ge=0,Te=ve,He=ge,pe=te,qe=Se,xt=0,nt=0,tt=0,Fe=0;r.bbox={};let we=!1,ke=!1,Ze=!1,Ne=!1,Ke=!1,it=!1;function ht(de,Ce,Be){(Be||de!=r.width||Ce!=r.height)&&Je(de,Ce),ql(!1),Ze=!0,ke=!0,Va()}function Je(de,Ce){r.width=Xe=te=de,r.height=le=Se=Ce,ve=ge=0,Ye(),st();let Be=r.bbox;xt=Be.left=_g(ve*Ri,.5),nt=Be.top=_g(ge*Ri,.5),tt=Be.width=_g(te*Ri,.5),Fe=Be.height=_g(Se*Ri,.5)}const $e=3;function Ae(){let de=!1,Ce=0;for(;!de;){Ce++;let Be=qo(Ce),Ve=ua(Ce);de=Ce==$e||Be&&Ve,de||(Je(r.width,r.height),ke=!0)}}function Oe({width:de,height:Ce}){ht(de,Ce)}r.setSize=Oe;function Ye(){let de=!1,Ce=!1,Be=!1,Ve=!1;A.forEach((ut,_t)=>{if(ut.show&&ut._show){let{side:Ft,_size:Gt}=ut,Qt=Ft%2,gn=ut.label!=null?ut.labelSize:0,xn=Gt+gn;xn>0&&(Qt?(te-=xn,Ft==3?(ve+=xn,Ve=!0):Be=!0):(Se-=xn,Ft==0?(ge+=xn,de=!0):Ce=!0))}}),Lt[0]=de,Lt[1]=Be,Lt[2]=Ce,Lt[3]=Ve,te-=Xn[1]+Xn[3],ve+=Xn[3],Se-=Xn[2]+Xn[0],ge+=Xn[0]}function st(){let de=ve+te,Ce=ge+Se,Be=ve,Ve=ge;function ut(_t,Ft){switch(_t){case 1:return de+=Ft,de-Ft;case 2:return Ce+=Ft,Ce-Ft;case 3:return Be-=Ft,Be+Ft;case 0:return Ve-=Ft,Ve+Ft}}A.forEach((_t,Ft)=>{if(_t.show&&_t._show){let Gt=_t.side;_t._pos=ut(Gt,_t._size),_t.label!=null&&(_t._lpos=ut(Gt,_t.labelSize))}})}if(V.dataIdx==null){let de=V.hover,Ce=de.skip=new Set(de.skip??[]);Ce.add(void 0);let Be=de.prox=si(de.prox),Ve=de.bias??(de.bias=0);V.dataIdx=(ut,_t,Ft,Gt)=>{if(_t==0)return Ft;let Qt=Ft,gn=Be(ut,_t,Ft,Gt)??ts,xn=gn>=0&&gn<ts,Sn=U.ori==0?te:Se,er=V.left,Kr=e[0],tr=e[_t];if(Ce.has(tr[Ft])){Qt=null;let fr=null,Bn=null,An;if(Ve==0||Ve==-1)for(An=Ft;fr==null&&An-- >0;)Ce.has(tr[An])||(fr=An);if(Ve==0||Ve==1)for(An=Ft;Bn==null&&An++<tr.length;)Ce.has(tr[An])||(Bn=An);if(fr!=null||Bn!=null)if(xn){let Wn=fr==null?-1/0:B(Kr[fr],U,Sn,0),Ji=Bn==null?1/0:B(Kr[Bn],U,Sn,0),Is=er-Wn,gi=Ji-er;Is<=gi?Is<=gn&&(Qt=fr):gi<=gn&&(Qt=Bn)}else Qt=Bn==null?fr:fr==null?Bn:Ft-fr<=Bn-Ft?fr:Bn}else xn&&ra(er-B(Kr[Ft],U,Sn,0))>gn&&(Qt=null);return Qt}}const Rt=de=>{V.event=de};V.idxs=z,V._lock=!1;let yt=V.points;yt.show=si(yt.show),yt.size=si(yt.size),yt.stroke=si(yt.stroke),yt.width=si(yt.width),yt.fill=si(yt.fill);const Tt=r.focus=Ho({},t.focus||{alpha:.3},V.focus),Et=Tt.prox>=0,Dt=Et&&yt.one;let Ue=[],ct=[],St=[];function kt(de,Ce){let Be=yt.show(r,Ce);if(Be instanceof HTMLElement)return Wc(Be,mhe),Wc(Be,de.class),Ef(Be,-10,-10,te,Se),b.insertBefore(Be,Ue[Ce]),Be}function Ut(de,Ce){if(i==1||Ce>0){let Be=i==1&&N[de.scale].time,Ve=de.value;de.value=Be?$I(Ve)?JI($,QI(Ve,K)):Ve||H:Ve||Npe,de.label=de.label||(Be?_pe:bpe)}if(Dt||Ce>0){de.width=de.width==null?1:de.width,de.paths=de.paths||Vpe||Dhe,de.fillTo=si(de.fillTo||Ipe),de.pxAlign=+Mi(de.pxAlign,_),de.pxRound=lO(de.pxAlign),de.stroke=si(de.stroke||null),de.fill=si(de.fill||null),de._stroke=de._fill=de._paths=de._focus=null;let Be=Rpe(Bl(1,de.width),1),Ve=de.points=Ho({},{size:Be,width:Bl(1,Be*.2),stroke:de.stroke,space:Be*2,paths:Gpe,_stroke:null,_fill:null},de.points);Ve.show=si(Ve.show),Ve.filter=si(Ve.filter),Ve.fill=si(Ve.fill),Ve.stroke=si(Ve.stroke),Ve.paths=si(Ve.paths),Ve.pxAlign=de.pxAlign}if(ie){let Be=ne(de,Ce);me.splice(Ce,0,Be[0]),ye.splice(Ce,0,Be[1]),X.values.push(null)}if(ae){z.splice(Ce,0,null);let Be=null;Dt?Ce==0&&(Be=kt(de,Ce)):Ce>0&&(Be=kt(de,Ce)),Ue.splice(Ce,0,Be),ct.splice(Ce,0,0),St.splice(Ce,0,0)}Ds("addSeries",Ce)}function Xt(de,Ce){Ce=Ce??E.length,de=i==1?uR(de,Ce,tO,oO):uR(de,Ce,{},sO),E.splice(Ce,0,de),Ut(E[Ce],Ce)}r.addSeries=Xt;function hn(de){if(E.splice(de,1),ie){X.values.splice(de,1),ye.splice(de,1);let Ce=me.splice(de,1)[0];be(null,Ce.firstChild),Ce.remove()}ae&&(z.splice(de,1),Ue.splice(de,1)[0].remove(),ct.splice(de,1),St.splice(de,1)),Ds("delSeries",de)}r.delSeries=hn;const Lt=[!1,!1,!1,!1];function on(de,Ce){if(de._show=de.show,de.show){let Be=de.side%2,Ve=N[de.scale];Ve==null&&(de.scale=Be?E[1].scale:P,Ve=N[de.scale]);let ut=Ve.time;de.size=si(de.size),de.space=si(de.space),de.rotate=si(de.rotate),E0(de.incrs)&&de.incrs.forEach(Ft=>{!Y0.has(Ft)&&Y0.set(Ft,kW(Ft))}),de.incrs=si(de.incrs||(Ve.distr==2?tpe:ut?S==1?rpe:ope:Sg)),de.splits=si(de.splits||(ut&&Ve.distr==1?Y:Ve.distr==3?oR:Ve.distr==4?Mpe:wpe)),de.stroke=si(de.stroke),de.grid.stroke=si(de.grid.stroke),de.ticks.stroke=si(de.ticks.stroke),de.border.stroke=si(de.border.stroke);let _t=de.values;de.values=E0(_t)&&!E0(_t[0])?si(_t):ut?E0(_t)?ZI($,KI(_t,K)):$I(_t)?cpe($,_t):_t||J:_t||Spe,de.filter=si(de.filter||(Ve.distr>=3&&Ve.log==10?Cpe:Ve.distr==3&&Ve.log==2?Ape:NW)),de.font=fO(de.font),de.labelFont=fO(de.labelFont),de._size=de.size(r,null,Ce,0),de._space=de._rotate=de._incrs=de._found=de._splits=de._values=null,de._size>0&&(Lt[Ce]=!0,de._el=Ou(dhe,g))}}function Ht(de,Ce,Be,Ve){let[ut,_t,Ft,Gt]=Be,Qt=Ce%2,gn=0;return Qt==0&&(Gt||_t)&&(gn=Ce==0&&!ut||Ce==2&&!Ft?na(eO.size/3):0),Qt==1&&(ut||Ft)&&(gn=Ce==1&&!_t||Ce==3&&!Gt?na(rO.size/2):0),gn}const kn=r.padding=(t.padding||[Ht,Ht,Ht,Ht]).map(de=>si(Mi(de,Ht))),Xn=r._padding=kn.map((de,Ce)=>de(r,Ce,Lt,0));let zn,Qn=null,Pn=null;const lr=i==1?E[0].idxs:null;let ir=null,xe=!1;function ot(de,Ce){if(e=de??[],r.data=r._data=e,i==2){zn=0;for(let Be=1;Be<E.length;Be++)zn+=e[Be][0].length}else{e.length==0&&(r.data=r._data=e=[[]]),ir=e[0],zn=ir.length;let Be=e;if(q==2){Be=e.slice();let Ve=Be[0]=Array(zn);for(let ut=0;ut<zn;ut++)Ve[ut]=ut}r._data=e=Be}if(ql(!0),Ds("setData"),q==2&&(Ze=!0),Ce!==!1){let Be=U;Be.auto(r,xe)?bt():vo(P,Be.min,Be.max),Ne=Ne||V.left>=0,it=!0,Va()}}r.setData=ot;function bt(){xe=!0;let de,Ce;i==1&&(zn>0?(Qn=lr[0]=0,Pn=lr[1]=zn-1,de=e[0][Qn],Ce=e[0][Pn],q==2?(de=Qn,Ce=Pn):de==Ce&&(q==3?[de,Ce]=ST(de,de,U.log,!1):q==4?[de,Ce]=j8(de,de,U.log,!1):U.time?Ce=de+na(86400/S):[de,Ce]=y2(de,Ce,F8,!0))):(Qn=lr[0]=de=null,Pn=lr[1]=Ce=null)),vo(P,de,Ce)}let mt,pt,$t,Zt,en,Jt,Mn,jn,Gn,ln;function sr(de,Ce,Be,Ve,ut,_t){de??(de=NI),Be??(Be=B8),Ve??(Ve="butt"),ut??(ut=NI),_t??(_t="round"),de!=mt&&(h.strokeStyle=mt=de),ut!=pt&&(h.fillStyle=pt=ut),Ce!=$t&&(h.lineWidth=$t=Ce),_t!=en&&(h.lineJoin=en=_t),Ve!=Jt&&(h.lineCap=Jt=Ve),Be!=Zt&&h.setLineDash(Zt=Be)}function Yr(de,Ce,Be,Ve){Ce!=pt&&(h.fillStyle=pt=Ce),de!=Mn&&(h.font=Mn=de),Be!=jn&&(h.textAlign=jn=Be),Ve!=Gn&&(h.textBaseline=Gn=Ve)}function ti(de,Ce,Be,Ve,ut=0){if(Ve.length>0&&de.auto(r,xe)&&(Ce==null||Ce.min==null)){let _t=Mi(Qn,0),Ft=Mi(Pn,Ve.length-1),Gt=Be.min==null?Che(Ve,_t,Ft,ut,de.distr==3):[Be.min,Be.max];de.min=Ld(de.min,Be.min=Gt[0]),de.max=Bl(de.max,Be.max=Gt[1])}}const dr={min:null,max:null};function kr(){for(let Ve in N){let ut=N[Ve];G[Ve]==null&&(ut.min==null||G[P]!=null&&ut.auto(r,xe))&&(G[Ve]=dr)}for(let Ve in N){let ut=N[Ve];G[Ve]==null&&ut.from!=null&&G[ut.from]!=null&&(G[Ve]=dr)}G[P]!=null&&ql(!0);let de={};for(let Ve in G){let ut=G[Ve];if(ut!=null){let _t=de[Ve]=Y1(N[Ve],Lhe);if(ut.min!=null)Ho(_t,ut);else if(Ve!=P||i==2)if(zn==0&&_t.from==null){let Ft=_t.range(r,null,null,Ve);_t.min=Ft[0],_t.max=Ft[1]}else _t.min=ts,_t.max=-ts}}if(zn>0){E.forEach((Ve,ut)=>{if(i==1){let _t=Ve.scale,Ft=G[_t];if(Ft==null)return;let Gt=de[_t];if(ut==0){let Qt=Gt.range(r,Gt.min,Gt.max,_t);Gt.min=Qt[0],Gt.max=Qt[1],Qn=Id(Gt.min,e[0]),Pn=Id(Gt.max,e[0]),Pn-Qn>1&&(e[0][Qn]<Gt.min&&Qn++,e[0][Pn]>Gt.max&&Pn--),Ve.min=ir[Qn],Ve.max=ir[Pn]}else Ve.show&&Ve.auto&&ti(Gt,Ft,Ve,e[ut],Ve.sorted);Ve.idxs[0]=Qn,Ve.idxs[1]=Pn}else if(ut>0&&Ve.show&&Ve.auto){let[_t,Ft]=Ve.facets,Gt=_t.scale,Qt=Ft.scale,[gn,xn]=e[ut],Sn=de[Gt],er=de[Qt];Sn!=null&&ti(Sn,G[Gt],_t,gn,_t.sorted),er!=null&&ti(er,G[Qt],Ft,xn,Ft.sorted),Ve.min=Ft.min,Ve.max=Ft.max}});for(let Ve in de){let ut=de[Ve],_t=G[Ve];if(ut.from==null&&(_t==null||_t.min==null)){let Ft=ut.range(r,ut.min==ts?null:ut.min,ut.max==-ts?null:ut.max,Ve);ut.min=Ft[0],ut.max=Ft[1]}}}for(let Ve in de){let ut=de[Ve];if(ut.from!=null){let _t=de[ut.from];if(_t.min==null)ut.min=ut.max=null;else{let Ft=ut.range(r,_t.min,_t.max,Ve);ut.min=Ft[0],ut.max=Ft[1]}}}let Ce={},Be=!1;for(let Ve in de){let ut=de[Ve],_t=N[Ve];if(_t.min!=ut.min||_t.max!=ut.max){_t.min=ut.min,_t.max=ut.max;let Ft=_t.distr;_t._min=Ft==3?ap(_t.min):Ft==4?QC(_t.min,_t.asinh):Ft==100?_t.fwd(_t.min):_t.min,_t._max=Ft==3?ap(_t.max):Ft==4?QC(_t.max,_t.asinh):Ft==100?_t.fwd(_t.max):_t.max,Ce[Ve]=Be=!0}}if(Be){E.forEach((Ve,ut)=>{i==2?ut>0&&Ce.y&&(Ve._paths=null):Ce[Ve.scale]&&(Ve._paths=null)});for(let Ve in Ce)Ze=!0,Ds("setScale",Ve);ae&&V.left>=0&&(Ne=it=!0)}for(let Ve in G)G[Ve]=null}function rn(de){let Ce=sR(Qn-1,0,zn-1),Be=sR(Pn+1,0,zn-1);for(;de[Ce]==null&&Ce>0;)Ce--;for(;de[Be]==null&&Be<zn-1;)Be++;return[Ce,Be]}function ss(){if(zn>0){let de=E.some(Ce=>Ce._focus)&&ln!=Tt.alpha;de&&(h.globalAlpha=ln=Tt.alpha),E.forEach((Ce,Be)=>{if(Be>0&&Ce.show&&(Nn(Be,!1),Nn(Be,!0),Ce._paths==null)){let Ve=ln;ln!=Ce.alpha&&(h.globalAlpha=ln=Ce.alpha);let ut=i==2?[0,e[Be][0].length-1]:rn(e[Be]);Ce._paths=Ce.paths(r,Be,ut[0],ut[1]),ln!=Ve&&(h.globalAlpha=ln=Ve)}}),E.forEach((Ce,Be)=>{if(Be>0&&Ce.show){let Ve=ln;ln!=Ce.alpha&&(h.globalAlpha=ln=Ce.alpha),Ce._paths!=null&&gs(Be,!1);{let ut=Ce._paths!=null?Ce._paths.gaps:null,_t=Ce.points.show(r,Be,Qn,Pn,ut),Ft=Ce.points.filter(r,Be,_t,ut);(_t||Ft)&&(Ce.points._paths=Ce.points.paths(r,Be,Qn,Pn,Ft),gs(Be,!0))}ln!=Ve&&(h.globalAlpha=ln=Ve),Ds("drawSeries",Be)}}),de&&(h.globalAlpha=ln=1)}}function Nn(de,Ce){let Be=Ce?E[de].points:E[de];Be._stroke=Be.stroke(r,de),Be._fill=Be.fill(r,de)}function gs(de,Ce){let Be=Ce?E[de].points:E[de],{stroke:Ve,fill:ut,clip:_t,flags:Ft,_stroke:Gt=Be._stroke,_fill:Qt=Be._fill,_width:gn=Be.width}=Be._paths;gn=ns(gn*Ri,3);let xn=null,Sn=gn%2/2;Ce&&Qt==null&&(Qt=gn>0?"#fff":Gt);let er=Be.pxAlign==1&&Sn>0;if(er&&h.translate(Sn,Sn),!Ce){let Kr=xt-gn/2,tr=nt-gn/2,fr=tt+gn,Bn=Fe+gn;xn=new Path2D,xn.rect(Kr,tr,fr,Bn)}Ce?vs(Gt,gn,Be.dash,Be.cap,Qt,Ve,ut,Ft,_t):Rs(de,Gt,gn,Be.dash,Be.cap,Qt,Ve,ut,Ft,xn,_t),er&&h.translate(-Sn,-Sn)}function Rs(de,Ce,Be,Ve,ut,_t,Ft,Gt,Qt,gn,xn){let Sn=!1;Qt!=0&&I.forEach((er,Kr)=>{if(er.series[0]==de){let tr=E[er.series[1]],fr=e[er.series[1]],Bn=(tr._paths||A_).band;E0(Bn)&&(Bn=er.dir==1?Bn[0]:Bn[1]);let An,Wn=null;tr.show&&Bn&&Nhe(fr,Qn,Pn)?(Wn=er.fill(r,Kr)||_t,An=tr._paths.clip):Bn=null,vs(Ce,Be,Ve,ut,Wn,Ft,Gt,Qt,gn,xn,An,Bn),Sn=!0}}),Sn||vs(Ce,Be,Ve,ut,_t,Ft,Gt,Qt,gn,xn)}const Di=K1|lR;function vs(de,Ce,Be,Ve,ut,_t,Ft,Gt,Qt,gn,xn,Sn){sr(de,Ce,Be,Ve,ut),(Qt||gn||Sn)&&(h.save(),Qt&&h.clip(Qt),gn&&h.clip(gn)),Sn?(Gt&Di)==Di?(h.clip(Sn),xn&&h.clip(xn),fi(ut,Ft),gr(de,_t,Ce)):Gt&lR?(fi(ut,Ft),h.clip(Sn),gr(de,_t,Ce)):Gt&K1&&(h.save(),h.clip(Sn),xn&&h.clip(xn),fi(ut,Ft),h.restore(),gr(de,_t,Ce)):(fi(ut,Ft),gr(de,_t,Ce)),(Qt||gn||Sn)&&h.restore()}function gr(de,Ce,Be){Be>0&&(Ce instanceof Map?Ce.forEach((Ve,ut)=>{h.strokeStyle=mt=ut,h.stroke(Ve)}):Ce!=null&&de&&h.stroke(Ce))}function fi(de,Ce){Ce instanceof Map?Ce.forEach((Be,Ve)=>{h.fillStyle=pt=Ve,h.fill(Be)}):Ce!=null&&de&&h.fill(Ce)}function ks(de,Ce,Be,Ve){let ut=A[de],_t;if(Ve<=0)_t=[0,0];else{let Ft=ut._space=ut.space(r,de,Ce,Be,Ve),Gt=ut._incrs=ut.incrs(r,de,Ce,Be,Ve,Ft);_t=Kpe(Ce,Be,Gt,Ve,Ft)}return ut._found=_t}function Ii(de,Ce,Be,Ve,ut,_t,Ft,Gt,Qt,gn){let xn=Ft%2/2;_==1&&h.translate(xn,xn),sr(Gt,Ft,Qt,gn,Gt),h.beginPath();let Sn,er,Kr,tr,fr=ut+(Ve==0||Ve==3?-_t:_t);Be==0?(er=ut,tr=fr):(Sn=ut,Kr=fr);for(let Bn=0;Bn<de.length;Bn++)Ce[Bn]!=null&&(Be==0?Sn=Kr=de[Bn]:er=tr=de[Bn],h.moveTo(Sn,er),h.lineTo(Kr,tr));h.stroke(),_==1&&h.translate(-xn,-xn)}function qo(de){let Ce=!0;return A.forEach((Be,Ve)=>{if(!Be.show)return;let ut=N[Be.scale];if(ut.min==null){Be._show&&(Ce=!1,Be._show=!1,ql(!1));return}else Be._show||(Ce=!1,Be._show=!0,ql(!1));let _t=Be.side,Ft=_t%2,{min:Gt,max:Qt}=ut,[gn,xn]=ks(Ve,Gt,Qt,Ft==0?te:Se);if(xn==0)return;let Sn=ut.distr==2,er=Be._splits=Be.splits(r,Ve,Gt,Qt,gn,xn,Sn),Kr=ut.distr==2?er.map(An=>ir[An]):er,tr=ut.distr==2?ir[er[1]]-ir[er[0]]:gn,fr=Be._values=Be.values(r,Be.filter(r,Kr,Ve,xn,tr),Ve,xn,tr);Be._rotate=_t==2?Be.rotate(r,fr,Ve,xn):0;let Bn=Be._size;Be._size=Uu(Be.size(r,fr,Ve,de)),Bn!=null&&Be._size!=Bn&&(Ce=!1)}),Ce}function ua(de){let Ce=!0;return kn.forEach((Be,Ve)=>{let ut=Be(r,Ve,Lt,de);ut!=Xn[Ve]&&(Ce=!1),Xn[Ve]=ut}),Ce}function wa(){for(let de=0;de<A.length;de++){let Ce=A[de];if(!Ce.show||!Ce._show)continue;let Be=Ce.side,Ve=Be%2,ut,_t,Ft=Ce.stroke(r,de),Gt=Be==0||Be==3?-1:1,[Qt,gn]=Ce._found;if(Ce.label!=null){let oo=Ce.labelGap*Gt,yo=na((Ce._lpos+oo)*Ri);Yr(Ce.labelFont[0],Ft,"center",Be==2?Vb:AI),h.save(),Ve==1?(ut=_t=0,h.translate(yo,na(nt+Fe/2)),h.rotate((Be==3?-jM:jM)/2)):(ut=na(xt+tt/2),_t=yo);let Lc=CW(Ce.label)?Ce.label(r,de,Qt,gn):Ce.label;h.fillText(Lc,ut,_t),h.restore()}if(gn==0)continue;let xn=N[Ce.scale],Sn=Ve==0?tt:Fe,er=Ve==0?xt:nt,Kr=Ce._splits,tr=xn.distr==2?Kr.map(oo=>ir[oo]):Kr,fr=xn.distr==2?ir[Kr[1]]-ir[Kr[0]]:Qt,Bn=Ce.ticks,An=Ce.border,Wn=Bn.show?Bn.size:0,Ji=na(Wn*Ri),Is=na((Ce.alignTo==2?Ce._size-Wn-Ce.gap:Ce.gap)*Ri),gi=Ce._rotate*-jM/180,ai=w(Ce._pos*Ri),os=(Ji+Is)*Gt,Os=ai+os;_t=Ve==0?Os:0,ut=Ve==1?Os:0;let Ko=Ce.font[0],ko=Ce.align==1?Mx:Ce.align==2?YC:gi>0?Mx:gi<0?YC:Ve==0?"center":Be==3?YC:Mx,Hi=gi||Ve==1?"middle":Be==2?Vb:AI;Yr(Ko,Ft,ko,Hi);let Gs=Ce.font[1]*Ce.lineGap,Po=Kr.map(oo=>w(a(oo,xn,Sn,er))),Ca=Ce._values;for(let oo=0;oo<Ca.length;oo++){let yo=Ca[oo];if(yo!=null){Ve==0?ut=Po[oo]:_t=Po[oo],yo=""+yo;let Lc=yo.indexOf(`
`)==-1?[yo]:yo.split(/\n/gm);for(let Do=0;Do<Lc.length;Do++){let Nv=Lc[Do];gi?(h.save(),h.translate(ut,_t+Do*Gs),h.rotate(gi),h.fillText(Nv,0,0),h.restore()):h.fillText(Nv,ut,_t+Do*Gs)}}}Bn.show&&Ii(Po,Bn.filter(r,tr,de,gn,fr),Ve,Be,ai,Ji,ns(Bn.width*Ri,3),Bn.stroke(r,de),Bn.dash,Bn.cap);let so=Ce.grid;so.show&&Ii(Po,so.filter(r,tr,de,gn,fr),Ve,Ve==0?2:1,Ve==0?nt:xt,Ve==0?Fe:tt,ns(so.width*Ri,3),so.stroke(r,de),so.dash,so.cap),An.show&&Ii([ai],[1],Ve==0?1:0,Ve==0?1:2,Ve==1?nt:xt,Ve==1?Fe:tt,ns(An.width*Ri,3),An.stroke(r,de),An.dash,An.cap)}Ds("drawAxes")}function ql(de){E.forEach((Ce,Be)=>{Be>0&&(Ce._paths=null,de&&(i==1?(Ce.min=null,Ce.max=null):Ce.facets.forEach(Ve=>{Ve.min=null,Ve.max=null})))})}let yl=!1,da=!1,Ps=[];function Xl(){da=!1;for(let de=0;de<Ps.length;de++)Ds(...Ps[de]);Ps.length=0}function Va(){yl||(Vhe(Ta),yl=!0)}function Ma(de,Ce=!1){yl=!0,da=Ce,de(r),Ta(),Ce&&Ps.length>0&&queueMicrotask(Xl)}r.batch=Ma;function Ta(){if(we&&(kr(),we=!1),Ze&&(Ae(),Ze=!1),ke){if(As(v,Mx,ve),As(v,Vb,ge),As(v,p_,te),As(v,m_,Se),As(b,Mx,ve),As(b,Vb,ge),As(b,p_,te),As(b,m_,Se),As(g,p_,Xe),As(g,m_,le),d.width=na(Xe*Ri),d.height=na(le*Ri),A.forEach(({_el:de,_show:Ce,_size:Be,_pos:Ve,side:ut})=>{if(de!=null)if(Ce){let _t=ut===3||ut===0?Be:0,Ft=ut%2==1;As(de,Ft?"left":"top",Ve-_t),As(de,Ft?"width":"height",Be),As(de,Ft?"top":"left",Ft?ge:ve),As(de,Ft?"height":"width",Ft?Se:te),rR(de,Eg)}else Wc(de,Eg)}),mt=pt=$t=en=Jt=Mn=jn=Gn=Zt=null,ln=1,ad(!0),ve!=Te||ge!=He||te!=pe||Se!=qe){ql(!1);let de=te/pe,Ce=Se/qe;if(ae&&!Ne&&V.left>=0){V.left*=de,V.top*=Ce,Xo&&Ef(Xo,na(V.left),0,te,Se),io&&Ef(io,0,na(V.top),te,Se);for(let Be=0;Be<Ue.length;Be++){let Ve=Ue[Be];Ve!=null&&(ct[Be]*=de,St[Be]*=Ce,Ef(Ve,Uu(ct[Be]),Uu(St[Be]),te,Se))}}if($r.show&&!Ke&&$r.left>=0&&$r.width>0){$r.left*=de,$r.width*=de,$r.top*=Ce,$r.height*=Ce;for(let Be in _m)As(Ea,Be,$r[Be])}Te=ve,He=ge,pe=te,qe=Se}Ds("setSize"),ke=!1}Xe>0&&le>0&&(h.clearRect(0,0,d.width,d.height),Ds("drawClear"),R.forEach(de=>de()),Ds("draw")),$r.show&&Ke&&(_l($r),Ke=!1),ae&&Ne&&(Zl(null,!0,!1),Ne=!1),X.show&&X.live&&it&&(Ep(),it=!1),l||(l=!0,r.status=1,Ds("ready")),xe=!1,yl=!1}r.redraw=(de,Ce)=>{Ze=Ce||!1,de!==!1?vo(P,U.min,U.max):Va()};function Pc(de,Ce){let Be=N[de];if(Be.from==null){if(zn==0){let Ve=Be.range(r,Ce.min,Ce.max,de);Ce.min=Ve[0],Ce.max=Ve[1]}if(Ce.min>Ce.max){let Ve=Ce.min;Ce.min=Ce.max,Ce.max=Ve}if(zn>1&&Ce.min!=null&&Ce.max!=null&&Ce.max-Ce.min<1e-16)return;de==P&&Be.distr==2&&zn>0&&(Ce.min=Id(Ce.min,e[0]),Ce.max=Id(Ce.max,e[0]),Ce.min==Ce.max&&Ce.max++),G[de]=Ce,we=!0,Va()}}r.setScale=Pc;let Dc,Yl,Xo,io,Ro,bl,xs,Ga,Wa,Ic,ni,Fr,Yo=!1;const vr=V.drag;let _i=vr.x,Oi=vr.y;ae&&(V.x&&(Dc=Ou(hhe,b)),V.y&&(Yl=Ou(phe,b)),U.ori==0?(Xo=Dc,io=Yl):(Xo=Yl,io=Dc),ni=V.left,Fr=V.top);const $r=r.select=Ho({show:!0,over:!0,left:0,width:0,top:0,height:0},t.select),Ea=$r.show?Ou(fhe,$r.over?b:v):null;function _l(de,Ce){if($r.show){for(let Be in de)$r[Be]=de[Be],Be in _m&&As(Ea,Be,de[Be]);Ce!==!1&&Ds("setSelect")}}r.setSelect=_l;function Kl(de){if(E[de].show)ie&&rR(me[de],Eg);else if(ie&&Wc(me[de],Eg),ae){let Be=Dt?Ue[0]:Ue[de];Be!=null&&Ef(Be,-10,-10,te,Se)}}function vo(de,Ce,Be){Pc(de,{min:Ce,max:Be})}function mi(de,Ce,Be,Ve){Ce.focus!=null&&Sl(de),Ce.show!=null&&E.forEach((ut,_t)=>{_t>0&&(de==_t||de==null)&&(ut.show=Ce.show,Kl(_t),i==2?(vo(ut.facets[0].scale,null,null),vo(ut.facets[1].scale,null,null)):vo(ut.scale,null,null),Va())}),Be!==!1&&Ds("setSeries",de,Ce),Ve&&ud("setSeries",r,de,Ce)}r.setSeries=mi;function xh(de,Ce){Ho(I[de],Ce)}function rd(de,Ce){de.fill=si(de.fill||null),de.dir=Mi(de.dir,-1),Ce=Ce??I.length,I.splice(Ce,0,de)}function id(de){de==null?I.length=0:I.splice(de,1)}r.addBand=rd,r.setBand=xh,r.delBand=id;function Qd(de,Ce){E[de].alpha=Ce,ae&&Ue[de]!=null&&(Ue[de].style.opacity=Ce),ie&&me[de]&&(me[de].style.opacity=Ce)}let fa,Gi,Hs;const ys={focus:!0};function Sl(de){if(de!=Hs){let Ce=de==null,Be=Tt.alpha!=1;E.forEach((Ve,ut)=>{if(i==1||ut>0){let _t=Ce||ut==0||ut==de;Ve._focus=Ce?null:_t,Be&&Qd(ut,_t?1:Tt.alpha)}}),Hs=de,Be&&Va()}}ie&&Et&&je(PI,ce,de=>{V._lock||(Rt(de),Hs!=null&&mi(null,ys,!0,bs.setSeries))});function xo(de,Ce,Be){let Ve=N[Ce];Be&&(de=de/Ri-(Ve.ori==1?ge:ve));let ut=te;Ve.ori==1&&(ut=Se,de=ut-de),Ve.dir==-1&&(de=ut-de);let _t=Ve._min,Ft=Ve._max,Gt=de/ut,Qt=_t+(Ft-_t)*Gt,gn=Ve.distr;return gn==3?q1(10,Qt):gn==4?khe(Qt,Ve.asinh):gn==100?Ve.bwd(Qt):Qt}function Mp(de,Ce){let Be=xo(de,P,Ce);return Id(Be,e[0],Qn,Pn)}r.valToIdx=de=>Id(de,e[0]),r.posToIdx=Mp,r.posToVal=xo,r.valToPos=(de,Ce,Be)=>N[Ce].ori==0?s(de,N[Ce],Be?tt:te,Be?xt:0):o(de,N[Ce],Be?Fe:Se,Be?nt:0),r.setCursor=(de,Ce,Be)=>{ni=de.left,Fr=de.top,Zl(null,Ce,Be)};function yh(de,Ce){As(Ea,Mx,$r.left=de),As(Ea,p_,$r.width=Ce)}function ym(de,Ce){As(Ea,Vb,$r.top=de),As(Ea,m_,$r.height=Ce)}let Jd=U.ori==0?yh:ym,sd=U.ori==1?yh:ym;function Tp(){if(ie&&X.live)for(let de=i==2?1:0;de<E.length;de++){if(de==0&&Ge)continue;let Ce=X.values[de],Be=0;for(let Ve in Ce)ye[de][Be++].firstChild.nodeValue=Ce[Ve]}}function Ep(de,Ce){if(de!=null&&(de.idxs?de.idxs.forEach((Be,Ve)=>{z[Ve]=Be}):Ohe(de.idx)||z.fill(de.idx),X.idx=z[0]),ie&&X.live){for(let Be=0;Be<E.length;Be++)(Be>0||i==1&&!Ge)&&od(Be,z[Be]);Tp()}it=!1,Ce!==!1&&Ds("setLegend")}r.setLegend=Ep;function od(de,Ce){let Be=E[de],Ve=de==0&&q==2?ir:e[de],ut;Ge?ut=Be.values(r,de,Ce)??_e:(ut=Be.value(r,Ce==null?null:Ve[Ce],de,Ce),ut=ut==null?_e:{_:ut}),X.values[de]=ut}function Zl(de,Ce,Be){Wa=ni,Ic=Fr,[ni,Fr]=V.move(r,ni,Fr),V.left=ni,V.top=Fr,ae&&(Xo&&Ef(Xo,na(ni),0,te,Se),io&&Ef(io,0,na(Fr),te,Se));let Ve,ut=Qn>Pn;fa=ts,Gi=null;let _t=U.ori==0?te:Se,Ft=U.ori==1?te:Se;if(ni<0||zn==0||ut){Ve=V.idx=null;for(let Gt=0;Gt<E.length;Gt++){let Qt=Ue[Gt];Qt!=null&&Ef(Qt,-10,-10,te,Se)}Et&&mi(null,ys,!0,de==null&&bs.setSeries),X.live&&(z.fill(Ve),it=!0)}else{let Gt,Qt,gn;i==1&&(Gt=U.ori==0?ni:Fr,Qt=xo(Gt,P),Ve=V.idx=Id(Qt,e[0],Qn,Pn),gn=B(e[0][Ve],U,_t,0));let xn=-10,Sn=-10,er=0,Kr=0,tr=!0,fr="",Bn="";for(let An=i==2?1:0;An<E.length;An++){let Wn=E[An],Ji=z[An],Is=Ji==null?null:i==1?e[An][Ji]:e[An][1][Ji],gi=V.dataIdx(r,An,Ve,Qt),ai=gi==null?null:i==1?e[An][gi]:e[An][1][gi];if(it=it||ai!=Is||gi!=Ji,z[An]=gi,An>0&&Wn.show){let os=gi==null?-10:gi==Ve?gn:B(i==1?e[0][gi]:e[An][0][gi],U,_t,0),Os=ai==null?-10:Z(ai,i==1?N[Wn.scale]:N[Wn.facets[1].scale],Ft,0);if(Et&&ai!=null){let Ko=U.ori==1?ni:Fr,ko=ra(Tt.dist(r,An,gi,Os,Ko));if(ko<fa){let Hi=Tt.bias;if(Hi!=0){let Gs=xo(Ko,Wn.scale),Po=ai>=0?1:-1,Ca=Gs>=0?1:-1;Ca==Po&&(Ca==1?Hi==1?ai>=Gs:ai<=Gs:Hi==1?ai<=Gs:ai>=Gs)&&(fa=ko,Gi=An)}else fa=ko,Gi=An}}if(it||Dt){let Ko,ko;U.ori==0?(Ko=os,ko=Os):(Ko=Os,ko=os);let Hi,Gs,Po,Ca,so,oo,yo=!0,Lc=yt.bbox;if(Lc!=null){yo=!1;let Do=Lc(r,An);Po=Do.left,Ca=Do.top,Hi=Do.width,Gs=Do.height}else Po=Ko,Ca=ko,Hi=Gs=yt.size(r,An);if(oo=yt.fill(r,An),so=yt.stroke(r,An),Dt)An==Gi&&fa<=Tt.prox&&(xn=Po,Sn=Ca,er=Hi,Kr=Gs,tr=yo,fr=oo,Bn=so);else{let Do=Ue[An];Do!=null&&(ct[An]=Po,St[An]=Ca,FI(Do,Hi,Gs,yo),zI(Do,oo,so),Ef(Do,Uu(Po),Uu(Ca),te,Se))}}}}if(Dt){let An=Tt.prox,Wn=Hs==null?fa<=An:fa>An||Gi!=Hs;if(it||Wn){let Ji=Ue[0];Ji!=null&&(ct[0]=xn,St[0]=Sn,FI(Ji,er,Kr,tr),zI(Ji,fr,Bn),Ef(Ji,Uu(xn),Uu(Sn),te,Se))}}}if($r.show&&Yo)if(de!=null){let[Gt,Qt]=bs.scales,[gn,xn]=bs.match,[Sn,er]=de.cursor.sync.scales,Kr=de.cursor.drag;if(_i=Kr._x,Oi=Kr._y,_i||Oi){let{left:tr,top:fr,width:Bn,height:An}=de.select,Wn=de.scales[Sn].ori,Ji=de.posToVal,Is,gi,ai,os,Os,Ko=Gt!=null&&gn(Gt,Sn),ko=Qt!=null&&xn(Qt,er);Ko&&_i?(Wn==0?(Is=tr,gi=Bn):(Is=fr,gi=An),ai=N[Gt],os=B(Ji(Is,Sn),ai,_t,0),Os=B(Ji(Is+gi,Sn),ai,_t,0),Jd(Ld(os,Os),ra(Os-os))):Jd(0,_t),ko&&Oi?(Wn==1?(Is=tr,gi=Bn):(Is=fr,gi=An),ai=N[Qt],os=Z(Ji(Is,er),ai,Ft,0),Os=Z(Ji(Is+gi,er),ai,Ft,0),sd(Ld(os,Os),ra(Os-os))):sd(0,Ft)}else Vs()}else{let Gt=ra(Wa-Ro),Qt=ra(Ic-bl);if(U.ori==1){let er=Gt;Gt=Qt,Qt=er}_i=vr.x&&Gt>=vr.dist,Oi=vr.y&&Qt>=vr.dist;let gn=vr.uni;gn!=null?_i&&Oi&&(_i=Gt>=gn,Oi=Qt>=gn,!_i&&!Oi&&(Qt>Gt?Oi=!0:_i=!0)):vr.x&&vr.y&&(_i||Oi)&&(_i=Oi=!0);let xn,Sn;_i&&(U.ori==0?(xn=xs,Sn=ni):(xn=Ga,Sn=Fr),Jd(Ld(xn,Sn),ra(Sn-xn)),Oi||sd(0,Ft)),Oi&&(U.ori==1?(xn=xs,Sn=ni):(xn=Ga,Sn=Fr),sd(Ld(xn,Sn),ra(Sn-xn)),_i||Jd(0,_t)),!_i&&!Oi&&(Jd(0,0),sd(0,0))}if(vr._x=_i,vr._y=Oi,de==null){if(Be){if(Rp!=null){let[Gt,Qt]=bs.scales;bs.values[0]=Gt!=null?xo(U.ori==0?ni:Fr,Gt):null,bs.values[1]=Qt!=null?xo(U.ori==1?ni:Fr,Qt):null}ud(KC,r,ni,Fr,te,Se,Ve)}if(Et){let Gt=Be&&bs.setSeries,Qt=Tt.prox;Hs==null?fa<=Qt&&mi(Gi,ys,!0,Gt):fa>Qt?mi(null,ys,!0,Gt):Gi!=Hs&&mi(Gi,ys,!0,Gt)}}it&&(X.idx=Ve,Ep()),Ce!==!1&&Ds("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(),Ds("syncRect",Ql))}function bm(de,Ce,Be,Ve,ut,_t,Ft){V._lock||Yo&&de!=null&&de.movementX==0&&de.movementY==0||(Cp(de,Ce,Be,Ve,ut,_t,Ft,!1,de!=null),de!=null?Zl(null,!0,!0):Zl(Ce,!0,!1))}function Cp(de,Ce,Be,Ve,ut,_t,Ft,Gt,Qt){if(Ql==null&&ad(!1),Rt(de),de!=null)Be=de.clientX-Ql.left,Ve=de.clientY-Ql.top;else{if(Be<0||Ve<0){ni=-10,Fr=-10;return}let[gn,xn]=bs.scales,Sn=Ce.cursor.sync,[er,Kr]=Sn.values,[tr,fr]=Sn.scales,[Bn,An]=bs.match,Wn=Ce.axes[0].side%2==1,Ji=U.ori==0?te:Se,Is=U.ori==1?te:Se,gi=Wn?_t:ut,ai=Wn?ut:_t,os=Wn?Ve:Be,Os=Wn?Be:Ve;if(tr!=null?Be=Bn(gn,tr)?a(er,N[gn],Ji,0):-10:Be=Ji*(os/gi),fr!=null?Ve=An(xn,fr)?a(Kr,N[xn],Is,0):-10:Ve=Is*(Os/ai),U.ori==1){let Ko=Be;Be=Ve,Ve=Ko}}Qt&&(Ce==null||Ce.cursor.event.type==KC)&&((Be<=1||Be>=te-1)&&(Be=_g(Be,te)),(Ve<=1||Ve>=Se-1)&&(Ve=_g(Ve,Se))),Gt?(Ro=Be,bl=Ve,[xs,Ga]=V.move(r,Be,Ve)):(ni=Be,Fr=Ve)}const _m={width:0,height:0,left:0,top:0};function Vs(){_l(_m,!1)}let Sm,wm,Mm,Tm;function du(de,Ce,Be,Ve,ut,_t,Ft){Yo=!0,_i=Oi=vr._x=vr._y=!1,Cp(de,Ce,Be,Ve,ut,_t,Ft,!0,!1),de!=null&&(je(ZC,tR,ld,!1),ud(RI,r,xs,Ga,te,Se,null));let{left:Gt,top:Qt,width:gn,height:xn}=$r;Sm=Gt,wm=Qt,Mm=gn,Tm=xn}function ld(de,Ce,Be,Ve,ut,_t,Ft){Yo=vr._x=vr._y=!1,Cp(de,Ce,Be,Ve,ut,_t,Ft,!1,!0);let{left:Gt,top:Qt,width:gn,height:xn}=$r,Sn=gn>0||xn>0,er=Sm!=Gt||wm!=Qt||Mm!=gn||Tm!=xn;if(Sn&&er&&_l($r),vr.setScale&&Sn&&er){let Kr=Gt,tr=gn,fr=Qt,Bn=xn;if(U.ori==1&&(Kr=Qt,tr=xn,fr=Gt,Bn=gn),_i&&vo(P,xo(Kr,P),xo(Kr+tr,P)),Oi)for(let An in N){let Wn=N[An];An!=P&&Wn.from==null&&Wn.min!=ts&&vo(An,xo(fr+Bn,An),xo(fr,An))}Vs()}else V.lock&&(V._lock=!V._lock,Zl(Ce,!0,de!=null));de!=null&&(be(ZC,tR),ud(ZC,r,ni,Fr,te,Se,null))}function Ap(de,Ce,Be,Ve,ut,_t,Ft){if(V._lock)return;Rt(de);let Gt=Yo;if(Yo){let Qt=!0,gn=!0,xn=10,Sn,er;U.ori==0?(Sn=_i,er=Oi):(Sn=Oi,er=_i),Sn&&er&&(Qt=ni<=xn||ni>=te-xn,gn=Fr<=xn||Fr>=Se-xn),Sn&&Qt&&(ni=ni<xs?0:te),er&&gn&&(Fr=Fr<Ga?0:Se),Zl(null,!0,!0),Yo=!1}ni=-10,Fr=-10,z.fill(null),Zl(null,!0,!0),Gt&&(Yo=Gt)}function Np(de,Ce,Be,Ve,ut,_t,Ft){V._lock||(Rt(de),bt(),Vs(),de!=null&&ud(DI,r,ni,Fr,te,Se,null))}function Em(){A.forEach(Zpe),ht(r.width,r.height,!0)}Wg(x2,m1,Em);const Jl={};Jl.mousedown=du,Jl.mousemove=bm,Jl.mouseup=ld,Jl.dblclick=Np,Jl.setSeries=(de,Ce,Be,Ve)=>{let ut=bs.match[2];Be=ut(r,Ce,Be),Be!=-1&&mi(Be,Ve,!0,!1)},ae&&(je(RI,b,du),je(KC,b,bm),je(kI,b,de=>{Rt(de),ad(!1)}),je(PI,b,Ap),je(DI,b,Np),cR.add(r),r.syncRect=ad);const cd=r.hooks=t.hooks||{};function Ds(de,Ce,Be){da?Ps.push([de,Ce,Be]):de in cd&&cd[de].forEach(Ve=>{Ve.call(null,r,Ce,Be)})}(t.plugins||[]).forEach(de=>{for(let Ce in de.hooks)cd[Ce]=(cd[Ce]||[]).concat(de.hooks[Ce])});const fu=(de,Ce,Be)=>Be,bs=Ho({key:null,setSeries:!1,filters:{pub:GI,sub:GI},scales:[P,E[1]?E[1].scale:null],match:[WI,WI,fu],values:[null,null]},V.sync);bs.match.length==2&&bs.match.push(fu),V.sync=bs;const Rp=bs.key,bh=ZW(Rp);function ud(de,Ce,Be,Ve,ut,_t,Ft){bs.filters.pub(de,Ce,Be,Ve,ut,_t,Ft)&&bh.pub(de,Ce,Be,Ve,ut,_t,Ft)}bh.sub(r);function kp(de,Ce,Be,Ve,ut,_t,Ft){bs.filters.sub(de,Ce,Be,Ve,ut,_t,Ft)&&Jl[de](null,Ce,Be,Ve,ut,_t,Ft)}r.pub=kp;function hu(){bh.unsub(r),cR.delete(r),We.clear(),iR(x2,m1,Em),c.remove(),ce==null||ce.remove(),Ds("destroy")}r.destroy=hu;function Oc(){Ds("init",t,e),ot(e||t.data,!1),G[P]?Pc(P,G[P]):bt(),Ke=$r.show&&($r.width>0||$r.height>0),Ne=it=!0,ht(t.width,t.height)}return E.forEach(Ut),A.forEach(on),n?n instanceof HTMLElement?(n.appendChild(c),Oc()):n(r,Oc):Oc(),r}go.assign=Ho;go.fmtNum=U8;go.rangeNum=y2;go.rangeLog=ST;go.rangeAsinh=j8;go.orient=_v;go.pxRatio=Ri;go.join=Hhe;go.fmtDate=H8,go.tzDate=Jhe;go.sync=ZW;{go.addGap=Ope,go.clipGaps=TT;let t=go.paths={points:r$};t.linear=s$,t.stepped=jpe,t.bars=Fpe,t.spline=Bpe}const c$=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 Vf({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(ed,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function u$(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)]),o=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),a=o-s,l=6;return{lower:s-l*a,upper:o+l*a}}function d$(t){return t.split("/").pop()||t}function av(t){var n;return((n=t.runName)==null?void 0:n.trim())||d$(t.runPath)}const Qpe=d1-1,hO="max-w-[190px]";function v_(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Jpe(t){const e=v_(t),{isTruncated:n,prefix:r,suffix:i}=UG(t,Qpe);return n?`<span class="inline-flex ${hO} min-w-0 items-center align-bottom" title="${e}"><span class="shrink-0">${v_(r)}</span><span class="shrink-0 px-0.5 text-muted-foreground/70">...</span><span class="shrink-0">${v_(i)}</span></span>`:`<span class="inline-block ${hO} truncate align-bottom" title="${e}">${v_(r)}</span>`}function Y8(t){const e=Jpe(av(t)),n=v_(d$(t.runPath));return`${e} <span class="text-muted-foreground/70">(${n})</span>`}function f$(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 tv(t)}const e0e=28;function t0e(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,o=t[n];if(o!=null)return s(n)?n:null;let a=n-1,l=n+1;for(;a>=0||l<t.length;){const c=a>=0?t[a]: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[a])-i),_=Math.abs(Number(e[l])-i)<v?l:a;return s(_)?_:null}if(h)return s(a)?a:null;if(g)return s(l)?l:null;a-=1,l+=1}return null}function c4(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const n0e={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 r0e(t){const e={...n0e};if(t.length>0){const n=t.map(r=>({prefix:`reward_${r}`,label:i0e(r)}));e.samples_metrics={title:"Samples Metrics",prefixes:n}}return e}function i0e(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const h$=["mean","std","min","max"],p$={mean:"Mean",std:"Std",min:"Min",max:"Max"};function K8(t,e){const n=typeof IntersectionObserver>"u",[r,i]=T.useState(n),[s,o]=T.useState(n),a=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?(a.current&&(clearTimeout(a.current),a.current=null),o(!0)):(a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{o(!1),a.current=null},2e3))},{root:l,rootMargin:c,threshold:d});return g.observe(h),()=>{g.disconnect(),a.current&&clearTimeout(a.current)}},[t,l,c,d]),r||s}function s0e({runs:t,shouldPoll:e,maxStep:n,maxTime:r,showEma:i=!1,emaSpan:s=10,hoveredRunId:o=null,availableRewardNames:a=[],availableSampleTags:l,customMetricSections:c={},xAxisMode:d="step",scrollRoot:h=null,evalsList:g=[]}){var ve,ge,Te,He,pe,qe,xt,nt,tt,Fe,we,ke,Ze,Ne,Ke,it,ht,Je,$e,Ae;const[v,b]=T.useState({}),[_,w]=T.useState(!0),[S,E]=T.useState(!0),[A,N]=T.useState(!0),[I,P]=T.useState(!0),[L,R]=T.useState({}),[O,F]=T.useState(!0),[U,q]=T.useState(!0),[B,Z]=T.useState(!0),G=T.useMemo(()=>r0e(a),[a]),$=d==="time",K=zr(((ve=t[0])==null?void 0:ve.runPath)||"",$&&!!t[0],e),Y=zr(((ge=t[1])==null?void 0:ge.runPath)||"",$&&!!t[1],e),J=zr(((Te=t[2])==null?void 0:Te.runPath)||"",$&&!!t[2],e),H=zr(((He=t[3])==null?void 0:He.runPath)||"",$&&!!t[3],e),z=zr(((pe=t[4])==null?void 0:pe.runPath)||"",$&&!!t[4],e),X=zr(((qe=t[5])==null?void 0:qe.runPath)||"",$&&!!t[5],e),V=zr(((xt=t[6])==null?void 0:xt.runPath)||"",$&&!!t[6],e),ie=zr(((nt=t[7])==null?void 0:nt.runPath)||"",$&&!!t[7],e),ae=zr(((tt=t[8])==null?void 0:tt.runPath)||"",$&&!!t[8],e),re=zr(((Fe=t[9])==null?void 0:Fe.runPath)||"",$&&!!t[9],e),ce=zr(((we=t[10])==null?void 0:we.runPath)||"",$&&!!t[10],e),oe=zr(((ke=t[11])==null?void 0:ke.runPath)||"",$&&!!t[11],e),fe=zr(((Ze=t[12])==null?void 0:Ze.runPath)||"",$&&!!t[12],e),me=zr(((Ne=t[13])==null?void 0:Ne.runPath)||"",$&&!!t[13],e),ye=zr(((Ke=t[14])==null?void 0:Ke.runPath)||"",$&&!!t[14],e),Ee=zr(((it=t[15])==null?void 0:it.runPath)||"",$&&!!t[15],e),Ge=zr(((ht=t[16])==null?void 0:ht.runPath)||"",$&&!!t[16],e),_e=zr(((Je=t[17])==null?void 0:Je.runPath)||"",$&&!!t[17],e),De=zr((($e=t[18])==null?void 0:$e.runPath)||"",$&&!!t[18],e),he=zr(((Ae=t[19])==null?void 0:Ae.runPath)||"",$&&!!t[19],e),{isStepTimesFetching:Le,isStepTimesRefetching:ne}=T.useMemo(()=>{if(!$)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const Oe=[K,Y,J,H,z,X,V,ie,ae,re,ce,oe,fe,me,ye,Ee,Ge,_e,De,he],Ye=Oe.some(yt=>yt.isFetching),st=Oe.filter(yt=>yt.isFetching),Rt=Ye&&st.length>0&&st.every(yt=>!!yt.data);return{isStepTimesFetching:Ye,isStepTimesRefetching:Rt}},[$,K,Y,J,H,z,X,V,ie,ae,re,ce,oe,fe,me,ye,Ee,Ge,_e,De,he]),{stepTimesByRun:We,firstStepTimesByRun:je}=T.useMemo(()=>{if(!$)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const Oe=[K,Y,J,H,z,X,V,ie,ae,re,ce,oe,fe,me,ye,Ee,Ge,_e,De,he],Ye=new Map,st=new Map;return t.forEach((Rt,yt)=>{if(yt>=20)return;const Et=Oe[yt].data;if(!Et||Et.first_step_time===null||Et.first_step_time===void 0||!Et.step_times||Et.step_times.length===0)return;const Dt=new Map;Et.step_times.forEach(Ue=>{typeof Ue.time=="number"&&Dt.set(Ue.step,Ue.time)}),Dt.size>0&&(Ye.set(Rt.runPath,Dt),st.set(Rt.runPath,Et.first_step_time))}),{stepTimesByRun:Ye,firstStepTimesByRun:st}},[t,$,K,Y,J,H,z,X,V,ie,ae,re,ce,oe,fe,me,ye,Ee,Ge,_e,De,he]),be={xAxisMode:d,stepTimesByRun:We,firstStepTimesByRun:je,isStepTimesFetching:Le,isStepTimesRefetching:ne,scrollRoot:h,maxStepLimit:n,maxTimeLimit:r},Xe=T.useMemo(()=>Object.keys(c),[c]),le=T.useCallback(Oe=>{b(Ye=>({...Ye,[Oe]:!(Ye[Oe]??!0)}))},[]),te=T.useCallback(Oe=>{R(Ye=>({...Ye,[Oe]:!(Ye[Oe]??!0)}))},[]),Se=g.length>0;return p.jsxs("div",{className:"-mt-3",children:[Xe.map((Oe,Ye)=>{const st=v[Oe]??!0,Rt=c[Oe]??{},yt=Object.entries(Rt);return p.jsxs("div",{children:[Ye>0&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:st,onOpenChange:()=>le(Oe),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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!st&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:c4(Oe)})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-4 mt-3 mb-4",children:yt.map(([Tt,Et])=>p.jsxs("div",{children:[Tt&&p.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:c4(Tt)}),p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Et.map(Dt=>p.jsx(Gr,{runs:t,shouldPoll:e,metricName:Dt,label:c4(Dt),showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...be},Dt))})]},Tt))})})]})]},Oe)}),Xe.length>0&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:_,onOpenChange:w,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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!_&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:G.reward.title})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:G.reward.prefixes.map(Oe=>p.jsx(tg,{runs:t,shouldPoll:e,prefix:Oe.prefix,label:Oe.label,hideGroupLabel:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...be,extraCharts:Oe.prefix==="reward_sum"?p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"reward_gini_mean",label:`${Oe.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...be}):void 0},Oe.prefix))})})]}),G.samples_metrics&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:S,onOpenChange:E,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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!S&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:G.samples_metrics.title})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:G.samples_metrics.prefixes.map(Oe=>p.jsx(tg,{runs:t,shouldPoll:e,prefix:Oe.prefix,label:Oe.label,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...be,extraCharts:p.jsx(Gr,{runs:t,shouldPoll:e,metricName:`${Oe.prefix}_gini_mean`,label:`${Oe.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...be})},Oe.prefix))})})]})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:A,onOpenChange:N,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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!A&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:G.advantage.title})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"space-y-6 mt-3 mb-4",children:G.advantage.prefixes.map(Oe=>p.jsx(tg,{runs:t,shouldPoll:e,prefix:Oe.prefix,label:Oe.label,hideGroupLabel:!0,showZeroLine:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...be},Oe.prefix))})})]}),Se&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:I,onOpenChange:P,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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!I&&"-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:g.map((Oe,Ye)=>{const st=Oe.eval_name,Rt=Oe.available_rollout_metric_names,yt=L[st]??!0;return p.jsxs("div",{children:[Ye>0&&p.jsx("div",{className:"border-t border-gray-100 my-3"}),p.jsxs(Ki,{open:yt,onOpenChange:()=>te(st),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(Wr,{className:Nt("h-3.5 w-3.5 text-muted-foreground transition-transform",!yt&&"-rotate-90")}),p.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:st})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3",children:[Rt.map(Tt=>p.jsx(u4,{runs:t,shouldPoll:e,evalName:st,prefix:`reward_${Tt}`,label:c4(Tt),showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:h,xAxisMode:d,stepTimesByRun:be.stepTimesByRun,firstStepTimesByRun:be.firstStepTimesByRun,isStepTimesFetching:be.isStepTimesFetching,isStepTimesRefetching:be.isStepTimesRefetching,maxStepLimit:be.maxStepLimit,maxTimeLimit:be.maxTimeLimit},`${st}-reward_${Tt}`)),p.jsx(u4,{runs:t,shouldPoll:e,evalName:st,prefix:"length_completion",label:"Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:h,xAxisMode:d,stepTimesByRun:be.stepTimesByRun,firstStepTimesByRun:be.firstStepTimesByRun,isStepTimesFetching:be.isStepTimesFetching,isStepTimesRefetching:be.isStepTimesRefetching,maxStepLimit:be.maxStepLimit,maxTimeLimit:be.maxTimeLimit}),p.jsx(u4,{runs:t,shouldPoll:e,evalName:st,prefix:"length_prompt",label:"Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:h,xAxisMode:d,stepTimesByRun:be.stepTimesByRun,firstStepTimesByRun:be.firstStepTimesByRun,isStepTimesFetching:be.isStepTimesFetching,isStepTimesRefetching:be.isStepTimesRefetching,maxStepLimit:be.maxStepLimit,maxTimeLimit:be.maxTimeLimit}),p.jsx(u4,{runs:t,shouldPoll:e,evalName:st,prefix:"length_sum",label:"Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:h,xAxisMode:d,stepTimesByRun:be.stepTimesByRun,firstStepTimesByRun:be.firstStepTimesByRun,isStepTimesFetching:be.isStepTimesFetching,isStepTimesRefetching:be.isStepTimesRefetching,maxStepLimit:be.maxStepLimit,maxTimeLimit:be.maxTimeLimit})]})})]})]},st)})})})]})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:O,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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!O&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:G.rollouts.title})]})})}),p.jsx(Qi,{children:p.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[G.rollouts.prefixes.map(Oe=>p.jsx(tg,{runs:t,shouldPoll:e,prefix:Oe.prefix,label:Oe.label,unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...be},Oe.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(Gr,{runs:t,shouldPoll:e,metricName:"stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,...be})]})]})]})})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:U,onOpenChange:q,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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!U&&"-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(Gr,{runs:t,shouldPoll:e,metricName:"discarded_count",label:"Discarded Count",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_pct",label:"Zero Advantage %",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"discarded_max_async_pct",label:"Max Async %",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"discarded_stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"discarded_group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"discarded_group_length_max_median_ratio_mean",label:"Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:o,...be})]})]}),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(Gr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_zero_pct",label:"Zero Advantage (All Reward = 0) %",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_positive_pct",label:"Zero Advantage (All Reward > 0) %",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_mean_reward",label:"Zero Advantage Mean Reward",showEma:i,emaSpan:s,hoveredRunId:o,...be})]})]}),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(Gr,{runs:t,shouldPoll:e,metricName:"canceled_count",label:"Canceled Count",showEma:i,emaSpan:s,hoveredRunId:o,...be})})]}),p.jsx(tg,{runs:t,shouldPoll:e,prefix:"discarded_length_prompt",label:"Discarded Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(tg,{runs:t,shouldPoll:e,prefix:"discarded_length_completion",label:"Discarded Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(tg,{runs:t,shouldPoll:e,prefix:"discarded_length_sum",label:"Discarded Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...be})]})})]}),p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsxs(Ki,{open:B,onOpenChange:Z,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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!B&&"-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(Gr,{runs:t,shouldPoll:e,metricName:"timing_step_total",label:"Time per Step",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_step_active",label:"Time per Step Active (Excl. Wait)",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_save_batch_total",label:"Batch Completion (Save Batch)",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_microbatch_count",label:"Microbatches per Step",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_forward_total",label:"Forward",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_backward_total",label:"Backward",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_total",label:"Loss Computation",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_total",label:"Compute KL",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_total",label:"Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_total",label:"Data to Device",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_total",label:"Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_waiting_for_data",label:"Waiting for Data",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_trainer_total",label:"Weight Broadcast (Trainer)",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_inference_total",label:"Weight Broadcast (Inference)",showEma:i,emaSpan:s,hoveredRunId:o,...be})]})]}),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(Gr,{runs:t,shouldPoll:e,metricName:"timing_forward_microbatch_mean",label:"Forward",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_backward_microbatch_mean",label:"Backward",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_microbatch_mean",label:"Loss Computation",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_microbatch_mean",label:"Compute KL",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_microbatch_mean",label:"Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_microbatch_mean",label:"Data to Device",showEma:i,emaSpan:s,hoveredRunId:o,...be}),p.jsx(Gr,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_microbatch_mean",label:"Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:o,...be})]})]})]})})]})]})}const _2=100;function o0e(t,e,n){const r=t.length;if(r<=_2)return{steps:t,counts:e};const i=Math.ceil(r/_2),s=[],o=[],a=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(a).fill(0);for(let g=l;g<c;g++){const v=e[g];for(let b=0;b<a;b++)h[b]+=v[b]||0}o.push(h)}return{steps:s,counts:o}}function m$({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,shouldPoll:s,scrollRoot:o=null,headerPrefix:a,headerSuffix:l}){const c=T.useRef(null),d=T.useRef(null),h=T.useRef(null),g=T.useRef(null),v=T.useRef(null),b=K8(c,{root:o,threshold:0}),{data:_,isFetching:w,isRefetching:S}=zG(t,e,b&&!!t&&!!e,s),E=_&&_.steps.length>0&&_.bin_edges.length>0,A=E&&_.steps.length>_2,N=T.useMemo(()=>!E||!_?null:A?o0e(_.steps,_.counts,_.bin_edges):{steps:_.steps,counts:_.counts},[E,_,A]),I=T.useCallback(U=>U==null?"N/A":i?Math.round(U).toLocaleString():Xu(U),[i]),P=T.useCallback(U=>Math.abs(U)>=1e3?`${parseFloat((U/1e3).toFixed(1))}k`:i?Math.round(U).toString():Number.isInteger(U)?U.toLocaleString():Math.abs(U)<.01&&U!==0?U.toExponential(1):String(parseFloat(U.toFixed(2))),[i]),L=T.useCallback(()=>{const U={top:8,right:8,bottom:24,left:40};if(!h.current||!_)return U;const q=h.current.getContext("2d");if(!q)return U;const B="10px system-ui, sans-serif",Z=5;let G=0;q.save(),q.setTransform(1,0,0,1,0,0),q.font=B;for(let $=0;$<Z;$++){const K=(_.global_min??0)+$/(Z-1)*((_.global_max??0)-(_.global_min??0)),Y=P(K);G=Math.max(G,q.measureText(Y).width)}return q.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(G)+12)}},[_,P]);T.useEffect(()=>{if(!d.current||!h.current||!E||!_||!N)return;const U=d.current,q=h.current,B=q.getContext("2d");if(!B)return;const Z=U.clientWidth,G=200,$="rgba(100, 100, 100, 0.9)",K="rgba(128, 128, 128, 0.15)",Y="10px system-ui, sans-serif",J=window.devicePixelRatio||1;q.width=Z*J,q.height=G*J,q.style.width=`${Z}px`,q.style.height=`${G}px`,B.scale(J,J),B.font=Y,B.clearRect(0,0,Z,G);const H=L(),z=Z-H.left-H.right,X=G-H.top-H.bottom,V=N.steps,ie=_.bin_edges,ae=N.counts,re=V.length,ce=ie.length-1;if(re===0||ce===0)return;let oe=0;for(const he of ae)for(const Le of he)Le>oe&&(oe=Le);const fe=Math.min(5,re),me=5,ye=z/Math.max(re,1),Ee=he=>H.left+(he+.5)*ye,Ge=he=>{const Le=(_.global_max??1)-(_.global_min??0),ne=(he-(_.global_min??0))/(Le||1);return H.top+X-ne*X},_e=he=>he===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(he/oe)*.75})`;B.strokeStyle=K,B.lineWidth=1;for(let he=0;he<fe;he++){const Le=Math.floor(he/Math.max(fe-1,1)*(re-1)),ne=Ee(Le);B.beginPath(),B.moveTo(ne,H.top),B.lineTo(ne,G-H.bottom),B.stroke()}for(let he=0;he<me;he++){const Le=(_.global_min??0)+he/(me-1)*((_.global_max??0)-(_.global_min??0)),ne=Ge(Le);B.beginPath(),B.moveTo(H.left,ne),B.lineTo(Z-H.right,ne),B.stroke()}const De=ye;for(let he=0;he<re;he++){const Le=H.left+he*ye,ne=ae[he];for(let We=0;We<ce;We++){const je=ne[We];if(je===0)continue;const be=ie[We+1],Xe=ie[We],le=Ge(be),te=Ge(Xe),Se=Math.max(1,te-le);B.fillStyle=_e(je),B.fillRect(Le,le,De,Se)}}if(r&&(_.global_min??0)<0&&(_.global_max??0)>0){const he=Ge(0);B.strokeStyle="rgba(128, 128, 128, 0.5)",B.lineWidth=1,B.setLineDash([5,5]),B.beginPath(),B.moveTo(H.left,he),B.lineTo(Z-H.right,he),B.stroke(),B.setLineDash([])}B.strokeStyle=$,B.lineWidth=1,B.beginPath(),B.moveTo(H.left,G-H.bottom),B.lineTo(Z-H.right,G-H.bottom),B.stroke(),B.beginPath(),B.moveTo(H.left,H.top),B.lineTo(H.left,G-H.bottom),B.stroke(),B.fillStyle=$,B.font=Y,B.textAlign="center";for(let he=0;he<fe;he++){const Le=Math.floor(he/Math.max(fe-1,1)*(re-1)),ne=V[Le],We=Ee(Le),je=ne>=1e3?`${(ne/1e3).toFixed(0)}k`:ne.toString();B.fillText(je,We,G-6)}B.textAlign="right",B.textBaseline="middle";for(let he=0;he<me;he++){const Le=(_.global_min??0)+he/(me-1)*((_.global_max??0)-(_.global_min??0)),ne=Ge(Le);B.fillText(P(Le),H.left-4,ne)}},[_,N,E,r,P,L]),T.useEffect(()=>{if(!d.current)return;const U=d.current,q=new ResizeObserver(()=>{if(h.current&&d.current){const B=d.current.clientWidth;h.current.style.width=`${B}px`}});return q.observe(U),()=>{q.disconnect()}},[]);const R=T.useCallback(U=>{var je;if(!_||!N||!g.current||!h.current||!d.current)return;const q=h.current.getBoundingClientRect(),B=U.clientX-q.left,Z=U.clientY-q.top,G=d.current.clientWidth,$=200,K=L(),Y=G-K.left-K.right,J=$-K.top-K.bottom;if(Y<=0||J<=0){v.current&&(v.current.style.display="none");return}if(B<K.left||B>G-K.right||Z<K.top||Z>$-K.bottom){g.current.style.display="none",v.current&&(v.current.style.display="none");return}const H=(B-K.left)/Y,z=Math.min(N.steps.length-1,Math.max(0,Math.round(H*(N.steps.length-1)))),X=N.steps[z];if(v.current){const be=Y/Math.max(N.steps.length,1),Xe=K.left+(z+.5)*be;v.current.style.display="block",v.current.style.left=`${Xe}px`,v.current.style.top=`${K.top}px`,v.current.style.bottom=`${K.bottom}px`}const V=1-(Z-K.top)/J,ie=_.bin_edges.length-1,ae=Math.min(ie-1,Math.max(0,Math.floor(V*ie))),re=_.bin_edges[ae],ce=_.bin_edges[ae+1],oe=((je=N.counts[z])==null?void 0:je[ae])??0,me=(N.counts[z]??[]).reduce((be,Xe)=>be+Xe,0),ye=me>0?(oe/me*100).toFixed(1):"0.0",Ge=A&&_.steps.length>_2?" (aggregated)":"";g.current.innerHTML=`
        <div class="font-medium mb-1">Step ${X.toLocaleString()}${Ge}</div>
        <div class="text-muted-foreground">Range: ${I(re)} to ${I(ce)}</div>
        <div class="text-muted-foreground">Count: ${oe.toLocaleString()} (${ye}%)</div>
      `,g.current.style.display="block",g.current.style.left="0px",g.current.style.top="0px";const _e=g.current.getBoundingClientRect(),De=U.clientX;let he=De;he+_e.width+20>window.innerWidth&&(he=De-_e.width);const Le=Math.max(4,window.innerWidth-_e.width-4);he=Math.min(Math.max(4,he),Le);const ne=d.current.getBoundingClientRect();let We=ne.top-_e.height+20;We<4&&(We=ne.bottom-20),g.current.style.left=`${he-_e.left}px`,g.current.style.top=`${We-_e.top}px`},[_,N,I,L,A]),O=T.useCallback(()=>{g.current&&(g.current.style.display="none"),v.current&&(v.current.style.display="none")},[]),F=w&&!S;return p.jsxs("div",{ref:c,className:Nt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white",F&&"opacity-50"),children:[p.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a,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 a0e(t,e,n,r,i){const s=T.useMemo(()=>t.slice(0,20).map(l=>l.runPath).filter(Boolean),[t]),o=Rue(s,e,n?[n]:[],i&&s.length>0&&!!n,r);return{metricsByRunPath:T.useMemo(()=>{var c,d;const l=new Map;return(d=(c=o.data)==null?void 0:c.runs)==null||d.forEach(h=>{l.set(h.run_path,h.metrics??[])}),l},[o.data]),isFetching:o.isFetching,isRefetching:o.isFetching&&!!o.data}}function g$({runs:t,shouldPoll:e,evalName:n,metricName:r,label:i,unit:s,showZeroLine:o,statType:a,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:I}){const P=T.useRef(null),L=T.useRef(null),R=T.useRef(null),O=T.useRef(null),[F,U]=un(kG),q=T.useMemo(()=>`eval-metric-${n}-${r}`,[n,r]),B=T.useRef(!1),Z=T.useRef(!1);T.useEffect(()=>{const Fe=ke=>{(ke.key==="Control"||ke.key==="Meta")&&(Z.current=!0)},we=ke=>{(ke.key==="Control"||ke.key==="Meta")&&(Z.current=!1,U(null))};return window.addEventListener("keydown",Fe),window.addEventListener("keyup",we),()=>{window.removeEventListener("keydown",Fe),window.removeEventListener("keyup",we)}},[U]);const G=`eval/${n}/${r}`,[$,K]=un(wG),J=c$.has(r),H=$[G],z=(H==null?void 0:H.ignoreOutliers)??!1,X=(H==null?void 0:H.ignoreFirstStep)??J,V=(H==null?void 0:H.minY)??null,ie=(H==null?void 0:H.maxY)??null,ae=(H==null?void 0:H.tagFilters)??{},re=Object.keys(ae).length>0,ce=T.useCallback(Fe=>{K(we=>{const ke={ignoreOutliers:!1,ignoreFirstStep:J,minY:null,maxY:null,tagFilters:{}},Ze=we[G]??ke,Ne=Fe(Ze);if(Ne.ignoreOutliers===ke.ignoreOutliers&&Ne.ignoreFirstStep===ke.ignoreFirstStep&&Ne.minY===ke.minY&&Ne.maxY===ke.maxY&&Object.keys(Ne.tagFilters??{}).length===0){if(!Object.prototype.hasOwnProperty.call(we,G))return we;const it={...we};return delete it[G],it}return{...we,[G]:Ne}})},[G,K,J]),oe=T.useCallback(Fe=>{ce(we=>({...we,ignoreOutliers:Fe}))},[ce]),fe=T.useCallback(Fe=>{ce(we=>({...we,ignoreFirstStep:Fe}))},[ce]),me=T.useCallback(Fe=>{ce(we=>({...we,minY:Fe}))},[ce]),ye=T.useCallback(Fe=>{ce(we=>({...we,maxY:Fe}))},[ce]),Ee=T.useCallback((Fe,we)=>{ce(ke=>{const Ze={...ke.tagFilters??{}},Ne=Ze[Fe]??[];if(Ne.includes(we)){const Ke=Ne.filter(it=>it!==we);Ke.length===0?delete Ze[Fe]:Ze[Fe]=Ke}else Ze[Fe]=[...Ne,we];return{...ke,tagFilters:Ze}})},[ce]),Ge=K8(P,{root:S,threshold:0}),_e=T.useMemo(()=>{const Fe=t.filter(ke=>!ke.isSelected),we=t.filter(ke=>ke.isSelected);return[...Fe,...we]},[t]),De=T.useMemo(()=>_e.slice(0,20),[_e]),he=T.useMemo(()=>{const Fe=new Map;return De.forEach((we,ke)=>{Fe.set(we.runPath,ke)}),Fe},[De]),{metricsByRunPath:Le,isFetching:ne,isRefetching:We}=a0e(t,n,r,e,Ge),{uplotData:je,seriesConfig:be,isFetching:Xe,isRefetching:le,hasData:te,timeToStepByRun:Se,outlierBounds:ve}=T.useMemo(()=>{const Fe=new Set,we=new Map,ke=new Map,Ze=new Map,Ne=g==="time"&&!!v&&!!b,Ke=ne;_e.forEach((st,Rt)=>{if(Rt>=20)return;const yt=Le.get(st.runPath)??[],Tt=new Map;if(yt.forEach(Et=>{Fe.add(Et.step),Tt.set(Et.step,Et.value)}),we.set(Rt,Tt),Ne){const Et=v==null?void 0:v.get(st.runPath),Dt=b==null?void 0:b.get(st.runPath);if(Et&&Dt!==void 0){const Ue=new Map,ct=new Map;Et.forEach((St,kt)=>{const Ut=St-Dt;Ue.set(kt,Ut),ct.set(Ut,kt)}),ke.set(Rt,Ue),Ze.set(Rt,ct)}}});const it=()=>!(!Ke&&!_||Ke&&!We||_&&!w);if(Fe.size===0)return{uplotData:null,seriesConfig:[],isFetching:Ke||_,isRefetching:it(),hasData:!1,timeToStepByRun:Ze,outlierBounds:null};let ht=Array.from(Fe).sort((st,Rt)=>st-Rt);E!=null&&!Ne&&(ht=ht.filter(st=>st<=E));let Je=ht;if(Ne){const st=new Set;if(we.forEach((yt,Tt)=>{const Et=ke.get(Tt);Et&&yt.forEach((Dt,Ue)=>{const ct=Et.get(Ue);ct!==void 0&&st.add(ct)})}),st.size===0)return{uplotData:null,seriesConfig:[],isFetching:Ke||_,isRefetching:it(),hasData:!1,timeToStepByRun:Ze,outlierBounds:null};let Rt=Array.from(st).sort((yt,Tt)=>yt-Tt);A!=null&&(Rt=Rt.filter(yt=>yt<=A)),Je=Rt}let $e=null;if(z){const st=[];we.forEach(Rt=>{Rt.forEach(yt=>{st.push(yt)})}),$e=u$(st)}const Ae=new Float64Array(Je),Oe=[{label:Ne?"Time (s)":"Step"}],Ye=[Ae];return _e.forEach((st,Rt)=>{if(Rt>=20)return;const yt=we.get(Rt)||new Map;let Tt;if(Ne){const ct=ke.get(Rt),St=new Map;ct&&yt.forEach((kt,Ut)=>{const Xt=ct.get(Ut);Xt!==void 0&&St.set(Xt,kt)}),Tt=Je.map(kt=>St.get(kt)??null)}else Tt=ht.map(ct=>yt.get(ct)??null);const Et=h===st.runPath,Ue=h!==null&&!Et?.1:c?.3:1;Ye.push(Tt),Oe.push({label:av(st),stroke:st.color,width:1,alpha:Ue,spanGaps:!0,points:{show:!1}})}),c&&_e.forEach((st,Rt)=>{if(Rt>=20)return;const yt=we.get(Rt)||new Map,Tt=2/(d+1);let Et=null,Dt;if(Ne){const kt=ke.get(Rt),Ut=new Map;ht.forEach(Xt=>{const hn=yt.get(Xt);if(hn!==void 0){Et=Et===null?hn:Tt*hn+(1-Tt)*Et;const Lt=kt==null?void 0:kt.get(Xt);Lt!==void 0&&Et!==null&&Ut.set(Lt,Et)}}),Dt=Je.map(Xt=>Ut.get(Xt)??null)}else{const kt=[];ht.forEach(Ut=>{const Xt=yt.get(Ut);Xt!==void 0?(Et=Et===null?Xt:Tt*Xt+(1-Tt)*Et,kt.push(Et)):kt.push(null)}),Dt=kt}const Ue=h===st.runPath,St=h!==null&&!Ue?.1:1;Ye.push(Dt),Oe.push({label:`${av(st)} (EMA)`,stroke:st.color,width:1.5,alpha:St,spanGaps:!0,points:{show:!1}})}),{uplotData:Ye,seriesConfig:Oe,isFetching:Ke||_,isRefetching:it(),hasData:!0,timeToStepByRun:Ze,outlierBounds:$e}},[_e,Le,ne,We,c,d,h,g,v,b,_,w,E,A,z]),ge=a||r.split("_").pop()||"",Te=g==="time",He=T.useCallback(Fe=>Fe==null?"N/A":l&&(ge==="min"||ge==="max")?Math.round(Fe).toLocaleString():Xu(Fe),[l,ge]),pe=T.useCallback(Fe=>Math.abs(Fe)>=1e3?`${parseFloat((Fe/1e3).toFixed(1))}k`:l?ge==="min"||ge==="max"?Math.round(Fe).toString():String(parseFloat(Fe.toFixed(1))):Number.isInteger(Fe)?Fe.toLocaleString():Math.abs(Fe)<.01&&Fe!==0?Fe.toExponential(1):String(parseFloat(Fe.toFixed(2))),[l,ge]),qe=T.useCallback(Fe=>Te?tv(Fe):Fe>=1e3?`${(Fe/1e3).toFixed(0)}k`:Fe.toString(),[Te]);T.useEffect(()=>{if(!L.current||!je||!te)return;const Fe=L.current,we=Fe.clientWidth,ke=Fe.clientHeight||192;let Ze=1/0,Ne=-1/0;for(let Et=1;Et<je.length;Et++){const Dt=je[Et];for(let Ue=0;Ue<Dt.length;Ue++){if(X&&Ue===0)continue;const ct=Dt[Ue];ct!=null&&(z&&ve?ct>=ve.lower&&ct<=ve.upper&&(ct<Ze&&(Ze=ct),ct>Ne&&(Ne=ct)):(ct<Ze&&(Ze=ct),ct>Ne&&(Ne=ct)))}}Ze===1/0&&ve&&(Ze=ve.lower,Ne=ve.upper);const Ke=Ne-Ze,it=Math.max(Math.abs(Ne),Math.abs(Ze)),ht=Math.max(it*.05,1e-10),Je=Math.max(Ke*.1,ht);let $e,Ae;o?($e=Math.min(Ze-Je,0),Ae=Math.max(Ne+Je,0)):($e=Ze-Je,Ae=Ne+Je),V!==null&&($e=V),ie!==null&&(Ae=ie);const Oe="rgba(128, 128, 128, 0.15)",Ye="rgba(100, 100, 100, 0.9)",Rt={width:we,height:ke,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[$e,Ae]}},axes:[{stroke:Ye,grid:{stroke:Oe,width:1},ticks:{stroke:Oe,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Et,Dt)=>Dt.map(qe)},{stroke:Ye,grid:{stroke:Oe,width:1},ticks:{stroke:Oe,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Et,Dt)=>{if(!Dt||Dt.length===0)return 40;const Ue=Math.max(...Dt.map(ct=>ct.length));return Math.max(40,Ue*7+14)},values:(Et,Dt)=>Dt.map(pe)}],series:be,hooks:{draw:[Et=>{var kt,Ut;if(!je)return;const Dt=je[0],Ue=Math.min(_e.length,20),ct=Et.series.length,St=Et.ctx;St.save();for(let Xt=1;Xt<ct;Xt++){const hn=je[Xt];if(!hn)continue;let Lt=-1;for(let lr=hn.length-1;lr>=0;lr--)if(hn[lr]!==null&&hn[lr]!==void 0){Lt=lr;break}if(Lt===-1)continue;const on=Dt[Lt],Ht=hn[Lt];if(on===void 0||Ht===void 0||Ht===null)continue;const kn=Et.valToPos(Number(on),"x",!0),Xn=Et.valToPos(Number(Ht),"y",!0);if(!Number.isFinite(kn)||!Number.isFinite(Xn))continue;const zn=Et.series[Xt],Qn=typeof(zn==null?void 0:zn.alpha)=="number"?zn.alpha:1;let Pn=typeof(zn==null?void 0:zn.stroke)=="string"?zn.stroke:void 0;if(!Pn){const lr=Xt-1;if(lr<Ue)Pn=(kt=_e[lr])==null?void 0:kt.color;else if(c){const ir=lr-Ue;ir>=0&&ir<Ue&&(Pn=(Ut=_e[ir])==null?void 0:Ut.color)}}Pn&&(St.globalAlpha=Qn,St.fillStyle=Pn,St.beginPath(),St.arc(kn,Xn,4,0,Math.PI*2),St.fill())}St.restore()}],setCursor:[Et=>{if(!O.current)return;const{left:Dt,top:Ue,idx:ct}=Et.cursor;if(ct==null||Dt===void 0||Ue===void 0||Dt<0){O.current.style.display="none";return}const St=je[0][ct];if(St===void 0){O.current.style.display="none";return}Z.current&&!B.current&&U({xValue:Number(St),sourceChartId:q});let Ut=`<div class="font-medium mb-1">${Te?`Time ${f$(Number(St))}`:`Step ${Number(St).toLocaleString()}`}</div>`;const Xt=De.length;t.forEach(kn=>{var ir;const Xn=he.get(kn.runPath);if(Xn===void 0)return;const zn=Xn+1,Qn=je[zn];if(!Qn)return;const Pn=Qn[ct];let lr;if(c){const xe=Xt+Xn+1;lr=(ir=je[xe])==null?void 0:ir[ct]}Pn!=null&&(Ut+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${kn.color}"></div>
                    <span>${Y8(kn)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${c?.7:1}">${He(Pn)}${s?` ${s}`:""}</span>
                    ${c&&lr!==void 0&&lr!==null?`<span class="text-muted-foreground">(EMA: ${He(lr)})</span>`:""}
                  </div>
                </div>
              `)}),O.current.innerHTML=Ut,O.current.style.display="block";const hn=L.current.getBoundingClientRect(),Lt=O.current.getBoundingClientRect();let on=hn.left+Dt+15;on+Lt.width+20>window.innerWidth&&(on=hn.left+Dt-Lt.width-15+Et.bbox.left),on=Math.max(4,on);let Ht=hn.top-Lt.height+20;Ht<4&&(Ht=hn.bottom-20),O.current.style.left=`${on}px`,O.current.style.top=`${Ht}px`}]}};R.current&&R.current.destroy();const yt=new go(Rt,je,Fe);R.current=yt;const Tt=new ResizeObserver(Et=>{for(const Dt of Et){const{width:Ue,height:ct}=Dt.contentRect;yt&&Ue>0&&ct>0&&yt.setSize({width:Ue,height:ct})}});return Tt.observe(Fe),()=>{Tt.disconnect(),yt.destroy(),R.current=null}},[je,be,te,qe,pe,He,Te,Se,_e,h,c,o,s,t,De,he,q,U,z,X,ve,V,ie]),T.useEffect(()=>{if(!F){O.current&&(O.current.style.display="none");return}if(F.sourceChartId===q||!R.current||!je)return;const Fe=R.current,we=je[0];if(!we||we.length===0)return;const ke=F.xValue;let Ze=0,Ne=1/0;for(let it=0;it<we.length;it++){const ht=Math.abs(Number(we[it])-ke);ht<Ne&&(Ne=ht,Ze=it)}const Ke=Fe.valToPos(Number(we[Ze]),"x");Ke>=0&&Ke<=Fe.width&&(B.current=!0,Fe.setCursor({left:Ke,top:0}),B.current=!1)},[F,q,je]);const xt=T.useCallback(()=>{O.current&&(O.current.style.display="none"),(F==null?void 0:F.sourceChartId)===q&&U(null)},[F,q,U]),nt=Xe&&!le,tt=i||(ge?`${ge.charAt(0).toUpperCase()}${ge.slice(1)}`:r);return p.jsxs("div",{ref:P,className:Nt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white h-[246px] flex flex-col",nt&&"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:tt})]}),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(ow,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(pi,{checked:z,onCheckedChange:oe,children:"Ignore Outliers"}),p.jsx(pi,{checked:X,onCheckedChange:fe,children:"Ignore First Step"}),p.jsx(ul,{}),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:V??"",onChange:Fe=>{const we=Fe.target.value;me(we===""?null:Number(we))},onClick:Fe=>Fe.stopPropagation(),onKeyDown:Fe=>Fe.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:Fe=>{const we=Fe.target.value;ye(we===""?null:Number(we))},onClick:Fe=>Fe.stopPropagation(),onKeyDown:Fe=>Fe.stopPropagation()})]})]})]}),I]})]}),(z||X||V!==null||ie!==null||re)&&p.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[z&&p.jsx(Vf,{label:"Ignore Outliers",onRemove:()=>oe(!1)}),X&&p.jsx(Vf,{label:"Ignore First Step",onRemove:()=>fe(!1)}),V!==null&&p.jsx(Vf,{label:`Min Y: ${V}`,onRemove:()=>me(null)}),ie!==null&&p.jsx(Vf,{label:`Max Y: ${ie}`,onRemove:()=>ye(null)}),Object.entries(ae).map(([Fe,we])=>we.map(ke=>p.jsx(Vf,{label:`${Fe}: ${ke}`,onRemove:()=>Ee(Fe,ke)},`${Fe}:${ke}`)))]})]}),te?p.jsxs("div",{className:"flex-1 min-h-0 relative bg-white rounded",ref:L,onMouseLeave:xt,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"}}),le&&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:Xe?"Loading...":"No data"})]})}function u4({runs:t,shouldPoll:e,evalName:n,prefix:r,label:i,unit:s,showZeroLine:o,isTokenMetric:a,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:h$.map(A=>p.jsx(g$,{runs:t,shouldPoll:e,evalName:n,metricName:`${r}_${A}`,label:`${i} ${p$[A]}`,unit:s,showZeroLine:o,statType:A,isTokenMetric:a,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 tg({runs:t,shouldPoll:e,prefix:n,label:r,unit:i,showZeroLine:s,isTokenMetric:o,showEma:a,emaSpan:l,hoveredRunId:c,xAxisMode:d,stepTimesByRun:h,firstStepTimesByRun:g,isStepTimesFetching:v,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:w,maxTimeLimit:S,extraCharts:E,hideGroupLabel:A,availableSampleTags:N}){const I=t.find(P=>P.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:[h$.map(P=>p.jsx(Gr,{runs:t,shouldPoll:e,metricName:`${n}_${P}`,label:`${r} ${p$[P]}`,unit:i,showZeroLine:s,statType:P,isTokenMetric:o,showEma:a,emaSpan:l,hoveredRunId:c,xAxisMode:d,stepTimesByRun:h,firstStepTimesByRun:g,isStepTimesFetching:v,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:w,maxTimeLimit:S,availableSampleTags:N},`${n}_${P}`)),E,I&&p.jsx(m$,{runPath:I.runPath,metricType:n,label:`${r} (Dist. Over Time)`,showZeroLine:s,isTokenMetric:o,shouldPoll:e,scrollRoot:_})]})]})}function l0e(t,e,n,r,i){const s=T.useMemo(()=>t.slice(0,20).map(c=>c.runPath).filter(Boolean),[t]),o=T.useMemo(()=>e?[e]:[],[e]),a=Aue(s,o,r&&s.length>0&&o.length>0,n,i);return{metricsByRunPath:T.useMemo(()=>{var d,h;const c=new Map;return(h=(d=a.data)==null?void 0:d.runs)==null||h.forEach(g=>{c.set(g.run_path,g.metrics??[])}),c},[a.data]),isFetching:a.isFetching,isRefetching:a.isFetching&&!!a.data}}function Gr({runs:t,shouldPoll:e,metricName:n,label:r,unit:i,showZeroLine:s,statType:o,isTokenMetric:a,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:I,availableSampleTags:P}){const L=T.useRef(null),R=T.useRef(null),O=T.useRef(null),F=T.useRef(null),[U,q]=un(kG),[B,Z]=un(wG),G=T.useMemo(()=>`metric-${n}`,[n]),$=T.useRef(!1),K=T.useRef(!1);T.useEffect(()=>{const ke=Ne=>{(Ne.key==="Control"||Ne.key==="Meta")&&(K.current=!0)},Ze=Ne=>{(Ne.key==="Control"||Ne.key==="Meta")&&(K.current=!1,q(null))};return window.addEventListener("keydown",ke),window.addEventListener("keyup",Ze),()=>{window.removeEventListener("keydown",ke),window.removeEventListener("keyup",Ze)}},[q]);const Y=S??!1,H=c$.has(n),z=B[n],X=(z==null?void 0:z.ignoreOutliers)??Y,V=(z==null?void 0:z.ignoreFirstStep)??H,ie=(z==null?void 0:z.minY)??null,ae=(z==null?void 0:z.maxY)??null,re=(z==null?void 0:z.tagFilters)??{},ce=T.useCallback(ke=>{Z(Ze=>{const Ne={ignoreOutliers:Y,ignoreFirstStep:H,minY:null,maxY:null,tagFilters:{}},Ke=Ze[n]??Ne,it=ke(Ke);if(it.ignoreOutliers===Ne.ignoreOutliers&&it.ignoreFirstStep===Ne.ignoreFirstStep&&it.minY===Ne.minY&&it.maxY===Ne.maxY&&Object.keys(it.tagFilters??{}).length===0){if(!Object.prototype.hasOwnProperty.call(Ze,n))return Ze;const Je={...Ze};return delete Je[n],Je}return{...Ze,[n]:it}})},[n,Z,Y,H]),oe=T.useCallback(ke=>{ce(Ze=>({...Ze,ignoreOutliers:ke}))},[ce]),fe=T.useCallback(ke=>{ce(Ze=>({...Ze,ignoreFirstStep:ke}))},[ce]),me=T.useCallback(ke=>{ce(Ze=>({...Ze,minY:ke}))},[ce]),ye=T.useCallback(ke=>{ce(Ze=>({...Ze,maxY:ke}))},[ce]),Ee=T.useCallback((ke,Ze)=>{ce(Ne=>{const Ke={...Ne.tagFilters??{}},it=Ke[ke]??[];if(it.includes(Ze)){const ht=it.filter(Je=>Je!==Ze);ht.length===0?delete Ke[ke]:Ke[ke]=ht}else Ke[ke]=[...it,Ze];return{...Ne,tagFilters:Ke}})},[ce]),Ge=Object.keys(re).length>0,_e=K8(L,{root:w,threshold:0}),De=T.useMemo(()=>{const ke=t.filter(Ne=>!Ne.isSelected),Ze=t.filter(Ne=>Ne.isSelected);return[...ke,...Ze]},[t]),he=T.useMemo(()=>De.slice(0,20),[De]),Le=T.useMemo(()=>{const ke=new Map;return he.forEach((Ze,Ne)=>{ke.set(Ze.runPath,Ne)}),ke},[he]),{metricsByRunPath:ne,isFetching:We,isRefetching:je}=l0e(t,n,e,_e,re),{uplotData:be,seriesConfig:Xe,isFetching:le,isRefetching:te,hasData:Se,timeToStepByRun:ve,outlierBounds:ge}=T.useMemo(()=>{const ke=new Set,Ze=new Map,Ne=new Map,Ke=new Map,it=h==="time"&&!!g&&!!v,ht=We;De.forEach((Tt,Et)=>{if(Et>=20)return;const Dt=ne.get(Tt.runPath)??[],Ue=new Map;if(Dt.forEach(ct=>{ke.add(ct.step),Ue.set(ct.step,ct.value)}),Ze.set(Et,Ue),it){const ct=g==null?void 0:g.get(Tt.runPath),St=v==null?void 0:v.get(Tt.runPath);if(ct&&St!==void 0){const kt=new Map,Ut=new Map;ct.forEach((Xt,hn)=>{const Lt=Xt-St;kt.set(hn,Lt),Ut.set(Lt,hn)}),Ne.set(Et,kt),Ke.set(Et,Ut)}}});const Je=()=>!(!ht&&!b||ht&&!je||b&&!_);if(ke.size===0)return{uplotData:null,seriesConfig:[],isFetching:ht||b,isRefetching:Je(),hasData:!1,timeToStepByRun:Ke,outlierBounds:null,minStep:null};const $e=Math.min(...Array.from(ke));let Ae=Array.from(ke).sort((Tt,Et)=>Tt-Et);E!=null&&!it&&(Ae=Ae.filter(Tt=>Tt<=E));let Oe=Ae;if(it){const Tt=new Set;if(Ze.forEach((Dt,Ue)=>{const ct=Ne.get(Ue);ct&&Dt.forEach((St,kt)=>{const Ut=ct.get(kt);Ut!==void 0&&Tt.add(Ut)})}),Tt.size===0)return{uplotData:null,seriesConfig:[],isFetching:ht||b,isRefetching:Je(),hasData:!1,timeToStepByRun:Ke,outlierBounds:null,minStep:null};let Et=Array.from(Tt).sort((Dt,Ue)=>Dt-Ue);A!=null&&(Et=Et.filter(Dt=>Dt<=A)),Oe=Et}let Ye=null;if(X){const Tt=[];Ze.forEach(Et=>{Et.forEach(Dt=>{Tt.push(Dt)})}),Ye=u$(Tt)}const st=new Float64Array(Oe),Rt=[{label:it?"Time (s)":"Step"}],yt=[st];return De.forEach((Tt,Et)=>{if(Et>=20)return;const Dt=Ze.get(Et)||new Map;let Ue;if(it){const Ut=Ne.get(Et),Xt=new Map;Ut&&Dt.forEach((hn,Lt)=>{const on=Ut.get(Lt);on!==void 0&&Xt.set(on,hn)}),Ue=Oe.map(hn=>Xt.get(hn)??null)}else Ue=Ae.map(Ut=>Dt.get(Ut)??null);const ct=d===Tt.runPath,St=d!==null;let kt;St&&!ct?kt=.1:kt=l?.3:1,yt.push(Ue),Rt.push({label:av(Tt),stroke:Tt.color,width:1,alpha:kt,spanGaps:!0,points:{show:!1}})}),l&&De.forEach((Tt,Et)=>{if(Et>=20)return;const Dt=Ze.get(Et)||new Map,Ue=2/(c+1);let ct=null,St;if(it){const hn=Ne.get(Et),Lt=new Map;Ae.forEach(on=>{const Ht=Dt.get(on);if(Ht!==void 0){!(Ye&&(Ht<Ye.lower||Ht>Ye.upper))&&!(V&&on===$e)&&(ct=ct===null?Ht:Ue*Ht+(1-Ue)*ct);const zn=hn==null?void 0:hn.get(on);zn!==void 0&&ct!==null&&Lt.set(zn,ct)}}),St=Oe.map(on=>Lt.get(on)??null)}else{const hn=[];Ae.forEach(Lt=>{const on=Dt.get(Lt);on!==void 0?(!(Ye&&(on<Ye.lower||on>Ye.upper))&&!(V&&Lt===$e)&&(ct===null?ct=on:ct=Ue*on+(1-Ue)*ct),hn.push(ct)):hn.push(null)}),St=hn}const kt=d===Tt.runPath,Ut=d!==null;let Xt;Ut&&!kt?Xt=.1:Xt=1,yt.push(St),Rt.push({label:`${av(Tt)} (EMA)`,stroke:Tt.color,width:1.5,alpha:Xt,spanGaps:!0,points:{show:!1}})}),{uplotData:yt,seriesConfig:Rt,isFetching:ht||b,isRefetching:Je(),hasData:!0,timeToStepByRun:Ke,outlierBounds:Ye,minStep:$e}},[De,ne,We,je,l,c,d,h,g,v,b,_,X,V,E,A]),Te=o||n.split("_").pop()||"",He=h==="time",pe=n.startsWith("timing_")&&n!=="timing_microbatch_count",qe=T.useCallback(ke=>ke==null?"N/A":a&&(Te==="min"||Te==="max")?Math.round(ke).toLocaleString():Xu(ke),[a,Te]),xt=T.useCallback(ke=>pe?tv(ke):Math.abs(ke)>=1e3?`${parseFloat((ke/1e3).toFixed(1))}k`:a?Te==="min"||Te==="max"?Math.round(ke).toString():String(parseFloat(ke.toFixed(1))):Number.isInteger(ke)?ke.toLocaleString():Math.abs(ke)<.01&&ke!==0?ke.toExponential(1):String(parseFloat(ke.toFixed(2))),[a,pe,Te]),nt=T.useCallback(ke=>He?tv(ke):ke>=1e3?`${(ke/1e3).toFixed(0)}k`:ke.toString(),[He]);T.useEffect(()=>{if(!R.current||!be||!Se)return;const ke=R.current,Ze=ke.clientWidth,Ne=ke.clientHeight||192;let Ke=1/0,it=-1/0;for(let Ue=1;Ue<be.length;Ue++){const ct=be[Ue];for(let St=0;St<ct.length;St++){if(V&&St===0)continue;const kt=ct[St];kt!=null&&(X&&ge?kt>=ge.lower&&kt<=ge.upper&&(kt<Ke&&(Ke=kt),kt>it&&(it=kt)):(kt<Ke&&(Ke=kt),kt>it&&(it=kt)))}}Ke===1/0&&ge&&(Ke=ge.lower,it=ge.upper);const ht=it-Ke,Je=Math.max(Math.abs(it),Math.abs(Ke)),$e=Math.max(Je*.05,1e-10),Ae=Math.max(ht*.1,$e);let Oe,Ye;s?(Oe=Math.min(Ke-Ae,0),Ye=Math.max(it+Ae,0)):(Oe=Ke-Ae,Ye=it+Ae),ie!==null&&(Oe=ie),ae!==null&&(Ye=ae);const st="rgba(128, 128, 128, 0.15)",Rt="rgba(100, 100, 100, 0.9)",Tt={width:Ze,height:Ne,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[Oe,Ye]}},axes:[{stroke:Rt,grid:{stroke:st,width:1},ticks:{stroke:st,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Ue,ct)=>ct.map(nt)},{stroke:Rt,grid:{stroke:st,width:1},ticks:{stroke:st,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Ue,ct)=>{if(!ct||ct.length===0)return 40;const St=Math.max(...ct.map(kt=>kt.length));return Math.max(40,St*7+14)},values:(Ue,ct)=>ct.map(xt)}],series:Xe,hooks:{draw:[Ue=>{var Xt,hn;if(!be)return;const ct=be[0],St=Math.min(De.length,20),kt=Ue.series.length,Ut=Ue.ctx;Ut.save();for(let Lt=1;Lt<kt;Lt++){const on=be[Lt];if(!on)continue;let Ht=-1;for(let xe=on.length-1;xe>=0;xe--){const ot=on[xe];if(ot!=null){Ht=xe;break}}if(Ht===-1)continue;const kn=ct[Ht],Xn=on[Ht];if(kn===void 0||Xn===void 0||Xn===null)continue;const zn=Ue.valToPos(Number(kn),"x",!0),Qn=Ue.valToPos(Number(Xn),"y",!0);if(!Number.isFinite(zn)||!Number.isFinite(Qn))continue;const Pn=Ue.series[Lt],lr=typeof(Pn==null?void 0:Pn.alpha)=="number"?Pn.alpha:1;let ir=typeof(Pn==null?void 0:Pn.stroke)=="string"?Pn.stroke:void 0;if(!ir){const xe=Lt-1;if(xe<St)ir=(Xt=De[xe])==null?void 0:Xt.color;else if(l){const ot=xe-St;ot>=0&&ot<St&&(ir=(hn=De[ot])==null?void 0:hn.color)}}ir&&(Ut.globalAlpha=lr,Ut.fillStyle=ir,Ut.beginPath(),Ut.arc(zn,Qn,4,0,Math.PI*2),Ut.fill())}Ut.restore()}],setCursor:[Ue=>{if(!F.current)return;const{left:ct,top:St,idx:kt}=Ue.cursor;if(kt==null||ct===void 0||St===void 0||ct<0){F.current.style.display="none";return}const Ut=be[0][kt];if(Ut===void 0){F.current.style.display="none";return}K.current&&!$.current&&q({xValue:Number(Ut),sourceChartId:G});const Xt=(()=>{var bt,mt;if(!He||!ve)return null;const lr=Number(Ut);if(d){const pt=De.findIndex($t=>$t.runPath===d);if(pt>=0){const $t=(bt=ve.get(pt))==null?void 0:bt.get(lr);if($t!==void 0)return $t}}const ir=De.findIndex(pt=>pt.isSelected);if(ir>=0){const pt=(mt=ve.get(ir))==null?void 0:mt.get(lr);if(pt!==void 0)return pt}let xe=null;const ot=new Set;return De.forEach((pt,$t)=>{var en;const Zt=(en=ve.get($t))==null?void 0:en.get(lr);Zt!==void 0&&(ot.add(Zt),xe===null&&(xe=Zt))}),ot.size===1,xe})();let Lt=`<div class="font-medium mb-1">${He?`Time ${f$(Number(Ut))}${Xt!==null?` <span class="text-muted-foreground">(Step ${Number(Xt).toLocaleString()})</span>`:""}`:`Step ${Number(Ut).toLocaleString()}`}</div>`;const on=he.length,Ht=be[0],kn=(()=>{if(!He)return null;const lr=Ue.scales.x,ir=Number(lr.min),xe=Number(lr.max);if(!Number.isFinite(ir)||!Number.isFinite(xe))return null;const ot=Math.abs(xe-ir);if(ot<=0)return null;const bt=Math.max(1,Ue.bbox.width);return ot*e0e/bt})();t.forEach(lr=>{const ir=Le.get(lr.runPath);if(ir===void 0)return;const xe=ir+1,ot=be[xe];if(!ot)return;const bt=He?t0e(ot,Ht,kt,kn):kt;if(bt===null)return;const mt=ot[bt];let pt;if(l){const $t=on+ir+1,Zt=be[$t];pt=Zt==null?void 0:Zt[bt]}mt!=null&&(Lt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${lr.color}"></div>
                    <span>${Y8(lr)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${l?.7:1}">${pe?rI(mt):`${qe(mt)}${i?` ${i}`:""}`}</span>
                    ${l&&pt!==void 0&&pt!==null?`<span class="text-muted-foreground">(EMA: ${pe?rI(pt):qe(pt)})</span>`:""}
                  </div>
                </div>
              `)}),F.current.innerHTML=Lt,F.current.style.display="block";const Xn=R.current.getBoundingClientRect(),zn=F.current.getBoundingClientRect();let Qn=Xn.left+ct+15;Qn+zn.width+20>window.innerWidth&&(Qn=Xn.left+ct-zn.width-15+Ue.bbox.left),Qn=Math.max(4,Qn);let Pn=Xn.top-zn.height+20;Pn<4&&(Pn=Xn.bottom-20),F.current.style.left=`${Qn}px`,F.current.style.top=`${Pn}px`}]}};O.current&&O.current.destroy();const Et=new go(Tt,be,ke);O.current=Et;const Dt=new ResizeObserver(Ue=>{for(const ct of Ue){const{width:St,height:kt}=ct.contentRect;Et&&St>0&&kt>0&&Et.setSize({width:St,height:kt})}});return Dt.observe(ke),()=>{Dt.disconnect(),Et.destroy(),O.current=null}},[be,Xe,Se,nt,xt,qe,He,ve,De,d,l,s,i,X,ge,V,ie,ae,t,he,Le,G,pe,q]),T.useEffect(()=>{if(!U){F.current&&(F.current.style.display="none");return}if(U.sourceChartId===G||!O.current||!be)return;const ke=O.current,Ze=be[0];if(!Ze||Ze.length===0)return;const Ne=U.xValue;let Ke=0,it=1/0;for(let Je=0;Je<Ze.length;Je++){const $e=Math.abs(Number(Ze[Je])-Ne);$e<it&&(it=$e,Ke=Je)}const ht=ke.valToPos(Number(Ze[Ke]),"x");ht>=0&&ht<=ke.width&&($.current=!0,ke.setCursor({left:ht,top:0}),$.current=!1)},[U,G,be]);const tt=T.useCallback(()=>{F.current&&(F.current.style.display="none"),(U==null?void 0:U.sourceChartId)===G&&q(null)},[U,G,q]),Fe=le&&!te,we=r||(Te?`${Te.charAt(0).toUpperCase()}${Te.slice(1)}`:n);return p.jsxs("div",{ref:L,className:Nt("group/chart rounded-lg border border-gray-200 p-3 transition-opacity bg-white h-[246px] flex flex-col",Fe&&"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(ow,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(pi,{checked:X,onCheckedChange:oe,children:"Ignore Outliers"}),p.jsx(pi,{checked:V,onCheckedChange:fe,children:"Ignore First Step"}),p.jsx(ul,{}),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:ie??"",onChange:ke=>{const Ze=ke.target.value;me(Ze===""?null:Number(Ze))},onClick:ke=>ke.stopPropagation(),onKeyDown:ke=>ke.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:ae??"",onChange:ke=>{const Ze=ke.target.value;ye(Ze===""?null:Number(Ze))},onClick:ke=>ke.stopPropagation(),onKeyDown:ke=>ke.stopPropagation()})]}),P&&Object.keys(P).length>0&&p.jsxs(p.Fragment,{children:[p.jsx(ul,{}),p.jsx(H1,{className:"text-[10px] text-muted-foreground",children:"Filter by Tag"}),Object.entries(P).map(([ke,Ze])=>{var Ne;return p.jsxs(pce,{children:[p.jsxs(mce,{className:"text-xs",children:[ke,(Ne=re[ke])!=null&&Ne.length?p.jsxs("span",{className:"ml-1 text-[10px] text-muted-foreground",children:["(",re[ke].length,")"]}):null]}),p.jsx(gce,{className:"max-h-[300px] overflow-y-auto",children:Ze.map(Ke=>p.jsx(pi,{checked:(re[ke]??[]).includes(Ke),onCheckedChange:()=>Ee(ke,Ke),children:Ke},Ke))})]},ke)})]})]})]}),I]})]}),(X||V||ie!==null||ae!==null||Ge)&&p.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[X&&p.jsx(Vf,{label:"Ignore Outliers",onRemove:()=>oe(!1)}),V&&p.jsx(Vf,{label:"Ignore First Step",onRemove:()=>fe(!1)}),ie!==null&&p.jsx(Vf,{label:`Min Y: ${ie}`,onRemove:()=>me(null)}),ae!==null&&p.jsx(Vf,{label:`Max Y: ${ae}`,onRemove:()=>ye(null)}),Object.entries(re).map(([ke,Ze])=>Ze.map(Ne=>p.jsx(Vf,{label:`${ke}: ${Ne}`,onRemove:()=>Ee(ke,Ne)},`${ke}:${Ne}`)))]})]}),Se?p.jsxs("div",{className:"flex-1 min-h-0 relative bg-white rounded",ref:R,onMouseLeave:tt,children:[p.jsx("div",{ref:F,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"}}),te&&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:le?"Loading...":"No data"})]})}const ng=["mean","std","min","max"],rg={mean:"Mean",std:"Std",min:"Min",max:"Max"};function S2(){return Math.random().toString(36).slice(2,10)}function e1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function v$(t,e,n){const r=[];for(const[i,s]of Object.entries(t)){const o=e1(i);for(const[a,l]of Object.entries(s)){const c=a?e1(a):void 0;for(const d of l)r.push({section:o,group:c,metricKey:d,label:e1(d),plotType:"step_metric",simple:!0})}}for(const i of ng)r.push({section:"Reward",metricKey:`reward_sum_${i}`,label:`Reward ${rg[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=e1(i);for(const o of ng)r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_${o}`,label:`${s} ${rg[o]}`,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 ng)r.push({section:"Advantage",metricKey:`advantage_${i}`,label:`Advantage ${rg[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 o of i.available_rollout_metric_names){const a=e1(o);for(const l of ng)r.push({section:"Evals",group:`${s} / ${a}`,metricKey:`reward_${o}_${l}`,label:`${s} ${a} ${rg[l]}`,plotType:"eval_metric",evalName:s})}for(const o of["length_completion","length_prompt","length_sum"]){const a=o==="length_completion"?"Tokens Completion":o==="length_prompt"?"Tokens Prompt":"Tokens Total";for(const l of ng)r.push({section:"Evals",group:`${s} / ${a}`,metricKey:`${o}_${l}`,label:`${s} ${a} ${rg[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 o of ng)r.push({section:"Rollouts",group:s,metricKey:`${i}_${o}`,label:`${s} ${rg[o]}`,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 o of ng)r.push({section:"Discarded Rollouts",group:s,metricKey:`${i}_${o}`,label:`${s} ${rg[o]}`,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(`${Rr}/custom-metrics-layout`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:t})})}function w2({open:t,onOpenChange:e,title:n,existingNames:r,initialValue:i="",onSubmit:s}){const[o,a]=T.useState(i),[l,c]=T.useState(""),d=T.useRef(null),h=v=>{v&&(a(i),c(""),setTimeout(()=>{var b;return(b=d.current)==null?void 0:b.focus()},50)),e(v)},g=()=>{const v=o.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(qf,{open:t,onOpenChange:h,children:p.jsxs(Xf,{className:"sm:max-w-[340px]",children:[p.jsx(Fd,{children:p.jsx(Ud,{children:n})}),p.jsxs("div",{className:"space-y-2",children:[p.jsx(V0,{ref:d,value:o,onChange:v=>{a(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(g8,{children:p.jsx(Tn,{size:"sm",onClick:g,children:i?"Rename":"Create"})})]})})}function mO(t){return`${t.plotType}|${t.evalName||""}|${t.metricKey}`}function Z1({catalog:t,onSelect:e,existingPlots:n,children:r}){const i=T.useMemo(()=>new Set((n??[]).map(mO)),[n]),[s,o]=T.useState(!1),[a,l]=T.useState(""),c=T.useMemo(()=>{const d=a.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,a]);return p.jsxs(oT,{open:s,onOpenChange:o,children:[p.jsx(aT,{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(V0,{value:a,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:Nt("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),o(!1),l(""))},children:g.label},`${g.plotType}-${g.evalName||""}-${g.metricKey}`)})]},`${d.section}-${h.group}`))]},d.section))]})]})]})}function x$({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 Z8({plot:t,onRemove:e,chartProps:n}){const{attributes:r,listeners:i,setNodeRef:s,transform:o,transition:a,isDragging:l}=P8({id:t.id}),c={transform:o?`translate3d(${Math.round(o.x)}px, ${Math.round(o.y)}px, 0)`:void 0,transition:a,opacity:l?.4:1,position:"relative",zIndex:l?50:void 0},d=t.label||e1(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(m8,{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(ed,{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(m$,{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(g$,{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(Gr,{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,availableSampleTags:n.availableSampleTags,headerPrefix:h,headerSuffix:g})})}function c0e({group:t,catalog:e,groupNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[o,a]=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}=P8({id:t.id}),N={transform:W1.Transform.toString(S),transition:E,opacity:A?.4:1},I=F=>{const U={id:S2(),metricKey:F.metricKey,label:F.label,plotType:F.plotType,evalName:F.evalName,distMetricType:F.distMetricType};r({...t,plots:[...t.plots,U]})},P=F=>{r({...t,plots:t.plots.filter(U=>U.id!==F)})},L=F=>{r({...t,name:F})},R=rS(Yf(rv,{activationConstraint:{distance:5}}),Yf(nv,{coordinateGetter:lS})),O=F=>{const{active:U,over:q}=F;if(!q||U.id===q.id)return;const B=t.plots.findIndex(G=>G.id===U.id),Z=t.plots.findIndex(G=>G.id===q.id);B===-1||Z===-1||r({...t,plots:iv(t.plots,B,Z)})};return p.jsxs("div",{ref:w,style:N,children:[p.jsxs(Ki,{open:o,onOpenChange:a,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(Wr,{className:Nt("h-3.5 w-3.5 text-muted-foreground transition-transform shrink-0",!o&&"-rotate-90")}),p.jsx("h4",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:t.name})]})}),p.jsx("button",{...b,..._,className:Nt("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(m8,{className:"h-3.5 w-3.5 text-muted-foreground"})}),p.jsxs("div",{className:Nt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[p.jsx(Z1,{catalog:e,onSelect:I,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(sp,{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(pG,{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(ed,{className:"h-3 w-3 text-muted-foreground"})})]})]}),p.jsx(Qi,{children:p.jsx(oS,{sensors:R,collisionDetection:iS,onDragEnd:O,children:p.jsx(aS,{items:t.plots.map(F=>F.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(F=>p.jsx(Z8,{plot:F,onRemove:()=>P(F.id),chartProps:s},F.id)),t.plots.length===0&&p.jsx(Z1,{catalog:e,onSelect:I,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(sp,{className:"h-3.5 w-3.5"}),"Add a plot"]})})]})})})})]}),p.jsx(w2,{open:d,onOpenChange:h,title:"Rename Group",existingNames:n.filter(F=>F!==t.name),onSubmit:L,initialValue:t.name}),p.jsx(x$,{open:g,onOpenChange:v,title:"Delete Group",description:`Delete "${t.name}" and all its plots?`,onConfirm:i})]})}function u0e({section:t,catalog:e,allSectionNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[o,a]=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:I}=P8({id:t.id}),P={transform:W1.Transform.toString(A),transition:N,opacity:I?.4:1},L=t.groups.map(Y=>Y.name),R=Y=>{const J={id:S2(),name:Y,plots:[]};r({...t,groups:[...t.groups,J]})},O=(Y,J)=>{r({...t,groups:t.groups.map(H=>H.id===Y?J:H)})},F=Y=>{r({...t,groups:t.groups.filter(J=>J.id!==Y)})},U=Y=>{const J={id:S2(),metricKey:Y.metricKey,label:Y.label,plotType:Y.plotType,evalName:Y.evalName,distMetricType:Y.distMetricType};r({...t,plots:[...t.plots,J]})},q=Y=>{r({...t,plots:t.plots.filter(J=>J.id!==Y)})},B=Y=>{r({...t,name:Y})},Z=rS(Yf(rv,{activationConstraint:{distance:5}}),Yf(nv,{coordinateGetter:lS})),G=Y=>{const{active:J,over:H}=Y;if(!H||J.id===H.id)return;const z=t.groups.findIndex(V=>V.id===J.id),X=t.groups.findIndex(V=>V.id===H.id);z===-1||X===-1||r({...t,groups:iv(t.groups,z,X)})},$=rS(Yf(rv,{activationConstraint:{distance:5}}),Yf(nv,{coordinateGetter:lS})),K=Y=>{const{active:J,over:H}=Y;if(!H||J.id===H.id)return;const z=t.plots.findIndex(V=>V.id===J.id),X=t.plots.findIndex(V=>V.id===H.id);z===-1||X===-1||r({...t,plots:iv(t.plots,z,X)})};return p.jsxs("div",{ref:E,style:P,children:[p.jsxs(Ki,{open:o,onOpenChange:a,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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform shrink-0",!o&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:t.name})]})}),p.jsx("button",{...w,...S,className:Nt("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(m8,{className:"h-4 w-4 text-muted-foreground"})}),p.jsxs("div",{className:Nt("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(sp,{className:"h-3 w-3"}),"New Group"]}),p.jsx(Z1,{catalog:e,onSelect:U,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(sp,{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(pG,{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(ed,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),p.jsxs(Qi,{children:[t.plots.length>0&&p.jsx(oS,{sensors:$,collisionDetection:iS,onDragEnd:K,children:p.jsx(aS,{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(Z8,{plot:Y,onRemove:()=>q(Y.id),chartProps:s},Y.id))})})}),p.jsx(oS,{sensors:Z,collisionDetection:iS,onDragEnd:G,children:p.jsx(aS,{items:t.groups.map(Y=>Y.id),strategy:cW,children:p.jsx("div",{className:"space-y-2",children:t.groups.map(Y=>p.jsx(c0e,{group:Y,catalog:e,groupNames:L,onUpdate:J=>O(Y.id,J),onRemove:()=>F(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(sp,{className:"h-3.5 w-3.5 mr-1"}),"New Group"]}),p.jsx(Z1,{catalog:e,onSelect:U,existingPlots:t.plots,children:p.jsxs(Tn,{size:"sm",variant:"outline",children:[p.jsx(sp,{className:"h-3.5 w-3.5 mr-1"}),"New Plot"]})})]})]})]})]}),p.jsx(w2,{open:d,onOpenChange:h,title:"New Group",existingNames:L,onSubmit:R}),p.jsx(w2,{open:g,onOpenChange:v,title:"Rename Section",existingNames:n.filter(Y=>Y!==t.name),onSubmit:B,initialValue:t.name}),p.jsx(x$,{open:b,onOpenChange:_,title:"Delete Section",description:`Delete "${t.name}" and all its groups and plots?`,onConfirm:i})]})}function d0e({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,availableRewardNames:s,customMetricSections:o,xAxisMode:a,scrollRoot:l,maxStep:c,maxTime:d,evalsList:h,newSectionTrigger:g,availableSampleTags:v}){var ve,ge,Te,He,pe,qe,xt,nt,tt,Fe,we,ke,Ze,Ne,Ke,it,ht,Je,$e,Ae;const b=py(),{data:_,isLoading:w}=jG(),[S,E]=T.useState({sections:[]}),[A,N]=T.useState(!1),[I,P]=T.useState(!1);!I&&_&&(P(!0),_.layout&&E(_.layout));const[L,R]=T.useState(g);g!==L&&(R(g),N(!0));const O=T.useRef(null),F=T.useRef(null),U=T.useCallback(Oe=>{E(Oe),b.setQueryData(["custom-metrics-layout"],{layout:Oe}),F.current=Oe,O.current&&clearTimeout(O.current),O.current=setTimeout(async()=>{F.current&&(await pO(F.current),F.current=null)},500)},[b]);T.useEffect(()=>()=>{O.current&&clearTimeout(O.current),F.current&&(pO(F.current),F.current=null)},[]);const q=T.useMemo(()=>v$(o,s,h),[o,s,h]),B=a==="time",Z=zr(((ve=t[0])==null?void 0:ve.runPath)||"",B&&!!t[0],e),G=zr(((ge=t[1])==null?void 0:ge.runPath)||"",B&&!!t[1],e),$=zr(((Te=t[2])==null?void 0:Te.runPath)||"",B&&!!t[2],e),K=zr(((He=t[3])==null?void 0:He.runPath)||"",B&&!!t[3],e),Y=zr(((pe=t[4])==null?void 0:pe.runPath)||"",B&&!!t[4],e),J=zr(((qe=t[5])==null?void 0:qe.runPath)||"",B&&!!t[5],e),H=zr(((xt=t[6])==null?void 0:xt.runPath)||"",B&&!!t[6],e),z=zr(((nt=t[7])==null?void 0:nt.runPath)||"",B&&!!t[7],e),X=zr(((tt=t[8])==null?void 0:tt.runPath)||"",B&&!!t[8],e),V=zr(((Fe=t[9])==null?void 0:Fe.runPath)||"",B&&!!t[9],e),ie=zr(((we=t[10])==null?void 0:we.runPath)||"",B&&!!t[10],e),ae=zr(((ke=t[11])==null?void 0:ke.runPath)||"",B&&!!t[11],e),re=zr(((Ze=t[12])==null?void 0:Ze.runPath)||"",B&&!!t[12],e),ce=zr(((Ne=t[13])==null?void 0:Ne.runPath)||"",B&&!!t[13],e),oe=zr(((Ke=t[14])==null?void 0:Ke.runPath)||"",B&&!!t[14],e),fe=zr(((it=t[15])==null?void 0:it.runPath)||"",B&&!!t[15],e),me=zr(((ht=t[16])==null?void 0:ht.runPath)||"",B&&!!t[16],e),ye=zr(((Je=t[17])==null?void 0:Je.runPath)||"",B&&!!t[17],e),Ee=zr((($e=t[18])==null?void 0:$e.runPath)||"",B&&!!t[18],e),Ge=zr(((Ae=t[19])==null?void 0:Ae.runPath)||"",B&&!!t[19],e),_e=T.useMemo(()=>[Z,G,$,K,Y,J,H,z,X,V,ie,ae,re,ce,oe,fe,me,ye,Ee,Ge],[Z,G,$,K,Y,J,H,z,X,V,ie,ae,re,ce,oe,fe,me,ye,Ee,Ge]),{isStepTimesFetching:De,isStepTimesRefetching:he}=T.useMemo(()=>{if(!B)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const Oe=_e.some(Rt=>Rt.isFetching),Ye=_e.filter(Rt=>Rt.isFetching),st=Oe&&Ye.length>0&&Ye.every(Rt=>!!Rt.data);return{isStepTimesFetching:Oe,isStepTimesRefetching:st}},[B,_e]),{stepTimesByRun:Le,firstStepTimesByRun:ne}=T.useMemo(()=>{if(!B)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const Oe=new Map,Ye=new Map;return t.forEach((st,Rt)=>{if(Rt>=20)return;const Tt=_e[Rt].data;if(!Tt||Tt.first_step_time===null||Tt.first_step_time===void 0||!Tt.step_times||Tt.step_times.length===0)return;const Et=new Map;Tt.step_times.forEach(Dt=>{typeof Dt.time=="number"&&Et.set(Dt.step,Dt.time)}),Et.size>0&&(Oe.set(st.runPath,Et),Ye.set(st.runPath,Tt.first_step_time))}),{stepTimesByRun:Oe,firstStepTimesByRun:Ye}},[t,B,_e]),We=T.useMemo(()=>({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,xAxisMode:a,scrollRoot:l,maxStep:c,maxTime:d,stepTimesByRun:Le,firstStepTimesByRun:ne,isStepTimesFetching:De,isStepTimesRefetching:he,availableSampleTags:v}),[t,e,n,r,i,a,l,c,d,Le,ne,De,he,v]),je=S.sections.map(Oe=>Oe.name),be=Oe=>{const Ye={id:S2(),name:Oe,groups:[],plots:[]};U({sections:[...S.sections,Ye]})},Xe=(Oe,Ye)=>{U({sections:S.sections.map(st=>st.id===Oe?Ye:st)})},le=Oe=>{U({sections:S.sections.filter(Ye=>Ye.id!==Oe)})},te=rS(Yf(rv,{activationConstraint:{distance:8}}),Yf(nv,{coordinateGetter:lS})),Se=Oe=>{const{active:Ye,over:st}=Oe;if(!st||Ye.id===st.id)return;const Rt=S.sections.findIndex(Tt=>Tt.id===Ye.id),yt=S.sections.findIndex(Tt=>Tt.id===st.id);Rt===-1||yt===-1||U({sections:iv(S.sections,Rt,yt)})};return p.jsxs("div",{className:"-mt-3",children:[p.jsx(oS,{sensors:te,collisionDetection:iS,onDragEnd:Se,children:p.jsx(aS,{items:S.sections.map(Oe=>Oe.id),strategy:cW,children:S.sections.map((Oe,Ye)=>p.jsxs("div",{children:[Ye>0&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsx(u0e,{section:Oe,catalog:q,allSectionNames:je,onUpdate:st=>Xe(Oe.id,st),onRemove:()=>le(Oe.id),chartProps:We})]},Oe.id))})}),S.sections.length===0&&w&&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..."})]}),S.sections.length===0&&!w&&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:()=>N(!0),children:[p.jsx(sp,{className:"h-3.5 w-3.5 mr-1"}),"New Section"]})]}),p.jsx(w2,{open:A,onOpenChange:N,title:"New Section",existingNames:je,onSubmit:be})]})}const gO=100;function y$({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,o)=>{const a=o*i,l=(o+1)*i;let c=0;t>=l?c=1:t>a&&(c=(t-a)/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}%`}})},o)})})}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 f0e(t,e){const[n,r]=T.useState(null);if(T.useEffect(()=>{if(!t||!e)return;const o=setTimeout(()=>r(Date.now()),0),a=setInterval(()=>{r(Date.now())},1e3);return()=>{clearTimeout(o),clearInterval(a)}},[t,e]),!t||!e||n===null)return null;const i=new Date(t).getTime();return isNaN(i)?null:(n-i)/1e3}function h0e(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"),o=String(e.getMinutes()).padStart(2,"0"),a=String(e.getSeconds()).padStart(2,"0");return`${n}/${r}/${i} ${s}:${o}:${a}`}function p0e(t){const e=a=>a&&typeof a=="object"&&"value"in a?a.value:a,n=e(t.model),r=typeof n=="string"?n:null,i=e(t.environments);let s=[],o=i;if(typeof o=="string")try{o=JSON.parse(o)}catch{}return o&&typeof o=="object"&&!Array.isArray(o)?s=Object.keys(o):Array.isArray(o)&&(s=o.map(a=>typeof a=="string"?a:a&&typeof a=="object"&&"name"in a?String(a.name):String(a))),{model:r,envNames:s}}function Wb(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 m0e(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 o=Math.pow(.5,1/10),a=i.length;let l=0,c=0;for(let g=0;g<a;g++){const v=Math.pow(o,a-1-g);l+=i[g].value*v,c+=v}const d=l/c,h=n-e;return d*h}function g0e({currentStep:t,totalSteps:e,runtimeSeconds:n,estimatedSecondsToFinish:r}){const i=t>=0?t+1:0,s=e>0?i/e*100:0,o=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:[o.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(y$,{current:i,total:e,fillClassName:"bg-foreground",activeBorderClassName:"border-foreground"})]})}function v0e({groupsDone:t,totalGroups:e,step:n,waitingBuckets:r}){const i=e>0?t/e*100:0,s=Math.min(i,100),o=(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})`:"",o>0&&p.jsxs("span",{className:"ml-2 font-normal",children:["· ",o," batch",o!==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(y$,{current:t,total:e,fillClassName:"bg-muted-foreground/40"})]})}function x0e(){var Le,ne,We,je,be,Xe,le,te,Se,ve,ge;const t=Pi(ml),e=Pi(cT),n=Pi(fT),r=jd(bG),i=jd(_G),[s,o]=T.useState(!0),[a,l]=T.useState(!0),[c,d]=T.useState(0),[h,g]=T.useState(0),[v,b]=un(Ece),[_,w]=un(Cce),[S,E]=T.useState(String(_)),[A,N]=un(Ace),[I,P]=un(SG),[L,R]=un(Rce),O=A?n:null,{data:F,isLoading:U,error:q}=td(t||"",!!t,!0),{data:B}=fm(),Z=T.useMemo(()=>{const Te=(B==null?void 0:B.runs)||[],He=new Set(e);return t&&He.add(t),Te.filter(pe=>He.has(pe.run_id)).map(pe=>({runPath:pe.run_id,runName:pe.name,color:pe.color,isSelected:pe.run_id===t}))},[t,e,B==null?void 0:B.runs]);T.useEffect(()=>{F&&(r(F.is_tracking),i(F.is_syncing))},[F,r,i]);const G=typeof((Le=F==null?void 0:F.config)==null?void 0:Le.number_of_steps)=="number"?F.config.number_of_steps:null,$=typeof((ne=F==null?void 0:F.config)==null?void 0:ne.prompts_batch_size_for_trainer)=="number"?F.config.prompts_batch_size_for_trainer:typeof((We=F==null?void 0:F.config)==null?void 0:We.batch_size_for_trainer)=="number"?F.config.batch_size_for_trainer:null,K=(je=F==null?void 0:F.summary)!=null&&je.steps&&typeof F.summary.steps=="object"?F.summary.steps:null,Y=Wb((be=F==null?void 0:F.summary)==null?void 0:be["steps/last_training_step"])??Wb(K==null?void 0:K.last_training_step)??Wb((Xe=F==null?void 0:F.trainer_info)==null?void 0:Xe.last_training_step)??Wb((le=F==null?void 0:F.rollout_info)==null?void 0:le.last_training_step)??Wb(F==null?void 0:F.last_rollout_step)??-1,J=F==null?void 0:F.trainer_bucket_info,H=((te=F==null?void 0:F.step_metrics_info)==null?void 0:te.local_steps)??0,z=((Se=F==null?void 0:F.step_metrics_info)==null?void 0:Se.custom_metric_sections)??{},X=(F==null?void 0:F.available_rollout_metric_names)??[],V=((ve=F==null?void 0:F.eval_info)==null?void 0:ve.evals)??[],ie=T.useMemo(()=>v$(z,X,V),[z,X,V]),ae=T.useMemo(()=>{if(A)return Z;const Te=Z.find(He=>He.isSelected);return Te?[Te]:Z.slice(0,1)},[A,Z]),re=rS(Yf(rv,{activationConstraint:{distance:5}}),Yf(nv,{coordinateGetter:lS})),ce=T.useCallback(Te=>{const{active:He,over:pe}=Te;!pe||He.id===pe.id||R(qe=>{const xt=qe.findIndex(tt=>tt.id===He.id),nt=qe.findIndex(tt=>tt.id===pe.id);return xt===-1||nt===-1?qe:iv(qe,xt,nt)})},[R]),oe=(F==null?void 0:F.available_sample_tags)??{},fe=T.useMemo(()=>({runs:ae,shouldPoll:!0,showEma:v,emaSpan:_,hoveredRunId:O,xAxisMode:"step",scrollRoot:null,availableSampleTags:oe}),[ae,v,_,O,oe]),me=T.useMemo(()=>!t||!(B!=null&&B.runs)?null:B.runs.find(Te=>Te.run_id===t)??null,[t,B]),ye=((ge=me==null?void 0:me.state)==null?void 0:ge.toLowerCase())==="running",Ee=f0e((me==null?void 0:me.created_at)??null,ye),Ge=T.useMemo(()=>{var pe,qe,xt;if(ye)return null;const Te=(pe=F==null?void 0:F.summary)==null?void 0:pe._runtime;if(typeof Te=="number")return Te;const He=(xt=(qe=F==null?void 0:F.summary)==null?void 0:qe._wandb)==null?void 0:xt.runtime;return typeof He=="number"?He:null},[ye,F==null?void 0:F.summary]),_e=ye?Ee:Ge,{data:De}=LG(t||"","timing_step_total",!!t&&!!G&&Y>0,!0),he=T.useMemo(()=>{if(!(De!=null&&De.metrics)||!G||Y<=0)return null;const Te=De.metrics.filter(qe=>qe.metric_name==="timing_step_total").map(qe=>({step:qe.step,value:qe.value}));if(Te.length===0)return null;const He=Math.min(...Te.map(qe=>qe.step)),pe=Te.filter(qe=>qe.step!==He);return m0e(pe,Y,G)},[De,G,Y]);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:me&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:me.color}}),p.jsx("span",{className:"text-sm font-semibold truncate",children:me.name||me.run_id.split("/").pop()}),p.jsx("span",{className:"text-sm text-muted-foreground truncate",children:me.run_id}),me.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 ",h0e(me.created_at)]})]})]})})})}),p.jsx("div",{className:I?"flex-1 min-h-0 overflow-hidden":"flex-1 overflow-auto p-6",children:I?p.jsx(nhe,{runPath:t,onBack:()=>P(!1)},t):p.jsxs("div",{className:"max-w-7xl mx-auto space-y-6",children:[U?p.jsxs("div",{className:"space-y-3",children:[p.jsx(Qh,{className:"h-4 w-32"}),p.jsx(Qh,{className:"h-8 w-64"}),p.jsx(Qh,{className:"h-8 w-full"})]}):q?p.jsx($u,{className:"border-destructive",children:p.jsx(th,{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:[G!==null?p.jsx(g0e,{currentStep:Y,totalSteps:G,runtimeSeconds:_e??null,estimatedSecondsToFinish:he}):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…"})})]}),$!==null&&J&&p.jsx(v0e,{groupsDone:J.groups_done,totalGroups:$,step:J.step,waitingBuckets:F==null?void 0:F.waiting_buckets})]}),H>0&&Z.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:()=>o(!1),children:"Hide Plots"}),p.jsx(cS,{label:"EMA",variant:"selecting",size:"sm",enabled:v,onEnabledChange:b,value:S,onValueChange:E,onValueCommit:Te=>{const He=parseInt(Te,10);!isNaN(He)&&He>=2&&He<=100?(w(He),E(He.toString())):E(_.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),p.jsx(p1,{variant:"selecting",size:"sm",pressed:A,onPressedChange:N,className:"text-xs px-2",children:"All selected runs"}),p.jsx(Z1,{catalog:ie,existingPlots:L,onSelect:Te=>{const He=Math.random().toString(36).slice(2,10);R(pe=>[...pe,{id:He,metricKey:Te.metricKey,label:Te.label,plotType:Te.plotType,evalName:Te.evalName}])},children:p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Plots"})})]}),p.jsx(oS,{sensors:re,collisionDetection:iS,onDragEnd:ce,children:p.jsx(aS,{items:L.map(Te=>Te.id),strategy:uw,children:p.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:L.map(Te=>p.jsx(Z8,{plot:Te,onRemove:()=>R(He=>He.filter(pe=>pe.id!==Te.id)),chartProps:fe},Te.id))})})})]}):p.jsxs("button",{onClick:()=>o(!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"})]})}),(F==null?void 0:F.config)&&(()=>{const{model:Te,envNames:He}=p0e(F.config);return!Te&&He.length===0?null:p.jsxs("div",{className:"flex items-center gap-3 text-sm mb-4",children:[Te&&p.jsx("span",{className:"font-semibold",children:Te}),He.map(pe=>p.jsx("span",{className:"text-muted-foreground",children:pe},pe))]})})(),(F==null?void 0:F.config)&&Object.keys(F.config).length>0&&p.jsx("div",{children:a?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"}),p.jsx(Ufe,{currentRunId:t,currentConfig:F.config}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{d(Te=>Te+1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{g(Te=>Te+1)},children:"Expand All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>P(!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(HG,{config:F.config,collapseAllSignal:c,expandAllSignal:h})]}):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(hm,{description:"Select a run from the sidebar or add a new one to get started."})}const d4=gT;function y0e(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),o=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10),l=s*3600+o*60+a;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function b0e(){var ae;const[t,e]=T.useState(null),n=T.useRef(0),[r,i]=un(zce),s=Pi(ml),o=Pi(cT),a=Pi(fT),[l,c]=un(jce),[d,h]=T.useState(0),[g,v]=un(kce),[b,_]=un(Pce),[w,S]=T.useState(b.toString()),[E,A]=un(Dce),[N,I]=un(Ice),[P,L]=un(Oce),[R,O]=un(Lce),[F,U]=T.useState(P.toString()),[q,B]=T.useState(d4(R));T.useEffect(()=>{U(P.toString())},[P]),T.useEffect(()=>{B(d4(R))},[R]),jG();const Z=!0;T.useEffect(()=>{t&&(t.scrollTop=r,n.current=r)},[t]),T.useEffect(()=>{if(!t)return;const re=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",re,{passive:!0}),()=>{t.removeEventListener("scroll",re),i(n.current)}},[t]);const{data:G}=fm(),$=T.useMemo(()=>{const re=(G==null?void 0:G.runs)||[],ce=new Set(o);return s&&ce.add(s),re.filter(oe=>ce.has(oe.run_id)).map(oe=>({runPath:oe.run_id,runName:oe.name,color:oe.color,isSelected:oe.run_id===s}))},[s,o,G==null?void 0:G.runs]),{data:K,error:Y}=td(s||"",!!s,Z),J=K==null?void 0:K.step_metrics_info,H=(J==null?void 0:J.local_steps)??0,z=(K==null?void 0:K.available_rollout_metric_names)??[],X=(J==null?void 0:J.custom_metric_sections)??{},V=((ae=K==null?void 0:K.eval_info)==null?void 0:ae.evals)??[],ie=(K==null?void 0:K.available_sample_tags)??{};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(sv,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:re=>{re&&c(re)},children:[p.jsx(Ul,{value:"all",className:"text-xs px-2 py-1 h-7",children:"All"}),p.jsx(Ul,{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(re=>re+1),children:[p.jsx(sp,{className:"h-3 w-3 mr-1"}),"New Section"]}),p.jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),p.jsxs(sv,{type:"single",variant:"outline",size:"sm",value:E,onValueChange:re=>{re&&A(re)},children:[p.jsx(Ul,{value:"step",className:"text-xs px-2 py-1 h-7",children:"Step"}),p.jsx(Ul,{value:"time",className:"text-xs px-2 py-1 h-7",children:"Time"})]}),p.jsx(cS,{label:"EMA",variant:"selecting",size:"sm",enabled:g,onEnabledChange:v,value:w,onValueChange:S,onValueCommit:re=>{const ce=parseInt(re,10);!isNaN(ce)&&ce>=2&&ce<=100?(_(ce),S(ce.toString())):S(b.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),p.jsx(cS,{label:E==="step"?"Max Step":"Max Time",variant:"selecting",size:"sm",enabled:N,onEnabledChange:I,value:E==="step"?F:q,inputType:E==="step"?"number":"text",onValueChange:re=>{E==="step"?U(re):B(re)},onValueCommit:re=>{if(E==="step"){const ce=parseInt(re,10);!isNaN(ce)&&ce>=1?(L(ce),U(ce.toString())):U(P.toString())}else{const ce=y0e(re);ce!==null?(O(ce),B(d4(ce))):B(d4(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(th,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",Y instanceof Error?Y.message:"Unknown error"]})})}),l==="all"?p.jsx(s0e,{runs:$,shouldPoll:Z,totalSteps:H,showEma:g,emaSpan:b,hoveredRunId:a,availableRewardNames:z,customMetricSections:X,xAxisMode:E,scrollRoot:t,maxStep:N&&E==="step"?P:void 0,maxTime:N&&E==="time"?R:void 0,evalsList:V,availableSampleTags:ie}):p.jsx(d0e,{runs:$,shouldPoll:Z,showEma:g,emaSpan:b,hoveredRunId:a,availableRewardNames:z,customMetricSections:X,xAxisMode:E,scrollRoot:t,maxStep:N&&E==="step"?P:void 0,maxTime:N&&E==="time"?R:void 0,evalsList:V,availableSampleTags:ie,newSectionTrigger:d})]})})]}):p.jsx(hm,{description:"Select a run from the sidebar to view training metrics."})}function Q8({...t}){return p.jsx(Loe,{"data-slot":"select",...t})}function J8({...t}){return p.jsx(joe,{"data-slot":"select-value",...t})}function ek({className:t,size:e="default",children:n,...r}){return p.jsxs(zoe,{"data-slot":"select-trigger","data-size":e,className:Nt("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(Foe,{asChild:!0,children:p.jsx(Wr,{className:"text-muted-foreground size-4 pointer-events-none"})})]})}function tk({className:t,children:e,position:n="item-aligned",align:r="center",...i}){return p.jsx(Uoe,{children:p.jsxs(Boe,{"data-slot":"select-content",className:Nt("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(_0e,{}),p.jsx(Hoe,{"data-position":n,className:Nt("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(S0e,{})]})})}function nk({className:t,children:e,...n}){return p.jsxs(Voe,{"data-slot":"select-item",className:Nt("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(Woe,{children:p.jsx(yv,{className:"pointer-events-none"})})}),p.jsx(Goe,{children:e})]})}function _0e({className:t,...e}){return p.jsx($oe,{"data-slot":"select-scroll-up-button",className:Nt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:p.jsx(p8,{})})}function S0e({className:t,...e}){return p.jsx(qoe,{"data-slot":"select-scroll-down-button",className:Nt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:p.jsx(Wr,{})})}const f4=["#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 w0e(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 tv(t)}const M0e=28;function T0e(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,o=t[n];if(o!=null)return s(n)?n:null;let a=n-1,l=n+1;for(;a>=0||l<t.length;){const c=a>=0?t[a]: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[a])-i),_=Math.abs(Number(e[l])-i)<v?l:a;return s(_)?_:null}if(h)return s(a)?a:null;if(g)return s(l)?l:null;a-=1,l+=1}return null}function E0e(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)]),o=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),a=o-s,l=6;return{lower:s-l*a,upper:o+l*a}}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(ed,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function h4(t){return typeof t=="number"&&Number.isFinite(t)}function C0e(t,e){if(t.startsWith("#")){const i=t.slice(1),s=i.length===3?i.split("").map(o=>o+o).join(""):i;if(s.length===6){const o=Number.parseInt(s.slice(0,2),16),a=Number.parseInt(s.slice(2,4),16),l=Number.parseInt(s.slice(4,6),16);return`rgba(${o}, ${a}, ${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 b$({metricName:t,data:e,gpuIndices:n,intervalStart:r,intervalEnd:i,variant:s="default",strokeColor:o,gpuDisplayNames:a,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,I]=T.useState(!1),[P,L]=T.useState(null),[R,O]=T.useState(null),F=NT[t]||{label:t.replace(/_/g," "),unit:""},U=s==="timeline",q=b==="clock"&&_==="bounds",B=T.useMemo(()=>{if(c==="node_gpu"){const V=new Map,ie=[...e].sort((ae,re)=>{const ce=h4(ae.node_id)?ae.node_id:Number.MAX_SAFE_INTEGER,oe=h4(re.node_id)?re.node_id:Number.MAX_SAFE_INTEGER;return ce!==oe?ce-oe:ae.gpu_index-re.gpu_index});for(const ae of ie){const re=h4(ae.node_id)?ae.node_id:null,ce=`${re??"?"}:${ae.gpu_index}`;if(V.has(ce))continue;const oe=re===null?"Node ?":`Node ${re}`,fe=V.size;V.set(ce,{key:ce,label:`${oe} GPU ${ae.gpu_index}`,stroke:o||f4[fe%f4.length],gpuIndex:ae.gpu_index,nodeId:re})}return Array.from(V.values())}return(n.length>0?Array.from(new Set(n)).sort((V,ie)=>V-ie):Array.from(new Set(e.map(V=>V.gpu_index))).sort((V,ie)=>V-ie)).map(V=>({key:`gpu:${V}`,label:(a==null?void 0:a[V])??`GPU ${V}`,stroke:o||f4[V%f4.length],gpuIndex:V,nodeId:null}))},[c,e,n,a,o]),Z=T.useMemo(()=>new Set(B.map(X=>X.key)),[B]),{uplotData:G,seriesConfig:$,hasData:K,outlierBounds:Y}=T.useMemo(()=>{if(e.length===0||B.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const X={},V=new Set,ie=[];for(const fe of e){const me=c==="node_gpu"?`${h4(fe.node_id)?fe.node_id:"?"}:${fe.gpu_index}`:`gpu:${fe.gpu_index}`;Z.has(me)&&(V.add(fe.timestamp),X[fe.timestamp]||(X[fe.timestamp]={}),X[fe.timestamp][me]=fe.value,ie.push(fe.value))}const ae=Array.from(V).sort((fe,me)=>fe-me);if(ae.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const re=ae.map(fe=>fe-r),ce=[{label:"Time"}],oe=[re];for(const fe of B){const me=ae.map(Ee=>{var Ge;return((Ge=X[Ee])==null?void 0:Ge[fe.key])??null}),ye=g!==null&&g.size>0&&!g.has(fe.key);oe.push(me),ce.push({label:fe.label,stroke:ye?C0e(fe.stroke,.25):fe.stroke,width:ye?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:oe,seriesConfig:ce,hasData:!0,outlierBounds:E0e(ie)}},[e,r,B,c,Z,g]),J=d??(!U&&B.length>1),H=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||!G||!K)return;const X=S.current,V=X.clientWidth,ie=192;let ae=Number.POSITIVE_INFINITY,re=Number.NEGATIVE_INFINITY;for(let ne=1;ne<G.length;ne+=1){const We=G[ne];for(let je=0;je<We.length;je+=1){const be=We[je];be!=null&&(N&&Y?be>=Y.lower&&be<=Y.upper&&(be<ae&&(ae=be),be>re&&(re=be)):(be<ae&&(ae=be),be>re&&(re=be)))}}ae===Number.POSITIVE_INFINITY&&Y&&(ae=Y.lower,re=Y.upper);const ce=re-ae,oe=Math.max(Math.abs(re),Math.abs(ae)),fe=Math.max(oe*.05,1e-10),me=Math.max(ce*.1,fe),ye=[P!==null?P:Math.max(0,ae-me),R!==null?R:re+me],Ee="rgba(128, 128, 128, 0.15)",Ge="rgba(100, 100, 100, 0.9)",De={width:V,height:ie,padding:U?[0,0,0,0]:q?[4,24,0,4]:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!U,y:!1}},legend:{show:J},...U?{}:{select:{show:!0,left:0,top:0,width:0,height:0}},scales:{x:{time:!1,range:(ne,We,je)=>{const be=i-r;return be>0?[0,be]:[We,je]}},y:{range:ye}},axes:U?[{show:!1,size:0},{show:!1,size:0}]:[{stroke:Ge,grid:{stroke:Ee,width:1},ticks:{stroke:Ee,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:_==="bounds"?(ne,We,je,be)=>[je,be]:void 0,values:(ne,We)=>We.map(je=>b==="clock"?X0(r+Number(je),i-r):tv(Number(je)+v))},{stroke:Ge,grid:{stroke:Ee,width:1},ticks:{stroke:Ee,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(ne,We)=>{if(!We||We.length===0)return 40;const je=Math.max(...We.map(be=>be.length));return Math.max(40,je*7+14)},values:(ne,We)=>We.map(H)}],series:$,hooks:{setCursor:[ne=>{if(!A.current||!S.current)return;const{left:We,idx:je}=ne.cursor;if(je==null||We===void 0||We<0){A.current.style.display="none";return}const be=G[0][je];if(be===void 0){A.current.style.display="none";return}const Xe=G[0],le=(()=>{const Fe=ne.scales.x,we=Number(Fe.min),ke=Number(Fe.max);if(!Number.isFinite(we)||!Number.isFinite(ke))return null;const Ze=Math.abs(ke-we);if(Ze<=0)return null;const Ne=Math.max(1,ne.bbox.width);return Ze*M0e/Ne})(),te=w0e(Number(be)+v),Se=r+Number(be),ve=X0(Se,i-r);let ge="";U||(ge+=`<div class="font-medium mb-1">${ve}</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: ${Se.toFixed(3)}</div>`);const Te=[];for(let Fe=0;Fe<B.length;Fe+=1){const we=B[Fe],ke=G[Fe+1],Ze=T0e(ke,Xe,je,le);if(Ze===null)continue;const Ne=ke==null?void 0:ke[Ze];Ne!=null&&Te.push({entry:we,formatted:Xu(Ne),role:(h==null?void 0:h[we.key])??null})}const He=Te.length>0;if(Te.some(Fe=>Fe.role!==null)&&!U){const Fe={Trainer:0,Inference:1},we=[];for(const ke of Te){const Ze=ke.role??"Other";we.includes(Ze)||we.push(Ze)}we.sort((ke,Ze)=>(Fe[ke]??99)-(Fe[Ze]??99));for(const ke of we){ge+=`<div class="text-[10px] font-medium text-muted-foreground mt-1 mb-0.5">${ke}</div>`;for(const Ze of Te)(Ze.role??"Other")===ke&&(ge+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Ze.entry.stroke}"></div>
                      <span class="text-muted-foreground">${Ze.entry.label}:</span>
                      <span class="font-medium">${Ze.formatted} ${F.unit}</span>
                    </div>
                  `)}}else for(const Fe of Te)U?ge+=`
                    <div class="flex items-center gap-2">
                      <span class="text-muted-foreground">${Fe.entry.label}:</span>
                      <span class="font-medium">${Fe.formatted} ${F.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: ${Fe.entry.stroke}"></div>
                      <span class="text-muted-foreground">${Fe.entry.label}:</span>
                      <span class="font-medium">${Fe.formatted} ${F.unit}</span>
                    </div>
                  `;if(!He){A.current.style.display="none";return}U&&(ge+=`<div class="text-muted-foreground mt-1">Time: ${te}</div>`),A.current.innerHTML=ge,A.current.style.display="block";const qe=S.current.getBoundingClientRect(),xt=A.current.getBoundingClientRect();let nt=qe.left+We+15;nt+xt.width+20>window.innerWidth&&(nt=qe.left+We-xt.width-15+ne.bbox.left),nt=Math.max(4,nt);let tt=qe.top-xt.height+20;tt<4&&(tt=qe.bottom-20),A.current.style.left=`${nt}px`,A.current.style.top=`${tt}px`}]}};E.current&&E.current.destroy();const he=new go(De,G,X);E.current=he;const Le=new ResizeObserver(ne=>{for(const We of ne){const{width:je}=We.contentRect;he&&je>0&&he.setSize({width:je,height:ie})}});return Le.observe(X),()=>{Le.disconnect(),he.destroy(),E.current=null}},[G,K,$,t,r,i,v,b,_,q,U,F.unit,J,B,h,H,N,Y,P,R]);const z=T.useCallback(()=>{A.current&&(A.current.style.display="none")},[]);return!K&&U?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:Nt("rounded-lg border transition-opacity",U?"overflow-hidden":"group/chart border-gray-200 p-3 bg-white",l&&"opacity-60"),children:[!U&&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:F.label}),N&&p.jsx(nA,{label:"Ignore Outliers",onRemove:()=>I(!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(ow,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(pi,{checked:N,onCheckedChange:I,children:"Ignore Outliers"}),p.jsx(ul,{}),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 V=X.target.value;L(V===""?null:Number(V))},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 V=X.target.value;O(V===""?null:Number(V))},onClick:X=>X.stopPropagation(),onKeyDown:X=>X.stopPropagation()})]})]})]})})]}),K?p.jsxs("div",{className:"h-48 relative bg-white rounded",ref:S,onMouseLeave:z,children:[!U&&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 ${F.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 o=n.slice(i,r).trim();(o||!s)&&e.push(o),i=r+1,r=n.indexOf(",",i)}return e}function A0e(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const N0e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,R0e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,k0e={};function yO(t,e){return(k0e.jsx?R0e:N0e).test(t)}const P0e=/[ \t\n\f\r]/g;function D0e(t){return typeof t=="object"?t.type==="text"?bO(t.value):!1:bO(t)}function bO(t){return t.replace(P0e,"")===""}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 _$(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 dS(t){return t.toLowerCase()}class Nc{constructor(e,n){this.attribute=n,this.property=e}}Nc.prototype.attribute="";Nc.prototype.booleanish=!1;Nc.prototype.boolean=!1;Nc.prototype.commaOrSpaceSeparated=!1;Nc.prototype.commaSeparated=!1;Nc.prototype.defined=!1;Nc.prototype.mustUseProperty=!1;Nc.prototype.number=!1;Nc.prototype.overloadedBoolean=!1;Nc.prototype.property="";Nc.prototype.spaceSeparated=!1;Nc.prototype.space=void 0;let I0e=0;const Dr=Sv(),Bo=Sv(),dR=Sv(),an=Sv(),ds=Sv(),g1=Sv(),Gc=Sv();function Sv(){return 2**++I0e}const fR=Object.freeze(Object.defineProperty({__proto__:null,boolean:Dr,booleanish:Bo,commaOrSpaceSeparated:Gc,commaSeparated:g1,number:an,overloadedBoolean:dR,spaceSeparated:ds},Symbol.toStringTag,{value:"Module"})),rA=Object.keys(fR);class rk extends Nc{constructor(e,n,r,i){let s=-1;if(super(e,n),_O(this,"space",i),typeof r=="number")for(;++s<rA.length;){const o=rA[s];_O(this,rA[s],(r&fR[o])===fR[o])}}}rk.prototype.defined=!0;function _O(t,e,n){n&&(t[e]=n)}function Ey(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new rk(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[dS(r)]=r,n[dS(s.attribute)]=r}return new dw(e,n,t.space)}const S$=Ey({properties:{ariaActiveDescendant:null,ariaAtomic:Bo,ariaAutoComplete:null,ariaBusy:Bo,ariaChecked:Bo,ariaColCount:an,ariaColIndex:an,ariaColSpan:an,ariaControls:ds,ariaCurrent:null,ariaDescribedBy:ds,ariaDetails:null,ariaDisabled:Bo,ariaDropEffect:ds,ariaErrorMessage:null,ariaExpanded:Bo,ariaFlowTo:ds,ariaGrabbed:Bo,ariaHasPopup:null,ariaHidden:Bo,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ds,ariaLevel:an,ariaLive:null,ariaModal:Bo,ariaMultiLine:Bo,ariaMultiSelectable:Bo,ariaOrientation:null,ariaOwns:ds,ariaPlaceholder:null,ariaPosInSet:an,ariaPressed:Bo,ariaReadOnly:Bo,ariaRelevant:null,ariaRequired:Bo,ariaRoleDescription:ds,ariaRowCount:an,ariaRowIndex:an,ariaRowSpan:an,ariaSelected:Bo,ariaSetSize:an,ariaSort:null,ariaValueMax:an,ariaValueMin:an,ariaValueNow:an,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function w$(t,e){return e in t?t[e]:e}function M$(t,e){return w$(t,e.toLowerCase())}const O0e=Ey({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:g1,acceptCharset:ds,accessKey:ds,action:null,allow:null,allowFullScreen:Dr,allowPaymentRequest:Dr,allowUserMedia:Dr,alt:null,as:null,async:Dr,autoCapitalize:null,autoComplete:ds,autoFocus:Dr,autoPlay:Dr,blocking:ds,capture:null,charSet:null,checked:Dr,cite:null,className:ds,cols:an,colSpan:null,content:null,contentEditable:Bo,controls:Dr,controlsList:ds,coords:an|g1,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Dr,defer:Dr,dir:null,dirName:null,disabled:Dr,download:dR,draggable:Bo,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Dr,formTarget:null,headers:ds,height:an,hidden:dR,high:an,href:null,hrefLang:null,htmlFor:ds,httpEquiv:ds,id:null,imageSizes:null,imageSrcSet:null,inert:Dr,inputMode:null,integrity:null,is:null,isMap:Dr,itemId:null,itemProp:ds,itemRef:ds,itemScope:Dr,itemType:ds,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Dr,low:an,manifest:null,max:null,maxLength:an,media:null,method:null,min:null,minLength:an,multiple:Dr,muted:Dr,name:null,nonce:null,noModule:Dr,noValidate:Dr,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:Dr,optimum:an,pattern:null,ping:ds,placeholder:null,playsInline:Dr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Dr,referrerPolicy:null,rel:ds,required:Dr,reversed:Dr,rows:an,rowSpan:an,sandbox:ds,scope:null,scoped:Dr,seamless:Dr,selected:Dr,shadowRootClonable:Dr,shadowRootDelegatesFocus:Dr,shadowRootMode:null,shape:null,size:an,sizes:null,slot:null,span:an,spellCheck:Bo,src:null,srcDoc:null,srcLang:null,srcSet:null,start:an,step:null,style:null,tabIndex:an,target:null,title:null,translate:null,type:null,typeMustMatch:Dr,useMap:null,value:Bo,width:an,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ds,axis:null,background:null,bgColor:null,border:an,borderColor:null,bottomMargin:an,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Dr,declare:Dr,event:null,face:null,frame:null,frameBorder:null,hSpace:an,leftMargin:an,link:null,longDesc:null,lowSrc:null,marginHeight:an,marginWidth:an,noResize:Dr,noHref:Dr,noShade:Dr,noWrap:Dr,object:null,profile:null,prompt:null,rev:null,rightMargin:an,rules:null,scheme:null,scrolling:Bo,standby:null,summary:null,text:null,topMargin:an,valueType:null,version:null,vAlign:null,vLink:null,vSpace:an,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Dr,disableRemotePlayback:Dr,prefix:null,property:null,results:an,security:null,unselectable:null},space:"html",transform:M$}),L0e=Ey({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:Gc,accentHeight:an,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:an,amplitude:an,arabicForm:null,ascent:an,attributeName:null,attributeType:null,azimuth:an,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:an,by:null,calcMode:null,capHeight:an,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:an,diffuseConstant:an,direction:null,display:null,dur:null,divisor:an,dominantBaseline:null,download:Dr,dx:null,dy:null,edgeMode:null,editable:null,elevation:an,enableBackground:null,end:null,event:null,exponent:an,externalResourcesRequired:null,fill:null,fillOpacity:an,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,g2:g1,glyphName:g1,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:an,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:an,horizOriginX:an,horizOriginY:an,id:null,ideographic:an,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:an,k:an,k1:an,k2:an,k3:an,k4:an,kernelMatrix:Gc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:an,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:an,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:an,overlineThickness:an,paintOrder:null,panose1:null,path:null,pathLength:an,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ds,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:an,pointsAtY:an,pointsAtZ:an,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Gc,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Gc,rev:Gc,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Gc,requiredFeatures:Gc,requiredFonts:Gc,requiredFormats:Gc,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:an,specularExponent:an,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:an,strikethroughThickness:an,string:null,stroke:null,strokeDashArray:Gc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:an,strokeOpacity:an,strokeWidth:null,style:null,surfaceScale:an,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Gc,tabIndex:an,tableValues:null,target:null,targetX:an,targetY:an,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Gc,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:an,underlineThickness:an,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:an,values:null,vAlphabetic:an,vMathematical:an,vectorEffect:null,vHanging:an,vIdeographic:an,version:null,vertAdvY:an,vertOriginX:an,vertOriginY:an,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:an,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:w$}),T$=Ey({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()}}),E$=Ey({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:M$}),C$=Ey({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),z0e={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"},j0e=/[A-Z]/g,SO=/-[a-z]/g,F0e=/^data[-\w.:]+$/i;function A$(t,e){const n=dS(e);let r=e,i=Nc;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&F0e.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(SO,B0e);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!SO.test(s)){let o=s.replace(j0e,U0e);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=rk}return new i(r,e)}function U0e(t){return"-"+t.toLowerCase()}function B0e(t){return t.charAt(1).toUpperCase()}const N$=_$([S$,O0e,T$,E$,C$],"html"),RT=_$([S$,L0e,T$,E$,C$],"svg");function wO(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function H0e(t){return t.join(" ").trim()}var Tx={},iA,MO;function V0e(){if(MO)return iA;MO=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\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 G=Z.match(e);G&&(E+=G.length);var $=Z.lastIndexOf(l);A=~$?Z.length-$:A+Z.length}function I(){var Z={line:E,column:A};return function(G){return G.position=new P(Z),O(),G}}function P(Z){this.start=Z,this.end={line:E,column:A},this.source=S.source}P.prototype.content=w;function L(Z){var G=new Error(S.source+":"+E+":"+A+": "+Z);if(G.reason=Z,G.filename=S.source,G.line=E,G.column=A,G.source=w,!S.silent)throw G}function R(Z){var G=Z.exec(w);if(G){var $=G[0];return N($),w=w.slice($.length),G}}function O(){R(n)}function F(Z){var G;for(Z=Z||[];G=U();)G!==!1&&Z.push(G);return Z}function U(){var Z=I();if(!(c!=w.charAt(0)||d!=w.charAt(1))){for(var G=2;h!=w.charAt(G)&&(d!=w.charAt(G)||c!=w.charAt(G+1));)++G;if(G+=2,h===w.charAt(G-1))return L("End of comment missing");var $=w.slice(2,G-2);return A+=2,N($),w=w.slice(G),A+=2,Z({type:g,comment:$})}}function q(){var Z=I(),G=R(r);if(G){if(U(),!R(i))return L("property missing ':'");var $=R(s),K=Z({type:v,property:_(G[0].replace(t,h)),value:$?_($[0].replace(t,h)):h});return R(o),K}}function B(){var Z=[];F(Z);for(var G;G=q();)G!==!1&&(Z.push(G),F(Z));return Z}return O(),B()}function _(w){return w?w.replace(a,h):h}return iA=b,iA}var TO;function G0e(){if(TO)return Tx;TO=1;var t=Tx&&Tx.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Tx,"__esModule",{value:!0}),Tx.default=n;const e=t(V0e());function n(r,i){let s=null;if(!r||typeof r!="string")return s;const o=(0,e.default)(r),a=typeof i=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:d}=l;a?i(c,d,l):d&&(s=s||{},s[c]=d)}),s}return Tx}var $b={},EO;function W0e(){if(EO)return $b;EO=1,Object.defineProperty($b,"__esModule",{value:!0}),$b.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)},o=function(c,d){return d.toUpperCase()},a=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,a):c=c.replace(r,a),c.replace(e,o))};return $b.camelCase=l,$b}var qb,CO;function $0e(){if(CO)return qb;CO=1;var t=qb&&qb.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(G0e()),n=W0e();function r(i,s){var o={};return!i||typeof i!="string"||(0,e.default)(i,function(a,l){a&&l&&(o[(0,n.camelCase)(a,s)]=l)}),o}return r.default=r,qb=r,qb}var q0e=$0e();const X0e=uy(q0e),R$=k$("end"),ik=k$("start");function k$(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 Y0e(t){const e=ik(t),n=R$(t);if(e&&n)return{start:e,end:n}}function N_(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 vl extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!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&&(o=!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 a=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=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=N_(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=o&&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}}vl.prototype.file="";vl.prototype.name="";vl.prototype.reason="";vl.prototype.message="";vl.prototype.stack="";vl.prototype.column=void 0;vl.prototype.line=void 0;vl.prototype.ancestors=void 0;vl.prototype.cause=void 0;vl.prototype.fatal=void 0;vl.prototype.place=void 0;vl.prototype.ruleId=void 0;vl.prototype.source=void 0;const sk={}.hasOwnProperty,K0e=new Map,Z0e=/[A-Z]/g,Q0e=new Set(["table","tbody","thead","tfoot","tr"]),J0e=new Set(["td","th"]),P$="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function eme(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=lme(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=ame(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:N$,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=D$(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function D$(t,e,n){if(e.type==="element")return tme(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return nme(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return ime(t,e,n);if(e.type==="mdxjsEsm")return rme(t,e);if(e.type==="root")return sme(t,e,n);if(e.type==="text")return ome(t,e)}function tme(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=O$(t,e.tagName,!1),o=cme(t,e);let a=ak(t,e);return Q0e.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!D0e(l):!0})),I$(t,o,s,e),ok(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function nme(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)}fS(t,e.position)}function rme(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);fS(t,e.position)}function ime(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:O$(t,e.name,!0),o=ume(t,e),a=ak(t,e);return I$(t,o,s,e),ok(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function sme(t,e,n){const r={};return ok(r,ak(t,e)),t.create(e,t.Fragment,r,n)}function ome(t,e){return e.value}function I$(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function ok(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function ame(t,e,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:e;return a?c(s,o,a):c(s,o)}}function lme(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=ik(r);return e(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function cme(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&sk.call(e.properties,i)){const s=dme(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&J0e.has(e.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function ume(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 o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else fS(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 a=r.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else fS(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:K0e;for(;++r<e.children.length;){const s=e.children[r];let o;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;o=l+"-"+c,i.set(l,c+1)}}const a=D$(t,s,o);a!==void 0&&n.push(a)}return n}function dme(t,e,n){const r=A$(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?A0e(n):H0e(n)),r.property==="style"){let i=typeof n=="object"?n:fme(t,String(n));return t.stylePropertyNameCase==="css"&&(i=hme(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?z0e[r.property]||r.property:r.attribute,n]}}function fme(t,e){try{return X0e(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new vl("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=P$+"#cannot-parse-style-attribute",i}}function O$(t,e,n){let r;if(!n)r={type:"Literal",value:e};else if(e.includes(".")){const i=e.split(".");let s=-1,o;for(;++s<i.length;){const a=yO(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}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 sk.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);fS(t)}function fS(t,e){const n=new vl("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=P$+"#cannot-handle-mdx-estrees-without-createevaluater",n}function hme(t){const e={};let n;for(n in t)sk.call(t,n)&&(e[pme(n)]=t[n]);return e}function pme(t){let e=t.replace(Z0e,mme);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function mme(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"]},gme={};function vme(t,e){const n=gme,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return L$(t,r,i)}function L$(t,e,n){if(xme(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]=L$(t[i],e,n);return r.join("")}function xme(t){return!!(t&&typeof t=="object")}const kO=document.createElement("i");function lk(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 sh(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function Bu(t,e){return t.length>0?(sh(t,t.length,0,e),t):e}const PO={}.hasOwnProperty;function yme(t){const e={};let n=-1;for(;++n<t.length;)bme(e,t[n]);return e}function bme(t,e){let n;for(n in e){const i=(PO.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){PO.call(i,o)||(i[o]=[]);const a=s[o];_me(i[o],Array.isArray(a)?a:a?[a]:[])}}}function _me(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);sh(t,0,0,r)}function z$(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 v1(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Gf=pm(/[A-Za-z]/),Kc=pm(/[\dA-Za-z]/),Sme=pm(/[#-'*+\--9=?A-Z^-~]/);function pR(t){return t!==null&&(t<32||t===127)}const mR=pm(/\d/),wme=pm(/[\dA-Fa-f]/),Mme=pm(/[!-/:-@[-`{-~]/);function qn(t){return t!==null&&t<-2}function Cc(t){return t!==null&&(t<0||t===32)}function ki(t){return t===-2||t===-1||t===32}const Tme=pm(new RegExp("\\p{P}|\\p{S}","u")),Eme=pm(/\s/);function pm(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Cy(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";if(s===37&&Kc(t.charCodeAt(n+1))&&Kc(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function Ui(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return ki(l)?(t.enter(n),a(l)):e(l)}function a(l){return ki(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}const Cme={tokenize:Ame};function Ame(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Ui(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return qn(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const Nme={tokenize:Rme},DO={tokenize:kme};function Rme(t){const e=this,n=[];let r=0,i,s,o;return a;function a(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 I=N,P;for(;I--;)if(e.events[I][0]==="exit"&&e.events[I][1].type==="chunkFlow"){P=e.events[I][1].end;break}S(r);let L=N;for(;L<e.events.length;)e.events[L][1].end={...P},L++;return sh(e.events,I+1,0,e.events.slice(N)),e.events.length=L,c(A)}return a(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(DO,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,o=e.now().offset,b(A)}function g(A){return e.containerState={},t.attempt(DO,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 qn(A)?(t.consume(A),w(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(A),_)}function w(A,N){const I=e.sliceStream(A);if(N&&I.push(null),A.previous=s,s&&(s.next=A),s=A,i.defineSkip(A.start),i.write(I),e.parser.lazy[A.start.line]){let P=i.events.length;for(;P--;)if(i.events[P][1].start.offset<o&&(!i.events[P][1].end||i.events[P][1].end.offset>o))return;const L=e.events.length;let R=L,O,F;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){if(O){F=e.events[R][1].end;break}O=!0}for(S(r),P=L;P<e.events.length;)e.events[P][1].end={...F},P++;sh(e.events,R+1,0,e.events.slice(L)),e.events.length=P}}function S(A){let N=n.length;for(;N-- >A;){const I=n[N];e.containerState=I[1],I[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 kme(t,e,n){return Ui(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function IO(t){if(t===null||Cc(t)||Eme(t))return 1;if(Tme(t))return 2}function ck(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:Pme,tokenize:Dme};function Pme(t,e){let n=-1,r,i,s,o,a,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),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},a={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:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=Bu(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=Bu(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=Bu(c,ck(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=Bu(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(d=2,c=Bu(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,sh(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 Dme(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=IO(r);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const c=t.exit("attentionSequence"),d=IO(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 Ime={name:"autolink",tokenize:Ome};function Ome(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 Gf(v)?(t.consume(v),o):v===64?n(v):c(v)}function o(v){return v===43||v===45||v===46||Kc(v)?(r=1,a(v)):c(v)}function a(v){return v===58?(t.consume(v),r=0,l):(v===43||v===45||v===46||Kc(v))&&r++<32?(t.consume(v),a):(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):Sme(v)?(t.consume(v),c):n(v)}function d(v){return Kc(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||Kc(v))&&r++<63){const b=v===45?g:h;return t.consume(v),b}return n(v)}}const kT={partial:!0,tokenize:Lme};function Lme(t,e,n){return r;function r(s){return ki(s)?Ui(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||qn(s)?e(s):n(s)}}const j$={continuation:{tokenize:jme},exit:Fme,name:"blockQuote",tokenize:zme};function zme(t,e,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return ki(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function jme(t,e,n){const r=this;return i;function i(o){return ki(o)?Ui(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(j$,e,n)(o)}}function Fme(t){t.exit("blockQuote")}const F$={name:"characterEscape",tokenize:Ume};function Ume(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 Mme(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const U$={name:"characterReference",tokenize:Bme};function Bme(t,e,n){const r=this;let i=0,s,o;return a;function a(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,o=Kc,d(h))}function c(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=wme,d):(t.enter("characterReferenceValue"),s=7,o=mR,d(h))}function d(h){if(h===59&&i){const g=t.exit("characterReferenceValue");return o===Kc&&!lk(r.sliceSerialize(g))?n(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(h)&&i++<s?(t.consume(h),d):n(h)}}const LO={partial:!0,tokenize:Vme},zO={concrete:!0,name:"codeFenced",tokenize:Hme};function Hme(t,e,n){const r=this,i={partial:!0,tokenize:I};let s=0,o=0,a;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,a=P,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),d(P)}function d(P){return P===a?(o++,t.consume(P),d):o<3?n(P):(t.exit("codeFencedFenceSequence"),ki(P)?Ui(t,h,"whitespace")(P):h(P))}function h(P){return P===null||qn(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||qn(P)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(P)):ki(P)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Ui(t,v,"whitespace")(P)):P===96&&P===a?n(P):(t.consume(P),g)}function v(P){return P===null||qn(P)?h(P):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),b(P))}function b(P){return P===null||qn(P)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(P)):P===96&&P===a?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&&ki(P)?Ui(t,E,"linePrefix",s+1)(P):E(P)}function E(P){return P===null||qn(P)?t.check(LO,_,N)(P):(t.enter("codeFlowValue"),A(P))}function A(P){return P===null||qn(P)?(t.exit("codeFlowValue"),E(P)):(t.consume(P),A)}function N(P){return t.exit("codeFenced"),e(P)}function I(P,L,R){let O=0;return F;function F(G){return P.enter("lineEnding"),P.consume(G),P.exit("lineEnding"),U}function U(G){return P.enter("codeFencedFence"),ki(G)?Ui(P,q,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):q(G)}function q(G){return G===a?(P.enter("codeFencedFenceSequence"),B(G)):R(G)}function B(G){return G===a?(O++,P.consume(G),B):O>=o?(P.exit("codeFencedFenceSequence"),ki(G)?Ui(P,Z,"whitespace")(G):Z(G)):R(G)}function Z(G){return G===null||qn(G)?(P.exit("codeFencedFence"),L(G)):R(G)}}}function Vme(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const oA={name:"codeIndented",tokenize:Wme},Gme={partial:!0,tokenize:$me};function Wme(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Ui(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?o(c):n(c)}function o(c){return c===null?l(c):qn(c)?t.attempt(Gme,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||qn(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function $me(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):qn(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Ui(t,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):qn(o)?i(o):n(o)}}const qme={name:"codeText",previous:Yme,resolve:Xme,tokenize:Kme};function Xme(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 Yme(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Kme(t,e,n){let r=0,i,s;return o;function o(h){return t.enter("codeText"),t.enter("codeTextSequence"),a(h)}function a(h){return h===96?(t.consume(h),r++,a):(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)):qn(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||qn(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 Zme{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&&Xb(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),Xb(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Xb(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);Xb(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Xb(this.left,n.reverse())}}}function Xb(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 B$(t){const e={};let n=-1,r,i,s,o,a,l,c;const d=new Zme(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,Qme(d,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=d.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(d.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...d.get(i)[1].start},a=d.slice(i,n),a.unshift(r),d.splice(i,n-i+1,a))}}return sh(t,0,Number.POSITIVE_INFINITY,d.slice(0)),!c}function Qme(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.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&&o.defineSkip(v.start),v._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(d),v._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=v,v=v.next}for(v=n;++g<a.length;)a[g][0]==="exit"&&a[g-1][0]==="enter"&&a[g][1].type===a[g-1][1].type&&a[g][1].start.line!==a[g][1].end.line&&(_=g+1,w.push(_),v._tokenizer=void 0,v.previous=void 0,v=v.next);for(o.events=[],v?(v._tokenizer=void 0,v.previous=void 0):w.pop(),g=w.length;g--;){const S=a.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 Jme={resolve:tge,tokenize:nge},ege={partial:!0,tokenize:rge};function tge(t){return B$(t),t}function nge(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):qn(a)?t.check(ege,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function rge(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Ui(t,s,"linePrefix")}function s(o){if(o===null||qn(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function H$(t,e,n,r,i,s,o,a,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(o),t.enter(a),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(a),t.enter("chunkString",{contentType:"string"}),v(S))}function v(S){return S===62?(t.exit("chunkString"),t.exit(a),g(S)):S===null||S===60||qn(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||Cc(S))?(t.exit("chunkString"),t.exit(a),t.exit(o),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 V$(t,e,n,r,i,s){const o=this;let a=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 a>999||v===null||v===91||v===93&&!l||v===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(v):v===93?(t.exit(s),t.enter(i),t.consume(v),t.exit(i),t.exit(r),e):qn(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||qn(v)||a++>999?(t.exit("chunkString"),d(v)):(t.consume(v),l||(l=!ki(v)),v===92?g:h)}function g(v){return v===91||v===92||v===93?(t.consume(v),a++,h):h(v)}}function G$(t,e,n,r,i,s){let o;return a;function a(g){return g===34||g===39||g===40?(t.enter(r),t.enter(i),t.consume(g),t.exit(i),o=g===40?41:g,l):n(g)}function l(g){return g===o?(t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):(t.enter(s),c(g))}function c(g){return g===o?(t.exit(s),l(o)):g===null?n(g):qn(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Ui(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(g))}function d(g){return g===o||g===null||qn(g)?(t.exit("chunkString"),c(g)):(t.consume(g),g===92?h:d)}function h(g){return g===o||g===92?(t.consume(g),d):d(g)}}function R_(t,e){let n;return r;function r(i){return qn(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):ki(i)?Ui(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const ige={name:"definition",tokenize:oge},sge={partial:!0,tokenize:age};function oge(t,e,n){const r=this;let i;return s;function s(v){return t.enter("definition"),o(v)}function o(v){return V$.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function a(v){return i=v1(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 Cc(v)?R_(t,c)(v):c(v)}function c(v){return H$(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function d(v){return t.attempt(sge,h,h)(v)}function h(v){return ki(v)?Ui(t,g,"whitespace")(v):g(v)}function g(v){return v===null||qn(v)?(t.exit("definition"),r.parser.defined.push(i),e(v)):n(v)}}function age(t,e,n){return r;function r(a){return Cc(a)?R_(t,i)(a):n(a)}function i(a){return G$(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return ki(a)?Ui(t,o,"whitespace")(a):o(a)}function o(a){return a===null||qn(a)?e(a):n(a)}}const lge={name:"hardBreakEscape",tokenize:cge};function cge(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return qn(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const uge={name:"headingAtx",resolve:dge,tokenize:fge};function dge(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"},sh(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function fge(t,e,n){let r=0;return i;function i(d){return t.enter("atxHeading"),s(d)}function s(d){return t.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(t.consume(d),o):d===null||Cc(d)?(t.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(t.enter("atxHeadingSequence"),l(d)):d===null||qn(d)?(t.exit("atxHeading"),e(d)):ki(d)?Ui(t,a,"whitespace")(d):(t.enter("atxHeadingText"),c(d))}function l(d){return d===35?(t.consume(d),l):(t.exit("atxHeadingSequence"),a(d))}function c(d){return d===null||d===35||Cc(d)?(t.exit("atxHeadingText"),a(d)):(t.consume(d),c)}}const hge=["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"],pge={concrete:!0,name:"htmlFlow",resolveTo:vge,tokenize:xge},mge={partial:!0,tokenize:bge},gge={partial:!0,tokenize:yge};function vge(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 xge(t,e,n){const r=this;let i,s,o,a,l;return c;function c(V){return d(V)}function d(V){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(V),h}function h(V){return V===33?(t.consume(V),g):V===47?(t.consume(V),s=!0,_):V===63?(t.consume(V),i=3,r.interrupt?e:H):Gf(V)?(t.consume(V),o=String.fromCharCode(V),w):n(V)}function g(V){return V===45?(t.consume(V),i=2,v):V===91?(t.consume(V),i=5,a=0,b):Gf(V)?(t.consume(V),i=4,r.interrupt?e:H):n(V)}function v(V){return V===45?(t.consume(V),r.interrupt?e:H):n(V)}function b(V){const ie="CDATA[";return V===ie.charCodeAt(a++)?(t.consume(V),a===ie.length?r.interrupt?e:q:b):n(V)}function _(V){return Gf(V)?(t.consume(V),o=String.fromCharCode(V),w):n(V)}function w(V){if(V===null||V===47||V===62||Cc(V)){const ie=V===47,ae=o.toLowerCase();return!ie&&!s&&jO.includes(ae)?(i=1,r.interrupt?e(V):q(V)):hge.includes(o.toLowerCase())?(i=6,ie?(t.consume(V),S):r.interrupt?e(V):q(V)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(V):s?E(V):A(V))}return V===45||Kc(V)?(t.consume(V),o+=String.fromCharCode(V),w):n(V)}function S(V){return V===62?(t.consume(V),r.interrupt?e:q):n(V)}function E(V){return ki(V)?(t.consume(V),E):F(V)}function A(V){return V===47?(t.consume(V),F):V===58||V===95||Gf(V)?(t.consume(V),N):ki(V)?(t.consume(V),A):F(V)}function N(V){return V===45||V===46||V===58||V===95||Kc(V)?(t.consume(V),N):I(V)}function I(V){return V===61?(t.consume(V),P):ki(V)?(t.consume(V),I):A(V)}function P(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(t.consume(V),l=V,L):ki(V)?(t.consume(V),P):R(V)}function L(V){return V===l?(t.consume(V),l=null,O):V===null||qn(V)?n(V):(t.consume(V),L)}function R(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||Cc(V)?I(V):(t.consume(V),R)}function O(V){return V===47||V===62||ki(V)?A(V):n(V)}function F(V){return V===62?(t.consume(V),U):n(V)}function U(V){return V===null||qn(V)?q(V):ki(V)?(t.consume(V),U):n(V)}function q(V){return V===45&&i===2?(t.consume(V),$):V===60&&i===1?(t.consume(V),K):V===62&&i===4?(t.consume(V),z):V===63&&i===3?(t.consume(V),H):V===93&&i===5?(t.consume(V),J):qn(V)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(mge,X,B)(V)):V===null||qn(V)?(t.exit("htmlFlowData"),B(V)):(t.consume(V),q)}function B(V){return t.check(gge,Z,X)(V)}function Z(V){return t.enter("lineEnding"),t.consume(V),t.exit("lineEnding"),G}function G(V){return V===null||qn(V)?B(V):(t.enter("htmlFlowData"),q(V))}function $(V){return V===45?(t.consume(V),H):q(V)}function K(V){return V===47?(t.consume(V),o="",Y):q(V)}function Y(V){if(V===62){const ie=o.toLowerCase();return jO.includes(ie)?(t.consume(V),z):q(V)}return Gf(V)&&o.length<8?(t.consume(V),o+=String.fromCharCode(V),Y):q(V)}function J(V){return V===93?(t.consume(V),H):q(V)}function H(V){return V===62?(t.consume(V),z):V===45&&i===2?(t.consume(V),H):q(V)}function z(V){return V===null||qn(V)?(t.exit("htmlFlowData"),X(V)):(t.consume(V),z)}function X(V){return t.exit("htmlFlow"),e(V)}}function yge(t,e,n){const r=this;return i;function i(o){return qn(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function bge(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(kT,e,n)}}const _ge={name:"htmlText",tokenize:Sge};function Sge(t,e,n){const r=this;let i,s,o;return a;function a(H){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(H),l}function l(H){return H===33?(t.consume(H),c):H===47?(t.consume(H),I):H===63?(t.consume(H),A):Gf(H)?(t.consume(H),R):n(H)}function c(H){return H===45?(t.consume(H),d):H===91?(t.consume(H),s=0,b):Gf(H)?(t.consume(H),E):n(H)}function d(H){return H===45?(t.consume(H),v):n(H)}function h(H){return H===null?n(H):H===45?(t.consume(H),g):qn(H)?(o=h,K(H)):(t.consume(H),h)}function g(H){return H===45?(t.consume(H),v):h(H)}function v(H){return H===62?$(H):H===45?g(H):h(H)}function b(H){const z="CDATA[";return H===z.charCodeAt(s++)?(t.consume(H),s===z.length?_:b):n(H)}function _(H){return H===null?n(H):H===93?(t.consume(H),w):qn(H)?(o=_,K(H)):(t.consume(H),_)}function w(H){return H===93?(t.consume(H),S):_(H)}function S(H){return H===62?$(H):H===93?(t.consume(H),S):_(H)}function E(H){return H===null||H===62?$(H):qn(H)?(o=E,K(H)):(t.consume(H),E)}function A(H){return H===null?n(H):H===63?(t.consume(H),N):qn(H)?(o=A,K(H)):(t.consume(H),A)}function N(H){return H===62?$(H):A(H)}function I(H){return Gf(H)?(t.consume(H),P):n(H)}function P(H){return H===45||Kc(H)?(t.consume(H),P):L(H)}function L(H){return qn(H)?(o=L,K(H)):ki(H)?(t.consume(H),L):$(H)}function R(H){return H===45||Kc(H)?(t.consume(H),R):H===47||H===62||Cc(H)?O(H):n(H)}function O(H){return H===47?(t.consume(H),$):H===58||H===95||Gf(H)?(t.consume(H),F):qn(H)?(o=O,K(H)):ki(H)?(t.consume(H),O):$(H)}function F(H){return H===45||H===46||H===58||H===95||Kc(H)?(t.consume(H),F):U(H)}function U(H){return H===61?(t.consume(H),q):qn(H)?(o=U,K(H)):ki(H)?(t.consume(H),U):O(H)}function q(H){return H===null||H===60||H===61||H===62||H===96?n(H):H===34||H===39?(t.consume(H),i=H,B):qn(H)?(o=q,K(H)):ki(H)?(t.consume(H),q):(t.consume(H),Z)}function B(H){return H===i?(t.consume(H),i=void 0,G):H===null?n(H):qn(H)?(o=B,K(H)):(t.consume(H),B)}function Z(H){return H===null||H===34||H===39||H===60||H===61||H===96?n(H):H===47||H===62||Cc(H)?O(H):(t.consume(H),Z)}function G(H){return H===47||H===62||Cc(H)?O(H):n(H)}function $(H){return H===62?(t.consume(H),t.exit("htmlTextData"),t.exit("htmlText"),e):n(H)}function K(H){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(H),t.exit("lineEnding"),Y}function Y(H){return ki(H)?Ui(t,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):J(H)}function J(H){return t.enter("htmlTextData"),o(H)}}const uk={name:"labelEnd",resolveAll:Ege,resolveTo:Cge,tokenize:Age},wge={tokenize:Nge},Mge={tokenize:Rge},Tge={tokenize:kge};function Ege(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&&sh(t,0,t.length,n),t}function Cge(t,e){let n=t.length,r=0,i,s,o,a;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(o){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"&&(o=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[o][1].end}},d={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=Bu(a,t.slice(s+1,s+r+3)),a=Bu(a,[["enter",d,e]]),a=Bu(a,ck(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=Bu(a,[["exit",d,e],t[o-2],t[o-1],["exit",c,e]]),a=Bu(a,t.slice(o+1)),a=Bu(a,[["exit",l,e]]),sh(t,s,t.length,a),t}function Age(t,e,n){const r=this;let i=r.events.length,s,o;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 a;function a(g){return s?s._inactive?h(g):(o=r.parser.defined.includes(v1(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(wge,d,o?d:h)(g):g===91?t.attempt(Mge,d,o?c:h)(g):o?d(g):h(g)}function c(g){return t.attempt(Tge,d,h)(g)}function d(g){return e(g)}function h(g){return s._balanced=!0,n(g)}}function Nge(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 Cc(h)?R_(t,s)(h):s(h)}function s(h){return h===41?d(h):H$(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Cc(h)?R_(t,l)(h):d(h)}function a(h){return n(h)}function l(h){return h===34||h===39||h===40?G$(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function c(h){return Cc(h)?R_(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 Rge(t,e,n){const r=this;return i;function i(a){return V$.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(v1(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function kge(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 Pge={name:"labelStartImage",resolveAll:uk.resolveAll,tokenize:Dge};function Dge(t,e,n){const r=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const Ige={name:"labelStartLink",resolveAll:uk.resolveAll,tokenize:Oge};function Oge(t,e,n){const r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const aA={name:"lineEnding",tokenize:Lge};function Lge(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Ui(t,e,"linePrefix")}}const FM={name:"thematicBreak",tokenize:zge};function zge(t,e,n){let r=0,i;return s;function s(c){return t.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(t.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||qn(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),ki(c)?Ui(t,a,"whitespace")(c):a(c))}}const xc={continuation:{tokenize:Bge},exit:Vge,name:"list",tokenize:Uge},jge={partial:!0,tokenize:Gge},Fge={partial:!0,tokenize:Hge};function Uge(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,o=0;return a;function a(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(FM,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)&&++o<10?(t.consume(v),l):(!r.interrupt||o<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(jge,g,h))}function d(v){return r.containerState.initialBlankLine=!0,s++,g(v)}function h(v){return ki(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 Bge(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(kT,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ui(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!ki(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Fge,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ui(t,t.attempt(xc,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Hge(t,e,n){const r=this;return Ui(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function Vge(t){t.exit(this.containerState.type)}function Gge(t,e,n){const r=this;return Ui(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!ki(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const FO={name:"setextUnderline",resolveTo:Wge,tokenize:$ge};function Wge(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 o={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",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function $ge(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,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),ki(c)?Ui(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||qn(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const qge={tokenize:Xge};function Xge(t){const e=this,n=t.attempt(kT,r,t.attempt(this.parser.constructs.flowInitial,i,Ui(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Jme,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 Yge={resolveAll:$$()},Kge=W$("string"),Zge=W$("text");function W$(t){return{resolveAll:$$(t==="text"?Qge:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(d){return c(d)?s(d):a(d)}function a(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 $$(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 Qge(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,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const c={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},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 Jge={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:j$},eve={91:ige},tve={[-2]:oA,[-1]:oA,32:oA},nve={35:uge,42:FM,45:[FO,FM],60:pge,61:FO,95:FM,96:zO,126:zO},rve={38:U$,92:F$},ive={[-5]:aA,[-4]:aA,[-3]:aA,33:Pge,38:U$,42:gR,60:[Ime,_ge],91:Ige,92:[lge,F$],93:uk,95:gR,96:qme},sve={null:[gR,Yge]},ove={null:[42,95]},ave={null:[]},lve=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ove,contentInitial:eve,disable:ave,document:Jge,flow:nve,flowInitial:tve,insideSpan:sve,string:rve,text:ive},Symbol.toStringTag,{value:"Module"}));function cve(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 o=[],a=[];const l={attempt:L(I),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(U){return o=Bu(o,U),w(),o[o.length-1]!==null?[]:(R(e,0),c.events=ck(s,c.events,c),c.events)}function g(U,q){return dve(v(U),q)}function v(U){return uve(o,U)}function b(){const{_bufferIndex:U,_index:q,line:B,column:Z,offset:G}=r;return{_bufferIndex:U,_index:q,line:B,column:Z,offset:G}}function _(U){i[U.line]=U.column,F()}function w(){let U;for(;r._index<o.length;){const q=o[r._index];if(typeof q=="string")for(U=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===U&&r._bufferIndex<q.length;)S(q.charCodeAt(r._bufferIndex));else S(q)}}function S(U){d=d(U)}function E(U){qn(U)?(r.line++,r.column=1,r.offset+=U===-3?2:1,F()):U!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=U}function A(U,q){const B=q||{};return B.type=U,B.start=b(),c.events.push(["enter",B,c]),a.push(B),B}function N(U){const q=a.pop();return q.end=b(),c.events.push(["exit",q,c]),q}function I(U,q){R(U,q.from)}function P(U,q){q.restore()}function L(U,q){return B;function B(Z,G,$){let K,Y,J,H;return Array.isArray(Z)?X(Z):"tokenize"in Z?X([Z]):z(Z);function z(re){return ce;function ce(oe){const fe=oe!==null&&re[oe],me=oe!==null&&re.null,ye=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(me)?me:me?[me]:[]];return X(ye)(oe)}}function X(re){return K=re,Y=0,re.length===0?$:V(re[Y])}function V(re){return ce;function ce(oe){return H=O(),J=re,re.partial||(c.currentConstruct=re),re.name&&c.parser.constructs.disable.null.includes(re.name)?ae():re.tokenize.call(q?Object.assign(Object.create(c),q):c,l,ie,ae)(oe)}}function ie(re){return U(J,H),G}function ae(re){return H.restore(),++Y<K.length?V(K[Y]):$}}}function R(U,q){U.resolveAll&&!s.includes(U)&&s.push(U),U.resolve&&sh(c.events,q,c.events.length-q,U.resolve(c.events.slice(q),c)),U.resolveTo&&(c.events=U.resolveTo(c.events,c))}function O(){const U=b(),q=c.previous,B=c.currentConstruct,Z=c.events.length,G=Array.from(a);return{from:Z,restore:$};function $(){r=U,c.previous=q,c.currentConstruct=B,c.events.length=Z,a=G,F()}}function F(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function uve(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function dve(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
`;break}case-3:{o=`\r
`;break}case-2:{o=e?" ":"	";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function fve(t){const r={constructs:yme([lve,...(t||{}).extensions||[]]),content:i(Cme),defined:[],document:i(Nme),flow:i(qge),lazy:{},string:i(Kge),text:i(Zge)};return r;function i(s){return o;function o(a){return cve(r,s,a)}}}function hve(t){for(;!B$(t););return t}const UO=/[\0\t\n\r]/g;function pve(){let t=1,e="",n=!0,r;return i;function i(s,o,a){const l=[];let c,d,h,g,v;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||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 a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const mve=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function gve(t){return t.replace(mve,vve)}function vve(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return z$(n.slice(s?2:1),s?16:10)}return lk(n)||t}const q$={}.hasOwnProperty;function xve(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),yve(n)(hve(fve(n).document().write(pve()(t,e,!0))))}function yve(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(We),autolinkProtocol:O,autolinkEmail:O,atxHeading:s(De),blockQuote:s(me),characterEscape:O,characterReference:O,codeFenced:s(ye),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(ye,o),codeText:s(Ee,o),codeTextData:O,data:O,codeFlowValue:O,definition:s(Ge),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(_e),hardBreakEscape:s(he),hardBreakTrailing:s(he),htmlFlow:s(Le,o),htmlFlowData:O,htmlText:s(Le,o),htmlTextData:O,image:s(ne),label:o,link:s(We),listItem:s(be),listItemValue:g,listOrdered:s(je,h),listUnordered:s(je),paragraph:s(Xe),reference:V,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(De),strong:s(le),thematicBreak:s(Se)},exit:{atxHeading:l(),atxHeadingSequence:I,autolink:l(),autolinkEmail:fe,autolinkProtocol:oe,blockQuote:l(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:re,characterReference:ce,codeFenced:l(w),codeFencedFence:_,codeFencedFenceInfo:v,codeFencedFenceMeta:b,codeFlowValue:F,codeIndented:l(S),codeText:l(G),codeTextData:F,data:F,definition:l(),definitionDestinationString:N,definitionLabelString:E,definitionTitleString:A,emphasis:l(),hardBreakEscape:l(q),hardBreakTrailing:l(q),htmlFlow:l(B),htmlFlowData:F,htmlText:l(Z),htmlTextData:F,image:l(K),label:J,labelText:Y,lineEnding:U,link:l($),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ie,resourceDestinationString:H,resourceTitleString:z,resource:X,setextHeading:l(R),setextHeadingLineSequence:L,setextHeadingText:P,strong:l(),thematicBreak:l()}};X$(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(ve){let ge={type:"root",children:[]};const Te={stack:[ge],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:d,data:n},He=[];let pe=-1;for(;++pe<ve.length;)if(ve[pe][1].type==="listOrdered"||ve[pe][1].type==="listUnordered")if(ve[pe][0]==="enter")He.push(pe);else{const qe=He.pop();pe=i(ve,qe,pe)}for(pe=-1;++pe<ve.length;){const qe=e[ve[pe][0]];q$.call(qe,ve[pe][1].type)&&qe[ve[pe][1].type].call(Object.assign({sliceSerialize:ve[pe][2].sliceSerialize},Te),ve[pe][1])}if(Te.tokenStack.length>0){const qe=Te.tokenStack[Te.tokenStack.length-1];(qe[1]||BO).call(Te,void 0,qe[0])}for(ge.position={start:d0(ve.length>0?ve[0][1].start:{line:1,column:1,offset:0}),end:d0(ve.length>0?ve[ve.length-2][1].end:{line:1,column:1,offset:0})},pe=-1;++pe<e.transforms.length;)ge=e.transforms[pe](ge)||ge;return ge}function i(ve,ge,Te){let He=ge-1,pe=-1,qe=!1,xt,nt,tt,Fe;for(;++He<=Te;){const we=ve[He];switch(we[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{we[0]==="enter"?pe++:pe--,Fe=void 0;break}case"lineEndingBlank":{we[0]==="enter"&&(xt&&!Fe&&!pe&&!tt&&(tt=He),Fe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Fe=void 0}if(!pe&&we[0]==="enter"&&we[1].type==="listItemPrefix"||pe===-1&&we[0]==="exit"&&(we[1].type==="listUnordered"||we[1].type==="listOrdered")){if(xt){let ke=He;for(nt=void 0;ke--;){const Ze=ve[ke];if(Ze[1].type==="lineEnding"||Ze[1].type==="lineEndingBlank"){if(Ze[0]==="exit")continue;nt&&(ve[nt][1].type="lineEndingBlank",qe=!0),Ze[1].type="lineEnding",nt=ke}else if(!(Ze[1].type==="linePrefix"||Ze[1].type==="blockQuotePrefix"||Ze[1].type==="blockQuotePrefixWhitespace"||Ze[1].type==="blockQuoteMarker"||Ze[1].type==="listItemIndent"))break}tt&&(!nt||tt<nt)&&(xt._spread=!0),xt.end=Object.assign({},nt?ve[nt][1].start:we[1].end),ve.splice(nt||He,0,["exit",xt,we[2]]),He++,Te++}if(we[1].type==="listItemPrefix"){const ke={type:"listItem",_spread:!1,start:Object.assign({},we[1].start),end:void 0};xt=ke,ve.splice(He,0,["enter",ke,we[2]]),He++,Te++,tt=void 0,Fe=!0}}}return ve[ge][1]._spread=qe,Te}function s(ve,ge){return Te;function Te(He){a.call(this,ve(He),He),ge&&ge.call(this,He)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(ve,ge,Te){this.stack[this.stack.length-1].children.push(ve),this.stack.push(ve),this.tokenStack.push([ge,Te||void 0]),ve.position={start:d0(ge.start),end:void 0}}function l(ve){return ge;function ge(Te){ve&&ve.call(this,Te),c.call(this,Te)}}function c(ve,ge){const Te=this.stack.pop(),He=this.tokenStack.pop();if(He)He[0].type!==ve.type&&(ge?ge.call(this,ve,He[0]):(He[1]||BO).call(this,ve,He[0]));else throw new Error("Cannot close `"+ve.type+"` ("+N_({start:ve.start,end:ve.end})+"): it’s not open");Te.position.end=d0(ve.end)}function d(){return vme(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function g(ve){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(ve),10),this.data.expectingFirstListItemValue=void 0}}function v(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=ve}function b(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=ve}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ve.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function S(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ve.replace(/(\r?\n|\r)$/g,"")}function E(ve){const ge=this.resume(),Te=this.stack[this.stack.length-1];Te.label=ge,Te.identifier=v1(this.sliceSerialize(ve)).toLowerCase()}function A(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.title=ve}function N(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.url=ve}function I(ve){const ge=this.stack[this.stack.length-1];if(!ge.depth){const Te=this.sliceSerialize(ve).length;ge.depth=Te}}function P(){this.data.setextHeadingSlurpLineEnding=!0}function L(ve){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(ve).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function O(ve){const Te=this.stack[this.stack.length-1].children;let He=Te[Te.length-1];(!He||He.type!=="text")&&(He=te(),He.position={start:d0(ve.start),end:void 0},Te.push(He)),this.stack.push(He)}function F(ve){const ge=this.stack.pop();ge.value+=this.sliceSerialize(ve),ge.position.end=d0(ve.end)}function U(ve){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=ge.children[ge.children.length-1];Te.position.end=d0(ve.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(ge.type)&&(O.call(this,ve),F.call(this,ve))}function q(){this.data.atHardBreak=!0}function B(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ve}function Z(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ve}function G(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.value=ve}function $(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=ge,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function K(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=ge,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function Y(ve){const ge=this.sliceSerialize(ve),Te=this.stack[this.stack.length-2];Te.label=gve(ge),Te.identifier=v1(ge).toLowerCase()}function J(){const ve=this.stack[this.stack.length-1],ge=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const He=ve.children;Te.children=He}else Te.alt=ge}function H(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.url=ve}function z(){const ve=this.resume(),ge=this.stack[this.stack.length-1];ge.title=ve}function X(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function ie(ve){const ge=this.resume(),Te=this.stack[this.stack.length-1];Te.label=ge,Te.identifier=v1(this.sliceSerialize(ve)).toLowerCase(),this.data.referenceType="full"}function ae(ve){this.data.characterReferenceType=ve.type}function re(ve){const ge=this.sliceSerialize(ve),Te=this.data.characterReferenceType;let He;Te?(He=z$(ge,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=lk(ge);const pe=this.stack[this.stack.length-1];pe.value+=He}function ce(ve){const ge=this.stack.pop();ge.position.end=d0(ve.end)}function oe(ve){F.call(this,ve);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(ve)}function fe(ve){F.call(this,ve);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(ve)}function me(){return{type:"blockquote",children:[]}}function ye(){return{type:"code",lang:null,meta:null,value:""}}function Ee(){return{type:"inlineCode",value:""}}function Ge(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _e(){return{type:"emphasis",children:[]}}function De(){return{type:"heading",depth:0,children:[]}}function he(){return{type:"break"}}function Le(){return{type:"html",value:""}}function ne(){return{type:"image",title:null,url:"",alt:null}}function We(){return{type:"link",title:null,url:"",children:[]}}function je(ve){return{type:"list",ordered:ve.type==="listOrdered",start:null,spread:ve._spread,children:[]}}function be(ve){return{type:"listItem",spread:ve._spread,checked:null,children:[]}}function Xe(){return{type:"paragraph",children:[]}}function le(){return{type:"strong",children:[]}}function te(){return{type:"text",value:""}}function Se(){return{type:"thematicBreak"}}}function d0(t){return{line:t.line,column:t.column,offset:t.offset}}function X$(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?X$(t,r):bve(t,r)}}function bve(t,e){let n;for(n in e)if(q$.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+"` ("+N_({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+N_({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+N_({start:e.start,end:e.end})+") is still open")}function _ve(t){const e=this;e.parser=n;function n(r){return xve(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function Sve(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 wve(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
`}]}function Mve(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 Tve(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Eve(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Cve(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Cy(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let o,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function Ave(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 Nve(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function Y$(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 o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function Rve(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Y$(t,e);const i={src:Cy(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 kve(t,e){const n={src:Cy(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 Pve(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 Dve(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Y$(t,e);const i={href:Cy(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 Ive(t,e){const n={href:Cy(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 Ove(t,e,n){const r=t.all(e),i=n?Lve(n):K$(e),s={},o=[];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 a=-1;for(;++a<r.length;){const d=r[a];(i||a!==0||d.type!=="element"||d.tagName!=="p")&&o.push({type:"text",value:`
`}),d.type==="element"&&d.tagName==="p"&&!i?o.push(...d.children):o.push(d)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
`});const c={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,c),t.applyData(e,c)}function Lve(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=K$(n[r])}return e}function K$(t){const e=t.spread;return e??t.children.length>1}function zve(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 o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.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 jve(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Fve(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function Uve(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Bve(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=ik(e.children[1]),l=R$(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function Hve(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:e.children.length;let l=-1;const c=[];for(;++l<a;){const h=e.children[l],g={},v=o?o[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 Vve(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 Gve(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 Wve(t,e){const n={type:"text",value:Gve(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function $ve(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const qve={blockquote:Sve,break:wve,code:Mve,delete:Tve,emphasis:Eve,footnoteReference:Cve,heading:Ave,html:Nve,imageReference:Rve,image:kve,inlineCode:Pve,linkReference:Dve,link:Ive,listItem:Ove,list:zve,paragraph:jve,root:Fve,strong:Uve,table:Bve,tableCell:Vve,tableRow:Hve,text:Wve,thematicBreak:$ve,toml:p4,yaml:p4,definition:p4,footnoteDefinition:p4};function p4(){}const Z$=-1,PT=0,k_=1,M2=2,dk=3,fk=4,hk=5,pk=6,Q$=7,J$=8,WO=typeof self=="object"?self:globalThis,Xve=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case PT:case Z$:return n(o,i);case k_:{const a=n([],i);for(const l of o)a.push(r(l));return a}case M2:{const a=n({},i);for(const[l,c]of o)a[r(l)]=r(c);return a}case dk:return n(new Date(o),i);case fk:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case hk:{const a=n(new Map,i);for(const[l,c]of o)a.set(r(l),r(c));return a}case pk:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case Q$:{const{name:a,message:l}=o;return n(new WO[a](l),i)}case J$:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new WO[s](o),i)};return r},$O=t=>Xve(new Map,t)(0),Ex="",{toString:Yve}={},{keys:Kve}=Object,Yb=t=>{const e=typeof t;if(e!=="object"||!t)return[PT,e];const n=Yve.call(t).slice(8,-1);switch(n){case"Array":return[k_,Ex];case"Object":return[M2,Ex];case"Date":return[dk,Ex];case"RegExp":return[fk,Ex];case"Map":return[hk,Ex];case"Set":return[pk,Ex];case"DataView":return[k_,n]}return n.includes("Array")?[k_,n]:n.includes("Error")?[Q$,n]:[M2,n]},m4=([t,e])=>t===PT&&(e==="function"||e==="symbol"),Zve=(t,e,n,r)=>{const i=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},s=o=>{if(n.has(o))return n.get(o);let[a,l]=Yb(o);switch(a){case PT:{let d=o;switch(l){case"bigint":a=J$,d=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return i([Z$],o)}return i([a,d],o)}case k_:{if(l){let g=o;return l==="DataView"?g=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(g=new Uint8Array(o)),i([l,[...g]],o)}const d=[],h=i([a,d],o);for(const g of o)d.push(s(g));return h}case M2:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const d=[],h=i([a,d],o);for(const g of Kve(o))(t||!m4(Yb(o[g])))&&d.push([s(g),s(o[g])]);return h}case dk:return i([a,o.toISOString()],o);case fk:{const{source:d,flags:h}=o;return i([a,{source:d,flags:h}],o)}case hk:{const d=[],h=i([a,d],o);for(const[g,v]of o)(t||!(m4(Yb(g))||m4(Yb(v))))&&d.push([s(g),s(v)]);return h}case pk:{const d=[],h=i([a,d],o);for(const g of o)(t||!m4(Yb(g)))&&d.push(s(g));return h}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},qO=(t,{json:e,lossy:n}={})=>{const r=[];return Zve(!(e||n),!!e,new Map,r)(t),r},T2=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 Qve(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 Jve(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function exe(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Qve,r=t.options.footnoteBackLabel||Jve,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];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=Cy(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),a.push(S)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...T2(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
`}]}}const mk=(function(t){if(t==null)return ixe;if(typeof t=="function")return DT(t);if(typeof t=="object")return Array.isArray(t)?txe(t):nxe(t);if(typeof t=="string")return rxe(t);throw new Error("Expected function, string, or object as test")});function txe(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=mk(t[n]);return DT(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function nxe(t){const e=t;return DT(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function rxe(t){return DT(e);function e(n){return n&&n.type===t}}function DT(t){return e;function e(n,r,i){return!!(sxe(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function ixe(){return!0}function sxe(t){return t!==null&&typeof t=="object"&&"type"in t}const eq=[],oxe=!0,XO=!1,tq="skip";function nq(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=mk(i),o=r?-1:1;a(t,void 0,[])();function a(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=eq,b,_,w;if((!e||s(l,c,d[d.length-1]||void 0))&&(v=axe(n(l,d)),v[0]===XO))return v;if("children"in l&&l.children){const S=l;if(S.children&&v[0]!==tq)for(_=(r?S.children.length:-1)+o,w=d.concat(S);_>-1&&_<S.children.length;){const E=S.children[_];if(b=a(E,_,w)(),b[0]===XO)return b;_=typeof b[1]=="number"?b[1]:_+o}}return v}}}function axe(t){return Array.isArray(t)?t:typeof t=="number"?[oxe,t]:t==null?eq:[t]}function rq(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),nq(t,s,a,i);function a(l,c){const d=c[c.length-1],h=d?d.children.indexOf(l):void 0;return o(l,h,d)}}const vR={}.hasOwnProperty,lxe={};function cxe(t,e){const n=e||lxe,r=new Map,i=new Map,s=new Map,o={...qve,...n.handlers},a={all:c,applyData:dxe,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:uxe,wrap:hxe};return rq(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)}}),a;function l(d,h){const g=d.type,v=a.handlers[g];if(vR.call(a.handlers,g)&&v)return v(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(g)){if("children"in d){const{children:_,...w}=d,S=T2(w);return S.children=a.all(d),S}return T2(d)}return(a.options.unknownHandler||fxe)(a,d,h)}function c(d){const h=[];if("children"in d){const g=d.children;let v=-1;for(;++v<g.length;){const b=a.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 uxe(t,e){t.position&&(e.position=Y0e(t))}function dxe(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 o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,T2(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function fxe(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 hxe(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=cxe(t,e),r=n.one(t,void 0),i=exe(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
`},i),s}function pxe(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 mxe(){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)},o=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},a=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=a(_,d),g=a(c,d),_!==g&&(E&&g&&(s(g)||(v=i(g)))?(v?(v=!1,b=h&&i(h)?h:[]):b=h&&s(h)?h:{},o(_,{name:d,newValue:l(E,b,g)})):typeof g<"u"&&o(_,{name:d,newValue:g}));return _},lA}var gxe=mxe();const cA=uy(gxe);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 vxe(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...c){const d=t[++s];let h=-1;if(l){o(l);return}for(;++h<i.length;)(c[h]===null||c[h]===void 0)&&(c[h]=i[h]);i=c,d?xxe(d,a)(...c):o(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 xxe(t,e){let n;return r;function r(...o){const a=t.length>o.length;let l;a&&o.push(i);try{l=t.apply(this,o)}catch(c){const d=c;if(a&&n)throw d;return i(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,e(o,...a))}function s(o){i(null,o)}}const Lf={basename:yxe,dirname:bxe,extname:_xe,join:Sxe,sep:"/"};function yxe(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 o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function bxe(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 _xe(t){fw(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===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 Sxe(...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?".":wxe(n)}function wxe(t){fw(t);const e=t.codePointAt(0)===47;let n=Mxe(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Mxe(t,e){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-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=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else a===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 Txe={cwd:Exe};function Exe(){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 Cxe(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 Axe(t)}function Axe(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 iq{constructor(e){let n;e?yR(e)?n={path:e}:typeof e=="string"||Nxe(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":Txe.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=Cxe(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 vl(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 Nxe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Rxe=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),kxe={}.hasOwnProperty;class gk extends Rxe{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=vxe()}copy(){const e=new gk;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):kxe.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=g4(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,o){const a=g4(e),l=r.parse(a);r.run(l,a,function(d,h,g){if(d||!h||!g)return c(d);const v=h,b=r.stringify(v,g);Ixe(b)?g.value=b:g.result=b,c(d,g)});function c(d,h){d||!h?o(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,o){n=!0,ZO(s),r=o}}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(o,a){const l=g4(n);i.run(e,l,c);function c(d,h,g){const v=h||e;d?a(d):o?o(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(o,a){ZO(o),i=a,r=!0}}stringify(e,n){this.freeze();const r=g4(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)?a(e):o(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 o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(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");a(c.plugins),c.settings&&(i.settings=cA(!0,i.settings,c.settings))}function a(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 Pxe=new gk().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 g4(t){return Dxe(t)?t:new iq(t)}function Dxe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function Ixe(t){return typeof t=="string"||Oxe(t)}function Oxe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Lxe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",nL=[],rL={allowDangerousHtml:!0},zxe=/^(https?|ircs?|mailto|xmpp)$/i,jxe=[{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 Fxe(t){const e=Uxe(t),n=Bxe(t);return Hxe(e.runSync(e.parse(n),n),t)}function Uxe(t){const e=t.rehypePlugins||nL,n=t.remarkPlugins||nL,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...rL}:rL;return Pxe().use(_ve).use(n).use(pxe,r).use(e)}function Bxe(t){const e=t.children||"",n=new iq;return typeof e=="string"&&(n.value=e),n}function Hxe(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||Vxe;for(const d of jxe)Object.hasOwn(e,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Lxe+d.id,void 0);return rq(t,c),eme(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 o?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 a&&d.children?g.children.splice(h,1,...d.children):g.children.splice(h,1),h}}}function Vxe(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||zxe.test(t.slice(0,e))?t:""}function Gxe(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,o=0;for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=n.indexOf(e,i);return o}function Wxe(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:s},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:a,mathText:o,mathTextData:a}};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 o(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 a(l){this.config.enter.data.call(this,l),this.config.exit.data.call(this,l)}}function $xe(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,o,a,l){const c=s.value||"",d=a.createTracker(l),h="$".repeat(Math.max(Gxe(c,"$")+1,2)),g=a.enter("mathFlow");let v=d.move(h);if(s.meta){const b=a.enter("mathFlowMeta");v+=d.move(a.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,o,a){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<a.unsafe.length;){const g=a.unsafe[h];if(!g.atBreak)continue;const v=a.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 qxe={tokenize:Xxe,concrete:!0,name:"mathFlow"},iL={tokenize:Yxe,partial:!0};function Xxe(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 o=0;return a;function a(E){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),l(E)}function l(E){return E===36?(t.consume(E),o++,l):o<2?n(E):(t.exit("mathFlowFenceSequence"),Ui(t,c,"whitespace")(E))}function c(E){return E===null||qn(E)?h(E):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),d(E))}function d(E){return E===null||qn(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?Ui(t,b,"linePrefix",s+1):b)(E)}function b(E){return E===null?w(E):qn(E)?t.attempt(iL,g,w)(E):(t.enter("mathFlowValue"),_(E))}function _(E){return E===null||qn(E)?(t.exit("mathFlowValue"),b(E)):(t.consume(E),_)}function w(E){return t.exit("mathFlow"),e(E)}function S(E,A,N){let I=0;return Ui(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?(I++,E.consume(O),L):I<o?N(O):(E.exit("mathFlowFenceSequence"),Ui(E,R,"whitespace")(O))}function R(O){return O===null||qn(O)?(E.exit("mathFlowFence"),A(O)):N(O)}}}function Yxe(t,e,n){const r=this;return i;function i(o){return o===null?e(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function Kxe(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:Zxe,previous:Qxe,name:"mathText"};function r(i,s,o){let a=0,l,c;return d;function d(_){return i.enter("mathText"),i.enter("mathTextSequence"),h(_)}function h(_){return _===36?(i.consume(_),a++,h):a<2&&!n?o(_):(i.exit("mathTextSequence"),g(_))}function g(_){return _===null?o(_):_===36?(c=i.enter("mathTextSequence"),l=0,b(_)):_===32?(i.enter("space"),i.consume(_),i.exit("space"),g):qn(_)?(i.enter("lineEnding"),i.consume(_),i.exit("lineEnding"),g):(i.enter("mathTextData"),v(_))}function v(_){return _===null||_===32||_===36||qn(_)?(i.exit("mathTextData"),g(_)):(i.consume(_),v)}function b(_){return _===36?(i.consume(_),l++,b):l===a?(i.exit("mathTextSequence"),i.exit("mathText"),s(_)):(c.type="mathTextData",v(_))}}}function Zxe(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 Qxe(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function Jxe(t){return{flow:{36:qxe},text:{36:Kxe(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 nu{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 nu(n,wc.range(this,e))}}class tn{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,o=n&&n.loc;if(o&&o.start<=o.end){var a=o.lexer.input;i=o.start,s=o.end,i===a.length?r+=" at end of input: ":r+=" at position "+(i+1)+": ";var l=a.slice(i,s).replace(/[^]/g,"$&̲"),c;i>15?c="…"+a.slice(i-15,i):c=a.slice(0,i);var d;s+15<a.length?d=a.slice(s,s+15)+"…":d=a.slice(s),r+=c+l+d}var h=new Error(r);return h.name="ParseError",h.__proto__=tn.prototype,h.position=i,i!=null&&s!=null&&(h.length=s-i),h.rawMessage=e,h}}tn.prototype.__proto__=Error.prototype;var e1e=/([A-Z])/g,vk=t=>t.replace(e1e,"-$1").toLowerCase(),t1e={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},n1e=/[&><"']/g,dl=t=>String(t).replace(n1e,e=>t1e[e]),P_=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?P_(t.body[0]):t:t.type==="font"?P_(t.body):t,r1e=new Set(["mathord","textord","atom"]),yp=t=>r1e.has(P_(t).type),i1e=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"},UM={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 s1e(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 xk{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 UM)if(UM.hasOwnProperty(n)){var r=UM[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:s1e(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 tn("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=i1e(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class f0{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[o1e[this.id]]}sub(){return Uf[a1e[this.id]]}fracNum(){return Uf[l1e[this.id]]}fracDen(){return Uf[c1e[this.id]]}cramp(){return Uf[u1e[this.id]]}text(){return Uf[d1e[this.id]]}isTight(){return this.size>=2}}var yk=0,E2=1,x1=2,cp=3,hS=4,Hu=5,Q1=6,Hl=7,Uf=[new f0(yk,0,!1),new f0(E2,0,!0),new f0(x1,1,!1),new f0(cp,1,!0),new f0(hS,2,!1),new f0(Hu,2,!0),new f0(Q1,3,!1),new f0(Hl,3,!0)],o1e=[hS,Hu,hS,Hu,Q1,Hl,Q1,Hl],a1e=[Hu,Hu,Hu,Hu,Hl,Hl,Hl,Hl],l1e=[x1,cp,hS,Hu,Q1,Hl,Q1,Hl],c1e=[cp,cp,Hu,Hu,Hl,Hl,Hl,Hl],u1e=[E2,E2,cp,cp,Hu,Hu,Hl,Hl],d1e=[yk,E2,x1,cp,x1,cp,x1,cp],mr={DISPLAY:Uf[yk],TEXT:Uf[x1],SCRIPT:Uf[hS],SCRIPTSCRIPT:Uf[Q1]},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 f1e(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 BM=[];bR.forEach(t=>t.blocks.forEach(e=>BM.push(...e)));function sq(t){for(var e=0;e<BM.length;e+=2)if(t>=BM[e]&&t<=BM[e+1])return!0;return!1}var Cx=80,h1e=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"},p1e=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"},m1e=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"},g1e=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"},v1e=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"},x1e=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},y1e=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"},b1e=function(e,n,r){n=1e3*n;var i="";switch(e){case"sqrtMain":i=h1e(n,Cx);break;case"sqrtSize1":i=p1e(n,Cx);break;case"sqrtSize2":i=m1e(n,Cx);break;case"sqrtSize3":i=g1e(n,Cx);break;case"sqrtSize4":i=v1e(n,Cx);break;case"sqrtTall":i=y1e(n,Cx,r)}return i},_1e=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`},S1e=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 Kf={"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]}},v4={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]},oL={Å:"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 w1e(t,e){Kf[t]=e}function bk(t,e,n){if(!Kf[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),i=Kf[e][r];if(!i&&t[0]in oL&&(r=oL[t[0]].charCodeAt(0),i=Kf[e][r]),!i&&n==="text"&&sq(r)&&(i=Kf[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var gA={};function M1e(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!gA[e]){var n=gA[e]={cssEmPerMu:v4.quad[e]/18};for(var r in v4)v4.hasOwnProperty(r)&&(n[r]=v4[r][e])}return gA[e]}var T1e=[[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]],aL=[.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:T1e[e-1][n.size-1]};class Jh{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||Jh.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=aL[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 Jh(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:aL[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=lL(Jh.BASESIZE,e);return this.size===n&&this.textSize===Jh.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!==Jh.BASESIZE?["sizing","reset-size"+this.size,"size"+Jh.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=M1e(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Jh.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},E1e={ex:!0,em:!0,mu:!0},oq=function(e){return typeof e!="string"&&(e=e.unit),e in _R||e in E1e||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 tn("Invalid unit: '"+e.unit+"'");i!==n&&(r*=i.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},fn=function(e){return+e.toFixed(4)+"em"},K0=function(e){return e.filter(n=>n).join(" ")},aq=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)}},lq=function(e){var n=document.createElement(e);n.className=K0(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},C1e=/[\s"'>/=\x00-\x1f]/,cq=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+dl(K0(this.classes))+'"');var r="";for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=vk(i)+":"+this.style[i]+";");r&&(n+=' style="'+dl(r)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(C1e.test(s))throw new tn("Invalid attribute name '"+s+"'");n+=" "+s+'="'+dl(this.attributes[s])+'"'}n+=">";for(var o=0;o<this.children.length;o++)n+=this.children[o].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,aq.call(this,e,r,i),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return lq.call(this,"span")}toMarkup(){return cq.call(this,"span")}}class _k{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,aq.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 lq.call(this,"a")}toMarkup(){return cq.call(this,"a")}}class A1e{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+=vk(r)+":"+this.style[r]+";");return n&&(e+=' style="'+dl(n)+'"'),e+="'/>",e}}var N1e={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class Yu{constructor(e,n,r,i,s,o,a,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=o||0,this.classes=a||[],this.style=l||{},this.maxFontSize=0;var c=f1e(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=N1e[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=fn(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=K0(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(K0(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+=vk(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 pp{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 Z0{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 Yu)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function R1e(t){if(t instanceof pw)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var k1e={bin:1,close:1,inner:1,open:1,punct:1,rel:1},P1e={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},hs={math:{},text:{}};function Q(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",qt="text",Me="main",Qe="ams",Bs="accent-token",En="bin",Wl="close",Ay="inner",Zn="mathord",$o="op-token",uu="open",IT="punct",et="rel",bp="spacing",ft="textord";Q(se,Me,et,"≡","\\equiv",!0);Q(se,Me,et,"≺","\\prec",!0);Q(se,Me,et,"≻","\\succ",!0);Q(se,Me,et,"∼","\\sim",!0);Q(se,Me,et,"⊥","\\perp");Q(se,Me,et,"⪯","\\preceq",!0);Q(se,Me,et,"⪰","\\succeq",!0);Q(se,Me,et,"≃","\\simeq",!0);Q(se,Me,et,"∣","\\mid",!0);Q(se,Me,et,"≪","\\ll",!0);Q(se,Me,et,"≫","\\gg",!0);Q(se,Me,et,"≍","\\asymp",!0);Q(se,Me,et,"∥","\\parallel");Q(se,Me,et,"⋈","\\bowtie",!0);Q(se,Me,et,"⌣","\\smile",!0);Q(se,Me,et,"⊑","\\sqsubseteq",!0);Q(se,Me,et,"⊒","\\sqsupseteq",!0);Q(se,Me,et,"≐","\\doteq",!0);Q(se,Me,et,"⌢","\\frown",!0);Q(se,Me,et,"∋","\\ni",!0);Q(se,Me,et,"∝","\\propto",!0);Q(se,Me,et,"⊢","\\vdash",!0);Q(se,Me,et,"⊣","\\dashv",!0);Q(se,Me,et,"∋","\\owns");Q(se,Me,IT,".","\\ldotp");Q(se,Me,IT,"⋅","\\cdotp");Q(se,Me,ft,"#","\\#");Q(qt,Me,ft,"#","\\#");Q(se,Me,ft,"&","\\&");Q(qt,Me,ft,"&","\\&");Q(se,Me,ft,"ℵ","\\aleph",!0);Q(se,Me,ft,"∀","\\forall",!0);Q(se,Me,ft,"ℏ","\\hbar",!0);Q(se,Me,ft,"∃","\\exists",!0);Q(se,Me,ft,"∇","\\nabla",!0);Q(se,Me,ft,"♭","\\flat",!0);Q(se,Me,ft,"ℓ","\\ell",!0);Q(se,Me,ft,"♮","\\natural",!0);Q(se,Me,ft,"♣","\\clubsuit",!0);Q(se,Me,ft,"℘","\\wp",!0);Q(se,Me,ft,"♯","\\sharp",!0);Q(se,Me,ft,"♢","\\diamondsuit",!0);Q(se,Me,ft,"ℜ","\\Re",!0);Q(se,Me,ft,"♡","\\heartsuit",!0);Q(se,Me,ft,"ℑ","\\Im",!0);Q(se,Me,ft,"♠","\\spadesuit",!0);Q(se,Me,ft,"§","\\S",!0);Q(qt,Me,ft,"§","\\S");Q(se,Me,ft,"¶","\\P",!0);Q(qt,Me,ft,"¶","\\P");Q(se,Me,ft,"†","\\dag");Q(qt,Me,ft,"†","\\dag");Q(qt,Me,ft,"†","\\textdagger");Q(se,Me,ft,"‡","\\ddag");Q(qt,Me,ft,"‡","\\ddag");Q(qt,Me,ft,"‡","\\textdaggerdbl");Q(se,Me,Wl,"⎱","\\rmoustache",!0);Q(se,Me,uu,"⎰","\\lmoustache",!0);Q(se,Me,Wl,"⟯","\\rgroup",!0);Q(se,Me,uu,"⟮","\\lgroup",!0);Q(se,Me,En,"∓","\\mp",!0);Q(se,Me,En,"⊖","\\ominus",!0);Q(se,Me,En,"⊎","\\uplus",!0);Q(se,Me,En,"⊓","\\sqcap",!0);Q(se,Me,En,"∗","\\ast");Q(se,Me,En,"⊔","\\sqcup",!0);Q(se,Me,En,"◯","\\bigcirc",!0);Q(se,Me,En,"∙","\\bullet",!0);Q(se,Me,En,"‡","\\ddagger");Q(se,Me,En,"≀","\\wr",!0);Q(se,Me,En,"⨿","\\amalg");Q(se,Me,En,"&","\\And");Q(se,Me,et,"⟵","\\longleftarrow",!0);Q(se,Me,et,"⇐","\\Leftarrow",!0);Q(se,Me,et,"⟸","\\Longleftarrow",!0);Q(se,Me,et,"⟶","\\longrightarrow",!0);Q(se,Me,et,"⇒","\\Rightarrow",!0);Q(se,Me,et,"⟹","\\Longrightarrow",!0);Q(se,Me,et,"↔","\\leftrightarrow",!0);Q(se,Me,et,"⟷","\\longleftrightarrow",!0);Q(se,Me,et,"⇔","\\Leftrightarrow",!0);Q(se,Me,et,"⟺","\\Longleftrightarrow",!0);Q(se,Me,et,"↦","\\mapsto",!0);Q(se,Me,et,"⟼","\\longmapsto",!0);Q(se,Me,et,"↗","\\nearrow",!0);Q(se,Me,et,"↩","\\hookleftarrow",!0);Q(se,Me,et,"↪","\\hookrightarrow",!0);Q(se,Me,et,"↘","\\searrow",!0);Q(se,Me,et,"↼","\\leftharpoonup",!0);Q(se,Me,et,"⇀","\\rightharpoonup",!0);Q(se,Me,et,"↙","\\swarrow",!0);Q(se,Me,et,"↽","\\leftharpoondown",!0);Q(se,Me,et,"⇁","\\rightharpoondown",!0);Q(se,Me,et,"↖","\\nwarrow",!0);Q(se,Me,et,"⇌","\\rightleftharpoons",!0);Q(se,Qe,et,"≮","\\nless",!0);Q(se,Qe,et,"","\\@nleqslant");Q(se,Qe,et,"","\\@nleqq");Q(se,Qe,et,"⪇","\\lneq",!0);Q(se,Qe,et,"≨","\\lneqq",!0);Q(se,Qe,et,"","\\@lvertneqq");Q(se,Qe,et,"⋦","\\lnsim",!0);Q(se,Qe,et,"⪉","\\lnapprox",!0);Q(se,Qe,et,"⊀","\\nprec",!0);Q(se,Qe,et,"⋠","\\npreceq",!0);Q(se,Qe,et,"⋨","\\precnsim",!0);Q(se,Qe,et,"⪹","\\precnapprox",!0);Q(se,Qe,et,"≁","\\nsim",!0);Q(se,Qe,et,"","\\@nshortmid");Q(se,Qe,et,"∤","\\nmid",!0);Q(se,Qe,et,"⊬","\\nvdash",!0);Q(se,Qe,et,"⊭","\\nvDash",!0);Q(se,Qe,et,"⋪","\\ntriangleleft");Q(se,Qe,et,"⋬","\\ntrianglelefteq",!0);Q(se,Qe,et,"⊊","\\subsetneq",!0);Q(se,Qe,et,"","\\@varsubsetneq");Q(se,Qe,et,"⫋","\\subsetneqq",!0);Q(se,Qe,et,"","\\@varsubsetneqq");Q(se,Qe,et,"≯","\\ngtr",!0);Q(se,Qe,et,"","\\@ngeqslant");Q(se,Qe,et,"","\\@ngeqq");Q(se,Qe,et,"⪈","\\gneq",!0);Q(se,Qe,et,"≩","\\gneqq",!0);Q(se,Qe,et,"","\\@gvertneqq");Q(se,Qe,et,"⋧","\\gnsim",!0);Q(se,Qe,et,"⪊","\\gnapprox",!0);Q(se,Qe,et,"⊁","\\nsucc",!0);Q(se,Qe,et,"⋡","\\nsucceq",!0);Q(se,Qe,et,"⋩","\\succnsim",!0);Q(se,Qe,et,"⪺","\\succnapprox",!0);Q(se,Qe,et,"≆","\\ncong",!0);Q(se,Qe,et,"","\\@nshortparallel");Q(se,Qe,et,"∦","\\nparallel",!0);Q(se,Qe,et,"⊯","\\nVDash",!0);Q(se,Qe,et,"⋫","\\ntriangleright");Q(se,Qe,et,"⋭","\\ntrianglerighteq",!0);Q(se,Qe,et,"","\\@nsupseteqq");Q(se,Qe,et,"⊋","\\supsetneq",!0);Q(se,Qe,et,"","\\@varsupsetneq");Q(se,Qe,et,"⫌","\\supsetneqq",!0);Q(se,Qe,et,"","\\@varsupsetneqq");Q(se,Qe,et,"⊮","\\nVdash",!0);Q(se,Qe,et,"⪵","\\precneqq",!0);Q(se,Qe,et,"⪶","\\succneqq",!0);Q(se,Qe,et,"","\\@nsubseteqq");Q(se,Qe,En,"⊴","\\unlhd");Q(se,Qe,En,"⊵","\\unrhd");Q(se,Qe,et,"↚","\\nleftarrow",!0);Q(se,Qe,et,"↛","\\nrightarrow",!0);Q(se,Qe,et,"⇍","\\nLeftarrow",!0);Q(se,Qe,et,"⇏","\\nRightarrow",!0);Q(se,Qe,et,"↮","\\nleftrightarrow",!0);Q(se,Qe,et,"⇎","\\nLeftrightarrow",!0);Q(se,Qe,et,"△","\\vartriangle");Q(se,Qe,ft,"ℏ","\\hslash");Q(se,Qe,ft,"▽","\\triangledown");Q(se,Qe,ft,"◊","\\lozenge");Q(se,Qe,ft,"Ⓢ","\\circledS");Q(se,Qe,ft,"®","\\circledR");Q(qt,Qe,ft,"®","\\circledR");Q(se,Qe,ft,"∡","\\measuredangle",!0);Q(se,Qe,ft,"∄","\\nexists");Q(se,Qe,ft,"℧","\\mho");Q(se,Qe,ft,"Ⅎ","\\Finv",!0);Q(se,Qe,ft,"⅁","\\Game",!0);Q(se,Qe,ft,"‵","\\backprime");Q(se,Qe,ft,"▲","\\blacktriangle");Q(se,Qe,ft,"▼","\\blacktriangledown");Q(se,Qe,ft,"■","\\blacksquare");Q(se,Qe,ft,"⧫","\\blacklozenge");Q(se,Qe,ft,"★","\\bigstar");Q(se,Qe,ft,"∢","\\sphericalangle",!0);Q(se,Qe,ft,"∁","\\complement",!0);Q(se,Qe,ft,"ð","\\eth",!0);Q(qt,Me,ft,"ð","ð");Q(se,Qe,ft,"╱","\\diagup");Q(se,Qe,ft,"╲","\\diagdown");Q(se,Qe,ft,"□","\\square");Q(se,Qe,ft,"□","\\Box");Q(se,Qe,ft,"◊","\\Diamond");Q(se,Qe,ft,"¥","\\yen",!0);Q(qt,Qe,ft,"¥","\\yen",!0);Q(se,Qe,ft,"✓","\\checkmark",!0);Q(qt,Qe,ft,"✓","\\checkmark");Q(se,Qe,ft,"ℶ","\\beth",!0);Q(se,Qe,ft,"ℸ","\\daleth",!0);Q(se,Qe,ft,"ℷ","\\gimel",!0);Q(se,Qe,ft,"ϝ","\\digamma",!0);Q(se,Qe,ft,"ϰ","\\varkappa");Q(se,Qe,uu,"┌","\\@ulcorner",!0);Q(se,Qe,Wl,"┐","\\@urcorner",!0);Q(se,Qe,uu,"└","\\@llcorner",!0);Q(se,Qe,Wl,"┘","\\@lrcorner",!0);Q(se,Qe,et,"≦","\\leqq",!0);Q(se,Qe,et,"⩽","\\leqslant",!0);Q(se,Qe,et,"⪕","\\eqslantless",!0);Q(se,Qe,et,"≲","\\lesssim",!0);Q(se,Qe,et,"⪅","\\lessapprox",!0);Q(se,Qe,et,"≊","\\approxeq",!0);Q(se,Qe,En,"⋖","\\lessdot");Q(se,Qe,et,"⋘","\\lll",!0);Q(se,Qe,et,"≶","\\lessgtr",!0);Q(se,Qe,et,"⋚","\\lesseqgtr",!0);Q(se,Qe,et,"⪋","\\lesseqqgtr",!0);Q(se,Qe,et,"≑","\\doteqdot");Q(se,Qe,et,"≓","\\risingdotseq",!0);Q(se,Qe,et,"≒","\\fallingdotseq",!0);Q(se,Qe,et,"∽","\\backsim",!0);Q(se,Qe,et,"⋍","\\backsimeq",!0);Q(se,Qe,et,"⫅","\\subseteqq",!0);Q(se,Qe,et,"⋐","\\Subset",!0);Q(se,Qe,et,"⊏","\\sqsubset",!0);Q(se,Qe,et,"≼","\\preccurlyeq",!0);Q(se,Qe,et,"⋞","\\curlyeqprec",!0);Q(se,Qe,et,"≾","\\precsim",!0);Q(se,Qe,et,"⪷","\\precapprox",!0);Q(se,Qe,et,"⊲","\\vartriangleleft");Q(se,Qe,et,"⊴","\\trianglelefteq");Q(se,Qe,et,"⊨","\\vDash",!0);Q(se,Qe,et,"⊪","\\Vvdash",!0);Q(se,Qe,et,"⌣","\\smallsmile");Q(se,Qe,et,"⌢","\\smallfrown");Q(se,Qe,et,"≏","\\bumpeq",!0);Q(se,Qe,et,"≎","\\Bumpeq",!0);Q(se,Qe,et,"≧","\\geqq",!0);Q(se,Qe,et,"⩾","\\geqslant",!0);Q(se,Qe,et,"⪖","\\eqslantgtr",!0);Q(se,Qe,et,"≳","\\gtrsim",!0);Q(se,Qe,et,"⪆","\\gtrapprox",!0);Q(se,Qe,En,"⋗","\\gtrdot");Q(se,Qe,et,"⋙","\\ggg",!0);Q(se,Qe,et,"≷","\\gtrless",!0);Q(se,Qe,et,"⋛","\\gtreqless",!0);Q(se,Qe,et,"⪌","\\gtreqqless",!0);Q(se,Qe,et,"≖","\\eqcirc",!0);Q(se,Qe,et,"≗","\\circeq",!0);Q(se,Qe,et,"≜","\\triangleq",!0);Q(se,Qe,et,"∼","\\thicksim");Q(se,Qe,et,"≈","\\thickapprox");Q(se,Qe,et,"⫆","\\supseteqq",!0);Q(se,Qe,et,"⋑","\\Supset",!0);Q(se,Qe,et,"⊐","\\sqsupset",!0);Q(se,Qe,et,"≽","\\succcurlyeq",!0);Q(se,Qe,et,"⋟","\\curlyeqsucc",!0);Q(se,Qe,et,"≿","\\succsim",!0);Q(se,Qe,et,"⪸","\\succapprox",!0);Q(se,Qe,et,"⊳","\\vartriangleright");Q(se,Qe,et,"⊵","\\trianglerighteq");Q(se,Qe,et,"⊩","\\Vdash",!0);Q(se,Qe,et,"∣","\\shortmid");Q(se,Qe,et,"∥","\\shortparallel");Q(se,Qe,et,"≬","\\between",!0);Q(se,Qe,et,"⋔","\\pitchfork",!0);Q(se,Qe,et,"∝","\\varpropto");Q(se,Qe,et,"◀","\\blacktriangleleft");Q(se,Qe,et,"∴","\\therefore",!0);Q(se,Qe,et,"∍","\\backepsilon");Q(se,Qe,et,"▶","\\blacktriangleright");Q(se,Qe,et,"∵","\\because",!0);Q(se,Qe,et,"⋘","\\llless");Q(se,Qe,et,"⋙","\\gggtr");Q(se,Qe,En,"⊲","\\lhd");Q(se,Qe,En,"⊳","\\rhd");Q(se,Qe,et,"≂","\\eqsim",!0);Q(se,Me,et,"⋈","\\Join");Q(se,Qe,et,"≑","\\Doteq",!0);Q(se,Qe,En,"∔","\\dotplus",!0);Q(se,Qe,En,"∖","\\smallsetminus");Q(se,Qe,En,"⋒","\\Cap",!0);Q(se,Qe,En,"⋓","\\Cup",!0);Q(se,Qe,En,"⩞","\\doublebarwedge",!0);Q(se,Qe,En,"⊟","\\boxminus",!0);Q(se,Qe,En,"⊞","\\boxplus",!0);Q(se,Qe,En,"⋇","\\divideontimes",!0);Q(se,Qe,En,"⋉","\\ltimes",!0);Q(se,Qe,En,"⋊","\\rtimes",!0);Q(se,Qe,En,"⋋","\\leftthreetimes",!0);Q(se,Qe,En,"⋌","\\rightthreetimes",!0);Q(se,Qe,En,"⋏","\\curlywedge",!0);Q(se,Qe,En,"⋎","\\curlyvee",!0);Q(se,Qe,En,"⊝","\\circleddash",!0);Q(se,Qe,En,"⊛","\\circledast",!0);Q(se,Qe,En,"⋅","\\centerdot");Q(se,Qe,En,"⊺","\\intercal",!0);Q(se,Qe,En,"⋒","\\doublecap");Q(se,Qe,En,"⋓","\\doublecup");Q(se,Qe,En,"⊠","\\boxtimes",!0);Q(se,Qe,et,"⇢","\\dashrightarrow",!0);Q(se,Qe,et,"⇠","\\dashleftarrow",!0);Q(se,Qe,et,"⇇","\\leftleftarrows",!0);Q(se,Qe,et,"⇆","\\leftrightarrows",!0);Q(se,Qe,et,"⇚","\\Lleftarrow",!0);Q(se,Qe,et,"↞","\\twoheadleftarrow",!0);Q(se,Qe,et,"↢","\\leftarrowtail",!0);Q(se,Qe,et,"↫","\\looparrowleft",!0);Q(se,Qe,et,"⇋","\\leftrightharpoons",!0);Q(se,Qe,et,"↶","\\curvearrowleft",!0);Q(se,Qe,et,"↺","\\circlearrowleft",!0);Q(se,Qe,et,"↰","\\Lsh",!0);Q(se,Qe,et,"⇈","\\upuparrows",!0);Q(se,Qe,et,"↿","\\upharpoonleft",!0);Q(se,Qe,et,"⇃","\\downharpoonleft",!0);Q(se,Me,et,"⊶","\\origof",!0);Q(se,Me,et,"⊷","\\imageof",!0);Q(se,Qe,et,"⊸","\\multimap",!0);Q(se,Qe,et,"↭","\\leftrightsquigarrow",!0);Q(se,Qe,et,"⇉","\\rightrightarrows",!0);Q(se,Qe,et,"⇄","\\rightleftarrows",!0);Q(se,Qe,et,"↠","\\twoheadrightarrow",!0);Q(se,Qe,et,"↣","\\rightarrowtail",!0);Q(se,Qe,et,"↬","\\looparrowright",!0);Q(se,Qe,et,"↷","\\curvearrowright",!0);Q(se,Qe,et,"↻","\\circlearrowright",!0);Q(se,Qe,et,"↱","\\Rsh",!0);Q(se,Qe,et,"⇊","\\downdownarrows",!0);Q(se,Qe,et,"↾","\\upharpoonright",!0);Q(se,Qe,et,"⇂","\\downharpoonright",!0);Q(se,Qe,et,"⇝","\\rightsquigarrow",!0);Q(se,Qe,et,"⇝","\\leadsto");Q(se,Qe,et,"⇛","\\Rrightarrow",!0);Q(se,Qe,et,"↾","\\restriction");Q(se,Me,ft,"‘","`");Q(se,Me,ft,"$","\\$");Q(qt,Me,ft,"$","\\$");Q(qt,Me,ft,"$","\\textdollar");Q(se,Me,ft,"%","\\%");Q(qt,Me,ft,"%","\\%");Q(se,Me,ft,"_","\\_");Q(qt,Me,ft,"_","\\_");Q(qt,Me,ft,"_","\\textunderscore");Q(se,Me,ft,"∠","\\angle",!0);Q(se,Me,ft,"∞","\\infty",!0);Q(se,Me,ft,"′","\\prime");Q(se,Me,ft,"△","\\triangle");Q(se,Me,ft,"Γ","\\Gamma",!0);Q(se,Me,ft,"Δ","\\Delta",!0);Q(se,Me,ft,"Θ","\\Theta",!0);Q(se,Me,ft,"Λ","\\Lambda",!0);Q(se,Me,ft,"Ξ","\\Xi",!0);Q(se,Me,ft,"Π","\\Pi",!0);Q(se,Me,ft,"Σ","\\Sigma",!0);Q(se,Me,ft,"Υ","\\Upsilon",!0);Q(se,Me,ft,"Φ","\\Phi",!0);Q(se,Me,ft,"Ψ","\\Psi",!0);Q(se,Me,ft,"Ω","\\Omega",!0);Q(se,Me,ft,"A","Α");Q(se,Me,ft,"B","Β");Q(se,Me,ft,"E","Ε");Q(se,Me,ft,"Z","Ζ");Q(se,Me,ft,"H","Η");Q(se,Me,ft,"I","Ι");Q(se,Me,ft,"K","Κ");Q(se,Me,ft,"M","Μ");Q(se,Me,ft,"N","Ν");Q(se,Me,ft,"O","Ο");Q(se,Me,ft,"P","Ρ");Q(se,Me,ft,"T","Τ");Q(se,Me,ft,"X","Χ");Q(se,Me,ft,"¬","\\neg",!0);Q(se,Me,ft,"¬","\\lnot");Q(se,Me,ft,"⊤","\\top");Q(se,Me,ft,"⊥","\\bot");Q(se,Me,ft,"∅","\\emptyset");Q(se,Qe,ft,"∅","\\varnothing");Q(se,Me,Zn,"α","\\alpha",!0);Q(se,Me,Zn,"β","\\beta",!0);Q(se,Me,Zn,"γ","\\gamma",!0);Q(se,Me,Zn,"δ","\\delta",!0);Q(se,Me,Zn,"ϵ","\\epsilon",!0);Q(se,Me,Zn,"ζ","\\zeta",!0);Q(se,Me,Zn,"η","\\eta",!0);Q(se,Me,Zn,"θ","\\theta",!0);Q(se,Me,Zn,"ι","\\iota",!0);Q(se,Me,Zn,"κ","\\kappa",!0);Q(se,Me,Zn,"λ","\\lambda",!0);Q(se,Me,Zn,"μ","\\mu",!0);Q(se,Me,Zn,"ν","\\nu",!0);Q(se,Me,Zn,"ξ","\\xi",!0);Q(se,Me,Zn,"ο","\\omicron",!0);Q(se,Me,Zn,"π","\\pi",!0);Q(se,Me,Zn,"ρ","\\rho",!0);Q(se,Me,Zn,"σ","\\sigma",!0);Q(se,Me,Zn,"τ","\\tau",!0);Q(se,Me,Zn,"υ","\\upsilon",!0);Q(se,Me,Zn,"ϕ","\\phi",!0);Q(se,Me,Zn,"χ","\\chi",!0);Q(se,Me,Zn,"ψ","\\psi",!0);Q(se,Me,Zn,"ω","\\omega",!0);Q(se,Me,Zn,"ε","\\varepsilon",!0);Q(se,Me,Zn,"ϑ","\\vartheta",!0);Q(se,Me,Zn,"ϖ","\\varpi",!0);Q(se,Me,Zn,"ϱ","\\varrho",!0);Q(se,Me,Zn,"ς","\\varsigma",!0);Q(se,Me,Zn,"φ","\\varphi",!0);Q(se,Me,En,"∗","*",!0);Q(se,Me,En,"+","+");Q(se,Me,En,"−","-",!0);Q(se,Me,En,"⋅","\\cdot",!0);Q(se,Me,En,"∘","\\circ",!0);Q(se,Me,En,"÷","\\div",!0);Q(se,Me,En,"±","\\pm",!0);Q(se,Me,En,"×","\\times",!0);Q(se,Me,En,"∩","\\cap",!0);Q(se,Me,En,"∪","\\cup",!0);Q(se,Me,En,"∖","\\setminus",!0);Q(se,Me,En,"∧","\\land");Q(se,Me,En,"∨","\\lor");Q(se,Me,En,"∧","\\wedge",!0);Q(se,Me,En,"∨","\\vee",!0);Q(se,Me,ft,"√","\\surd");Q(se,Me,uu,"⟨","\\langle",!0);Q(se,Me,uu,"∣","\\lvert");Q(se,Me,uu,"∥","\\lVert");Q(se,Me,Wl,"?","?");Q(se,Me,Wl,"!","!");Q(se,Me,Wl,"⟩","\\rangle",!0);Q(se,Me,Wl,"∣","\\rvert");Q(se,Me,Wl,"∥","\\rVert");Q(se,Me,et,"=","=");Q(se,Me,et,":",":");Q(se,Me,et,"≈","\\approx",!0);Q(se,Me,et,"≅","\\cong",!0);Q(se,Me,et,"≥","\\ge");Q(se,Me,et,"≥","\\geq",!0);Q(se,Me,et,"←","\\gets");Q(se,Me,et,">","\\gt",!0);Q(se,Me,et,"∈","\\in",!0);Q(se,Me,et,"","\\@not");Q(se,Me,et,"⊂","\\subset",!0);Q(se,Me,et,"⊃","\\supset",!0);Q(se,Me,et,"⊆","\\subseteq",!0);Q(se,Me,et,"⊇","\\supseteq",!0);Q(se,Qe,et,"⊈","\\nsubseteq",!0);Q(se,Qe,et,"⊉","\\nsupseteq",!0);Q(se,Me,et,"⊨","\\models");Q(se,Me,et,"←","\\leftarrow",!0);Q(se,Me,et,"≤","\\le");Q(se,Me,et,"≤","\\leq",!0);Q(se,Me,et,"<","\\lt",!0);Q(se,Me,et,"→","\\rightarrow",!0);Q(se,Me,et,"→","\\to");Q(se,Qe,et,"≱","\\ngeq",!0);Q(se,Qe,et,"≰","\\nleq",!0);Q(se,Me,bp," ","\\ ");Q(se,Me,bp," ","\\space");Q(se,Me,bp," ","\\nobreakspace");Q(qt,Me,bp," ","\\ ");Q(qt,Me,bp," "," ");Q(qt,Me,bp," ","\\space");Q(qt,Me,bp," ","\\nobreakspace");Q(se,Me,bp,null,"\\nobreak");Q(se,Me,bp,null,"\\allowbreak");Q(se,Me,IT,",",",");Q(se,Me,IT,";",";");Q(se,Qe,En,"⊼","\\barwedge",!0);Q(se,Qe,En,"⊻","\\veebar",!0);Q(se,Me,En,"⊙","\\odot",!0);Q(se,Me,En,"⊕","\\oplus",!0);Q(se,Me,En,"⊗","\\otimes",!0);Q(se,Me,ft,"∂","\\partial",!0);Q(se,Me,En,"⊘","\\oslash",!0);Q(se,Qe,En,"⊚","\\circledcirc",!0);Q(se,Qe,En,"⊡","\\boxdot",!0);Q(se,Me,En,"△","\\bigtriangleup");Q(se,Me,En,"▽","\\bigtriangledown");Q(se,Me,En,"†","\\dagger");Q(se,Me,En,"⋄","\\diamond");Q(se,Me,En,"⋆","\\star");Q(se,Me,En,"◃","\\triangleleft");Q(se,Me,En,"▹","\\triangleright");Q(se,Me,uu,"{","\\{");Q(qt,Me,ft,"{","\\{");Q(qt,Me,ft,"{","\\textbraceleft");Q(se,Me,Wl,"}","\\}");Q(qt,Me,ft,"}","\\}");Q(qt,Me,ft,"}","\\textbraceright");Q(se,Me,uu,"{","\\lbrace");Q(se,Me,Wl,"}","\\rbrace");Q(se,Me,uu,"[","\\lbrack",!0);Q(qt,Me,ft,"[","\\lbrack",!0);Q(se,Me,Wl,"]","\\rbrack",!0);Q(qt,Me,ft,"]","\\rbrack",!0);Q(se,Me,uu,"(","\\lparen",!0);Q(se,Me,Wl,")","\\rparen",!0);Q(qt,Me,ft,"<","\\textless",!0);Q(qt,Me,ft,">","\\textgreater",!0);Q(se,Me,uu,"⌊","\\lfloor",!0);Q(se,Me,Wl,"⌋","\\rfloor",!0);Q(se,Me,uu,"⌈","\\lceil",!0);Q(se,Me,Wl,"⌉","\\rceil",!0);Q(se,Me,ft,"\\","\\backslash");Q(se,Me,ft,"∣","|");Q(se,Me,ft,"∣","\\vert");Q(qt,Me,ft,"|","\\textbar",!0);Q(se,Me,ft,"∥","\\|");Q(se,Me,ft,"∥","\\Vert");Q(qt,Me,ft,"∥","\\textbardbl");Q(qt,Me,ft,"~","\\textasciitilde");Q(qt,Me,ft,"\\","\\textbackslash");Q(qt,Me,ft,"^","\\textasciicircum");Q(se,Me,et,"↑","\\uparrow",!0);Q(se,Me,et,"⇑","\\Uparrow",!0);Q(se,Me,et,"↓","\\downarrow",!0);Q(se,Me,et,"⇓","\\Downarrow",!0);Q(se,Me,et,"↕","\\updownarrow",!0);Q(se,Me,et,"⇕","\\Updownarrow",!0);Q(se,Me,$o,"∐","\\coprod");Q(se,Me,$o,"⋁","\\bigvee");Q(se,Me,$o,"⋀","\\bigwedge");Q(se,Me,$o,"⨄","\\biguplus");Q(se,Me,$o,"⋂","\\bigcap");Q(se,Me,$o,"⋃","\\bigcup");Q(se,Me,$o,"∫","\\int");Q(se,Me,$o,"∫","\\intop");Q(se,Me,$o,"∬","\\iint");Q(se,Me,$o,"∭","\\iiint");Q(se,Me,$o,"∏","\\prod");Q(se,Me,$o,"∑","\\sum");Q(se,Me,$o,"⨂","\\bigotimes");Q(se,Me,$o,"⨁","\\bigoplus");Q(se,Me,$o,"⨀","\\bigodot");Q(se,Me,$o,"∮","\\oint");Q(se,Me,$o,"∯","\\oiint");Q(se,Me,$o,"∰","\\oiiint");Q(se,Me,$o,"⨆","\\bigsqcup");Q(se,Me,$o,"∫","\\smallint");Q(qt,Me,Ay,"…","\\textellipsis");Q(se,Me,Ay,"…","\\mathellipsis");Q(qt,Me,Ay,"…","\\ldots",!0);Q(se,Me,Ay,"…","\\ldots",!0);Q(se,Me,Ay,"⋯","\\@cdots",!0);Q(se,Me,Ay,"⋱","\\ddots",!0);Q(se,Me,ft,"⋮","\\varvdots");Q(qt,Me,ft,"⋮","\\varvdots");Q(se,Me,Bs,"ˊ","\\acute");Q(se,Me,Bs,"ˋ","\\grave");Q(se,Me,Bs,"¨","\\ddot");Q(se,Me,Bs,"~","\\tilde");Q(se,Me,Bs,"ˉ","\\bar");Q(se,Me,Bs,"˘","\\breve");Q(se,Me,Bs,"ˇ","\\check");Q(se,Me,Bs,"^","\\hat");Q(se,Me,Bs,"⃗","\\vec");Q(se,Me,Bs,"˙","\\dot");Q(se,Me,Bs,"˚","\\mathring");Q(se,Me,Zn,"","\\@imath");Q(se,Me,Zn,"","\\@jmath");Q(se,Me,ft,"ı","ı");Q(se,Me,ft,"ȷ","ȷ");Q(qt,Me,ft,"ı","\\i",!0);Q(qt,Me,ft,"ȷ","\\j",!0);Q(qt,Me,ft,"ß","\\ss",!0);Q(qt,Me,ft,"æ","\\ae",!0);Q(qt,Me,ft,"œ","\\oe",!0);Q(qt,Me,ft,"ø","\\o",!0);Q(qt,Me,ft,"Æ","\\AE",!0);Q(qt,Me,ft,"Œ","\\OE",!0);Q(qt,Me,ft,"Ø","\\O",!0);Q(qt,Me,Bs,"ˊ","\\'");Q(qt,Me,Bs,"ˋ","\\`");Q(qt,Me,Bs,"ˆ","\\^");Q(qt,Me,Bs,"˜","\\~");Q(qt,Me,Bs,"ˉ","\\=");Q(qt,Me,Bs,"˘","\\u");Q(qt,Me,Bs,"˙","\\.");Q(qt,Me,Bs,"¸","\\c");Q(qt,Me,Bs,"˚","\\r");Q(qt,Me,Bs,"ˇ","\\v");Q(qt,Me,Bs,"¨",'\\"');Q(qt,Me,Bs,"˝","\\H");Q(qt,Me,Bs,"◯","\\textcircled");var uq={"--":!0,"---":!0,"``":!0,"''":!0};Q(qt,Me,ft,"–","--",!0);Q(qt,Me,ft,"–","\\textendash");Q(qt,Me,ft,"—","---",!0);Q(qt,Me,ft,"—","\\textemdash");Q(qt,Me,ft,"‘","`",!0);Q(qt,Me,ft,"‘","\\textquoteleft");Q(qt,Me,ft,"’","'",!0);Q(qt,Me,ft,"’","\\textquoteright");Q(qt,Me,ft,"“","``",!0);Q(qt,Me,ft,"“","\\textquotedblleft");Q(qt,Me,ft,"”","''",!0);Q(qt,Me,ft,"”","\\textquotedblright");Q(se,Me,ft,"°","\\degree",!0);Q(qt,Me,ft,"°","\\degree");Q(qt,Me,ft,"°","\\textdegree",!0);Q(se,Me,ft,"£","\\pounds");Q(se,Me,ft,"£","\\mathsterling",!0);Q(qt,Me,ft,"£","\\pounds");Q(qt,Me,ft,"£","\\textsterling",!0);Q(se,Qe,ft,"✠","\\maltese");Q(qt,Qe,ft,"✠","\\maltese");var uL='0123456789/@."';for(var vA=0;vA<uL.length;vA++){var dL=uL.charAt(vA);Q(se,Me,ft,dL,dL)}var fL='0123456789!@*()-=+";:?/.,';for(var xA=0;xA<fL.length;xA++){var hL=fL.charAt(xA);Q(qt,Me,ft,hL,hL)}var C2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var yA=0;yA<C2.length;yA++){var x4=C2.charAt(yA);Q(se,Me,Zn,x4,x4),Q(qt,Me,ft,x4,x4)}Q(se,Qe,ft,"C","ℂ");Q(qt,Qe,ft,"C","ℂ");Q(se,Qe,ft,"H","ℍ");Q(qt,Qe,ft,"H","ℍ");Q(se,Qe,ft,"N","ℕ");Q(qt,Qe,ft,"N","ℕ");Q(se,Qe,ft,"P","ℙ");Q(qt,Qe,ft,"P","ℙ");Q(se,Qe,ft,"Q","ℚ");Q(qt,Qe,ft,"Q","ℚ");Q(se,Qe,ft,"R","ℝ");Q(qt,Qe,ft,"R","ℝ");Q(se,Qe,ft,"Z","ℤ");Q(qt,Qe,ft,"Z","ℤ");Q(se,Me,Zn,"h","ℎ");Q(qt,Me,Zn,"h","ℎ");var ur="";for(var Pl=0;Pl<C2.length;Pl++){var fo=C2.charAt(Pl);ur=String.fromCharCode(55349,56320+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur),ur=String.fromCharCode(55349,56372+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur),ur=String.fromCharCode(55349,56424+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur),ur=String.fromCharCode(55349,56580+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur),ur=String.fromCharCode(55349,56684+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur),ur=String.fromCharCode(55349,56736+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur),ur=String.fromCharCode(55349,56788+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur),ur=String.fromCharCode(55349,56840+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur),ur=String.fromCharCode(55349,56944+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur),Pl<26&&(ur=String.fromCharCode(55349,56632+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur),ur=String.fromCharCode(55349,56476+Pl),Q(se,Me,Zn,fo,ur),Q(qt,Me,ft,fo,ur))}ur="𝕜";Q(se,Me,Zn,"k",ur);Q(qt,Me,ft,"k",ur);for(var ig=0;ig<10;ig++){var h0=ig.toString();ur=String.fromCharCode(55349,57294+ig),Q(se,Me,Zn,h0,ur),Q(qt,Me,ft,h0,ur),ur=String.fromCharCode(55349,57314+ig),Q(se,Me,Zn,h0,ur),Q(qt,Me,ft,h0,ur),ur=String.fromCharCode(55349,57324+ig),Q(se,Me,Zn,h0,ur),Q(qt,Me,ft,h0,ur),ur=String.fromCharCode(55349,57334+ig),Q(se,Me,Zn,h0,ur),Q(qt,Me,ft,h0,ur)}var wR="ÐÞþ";for(var bA=0;bA<wR.length;bA++){var y4=wR.charAt(bA);Q(se,Me,Zn,y4,y4),Q(qt,Me,ft,y4,y4)}var b4=[["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"]],D1e=function(e,n){var r=e.charCodeAt(0),i=e.charCodeAt(1),s=(r-55296)*1024+(i-56320)+65536,o=n==="math"?0:1;if(119808<=s&&s<120484){var a=Math.floor((s-119808)/26);return[b4[a][2],b4[a][o]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[pL[l][2],pL[l][o]]}else{if(s===120485||s===120486)return[b4[0][2],b4[0][o]];if(120486<s&&s<120782)return["",""];throw new tn("Unsupported character: "+e)}},OT=function(e,n,r){return hs[r][e]&&hs[r][e].replace&&(e=hs[r][e].replace),{value:e,metrics:bk(e,n,r)}},zl=function(e,n,r,i,s){var o=OT(e,n,r),a=o.metrics;e=o.value;var l;if(a){var c=a.italic;(r==="text"||i&&i.font==="mathit")&&(c=0),l=new Yu(e,a.height,a.depth,c,a.skew,a.width,s)}else typeof console<"u"&&console.warn("No character metrics "+("for '"+e+"' in style '"+n+"' and mode '"+r+"'")),l=new Yu(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},Sk=function(e,n,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&OT(e,"Main-Bold",n).metrics?zl(e,"Main-Bold",n,r,i.concat(["mathbf"])):e==="\\"||hs[n][e].font==="main"?zl(e,"Main-Regular",n,r,i):zl(e,"AMS-Regular",n,r,i.concat(["amsrm"]))},I1e=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,o=["mord"],a=i==="math"||i==="text"&&n.font,l=a?n.font:n.fontFamily,c="",d="";if(s.charCodeAt(0)===55349&&([c,d]=D1e(s,i)),c.length>0)return zl(s,c,i,n,o.concat(d));if(l){var h,g;if(l==="boldsymbol"){var v=I1e(s,i,n,o,r);h=v.fontName,g=[v.fontClass]}else a?(h=MR[l].fontName,g=[l]):(h=_4(l,n.fontWeight,n.fontShape),g=[l,n.fontWeight,n.fontShape]);if(OT(s,h,i).metrics)return zl(s,h,i,n,o.concat(g));if(uq.hasOwnProperty(s)&&h.slice(0,10)==="Typewriter"){for(var b=[],_=0;_<s.length;_++)b.push(zl(s[_],h,i,n,o.concat(g)));return _p(b)}}if(r==="mathord")return zl(s,"Math-Italic",i,n,o.concat(["mathnormal"]));if(r==="textord"){var w=hs[i][s]&&hs[i][s].font;if(w==="ams"){var S=_4("amsrm",n.fontWeight,n.fontShape);return zl(s,S,i,n,o.concat("amsrm",n.fontWeight,n.fontShape))}else if(w==="main"||!w){var E=_4("textrm",n.fontWeight,n.fontShape);return zl(s,E,i,n,o.concat(n.fontWeight,n.fontShape))}else{var A=_4(w,n.fontWeight,n.fontShape);return zl(s,A,i,n,o.concat(A,n.fontWeight,n.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},O1e=(t,e)=>{if(K0(t.classes)!==K0(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},dq=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof Yu&&r instanceof Yu&&O1e(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},wk=function(e){for(var n=0,r=0,i=0,s=0;s<e.children.length;s++){var o=e.children[s];o.height>n&&(n=o.height),o.depth>r&&(r=o.depth),o.maxFontSize>i&&(i=o.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=i},Kt=function(e,n,r,i){var s=new pw(e,n,r,i);return wk(s),s},Q0=(t,e,n,r)=>new pw(t,e,n,r),J1=function(e,n,r){var i=Kt([e],[],n);return i.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),i.style.borderBottomWidth=fn(i.height),i.maxFontSize=1,i},L1e=function(e,n,r,i){var s=new _k(e,n,r,i);return wk(s),s},_p=function(e){var n=new hw(e);return wk(n),n},ey=function(e,n){return e instanceof hw?Kt([],[e],n):e},z1e=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],i=-n[0].shift-n[0].elem.depth,s=i,o=1;o<n.length;o++){var a=-n[o].shift-s-n[o].elem.depth,l=a-(n[o-1].elem.height+n[o-1].elem.depth);s=s+a,r.push({type:"kern",size:l}),r.push(n[o])}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}},Ti=function(e,n){for(var{children:r,depth:i}=z1e(e),s=0,o=0;o<r.length;o++){var a=r[o];if(a.type==="elem"){var l=a.elem;s=Math.max(s,l.maxFontSize,l.height)}}s+=2;var c=Kt(["pstrut"],[]);c.style.height=fn(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=Kt(S,[c,w],void 0,E);A.style.top=fn(-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=Kt(["vlist"],d);N.style.height=fn(g);var I;if(h<0){var P=Kt([],[]),L=Kt(["vlist"],[P]);L.style.height=fn(-h);var R=Kt(["vlist-s"],[new Yu("​")]);I=[Kt(["vlist-r"],[N,R]),Kt(["vlist-r"],[L])]}else I=[Kt(["vlist-r"],[N])];var O=Kt(["vlist-t"],I);return I.length===2&&O.classes.push("vlist-t2"),O.height=g,O.depth=-h,O},fq=(t,e)=>{var n=Kt(["mspace"],[],e),r=Js(t,e);return n.style.marginRight=fn(r),n},_4=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"}},hq={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},pq=function(e,n){var[r,i,s]=hq[e],o=new Z0(r),a=new pp([o],{width:fn(i),height:fn(s),style:"width:"+fn(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=Q0(["overlay"],[a],n);return l.height=s,l.style.height=fn(s),l.style.width=fn(i),l},Zs={number:3,unit:"mu"},sg={number:4,unit:"mu"},Gh={number:5,unit:"mu"},j1e={mord:{mop:Zs,mbin:sg,mrel:Gh,minner:Zs},mop:{mord:Zs,mop:Zs,mrel:Gh,minner:Zs},mbin:{mord:sg,mop:sg,mopen:sg,minner:sg},mrel:{mord:Gh,mop:Gh,mopen:Gh,minner:Gh},mopen:{},mclose:{mop:Zs,mbin:sg,mrel:Gh,minner:Zs},mpunct:{mord:Zs,mop:Zs,mrel:Gh,mopen:Zs,mclose:Zs,mpunct:Zs,minner:Zs},minner:{mord:Zs,mop:Zs,mbin:sg,mrel:Gh,mopen:Zs,mpunct:Zs,minner:Zs}},F1e={mord:{mop:Zs},mop:{mord:Zs,mop:Zs},mbin:{},mrel:{},mopen:{},mclose:{mop:Zs},mpunct:{},minner:{mop:Zs}},mq={},A2={},N2={};function _n(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:o}=t,a={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)mq[n[l]]=a;e&&(s&&(A2[e]=s),o&&(N2[e]=o))}function wv(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 R2=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},Eo=function(e){return e.type==="ordgroup"?e.body:[e]},U1e=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),B1e=new Set(["rightmost","mrel","mclose","mpunct"]),H1e={display:mr.DISPLAY,text:mr.TEXT,script:mr.SCRIPT,scriptscript:mr.SCRIPTSCRIPT},V1e={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},oa=function(e,n,r,i){i===void 0&&(i=[null,null]);for(var s=[],o=0;o<e.length;o++){var a=yi(e[o],n);if(a instanceof hw){var l=a.children;s.push(...l)}else s.push(a)}if(dq(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(H1e[d.style]))}var h=Kt([i[0]||"leftmost"],[],n),g=Kt([i[1]||"rightmost"],[],n),v=r==="root";return mL(s,(b,_)=>{var w=_.classes[0],S=b.classes[0];w==="mbin"&&B1e.has(S)?_.classes[0]="mord":S==="mbin"&&U1e.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")?F1e[w][S]:j1e[w][S]:null;if(E)return fq(E,c)},{node:h},g,v),s},mL=function t(e,n,r,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var a=e[o],l=gq(a);if(l){t(l.children,n,r,null,s);continue}var c=!a.hasClass("mspace");if(c){var d=n(a,r.node);d&&(r.insertAfter?r.insertAfter(d):(e.unshift(d),o++))}c?r.node=a:s&&a.hasClass("newline")&&(r.node=Kt(["leftmost"])),r.insertAfter=(h=>g=>{e.splice(h+1,0,g),o++})(o)}i&&e.pop()},gq=function(e){return e instanceof hw||e instanceof _k||e instanceof pw&&e.hasClass("enclosing")?e:null},G1e=function t(e,n){var r=gq(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=G1e(e,n)),V1e[e.classes[0]]||null):null},pS=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return Kt(n.concat(r))},yi=function(e,n,r){if(!e)return Kt();if(A2[e.type]){var i=A2[e.type](e,n);if(r&&n.size!==r.size){i=Kt(n.sizingClasses(r),[i],n);var s=n.sizeMultiplier/r.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new tn("Got group of unknown type: '"+e.type+"'")};function S4(t,e){var n=Kt(["base"],t,e),r=Kt(["strut"]);return r.style.height=fn(n.height+n.depth),n.depth&&(r.style.verticalAlign=fn(-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=oa(t,e,"root"),i;r.length===2&&r[1].hasClass("tag")&&(i=r.pop());for(var s=[],o=[],a=0;a<r.length;a++)if(o.push(r[a]),r[a].hasClass("mbin")||r[a].hasClass("mrel")||r[a].hasClass("allowbreak")){for(var l=!1;a<r.length-1&&r[a+1].hasClass("mspace")&&!r[a+1].hasClass("newline");)a++,o.push(r[a]),r[a].hasClass("nobreak")&&(l=!0);l||(s.push(S4(o,e)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(S4(o,e)),o=[]),s.push(r[a]));o.length>0&&s.push(S4(o,e));var c;n?(c=S4(oa(n,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var d=Kt(["katex-html"],s);if(d.setAttribute("aria-hidden","true"),c){var h=c.children[0];h.style.height=fn(d.height+d.depth),d.depth&&(h.style.verticalAlign=fn(-d.depth))}return d}function vq(t){return new hw(t)}class nn{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=K0(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Go&&this.children[r+1]instanceof Go){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Go;)i+=this.children[++r].toText();e.appendChild(new Go(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(K0(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 Go{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 xq{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",fn(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+fn(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var W1e=new Set(["\\imath","\\jmath"]),$1e=new Set(["mrow","mtable"]),Ku=function(e,n,r){return hs[n][e]&&hs[n][e].replace&&e.charCodeAt(0)!==55349&&!(uq.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 Go(e)},Mk=function(e){return e.length===1?e[0]:new nn("mrow",e)},Tk=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(W1e.has(s))return null;hs[i][s]&&hs[i][s].replace&&(s=hs[i][s].replace);var o=MR[r].fontName;return bk(s,o,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 Go&&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 Go&&n.text===","}else return!1}var Rc=function(e,n,r){if(e.length===1){var i=is(e[0],n);return r&&i instanceof nn&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,a=0;a<e.length;a++){var l=is(e[a],n);if(l instanceof nn&&o instanceof nn){if(l.type==="mtext"&&o.type==="mtext"&&l.getAttribute("mathvariant")===o.getAttribute("mathvariant")){o.children.push(...l.children);continue}else if(l.type==="mn"&&o.type==="mn"){o.children.push(...l.children);continue}else if(_A(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&_A(o))l.children=[...o.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||_A(o))){var c=l.children[0];c instanceof nn&&c.type==="mn"&&(c.children=[...o.children,...c.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var d=o.children[0];if(d instanceof Go&&d.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var h=l.children[0];h instanceof Go&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),s.pop())}}}s.push(l),o=l}return s},J0=function(e,n,r){return Mk(Rc(e,n,r))},is=function(e,n){if(!e)return new nn("mrow");if(N2[e.type]){var r=N2[e.type](e,n);return r}else throw new tn("Got group of unknown type: '"+e.type+"'")};function gL(t,e,n,r,i){var s=Rc(t,n),o;s.length===1&&s[0]instanceof nn&&$1e.has(s[0].type)?o=s[0]:o=new nn("mrow",s);var a=new nn("annotation",[new Go(e)]);a.setAttribute("encoding","application/x-tex");var l=new nn("semantics",[o,a]),c=new nn("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var d=i?"katex":"katex-mathml";return Kt([d],[c])}var yq=function(e){return new Jh({style:e.displayMode?mr.DISPLAY:mr.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},bq=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=Kt(r,[e])}return e},q1e=function(e,n,r){var i=yq(r),s;if(r.output==="mathml")return gL(e,n,i,r.displayMode,!0);if(r.output==="html"){var o=ER(e,i);s=Kt(["katex"],[o])}else{var a=gL(e,n,i,r.displayMode,!1),l=ER(e,i);s=Kt(["katex"],[a,l])}return bq(s,r)},X1e=function(e,n,r){var i=yq(r),s=ER(e,i),o=Kt(["katex"],[s]);return bq(o,r)},Y1e={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 nn("mo",[new Go(Y1e[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},K1e={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]},Z1e=new Set(["widehat","widecheck","widetilde","utilde"]),jT=function(e,n){function r(){var a=4e5,l=e.label.slice(1);if(Z1e.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,a=2364,v=.42,g=l+"4"):(h=312,a=2340,v=.34,g="tilde4");else{var b=[1,1,2,2,3,3][d];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][b],h=[0,239,300,360,420][b],v=[0,.24,.3,.3,.36,.42][b],g=l+b):(a=[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 Z0(g),w=new pp([_],{width:"100%",height:fn(v),viewBox:"0 0 "+a+" "+h,preserveAspectRatio:"none"});return{span:Q0([],[w],n),minWidth:0,height:v}}else{var S=[],E=K1e[l],[A,N,I]=E,P=I/1e3,L=A.length,R,O;if(L===1){var F=E[3];R=["hide-tail"],O=[F]}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 U=0;U<L;U++){var q=new Z0(A[U]),B=new pp([q],{width:"400em",height:fn(P),viewBox:"0 0 "+a+" "+I,preserveAspectRatio:O[U]+" slice"}),Z=Q0([R[U]],[B],n);if(L===1)return{span:Z,minWidth:N,height:P};Z.style.height=fn(P),S.push(Z)}return{span:Kt(["stretchy"],S,n),minWidth:N,height:P}}}var{span:i,minWidth:s,height:o}=r();return i.height=o,i.style.height=fn(o),s>0&&(i.style.minWidth=fn(s)),i},Q1e=function(e,n,r,i,s){var o,a=e.height+e.depth+r+i;if(/fbox|color|angl/.test(n)){if(o=Kt(["stretchy",n],[],s),n==="fbox"){var l=s.color&&s.getColor();l&&(o.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 pp(c,{width:"100%",height:fn(a)});o=Q0([],[d],s)}return o.height=a,o.style.height=fn(a),o};function Ir(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 Ek(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"||P1e.hasOwnProperty(t.type))?t:null}var Ck=(t,e)=>{var n,r,i;t&&t.type==="supsub"?(r=Ir(t.base,"accent"),n=r.base,t.base=n,i=R1e(yi(t,e)),t.base=r):(r=Ir(t,"accent"),n=r.base);var s=yi(n,e.havingCrampedStyle()),o=r.isShifty&&yp(n),a=0;if(o){var l=P_(n),c=yi(l,e.havingCrampedStyle());a=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=Ti({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+fn(2*a)+")",marginLeft:fn(2*a)}:void 0}]});else{var v,b;r.label==="\\vec"?(v=pq("vec",e),b=hq.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=Kt(["accent-body"],[v]);var _=r.label==="\\textcircled";_&&(g.classes.push("accent-full"),h=s.height);var w=a;_||(w-=b/2),g.style.left=fn(w),r.label==="\\textcircled"&&(g.style.top=".2em"),g=Ti({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-h},{type:"elem",elem:g}]})}var S=Kt(["mord","accent"],[g],e);return i?(i.children[0]=S,i.height=Math.max(S.height,i.height),i.classes[0]="mord",i):S},_q=(t,e)=>{var n=t.isStretchy?zT(t.label):new nn("mo",[Ku(t.label,t.mode)]),r=new nn("mover",[is(t.base,e),n]);return r.setAttribute("accent","true"),r},J1e=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=R2(e[0]),r=!J1e.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:Ck,mathmlBuilder:_q});_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:Ck,mathmlBuilder:_q});_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=yi(t.base,e),r=jT(t,e),i=t.label==="\\utilde"?.12:0,s=Ti({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]});return Kt(["mord","accentunder"],[s],e)},mathmlBuilder:(t,e)=>{var n=zT(t.label),r=new nn("munder",[is(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var w4=t=>{var e=new nn("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=ey(yi(t.body,r,e),e),s=t.label.slice(0,2)==="\\x"?"x":"cd";i.classes.push(s+"-arrow-pad");var o;t.below&&(r=e.havingStyle(n.sub()),o=ey(yi(t.below,r,e),e),o.classes.push(s+"-arrow-pad"));var a=jT(t,e),l=-e.fontMetrics().axisHeight+.5*a.height,c=-e.fontMetrics().axisHeight-.5*a.height-.111;(i.depth>.25||t.label==="\\xleftequilibrium")&&(c-=i.depth);var d;if(o){var h=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;d=Ti({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l},{type:"elem",elem:o,shift:h}]})}else d=Ti({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l}]});return d.children[0].children[0].children[1].classes.push("svg-align"),Kt(["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=w4(is(t.body,e));if(t.below){var s=w4(is(t.below,e));r=new nn("munderover",[n,s,i])}else r=new nn("mover",[n,i])}else if(t.below){var o=w4(is(t.below,e));r=new nn("munder",[n,o])}else r=w4(),r=new nn("mover",[n,r]);return r}});function Sq(t,e){var n=oa(t.body,e,!0);return Kt([t.mclass],n,e)}function wq(t,e){var n,r=Rc(t.body,e);return t.mclass==="minner"?n=new nn("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new nn("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new nn("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:Eo(i),isCharacterBox:yp(i)}},htmlBuilder:Sq,mathmlBuilder:wq});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:Eo(e[1]),isCharacterBox:yp(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],o;r!=="\\stackrel"?o=UT(i):o="mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:Eo(i)},l={type:"supsub",mode:s.mode,base:a,sup:r==="\\underset"?null:s,sub:r==="\\underset"?s:null};return{type:"mclass",mode:n.mode,mclass:o,body:[l],isCharacterBox:yp(l)}},htmlBuilder:Sq,mathmlBuilder:wq});_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:Eo(e[0])}},htmlBuilder(t,e){var n=oa(t.body,e,!0),r=Kt([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=Rc(t.body,e),r=new nn("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var eye={">":"\\\\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==="@",tye=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function nye(t,e,n){var r=eye[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"},o=n.callFunction("\\Big",[s],[]),a=n.callFunction("\\\\cdright",[e[1]],[]),l={type:"ordgroup",mode:"math",body:[i,o,a]};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 rye(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 tn("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var o=e[s],a=vL(),l=0;l<o.length;l++)if(!xL(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var c=Ek(o[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<o.length;v++){if(tye(o[v],c)){g=!1,l=v;break}if(xL(o[v]))throw new tn("Missing a "+c+" character to complete a CD arrow.",o[v]);d[h].body.push(o[v])}if(g)throw new tn("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new tn('Expected one of "<>AV=|." after @',o[l]);var b=nye(c,d,t),_={type:"styling",body:[b],mode:"math",style:"display"};r.push(_),a=vL()}s%2===0?r.push(a):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=ey(yi(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=fn(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new nn("mrow",[is(t.label,e)]);return n=new nn("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new nn("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=ey(yi(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new nn("mrow",[is(t.fragment,e)])}});_n({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Ir(e[0],"ordgroup"),i=r.body,s="",o=0;o<i.length;o++){var a=Ir(i[o],"textord");s+=a.text}var l=parseInt(s),c;if(isNaN(l))throw new tn("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new tn("\\@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 Mq=(t,e)=>{var n=oa(t.body,e.withColor(t.color),!1);return _p(n)},Tq=(t,e)=>{var n=Rc(t.body,e.withColor(t.color)),r=new nn("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=Ir(e[0],"color-token").color,i=e[1];return{type:"color",mode:n.mode,color:r,body:Eo(i)}},htmlBuilder:Mq,mathmlBuilder:Tq});_n({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,i=Ir(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:Mq,mathmlBuilder:Tq});_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&&Ir(i,"size").value}},htmlBuilder(t,e){var n=Kt(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=fn(Js(t.size,e)))),n},mathmlBuilder(t,e){var n=new nn("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",fn(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"},Eq=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new tn("Expected a control sequence",t);return e},iye=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},Cq=(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]),Ir(e.parseFunction(),"internal");throw new tn("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 tn("Expected a control sequence",r);for(var s=0,o,a=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){o=e.gullet.future(),a[s].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new tn('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new tn('Argument number "'+r.text+'" out of order');s++,a.push([])}else{if(r.text==="EOF")throw new tn("Expected a macro definition");a[s].push(r.text)}var{tokens:l}=e.gullet.consumeArg();return o&&l.unshift(o),(n==="\\edef"||n==="\\xdef")&&(l=e.gullet.expandTokens(l),l.reverse()),e.gullet.macros.set(i,{tokens:l,numArgs:s,delimiters:a},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=Eq(e.gullet.popToken());e.gullet.consumeSpaces();var i=iye(e);return Cq(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=Eq(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return Cq(e,r,s,n==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var x_=function(e,n,r){var i=hs.math[e]&&hs.math[e].replace,s=bk(i||e,n,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return s},Ak=function(e,n,r,i){var s=r.havingBaseStyle(n),o=Kt(i.concat(s.sizingClasses(r)),[e],r),a=s.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=s.sizeMultiplier,o},Aq=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=fn(s),e.height-=s,e.depth+=s},sye=function(e,n,r,i,s,o){var a=zl(e,"Main-Regular",s,i),l=Ak(a,n,i,o);return Aq(l,i,n),l},oye=function(e,n,r,i){return zl(e,"Size"+n+"-Regular",r,i)},Nq=function(e,n,r,i,s,o){var a=oye(e,n,s,i),l=Ak(Kt(["delimsizing","size"+n],[a],i),mr.TEXT,i,o);return r&&Aq(l,i,mr.TEXT),l},SA=function(e,n,r){var i;n==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=Kt(["delimsizinginner",i],[Kt([],[zl(e,n,r)])]);return{type:"elem",elem:s}},wA=function(e,n,r){var i=Kf["Size4-Regular"][e.charCodeAt(0)]?Kf["Size4-Regular"][e.charCodeAt(0)][4]:Kf["Size1-Regular"][e.charCodeAt(0)][4],s=new Z0("inner",_1e(e,Math.round(1e3*n))),o=new pp([s],{width:fn(i),height:fn(n),style:"width:"+fn(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=Q0([],[o],r);return a.height=n,a.style.height=fn(n),a.style.width=fn(i),{type:"elem",elem:a}},AR=.008,M4={type:"kern",size:-1*AR},aye=new Set(["|","\\lvert","\\rvert","\\vert"]),lye=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),Rq=function(e,n,r,i,s,o){var a,l,c,d,h="",g=0;a=c=d=e,l=null;var v="Size1-Regular";e==="\\uparrow"?c=d="⏐":e==="\\Uparrow"?c=d="‖":e==="\\downarrow"?a=c="⏐":e==="\\Downarrow"?a=c="‖":e==="\\updownarrow"?(a="\\uparrow",c="⏐",d="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",c="‖",d="\\Downarrow"):aye.has(e)?(c="∣",h="vert",g=333):lye.has(e)?(c="∥",h="doublevert",g=556):e==="["||e==="\\lbrack"?(a="⎡",c="⎢",d="⎣",v="Size4-Regular",h="lbrack",g=667):e==="]"||e==="\\rbrack"?(a="⎤",c="⎥",d="⎦",v="Size4-Regular",h="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(c=a="⎢",d="⎣",v="Size4-Regular",h="lfloor",g=667):e==="\\lceil"||e==="⌈"?(a="⎡",c=d="⎢",v="Size4-Regular",h="lceil",g=667):e==="\\rfloor"||e==="⌋"?(c=a="⎥",d="⎦",v="Size4-Regular",h="rfloor",g=667):e==="\\rceil"||e==="⌉"?(a="⎤",c=d="⎥",v="Size4-Regular",h="rceil",g=667):e==="("||e==="\\lparen"?(a="⎛",c="⎜",d="⎝",v="Size4-Regular",h="lparen",g=875):e===")"||e==="\\rparen"?(a="⎞",c="⎟",d="⎠",v="Size4-Regular",h="rparen",g=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",d="⎩",c="⎪",v="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",d="⎭",c="⎪",v="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",d="⎩",c="⎪",v="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",d="⎭",c="⎪",v="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",d="⎭",c="⎪",v="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",d="⎩",c="⎪",v="Size4-Regular");var b=x_(a,v,s),_=b.height+b.depth,w=x_(c,v,s),S=w.height+w.depth,E=x_(d,v,s),A=E.height+E.depth,N=0,I=1;if(l!==null){var P=x_(l,v,s);N=P.height+P.depth,I=2}var L=_+A+N,R=Math.max(0,Math.ceil((n-L)/(I*S))),O=L+R*I*S,F=i.fontMetrics().axisHeight;r&&(F*=i.sizeMultiplier);var U=O/2-F,q=[];if(h.length>0){var B=O-_-A,Z=Math.round(O*1e3),G=S1e(h,Math.round(B*1e3)),$=new Z0(h,G),K=(g/1e3).toFixed(3)+"em",Y=(Z/1e3).toFixed(3)+"em",J=new pp([$],{width:K,height:Y,viewBox:"0 0 "+g+" "+Z}),H=Q0([],[J],i);H.height=Z/1e3,H.style.width=K,H.style.height=Y,q.push({type:"elem",elem:H})}else{if(q.push(SA(d,v,s)),q.push(M4),l===null){var z=O-_-A+2*AR;q.push(wA(c,z,i))}else{var X=(O-_-A-N)/2+2*AR;q.push(wA(c,X,i)),q.push(M4),q.push(SA(l,v,s)),q.push(M4),q.push(wA(c,X,i))}q.push(M4),q.push(SA(a,v,s))}var V=i.havingBaseStyle(mr.TEXT),ie=Ti({positionType:"bottom",positionData:U,children:q});return Ak(Kt(["delimsizing","mult"],[ie],V),mr.TEXT,i,o)},MA=80,TA=.08,EA=function(e,n,r,i,s){var o=b1e(e,i,r),a=new Z0(e,o),l=new pp([a],{width:"400em",height:fn(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return Q0(["hide-tail"],[l],s)},cye=function(e,n){var r=n.havingBaseSizing(),i=Oq("\\surd",e*r.sizeMultiplier,Iq,r),s=r.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l=0,c=0,d=0,h;return i.type==="small"?(d=1e3+1e3*o+MA,e<1?s=1:e<1.4&&(s=.7),l=(1+o+TA)/s,c=(1+o)/s,a=EA("sqrtMain",l,d,o,n),a.style.minWidth="0.853em",h=.833/s):i.type==="large"?(d=(1e3+MA)*D_[i.size],c=(D_[i.size]+o)/s,l=(D_[i.size]+o+TA)/s,a=EA("sqrtSize"+i.size,l,d,o,n),a.style.minWidth="1.02em",h=1/s):(l=e+o+TA,c=e+o,d=Math.floor(1e3*e+o)+MA,a=EA("sqrtTall",l,d,o,n),a.style.minWidth="0.742em",h=1.056),a.height=c,a.style.height=fn(l),{span:a,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*s}},kq=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),uye=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),Pq=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),D_=[0,1.2,1.8,2.4,3],Dq=function(e,n,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),kq.has(e)||Pq.has(e))return Nq(e,n,!1,r,i,s);if(uye.has(e))return Rq(e,D_[n],!1,r,i,s);throw new tn("Illegal delimiter: '"+e+"'")},dye=[{type:"small",style:mr.SCRIPTSCRIPT},{type:"small",style:mr.SCRIPT},{type:"small",style:mr.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],fye=[{type:"small",style:mr.SCRIPTSCRIPT},{type:"small",style:mr.SCRIPT},{type:"small",style:mr.TEXT},{type:"stack"}],Iq=[{type:"small",style:mr.SCRIPTSCRIPT},{type:"small",style:mr.SCRIPT},{type:"small",style:mr.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],hye=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.")},Oq=function(e,n,r,i){for(var s=Math.min(2,3-i.style.size),o=s;o<r.length&&r[o].type!=="stack";o++){var a=x_(e,hye(r[o]),"math"),l=a.height+a.depth;if(r[o].type==="small"){var c=i.havingBaseStyle(r[o].style);l*=c.sizeMultiplier}if(l>n)return r[o]}return r[r.length-1]},NR=function(e,n,r,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;Pq.has(e)?a=dye:kq.has(e)?a=Iq:a=fye;var l=Oq(e,n,a,i);return l.type==="small"?sye(e,l.style,r,i,s,o):l.type==="large"?Nq(e,l.size,r,i,s,o):Rq(e,n,r,i,s,o)},CA=function(e,n,r,i,s,o){var a=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,c=5/i.fontMetrics().ptPerEm,d=Math.max(n-a,r+a),h=Math.max(d/500*l,2*d-c);return NR(e,h,!0,i,s,o)},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}},pye=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&&pye.has(n.text))return n;throw n?new tn("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new tn("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==="."?Kt([t.mclass]):Dq(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(Ku(t.delim,t.mode));var n=new nn("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=fn(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 tn("\\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=Ir(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=oa(t.body,e,!0,["mopen","mclose"]),r=0,i=0,s=!1,o=0;o<n.length;o++)n[o].isMiddle?s=!0:(r=Math.max(n[o].height,r),i=Math.max(n[o].depth,i));r*=e.sizeMultiplier,i*=e.sizeMultiplier;var a;if(t.left==="."?a=pS(e,["mopen"]):a=CA(t.left,r,i,e,t.mode,["mopen"]),n.unshift(a),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=pS(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),Kt(["minner"],n,e)},mathmlBuilder:(t,e)=>{bL(t);var n=Rc(t.body,e);if(t.left!=="."){var r=new nn("mo",[Ku(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var i=new nn("mo",[Ku(t.right,t.mode)]);i.setAttribute("fence","true"),t.rightColor&&i.setAttribute("mathcolor",t.rightColor),n.push(i)}return Mk(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 tn("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=pS(e,[]);else{n=Dq(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==="|"?Ku("|","text"):Ku(t.delim,t.mode),r=new nn("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var Nk=(t,e)=>{var n=ey(yi(t.body,e),e),r=t.label.slice(1),i=e.sizeMultiplier,s,o=0,a=yp(t.body);if(r==="sout")s=Kt(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.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=fn(h/2+l);var g=Math.floor(1e3*h*i),v=x1e(g),b=new pp([new Z0("phase",v)],{width:"400em",height:fn(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});s=Q0(["hide-tail"],[b],e),s.style.height=fn(h),o=n.depth+l+c}else{/cancel/.test(r)?a||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)):(_=a?.2:0,w=_),s=Q1e(n,r,_,w,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=fn(S)):r==="angl"&&S!==.049&&(s.style.borderTopWidth=fn(S),s.style.borderRightWidth=fn(S)),o=n.depth+w,t.backgroundColor&&(s.style.backgroundColor=t.backgroundColor,t.borderColor&&(s.style.borderColor=t.borderColor))}var E;if(t.backgroundColor)E=Ti({positionType:"individualShift",children:[{type:"elem",elem:s,shift:o},{type:"elem",elem:n,shift:0}]});else{var A=/cancel|phase/.test(r)?["svg-align"]:[];E=Ti({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:s,shift:o,wrapperClasses:A}]})}return/cancel/.test(r)&&(E.height=n.height,E.depth=n.depth),/cancel/.test(r)&&!a?Kt(["mord","cancel-lap"],[E],e):Kt(["mord"],[E],e)},Rk=(t,e)=>{var n=0,r=new nn(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=Ir(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:Nk,mathmlBuilder:Rk});_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=Ir(e[0],"color-token").color,o=Ir(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,borderColor:s,body:a}},htmlBuilder:Nk,mathmlBuilder:Rk});_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:Nk,mathmlBuilder:Rk});_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 Lq={};function hh(t){for(var{type:e,names:n,props:r,handler:i,htmlBuilder:s,mathmlBuilder:o}=t,a={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:i},l=0;l<n.length;++l)Lq[n[l]]=a;s&&(A2[e]=s),o&&(N2[e]=o)}var zq={};function Ie(t,e){zq[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 tn("{"+t.envName+"} can be used only in display mode.")},mye=new Set(["gather","gather*"]);function kk(t){if(!t.includes("ed"))return!t.includes("*")}function mm(t,e,n){var{hskipBeforeAndAfter:r,addJot:i,cols:s,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:d,maxNumCols:h,leqno:g}=e;if(t.gullet.beginGroup(),c||t.gullet.macros.set("\\cr","\\\\\\relax"),!o){var v=t.gullet.expandMacroAsText("\\arraystretch");if(v==null)o=1;else if(o=parseFloat(v),!o||o<0)throw new tn("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 nu("\\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 I=t.parseExpression(!1,c?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),I={type:"ordgroup",mode:t.mode,body:I},n&&(I={type:"styling",mode:t.mode,style:n,body:[I]}),b.push(I);var P=t.fetch().text;if(P==="&"){if(h&&b.length===h){if(c||a)throw new tn("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&&I.type==="styling"&&I.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 tn("Expected & or \\\\ or \\cr or \\end",t.nextToken)}return t.gullet.endGroup(),t.gullet.endGroup(),{type:"array",mode:t.mode,addJot:i,arraystretch:o,body:_,cols:s,rowGaps:w,hskipBeforeAndAfter:r,hLinesBeforeRow:S,colSeparationType:a,tags:E,leqno:g}}function Pk(t){return t.slice(0,1)==="d"?"display":"text"}var ph=function(e,n){var r,i,s=e.body.length,o=e.hLinesBeforeRow,a=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(mr.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(je){for(var be=0;be<je.length;++be)be>0&&(A+=.25),c.push({pos:A,isDashed:je[be]})}for(N(o[0]),r=0;r<e.body.length;++r){var I=e.body[r],P=S,L=E;a<I.length&&(a=I.length);var R=new Array(I.length);for(i=0;i<I.length;++i){var O=yi(I[i],n);L<O.depth&&(L=O.depth),P<O.height&&(P=O.height),R[i]=O}var F=e.rowGaps[r],U=0;F&&(U=Js(F,n),U>0&&(U+=E,L<U&&(L=U),U=0)),e.addJot&&(L+=_),R.height=P,R.depth=L,A+=P,R.pos=A,A+=L+U,l[r]=R,N(o[r+1])}var q=A/2+n.fontMetrics().axisHeight,B=e.cols||[],Z=[],G,$,K=[];if(e.tags&&e.tags.some(je=>je))for(r=0;r<s;++r){var Y=l[r],J=Y.pos-q,H=e.tags[r],z=void 0;H===!0?z=Kt(["eqn-num"],[],n):H===!1?z=Kt([],[],n):z=Kt([],oa(H,n,!0),n),z.depth=Y.depth,z.height=Y.height,K.push({type:"elem",elem:z,shift:J})}for(i=0,$=0;i<a||$<B.length;++i,++$){for(var X=B[$]||{},V=!0;X.type==="separator";){if(V||(G=Kt(["arraycolsep"],[]),G.style.width=fn(n.fontMetrics().doubleRuleSep),Z.push(G)),X.separator==="|"||X.separator===":"){var ie=X.separator==="|"?"solid":"dashed",ae=Kt(["vertical-separator"],[],n);ae.style.height=fn(A),ae.style.borderRightWidth=fn(d),ae.style.borderRightStyle=ie,ae.style.margin="0 "+fn(-d/2);var re=A-q;re&&(ae.style.verticalAlign=fn(-re)),Z.push(ae)}else throw new tn("Invalid separator type: "+X.separator);$++,X=B[$]||{},V=!1}if(!(i>=a)){var ce=void 0;if(i>0||e.hskipBeforeAndAfter){var oe;ce=(oe=X.pregap)!=null?oe:g,ce!==0&&(G=Kt(["arraycolsep"],[]),G.style.width=fn(ce),Z.push(G))}var fe=[];for(r=0;r<s;++r){var me=l[r],ye=me[i];if(ye){var Ee=me.pos-q;ye.depth=me.depth,ye.height=me.height,fe.push({type:"elem",elem:ye,shift:Ee})}}if(fe=Ti({positionType:"individualShift",children:fe}),fe=Kt(["col-align-"+(X.align||"c")],[fe]),Z.push(fe),i<a-1||e.hskipBeforeAndAfter){var Ge;ce=(Ge=X.postgap)!=null?Ge:g,ce!==0&&(G=Kt(["arraycolsep"],[]),G.style.width=fn(ce),Z.push(G))}}}if(l=Kt(["mtable"],Z),c.length>0){for(var _e=J1("hline",n,d),De=J1("hdashline",n,d),he=[{type:"elem",elem:l,shift:0}];c.length>0;){var Le=c.pop(),ne=Le.pos-q;Le.isDashed?he.push({type:"elem",elem:De,shift:ne}):he.push({type:"elem",elem:_e,shift:ne})}l=Ti({positionType:"individualShift",children:he})}if(K.length===0)return Kt(["mord"],[l],n);var We=Ti({positionType:"individualShift",children:K});return We=Kt(["tag"],[We],n),_p([l,We])},gye={c:"center ",l:"left ",r:"right "},mh=function(e,n){for(var r=[],i=new nn("mtd",[],["mtr-glue"]),s=new nn("mtd",[],["mml-eqn-num"]),o=0;o<e.body.length;o++){for(var a=e.body[o],l=[],c=0;c<a.length;c++)l.push(new nn("mtd",[is(a[c],n)]));e.tags&&e.tags[o]&&(l.unshift(i),l.push(i),e.leqno?l.unshift(s):l.push(s)),r.push(new nn("mtr",l))}var d=new nn("mtable",r),h=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);d.setAttribute("rowspacing",fn(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+=gye[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||[],I="",P=1;P<N.length;P++)I+=P%2?"0em ":"1em ";d.setAttribute("columnspacing",I.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 nn("menclose",[d]),d.setAttribute("notation",g.trim())),e.arraystretch&&e.arraystretch<1&&(d=new nn("mstyle",[d]),d.setAttribute("scriptlevel","1")),d},jq=function(e,n){e.envName.includes("ed")||HT(e);var r=[],i=e.envName.includes("at")?"alignat":"align",s=e.envName==="split",o=mm(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:kk(e.envName),emptySingleRow:!0,colSeparationType:i,maxNumCols:s?2:void 0,leqno:e.parser.settings.leqno},"display"),a,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=Ir(n[0].body[h],"textord");d+=g.text}a=Number(d),l=a*2}var v=!l;o.body.forEach(function(S){for(var E=1;E<S.length;E+=2){var A=Ir(S[E],"styling"),N=Ir(A.body[0],"ordgroup");N.body.unshift(c)}if(v)l<S.length&&(l=S.length);else{var I=S.length/2;if(a<I)throw new tn("Too many math in a row: "+("expected "+a+", but got "+I),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 o.colSeparationType=v?"align":"alignat",o};hh({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=FT(e[0]),r=n?[e[0]]:Ir(e[0],"ordgroup").body,i=r.map(function(o){var a=Ek(o),l=a.text;if("lcr".includes(l))return{type:"align",align:l};if(l==="|")return{type:"separator",separator:"|"};if(l===":")return{type:"separator",separator:":"};throw new tn("Unknown column alignment: "+l,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return mm(t.parser,s,Pk(t.envName))},htmlBuilder:ph,mathmlBuilder:mh});hh({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 tn("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var s=mm(t.parser,r,Pk(t.envName)),o=Math.max(0,...s.body.map(a=>a.length));return s.cols=new Array(o).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[s],left:e[0],right:e[1],rightColor:void 0}:s},htmlBuilder:ph,mathmlBuilder:mh});hh({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=mm(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:ph,mathmlBuilder:mh});hh({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=FT(e[0]),r=n?[e[0]]:Ir(e[0],"ordgroup").body,i=r.map(function(o){var a=Ek(o),l=a.text;if("lc".includes(l))return{type:"align",align:l};throw new tn("Unknown column alignment: "+l,o)});if(i.length>1)throw new tn("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=mm(t.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new tn("{subarray} can contain only one column");return s},htmlBuilder:ph,mathmlBuilder:mh});hh({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=mm(t.parser,e,Pk(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:ph,mathmlBuilder:mh});hh({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:jq,htmlBuilder:ph,mathmlBuilder:mh});hh({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){mye.has(t.envName)&&HT(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:kk(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return mm(t.parser,e,"display")},htmlBuilder:ph,mathmlBuilder:mh});hh({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:jq,htmlBuilder:ph,mathmlBuilder:mh});hh({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){HT(t);var e={autoTag:kk(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return mm(t.parser,e,"display")},htmlBuilder:ph,mathmlBuilder:mh});hh({type:"array",names:["CD"],props:{numArgs:0},handler(t){return HT(t),rye(t.parser)},htmlBuilder:ph,mathmlBuilder:mh});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 tn(t.funcName+" valid only within array environment")}});var SL=Lq;_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 tn("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=Ir(i.body[o],"textord").text;if(r==="\\begin"){if(!SL.hasOwnProperty(s))throw new tn("No such environment: "+s,i);var a=SL[s],{args:l,optArgs:c}=n.parseArguments("\\begin{"+s+"}",a),d={mode:n.mode,envName:s,parser:n},h=a.handler(d,l,c);n.expect("\\end",!1);var g=n.nextToken,v=Ir(n.parseFunction(),"environment");if(v.name!==s)throw new tn("Mismatch: \\begin{"+s+"} matched by \\end{"+v.name+"}",g);return h}return{type:"environment",mode:n.mode,name:s,nameGroup:i}}});var Fq=(t,e)=>{var n=t.font,r=e.withFont(n);return yi(t.body,r)},Uq=(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=R2(e[0]),s=r;return s in wL&&(s=wL[s]),{type:"font",mode:n.mode,font:s.slice(1),body:i}},htmlBuilder:Fq,mathmlBuilder:Uq});_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:yp(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,o=n.parseExpression(!0,i),a="math"+r.slice(1);return{type:"font",mode:s,font:a,body:{type:"ordgroup",mode:n.mode,body:o}}},htmlBuilder:Fq,mathmlBuilder:Uq});var vye=(t,e)=>{var n=e.style,r=n.fracNum(),i=n.fracDen(),s;s=e.havingStyle(r);var o=yi(t.numer,s,e);if(t.continued){var a=8.5/e.fontMetrics().ptPerEm,l=3.5/e.fontMetrics().ptPerEm;o.height=o.height<a?a:o.height,o.depth=o.depth<l?l:o.depth}s=e.havingStyle(i);var c=yi(t.denom,s,e),d,h,g;t.hasBarLine?(t.barSize?(h=Js(t.barSize,e),d=J1("frac-line",e,h)):d=J1("frac-line",e),h=d.height,g=d.height):(d=null,h=0,g=e.fontMetrics().defaultRuleThickness);var v,b,_;n.size===mr.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-o.depth-(E+.5*h)<b&&(v+=b-(v-o.depth-(E+.5*h))),E-.5*h-(c.height-_)<b&&(_+=b-(E-.5*h-(c.height-_)));var A=-(E-.5*h);w=Ti({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:d,shift:A},{type:"elem",elem:o,shift:-v}]})}else{var S=v-o.depth-(c.height-_);S<b&&(v+=.5*(b-S),_+=.5*(b-S)),w=Ti({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:o,shift:-v}]})}s=e.havingStyle(n),w.height*=s.sizeMultiplier/e.sizeMultiplier,w.depth*=s.sizeMultiplier/e.sizeMultiplier;var N;n.size===mr.DISPLAY.size?N=e.fontMetrics().delim1:n.size===mr.SCRIPTSCRIPT.size?N=e.havingStyle(mr.SCRIPT).fontMetrics().delim2:N=e.fontMetrics().delim2;var I,P;return t.leftDelim==null?I=pS(e,["mopen"]):I=NR(t.leftDelim,N,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?P=Kt([]):t.rightDelim==null?P=pS(e,["mclose"]):P=NR(t.rightDelim,N,!0,e.havingStyle(n),t.mode,["mclose"]),Kt(["mord"].concat(s.sizingClasses(e)),[I,Kt(["mfrac"],[w]),P],e)},xye=(t,e)=>{var n=new nn("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",fn(r))}if(t.leftDelim!=null||t.rightDelim!=null){var i=[];if(t.leftDelim!=null){var s=new nn("mo",[new Go(t.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}if(i.push(n),t.rightDelim!=null){var o=new nn("mo",[new Go(t.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),i.push(o)}return Mk(i)}return n},Bq=(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],o,a=null,l=null;switch(r){case"\\cfrac":case"\\dfrac":case"\\frac":case"\\tfrac":o=!0;break;case"\\\\atopfrac":o=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":o=!1,a="(",l=")";break;case"\\\\bracefrac":o=!1,a="\\{",l="\\}";break;case"\\\\brackfrac":o=!1,a="[",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"),Bq({type:"genfrac",mode:n.mode,numer:i,denom:s,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},d)},htmlBuilder:vye,mathmlBuilder:xye});_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=R2(e[0]),o=s.type==="atom"&&s.family==="open"?TL(s.text):null,a=R2(e[1]),l=a.type==="atom"&&a.family==="close"?TL(a.text):null,c=Ir(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=Ir(v.body[0],"textord");g=ML[Number(b.text)]}}else v=Ir(v,"textord"),g=ML[Number(v.text)];return Bq({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:d,barSize:h,leftDelim:o,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:Ir(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=Ir(e[1],"infix").size;if(!s)throw new Error("\\\\abovefrac expected size, but got "+String(s));var o=e[2],a=s.number>0;return{type:"genfrac",mode:n.mode,numer:i,denom:o,continued:!1,hasBarLine:a,barSize:s,leftDelim:null,rightDelim:null}}});var Hq=(t,e)=>{var n=e.style,r,i;t.type==="supsub"?(r=t.sup?yi(t.sup,e.havingStyle(n.sup()),e):yi(t.sub,e.havingStyle(n.sub()),e),i=Ir(t.base,"horizBrace")):i=Ir(t,"horizBrace");var s=yi(i.base,e.havingBaseStyle(mr.DISPLAY)),o=jT(i,e),a;if(i.isOver?(a=Ti({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:.1},{type:"elem",elem:o}]}),a.children[0].children[0].children[1].classes.push("svg-align")):(a=Ti({positionType:"bottom",positionData:s.depth+.1+o.height,children:[{type:"elem",elem:o},{type:"kern",size:.1},{type:"elem",elem:s}]}),a.children[0].children[0].children[0].classes.push("svg-align")),r){var l=Kt(["mord",i.isOver?"mover":"munder"],[a],e);i.isOver?a=Ti({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=Ti({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return Kt(["mord",i.isOver?"mover":"munder"],[a],e)},yye=(t,e)=>{var n=zT(t.label);return new nn(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:Hq,mathmlBuilder:yye});_n({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],i=Ir(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:Eo(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=oa(t.body,e,!1);return L1e(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=J0(t.body,e);return n instanceof nn||(n=new nn("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=Ir(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 o=r[s];o==="~"&&(o="\\textasciitilde"),i.push({type:"textord",mode:"text",text:o})}var a={type:"text",mode:n.mode,font:"\\texttt",body:i};return{type:"href",mode:n.mode,href:r,body:Eo(a)}}});_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:Eo(e[0])}},htmlBuilder(t,e){var n=oa(t.body,e,!1);return _p(n)},mathmlBuilder(t,e){return new nn("mrow",Rc(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=Ir(e[0],"raw").string,o=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var a,l={};switch(r){case"\\htmlClass":l.class=s,a={command:"\\htmlClass",class:s};break;case"\\htmlId":l.id=s,a={command:"\\htmlId",id:s};break;case"\\htmlStyle":l.style=s,a={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 tn("\\htmlData key/value '"+h+"' missing equals sign");var v=h.slice(0,g),b=h.slice(g+1);l["data-"+v.trim()]=b}a={command:"\\htmlData",attributes:l};break}default:throw new Error("Unrecognized html command")}return n.settings.isTrusted(a)?{type:"html",mode:n.mode,attributes:l,body:Eo(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var n=oa(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var i=Kt(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)=>J0(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:Eo(e[0]),mathml:Eo(e[1])}},htmlBuilder:(t,e)=>{var n=oa(t.html,e,!1);return _p(n)},mathmlBuilder:(t,e)=>J0(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 tn("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!oq(r))throw new tn("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"},o={number:0,unit:"em"},a="";if(n[0])for(var l=Ir(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":a=g;break;case"width":i=AA(g);break;case"height":s=AA(g);break;case"totalheight":o=AA(g);break;default:throw new tn("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var v=Ir(e[0],"url").url;return a===""&&(a=v,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:v})?{type:"includegraphics",mode:r.mode,alt:a,width:i,height:s,totalheight:o,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:fn(n+r)};i>0&&(s.width=fn(i)),r>0&&(s.verticalAlign=fn(-r));var o=new A1e(t.src,t.alt,s);return o.height=n,o.depth=r,o},mathmlBuilder:(t,e)=>{var n=new nn("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",fn(-i))),n.setAttribute("height",fn(r+i)),t.width.number>0){var s=Js(t.width,e);n.setAttribute("width",fn(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=Ir(e[0],"size");if(n.settings.strict){var s=r[1]==="m",o=i.value.unit==="mu";s?(o||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")):o&&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 fq(t.dimension,e)},mathmlBuilder(t,e){var n=Js(t.dimension,e);return new xq(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=Kt([],[yi(t.body,e)]),n=Kt(["inner"],[n],e)):n=Kt(["inner"],[yi(t.body,e)]);var r=Kt(["fix"],[]),i=Kt([t.alignment],[n,r],e),s=Kt(["strut"]);return s.style.height=fn(i.height+i.depth),i.depth&&(s.style.verticalAlign=fn(-i.depth)),i.children.unshift(s),i=Kt(["thinbox"],[i],e),Kt(["mord","vbox"],[i],e)},mathmlBuilder:(t,e)=>{var n=new nn("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==="\\("?"\\)":"$",o=r.parseExpression(!1,s);return r.expect(s),r.switchMode(i),{type:"styling",mode:r.mode,style:"text",body:o}}});_n({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new tn("Mismatched "+t.funcName)}});var EL=(t,e)=>{switch(e.style.size){case mr.DISPLAY.size:return t.display;case mr.TEXT.size:return t.text;case mr.SCRIPT.size:return t.script;case mr.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:Eo(e[0]),text:Eo(e[1]),script:Eo(e[2]),scriptscript:Eo(e[3])}},htmlBuilder:(t,e)=>{var n=EL(t,e),r=oa(n,e,!1);return _p(r)},mathmlBuilder:(t,e)=>{var n=EL(t,e);return J0(n,e)}});var Vq=(t,e,n,r,i,s,o)=>{t=Kt([],[t]);var a=n&&yp(n),l,c;if(e){var d=yi(e,r.havingStyle(i.sup()),r);c={elem:d,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-d.depth)}}if(n){var h=yi(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+o;g=Ti({positionType:"bottom",positionData:v,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:fn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:fn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var b=t.height-o;g=Ti({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:fn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(c){var _=t.depth+o;g=Ti({positionType:"bottom",positionData:_,children:[{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:fn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return t;var w=[g];if(l&&s!==0&&!a){var S=Kt(["mspace"],[],r);S.style.marginRight=fn(s),w.unshift(S)}return Kt(["mop","op-limits"],w,r)},Gq=new Set(["\\smallint"]),Ny=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Ir(t.base,"op"),i=!0):s=Ir(t,"op");var o=e.style,a=!1;o.size===mr.DISPLAY.size&&s.symbol&&!Gq.has(s.name)&&(a=!0);var l;if(s.symbol){var c=a?"Size2-Regular":"Size1-Regular",d="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(d=s.name.slice(1),s.name=d==="oiint"?"\\iint":"\\iiint"),l=zl(s.name,c,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),d.length>0){var h=l.italic,g=pq(d+"Size"+(a?"2":"1"),e);l=Ti({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:g,shift:a?.08:0}]}),s.name="\\"+d,l.classes.unshift("mop"),l.italic=h}}else if(s.body){var v=oa(s.body,e,!0);v.length===1&&v[0]instanceof Yu?(l=v[0],l.classes[0]="mop"):l=Kt(["mop"],v,e)}else{for(var b=[],_=1;_<s.name.length;_++)b.push(Sk(s.name[_],s.mode,e));l=Kt(["mop"],b,e)}var w=0,S=0;return(l instanceof Yu||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(w=(l.height-l.depth)/2-e.fontMetrics().axisHeight,S=l.italic),i?Vq(l,n,r,e,o,S,w):(w&&(l.style.position="relative",l.style.top=fn(w)),l)},mw=(t,e)=>{var n;if(t.symbol)n=new nn("mo",[Ku(t.name,t.mode)]),Gq.has(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new nn("mo",Rc(t.body,e));else{n=new nn("mi",[new Go(t.name.slice(1))]);var r=new nn("mo",[Ku("⁡","text")]);t.parentIsSupSub?n=new nn("mrow",[n,r]):n=vq([n,r])}return n},bye={"∏":"\\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=bye[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:Ny,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:Eo(r)}},htmlBuilder:Ny,mathmlBuilder:mw});var _ye={"∫":"\\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:Ny,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:Ny,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=_ye[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Ny,mathmlBuilder:mw});var Wq=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Ir(t.base,"operatorname"),i=!0):s=Ir(t,"operatorname");var o;if(s.body.length>0){for(var a=s.body.map(h=>{var g=h.text;return typeof g=="string"?{type:"textord",mode:h.mode,text:g}:h}),l=oa(a,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var d=l[c];d instanceof Yu&&(d.text=d.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=Kt(["mop"],l,e)}else o=Kt(["mop"],[],e);return i?Vq(o,n,r,e,e.style,0,0):o},Sye=(t,e)=>{for(var n=Rc(t.body,e.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var s=n[i];if(!(s instanceof xq))if(s instanceof nn)switch(s.type){case"mi":case"mn":case"ms":case"mspace":case"mtext":break;case"mo":{var o=s.children[0];s.children.length===1&&o instanceof Go?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var a=n.map(d=>d.toText()).join("");n=[new Go(a)]}var l=new nn("mi",n);l.setAttribute("mathvariant","normal");var c=new nn("mo",[Ku("⁡","text")]);return t.parentIsSupSub?new nn("mrow",[l,c]):vq([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:Eo(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:Wq,mathmlBuilder:Sye});Ie("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");wv({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?_p(oa(t.body,e,!1)):Kt(["mord"],oa(t.body,e,!0),e)},mathmlBuilder(t,e){return J0(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=yi(t.body,e.havingCrampedStyle()),r=J1("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Ti({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]});return Kt(["mord","overline"],[s],e)},mathmlBuilder(t,e){var n=new nn("mo",[new Go("‾")]);n.setAttribute("stretchy","true");var r=new nn("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:Eo(r)}},htmlBuilder:(t,e)=>{var n=oa(t.body,e.withPhantom(),!1);return _p(n)},mathmlBuilder:(t,e)=>{var n=Rc(t.body,e);return new nn("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=Kt([],[yi(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=Ti({positionType:"firstBaseline",children:[{type:"elem",elem:n}]}),Kt(["mord"],[n],e)},mathmlBuilder:(t,e)=>{var n=Rc(Eo(t.body),e),r=new nn("mphantom",n),i=new nn("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=Kt(["inner"],[yi(t.body,e.withPhantom())]),r=Kt(["fix"],[]);return Kt(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=Rc(Eo(t.body),e),r=new nn("mphantom",n),i=new nn("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=Ir(e[0],"size").value,i=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:i}},htmlBuilder(t,e){var n=yi(t.body,e),r=Js(t.dy,e);return Ti({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new nn("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=Ir(e[0],"size"),o=Ir(e[1],"size");return{type:"rule",mode:r.mode,shift:i&&Ir(i,"size").value,width:s.value,height:o.value}},htmlBuilder(t,e){var n=Kt(["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=fn(r),n.style.borderTopWidth=fn(i),n.style.bottom=fn(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",o=new nn("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",fn(n)),o.setAttribute("height",fn(r));var a=new nn("mpadded",[o]);return i>=0?a.setAttribute("height",fn(i)):(a.setAttribute("height",fn(i)),a.setAttribute("depth",fn(-i))),a.setAttribute("voffset",fn(i)),a}});function $q(t,e,n){for(var r=oa(t,e,!1),i=e.sizeMultiplier/n.sizeMultiplier,s=0;s<r.length;s++){var o=r[s].classes.indexOf("sizing");o<0?Array.prototype.push.apply(r[s].classes,e.sizingClasses(n)):r[s].classes[o+1]==="reset-size"+e.size&&(r[s].classes[o+1]="reset-size"+n.size),r[s].height*=i,r[s].depth*=i}return _p(r)}var CL=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],wye=(t,e)=>{var n=e.havingSize(t.size);return $q(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:wye,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=Rc(t.body,n),i=new nn("mstyle",r);return i.setAttribute("mathsize",fn(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,o=n[0]&&Ir(n[0],"ordgroup");if(o)for(var a="",l=0;l<o.body.length;++l){var c=o.body[l];if(a=c.text,a==="t")i=!0;else if(a==="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=Kt([],[yi(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=Ti({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return Kt(["mord"],[s],e)},mathmlBuilder:(t,e)=>{var n=new nn("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=yi(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=ey(n,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<mr.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,a=n.height+n.depth+o+i,{span:l,ruleWidth:c,advanceWidth:d}=cye(a,e),h=l.height-c;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var g=l.height-n.height-o-c;n.style.paddingLeft=fn(d);var v=Ti({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(mr.SCRIPTSCRIPT),_=yi(t.index,b,e),w=.6*(v.height-v.depth),S=Ti({positionType:"shift",positionData:-w,children:[{type:"elem",elem:_}]}),E=Kt(["root"],[S]);return Kt(["mord","sqrt"],[E,v],e)}else return Kt(["mord","sqrt"],[v],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new nn("mroot",[is(n,e),is(r,e)]):new nn("msqrt",[is(n,e)])}});var AL={display:mr.DISPLAY,text:mr.TEXT,script:mr.SCRIPT,scriptscript:mr.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),o=r.slice(1,r.length-5);return{type:"styling",mode:i.mode,style:o,body:s}},htmlBuilder(t,e){var n=AL[t.style],r=e.havingStyle(n).withFont("");return $q(t.body,r,e)},mathmlBuilder(t,e){var n=AL[t.style],r=e.havingStyle(n),i=Rc(t.body,r),s=new nn("mstyle",i),o={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},a=o[t.style];return s.setAttribute("scriptlevel",a[0]),s.setAttribute("displaystyle",a[1]),s}});var Mye=function(e,n){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(n.style.size===mr.DISPLAY.size||r.alwaysHandleSupSub);return i?Ny:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(n.style.size===mr.DISPLAY.size||r.limits);return s?Wq:null}else{if(r.type==="accent")return yp(r.base)?Ck:null;if(r.type==="horizBrace"){var o=!e.sub;return o===r.isOver?Hq:null}else return null}else return null};wv({type:"supsub",htmlBuilder(t,e){var n=Mye(t,e);if(n)return n(t,e);var{base:r,sup:i,sub:s}=t,o=yi(r,e),a,l,c=e.fontMetrics(),d=0,h=0,g=r&&yp(r);if(i){var v=e.havingStyle(e.style.sup());a=yi(i,v,e),g||(d=o.height-v.fontMetrics().supDrop*v.sizeMultiplier/e.sizeMultiplier)}if(s){var b=e.havingStyle(e.style.sub());l=yi(s,b,e),g||(h=o.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var _;e.style===mr.DISPLAY?_=c.sup1:e.style.cramped?_=c.sup3:_=c.sup2;var w=e.sizeMultiplier,S=fn(.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");(o instanceof Yu||A)&&(E=fn(-o.italic))}var N;if(a&&l){d=Math.max(d,_,a.depth+.25*c.xHeight),h=Math.max(h,c.sub2);var I=c.defaultRuleThickness,P=4*I;if(d-a.depth-(l.height-h)<P){h=P-(d-a.depth)+l.height;var L=.8*c.xHeight-(d-a.depth);L>0&&(d+=L,h-=L)}var R=[{type:"elem",elem:l,shift:h,marginRight:S,marginLeft:E},{type:"elem",elem:a,shift:-d,marginRight:S}];N=Ti({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=Ti({positionType:"shift",positionData:h,children:O})}else if(a)d=Math.max(d,_,a.depth+.25*c.xHeight),N=Ti({positionType:"shift",positionData:-d,children:[{type:"elem",elem:a,marginRight:S}]});else throw new Error("supsub must have either sup or sub.");var F=TR(o,"right")||"mord";return Kt([F],[o,Kt(["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 o;if(n)o=r?"mover":"munder";else if(t.sub)if(t.sup){var c=t.base;c&&c.type==="op"&&c.limits&&e.style===mr.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===mr.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===mr.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===mr.DISPLAY)?o="munder":o="msub"}else{var a=t.base;a&&a.type==="op"&&a.limits&&(e.style===mr.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===mr.DISPLAY)?o="mover":o="msup"}return new nn(o,s)}});wv({type:"atom",htmlBuilder(t,e){return Sk(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new nn("mo",[Ku(t.text,t.mode)]);if(t.family==="bin"){var r=Tk(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 qq={mi:"italic",mn:"normal",mtext:"normal"};wv({type:"mathord",htmlBuilder(t,e){return LT(t,e,"mathord")},mathmlBuilder(t,e){var n=new nn("mi",[Ku(t.text,t.mode,e)]),r=Tk(t,e)||"italic";return r!==qq[n.type]&&n.setAttribute("mathvariant",r),n}});wv({type:"textord",htmlBuilder(t,e){return LT(t,e,"textord")},mathmlBuilder(t,e){var n=Ku(t.text,t.mode,e),r=Tk(t,e)||"normal",i;return t.mode==="text"?i=new nn("mtext",[n]):/[0-9]/.test(t.text)?i=new nn("mn",[n]):t.text==="\\prime"?i=new nn("mo",[n]):i=new nn("mi",[n]),r!==qq[i.type]&&i.setAttribute("mathvariant",r),i}});var NA={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},RA={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};wv({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 Kt(["mspace",n],[Sk(t.text,t.mode,e)],e)}else{if(NA.hasOwnProperty(t.text))return Kt(["mspace",NA[t.text]],[],e);throw new tn('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(RA.hasOwnProperty(t.text))n=new nn("mtext",[new Go(" ")]);else{if(NA.hasOwnProperty(t.text))return new nn("mspace");throw new tn('Unknown type of space "'+t.text+'"')}return n}});var NL=()=>{var t=new nn("mtd",[]);return t.setAttribute("width","50%"),t};wv({type:"tag",mathmlBuilder(t,e){var n=new nn("mtable",[new nn("mtr",[NL(),new nn("mtd",[J0(t.body,e)]),NL(),new nn("mtd",[J0(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"},Tye={"\\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(Tye[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:Eo(i),font:r}},htmlBuilder(t,e){var n=PL(t,e),r=oa(t.body,n,!0);return Kt(["mord","text"],r,n)},mathmlBuilder(t,e){var n=PL(t,e);return J0(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=yi(t.body,e),r=J1("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Ti({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]});return Kt(["mord","underline"],[s],e)},mathmlBuilder(t,e){var n=new nn("mo",[new Go("‾")]);n.setAttribute("stretchy","true");var r=new nn("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=yi(t.body,e),r=e.fontMetrics().axisHeight,i=.5*(n.height-r-(n.depth+r));return Ti({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){return new nn("mpadded",[is(t.body,e)],["vcenter"])}});_n({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new tn("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=DL(t),r=[],i=e.havingStyle(e.style.text()),s=0;s<n.length;s++){var o=n[s];o==="~"&&(o="\\textasciitilde"),r.push(zl(o,"Typewriter-Regular",t.mode,i,["mord","texttt"]))}return Kt(["mord","text"].concat(i.sizingClasses(e)),dq(r),i)},mathmlBuilder(t,e){var n=new Go(DL(t)),r=new nn("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var DL=t=>t.body.replace(/ /g,t.star?"␣":" "),j0=mq,Xq=`[ \r
	]`,Eye="\\\\[a-zA-Z@]+",Cye="\\\\[^\uD800-\uDFFF]",Aye="("+Eye+")"+Xq+"*",Nye=`\\\\(
|[ \r	]+
?)[ \r	]*`,RR="[̀-ͯ]",Rye=new RegExp(RR+"+$"),kye="("+Xq+"+)|"+(Nye+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(RR+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(RR+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+Aye)+("|"+Cye+")");class IL{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(kye,"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 nu("EOF",new wc(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new tn("Unexpected character: '"+e[n]+"'",new nu(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 nu(i,new wc(this,n,this.tokenRegex.lastIndex))}}class Pye{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 tn("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 Dye=zq;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 tn("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=OL[e.text],r==null||r>=n)throw new tn("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 Dk=(t,e,n,r)=>{var i=t.consumeArg().tokens;if(i.length!==1)throw new tn("\\newcommand's first argument must be a macro name");var s=i[0].text,o=t.isDefined(s);if(o&&!e)throw new tn("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!n)throw new tn("\\renewcommand{"+s+"} when command "+s+" does not yet exist; use \\newcommand");var a=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 tn("Invalid number of arguments: "+l);a=parseInt(l),i=t.consumeArg().tokens}return o&&r||t.macros.set(s,{tokens:i,numArgs:a}),""};Ie("\\newcommand",t=>Dk(t,!1,!0,!1));Ie("\\renewcommand",t=>Dk(t,!0,!1,!1));Ie("\\providecommand",t=>Dk(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),j0[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"},Iye=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&&Iye.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 tn("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 Yq=fn(Kf["Main-Regular"][84][1]-.7*Kf["Main-Regular"][65][1]);Ie("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+Yq+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Ie("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+Yq+"}{\\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 Kq=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,i=e.consumeArg().tokens,s=e.consumeArg().tokens,o=e.macros.get("|"),a=e.macros.get("\\|");e.macros.beginGroup();var l=h=>g=>{t&&(g.macros.set("|",o),i.length&&g.macros.set("\\|",a));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",Kq(!1));Ie("\\bra@set",Kq(!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 Zq={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class Oye{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 Pye(Dye,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new IL(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 nu("EOF",r.loc)),this.pushTokens(i),new nu("",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,o=0,a=0;do{if(s=this.popToken(),n.push(s),s.text==="{")++o;else if(s.text==="}"){if(--o,o===-1)throw new tn("Extra }",s)}else if(s.text==="EOF")throw new tn("Unexpected end of input in a macro argument, expected '"+(e&&r?e[a]:"}")+"'",s);if(e&&r)if((o===0||o===1&&e[a]==="{")&&s.text===e[a]){if(++a,a===e.length){n.splice(-a,a);break}}else a=0}while(o!==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 tn("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 tn("Use of the macro doesn't match its definition",s)}}for(var o=[],a=0;a<e;a++)o.push(this.consumeArg(n&&n[a+1]).tokens);return o}countExpansion(e){if(this.expansionCount+=e,this.expansionCount>this.settings.maxExpand)throw new tn("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 tn("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var s=i.tokens,o=this.consumeArgs(i.numArgs,i.delimiters);if(i.numArgs){s=s.slice();for(var a=s.length-1;a>=0;--a){var l=s[a];if(l.text==="#"){if(a===0)throw new tn("Incomplete placeholder at end of macro body",l);if(l=s[--a],l.text==="#")s.splice(a+1,1);else if(/^[1-9]$/.test(l.text))s.splice(a,2,...o[+l.text-1]);else throw new tn("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 nu(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 o=i.replace(/##/g,"");o.includes("#"+(s+1));)++s;for(var a=new IL(i,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var d={tokens:l,numArgs:s};return d}return i}isDefined(e){return this.macros.has(e)||j0.hasOwnProperty(e)||hs.math.hasOwnProperty(e)||hs.text.hasOwnProperty(e)||Zq.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:j0.hasOwnProperty(e)&&!j0[e].primitive}}var zL=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,T4=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 Oye(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 tn("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 nu("}")),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&&j0[i.text]&&j0[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 tn("only one infix operator per group",e[i].token);n=i,r=e[i].replaceWith}if(n!==-1&&r){var s,o,a=e.slice(0,n),l=e.slice(n+1);a.length===1&&a[0].type==="ordgroup"?s=a[0]:s={type:"ordgroup",mode:this.mode,body:a},l.length===1&&l[0].type==="ordgroup"?o=l[0]:o={type:"ordgroup",mode:this.mode,body:l};var c;return r==="\\\\abovefrac"?c=this.callFunction(r,[s,e[n],o],[]):c=this.callFunction(r,[s,o],[]),[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 tn("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 o=s.text==="\\limits";n.limits=o,n.alwaysHandleSupSub=!0}else if(n&&n.type==="operatorname")n.alwaysHandleSupSub&&(n.limits=s.text==="\\limits");else throw new tn("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new tn("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new tn("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new tn("Double superscript",s);var a={type:"textord",mode:this.mode,text:"\\prime"},l=[a];for(this.consume();this.fetch().text==="'";)l.push(a),this.consume();this.fetch().text==="^"&&l.push(this.handleSupSubscript("superscript")),r={type:"ordgroup",mode:this.mode,body:l}}else if(T4[s.text]){var c=zL.test(s.text),d=[];for(d.push(new nu(T4[s.text])),this.consume();;){var h=this.fetch().text;if(!T4[h]||zL.test(h)!==c)break;d.unshift(new nu(T4[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=j0[i];if(!s)return null;if(this.consume(),n&&n!=="atom"&&!s.allowedInArgument)throw new tn("Got function '"+i+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!s.allowedInText)throw new tn("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new tn("Can't use function '"+i+"' in math mode",r);var{args:o,optArgs:a}=this.parseArguments(i,s);return this.callFunction(i,o,a,r,e)}callFunction(e,n,r,i,s){var o={funcName:e,parser:this,token:i,breakOnTokenText:s},a=j0[e];if(a&&a.handler)return a.handler(o,n,r);throw new tn("No function handler for "+e)}parseArguments(e,n){var r=n.numArgs+n.numOptionalArgs;if(r===0)return{args:[],optArgs:[]};for(var i=[],s=[],o=0;o<r;o++){var a=n.argTypes&&n.argTypes[o],l=o<n.numOptionalArgs;(n.primitive&&a==null||n.type==="sqrt"&&o===1&&s[0]==null)&&(a="primitive");var c=this.parseGroupOfType("argument to '"+e+"'",a,l);if(l)s.push(c);else if(c!=null)i.push(c);else throw new tn("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 tn("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new tn("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new tn("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="",o;(o=this.fetch()).text!=="EOF"&&e.test(s+o.text);)i=o,s+=i.text,this.consume();if(s==="")throw new tn("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 tn("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 tn("Invalid size: '"+n.text+"'",n);var s={number:+(i[1]+i[2]),unit:i[3]};if(!oq(s))throw new tn("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 o={type:"ordgroup",mode:this.mode,loc:r.loc,body:s};return n&&this.switchMode(i),o}parseGroup(e,n){var r=this.fetch(),i=r.text,s;if(i==="{"||i==="\\begingroup"){this.consume();var o=i==="{"?"}":"\\endgroup";this.gullet.beginGroup();var a=this.parseExpression(!1,o),l=this.fetch();this.expect(o),this.gullet.endGroup(),s={type:"ordgroup",mode:this.mode,loc:wc.range(r,l),body:a,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(n,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!Zq.hasOwnProperty(i)){if(this.settings.throwOnError)throw new tn("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 tn(`\\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=Rye.exec(n);s&&(n=n.substring(0,s.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;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 a=hs[this.mode][n].group,l=wc.range(e),c;if(k1e.hasOwnProperty(a)){var d=a;c={type:"atom",mode:this.mode,family:d,loc:l,text:n}}else c={type:a,mode:this.mode,loc:l,text:n};o=c}else if(n.charCodeAt(0)>=128)this.settings.strict&&(sq(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)),o={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 tn("Unknown accent ' "+g+"'",e);var v=kA[g][this.mode]||kA[g].text;if(!v)throw new tn("Accent "+g+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:wc.range(e),label:v,isStretchy:!1,isShifty:!0,base:o}}return o}}VT.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var Ok=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 tn("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new nu("\\df@tag")])}]}return i},Qq=function(e,n,r){n.textContent="";var i=Lk(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."),Qq=function(){throw new tn("KaTeX doesn't work in quirks mode.")});var Lye=function(e,n){var r=Lk(e,n).toMarkup();return r},zye=function(e,n){var r=new xk(n);return Ok(e,r)},Jq=function(e,n,r){if(r.throwOnError||!(e instanceof tn))throw e;var i=Kt(["katex-error"],[new Yu(n)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},Lk=function(e,n){var r=new xk(n);try{var i=Ok(e,r);return q1e(i,e,r)}catch(s){return Jq(s,e,r)}},jye=function(e,n){var r=new xk(n);try{var i=Ok(e,r);return X1e(i,e,r)}catch(s){return Jq(s,e,r)}},Fye="0.16.33",Uye={Span:pw,Anchor:_k,SymbolNode:Yu,SvgNode:pp,PathNode:Z0,LineNode:SR},kR={version:Fye,render:Qq,renderToString:Lye,ParseError:tn,SETTINGS_SCHEMA:UM,__parse:zye,__renderToDomTree:Lk,__renderToHTMLTree:jye,__setFontMetrics:w1e,__defineSymbol:Q,__defineFunction:_n,__defineMacro:Ie,__domTree:Uye};const Bye={};function Hye(t){const e=this,n=t||Bye,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Jxe(n)),s.push(Wxe()),o.push($xe(n))}const FL=/[#.]/g;function Vye(t,e){const n=t||"",r={};let i=0,s,o;for(;i<n.length;){FL.lastIndex=i;const a=FL.exec(n),l=n.slice(i,a?a.index:n.length);l&&(s?s==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:o=l,i+=l.length),a&&(s=a[0],i++)}return{type:"element",tagName:o||e||"div",properties:r,children:[]}}function eX(t,e,n){const r=n?qye(n):void 0;function i(s,o,...a){let l;if(s==null){l={type:"root",children:[]};const c=o;a.unshift(c)}else{l=Vye(s,e);const c=l.tagName.toLowerCase(),d=r?r.get(c):void 0;if(l.tagName=d||c,Gye(o))a.unshift(o);else for(const[h,g]of Object.entries(o))Wye(t,l.properties,h,g)}for(const c of a)PR(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function Gye(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 o of s)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function Wye(t,e,n,r){const i=A$(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"?$ye(r):String(r);if(Array.isArray(s)){const o=[];for(const a of s)o.push(UL(i,i.property,a));s=o}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===""||dS(n)===dS(e)))return!0}return n}function $ye(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function qye(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const Xye=["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"],Yye=eX(N$,"div"),Kye=eX(RT,"g",Xye),PA={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function Zye(t,e){return tX(t,{})||{type:"root",children:[]}}function tX(t,e){const n=Qye(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function Qye(t,e){switch(t.nodeType){case 1:return nbe(t,e);case 3:return ebe(t);case 8:return tbe(t);case 9:return BL(t,e);case 10:return Jye();case 11:return BL(t,e);default:return}}function BL(t,e){return{type:"root",children:nX(t,e)}}function Jye(){return{type:"doctype"}}function ebe(t){return{type:"text",value:t.nodeValue||""}}function tbe(t){return{type:"comment",value:t.nodeValue||""}}function nbe(t,e){const n=t.namespaceURI,r=n===PA.svg?Kye:Yye,i=n===PA.html?t.tagName.toLowerCase():t.tagName,s=n===PA.html&&i==="template"?t.content:t,o=t.getAttributeNames(),a={};let l=-1;for(;++l<o.length;)a[o[l]]=t.getAttribute(o[l])||"";return r(i,a,nX(s,e))}function nX(t,e){const n=t.childNodes,r=[];let i=-1;for(;++i<n.length;){const s=tX(n[i],e);s!==void 0&&r.push(s)}return r}new DOMParser;function rbe(t,e){const n=ibe(t);return Zye(n)}function ibe(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const HL=(function(t,e,n){const r=mk(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]}),Mv=(function(t){if(t==null)return abe;if(typeof t=="string")return obe(t);if(typeof t=="object")return sbe(t);if(typeof t=="function")return zk(t);throw new Error("Expected function, string, or array as `test`")});function sbe(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Mv(t[n]);return zk(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function obe(t){return zk(e);function e(n){return n.tagName===t}}function zk(t){return e;function e(n,r,i){return!!(lbe(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function abe(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function lbe(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const VL=/\n/g,GL=/[\t ]+/g,DR=Mv("br"),WL=Mv(gbe),cbe=Mv("p"),$L=Mv("tr"),ube=Mv(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",mbe,vbe]),rX=Mv(["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 dbe(t,e){const n=e||{},r="children"in t?t.children:[],i=rX(t),s=oX(t,{whitespace:n.whitespace||"normal"}),o=[];(t.type==="text"||t.type==="comment")&&o.push(...sX(t,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...iX(r[a],t,{whitespace:s,breakBefore:a?void 0:i,breakAfter:a<r.length-1?DR(r[a+1]):i}));const l=[];let c;for(a=-1;++a<o.length;){const d=o[a];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 iX(t,e,n){return t.type==="element"?fbe(t,e,n):t.type==="text"?n.whitespace==="normal"?sX(t,n):hbe(t):[]}function fbe(t,e,n){const r=oX(t,n),i=t.children||[];let s=-1,o=[];if(ube(t))return o;let a,l;for(DR(t)||$L(t)&&HL(e,t,$L)?l=`
`:cbe(t)?(a=2,l=2):rX(t)&&(a=1,l=1);++s<i.length;)o=o.concat(iX(i[s],t,{whitespace:r,breakBefore:s?void 0:a,breakAfter:s<i.length-1?DR(i[s+1]):l}));return WL(t)&&HL(e,t,WL)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function sX(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(pbe(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 o=-1,a;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),a=void 0):r[o]?(typeof a=="number"&&i.push(a),i.push(r[o]),a=0):(o===0||o===r.length-1)&&i.push(0);return i}function hbe(t){return[String(t.value)]}function pbe(t,e,n){const r=[];let i=0,s;for(;i<t.length;){GL.lastIndex=i;const o=GL.exec(t);s=o?o.index:t.length,!i&&!s&&o&&!e&&r.push(""),i!==s&&r.push(t.slice(i,s)),i=o?s+o[0].length:s}return i!==s&&!n&&r.push(""),r.join(" ")}function oX(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 mbe(t){return!!(t.properties||{}).hidden}function gbe(t){return t.tagName==="td"||t.tagName==="th"}function vbe(t){return t.tagName==="dialog"&&!(t.properties||{}).open}const xbe={},ybe=[];function bbe(t){const e=t||xbe;return function(n,r){nq(n,"element",function(i,s){const o=Array.isArray(i.properties.className)?i.properties.className:ybe,a=o.includes("language-math"),l=o.includes("math-display"),c=o.includes("math-inline");let d=l;if(!a&&!l&&!c)return;let h=s[s.length-1],g=i;if(i.tagName==="code"&&a&&h&&h.type==="element"&&h.tagName==="pre"&&(g=h,h=s[s.length-2],d=!0),!h)return;const v=dbe(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=rbe(b).children);const _=h.children.indexOf(g);return h.children.splice(_,1,...b),tq})}}function jk(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=jk(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 vw(t){const e=new Map,n=jk(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 o=new Map;for(const[a,l]of Object.entries(s)){const c=l;typeof(c==null?void 0:c.min)=="number"&&typeof(c==null?void 0:c.max)=="number"&&o.set(a,{min:c.min,max:c.max})}o.size>0&&e.set(i.name,o)}}return e}function xw(t){const e=new Map;if(!t)return e;for(const[n,r]of Object.entries(t)){const i=new Map;for(const[s,o]of Object.entries(r))typeof(o==null?void 0:o.min)=="number"&&typeof(o==null?void 0:o.max)=="number"&&i.set(s,{min:o.min,max:o.max});i.size>0&&e.set(n,i)}return e}function yw(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[o,a]of i)s.set(o,a);n.set(r,s)}return n}function y1({prompts:t,data:e,samplesData:n,rolloutMetrics:r,goldenAnswers:i,infoTurns:s,isLoading:o,step:a,scrollToSampleId:l=null,showGoTo:c=!1,goToBasePath:d="/rollouts",goToStepParam:h="step",filterGroupId:g=null,filterSampleIdx:v=null,lastValidSampleAtom:b=NG,collapseAllSignal:_=0,expandAllSignal:w=0,defaultSectionsOpen:S=!0,envRewardRanges:E,envMetricRanges:A,advantageRange:N,renderOptions:I=[],formatThinkBlocks:P=!0}){var oe;const L=T.useMemo(()=>{if(!r)return new Map;const fe=new Map;for(const me of r){const ye=fe.get(me.sample_idx)||[];ye.push(me),fe.set(me.sample_idx,ye)}return fe},[r]),R=T.useMemo(()=>{if(!r)return[];const fe=new Set;for(const me of r)fe.add(me.metric_name);return[...fe].sort()},[r]),O=T.useMemo(()=>{if(!i)return new Map;const fe=new Map;for(const me of i){const ye=fe.get(me.sample_idx)||[];ye.push(me),fe.set(me.sample_idx,ye)}return fe},[i]),F=T.useMemo(()=>{if(!s)return new Map;const fe=new Map;for(const me of s){const ye=fe.get(me.sample_idx)||[];ye.push(me),fe.set(me.sample_idx,ye)}return fe},[s]),U=T.useMemo(()=>{if(!t)return new Map;const fe=new Map;for(const me of t)fe.set(me.group_id,me);return fe},[t]),q=T.useMemo(()=>{if(!n)return new Map;const fe=new Map;for(const me of n)fe.set(me.sample_idx,me);return fe},[n]),B=T.useMemo(()=>{if(!e)return[];const fe=new Map,me=new Map;for(const Ge of e){const _e=fe.get(Ge.sample_idx)||[];_e.push(Ge),fe.set(Ge.sample_idx,_e),me.set(Ge.sample_idx,Ge.group_id)}const ye=[];for(const[Ge,_e]of fe){const De=[..._e].sort((We,je)=>We.turn_order-je.turn_order),he=me.get(Ge)??-1,Le=U.get(he)??null,ne=q.get(Ge);ye.push({sample_idx:Ge,group_id:he,prompt:Le,turns:De,reward:(ne==null?void 0:ne.reward)??null,advantage:(ne==null?void 0:ne.advantage)??null,total_tokens:(ne==null?void 0:ne.total_tokens)??null,raw_string:(ne==null?void 0:ne.raw_string)??null})}let Ee=ye.sort((Ge,_e)=>Ge.sample_idx-_e.sample_idx);return g!==null&&(Ee=Ee.filter(Ge=>Ge.group_id===g)),v!==null&&(Ee=Ee.filter(Ge=>Ge.sample_idx===v)),Ee},[e,U,q,g,v]),[Z,G]=un(b),$=B[0],K=($==null?void 0:$.sample_idx)??null,Y=T.useMemo(()=>K!==null?L.get(K)??[]:[],[L,K]),J=T.useMemo(()=>K!==null?O.get(K)??[]:[],[O,K]),H=T.useMemo(()=>K!==null?F.get(K)??[]:[],[F,K]);T.useEffect(()=>{!$||v===null||G({sample:$,rolloutMetrics:Y,goldenAnswers:J})},[$,Y,J,v,G]);const z=v!==null&&(Z==null?void 0:Z.sample.sample_idx)===v?Z:null,X=$||(z==null?void 0:z.sample),V=$?Y:(z==null?void 0:z.rolloutMetrics)||[],ie=$?J:(z==null?void 0:z.goldenAnswers)||[],ae=$?H:[],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,B]);const ce=a!==void 0?a:(oe=e==null?void 0:e[0])==null?void 0:oe.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&&!o?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(_be,{sample:X,rolloutMetrics:V,goldenAnswers:ie,infoTurns:ae,availableMetricNames:R,showGoTo:c,goToStep:ce,goToBasePath:d,goToStepParam:h,collapseAllSignal:_,expandAllSignal:w,defaultSectionsOpen:S,envRewardRanges:E,envMetricRanges:A,advantageRange:N,renderOptions:I,formatThinkBlocks:P},X.sample_idx)}):null}function _be({sample:t,rolloutMetrics:e,goldenAnswers:n,infoTurns:r,availableMetricNames:i,showGoTo:s,goToStep:o,goToBasePath:a="/rollouts",goToStepParam:l="step",collapseAllSignal:c=0,expandAllSignal:d=0,defaultSectionsOpen:h=!0,envRewardRanges:g,envMetricRanges:v,advantageRange:b,renderOptions:_=[],formatThinkBlocks:w=!0}){var Ee,Ge;const[S,E]=un(Zce),A=S.length===0,N=S.length===1&&S[0]==="__none__",I=_e=>A?!0:N?!1:S.includes(_e),P=_e=>{E(De=>{if(De.length===0)return i.filter(ne=>ne!==_e);const he=De.filter(ne=>ne!=="__none__");if(he.length===0)return[_e];if(he.includes(_e)){const ne=he.filter(We=>We!==_e);return ne.length===0?["__none__"]:ne}const Le=[...he,_e];return i.length>0&&Le.length>=i.length?[]:Le})},L=T.useMemo(()=>[...e].sort((_e,De)=>_e.metric_name.localeCompare(De.metric_name)),[e]),R=T.useMemo(()=>S.length===0?L:L.filter(_e=>S.includes(_e.metric_name)),[L,S]),O=T.useMemo(()=>n.filter(_e=>_e.value!=null&&_e.value!==""),[n]),F=((Ee=t.prompt)==null?void 0:Ee.env)??null,U=D5(),q=()=>{o!=null&&U(`${a}?${l}=${o}&group=${t.group_id}&sample=${t.sample_idx}`)},B=T.useMemo(()=>{if(!r||r.length===0)return new Map;const _e=new Map;for(const De of r){const he=_e.get(De.turn_order)||[];he.push(De),_e.set(De.turn_order,he)}return _e},[r]),[Z,G]=T.useState(!1),[$,K]=T.useState(!1),[Y,J]=T.useState(h),[H,z]=T.useState({}),[X,V]=T.useState(c),[ie,ae]=T.useState(d),re=t.turns.length;if(c!==X){V(c),G(!1),K(!1),J(!1);const _e={};for(let De=0;De<re;De++)_e[De]=!1;z(_e)}if(d!==ie){ae(d),G(!0),K(!0),J(!0);const _e={};for(let De=0;De<re;De++)_e[De]=!0;z(_e)}const ce=_e=>{z(De=>({...De,[_e]:!De[_e]}))},oe=F?g==null?void 0:g.get(F):void 0,fe=[];F&&fe.push({label:"Env",value:F});const me=t.turns.filter(_e=>_e.turn_type==="model").length;if(me>1&&fe.push({label:"Turns",value:String(me)}),t.reward!==null){const _e=LA(t.reward,(oe==null?void 0:oe.min)??null,(oe==null?void 0:oe.max)??null);fe.push({label:"Reward",value:t.reward.toFixed(2),rangeColor:_e})}if(t.advantage!==null){const _e=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:_e})}const ye=[];for(const _e of R){const De=_e.env??F,he=Pbe(v,De,_e.metric_name),Le=LA(_e.value,(he==null?void 0:he.min)??null,(he==null?void 0:he.max)??null);ye.push({label:E4(_e.metric_name),value:kbe(_e.value),highlight:Le?void 0:_e.value===1?"positive":_e.value===0?"negative":void 0,rangeColor:Le})}return p.jsxs("div",{id:`sample-${t.sample_idx}`,children:[(fe.length>0||ye.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:q,disabled:o==null,children:"Go to"}),fe.map((_e,De)=>p.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[De>0&&p.jsx("span",{className:"text-foreground/20",children:"·"}),p.jsx("span",{className:"text-muted-foreground",children:_e.label}),p.jsx("span",{className:"font-medium tabular-nums text-foreground/80",style:_e.rangeColor?{color:_e.rangeColor}:void 0,children:_e.value})]},_e.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(Wr,{className:"h-3 w-3"})]})}),p.jsxs(pl,{align:"start",className:"w-max max-w-[400px]",children:[p.jsx(_c,{onSelect:_e=>{_e.preventDefault(),E([])},children:"Select All"}),p.jsx(_c,{onSelect:_e=>{_e.preventDefault(),E(["__none__"])},children:"Unselect All"}),p.jsx(ul,{}),i.map(_e=>p.jsx(pi,{checked:I(_e),onCheckedChange:()=>P(_e),onSelect:De=>De.preventDefault(),children:E4(_e)},_e))]})]})]}),ye.length>0&&p.jsx("div",{className:"flex items-center gap-1.5 text-xs min-w-0 flex-wrap",children:ye.map((_e,De)=>p.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[p.jsx("span",{className:"text-muted-foreground",children:_e.label}),p.jsx("span",{className:Nt("font-medium tabular-nums",!_e.rangeColor&&_e.highlight==="positive"&&"text-emerald-600 dark:text-emerald-400",!_e.rangeColor&&_e.highlight==="negative"&&"text-red-500 dark:text-red-400",!_e.rangeColor&&!_e.highlight&&"text-foreground/80"),style:_e.rangeColor?{color:_e.rangeColor}:void 0,children:_e.value}),De<ye.length-1&&p.jsx("span",{className:"text-foreground/20",children:"·"})]},_e.label))})]}),O.length>0&&p.jsxs(Ki,{open:Z,onOpenChange:G,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(_e=>`${E4(_e.key)}: ${_e.value}`).join(" · ")}),p.jsx("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:p.jsx(Wr,{className:Nt("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((_e,De)=>p.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[De>0&&p.jsx("span",{className:"text-foreground/20",children:"·"}),p.jsx("span",{className:"text-muted-foreground",children:E4(_e.key)}),p.jsx("span",{className:"font-medium text-foreground/80 whitespace-pre-wrap break-words",children:_.length>0&&_e.value?p.jsx(k2,{content:_e.value,renderOptions:_}):_e.value})]},_e.key))})})})]}),((Ge=t.prompt)==null?void 0:Ge.system_prompt)&&p.jsxs(Ki,{open:$,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"}),!$&&p.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:DA(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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!$&&"-rotate-90")})]})]})})}),p.jsx(Qi,{children:p.jsx("div",{className:"py-2",children:p.jsx(IA,{content:t.prompt.system_prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.prompt&&p.jsxs(Ki,{open:Y,onOpenChange:J,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:DA(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(Wr,{className:Nt("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(IA,{content:t.prompt.prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.turns.map((_e,De)=>{const he=H[De]??h,Le=_e.turn_type==="model"?t.turns.slice(0,De).filter(ne=>ne.turn_type==="model").length:null;return p.jsxs(Ki,{open:he,onOpenChange:()=>ce(De),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:wbe(_e.turn_type)}),!he&&p.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:DA(_e.content,60,_e.turn_type==="model"&&w)}),p.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[_e.tokens!=null&&p.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[_e.tokens.toLocaleString()," tokens"]}),Le!==null&&p.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:["Turn ",Le]}),p.jsx(OA,{text:_e.content}),p.jsx(Wr,{className:Nt("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(IA,{content:_e.content,renderOptions:_,enableThinkBlocks:_e.turn_type==="model"&&w}),(()=>{const ne=B.get(_e.turn_order);return!ne||ne.length===0?null:p.jsx("div",{className:"mt-2 space-y-1",children:ne.map((We,je)=>p.jsx(Sbe,{info:We,renderOptions:_},`${We.info_key}-${je}`))})})()]})})]},`${_e.sample_idx}-${_e.turn_order}`)})]})}function Sbe({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(Wr,{className:Nt("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(k2,{content:t.info_value,renderOptions:e}):p.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:t.info_value})})})]})}function wbe(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Mbe(t){return t.replace(/<think>[\s\S]*?<\/think>\s*/g,"").trimStart()}function DA(t,e=60,n=!0){if(!t)return"";const i=(n?Mbe(t):t).replace(/\s+/g," ").trim();return i.length<=e?i:i.slice(0,e)+"…"}function Tbe(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 Ebe(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:Ebe(t)}),p.jsx("span",{children:"</think>"}),p.jsx(Vg,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&p.jsx(Wr,{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 Cbe(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 Abe(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 Nbe({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(yv,{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 Rbe({content:t}){const e="katex-scroll",n=Cbe(t);return p.jsx("div",{className:Nt("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(Hye),s.push(bbe)),p.jsx("div",{className:Nt("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(Fxe,{remarkPlugins:i,rehypePlugins:s,children:t})})}return n?p.jsx(Rbe,{content:t}):p.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})}function k2({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=Abe(t);if(s.some(o=>o.type==="code"))return p.jsx(p.Fragment,{children:s.map((o,a)=>o.type==="code"?p.jsx(Nbe,{code:o.value,language:o.language},a):p.jsx(XL,{content:o.value,renderMarkdown:n,renderLatex:r},a))})}return p.jsx(XL,{content:t,renderMarkdown:n,renderLatex:r})}function IA({content:t,renderOptions:e=[],enableThinkBlocks:n=!0}){const r=T.useMemo(()=>n?Tbe(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(k2,{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,o)=>s.type==="text"?p.jsx(k2,{content:s.value,renderOptions:e},o):p.jsx(qL,{content:s.value},o))}):p.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:r.map((s,o)=>s.type==="text"?p.jsx("span",{children:s.value},o):p.jsx(qL,{content:s.value},o))})}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(yv,{className:"h-3.5 w-3.5 text-foreground/30"}):p.jsx(iT,{className:"h-3.5 w-3.5 text-foreground/30"})})}function E4(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function kbe(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function Pbe(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){return e==null||n==null||e>=n?void 0:`hsl(${(Math.max(0,Math.min(1,(t-e)/(n-e)))*120).toFixed(0)} 80% 38%)`}function GT({rawString:t,totalTokens:e,turns:n}){const[r,i]=T.useState(!1),[s,o]=T.useState(!1),a=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(qf,{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(Xf,{className:"sm:max-w-[75vw] max-h-[80vh]",children:[p.jsx(Fd,{children:p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ud,{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:a,children:[r?p.jsx(yv,{className:"size-3"}):p.jsx(iT,{className:"size-3"}),r?"Copied":"Copy"]}),p.jsx(p1,{variant:"outline",size:"sm",pressed:s,onPressedChange:o,className:"text-xs",children:"Line breaks"})]})}),p.jsx(bv,{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 Dbe(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 Ibe(t){switch(t){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}}function Obe(t){const e=T.useMemo(()=>{if(t!=null&&t.prompts)return t.prompts.map(a=>({step:a.trainer_step,group_id:a.group_id,env:a.env,system_prompt:a.system_prompt,tokens_system_prompt:a.tokens_system_prompt,prompt:a.prompt,tokens_prompt:a.tokens_prompt}))},[t]),n=T.useMemo(()=>{if(t!=null&&t.rollouts)return t.rollouts.map(a=>({step:a.trainer_step,group_id:a.group_id,sample_idx:a.sample_idx,turn_order:a.turn_order,turn_type:a.turn_type,content:a.content,tokens:a.tokens}))},[t]),r=T.useMemo(()=>{if(t!=null&&t.samples_data)return t.samples_data.map(a=>({step:a.trainer_step,group_id:a.group_id,sample_idx:a.sample_idx,reward:a.reward,advantage:a.advantage,turns:a.turns,total_tokens:a.total_tokens,raw_string:a.raw_string}))},[t]),i=T.useMemo(()=>{if(!(t!=null&&t.rollout_metrics))return;const a=t.trainer_step??0;return t.rollout_metrics.map(l=>({step:a,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 a=t.trainer_step??0;return t.golden_answers.map(l=>({step:a,sample_idx:l.sample_idx,env:l.env,key:l.key,value:l.value}))},[t]),o=T.useMemo(()=>{if(!(t!=null&&t.info_turns))return;const a=t.trainer_step??0;return t.info_turns.map(l=>({step:a,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:o}}function Lbe({runPath:t,groupId:e,sampleId:n,isEval:r,isCanceled:i,children:s}){var re,ce,oe,fe;const[o,a]=T.useState(!1),{data:l,isLoading:c,error:d}=OG(t,e,n,o,r),{data:h}=td(t,o&&!!t,!1),g=r?((re=h==null?void 0:h.summary)==null?void 0:re.eval_env_details)??((ce=h==null?void 0:h.config)==null?void 0:ce.eval_env_details):(oe=h==null?void 0:h.config)==null?void 0:oe.environments,v=T.useMemo(()=>gw(g),[g]),b=T.useMemo(()=>{const me=vw(g),ye=xw(h==null?void 0:h.data_metric_ranges);return yw(me,ye)},[g,h==null?void 0:h.data_metric_ranges]),_=T.useMemo(()=>{var Ge;const me=(Ge=h==null?void 0:h.config)==null?void 0:Ge.group_size,ye=typeof me=="object"&&me!==null&&"value"in me?Number(me.value):Number(me);if(!ye||isNaN(ye)||ye<=1)return null;const Ee=Math.sqrt(ye-1);return{min:-Ee,max:Ee}},[(fe=h==null?void 0:h.config)==null?void 0:fe.group_size]),w=(l==null?void 0:l.kind)==="rollouts_discarded"?l:null,{mappedPrompts:S,mappedRollouts:E,mappedSamplesData:A,mappedRolloutMetrics:N,mappedGoldenAnswers:I,mappedInfoTurns:P}=Obe(w),L=T.useMemo(()=>{var ye;if(!l||l.kind!=="eval")return null;const me=(ye=l.samples_data)==null?void 0:ye[0];return me?{groupId:me.group_id,sampleIdx:me.sample_idx}:null},[l]),R=(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,O=D5(),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]),U=()=>{F&&(a(!1),O(F))},[q,B]=T.useState(0),[Z,G]=T.useState(0),[$,K]=T.useState(!0),[Y,J]=un(hT),[H,z]=un(pT),X=Y.length+(H?1:0),V=me=>{J(ye=>ye.includes(me)?ye.filter(Ee=>Ee!==me):[...ye,me])},ie=T.useMemo(()=>{if(!l)return null;const me=l.kind==="rollouts"?l.samples_data:l.kind==="rollouts_discarded"?A:l.kind==="eval"?l.samples_data:null;if(!me)return null;const ye=l.kind==="eval"?(L==null?void 0:L.sampleIdx)??n:n;return me.find(Ee=>Ee.sample_idx===ye)??null},[l,A,n,L]),ae=!c&&!d&&l&&l.kind!==null;return p.jsxs(qf,{open:o,onOpenChange:a,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(Xf,{className:"sm:max-w-[85vw] max-h-[85vh] overflow-auto",children:[p.jsx(Fd,{children:p.jsxs(Ud,{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}`}),R&&p.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[R,(l==null?void 0:l.kind)==="eval"&&l.eval_name&&` — ${l.eval_name}`]}),(w==null?void 0:w.discard_reason)&&p.jsx($1,{variant:Ibe(w.discard_reason),className:"text-xs",children:Dbe(w.discard_reason)}),F&&p.jsx(Tn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:U,children:"Go to"}),ae&&p.jsxs(p.Fragment,{children:[(ie==null?void 0:ie.raw_string)&&p.jsx(GT,{rawString:ie.raw_string,totalTokens:ie.total_tokens,turns:ie.turns??void 0}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{B(me=>me+1),K(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{G(me=>me+1),K(!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",X>0&&` (${X})`]})}),p.jsxs(pl,{align:"start",className:"w-auto",children:[p.jsx(pi,{checked:H,onCheckedChange:me=>z(!!me),onSelect:me=>me.preventDefault(),children:"Format Think"}),p.jsx(pi,{checked:Y.includes("markdown"),onCheckedChange:()=>V("markdown"),onSelect:me=>me.preventDefault(),children:"Markdown"}),p.jsx(pi,{checked:Y.includes("latex"),onCheckedChange:()=>V("latex"),onSelect:me=>me.preventDefault(),children:"LaTeX"}),p.jsx(pi,{checked:Y.includes("code"),onCheckedChange:()=>V("code"),onSelect:me=>me.preventDefault(),children:"Code"})]})]})]})]})}),d&&p.jsx($u,{className:"border-destructive",children:p.jsx(th,{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(th,{className:"pt-6 space-y-3",children:[p.jsx(Qh,{className:"h-5 w-40"}),p.jsx(Qh,{className:"h-32 w-full"}),p.jsx(Qh,{className:"h-24 w-full"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx(Qh,{className:"h-6 w-20"}),p.jsx(Qh,{className:"h-6 w-20"}),p.jsx(Qh,{className:"h-6 w-20"})]})]})}),!c&&!d&&(l==null?void 0:l.kind)==="rollouts"&&p.jsx(y1,{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:v,envMetricRanges:b,advantageRange:_,collapseAllSignal:q,expandAllSignal:Z,defaultSectionsOpen:$,renderOptions:Y,formatThinkBlocks:H}),!c&&!d&&(l==null?void 0:l.kind)==="rollouts_discarded"&&p.jsx(y1,{prompts:S,data:E,samplesData:A,rolloutMetrics:N,goldenAnswers:I,infoTurns:P,step:l.trainer_step,goToBasePath:"/rollouts-discarded",goToStepParam:"trainer_step",filterGroupId:e,filterSampleIdx:n,envRewardRanges:v,envMetricRanges:b,advantageRange:_,collapseAllSignal:q,expandAllSignal:Z,defaultSectionsOpen:$,renderOptions:Y,formatThinkBlocks:H}),!c&&!d&&(l==null?void 0:l.kind)==="eval"&&p.jsx(y1,{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:(L==null?void 0:L.groupId)??e,filterSampleIdx:(L==null?void 0:L.sampleIdx)??n,envRewardRanges:v,envMetricRanges:b,advantageRange:_,collapseAllSignal:q,expandAllSignal:Z,defaultSectionsOpen:$,renderOptions:Y,formatThinkBlocks:H}),!c&&!d&&(l==null?void 0:l.kind)===null&&p.jsx($u,{children:p.jsx(th,{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 zbe=.005;function jbe(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,o=s>=1?`${s}ms`:`${Number(s.toPrecision(2))}ms`;return{thresholdSeconds:s/1e3,displayLabel:o}}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 aX(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 Fbe(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),o=Math.round(r+(255-r)*e),a=Math.round(i+(255-i)*e),l=Math.round(s+(255-s)*e);return`#${o.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}`}const Ube=new Set;function lX(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 Bbe(t,e=zbe){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,o=0;for(let l=0;l<n.length;l++){const c=n[l].event.timestamp;for(;c-n[s].event.timestamp>e;)s++;for(o<l&&(o=l);o+1<n.length&&n[o+1].event.timestamp-c<=e;)o++;r[l]=s,i[l]=o}const a=new Map;return n.forEach((l,c)=>{a.set(l.originalIndex,{start:r[c],end:i[c],sortedIndex:c})}),{sortedEvents:n,windowByOriginalIndex:a}}function Hbe({orchestratorData:t,trainerData:e,inferenceData:n,isLoading:r,intervalStart:i,intervalEnd:s,trainerGpuMetricsByGpuIndex:o,trainerGpuMetricsByRank:a,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=Pi(dT),N=T.useMemo(()=>{const G=(g??[]).filter(K=>Number.isFinite(K));return G.length>0?G:o?Object.keys(o).map(Number).filter(K=>Number.isFinite(K)).sort((K,Y)=>K-Y):[]},[g,o]),I=s-i,P=T.useMemo(()=>!t||t.length===0?[]:t.filter(G=>G.timestamp>=i&&G.timestamp<s),[t,i,s]),L=T.useMemo(()=>!e||e.length===0?[]:e.filter(G=>G.start_time<s&&G.end_time>i),[e,i,s]),R=T.useMemo(()=>!n||n.length===0?[]:n.filter(G=>{const $=G.end_time+(G.environment_response_time??0)+(G.compute_reward_time??0);return G.start_time<s&&$>i}),[n,i,s]),{eventsByRank:O,ranks:F}=T.useMemo(()=>{const G={};L.forEach(K=>{G[K.rank]||(G[K.rank]=[]),G[K.rank].push(K)});const $=Object.keys(G).map(Number).sort((K,Y)=>K-Y);return{eventsByRank:G,ranks:$}},[L]),{eventsByServer:U,servers:q}=T.useMemo(()=>{const G={};R.forEach(K=>{G[K.server]||(G[K.server]=[]),G[K.server].push(K)});const $=Object.keys(G).map(Number).sort((K,Y)=>K-Y);return{eventsByServer:G,servers:$}},[R]),B=w>0?w:Math.max(1,q.length),Z=Math.max(1,Math.floor(S/B*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:[(q.length>0||w>0)&&p.jsx($be,{servers:q.length>0?q:Array.from({length:w},(G,$)=>$),eventsByServer:U,intervalStart:i,intervalDuration:I,lanesPerServer:Z,inferenceServerNodeMap:_,totalSetupNodes:b,isLoading:r}),p.jsx(Vbe,{events:P,intervalStart:i,intervalDuration:I,isLoading:r}),p.jsx(l_e,{ranks:F,eventsByRank:O,intervalStart:i,intervalDuration:I,intervalEnd:s,trainerGpuMetricsByGpuIndex:o,trainerGpuMetricsByRank:a,trainerGpuMetricsIsLoading:l,trainerAvailableGpuMetrics:c,selectedMetricNames:d,onSelectedMetricNamesChange:h,trainerSystemGpuIndices:N,trainerRankInfoByRank:v,totalSetupNodes:b,isLoading:r})]})})}function Vbe({events:t,intervalStart:e,intervalDuration:n,isLoading:r}){const[i,s]=T.useState(!0),[o,a]=T.useState(null),[l,c]=T.useState(null),d=l??o,{thresholdSeconds:h,displayLabel:g}=T.useMemo(()=>jbe(n),[n]),{sortedEvents:v,windowByOriginalIndex:b}=T.useMemo(()=>Bbe(t,h),[t,h]),_=T.useMemo(()=>{const w=[],S=new Map;return t.forEach(E=>{const A=w8(E.event_type),N=S.get(A);N!==void 0?w[N].count++:(S.set(A,w.length),w.push({displayName:A,color:S8(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(Wr,{className:Nt("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(al,{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:()=>a(w),onPointerLeave:()=>a(null),onClick:()=>c(I=>I===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:op(0)}),p.jsx("span",{children:op(n/2)}),p.jsx("span",{children:op(n)})]}),p.jsx("div",{className:"absolute top-0 left-0 right-0 h-24",children:t.map((w,S)=>p.jsx(Gbe,{event:w,intervalStart:e,intervalDuration:n,sortedEvents:v,closeEventWindow:b.get(S),thresholdLabel:g,highlightedDisplayName:d},`${w.timestamp}-${S}`))})]})})]})})]})}function Gbe({event:t,intervalStart:e,intervalDuration:n,sortedEvents:r,closeEventWindow:i,thresholdLabel:s,highlightedDisplayName:o}){const l=(t.timestamp-e)/n*100;if(l<0||l>100)return null;const c=S8(t.event_type),h=(i?Math.max(0,i.end-i.start):0)>0,g=w8(t.event_type),v=o===null?null:g===o;return p.jsx(Zc,{className:"absolute top-0 bottom-0 w-0.5 group cursor-pointer",style:{left:`${l}%`,backgroundColor:v===!1?Fbe(c,.8):c,zIndex:v===!0?20:1},interactive:h,tooltip:p.jsx(Wbe,{event:t,sortedEvents:r,closeEventWindow:i,thresholdLabel:s})})}function Wbe({event:t,sortedEvents:e,closeEventWindow:n,thresholdLabel:r}){const i=a=>{const l=w8(a.event_type).split(" ").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ");return(a.event_type==="weight_update"||a.event_type==="save_batch")&&a.step!==-1?`${l} ${a.step}`:l},s=T.useMemo(()=>!n||e.length===0?[t]:e.slice(n.start,n.end+1).map(l=>l.event),[n,e,t]),o=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:[o&&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 ${o?"pt-2 pb-2 space-y-3":"py-2"}`,children:s.map((a,l)=>{const c=S8(a.event_type),d=i(a);return p.jsxs("div",{className:o&&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:[a.step!==-1&&p.jsxs("div",{children:["Step: ",a.step]}),p.jsxs("div",{children:["Time:"," ",new Date(a.timestamp*1e3).toISOString().slice(11,23)]})]})]},`${a.timestamp}-${l}`)})})]})}function $be({servers:t,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i,inferenceServerNodeMap:s,totalSetupNodes:o,isLoading:a}){var ve;const[g,v]=T.useState(!0),[b,_]=un(Gce),[w,S]=un(dT),[E,A]=un(Vce),[N,I]=un(MG),[P,L]=un(Wce),[R,O]=un($ce),[F,U]=un(Bce),[q,B]=un(EG),Z=Pi(ml),G=8,$=t.length>G,K=T.useMemo(()=>{if(!$)return[];const ge=[];for(let Te=0;Te<t.length;Te+=G){const He=t.slice(Te,Te+G),pe=Te,qe=Math.min(Te+G,t.length)-1;ge.push({label:`${pe} – ${qe}`,servers:He})}return ge},[t,$]),Y=$?Math.min(F,Math.max(0,K.length-1)):0;T.useEffect(()=>{$&&F!==Y&&U(Y)},[$,F,Y,U]);const J=$?((ve=K[Y])==null?void 0:ve.servers)??t.slice(0,G):t,H=T.useMemo(()=>typeof o=="number"&&Number.isFinite(o)?o>1:s?new Set(Object.values(s).filter(Te=>Te!==null)).size>1:!1,[s,o]),z=T.useMemo(()=>{const ge=new Set,Te=[];for(const He of Object.values(e))for(const pe of He){if(pe.event_type!=="request"||pe.sample_id==null||pe.group_id==null)continue;const qe=`${pe.group_id}:${pe.sample_id}`;ge.has(qe)||(ge.add(qe),Te.push({group_id:pe.group_id,sample_idx:pe.sample_id}))}return Te},[e]),{data:X}=M8(Z??"",z,!!Z&&z.length>0&&w),V=!w||z.length===0||!!X,ie=!w||V,ae=T.useMemo(()=>{const ge=new Map;return X==null||X.statuses.forEach(Te=>{ge.set(`${Te.group_id}:${Te.sample_idx}`,Te.kind)}),ge},[X]),re=T.useMemo(()=>{let ge=i;for(const Te of Object.values(e))for(const He of Te)He.event_type==="request"&&He.lane!=null&&He.lane+1>ge&&(ge=He.lane+1);return ge},[e,i]),ce=Math.max(1,t.length),oe=Math.max(1,Math.floor(R/ce)),fe=re,me=Math.max(1,Math.ceil(fe/oe)),ye=Math.min(P,Math.max(0,me-1));T.useEffect(()=>{P!==ye&&L(ye)},[P,ye,L]);const Ee=ye*oe,Ge=oe,_e=Math.min(Ee+oe-1,fe-1),De=T.useMemo(()=>{let ge=0;for(const Te of Object.values(e))ge+=Te.length;return ge},[e]),he=T.useMemo(()=>({servers:J,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i}),[J,e,n,r,i]),Le=T.useMemo(()=>`${n}:${r}:${J.join(",")}:${De}:${w}`,[n,r,J,De,w]),[ne,We]=T.useState(null),[je,be]=T.useState(null),[Xe,le]=T.useState(null);ie&&(ne!==he||je!==ae||Xe!==Le)&&(We(he),be(ae),le(Le));const te=w&&Xe!==null&&Le!==Xe,Se=T.useCallback(ge=>{if(ge.event_type==="request"&&!(ge.sample_id===void 0||ge.group_id===void 0)){if((q==null?void 0:q.sampleId)===ge.sample_id){B(null);return}B({sampleId:ge.sample_id,groupId:ge.group_id,isEval:ge.is_eval})}},[q,B]);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(Wr,{className:Nt("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:a&&p.jsx(al,{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(Qle,{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(sp,{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:ye<=0,children:p.jsx(p8,{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":`${Ee}–${_e}`}),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(me-1,ge+1)),disabled:ye>=me-1,children:p.jsx(Wr,{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(mG,{className:"h-3.5 w-3.5"})})}),p.jsxs(pl,{align:"end",children:[p.jsx(H1,{children:"Max Lanes"}),p.jsx(ul,{}),[64,128,256,512,1024].map(ge=>p.jsx(pi,{checked:R===ge,onCheckedChange:()=>{O(ge),L(0)},children:ge},ge))]})]}),$&&p.jsxs(Q8,{value:String(Y),onValueChange:ge=>U(Number(ge)),children:[p.jsx(ek,{size:"sm",className:"text-xs h-7 gap-1",children:p.jsx(J8,{})}),p.jsx(tk,{children:K.map((ge,Te)=>p.jsxs(nk,{value:String(Te),children:["Servers ",ge.label]},Te))})]}),p.jsx(p1,{variant:"selecting",size:"sm",pressed:w,onPressedChange:S,className:"text-xs px-2 h-7",children:"Highlight Discarded"}),p.jsx(p1,{variant:"selecting",size:"sm",pressed:E,onPressedChange:A,className:"text-xs px-2 h-7",children:"Show Weight Update"}),p.jsx(p1,{variant:"selecting",size:"sm",pressed:N,onPressedChange:I,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=ne??(ie?he:null),Te=je??(ie?ae:null);if(!ge||!Te)return null;const He=te?!0:V;return p.jsx("div",{className:`transition-opacity ${te?"opacity-60":"opacity-100"}`,children:p.jsx("div",{className:"space-y-3",children:ge.servers.map(pe=>p.jsx(i_e,{server:pe,nodeId:(s==null?void 0:s[pe])??null,showNodeLabel:H,events:ge.eventsByServer[pe]||[],intervalStart:ge.intervalStart,intervalDuration:ge.intervalDuration,numLanes:ge.lanesPerServer,selectedRequest:q,sampleStatusByKey:Te,highlightDiscarded:w,discardStatusReady:He,onEventClick:Se,showWeightUpdate:E,showComputeReward:N,laneHeight:b,laneStart:Ee,maxLanesToShow:Ge},pe))})})})():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:op(0)}),p.jsx("span",{children:op(r/2)}),p.jsx("span",{children:op(r)})]})]})]})}const qbe="#075985",Xbe="#047857",cX="#0284c7",uX="#10b981",dX="#a1a1a1",fX="#b0b0b0",Ybe="#0c4a6e",Kbe="#065f46",hX="#8a8a8a",Zbe="#0ea5e9",Qbe="#ababab",Jbe="#0ea5e9",e_e="#ababab",t_e="#34d399",n_e="#ababab",pX="#0369a1",mX="#0369a1",gX="#047857",vX="#0284c7",xX="#0284c7",yX="#10b981",bX="#b3b3b3",_X="#b3b3b3",SX="#b3b3b3";function r_e({eventsBySampleId:t,selectedSampleId:e,timeBounds:n,groupId:r,runPath:i,envResponseTimesBySample:s,computeRewardTimeBySample:o,onSampleClick:a,showNodeLabel:l,isEval:c}){const d=Object.keys(t).map(Number).sort((L,R)=>L-R),h=Pi(dT),g=T.useMemo(()=>d.map(L=>({group_id:r,sample_idx:L})),[r,d.join(",")]),{data:v}=M8(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?fX:_?dX:w?uX:cX,A=16,N=3,I=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(Lbe,{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:I},children:d.map((L,R)=>{const O=t[L],F=L===e,U=R*(A+N),q=F?S?hX:_?"#6b7280":w?Kbe:Ybe:E,B=[...O].sort((Y,J)=>Y.start_time-J.start_time),Z=(s==null?void 0:s[L])??[],G=(o==null?void 0:o[L])??0,$=[];for(let Y=0;Y<B.length&&Y<Z.length;Y++){const J=Z[Y].time;J>0&&$.push({start:B[Y].end_time,duration:J,idx:Y})}let K=0;if(G>0&&B.length>0&&(K=B[B.length-1].end_time,Z.length>=B.length)){const J=Z[B.length-1];J&&J.time>0&&(K+=J.time)}return p.jsxs("div",{className:"absolute left-0 right-0",style:{top:U,height:A},children:[O.map((Y,J)=>{const z=(Y.start_time-n.start)/n.duration*100,X=Y.end_time-Y.start_time,V=X*1e3,ie=Math.max(.5,X/n.duration*100);return p.jsx(Zc,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${z}%`,width:`${Math.min(ie,100-z)}%`,backgroundColor:q,borderRadius:"1px",border:S?"1px solid rgba(0, 0, 0, 0.12)":"1px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},onClick:a?()=>a(L):void 0,tooltip:p.jsx(Vu,{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:q,statusLabel:S?{text:"Canceled",className:"text-gray-500"}:_?{text:"Discarded",className:"text-red-700"}:null,details:aX(Y,V,[{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-${J}`)}),$.map(Y=>{const H=(Y.start-n.start)/n.duration*100,z=Math.max(.3,Y.duration/n.duration*100),X=Y.duration*1e3,V=F?_?"#6b7280":pX:_?bX:vX;return p.jsx(Zc,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${H}%`,width:`${Math.min(z,100-H)}%`,backgroundColor:V,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:.85},onClick:a?()=>a(L):void 0,tooltip:p.jsx(Vu,{title:"Env Response",titleSecondary:`Turn ${Y.idx}`,color:V,details:[{label:"Duration",value:Ns(X)}]})},`env-${Y.idx}`)}),G>0&&B.length>0&&(()=>{const J=(K-n.start)/n.duration*100,H=Math.max(.3,G/n.duration*100),z=G*1e3,X=F?_?"#6b7280":c?gX:mX:_?c?SX:_X:c?yX:xX;return p.jsx(Zc,{className:`absolute top-px bottom-px group ${a?"cursor-pointer":""}`,style:{left:`${J}%`,width:`${Math.min(H,100-J)}%`,backgroundColor:X,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:.85},onClick:a?()=>a(L):void 0,tooltip:p.jsx(Vu,{title:c?"Compute Metrics":"Compute Reward",color:X,details:[{label:"Duration",value:Ns(z)}]})})})()]},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:I+24},children:p.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"})})}function i_e({server:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,numLanes:o,selectedRequest:a,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:I}=T.useMemo(()=>{const Z=[],G=[];for(const K of A)K.lane!=null&&K.lane>=0?Z.push({...K,lane:K.lane}):G.push(K);if(G.length>0){const K=[...G].sort((J,H)=>J.start_time-H.start_time),Y=[];for(const J of K){let H=!1;for(let z=0;z<Y.length;z++)if(Y[z]<=J.start_time){Y[z]=J.end_time+(J.environment_response_time??0)+(J.compute_reward_time??0),Z.push({...J,lane:z}),H=!0;break}if(!H){const z=Y.length;Y.push(J.end_time+(J.environment_response_time??0)+(J.compute_reward_time??0)),Z.push({...J,lane:z})}}}const $=Z.reduce((K,Y)=>Math.max(K,Y.lane),-1);return{assignedEvents:Z,actualNumLanes:Math.max(o,$+1)}},[A,o]),P=i+s,L=b,R=w!==void 0?Math.min(_+w,I):I,O=Math.max(0,R-_),F=O*L+Math.max(0,O-1)*2,U=T.useMemo(()=>Array.from({length:O},(Z,G)=>G),[O]),{laneEventsByIndex:q,idlePeriodsByLane:B}=T.useMemo(()=>{const Z=Array.from({length:I},()=>[]);for(const $ of N){const K=$.lane;Z[K]&&Z[K].push($)}const G=Z.map($=>{const K=[];if($.length>0){$[0].start_time>i&&K.push({start:i,end:$[0].start_time,duration:$[0].start_time-i});for(let J=0;J<$.length-1;J++){const H=$[J].end_time,z=$[J+1].start_time;H<z&&K.push({start:H,end:z,duration:z-H})}const Y=$[$.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:G}},[N,i,P,s,I]);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:F},children:[U.map(Z=>{const G=Z+_,$=Z*(L+2),K=q[G]||[],Y=B[G]||[];return p.jsxs("div",{className:"absolute left-0 right-0",style:{top:$,height:L},children:[Y.map((J,H)=>{const z=Math.max(J.start,i),X=Math.min(J.end,P),V=X-z,ie=(z-i)/s*100,ae=V/s*100;return ae<.5||ie>=100||X<=z?null:p.jsx(Zc,{className:"absolute top-0 bottom-0 group",style:{left:`${ie}%`,width:`${Math.min(ae,100-ie)}%`,backgroundColor:V1,borderRadius:"1px"},tooltip:p.jsx(Vu,{title:"Idle",color:V1,details:[{label:"Duration",value:Ns(J.duration*1e3)},{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[],{label:"Lane",value:String(G)}]})},`idle-${H}`)}),K.map((J,H)=>{const z=J.environment_response_time,X=J.compute_reward_time,V=YL(J,"env",a,l,c,d),ie=YL(J,"reward",a,l,c,d);return p.jsxs(T.Fragment,{children:[p.jsx(a_e,{event:J,server:t,nodeId:S,lane:G,intervalStart:i,intervalDuration:s,selectedRequest:a,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:d,onClick:()=>h(J)}),z!=null&&z>0&&(()=>{const ae=i+s,re=J.end_time,ce=re+z;if(re>=ae||ce<=i)return null;const oe=Math.max(re,i),fe=Math.min(ce,ae),me=Math.max(0,(oe-i)/s*100),ye=Math.max(.3,(fe-oe)/s*100),Ee=z*1e3;return p.jsx(Zc,{className:"absolute top-0 bottom-0 group cursor-pointer",style:{left:`${me}%`,width:`${Math.min(ye,100-me)}%`,backgroundColor:V.color,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:V.opacity},onClick:()=>h(J),tooltip:p.jsx(Vu,{title:"Env Response",titleSecondary:J.sample_id!==void 0?`Sample ${J.sample_id}`:void 0,color:V.color,details:[{label:"Duration",value:Ns(Ee)},...J.group_id!==void 0?[{label:"Group",value:String(J.group_id)}]:[],{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[],{label:"Lane",value:String(G)}]})})})(),v&&X!=null&&X>0&&(()=>{const ae=i+s,re=J.end_time+(z!=null&&z>0?z:0),ce=re+X;if(re>=ae||ce<=i)return null;const oe=Math.max(re,i),fe=Math.min(ce,ae),me=Math.max(0,(oe-i)/s*100),ye=Math.max(.3,(fe-oe)/s*100),Ee=X*1e3;return p.jsx(Zc,{className:"absolute top-0 bottom-0 group cursor-pointer",style:{left:`${me}%`,width:`${Math.min(ye,100-me)}%`,backgroundColor:ie.color,borderRadius:"1px",border:"1px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:ie.opacity},onClick:()=>h(J),tooltip:p.jsx(Vu,{title:J.is_eval?"Compute Metrics":"Compute Reward",titleSecondary:J.sample_id!==void 0?`Sample ${J.sample_id}`:void 0,color:ie.color,details:[{label:"Duration",value:Ns(Ee)},...J.group_id!==void 0?[{label:"Group",value:String(J.group_id)}]:[],{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[],{label:"Lane",value:String(G)}]})})})()]},`event-${H}`)})]},G)}),g&&E.map((Z,G)=>{const $=Z.start_time-i,K=Math.max(0,$/s*100),J=(Z.end_time-Z.start_time)*1e3,H=Math.max(Z.start_time,i),z=Z.end_time-H,X=Math.max(.5,z/s*100),V=DG(Z.event_type);return p.jsx(Zc,{className:"absolute group cursor-default",style:{top:0,left:`${K}%`,width:`${Math.min(X,100-K)}%`,height:F,backgroundColor:V,borderRadius:"2px",border:"1.5px solid rgba(0, 0, 0, 0.2)",boxSizing:"border-box",opacity:.6},tooltip:p.jsx(Vu,{title:"Weight Broadcast",color:V,details:[...Z.step!=null?[{label:"Step",value:String(Z.step)}]:[],{label:"Duration",value:Ns(J)},{label:"Server",value:String(t)},...S!==void 0?[{label:"Node",value:String(S)}]:[]],startTime:Z.start_time,endTime:Z.end_time})},`wb-${G}`)})]})})]})}function s_e(t,e,n=!0,r=!0){if(t.event_type!=="request")return DG(t.event_type);if(t.is_canceled)return PG;if(!n)return t.is_eval?BC:LM;if(!r)return qN;if(!e||t.sample_id==null||t.group_id==null)return t.is_eval?BC:LM;const i=`${t.group_id}:${t.sample_id}`;return e.get(i)==="rollouts_discarded"?qN:t.is_eval?BC:LM}function o_e(t,e,n,r=!0,i=!0){const s=s_e(t,n,r,i);if(!e)return{color:s,opacity:1};const o=s===qN,a=s===PG;return t.sample_id===e.sampleId?a?{color:hX,opacity:1}:o?{color:"#6b7280",opacity:1}:{color:t.is_eval?Xbe:qbe,opacity:1}:t.group_id===e.groupId?a?{color:fX,opacity:1}:o?{color:dX,opacity:1}:{color:t.is_eval?uX:cX,opacity:1}:{color:s,opacity:.55}}function YL(t,e,n,r,i,s){const o=e==="reward"&&t.is_eval,a=(()=>{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=a?e==="env"?Qbe:o?n_e:e_e:e==="env"?Zbe:o?t_e:Jbe;return n?t.sample_id===n.sampleId?a?{color:"#6b7280",opacity:1}:{color:e==="env"?pX:o?gX:mX,opacity:1}:t.group_id===n.groupId?{color:a?e==="env"?bX:o?SX:_X:e==="env"?vX:o?yX:xX,opacity:1}:{color:l,opacity:.35}:{color:l,opacity:.85}}function a_e({event:t,server:e,nodeId:n,lane:r,intervalStart:i,intervalDuration:s,selectedRequest:o,sampleStatusByKey:a,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}=o_e(t,o,a,l,c),I=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(a.get(L)==="rollouts_discarded")return{text:"Discarded",className:"text-red-700"}}return null})();return p.jsx(Zc,{className:`absolute top-0 bottom-0 group ${I?"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:I?d:void 0,tooltip:p.jsx(Vu,{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"?aX(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 l_e({ranks:t,eventsByRank:e,intervalStart:n,intervalDuration:r,intervalEnd:i,trainerGpuMetricsByGpuIndex:s,trainerGpuMetricsByRank:o,trainerGpuMetricsIsLoading:a,trainerAvailableGpuMetrics:l,selectedMetricNames:c,onSelectedMetricNamesChange:d,trainerSystemGpuIndices:h,trainerRankInfoByRank:g,totalSetupNodes:v,isLoading:b}){var ce;const[_,w]=T.useState(!0),[S,E]=un(TG),[A,N]=un(Hce),I=T.useMemo(()=>{const oe=new Set;return(l??[]).forEach(fe=>{typeof fe=="string"&&oe.add(fe)}),Array.from(oe)},[l]),[P,L]=T.useState([]),R=((h==null?void 0:h.length)??0)===0;R&&P.length>0?L([]):!R&&I.length>0&&P!==I&&L(I);const O=T.useMemo(()=>R?[]:I.length>0?I:P,[R,I,P]),F=T.useMemo(()=>Array.from(new Set((c??[]).filter(oe=>typeof oe=="string"&&oe.trim().length>0))),[c]),U=T.useMemo(()=>O.length===0?F:F.filter(oe=>O.includes(oe)),[O,F]),q=T.useMemo(()=>{const oe=Object.keys(g??{}).map(Number).filter(fe=>Number.isFinite(fe)).sort((fe,me)=>fe-me);return oe.length>0?oe:!h||h.length===0?[]:h.map((fe,me)=>me)},[g,h]),B=T.useMemo(()=>{const oe=new Set;return t.forEach(fe=>oe.add(fe)),q.forEach(fe=>oe.add(fe)),Array.from(oe).sort((fe,me)=>fe-me)},[t,q]),Z=8,G=B.length>Z,$=T.useMemo(()=>{if(!G)return[];const oe=[];for(let fe=0;fe<B.length;fe+=Z){const me=B.slice(fe,fe+Z),ye=fe+1,Ee=Math.min(fe+Z,B.length);oe.push({label:`${ye} – ${Ee}`,ranks:me})}return oe},[B,G]),K=G?Math.min(A,Math.max(0,$.length-1)):0;T.useEffect(()=>{G&&A!==K&&N(K)},[G,A,K,N]);const Y=G?((ce=$[K])==null?void 0:ce.ranks)??B.slice(0,Z):B;T.useMemo(()=>new Set(Y),[Y]);const J=T.useMemo(()=>{const oe=new Map;return Object.entries(e).forEach(([fe,me])=>{const ye=new Set;me.forEach(Ee=>{if(!Ee.event_type.includes("/"))return;const Ge=Ee.event_type.split("/")[0];ye.add(`${Ge}|${Ee.step}`)}),oe.set(Number(fe),ye)}),oe},[e]),H=T.useMemo(()=>{const oe=new Map;return Y.forEach(fe=>{var Ee;const me=((Ee=g==null?void 0:g[fe])==null?void 0:Ee.node_id)??null,ye=me===null?"__unknown__":String(me);oe.has(ye)||oe.set(ye,{nodeId:me,ranks:[]}),oe.get(ye).ranks.push(fe)}),Array.from(oe.values()).map(fe=>({nodeId:fe.nodeId,ranks:fe.ranks.sort((me,ye)=>me-ye)})).sort((fe,me)=>fe.nodeId===null&&me.nodeId===null?0:fe.nodeId===null?1:me.nodeId===null?-1:fe.nodeId-me.nodeId)},[Y,g]),z=T.useMemo(()=>typeof v=="number"&&Number.isFinite(v)?v>1:H.filter(fe=>fe.nodeId!==null).length>1,[H,v]),X=T.useCallback(oe=>{var me;oe.event_type.includes("/")||!(((me=J.get(oe.rank))==null?void 0:me.has(`${oe.event_type}|${oe.step}`))??!1)||E(ye=>(ye==null?void 0:ye.eventType)===oe.event_type&&(ye==null?void 0:ye.rank)===oe.rank&&(ye==null?void 0:ye.step)===oe.step?null:{eventType:oe.event_type,rank:oe.rank,step:oe.step})},[J,E]),V=T.useCallback((oe,fe)=>{const me=U,Ee=fe===!0?me.includes(oe)?me:[...me,oe]:me.filter(Ge=>Ge!==oe);d==null||d(Ee)},[U,d]),ie=T.useCallback(()=>d==null?void 0:d([...O]),[O,d]),ae=T.useCallback(()=>d==null?void 0:d([]),[d]),re=T.useCallback(oe=>{const fe=g==null?void 0:g[oe],me=(fe==null?void 0:fe.local_rank)??(h?h[oe]:void 0),ye=(o==null?void 0:o[oe])??(me!==void 0&&s?s[me]??[]:void 0);return p.jsx(u_e,{rank:oe,nodeId:(fe==null?void 0:fe.node_id)??null,showNodeLabel:z,events:e[oe]||[],intervalStart:n,intervalDuration:r,intervalEnd:i,selectedEvent:S,onEventClick:X,childEventKeys:J.get(oe)??Ube,systemGpuIndex:me,gpuMetrics:ye,selectedMetricNames:U,gpuMetricsIsLoading:a??!1},oe)},[J,U,e,X,r,i,n,S,s,o,a,g,h,z]);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(Wr,{className:Nt("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(al,{className:"size-3.5 text-muted-foreground"})})]})}),_&&p.jsxs(p.Fragment,{children:[G&&p.jsxs(Q8,{value:String(K),onValueChange:oe=>N(Number(oe)),children:[p.jsx(ek,{size:"sm",className:"text-xs h-7 gap-1",children:p.jsx(J8,{})}),p.jsx(tk,{children:$.map((oe,fe)=>p.jsxs(nk,{value:String(fe),children:["GPUs ",oe.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:U.length}),p.jsx(Wr,{className:"h-3 w-3 text-muted-foreground"})]})}),p.jsxs(pl,{align:"start",className:"w-64",children:[p.jsx(H1,{children:"Trainer GPU Plots"}),p.jsx(ul,{}),p.jsx(_c,{onSelect:oe=>{oe.preventDefault(),ie()},className:"text-xs",children:"Select All"}),p.jsx(_c,{onSelect:oe=>{oe.preventDefault(),ae()},className:"text-xs",children:"Unselect All"}),p.jsx(ul,{}),O.length>0?O.map(oe=>p.jsx(pi,{checked:U.includes(oe),onCheckedChange:fe=>V(oe,fe),onSelect:fe=>fe.preventDefault(),className:"text-xs",children:lX(oe)},oe)):p.jsx(_c,{disabled:!0,className:"text-xs text-muted-foreground",children:a?"Loading plots...":"No plots available"})]})]})]})]}),p.jsxs(Qi,{children:[p.jsx("div",{className:"space-y-4",children:Y.length>0?z?H.map(oe=>p.jsx(c_e,{nodeId:oe.nodeId,rankCount:oe.ranks.length,children:oe.ranks.map(fe=>re(fe))},oe.nodeId===null?"__unknown__":String(oe.nodeId))):Y.map(oe=>re(oe)):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:op(0)}),p.jsx("span",{children:op(r/2)}),p.jsx("span",{children:op(r)})]})]})]})}function c_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(Wr,{className:Nt("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 u_e({rank:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,intervalEnd:o,selectedEvent:a,onEventClick:l,childEventKeys:c,systemGpuIndex:d,gpuMetrics:h,selectedMetricNames:g,gpuMetricsIsLoading:v}){const b=T.useMemo(()=>[...r.filter(I=>!I.event_type.includes("/"))].sort((I,P)=>I.start_time-P.start_time),[r]),_=T.useMemo(()=>wX(b,i,o),[b,i,o]),w=T.useMemo(()=>{if(!h||h.length===0)return{};const N={};return h.forEach(I=>{N[I.metric_name]||(N[I.metric_name]=[]),N[I.metric_name].push(I)}),N},[h]),S=T.useMemo(()=>{const N=new Set;return h==null||h.forEach(I=>{Number.isFinite(I.gpu_index)&&N.add(I.gpu_index)}),N.size>0?Array.from(N).sort((I,P)=>I-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(I=>{N[I]=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,I)=>p.jsx(d_e,{idle:N,rank:t,intervalStart:i,intervalDuration:s,dimmed:a!==null},`idle-${I}`)),b.map((N,I)=>{const P=(a==null?void 0:a.eventType)===N.event_type&&(a==null?void 0:a.rank)===N.rank&&(a==null?void 0:a.step)===N.step,L=c.has(`${N.event_type}|${N.step}`),R=a!==null&&!P;return p.jsx(f_e,{event:N,intervalStart:i,intervalDuration:s,isSelected:P,isDimmed:R,hasChildren:L,onClick:()=>l(N)},`${N.start_time}-${N.rank}-${I}`)})]}),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:lX(N)}),p.jsx(b$,{metricName:N,data:w[N]??[],gpuIndices:S,intervalStart:i,intervalEnd:o,variant:"timeline",strokeColor:"#ef4444",gpuDisplayNames:A,isLoading:v})]},N))]})]})}function d_e({idle:t,rank:e,intervalStart:n,intervalDuration:r,dimmed:i=!1}){const o=(t.start-n)/r*100,a=t.duration/r*100;return a<.5||o<0||o>=100?null:p.jsx(Zc,{className:"absolute top-1 bottom-1 group cursor-pointer transition-opacity duration-200",style:{left:`${o}%`,width:`${Math.min(a,100-o)}%`,backgroundColor:V1,borderRadius:"2px",opacity:i?.3:1},tooltip:p.jsx(Vu,{title:"Idle",color:V1,details:[{label:"Duration",value:Ns(t.duration*1e3)},{label:"Rank",value:String(e)}],startTime:t.start,endTime:t.end})})}function f_e({event:t,intervalStart:e,intervalDuration:n,isSelected:r=!1,isDimmed:i=!1,hasChildren:s=!1,onClick:o}){const a=e+n;if(t.end_time<=e||t.start_time>=a)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,_=f2(t.event_type),w=IG(t.event_type,t.step,t.microbatch,t.minibatch);return p.jsx(Zc,{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?o:void 0,tooltip:p.jsx(Vu,{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 h_e({parentEvent:t,childEvents:e}){const n=[...e].sort((a,l)=>a.start_time-l.start_time),r=t.start_time,i=t.end_time,s=i-r,o=wX(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(a=>{const l=f2(a.event_type),c=a.event_type.includes("/")?a.event_type.split("/").pop():a.event_type,d=a.end_time-a.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,"%"]})]},a.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:[o.map((a,l)=>{const d=(a.start-r)/s*100,h=a.duration/s*100;return h<.5||d<0||d>=100?null:p.jsx(Zc,{className:"absolute top-px bottom-px group",style:{left:`${d}%`,width:`${Math.min(h,100-d)}%`,backgroundColor:V1,borderRadius:"1px",opacity:.5},tooltip:p.jsx(Vu,{title:"Gap",color:V1,details:[{label:"Duration",value:Ns(a.duration*1e3)}]})},`child-idle-${l}`)}),n.map((a,l)=>{const c=a.start_time-r,d=Math.max(0,c/s*100),h=a.end_time-a.start_time,g=h*1e3,v=Math.max(.5,h/s*100),b=f2(a.event_type),_=a.event_type.includes("/")?a.event_type.split("/").pop():a.event_type;return p.jsx(Zc,{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(Vu,{title:_||a.event_type,color:b,capitalize:!0,details:[{label:"Duration",value:Ns(g)},{label:"% of parent",value:`${(h/s*100).toFixed(1)}%`}],startTime:a.start_time,endTime:a.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-${a.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 Vu({title:t,titleSecondary:e,color:n,details:r,capitalize:i=!1,timestamp:s,startTime:o,endTime:a,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)]}),o!==void 0&&p.jsxs("div",{children:["Start: ",new Date(o*1e3).toISOString().slice(11,23)]}),a!==void 0&&p.jsxs("div",{children:["End: ",new Date(a*1e3).toISOString().slice(11,23)]})]})]})}function Zc({className:t,style:e,onClick:n,tooltip:r,children:i,interactive:s=!1}){const[o,a]=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=o||l,S=l&&g?g:d;T.useLayoutEffect(()=>{const A=b.current;if(!w||!A)return;const N=A.getBoundingClientRect(),I=8;let P=S.x-N.width/2;P+N.width+I>window.innerWidth&&(P=window.innerWidth-N.width-I),P<I&&(P=I);let L=S.y-N.height-12;L<I&&(L=S.y+16),L+N.height+I>window.innerHeight&&(L=window.innerHeight-N.height-I),A.style.left=`${P}px`,A.style.top=`${L}px`,A.style.visibility="visible"},[w,S]),T.useEffect(()=>{if(!l)return;const A=I=>{var L,R;const P=I.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}),a(!0)},onPointerLeave:()=>{a(!1)},onPointerMove:A=>{l||h({x:A.clientX,y:A.clientY})},children:[i,w?zd.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 wX(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,o=t[i+1].start_time;s<o&&r.push({start:s,end:o,duration:o-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 Fk({currentPage:t,totalPages:e,onPageChange:n,disabled:r=!1,pageValues:i}){const s=(i==null?void 0:i[t])??t,o=(i==null?void 0:i[0])??0,a=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(Rle,{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(h8,{className:"h-3.5 w-3.5"})}),p.jsxs("div",{className:"flex items-center gap-1 text-xs px-1",children:[p.jsx(V0,{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:o,max:a}),p.jsxs("span",{className:"text-muted-foreground",children:["/ ",a]})]}),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(Vg,{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(Ple,{className:"h-3.5 w-3.5"})})]})}/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const bw="183",wg={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Mg={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},MX=0,IR=1,TX=2,p_e=3,EX=0,b1=1,I_=2,Rg=3,mp=0,Gl=1,Yc=2,nh=0,$g=1,OR=2,LR=3,zR=4,CX=5,m_e=6,C0=100,AX=101,NX=102,RX=103,kX=104,PX=200,DX=201,IX=202,OX=203,P2=204,D2=205,LX=206,zX=207,jX=208,FX=209,UX=210,BX=211,HX=212,VX=213,GX=214,I2=0,O2=1,L2=2,lv=3,z2=4,j2=5,F2=6,U2=7,_w=0,WX=1,$X=2,ru=0,Uk=1,Bk=2,Hk=3,WT=4,Vk=5,Gk=6,Wk=7,jR="attached",qX="detached",$T=300,oh=301,em=302,O_=303,L_=304,Ry=306,mS=1e3,Tc=1001,gS=1002,Co=1003,$k=1004,g_e=1004,r1=1005,v_e=1005,rs=1006,z_=1007,x_e=1007,Zf=1008,y_e=1008,jl=1009,qk=1010,Xk=1011,ty=1012,qT=1013,Zu=1014,Vl=1015,ah=1016,XT=1017,YT=1018,ny=1020,Yk=35902,Kk=35899,Zk=1021,Qk=1022,cl=1023,lh=1026,F0=1027,KT=1028,Sw=1029,cv=1030,ZT=1031,b_e=1032,QT=1033,j_=33776,F_=33777,U_=33778,B_=33779,B2=35840,H2=35841,V2=35842,G2=35843,W2=36196,$2=37492,q2=37496,X2=37488,Y2=37489,K2=37490,Z2=37491,Q2=37808,J2=37809,e5=37810,t5=37811,n5=37812,r5=37813,i5=37814,s5=37815,o5=37816,a5=37817,l5=37818,c5=37819,u5=37820,d5=37821,f5=36492,h5=36494,p5=36495,m5=36283,g5=36284,v5=36285,x5=36286,XX=2200,YX=2201,KX=2202,vS=2300,y5=2301,HM=2302,FR=2303,kg=2400,Pg=2401,xS=2402,JT=2500,Jk=2501,__e=0,S_e=1,w_e=2,ZX=3200,QX=3201,M_e=3202,T_e=3203,gm=0,JX=1,rp="",ll="srgb",tm="srgb-linear",yS="linear",Fi="srgb",E_e="",C_e="rg",A_e="ga",N_e=0,Tg=7680,R_e=7681,k_e=7682,P_e=7683,D_e=34055,I_e=34056,O_e=5386,L_e=512,z_e=513,j_e=514,F_e=515,U_e=516,B_e=517,H_e=518,UR=519,eY=512,tY=513,nY=514,eE=515,rY=516,iY=517,tE=518,sY=519,bS=35044,V_e=35048,G_e=35040,W_e=35045,$_e=35049,q_e=35041,X_e=35046,Y_e=35050,K_e=35042,Z_e="100",BR="300 es",Qc=2e3,uv=2001,Q_e={COMPUTE:"compute",RENDER:"render"},J_e={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},eSe={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},tSe={TEXTURE_COMPARE:"depthTextureCompare"};function nSe(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const rSe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function i1(t,e){return new rSe[t](e)}function oY(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function _S(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function aY(){const t=_S("canvas");return t.style.display="block",t}const KL={};let nm=null;function iSe(t){nm=t}function sSe(){return nm}function SS(...t){const e="THREE."+t.shift();nm?nm("log",e,...t):console.log(e,...t)}function lY(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 pn(...t){t=lY(t);const e="THREE."+t.shift();if(nm)nm("warn",e,...t);else{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function Un(...t){t=lY(t);const e="THREE."+t.shift();if(nm)nm("error",e,...t);else{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function wS(...t){const e=t.join(" ");e in KL||(KL[e]=!0,pn(...t))}function oSe(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 aSe={[I2]:O2,[L2]:F2,[z2]:U2,[lv]:j2,[O2]:I2,[F2]:L2,[U2]:z2,[j2]:lv};let gh=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,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}};const rl=["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 qg=Math.PI/180,ry=180/Math.PI;function iu(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(rl[t&255]+rl[t>>8&255]+rl[t>>16&255]+rl[t>>24&255]+"-"+rl[e&255]+rl[e>>8&255]+"-"+rl[e>>16&15|64]+rl[e>>24&255]+"-"+rl[n&63|128]+rl[n>>8&255]+"-"+rl[n>>16&255]+rl[n>>24&255]+rl[r&255]+rl[r>>8&255]+rl[r>>16&255]+rl[r>>24&255]).toLowerCase()}function or(t,e,n){return Math.max(e,Math.min(n,t))}function e9(t,e){return(t%e+e)%e}function lSe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function cSe(t,e,n){return t!==e?(n-t)/(e-t):0}function H_(t,e,n){return(1-n)*t+n*e}function uSe(t,e,n,r){return H_(t,e,1-Math.exp(-n*r))}function dSe(t,e=1){return e-Math.abs(e9(t,e*2)-e)}function fSe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function hSe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function pSe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function mSe(t,e){return t+Math.random()*(e-t)}function gSe(t){return t*(.5-Math.random())}function vSe(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 xSe(t){return t*qg}function ySe(t){return t*ry}function bSe(t){return(t&t-1)===0&&t!==0}function _Se(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function SSe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function wSe(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),d=o((e+r)/2),h=s((e-r)/2),g=o((e-r)/2),v=s((r-e)/2),b=o((r-e)/2);switch(i){case"XYX":t.set(a*d,l*h,l*g,a*c);break;case"YZY":t.set(l*g,a*d,l*h,a*c);break;case"ZXZ":t.set(l*h,l*g,a*d,a*c);break;case"XZX":t.set(a*d,l*b,l*v,a*c);break;case"YXY":t.set(l*v,a*d,l*b,a*c);break;case"ZYZ":t.set(l*b,l*v,a*d,a*c);break;default:pn("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Fl(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 Nr(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 cY={DEG2RAD:qg,RAD2DEG:ry,generateUUID:iu,clamp:or,euclideanModulo:e9,mapLinear:lSe,inverseLerp:cSe,lerp:H_,damp:uSe,pingpong:dSe,smoothstep:fSe,smootherstep:hSe,randInt:pSe,randFloat:mSe,randFloatSpread:gSe,seededRandom:vSe,degToRad:xSe,radToDeg:ySe,isPowerOfTwo:bSe,ceilPowerOfTwo:_Se,floorPowerOfTwo:SSe,setQuaternionFromProperEuler:wSe,normalize:Nr,denormalize:Fl};class jt{constructor(e=0,n=0){jt.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=or(this.x,e.x,n.x),this.y=or(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=or(this.x,e,n),this.y=or(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(or(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(or(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,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ua{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,o,a){let l=r[i+0],c=r[i+1],d=r[i+2],h=r[i+3],g=s[o+0],v=s[o+1],b=s[o+2],_=s[o+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-a;if(w<.9995){const E=Math.acos(w),A=Math.sin(E);S=Math.sin(S*E)/A,a=Math.sin(a*E)/A,l=l*S+g*a,c=c*S+v*a,d=d*S+b*a,h=h*S+_*a}else{l=l*S+g*a,c=c*S+v*a,d=d*S+b*a,h=h*S+_*a;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,o){const a=r[i],l=r[i+1],c=r[i+2],d=r[i+3],h=s[o],g=s[o+1],v=s[o+2],b=s[o+3];return e[n]=a*b+d*h+l*v-c*g,e[n+1]=l*b+d*g+c*h-a*v,e[n+2]=c*b+d*v+a*g-l*h,e[n+3]=d*b-a*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,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),d=a(i/2),h=a(s/2),g=l(r/2),v=l(i/2),b=l(s/2);switch(o){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:pn("Quaternion: .setFromEuler() encountered an unknown order: "+o)}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],o=n[1],a=n[5],l=n[9],c=n[2],d=n[6],h=n[10],g=r+a+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=(o-i)*v}else if(r>a&&r>h){const v=2*Math.sqrt(1+r-a-h);this._w=(d-l)/v,this._x=.25*v,this._y=(i+o)/v,this._z=(s+c)/v}else if(a>h){const v=2*Math.sqrt(1+a-r-h);this._w=(s-c)/v,this._x=(i+o)/v,this._y=.25*v,this._z=(l+d)/v}else{const v=2*Math.sqrt(1+h-r-a);this._w=(o-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(or(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,o=e._w,a=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+o*a+i*c-s*l,this._y=i*d+o*l+s*a-r*c,this._z=s*d+o*c+r*l-i*a,this._w=o*d-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){let r=e._x,i=e._y,s=e._z,o=e._w,a=this.dot(e);a<0&&(r=-r,i=-i,s=-s,o=-o,a=-a);let l=1-n;if(a<.9995){const c=Math.acos(a),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+o*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+o*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 ze{constructor(e=0,n=0,r=0){ze.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,o=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])*o,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),d=2*(a*n-s*i),h=2*(s*r-o*n);return this.x=n+l*c+o*h-a*d,this.y=r+l*d+a*c-s*h,this.z=i+l*h+s*d-o*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=or(this.x,e.x,n.x),this.y=or(this.y,e.y,n.y),this.z=or(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=or(this.x,e,n),this.y=or(this.y,e,n),this.z=or(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(or(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,o=n.x,a=n.y,l=n.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,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(or(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 ze,QL=new Ua;class _r{constructor(e,n,r,i,s,o,a,l,c){_r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c)}set(e,n,r,i,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=o,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,o=r[0],a=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],I=i[2],P=i[5],L=i[8];return s[0]=o*_+a*E+l*I,s[3]=o*w+a*A+l*P,s[6]=o*S+a*N+l*L,s[1]=c*_+d*E+h*I,s[4]=c*w+d*A+h*P,s[7]=c*S+d*N+h*L,s[2]=g*_+v*E+b*I,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],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return n*o*d-n*a*c-r*s*d+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=d*o-a*c,g=a*l-d*s,v=c*s-o*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]=(a*r-i*o)*_,e[3]=g*_,e[4]=(d*n-i*l)*_,e[5]=(i*s-a*n)*_,e[6]=v*_,e[7]=(r*l-c*n)*_,e[8]=(o*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,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+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 _r,JL=new _r().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ez=new _r().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function MSe(){const t={enabled:!0,workingColorSpace:tm,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Fi&&(i.r=up(i.r),i.g=up(i.g),i.b=up(i.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Fi&&(i.r=_1(i.r),i.g=_1(i.g),i.b=_1(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===rp?yS: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,o){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].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 wS("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return wS("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({[tm]:{primaries:e,whitePoint:r,transfer:yS,toXYZ:JL,fromXYZ:ez,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:ll},outputColorSpaceConfig:{drawingBufferColorSpace:ll}},[ll]:{primaries:e,whitePoint:r,transfer:Fi,toXYZ:JL,fromXYZ:ez,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:ll}}}),t}const oi=MSe();function up(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function _1(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Ax;class uY{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{Ax===void 0&&(Ax=_S("canvas")),Ax.width=e.width,Ax.height=e.height;const i=Ax.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Ax}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=_S("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 o=0;o<s.length;o++)s[o]=up(s[o]/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(up(n[r]/255)*255):n[r]=up(n[r]);return{data:n,width:e.width,height:e.height}}else return pn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let TSe=0;class U0{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:TSe++}),this.uuid=iu(),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 o=0,a=i.length;o<a;o++)i[o].isDataTexture?s.push(UA(i[o].image)):s.push(UA(i[o]))}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?uY.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(pn("Texture: Unable to serialize Texture."),{})}let ESe=0;const BA=new ze;class ro extends gh{constructor(e=ro.DEFAULT_IMAGE,n=ro.DEFAULT_MAPPING,r=Tc,i=Tc,s=rs,o=Zf,a=cl,l=jl,c=ro.DEFAULT_ANISOTROPY,d=rp){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:ESe++}),this.uuid=iu(),this.name="",this.source=new U0(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new jt(0,0),this.repeat=new jt(1,1),this.center=new jt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new _r,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){pn(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){pn(`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 mS:e.x=e.x-Math.floor(e.x);break;case Tc:e.x=e.x<0?0:1;break;case gS: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 mS:e.y=e.y-Math.floor(e.y);break;case Tc:e.y=e.y<0?0:1;break;case gS: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++}}ro.DEFAULT_IMAGE=null;ro.DEFAULT_MAPPING=$T;ro.DEFAULT_ANISOTROPY=1;class di{constructor(e=0,n=0,r=0,i=1){di.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,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*i+o[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,I=(S+1)/2,P=(d+g)/4,L=(h+_)/4,R=(b+w)/4;return A>N&&A>I?A<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(A),i=P/r,s=L/r):N>I?N<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(N),r=P/i,s=R/i):I<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(I),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=or(this.x,e.x,n.x),this.y=or(this.y,e.y,n.y),this.z=or(this.z,e.z,n.z),this.w=or(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=or(this.x,e,n),this.y=or(this.y,e,n),this.z=or(this.z,e,n),this.w=or(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(or(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 t9 extends gh{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 di(0,0,e,n),this.scissorTest=!1,this.viewport=new di(0,0,e,n),this.textures=[];const i={width:e,height:n,depth:r.depth},s=new ro(i),o=r.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0,this.textures[a].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 U0(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 su extends t9{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class nE extends ro{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=Co,this.minFilter=Co,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 CSe extends su{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 ro{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=Co,this.minFilter=Co,this.wrapR=Tc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ASe extends su{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,o,a,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,o,a,l,c,d,h,g,v,b,_,w)}set(e,n,r,i,s,o,a,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]=o,S[9]=a,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/Nx.setFromMatrixColumn(e,0).length(),s=1/Nx.setFromMatrixColumn(e,1).length(),o=1/Nx.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]*o,n[9]=r[9]*o,n[10]=r[10]*o,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,o=Math.cos(r),a=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=o*d,v=o*h,b=a*d,_=a*h;n[0]=l*d,n[4]=-l*h,n[8]=c,n[1]=v+b*c,n[5]=g-_*c,n[9]=-a*l,n[2]=_-g*c,n[6]=b+v*c,n[10]=o*l}else if(e.order==="YXZ"){const g=l*d,v=l*h,b=c*d,_=c*h;n[0]=g+_*a,n[4]=b*a-v,n[8]=o*c,n[1]=o*h,n[5]=o*d,n[9]=-a,n[2]=v*a-b,n[6]=_+g*a,n[10]=o*l}else if(e.order==="ZXY"){const g=l*d,v=l*h,b=c*d,_=c*h;n[0]=g-_*a,n[4]=-o*h,n[8]=b+v*a,n[1]=v+b*a,n[5]=o*d,n[9]=_-g*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const g=o*d,v=o*h,b=a*d,_=a*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]=a*l,n[10]=o*l}else if(e.order==="YZX"){const g=o*l,v=o*c,b=a*l,_=a*c;n[0]=l*d,n[4]=_-g*h,n[8]=b*h+v,n[1]=h,n[5]=o*d,n[9]=-a*d,n[2]=-c*d,n[6]=v*h+b,n[10]=g-_*h}else if(e.order==="XZY"){const g=o*l,v=o*c,b=a*l,_=a*c;n[0]=l*d,n[4]=-h,n[8]=c*d,n[1]=g*h+_,n[5]=o*d,n[9]=v*h-b,n[2]=b*h-v,n[6]=a*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(NSe,e,RSe)}lookAt(e,n,r){const i=this.elements;return Hc.subVectors(e,n),Hc.lengthSq()===0&&(Hc.z=1),Hc.normalize(),p0.crossVectors(r,Hc),p0.lengthSq()===0&&(Math.abs(r.z)===1?Hc.x+=1e-4:Hc.z+=1e-4,Hc.normalize(),p0.crossVectors(r,Hc)),p0.normalize(),C4.crossVectors(Hc,p0),i[0]=p0.x,i[4]=C4.x,i[8]=Hc.x,i[1]=p0.y,i[5]=C4.y,i[9]=Hc.y,i[2]=p0.z,i[6]=C4.z,i[10]=Hc.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,o=r[0],a=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],I=r[15],P=i[0],L=i[4],R=i[8],O=i[12],F=i[1],U=i[5],q=i[9],B=i[13],Z=i[2],G=i[6],$=i[10],K=i[14],Y=i[3],J=i[7],H=i[11],z=i[15];return s[0]=o*P+a*F+l*Z+c*Y,s[4]=o*L+a*U+l*G+c*J,s[8]=o*R+a*q+l*$+c*H,s[12]=o*O+a*B+l*K+c*z,s[1]=d*P+h*F+g*Z+v*Y,s[5]=d*L+h*U+g*G+v*J,s[9]=d*R+h*q+g*$+v*H,s[13]=d*O+h*B+g*K+v*z,s[2]=b*P+_*F+w*Z+S*Y,s[6]=b*L+_*U+w*G+S*J,s[10]=b*R+_*q+w*$+S*H,s[14]=b*O+_*B+w*K+S*z,s[3]=E*P+A*F+N*Z+I*Y,s[7]=E*L+A*U+N*G+I*J,s[11]=E*R+A*q+N*$+I*H,s[15]=E*O+A*B+N*K+I*z,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],o=e[1],a=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=a*v-c*h,N=a*g-l*h,I=o*v-c*d,P=o*g-l*d,L=o*h-a*d;return n*(_*E-w*A+S*N)-r*(b*E-w*I+S*P)+i*(b*A-_*I+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],o=e[4],a=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*a-r*o,A=n*l-i*o,N=n*c-s*o,I=r*l-i*a,P=r*c-s*a,L=i*c-s*l,R=d*_-h*b,O=d*w-g*b,F=d*S-v*b,U=h*w-g*_,q=h*S-v*_,B=g*S-v*w,Z=E*B-A*q+N*U+I*F-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 G=1/Z;return e[0]=(a*B-l*q+c*U)*G,e[1]=(i*q-r*B-s*U)*G,e[2]=(_*L-w*P+S*I)*G,e[3]=(g*P-h*L-v*I)*G,e[4]=(l*F-o*B-c*O)*G,e[5]=(n*B-i*F+s*O)*G,e[6]=(w*N-b*L-S*A)*G,e[7]=(d*L-g*N+v*A)*G,e[8]=(o*q-a*F+c*R)*G,e[9]=(r*F-n*q-s*R)*G,e[10]=(b*P-_*N+S*E)*G,e[11]=(h*N-d*P-v*E)*G,e[12]=(a*O-o*U-l*R)*G,e[13]=(n*U-r*O+i*R)*G,e[14]=(_*A-b*I-w*E)*G,e[15]=(d*I-h*A+g*E)*G,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,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,d*a+r,d*l-i*o,0,c*l-i*a,d*l+i*o,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,o){return this.set(1,r,s,0,e,1,o,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,d=o+o,h=a+a,g=s*c,v=s*d,b=s*h,_=o*d,w=o*h,S=a*h,E=l*c,A=l*d,N=l*h,I=r.x,P=r.y,L=r.z;return i[0]=(1-(_+S))*I,i[1]=(v+N)*I,i[2]=(b-A)*I,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 o=Nx.set(i[0],i[1],i[2]).length();const a=Nx.set(i[4],i[5],i[6]).length(),l=Nx.set(i[8],i[9],i[10]).length();s<0&&(o=-o),Cd.copy(this);const c=1/o,d=1/a,h=1/l;return Cd.elements[0]*=c,Cd.elements[1]*=c,Cd.elements[2]*=c,Cd.elements[4]*=d,Cd.elements[5]*=d,Cd.elements[6]*=d,Cd.elements[8]*=h,Cd.elements[9]*=h,Cd.elements[10]*=h,n.setFromRotationMatrix(Cd),r.x=o,r.y=a,r.z=l,this}makePerspective(e,n,r,i,s,o,a=Qc,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/(o-s),_=o*s/(o-s);else if(a===Qc)b=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===uv)b=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);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,o,a=Qc,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/(o-s),_=o/(o-s);else if(a===Qc)b=-2/(o-s),_=-(o+s)/(o-s);else if(a===uv)b=-1/(o-s),_=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);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 Nx=new ze,Cd=new rr,NSe=new ze(0,0,0),RSe=new ze(1,1,1),p0=new ze,C4=new ze,Hc=new ze,tz=new rr,nz=new Ua;class ou{constructor(e=0,n=0,r=0,i=ou.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],o=i[4],a=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(or(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,v),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(g,c),this._z=0);break;case"YXZ":this._x=Math.asin(-or(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,v),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(or(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-h,v),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-or(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(-o,c));break;case"YZX":this._z=Math.asin(or(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(a,v));break;case"XZY":this._z=Math.asin(-or(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(g,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,v),this._y=0);break;default:pn("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}}ou.DEFAULT_ORDER="XYZ";class iy{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 kSe=0;const rz=new ze,Rx=new Ua,Wh=new rr,A4=new ze,Kb=new ze,PSe=new ze,DSe=new Ua,iz=new ze(1,0,0),sz=new ze(0,1,0),oz=new ze(0,0,1),az={type:"added"},ISe={type:"removed"},kx={type:"childadded",child:null},HA={type:"childremoved",child:null};class bi extends gh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:kSe++}),this.uuid=iu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=bi.DEFAULT_UP.clone();const e=new ze,n=new ou,r=new Ua,i=new ze(1,1,1);function s(){r.setFromEuler(n,!1)}function o(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(o),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 _r}}),this.matrix=new rr,this.matrixWorld=new rr,this.matrixAutoUpdate=bi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=bi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new iy,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 Rx.setFromAxisAngle(e,n),this.quaternion.multiply(Rx),this}rotateOnWorldAxis(e,n){return Rx.setFromAxisAngle(e,n),this.quaternion.premultiply(Rx),this}rotateX(e){return this.rotateOnAxis(iz,e)}rotateY(e){return this.rotateOnAxis(sz,e)}rotateZ(e){return this.rotateOnAxis(oz,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(oz,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Wh.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?A4.copy(e):A4.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),Kb.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Wh.lookAt(Kb,A4,this.up):Wh.lookAt(A4,Kb,this.up),this.quaternion.setFromRotationMatrix(Wh),i&&(Wh.extractRotation(i.matrixWorld),Rx.setFromRotationMatrix(Wh),this.quaternion.premultiply(Rx.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(Un("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(az),kx.child=e,this.dispatchEvent(kx),kx.child=null):Un("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(ISe),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),Wh.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Wh.multiply(e.parent.matrixWorld)),e.applyMatrix4(Wh),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(az),kx.child=e,this.dispatchEvent(kx),kx.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 o=this.children[r].getObjectByProperty(e,n);if(o!==void 0)return o}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let s=0,o=i.length;s<o;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(Kb,e,PSe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kb,DSe,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,o=i.length;s<o;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(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(a=>({...a})),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(a,l){return a[l.uuid]===void 0&&(a[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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.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 a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];i.animations.push(s(e.animations,l))}}if(n){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),d=o(e.images),h=o(e.shapes),g=o(e.skeletons),v=o(e.animations),b=o(e.nodes);a.length>0&&(r.geometries=a),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 o(a){const l=[];for(const c in a){const d=a[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}}bi.DEFAULT_UP=new ze(0,1,0);bi.DEFAULT_MATRIX_AUTO_UPDATE=!0;bi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class s1 extends bi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const OSe={type:"move"};class VM{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new s1,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 s1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ze,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ze),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new s1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ze,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ze),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,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!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));a!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(OSe)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new s1;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const dY={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},m0={h:0,s:0,l:0},N4={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 yn{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=ll){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,oi.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=oi.workingColorSpace){return this.r=e,this.g=n,this.b=r,oi.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=oi.workingColorSpace){if(e=e9(e,1),n=or(n,0,1),r=or(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=VA(o,s,e+1/3),this.g=VA(o,s,e),this.b=VA(o,s,e-1/3)}return oi.colorSpaceToWorking(this,i),this}setStyle(e,n=ll){function r(s){s!==void 0&&parseFloat(s)<1&&pn("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:pn("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);pn("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=ll){const r=dY[e.toLowerCase()];return r!==void 0?this.setHex(r,n):pn("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=up(e.r),this.g=up(e.g),this.b=up(e.b),this}copyLinearToSRGB(e){return this.r=_1(e.r),this.g=_1(e.g),this.b=_1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ll){return oi.workingToColorSpace(il.copy(this),e),Math.round(or(il.r*255,0,255))*65536+Math.round(or(il.g*255,0,255))*256+Math.round(or(il.b*255,0,255))}getHexString(e=ll){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=oi.workingColorSpace){oi.workingToColorSpace(il.copy(this),n);const r=il.r,i=il.g,s=il.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=d<=.5?h/(o+a):h/(2-o-a),o){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=oi.workingColorSpace){return oi.workingToColorSpace(il.copy(this),n),e.r=il.r,e.g=il.g,e.b=il.b,e}getStyle(e=ll){oi.workingToColorSpace(il.copy(this),e);const n=il.r,r=il.g,i=il.b;return e!==ll?`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(m0),this.setHSL(m0.h+e,m0.s+n,m0.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(m0),e.getHSL(N4);const r=H_(m0.h,N4.h,n),i=H_(m0.s,N4.s,n),s=H_(m0.l,N4.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 il=new yn;yn.NAMES=dY;class iE{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new yn(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 yn(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 n9=class extends bi{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 ou,this.environmentIntensity=1,this.environmentRotation=new ou,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 Ad=new ze,$h=new ze,GA=new ze,qh=new ze,Px=new ze,Dx=new ze,lz=new ze,WA=new ze,$A=new ze,qA=new ze,XA=new di,YA=new di,KA=new di;class Mc{constructor(e=new ze,n=new ze,r=new ze){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Ad.subVectors(e,n),i.cross(Ad);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){Ad.subVectors(i,n),$h.subVectors(r,n),GA.subVectors(e,n);const o=Ad.dot(Ad),a=Ad.dot($h),l=Ad.dot(GA),c=$h.dot($h),d=$h.dot(GA),h=o*c-a*a;if(h===0)return s.set(0,0,0),null;const g=1/h,v=(c*l-a*d)*g,b=(o*d-a*l)*g;return s.set(1-v-b,b,v)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,qh)===null?!1:qh.x>=0&&qh.y>=0&&qh.x+qh.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,qh)===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,qh.x),l.addScaledVector(o,qh.y),l.addScaledVector(a,qh.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return XA.setScalar(0),YA.setScalar(0),KA.setScalar(0),XA.fromBufferAttribute(e,n),YA.fromBufferAttribute(e,r),KA.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(XA,s.x),o.addScaledVector(YA,s.y),o.addScaledVector(KA,s.z),o}static isFrontFacing(e,n,r,i){return Ad.subVectors(r,n),$h.subVectors(e,n),Ad.cross($h).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 Ad.subVectors(this.c,this.b),$h.subVectors(this.a,this.b),Ad.cross($h).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 o,a;Px.subVectors(i,r),Dx.subVectors(s,r),WA.subVectors(e,r);const l=Px.dot(WA),c=Dx.dot(WA);if(l<=0&&c<=0)return n.copy(r);$A.subVectors(e,i);const d=Px.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 o=l/(l-d),n.copy(r).addScaledVector(Px,o);qA.subVectors(e,s);const v=Px.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 a=c/(c-b),n.copy(r).addScaledVector(Dx,a);const w=d*b-v*h;if(w<=0&&h-d>=0&&v-b>=0)return lz.subVectors(s,i),a=(h-d)/(h-d+(v-b)),n.copy(i).addScaledVector(lz,a);const S=1/(w+_+g);return o=_*S,a=g*S,n.copy(r).addScaledVector(Px,o).addScaledVector(Dx,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Ao{constructor(e=new ze(1/0,1/0,1/0),n=new ze(-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(Nd.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Nd.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=Nd.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 o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Nd):Nd.fromBufferAttribute(s,o),Nd.applyMatrix4(e.matrixWorld),this.expandByPoint(Nd);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),R4.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),R4.copy(r.boundingBox)),R4.applyMatrix4(e.matrixWorld),this.union(R4)}const i=e.children;for(let s=0,o=i.length;s<o;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,Nd),Nd.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(Zb),k4.subVectors(this.max,Zb),Ix.subVectors(e.a,Zb),Ox.subVectors(e.b,Zb),Lx.subVectors(e.c,Zb),g0.subVectors(Ox,Ix),v0.subVectors(Lx,Ox),og.subVectors(Ix,Lx);let n=[0,-g0.z,g0.y,0,-v0.z,v0.y,0,-og.z,og.y,g0.z,0,-g0.x,v0.z,0,-v0.x,og.z,0,-og.x,-g0.y,g0.x,0,-v0.y,v0.x,0,-og.y,og.x,0];return!ZA(n,Ix,Ox,Lx,k4)||(n=[1,0,0,0,1,0,0,0,1],!ZA(n,Ix,Ox,Lx,k4))?!1:(P4.crossVectors(g0,v0),n=[P4.x,P4.y,P4.z],ZA(n,Ix,Ox,Lx,k4))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Nd).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Nd).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:(Xh[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Xh[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Xh[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Xh[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Xh[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Xh[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Xh[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Xh[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Xh),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 Xh=[new ze,new ze,new ze,new ze,new ze,new ze,new ze,new ze],Nd=new ze,R4=new Ao,Ix=new ze,Ox=new ze,Lx=new ze,g0=new ze,v0=new ze,og=new ze,Zb=new ze,k4=new ze,P4=new ze,ag=new ze;function ZA(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){ag.fromArray(t,s);const a=i.x*Math.abs(ag.x)+i.y*Math.abs(ag.y)+i.z*Math.abs(ag.z),l=e.dot(ag),c=n.dot(ag),d=r.dot(ag);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const ip=LSe();function LSe(){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),o=new Uint32Array(64),a=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)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function yc(t){Math.abs(t)>65504&&pn("DataUtils.toHalfFloat(): Value out of range."),t=or(t,-65504,65504),ip.floatView[0]=t;const e=ip.uint32View[0],n=e>>23&511;return ip.baseTable[n]+((e&8388607)>>ip.shiftTable[n])}function y_(t){const e=t>>10;return ip.uint32View[0]=ip.mantissaTable[ip.offsetTable[e]+(t&1023)]+ip.exponentTable[e],ip.floatView[0]}class zSe{static toHalfFloat(e){return yc(e)}static fromHalfFloat(e){return y_(e)}}const Uo=new ze,D4=new jt;let jSe=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:jSe++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=bS,this.updateRanges=[],this.gpuType=Vl,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++)D4.fromBufferAttribute(this,n),D4.applyMatrix3(e),this.setXY(n,D4.x,D4.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)Uo.fromBufferAttribute(this,n),Uo.applyMatrix3(e),this.setXYZ(n,Uo.x,Uo.y,Uo.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)Uo.fromBufferAttribute(this,n),Uo.applyMatrix4(e),this.setXYZ(n,Uo.x,Uo.y,Uo.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Uo.fromBufferAttribute(this,n),Uo.applyNormalMatrix(e),this.setXYZ(n,Uo.x,Uo.y,Uo.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Uo.fromBufferAttribute(this,n),Uo.transformDirection(e),this.setXYZ(n,Uo.x,Uo.y,Uo.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=Fl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Nr(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Fl(n,this.array)),n}setX(e,n){return this.normalized&&(n=Nr(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Fl(n,this.array)),n}setY(e,n){return this.normalized&&(n=Nr(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=Fl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Nr(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=Fl(n,this.array)),n}setW(e,n){return this.normalized&&(n=Nr(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Nr(n,this.array),r=Nr(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=Nr(n,this.array),r=Nr(r,this.array),i=Nr(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=Nr(n,this.array),r=Nr(r,this.array),i=Nr(i,this.array),s=Nr(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!==bS&&(e.usage=this.usage),e}}class FSe extends Vi{constructor(e,n,r){super(new Int8Array(e),n,r)}}class USe extends Vi{constructor(e,n,r){super(new Uint8Array(e),n,r)}}class BSe extends Vi{constructor(e,n,r){super(new Uint8ClampedArray(e),n,r)}}class HSe extends Vi{constructor(e,n,r){super(new Int16Array(e),n,r)}}class r9 extends Vi{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class VSe extends Vi{constructor(e,n,r){super(new Int32Array(e),n,r)}}class i9 extends Vi{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class GSe extends Vi{constructor(e,n,r){super(new Uint16Array(e),n,r),this.isFloat16BufferAttribute=!0}getX(e){let n=y_(this.array[e*this.itemSize]);return this.normalized&&(n=Fl(n,this.array)),n}setX(e,n){return this.normalized&&(n=Nr(n,this.array)),this.array[e*this.itemSize]=yc(n),this}getY(e){let n=y_(this.array[e*this.itemSize+1]);return this.normalized&&(n=Fl(n,this.array)),n}setY(e,n){return this.normalized&&(n=Nr(n,this.array)),this.array[e*this.itemSize+1]=yc(n),this}getZ(e){let n=y_(this.array[e*this.itemSize+2]);return this.normalized&&(n=Fl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Nr(n,this.array)),this.array[e*this.itemSize+2]=yc(n),this}getW(e){let n=y_(this.array[e*this.itemSize+3]);return this.normalized&&(n=Fl(n,this.array)),n}setW(e,n){return this.normalized&&(n=Nr(n,this.array)),this.array[e*this.itemSize+3]=yc(n),this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Nr(n,this.array),r=Nr(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=Nr(n,this.array),r=Nr(r,this.array),i=Nr(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=Nr(n,this.array),r=Nr(r,this.array),i=Nr(i,this.array),s=Nr(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 WSe=new Ao,Qb=new ze,QA=new ze;class Wo{constructor(e=new ze,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):WSe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;s<o;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;Qb.subVectors(e,this.center);const n=Qb.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(Qb,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(Qb.copy(e.center).add(QA)),this.expandByPoint(Qb.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 $Se=0;const Iu=new rr,JA=new bi,zx=new ze,Vc=new Ao,Jb=new Ao,ga=new ze;class Sr extends gh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:$Se++}),this.uuid=iu(),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(nSe(e)?i9:r9)(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 _r().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(zx).negate(),this.translate(zx.x,zx.y,zx.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 o=e[i];r.push(o.x,o.y,o.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&&pn("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 Ao);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Un("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new ze(-1/0,-1/0,-1/0),new ze(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];Vc.setFromBufferAttribute(s),this.morphTargetsRelative?(ga.addVectors(this.boundingBox.min,Vc.min),this.boundingBox.expandByPoint(ga),ga.addVectors(this.boundingBox.max,Vc.max),this.boundingBox.expandByPoint(ga)):(this.boundingBox.expandByPoint(Vc.min),this.boundingBox.expandByPoint(Vc.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Un('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 Wo);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Un("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new ze,1/0);return}if(e){const r=this.boundingSphere.center;if(Vc.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const a=n[s];Jb.setFromBufferAttribute(a),this.morphTargetsRelative?(ga.addVectors(Vc.min,Jb.min),Vc.expandByPoint(ga),ga.addVectors(Vc.max,Jb.max),Vc.expandByPoint(ga)):(Vc.expandByPoint(Jb.min),Vc.expandByPoint(Jb.max))}Vc.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)ga.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(ga));if(n)for(let s=0,o=n.length;s<o;s++){const a=n[s],l=this.morphTargetsRelative;for(let c=0,d=a.count;c<d;c++)ga.fromBufferAttribute(a,c),l&&(zx.fromBufferAttribute(e,c),ga.add(zx)),i=Math.max(i,r.distanceToSquared(ga))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Un('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){Un("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 o=this.getAttribute("tangent"),a=[],l=[];for(let R=0;R<r.count;R++)a[R]=new ze,l[R]=new ze;const c=new ze,d=new ze,h=new ze,g=new jt,v=new jt,b=new jt,_=new ze,w=new ze;function S(R,O,F){c.fromBufferAttribute(r,R),d.fromBufferAttribute(r,O),h.fromBufferAttribute(r,F),g.fromBufferAttribute(s,R),v.fromBufferAttribute(s,O),b.fromBufferAttribute(s,F),d.sub(c),h.sub(c),v.sub(g),b.sub(g);const U=1/(v.x*b.y-b.x*v.y);isFinite(U)&&(_.copy(d).multiplyScalar(b.y).addScaledVector(h,-v.y).multiplyScalar(U),w.copy(h).multiplyScalar(v.x).addScaledVector(d,-b.x).multiplyScalar(U),a[R].add(_),a[O].add(_),a[F].add(_),l[R].add(w),l[O].add(w),l[F].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 F=E[R],U=F.start,q=F.count;for(let B=U,Z=U+q;B<Z;B+=3)S(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const A=new ze,N=new ze,I=new ze,P=new ze;function L(R){I.fromBufferAttribute(i,R),P.copy(I);const O=a[R];A.copy(O),A.sub(I.multiplyScalar(I.dot(O))).normalize(),N.crossVectors(P,O);const U=N.dot(l[R])<0?-1:1;o.setXYZW(R,A.x,A.y,A.z,U)}for(let R=0,O=E.length;R<O;++R){const F=E[R],U=F.start,q=F.count;for(let B=U,Z=U+q;B<Z;B+=3)L(e.getX(B+0)),L(e.getX(B+1)),L(e.getX(B+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 ze,s=new ze,o=new ze,a=new ze,l=new ze,c=new ze,d=new ze,h=new ze;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,_),o.fromBufferAttribute(n,w),d.subVectors(o,s),h.subVectors(i,s),d.cross(h),a.fromBufferAttribute(r,b),l.fromBufferAttribute(r,_),c.fromBufferAttribute(r,w),a.add(d),l.add(d),c.add(d),r.setXYZ(b,a.x,a.y,a.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),o.fromBufferAttribute(n,g+2),d.subVectors(o,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++)ga.fromBufferAttribute(e,n),ga.normalize(),e.setXYZ(n,ga.x,ga.y,ga.z)}toNonIndexed(){function e(a,l){const c=a.array,d=a.itemSize,h=a.normalized,g=new c.constructor(l.length*d);let v=0,b=0;for(let _=0,w=l.length;_<w;_++){a.isInterleavedBufferAttribute?v=l[_]*a.data.stride+a.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 pn("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Sr,r=this.index.array,i=this.attributes;for(const a in i){const l=i[a],c=e(l,r);n.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let d=0,h=c.length;d<h;d++){const g=c[d],v=e(g,r);l.push(v)}n.morphAttributes[a]=l}n.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];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 o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.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 o=e.groups;for(let c=0,d=o.length;c<d;c++){const h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.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 oE{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=bS,this.updateRanges=[],this.version=0,this.uuid=iu()}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=iu()),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=iu()),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 Dl=new ze;class Jc{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++)Dl.fromBufferAttribute(this,n),Dl.applyMatrix4(e),this.setXYZ(n,Dl.x,Dl.y,Dl.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Dl.fromBufferAttribute(this,n),Dl.applyNormalMatrix(e),this.setXYZ(n,Dl.x,Dl.y,Dl.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Dl.fromBufferAttribute(this,n),Dl.transformDirection(e),this.setXYZ(n,Dl.x,Dl.y,Dl.z);return this}getComponent(e,n){let r=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(r=Fl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Nr(r,this.array)),this.data.array[e*this.data.stride+this.offset+n]=r,this}setX(e,n){return this.normalized&&(n=Nr(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=Nr(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=Nr(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=Nr(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=Fl(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Fl(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Fl(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Fl(n,this.array)),n}setXY(e,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=Nr(n,this.array),r=Nr(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=Nr(n,this.array),r=Nr(r,this.array),i=Nr(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=Nr(n,this.array),r=Nr(r,this.array),i=Nr(i,this.array),s=Nr(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){SS("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 Jc(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){SS("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 qSe=0;class xl extends gh{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:qSe++}),this.uuid=iu(),this.name="",this.type="Material",this.blending=$g,this.side=mp,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=P2,this.blendDst=D2,this.blendEquation=C0,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new yn(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=Tg,this.stencilZFail=Tg,this.stencilZPass=Tg,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){pn(`Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){pn(`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!==$g&&(r.blending=this.blending),this.side!==mp&&(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!==P2&&(r.blendSrc=this.blendSrc),this.blendDst!==D2&&(r.blendDst=this.blendDst),this.blendEquation!==C0&&(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!==Tg&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Tg&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Tg&&(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 o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(n){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}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 s9 extends xl{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new yn(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 jx;const e_=new ze,Fx=new ze,Ux=new ze,Bx=new jt,t_=new jt,fY=new rr,I4=new ze,n_=new ze,O4=new ze,cz=new jt,e6=new jt,uz=new jt;class hY extends bi{constructor(e=new s9){if(super(),this.isSprite=!0,this.type="Sprite",jx===void 0){jx=new Sr;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 oE(n,5);jx.setIndex([0,1,2,0,2,3]),jx.setAttribute("position",new Jc(r,3,0,!1)),jx.setAttribute("uv",new Jc(r,2,3,!1))}this.geometry=jx,this.material=e,this.center=new jt(.5,.5),this.count=1}raycast(e,n){e.camera===null&&Un('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Fx.setFromMatrixScale(this.matrixWorld),fY.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ux.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Fx.multiplyScalar(-Ux.z);const r=this.material.rotation;let i,s;r!==0&&(s=Math.cos(r),i=Math.sin(r));const o=this.center;L4(I4.set(-.5,-.5,0),Ux,o,Fx,i,s),L4(n_.set(.5,-.5,0),Ux,o,Fx,i,s),L4(O4.set(.5,.5,0),Ux,o,Fx,i,s),cz.set(0,0),e6.set(1,0),uz.set(1,1);let a=e.ray.intersectTriangle(I4,n_,O4,!1,e_);if(a===null&&(L4(n_.set(-.5,.5,0),Ux,o,Fx,i,s),e6.set(0,1),a=e.ray.intersectTriangle(I4,O4,n_,!1,e_),a===null))return;const l=e.ray.origin.distanceTo(e_);l<e.near||l>e.far||n.push({distance:l,point:e_.clone(),uv:Mc.getInterpolation(e_,I4,n_,O4,cz,e6,uz,new jt),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 L4(t,e,n,r,i,s){Bx.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(t_.x=s*Bx.x-i*Bx.y,t_.y=i*Bx.x+s*Bx.y):t_.copy(Bx),t.copy(e),t.x+=t_.x,t.y+=t_.y,t.applyMatrix4(fY)}const z4=new ze,dz=new ze;class pY extends bi{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){z4.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(z4);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){z4.setFromMatrixPosition(e.matrixWorld),dz.setFromMatrixPosition(this.matrixWorld);const r=z4.distanceTo(dz)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i<s;i++){let o=n[i].distance;if(n[i].object.visible&&(o-=o*n[i].hysteresis),r>=o)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 o=r[i];n.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return n}}const Yh=new ze,t6=new ze,j4=new ze,x0=new ze,n6=new ze,F4=new ze,r6=new ze;class Tv{constructor(e=new ze,n=new ze(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,Yh)),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=Yh.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Yh.copy(this.origin).addScaledVector(this.direction,n),Yh.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){t6.copy(e).add(n).multiplyScalar(.5),j4.copy(n).sub(e).normalize(),x0.copy(this.origin).sub(t6);const s=e.distanceTo(n)*.5,o=-this.direction.dot(j4),a=x0.dot(this.direction),l=-x0.dot(j4),c=x0.lengthSq(),d=Math.abs(1-o*o);let h,g,v,b;if(d>0)if(h=o*l-a,g=o*a-l,b=s*d,h>=0)if(g>=-b)if(g<=b){const _=1/d;h*=_,g*=_,v=h*(h+o*g+2*a)+g*(o*h+g+2*l)+c}else g=s,h=Math.max(0,-(o*g+a)),v=-h*h+g*(g+2*l)+c;else g=-s,h=Math.max(0,-(o*g+a)),v=-h*h+g*(g+2*l)+c;else g<=-b?(h=Math.max(0,-(-o*s+a)),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,-(o*s+a)),g=h>0?s:Math.min(Math.max(-s,-l),s),v=-h*h+g*(g+2*l)+c);else g=o>0?-s:s,h=Math.max(0,-(o*g+a)),v=-h*h+g*(g+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(t6).addScaledVector(j4,g),v}intersectSphere(e,n){Yh.subVectors(e.center,this.origin);const r=Yh.dot(this.direction),i=Yh.dot(Yh)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,n):this.at(a,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,o,a,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,o=(e.max.y-g.y)*d):(s=(e.max.y-g.y)*d,o=(e.min.y-g.y)*d),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o<i||isNaN(i))&&(i=o),h>=0?(a=(e.min.z-g.z)*h,l=(e.max.z-g.z)*h):(a=(e.max.z-g.z)*h,l=(e.min.z-g.z)*h),r>l||a>i)||((a>r||r!==r)&&(r=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Yh)!==null}intersectTriangle(e,n,r,i,s){n6.subVectors(n,e),F4.subVectors(r,e),r6.crossVectors(n6,F4);let o=this.direction.dot(r6),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;x0.subVectors(this.origin,e);const l=a*this.direction.dot(F4.crossVectors(x0,F4));if(l<0)return null;const c=a*this.direction.dot(n6.cross(x0));if(c<0||l+c>o)return null;const d=-a*x0.dot(r6);return d<0?null:this.at(d/o,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 Sp extends xl{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new yn(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 ou,this.combine=_w,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,lg=new Tv,U4=new Wo,hz=new ze,B4=new ze,H4=new ze,V4=new ze,i6=new ze,G4=new ze,pz=new ze,W4=new ze;class Us extends bi{constructor(e=new Sr,n=new Sp){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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,o=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const a=this.morphTargetInfluences;if(s&&a){G4.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=a[l],h=s[l];d!==0&&(i6.fromBufferAttribute(h,e),o?G4.addScaledVector(i6,d):G4.addScaledVector(i6.sub(n),d))}n.add(G4)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),U4.copy(r.boundingSphere),U4.applyMatrix4(s),lg.copy(e.ray).recast(e.near),!(U4.containsPoint(lg.origin)===!1&&(lg.intersectSphere(U4,hz)===null||lg.origin.distanceToSquared(hz)>(e.far-e.near)**2))&&(fz.copy(s).invert(),lg.copy(e.ray).applyMatrix4(fz),!(r.boundingBox!==null&&lg.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,lg)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=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(a!==null)if(Array.isArray(o))for(let b=0,_=g.length;b<_;b++){const w=g[b],S=o[w.materialIndex],E=Math.max(w.start,v.start),A=Math.min(a.count,Math.min(w.start+w.count,v.start+v.count));for(let N=E,I=A;N<I;N+=3){const P=a.getX(N),L=a.getX(N+1),R=a.getX(N+2);i=$4(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(a.count,v.start+v.count);for(let w=b,S=_;w<S;w+=3){const E=a.getX(w),A=a.getX(w+1),N=a.getX(w+2);i=$4(this,o,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(o))for(let b=0,_=g.length;b<_;b++){const w=g[b],S=o[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,I=A;N<I;N+=3){const P=N,L=N+1,R=N+2;i=$4(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=$4(this,o,e,r,c,d,h,E,A,N),i&&(i.faceIndex=Math.floor(w/3),n.push(i))}}}}function XSe(t,e,n,r,i,s,o,a){let l;if(e.side===Gl?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,e.side===mp,a),l===null)return null;W4.copy(a),W4.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(W4);return c<n.near||c>n.far?null:{distance:c,point:W4.clone(),object:t}}function $4(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,B4),t.getVertexPosition(l,H4),t.getVertexPosition(c,V4);const d=XSe(t,e,n,r,B4,H4,V4,pz);if(d){const h=new ze;Mc.getBarycoord(pz,B4,H4,V4,h),i&&(d.uv=Mc.getInterpolatedAttribute(i,a,l,c,h,new jt)),s&&(d.uv1=Mc.getInterpolatedAttribute(s,a,l,c,h,new jt)),o&&(d.normal=Mc.getInterpolatedAttribute(o,a,l,c,h,new ze),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const g={a,b:l,c,normal:new ze,materialIndex:0};Mc.getNormal(B4,H4,V4,g.normal),d.face=g,d.barycoord=h}return d}const mz=new ze,gz=new di,vz=new di,YSe=new ze,xz=new rr,q4=new ze,s6=new Wo,yz=new rr,o6=new Tv;class mY 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 Ao),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,q4),this.boundingBox.expandByPoint(q4)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Wo),this.boundingSphere.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,q4),this.boundingSphere.expandByPoint(q4)}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(),o6.copy(e.ray).applyMatrix4(yz),!(this.boundingBox!==null&&o6.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,n,o6)))}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 di,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===qX?this.bindMatrixInverse.copy(this.bindMatrix).invert():pn("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 o=vz.getComponent(s);if(o!==0){const a=gz.getComponent(s);xz.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),n.addScaledVector(YSe.copy(mz).applyMatrix4(xz),o)}}return n.applyMatrix4(this.bindMatrixInverse)}}class o9 extends bi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Hd extends ro{constructor(e=null,n=1,r=1,i,s,o,a,l,c=Co,d=Co,h,g){super(null,o,a,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,KSe=new rr;class aE{constructor(e=[],n=[]){this.uuid=iu(),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){pn("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,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:KSe;bz.multiplyMatrices(a,n[s]),bz.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new aE(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 Hd(n,e,e,cl,Vl);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 o=n[s];o===void 0&&(pn("Skeleton: No bone found with UUID:",s),o=new o9),this.bones.push(o),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 o=n[i];e.bones.push(o.uuid);const a=r[i];e.boneInverses.push(a.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 Hx=new rr,_z=new rr,X4=[],Sz=new Ao,ZSe=new rr,r_=new Us,i_=new Wo;class gY 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,ZSe)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new Ao),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Hx),Sz.copy(e.boundingBox).applyMatrix4(Hx),this.boundingBox.union(Sz)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new Wo),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,Hx),i_.copy(e.boundingSphere).applyMatrix4(Hx),this.boundingSphere.union(i_)}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,o=e*s+1;for(let a=0;a<r.length;a++)r[a]=i[o+a]}raycast(e,n){const r=this.matrixWorld,i=this.count;if(r_.geometry=this.geometry,r_.material=this.material,r_.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),i_.copy(this.boundingSphere),i_.applyMatrix4(r),e.ray.intersectsSphere(i_)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,Hx),_z.multiplyMatrices(r,Hx),r_.matrixWorld=_z,r_.raycast(e,X4);for(let o=0,a=X4.length;o<a;o++){const l=X4[o];l.instanceId=s,l.object=this,n.push(l)}X4.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 Hd(new Float32Array(i*this.count),i,this.count,KT,Vl));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<r.length;c++)o+=r[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=i*e;s[l]=a,s.set(r,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const a6=new ze,QSe=new ze,JSe=new _r;class ep{constructor(e=new ze(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=a6.subVectors(r,n).cross(QSe.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(a6),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||JSe.getNormalMatrix(e),i=this.coplanarPoint(a6).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 cg=new Wo,ewe=new jt(.5,.5),Y4=new ze;class ky{constructor(e=new ep,n=new ep,r=new ep,i=new ep,s=new ep,o=new ep){this.planes=[e,n,r,i,s,o]}set(e,n,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),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=Qc,r=!1){const i=this.planes,s=e.elements,o=s[0],a=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],I=s[15];if(i[0].setComponents(c-o,v-d,S-b,I-E).normalize(),i[1].setComponents(c+o,v+d,S+b,I+E).normalize(),i[2].setComponents(c+a,v+h,S+_,I+A).normalize(),i[3].setComponents(c-a,v-h,S-_,I-A).normalize(),r)i[4].setComponents(l,g,w,N).normalize(),i[5].setComponents(c-l,v-g,S-w,I-N).normalize();else if(i[4].setComponents(c-l,v-g,S-w,I-N).normalize(),n===Qc)i[5].setComponents(c+l,v+g,S+w,I+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(),cg.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),cg.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(cg)}intersectsSprite(e){cg.center.set(0,0,0);const n=ewe.distanceTo(e.center);return cg.radius=.7071067811865476+n,cg.applyMatrix4(e.matrixWorld),this.intersectsSphere(cg)}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(Y4.x=i.normal.x>0?e.max.x:e.min.x,Y4.y=i.normal.y>0?e.max.y:e.min.y,Y4.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Y4)<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 ky;class lE{constructor(){this.coordinateSystem=Qc}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 twe(t,e){return t.z-e.z}function nwe(t,e){return e.z-t.z}class rwe{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,n,r,i){const s=this.pool,o=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const a=s[this.index];o.push(a),this.index++,a.start=e,a.count=n,a.z=r,a.index=i}reset(){this.list.length=0,this.index=0}}const vc=new rr,iwe=new yn(1,1,1),wz=new ky,swe=new lE,K4=new Ao,ug=new Wo,s_=new ze,Mz=new ze,owe=new ze,c6=new rwe,sl=new Us,Z4=[];function awe(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 o=0;o<r;o++)e.setComponent(s+n,o,t.getComponent(s,o))}else e.array.set(t.array,n*r);e.needsUpdate=!0}function dg(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 vY extends Us{constructor(e,n,r=n*2,i){super(new Sr,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 Hd(n,e,e,cl,Vl);this._matricesTexture=r}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Uint32Array(e*e),r=new Hd(n,e,e,Sw,Zu);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 Hd(n,e,e,cl,Vl);r.colorSpace=oi.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 o=e.getAttribute(s),{array:a,itemSize:l,normalized:c}=o,d=new a.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 Ao);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,K4).applyMatrix4(vc),e.union(K4)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Wo);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,ug).applyMatrix4(vc),e.union(ug)}}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 o=this._colorsTexture;return o&&(iwe.toArray(o.image.data,i*4),o.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 o=e.getIndex();if(o!==null&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=r===-1?o.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(),o=n.getIndex(),a=this._geometryInfo[e];if(i&&o.count>a.reservedIndexCount||n.attributes.position.count>a.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.reservedVertexCount;a.vertexCount=n.getAttribute("position").count;for(const d in r.attributes){const h=n.getAttribute(d),g=r.getAttribute(d);awe(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=a.indexStart,h=a.reservedIndexCount;a.indexCount=n.getIndex().count;for(let g=0;g<o.count;g++)s.setX(d+g,l+o.getX(g));for(let g=o.count,v=h;g<v;g++)s.setX(d+g,l);s.needsUpdate=!0,s.addUpdateRange(d,a.reservedIndexCount)}return a.start=i?a.indexStart:a.vertexStart,a.count=i?a.indexCount:a.vertexCount,a.boundingBox=null,n.boundingBox!==null&&(a.boundingBox=n.boundingBox.clone()),a.boundingSphere=null,n.boundingSphere!==null&&(a.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((o,a)=>a).sort((o,a)=>r[o].vertexStart-r[a].vertexStart),s=this.geometry;for(let o=0,a=r.length;o<a;o++){const l=i[o],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 Ao,o=r.index,a=r.attributes.position;for(let l=i.start,c=i.start+i.count;l<c;l++){let d=l;o&&(d=o.getX(d)),s.expandByPoint(s_.fromBufferAttribute(a,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 Wo;this.getBoundingBoxAt(e,K4),K4.getCenter(s.center);const o=r.index,a=r.attributes.position;let l=0;for(let c=i.start,d=i.start+i.count;c<d;c++){let h=c;o&&(h=o.getX(h)),s_.fromBufferAttribute(a,h),l=Math.max(l,s.center.distanceToSquared(s_))}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);dg(this._multiDrawCounts,i),dg(this._multiDrawStarts,s),this._multiDrawCounts=i,this._multiDrawStarts=s,this._maxInstanceCount=e;const o=this._indirectTexture,a=this._matricesTexture,l=this._colorsTexture;o.dispose(),this._initIndirectTexture(),dg(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),dg(a.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),dg(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,n){const r=[...this._geometryInfo].filter(a=>a.active);if(Math.max(...r.map(a=>a.vertexStart+a.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 Sr,this._initializeGeometry(s));const o=this.geometry;s.index&&dg(s.index.array,o.index.array);for(const a in s.attributes)dg(s.attributes[a].array,o.attributes[a].array)}raycast(e,n){const r=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,o=this.geometry;sl.material=this.material,sl.geometry.index=o.index,sl.geometry.attributes=o.attributes,sl.geometry.boundingBox===null&&(sl.geometry.boundingBox=new Ao),sl.geometry.boundingSphere===null&&(sl.geometry.boundingSphere=new Wo);for(let a=0,l=r.length;a<l;a++){if(!r[a].visible||!r[a].active)continue;const c=r[a].geometryIndex,d=i[c];sl.geometry.setDrawRange(d.start,d.count),this.getMatrixAt(a,sl.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,sl.geometry.boundingBox),this.getBoundingSphereAt(c,sl.geometry.boundingSphere),sl.raycast(e,Z4);for(let h=0,g=Z4.length;h<g;h++){const v=Z4[h];v.object=this,v.batchId=a,n.push(v)}Z4.length=0}sl.material=null,sl.geometry.index=null,sl.geometry.attributes={},sl.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 o=i.getIndex();let a=o===null?1:o.array.BYTES_PER_ELEMENT,l=1;s.wireframe&&(l=2,a=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?swe: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(),s_.setFromMatrixPosition(r.matrixWorld).applyMatrix4(vc),Mz.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(vc);for(let N=0,I=c.length;N<I;N++)if(c[N].visible&&c[N].active){const P=c[N].geometryIndex;this.getMatrixAt(N,vc),this.getBoundingSphereAt(P,ug).applyMatrix4(vc);let L=!1;if(v&&(L=!w.intersectsSphere(ug,r)),!L){const R=g[P],O=owe.subVectors(ug.center,s_).dot(Mz);c6.push(R.start,R.count,O,N)}}const E=c6.list,A=this.customSort;A===null?E.sort(s.transparent?nwe:twe):A.call(this,E,r);for(let N=0,I=E.length;N<I;N++){const P=E[N];d[S]=P.start*a*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 I=!1;if(v&&(this.getMatrixAt(E,vc),this.getBoundingSphereAt(N,ug).applyMatrix4(vc),I=!w.intersectsSphere(ug,r)),!I){const P=g[N];d[S]=P.start*a*l,h[S]=P.count*l,_[S]=E,S++}}b.needsUpdate=!0,this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(e,n,r,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class $l extends xl{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new yn(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 b5=new ze,_5=new ze,Tz=new rr,o_=new Tv,Q4=new Wo,u6=new ze,Ez=new ze;let rm=class extends bi{constructor(e=new Sr,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++)b5.fromBufferAttribute(n,i-1),_5.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=b5.distanceTo(_5);e.setAttribute("lineDistance",new Cn(r,1))}else pn("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,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Q4.copy(r.boundingSphere),Q4.applyMatrix4(i),Q4.radius+=s,e.ray.intersectsSphere(Q4)===!1)return;Tz.copy(i).invert(),o_.copy(e.ray).applyMatrix4(Tz);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,d=r.index,g=r.attributes.position;if(d!==null){const v=Math.max(0,o.start),b=Math.min(d.count,o.start+o.count);for(let _=v,w=b-1;_<w;_+=c){const S=d.getX(_),E=d.getX(_+1),A=J4(this,e,o_,l,S,E,_);A&&n.push(A)}if(this.isLineLoop){const _=d.getX(b-1),w=d.getX(v),S=J4(this,e,o_,l,_,w,b-1);S&&n.push(S)}}else{const v=Math.max(0,o.start),b=Math.min(g.count,o.start+o.count);for(let _=v,w=b-1;_<w;_+=c){const S=J4(this,e,o_,l,_,_+1,_);S&&n.push(S)}if(this.isLineLoop){const _=J4(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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function J4(t,e,n,r,i,s,o){const a=t.geometry.attributes.position;if(b5.fromBufferAttribute(a,i),_5.fromBufferAttribute(a,s),n.distanceSqToSegment(b5,_5,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:o,face:null,faceIndex:null,barycoord:null,object:t}}const Cz=new ze,Az=new ze;class vh extends rm{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 pn("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class xY extends rm{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class a9 extends xl{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new yn(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 Tv,eM=new Wo,tM=new ze;class yY extends bi{constructor(e=new Sr,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,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),eM.copy(r.boundingSphere),eM.applyMatrix4(i),eM.radius+=s,e.ray.intersectsSphere(eM)===!1)return;Nz.copy(i).invert(),HR.copy(e.ray).applyMatrix4(Nz);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=r.index,h=r.attributes.position;if(c!==null){const g=Math.max(0,o.start),v=Math.min(c.count,o.start+o.count);for(let b=g,_=v;b<_;b++){const w=c.getX(b);tM.fromBufferAttribute(h,w),Rz(tM,w,l,i,e,n,this)}}else{const g=Math.max(0,o.start),v=Math.min(h.count,o.start+o.count);for(let b=g,_=v;b<_;b++)tM.fromBufferAttribute(h,b),Rz(tM,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,o=i.length;s<o;s++){const a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function Rz(t,e,n,r,i,s,o){const a=HR.distanceSqToPoint(t);if(a<n){const l=new ze;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(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class bY extends ro{constructor(e,n,r,i,s=rs,o=rs,a,l,c){super(e,n,r,i,s,o,a,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 lwe extends bY{constructor(e,n,r,i,s,o,a,l){super({},e,n,r,i,s,o,a,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class cwe extends ro{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=Co,this.minFilter=Co,this.generateMipmaps=!1,this.needsUpdate=!0}}class cE extends ro{constructor(e,n,r,i,s,o,a,l,c,d,h,g){super(null,o,a,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 uwe extends cE{constructor(e,n,r,i,s,o){super(e,n,r,s,o),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 dwe extends cE{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,oh),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class ww extends ro{constructor(e=[],n=oh,r,i,s,o,a,l,c,d){super(e,n,r,i,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class fwe extends ro{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class sy extends ro{constructor(e,n,r=Zu,i,s,o,a=Co,l=Co,c,d=lh,h=1){if(d!==lh&&d!==F0)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,o,a,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 U0(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 _Y extends sy{constructor(e,n=Zu,r=oh,i,s,o=Co,a=Co,l,c=lh){const d={width:e,height:e,depth:1},h=[d,d,d,d,d,d];super(e,e,n,r,i,s,o,a,l,c),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class l9 extends ro{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ev extends Sr{constructor(e=1,n=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],h=[];let g=0,v=0;b("z","y","x",-1,-1,r,n,e,o,s,0),b("z","y","x",1,-1,r,n,-e,o,s,1),b("x","z","y",1,1,e,r,n,i,o,2),b("x","z","y",1,-1,e,r,-n,i,o,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,I,P,L,R,O){const F=N/L,U=I/R,q=N/2,B=I/2,Z=P/2,G=L+1,$=R+1;let K=0,Y=0;const J=new ze;for(let H=0;H<$;H++){const z=H*U-B;for(let X=0;X<G;X++){const V=X*F-q;J[_]=V*E,J[w]=z*A,J[S]=Z,c.push(J.x,J.y,J.z),J[_]=0,J[w]=0,J[S]=P>0?1:-1,d.push(J.x,J.y,J.z),h.push(X/L),h.push(1-H/R),K+=1}}for(let H=0;H<R;H++)for(let z=0;z<L;z++){const X=g+z+G*H,V=g+z+G*(H+1),ie=g+(z+1)+G*(H+1),ae=g+(z+1)+G*H;l.push(X,V,ae),l.push(V,ie,ae),Y+=6}a.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 Ev(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class uE extends Sr{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 o=[],a=[],l=[],c=[],d=n/2,h=Math.PI/2*e,g=n,v=2*h+g,b=r*2+s,_=i+1,w=new ze,S=new ze;for(let E=0;E<=b;E++){let A=0,N=0,I=0,P=0;if(E<=r){const O=E/r,F=O*Math.PI/2;N=-d-e*Math.cos(F),I=e*Math.sin(F),P=-e*Math.cos(F),A=O*h}else if(E<=r+s){const O=(E-r)/s;N=-d+O*n,I=e,P=0,A=h+O*g}else{const O=(E-r-s)/r,F=O*Math.PI/2;N=d+e*Math.sin(F),I=e*Math.cos(F),P=e*Math.sin(F),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 F=O/i,U=F*Math.PI*2,q=Math.sin(U),B=Math.cos(U);S.x=-I*B,S.y=N,S.z=I*q,a.push(S.x,S.y,S.z),w.set(-I*B,P,I*q),w.normalize(),l.push(w.x,w.y,w.z),c.push(F+R,L)}if(E>0){const O=(E-1)*_;for(let F=0;F<i;F++){const U=O+F,q=O+F+1,B=E*_+F,Z=E*_+F+1;o.push(U,q,B),o.push(q,Z,B)}}}this.setIndex(o),this.setAttribute("position",new Cn(a,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 Sr{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=[],o=[],a=[],l=[],c=new ze,d=new jt;o.push(0,0,0),a.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),o.push(c.x,c.y,c.z),a.push(0,0,1),d.x=(o[g]/e+1)/2,d.y=(o[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(o,3)),this.setAttribute("normal",new Cn(a,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 Mw extends Sr{constructor(e=1,n=1,r=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,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(),o===!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 ze,I=new ze;let P=0;const L=(n-e)/r;for(let R=0;R<=s;R++){const O=[],F=R/s,U=F*(n-e)+e;for(let q=0;q<=i;q++){const B=q/i,Z=B*l+a,G=Math.sin(Z),$=Math.cos(Z);I.x=U*G,I.y=-F*r+w,I.z=U*$,h.push(I.x,I.y,I.z),N.set(G,L,$).normalize(),g.push(N.x,N.y,N.z),v.push(B,1-F),O.push(b++)}_.push(O)}for(let R=0;R<i;R++)for(let O=0;O<s;O++){const F=_[O][R],U=_[O+1][R],q=_[O+1][R+1],B=_[O][R+1];(e>0||O!==0)&&(d.push(F,U,B),P+=3),(n>0||O!==s-1)&&(d.push(U,q,B),P+=3)}c.addGroup(S,P,0),S+=P}function A(N){const I=b,P=new jt,L=new ze;let R=0;const O=N===!0?e:n,F=N===!0?1:-1;for(let q=1;q<=i;q++)h.push(0,w*F,0),g.push(0,F,0),v.push(.5,.5),b++;const U=b;for(let q=0;q<=i;q++){const Z=q/i*l+a,G=Math.cos(Z),$=Math.sin(Z);L.x=O*$,L.y=w*F,L.z=O*G,h.push(L.x,L.y,L.z),g.push(0,F,0),P.x=G*.5+.5,P.y=$*.5*F+.5,v.push(P.x,P.y),b++}for(let q=0;q<i;q++){const B=I+q,Z=U+q;N===!0?d.push(Z,Z+1,B):d.push(Z+1,Z,B),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 Mw(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Tw extends Mw{constructor(e=1,n=1,r=32,i=1,s=!1,o=0,a=Math.PI*2){super(0,e,n,r,i,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Tw(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class vm extends Sr{constructor(e=[],n=[],r=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:n,radius:r,detail:i};const s=[],o=[];a(i),c(r),d(),this.setAttribute("position",new Cn(s,3)),this.setAttribute("normal",new Cn(s.slice(),3)),this.setAttribute("uv",new Cn(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(E){const A=new ze,N=new ze,I=new ze;for(let P=0;P<n.length;P+=3)v(n[P+0],A),v(n[P+1],N),v(n[P+2],I),l(A,N,I,E)}function l(E,A,N,I){const P=I+1,L=[];for(let R=0;R<=P;R++){L[R]=[];const O=E.clone().lerp(N,R/P),F=A.clone().lerp(N,R/P),U=P-R;for(let q=0;q<=U;q++)q===0&&R===P?L[R][q]=O:L[R][q]=O.clone().lerp(F,q/U)}for(let R=0;R<P;R++)for(let O=0;O<2*(P-R)-1;O++){const F=Math.floor(O/2);O%2===0?(g(L[R][F+1]),g(L[R+1][F]),g(L[R][F])):(g(L[R][F+1]),g(L[R+1][F+1]),g(L[R+1][F]))}}function c(E){const A=new ze;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 ze;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,I=S(E)/Math.PI+.5;o.push(N,1-I)}b(),h()}function h(){for(let E=0;E<o.length;E+=6){const A=o[E+0],N=o[E+2],I=o[E+4],P=Math.max(A,N,I),L=Math.min(A,N,I);P>.9&&L<.1&&(A<.2&&(o[E+0]+=1),N<.2&&(o[E+2]+=1),I<.2&&(o[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 ze,A=new ze,N=new ze,I=new ze,P=new jt,L=new jt,R=new jt;for(let O=0,F=0;O<s.length;O+=9,F+=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(o[F+0],o[F+1]),L.set(o[F+2],o[F+3]),R.set(o[F+4],o[F+5]),I.copy(E).add(A).add(N).divideScalar(3);const U=w(I);_(P,F+0,E,U),_(L,F+2,A,U),_(R,F+4,N,U)}}function _(E,A,N,I){I<0&&E.x===1&&(o[A]=E.x-1),N.x===0&&N.z===0&&(o[A]=I/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 vm(e.vertices,e.indices,e.radius,e.detail)}}class fE extends vm{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],o=[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,o,e,n),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:n}}static fromJSON(e){return new fE(e.radius,e.detail)}}const nM=new ze,rM=new ze,d6=new ze,iM=new Mc;class c9 extends Sr{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(qg*n),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],d=["a","b","c"],h=new Array(3),g={},v=[];for(let b=0;b<l;b+=3){o?(c[0]=o.getX(b),c[1]=o.getX(b+1),c[2]=o.getX(b+2)):(c[0]=b,c[1]=b+1,c[2]=b+2);const{a:_,b:w,c:S}=iM;if(_.fromBufferAttribute(a,c[0]),w.fromBufferAttribute(a,c[1]),S.fromBufferAttribute(a,c[2]),iM.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],I=h[A],P=iM[d[E]],L=iM[d[A]],R=`${N}_${I}`,O=`${I}_${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];nM.fromBufferAttribute(a,_),rM.fromBufferAttribute(a,w),v.push(nM.x,nM.y,nM.z),v.push(rM.x,rM.y,rM.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(){pn("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 o=1;o<=e;o++)r=this.getPoint(o/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 o;n?o=n:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const d=r[i],g=r[i+1]-d,v=(o-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 o=this.getPoint(i),a=this.getPoint(s),l=n||(o.isVector2?new jt:new ze);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n=!1){const r=new ze,i=[],s=[],o=[],a=new ze,l=new rr;for(let v=0;v<=e;v++){const b=v/e;i[v]=this.getTangentAt(b,new ze)}s[0]=new ze,o[0]=new ze;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),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let v=1;v<=e;v++){if(s[v]=s[v-1].clone(),o[v]=o[v-1].clone(),a.crossVectors(i[v-1],i[v]),a.length()>Number.EPSILON){a.normalize();const b=Math.acos(or(i[v-1].dot(i[v]),-1,1));s[v].applyMatrix4(l.makeRotationAxis(a,b))}o[v].crossVectors(i[v],s[v])}if(n===!0){let v=Math.acos(or(s[0].dot(s[e]),-1,1));v/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(v=-v);for(let b=1;b<=e;b++)s[b].applyMatrix4(l.makeRotationAxis(i[b],v*b)),o[b].crossVectors(i[b],s[b])}return{tangents:i,normals:s,binormals:o}}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,o=Math.PI*2,a=!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=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n=new jt){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(o?s=0:s=i),this.aClockwise===!0&&!o&&(s===i?s=-i:s=s-i);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);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 SY extends hE{constructor(e,n,r,i,s,o){super(e,n,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function u9(){let t=0,e=0,n=0,r=0;function i(s,o,a,l){t=s,e=a,n=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){i(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,d,h){let g=(o-s)/c-(a-s)/(c+d)+(a-o)/d,v=(a-o)/d-(l-o)/(d+h)+(l-a)/h;g*=d,v*=d,i(o,a,g,v)},calc:function(s){const o=s*s,a=o*s;return t+e*s+n*o+r*a}}}const sM=new ze,f6=new u9,h6=new u9,p6=new u9;class wY 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 ze){const r=n,i=this.points,s=i.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,d;this.closed||a>0?c=i[(a-1)%s]:(sM.subVectors(i[0],i[1]).add(i[0]),c=sM);const h=i[a%s],g=i[(a+1)%s];if(this.closed||a+2<s?d=i[(a+2)%s]:(sM.subVectors(i[s-1],i[s-2]).add(i[s-1]),d=sM),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 ze().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,o=(i-n)*.5,a=t*t,l=t*a;return(2*n-2*r+s+o)*l+(-3*n+3*r-2*s-o)*a+s*t+n}function hwe(t,e){const n=1-t;return n*n*e}function pwe(t,e){return 2*(1-t)*t*e}function mwe(t,e){return t*t*e}function V_(t,e,n,r){return hwe(t,e)+pwe(t,n)+mwe(t,r)}function gwe(t,e){const n=1-t;return n*n*n*e}function vwe(t,e){const n=1-t;return 3*n*n*t*e}function xwe(t,e){return 3*(1-t)*t*t*e}function ywe(t,e){return t*t*t*e}function G_(t,e,n,r,i){return gwe(t,e)+vwe(t,n)+xwe(t,r)+ywe(t,i)}class d9 extends Zd{constructor(e=new jt,n=new jt,r=new jt,i=new jt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new jt){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(G_(e,i.x,s.x,o.x,a.x),G_(e,i.y,s.y,o.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.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 MY extends Zd{constructor(e=new ze,n=new ze,r=new ze,i=new ze){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new ze){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(G_(e,i.x,s.x,o.x,a.x),G_(e,i.y,s.y,o.y,a.y),G_(e,i.z,s.z,o.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.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 f9 extends Zd{constructor(e=new jt,n=new jt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new jt){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 jt){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 TY extends Zd{constructor(e=new ze,n=new ze){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new ze){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 ze){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 h9 extends Zd{constructor(e=new jt,n=new jt,r=new jt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new jt){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(V_(e,i.x,s.x,o.x),V_(e,i.y,s.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}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=new ze,n=new ze,r=new ze){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new ze){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(V_(e,i.x,s.x,o.x),V_(e,i.y,s.y,o.y),V_(e,i.z,s.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}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 m9 extends Zd{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new jt){const r=n,i=this.points,s=(i.length-1)*e,o=Math.floor(s),a=s-o,l=i[o===0?o:o-1],c=i[o],d=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return r.set(kz(a,l.x,c.x,d.x,h.x),kz(a,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 jt().fromArray(i))}return this}}var S5=Object.freeze({__proto__:null,ArcCurve:SY,CatmullRomCurve3:wY,CubicBezierCurve:d9,CubicBezierCurve3:MY,EllipseCurve:hE,LineCurve:f9,LineCurve3:TY,QuadraticBezierCurve:h9,QuadraticBezierCurve3:p9,SplineCurve:m9});class EY 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 S5[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 o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.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 o=s[i],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);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 S5[i.type]().fromJSON(i))}return this}}class w5 extends EY{constructor(e){super(),this.type="Path",this.currentPoint=new jt,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 f9(this.currentPoint.clone(),new jt(e,n));return this.curves.push(r),this.currentPoint.set(e,n),this}quadraticCurveTo(e,n,r,i){const s=new h9(this.currentPoint.clone(),new jt(e,n),new jt(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,n,r,i,s,o){const a=new d9(this.currentPoint.clone(),new jt(e,n),new jt(r,i),new jt(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new m9(n);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,n,r,i,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,n+l,r,i,s,o),this}absarc(e,n,r,i,s,o){return this.absellipse(e,n,r,r,i,s,o),this}ellipse(e,n,r,i,s,o,a,l){const c=this.currentPoint.x,d=this.currentPoint.y;return this.absellipse(e+c,n+d,r,i,s,o,a,l),this}absellipse(e,n,r,i,s,o,a,l){const c=new hE(e,n,r,i,s,o,a,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 G0 extends w5{constructor(e){super(e),this.uuid=iu(),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 w5().fromJSON(i))}return this}}function bwe(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=CY(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=Twe(t,e,s,n)),t.length>80*n){a=t[0],l=t[1];let d=a,h=l;for(let g=n;g<i;g+=n){const v=t[g],b=t[g+1];v<a&&(a=v),b<l&&(l=b),v>d&&(d=v),b>h&&(h=b)}c=Math.max(d-a,h-l),c=c!==0?32767/c:0}return MS(s,o,n,a,l,c,0),o}function CY(t,e,n,r,i){let s;if(i===Lwe(t,e,n,r)>0)for(let o=e;o<n;o+=r)s=Pz(o/r|0,t[o],t[o+1],s);else for(let o=n-r;o>=e;o-=r)s=Pz(o/r|0,t[o],t[o+1],s);return s&&oy(s,s.next)&&(ES(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)||to(n.prev,n,n.next)===0)){if(ES(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function MS(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Rwe(t,r,i,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?Swe(t,r,i,s):_we(t)){e.push(l.i,t.i,c.i),ES(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=wwe(fv(t),e),MS(t,e,n,r,i,s,2)):o===2&&Mwe(t,e,n,r,i,s):MS(fv(t),e,n,r,i,s,1);break}}}function _we(t){const e=t.prev,n=t,r=t.next;if(to(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,c=r.y,d=Math.min(i,s,o),h=Math.min(a,l,c),g=Math.max(i,s,o),v=Math.max(a,l,c);let b=r.next;for(;b!==e;){if(b.x>=d&&b.x<=g&&b.y>=h&&b.y<=v&&b_(i,a,s,l,o,c,b.x,b.y)&&to(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function Swe(t,e,n,r){const i=t.prev,s=t,o=t.next;if(to(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,d=i.y,h=s.y,g=o.y,v=Math.min(a,l,c),b=Math.min(d,h,g),_=Math.max(a,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!==o&&b_(a,d,l,h,c,g,A.x,A.y)&&to(A.prev,A,A.next)>=0||(A=A.prevZ,N.x>=v&&N.x<=_&&N.y>=b&&N.y<=w&&N!==i&&N!==o&&b_(a,d,l,h,c,g,N.x,N.y)&&to(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!==o&&b_(a,d,l,h,c,g,A.x,A.y)&&to(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!==o&&b_(a,d,l,h,c,g,N.x,N.y)&&to(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function wwe(t,e){let n=t;do{const r=n.prev,i=n.next.next;!oy(r,i)&&NY(r,n,n.next,i)&&TS(r,i)&&TS(i,r)&&(e.push(r.i,n.i,i.i),ES(n),ES(n.next),n=t=i),n=n.next}while(n!==t);return fv(n)}function Mwe(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Dwe(o,a)){let l=RY(o,a);o=fv(o,o.next),l=fv(l,l.next),MS(o,e,n,r,i,s,0),MS(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function Twe(t,e,n,r){const i=[];for(let s=0,o=e.length;s<o;s++){const a=e[s]*r,l=s<o-1?e[s+1]*r:t.length,c=CY(t,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(Pwe(c))}i.sort(Ewe);for(let s=0;s<i.length;s++)n=Cwe(i[s],n);return n}function Ewe(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 Cwe(t,e){const n=Awe(t,e);if(!n)return e;const r=RY(n,t);return fv(r,r.next),fv(n,n.next)}function Awe(t,e){let n=e;const r=t.x,i=t.y;let s=-1/0,o;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,o=n.x<n.next.x?n:n.next,h===r))return o}n=n.next}while(n!==e);if(!o)return null;const a=o,l=o.x,c=o.y;let d=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&AY(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);TS(n,t)&&(h<d||h===d&&(n.x>o.x||n.x===o.x&&Nwe(o,n)))&&(o=n,d=h)}n=n.next}while(n!==a);return o}function Nwe(t,e){return to(t.prev,t,e.prev)<0&&to(e.next,t,t.next)<0}function Rwe(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,kwe(i)}function kwe(t){let e,n=1;do{let r=t,i;t=null;let s=null;for(e=0;r;){e++;let o=r,a=0;for(let c=0;c<n&&(a++,o=o.nextZ,!!o);c++);let l=n;for(;a>0||l>0&&o;)a!==0&&(l===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,a--):(i=o,o=o.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;r=o}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 Pwe(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 AY(t,e,n,r,i,s,o,a){return(i-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function b_(t,e,n,r,i,s,o,a){return!(t===o&&e===a)&&AY(t,e,n,r,i,s,o,a)}function Dwe(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Iwe(t,e)&&(TS(t,e)&&TS(e,t)&&Owe(t,e)&&(to(t.prev,t,e.prev)||to(t,e.prev,e))||oy(t,e)&&to(t.prev,t,t.next)>0&&to(e.prev,e,e.next)>0)}function to(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 NY(t,e,n,r){const i=aM(to(t,e,n)),s=aM(to(t,e,r)),o=aM(to(n,r,t)),a=aM(to(n,r,e));return!!(i!==s&&o!==a||i===0&&oM(t,n,e)||s===0&&oM(t,r,e)||o===0&&oM(n,t,r)||a===0&&oM(n,e,r))}function oM(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 aM(t){return t>0?1:t<0?-1:0}function Iwe(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&&NY(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function TS(t,e){return to(t.prev,t,t.next)<0?to(t,e,t.next)>=0&&to(t,t.prev,e)>=0:to(t,e,t.prev)<0||to(t,t.next,e)<0}function Owe(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 RY(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 ES(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 Lwe(t,e,n,r){let i=0;for(let s=e,o=n-r;s<n;s+=r)i+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return i}class zwe{static triangulate(e,n,r=2){return bwe(e,n,r)}}class Bd{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 Bd.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];Dz(e),Iz(r,e);let o=e.length;n.forEach(Dz);for(let l=0;l<n.length;l++)i.push(o),o+=n[l].length,Iz(r,n[l]);const a=zwe.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function Dz(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Iz(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class pE extends Sr{constructor(e=new G0([new jt(.5,.5),new jt(-.5,.5),new jt(-.5,-.5),new jt(.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 a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new Cn(i,3)),this.setAttribute("uv",new Cn(s,2)),this.computeVertexNormals();function o(a){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:jwe;let A,N=!1,I,P,L,R;if(S){A=S.getSpacedPoints(d),N=!0,g=!1;const _e=S.isCatmullRomCurve3?S.closed:!1;I=S.computeFrenetFrames(d,_e),P=new ze,L=new ze,R=new ze}g||(w=0,v=0,b=0,_=0);const O=a.extractPoints(c);let F=O.shape;const U=O.holes;if(!Bd.isClockWise(F)){F=F.reverse();for(let _e=0,De=U.length;_e<De;_e++){const he=U[_e];Bd.isClockWise(he)&&(U[_e]=he.reverse())}}function B(_e){const he=10000000000000001e-36;let Le=_e[0];for(let ne=1;ne<=_e.length;ne++){const We=ne%_e.length,je=_e[We],be=je.x-Le.x,Xe=je.y-Le.y,le=be*be+Xe*Xe,te=Math.max(Math.abs(je.x),Math.abs(je.y),Math.abs(Le.x),Math.abs(Le.y)),Se=he*te*te;if(le<=Se){_e.splice(We,1),ne--;continue}Le=je}}B(F),U.forEach(B);const Z=U.length,G=F;for(let _e=0;_e<Z;_e++){const De=U[_e];F=F.concat(De)}function $(_e,De,he){return De||Un("ExtrudeGeometry: vec does not exist"),_e.clone().addScaledVector(De,he)}const K=F.length;function Y(_e,De,he){let Le,ne,We;const je=_e.x-De.x,be=_e.y-De.y,Xe=he.x-_e.x,le=he.y-_e.y,te=je*je+be*be,Se=je*le-be*Xe;if(Math.abs(Se)>Number.EPSILON){const ve=Math.sqrt(te),ge=Math.sqrt(Xe*Xe+le*le),Te=De.x-be/ve,He=De.y+je/ve,pe=he.x-le/ge,qe=he.y+Xe/ge,xt=((pe-Te)*le-(qe-He)*Xe)/(je*le-be*Xe);Le=Te+je*xt-_e.x,ne=He+be*xt-_e.y;const nt=Le*Le+ne*ne;if(nt<=2)return new jt(Le,ne);We=Math.sqrt(nt/2)}else{let ve=!1;je>Number.EPSILON?Xe>Number.EPSILON&&(ve=!0):je<-Number.EPSILON?Xe<-Number.EPSILON&&(ve=!0):Math.sign(be)===Math.sign(le)&&(ve=!0),ve?(Le=-be,ne=je,We=Math.sqrt(te)):(Le=je,ne=be,We=Math.sqrt(te/2))}return new jt(Le/We,ne/We)}const J=[];for(let _e=0,De=G.length,he=De-1,Le=_e+1;_e<De;_e++,he++,Le++)he===De&&(he=0),Le===De&&(Le=0),J[_e]=Y(G[_e],G[he],G[Le]);const H=[];let z,X=J.concat();for(let _e=0,De=Z;_e<De;_e++){const he=U[_e];z=[];for(let Le=0,ne=he.length,We=ne-1,je=Le+1;Le<ne;Le++,We++,je++)We===ne&&(We=0),je===ne&&(je=0),z[Le]=Y(he[Le],he[We],he[je]);H.push(z),X=X.concat(z)}let V;if(w===0)V=Bd.triangulateShape(G,U);else{const _e=[],De=[];for(let he=0;he<w;he++){const Le=he/w,ne=v*Math.cos(Le*Math.PI/2),We=b*Math.sin(Le*Math.PI/2)+_;for(let je=0,be=G.length;je<be;je++){const Xe=$(G[je],J[je],We);fe(Xe.x,Xe.y,-ne),Le===0&&_e.push(Xe)}for(let je=0,be=Z;je<be;je++){const Xe=U[je];z=H[je];const le=[];for(let te=0,Se=Xe.length;te<Se;te++){const ve=$(Xe[te],z[te],We);fe(ve.x,ve.y,-ne),Le===0&&le.push(ve)}Le===0&&De.push(le)}}V=Bd.triangulateShape(_e,De)}const ie=V.length,ae=b+_;for(let _e=0;_e<K;_e++){const De=g?$(F[_e],X[_e],ae):F[_e];N?(L.copy(I.normals[0]).multiplyScalar(De.x),P.copy(I.binormals[0]).multiplyScalar(De.y),R.copy(A[0]).add(L).add(P),fe(R.x,R.y,R.z)):fe(De.x,De.y,0)}for(let _e=1;_e<=d;_e++)for(let De=0;De<K;De++){const he=g?$(F[De],X[De],ae):F[De];N?(L.copy(I.normals[_e]).multiplyScalar(he.x),P.copy(I.binormals[_e]).multiplyScalar(he.y),R.copy(A[_e]).add(L).add(P),fe(R.x,R.y,R.z)):fe(he.x,he.y,h/d*_e)}for(let _e=w-1;_e>=0;_e--){const De=_e/w,he=v*Math.cos(De*Math.PI/2),Le=b*Math.sin(De*Math.PI/2)+_;for(let ne=0,We=G.length;ne<We;ne++){const je=$(G[ne],J[ne],Le);fe(je.x,je.y,h+he)}for(let ne=0,We=U.length;ne<We;ne++){const je=U[ne];z=H[ne];for(let be=0,Xe=je.length;be<Xe;be++){const le=$(je[be],z[be],Le);N?fe(le.x,le.y+A[d-1].y,A[d-1].x+he):fe(le.x,le.y,h+he)}}}re(),ce();function re(){const _e=i.length/3;if(g){let De=0,he=K*De;for(let Le=0;Le<ie;Le++){const ne=V[Le];me(ne[2]+he,ne[1]+he,ne[0]+he)}De=d+w*2,he=K*De;for(let Le=0;Le<ie;Le++){const ne=V[Le];me(ne[0]+he,ne[1]+he,ne[2]+he)}}else{for(let De=0;De<ie;De++){const he=V[De];me(he[2],he[1],he[0])}for(let De=0;De<ie;De++){const he=V[De];me(he[0]+K*d,he[1]+K*d,he[2]+K*d)}}r.addGroup(_e,i.length/3-_e,0)}function ce(){const _e=i.length/3;let De=0;oe(G,De),De+=G.length;for(let he=0,Le=U.length;he<Le;he++){const ne=U[he];oe(ne,De),De+=ne.length}r.addGroup(_e,i.length/3-_e,1)}function oe(_e,De){let he=_e.length;for(;--he>=0;){const Le=he;let ne=he-1;ne<0&&(ne=_e.length-1);for(let We=0,je=d+w*2;We<je;We++){const be=K*We,Xe=K*(We+1),le=De+Le+be,te=De+ne+be,Se=De+ne+Xe,ve=De+Le+Xe;ye(le,te,Se,ve)}}}function fe(_e,De,he){l.push(_e),l.push(De),l.push(he)}function me(_e,De,he){Ee(_e),Ee(De),Ee(he);const Le=i.length/3,ne=E.generateTopUV(r,i,Le-3,Le-2,Le-1);Ge(ne[0]),Ge(ne[1]),Ge(ne[2])}function ye(_e,De,he,Le){Ee(_e),Ee(De),Ee(Le),Ee(De),Ee(he),Ee(Le);const ne=i.length/3,We=E.generateSideWallUV(r,i,ne-6,ne-3,ne-2,ne-1);Ge(We[0]),Ge(We[1]),Ge(We[3]),Ge(We[1]),Ge(We[2]),Ge(We[3])}function Ee(_e){i.push(l[_e*3+0]),i.push(l[_e*3+1]),i.push(l[_e*3+2])}function Ge(_e){s.push(_e.x),s.push(_e.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 Fwe(n,r,e)}static fromJSON(e,n){const r=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=n[e.shapes[s]];r.push(a)}const i=e.options.extrudePath;return i!==void 0&&(e.options.extrudePath=new S5[i.type]().fromJSON(i)),new pE(r,e.options)}}const jwe={generateTopUV:function(t,e,n,r,i){const s=e[n*3],o=e[n*3+1],a=e[r*3],l=e[r*3+1],c=e[i*3],d=e[i*3+1];return[new jt(s,o),new jt(a,l),new jt(c,d)]},generateSideWallUV:function(t,e,n,r,i,s){const o=e[n*3],a=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(a-d)<Math.abs(o-c)?[new jt(o,1-l),new jt(c,1-h),new jt(g,1-b),new jt(_,1-S)]:[new jt(a,1-l),new jt(d,1-h),new jt(v,1-b),new jt(w,1-S)]}};function Fwe(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 vm{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 Sr{constructor(e=[new jt(0,-.5),new jt(.5,0),new jt(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=or(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/n,h=new ze,g=new jt,v=new ze,b=new ze,_=new ze;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),I=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*I,o.push(h.x,h.y,h.z),g.x=E/n,g.y=P/(e.length-1),a.push(g.x,g.y);const L=l[3*P+0]*N,R=l[3*P+1],O=l[3*P+0]*I;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,I=N,P=N+e.length,L=N+e.length+1,R=N+1;s.push(I,P,R),s.push(L,R,P)}this.setIndex(s),this.setAttribute("position",new Cn(o,3)),this.setAttribute("uv",new Cn(a,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 Ew extends vm{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 Ew(e.radius,e.detail)}}class wp extends Sr{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,o=n/2,a=Math.floor(r),l=Math.floor(i),c=a+1,d=l+1,h=e/a,g=n/l,v=[],b=[],_=[],w=[];for(let S=0;S<d;S++){const E=S*g-o;for(let A=0;A<c;A++){const N=A*h-s;b.push(N,-E,0),_.push(0,0,1),w.push(A/a),w.push(1-S/l)}}for(let S=0;S<l;S++)for(let E=0;E<a;E++){const A=E+c*S,N=E+c*(S+1),I=E+1+c*(S+1),P=E+1+c*S;v.push(A,N,P),v.push(N,I,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 wp(e.width,e.height,e.widthSegments,e.heightSegments)}}class vE extends Sr{constructor(e=.5,n=1,r=32,i=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:n,thetaSegments:r,phiSegments:i,thetaStart:s,thetaLength:o},r=Math.max(3,r),i=Math.max(1,i);const a=[],l=[],c=[],d=[];let h=e;const g=(n-e)/i,v=new ze,b=new jt;for(let _=0;_<=i;_++){for(let w=0;w<=r;w++){const S=s+w/r*o;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,I=E+r+2,P=E+1;a.push(A,N,P),a.push(N,I,P)}}this.setIndex(a),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 Sr{constructor(e=new G0([new jt(0,.5),new jt(-.5,-.5),new jt(.5,-.5)]),n=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:n};const r=[],i=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let d=0;d<e.length;d++)c(e[d]),this.addGroup(a,l,d),a+=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(o,2));function c(d){const h=i.length/3,g=d.extractPoints(n);let v=g.shape;const b=g.holes;Bd.isClockWise(v)===!1&&(v=v.reverse());for(let w=0,S=b.length;w<S;w++){const E=b[w];Bd.isClockWise(E)===!0&&(b[w]=E.reverse())}const _=Bd.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),o.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,I=E[2]+h;r.push(A,N,I),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 Uwe(n,e)}static fromJSON(e,n){const r=[];for(let i=0,s=e.shapes.length;i<s;i++){const o=n[e.shapes[i]];r.push(o)}return new xE(r,e.curveSegments)}}function Uwe(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 Cw extends Sr{constructor(e=1,n=32,r=16,i=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:s,thetaStart:o,thetaLength:a},n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));const l=Math.min(o+a,Math.PI);let c=0;const d=[],h=new ze,g=new ze,v=[],b=[],_=[],w=[];for(let S=0;S<=r;S++){const E=[],A=S/r;let N=0;S===0&&o===0?N=.5/n:S===r&&l===Math.PI&&(N=-.5/n);for(let I=0;I<=n;I++){const P=I/n;h.x=-e*Math.cos(i+P*s)*Math.sin(o+A*a),h.y=e*Math.cos(o+A*a),h.z=e*Math.sin(i+P*s)*Math.sin(o+A*a),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],I=d[S+1][E],P=d[S+1][E+1];(S!==0||o>0)&&v.push(A,N,P),(S!==r-1||l<Math.PI)&&v.push(N,I,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 Cw(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class yE extends vm{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 Sr{constructor(e=1,n=.4,r=12,i=48,s=Math.PI*2,o=0,a=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:n,radialSegments:r,tubularSegments:i,arc:s,thetaStart:o,thetaLength:a},r=Math.floor(r),i=Math.floor(i);const l=[],c=[],d=[],h=[],g=new ze,v=new ze,b=new ze;for(let _=0;_<=r;_++){const w=o+_/r*a;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 Sr{constructor(e=1,n=.4,r=64,i=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:n,tubularSegments:r,radialSegments:i,p:s,q:o},r=Math.floor(r),i=Math.floor(i);const a=[],l=[],c=[],d=[],h=new ze,g=new ze,v=new ze,b=new ze,_=new ze,w=new ze,S=new ze;for(let A=0;A<=r;++A){const N=A/r*s*Math.PI*2;E(N,s,o,e,v),E(N+.01,s,o,e,b),w.subVectors(b,v),S.addVectors(b,v),_.crossVectors(w,S),S.crossVectors(_,w),_.normalize(),S.normalize();for(let I=0;I<=i;++I){const P=I/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(I/i)}}for(let A=1;A<=r;A++)for(let N=1;N<=i;N++){const I=(i+1)*(A-1)+(N-1),P=(i+1)*A+(N-1),L=(i+1)*A+N,R=(i+1)*(A-1)+N;a.push(I,P,R),a.push(P,L,R)}this.setIndex(a),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,I,P,L){const R=Math.cos(A),O=Math.sin(A),F=I/N*A,U=Math.cos(F);L.x=P*(2+U)*.5*R,L.y=P*(2+U)*O*.5,L.z=P*Math.sin(F)*.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 Sr{constructor(e=new p9(new ze(-1,-1,0),new ze(-1,1,0),new ze(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 o=e.computeFrenetFrames(n,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new ze,l=new ze,c=new jt;let d=new ze;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=o.normals[A],I=o.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*I.x,l.y=O*N.y+R*I.y,l.z=O*N.z+R*I.z,l.normalize(),g.push(l.x,l.y,l.z),a.x=d.x+r*l.x,a.y=d.y+r*l.y,a.z=d.z+r*l.z,h.push(a.x,a.y,a.z)}}function S(){for(let A=1;A<=n;A++)for(let N=1;N<=i;N++){const I=(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(I,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 S5[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class g9 extends Sr{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,i=new ze,s=new ze;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.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=a.getX(b+w),E=a.getX(b+(w+1)%3);i.fromBufferAttribute(o,S),s.fromBufferAttribute(o,E),Oz(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const d=3*a+c,h=3*a+(c+1)%3;i.fromBufferAttribute(o,d),s.fromBufferAttribute(o,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:Ev,CapsuleGeometry:uE,CircleGeometry:dE,ConeGeometry:Tw,CylinderGeometry:Mw,DodecahedronGeometry:fE,EdgesGeometry:c9,ExtrudeGeometry:pE,IcosahedronGeometry:mE,LatheGeometry:gE,OctahedronGeometry:Ew,PlaneGeometry:wp,PolyhedronGeometry:vm,RingGeometry:vE,ShapeGeometry:xE,SphereGeometry:Cw,TetrahedronGeometry:yE,TorusGeometry:bE,TorusKnotGeometry:_E,TubeGeometry:SE,WireframeGeometry:g9});class kY extends xl{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new yn(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 ay(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?(pn("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=ay(t[n]);for(const i in r)e[i]=r[i]}return e}function Bwe(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function PY(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:oi.workingColorSpace}const CS={clone:ay,merge:Il};var Hwe=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,Vwe=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class au extends xl{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Hwe,this.fragmentShader=Vwe,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=ay(e.uniforms),this.uniformsGroups=Bwe(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 o=this.uniforms[i].value;o&&o.isTexture?n.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[i]={type:"m4",value:o.toArray()}:n.uniforms[i]={value:o}}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 v9 extends au{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class x9 extends xl{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new yn(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 yn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new jt(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 ou,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 DY extends x9{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 jt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return or(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 yn(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 yn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new yn(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 IY extends xl{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new yn(16777215),this.specular=new yn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new yn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new jt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ou,this.combine=_w,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 OY extends xl{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new yn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new yn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new jt(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 LY extends xl{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new jt(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 zY extends xl{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new yn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new yn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new jt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new ou,this.combine=_w,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 xl{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ZX,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 xl{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 jY extends xl{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new yn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=gm,this.normalScale=new jt(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 FY 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 Dg(t,e){return!t||t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function UY(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,o=0;o!==r;++s){const a=n[s]*e;for(let l=0;l!==e;++l)i[o++]=t[a+l]}return i}function y9(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 o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),n.push(...o)),s=t[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),n.push(o)),s=t[i++];while(s!==void 0)}function Gwe(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];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=Dg(h,c.times.constructor),c.values=Dg(g,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function Wwe(t,e=0,n=t,r=30){r<=0&&(r=30);const i=n.tracks.length,s=e/r;for(let o=0;o<i;++o){const a=n.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=t.tracks.find(function(S){return S.name===a.name&&S.ValueTypeName===l});if(c===void 0)continue;let d=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=h/3);let g=0;const v=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(g=v/3);const b=a.times.length-1;let _;if(s<=a.times[0]){const S=d,E=h-d;_=a.values.slice(S,E)}else if(s>=a.times[b]){const S=b*h+d,E=S+h-d;_=a.values.slice(S,E)}else{const S=a.createInterpolant(),E=d,A=h-d;S.evaluate(s),_=S.resultBuffer.slice(E,A)}l==="quaternion"&&new Ua().fromArray(_).normalize().conjugate().toArray(_);const w=c.times.length;for(let S=0;S<w;++S){const E=S*v+g;if(l==="quaternion")Ua.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=Jk,t}class $we{static convertArray(e,n){return Dg(e,n)}static isTypedArray(e){return oY(e)}static getKeyframeOrder(e){return UY(e)}static sortedArray(e,n,r){return WR(e,n,r)}static flattenJSON(e,n,r,i){y9(e,n,r,i)}static subclip(e,n,r,i,s=30){return Gwe(e,n,r,i,s)}static makeClipAdditive(e,n=0,r=e,i=30){return Wwe(e,n,r,i)}}class Py{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 o;n:{r:if(!(e<i)){for(let a=r+2;;){if(i===void 0){if(e<s)break r;return r=n.length,this._cachedIndex=r,this.copySampleValue_(r-1)}if(r===a)break;if(s=i,i=n[++r],e<i)break t}o=n.length;break n}if(!(e>=s)){const a=n[1];e<a&&(r=2,s=a);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}o=r,r=0;break n}break e}for(;r<o;){const a=r+o>>>1;e<n[a]?o=a:r=a+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 o=0;o!==i;++o)n[o]=r[s+o];return n}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class BY extends Py{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:kg,endingEnd:kg}}intervalChanged_(e,n,r){const i=this.parameterPositions;let s=e-2,o=e+1,a=i[s],l=i[o];if(a===void 0)switch(this.getSettings_().endingStart){case Pg:s=e,a=2*n-r;break;case xS:s=i.length-2,a=n+i[s]-i[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case Pg:o=e,l=2*r-n;break;case xS:o=1,l=r+i[1]-i[0];break;default:o=e-1,l=n}const c=(r-n)*.5,d=this.valueSize;this._weightPrev=c/(n-a),this._weightNext=c/(l-r),this._offsetPrev=s*d,this._offsetNext=o*d}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,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 I=0;I!==a;++I)s[I]=S*o[d+I]+E*o[c+I]+A*o[l+I]+N*o[h+I];return s}}class b9 extends Py{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,d=(r-n)/(i-n),h=1-d;for(let g=0;g!==a;++g)s[g]=o[c+g]*h+o[l+g]*d;return s}}class HY extends Py{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class VY extends Py{interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,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!==a;++S)s[S]=o[c+S]*w+o[l+S]*_;return s}const v=a*2,b=e-1;for(let _=0;_!==a;++_){const w=o[c+_],S=o[l+_],E=b*v+_*2,A=g[E],N=g[E+1],I=e*v+_*2,P=h[I],L=h[I+1];let R=(r-n)/(i-n),O,F,U,q,B;for(let Z=0;Z<8;Z++){O=R*R,F=O*R,U=1-R,q=U*U,B=q*U;const $=B*n+3*q*R*A+3*U*O*P+F*i-r;if(Math.abs($)<1e-10)break;const K=3*q*(A-n)+6*U*R*(P-A)+3*O*(i-P);if(Math.abs(K)<1e-10)break;R=R-$/K,R=Math.max(0,Math.min(1,R))}s[_]=B*w+3*q*R*N+3*U*O*L+F*S}return s}}class nd{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=Dg(n,this.TimeBufferType),this.values=Dg(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:Dg(e.times,Array),values:Dg(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new HY(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new b9(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new BY(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const n=new VY(this.times,this.values,this.getValueSize(),e);return this.settings&&(n.settings=this.settings),n}setInterpolation(e){let n;switch(e){case vS:n=this.InterpolantFactoryMethodDiscrete;break;case y5:n=this.InterpolantFactoryMethodLinear;break;case HM: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 pn("KeyframeTrack:",r),this}return this.createInterpolant=n,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return vS;case this.InterpolantFactoryMethodLinear:return y5;case this.InterpolantFactoryMethodSmooth:return HM;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,o=i-1;for(;s!==i&&r[s]<e;)++s;for(;o!==-1&&r[o]>n;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(Un("KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(Un("KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){Un("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){Un("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&oY(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){Un("KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===HM,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],d=e[a+1];if(c!==d&&(a!==1||c!==e[0]))if(i)l=!0;else{const h=a*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(a!==o){e[o]=e[a];const h=a*r,g=o*r;for(let v=0;v!==r;++v)n[g+v]=n[h+v]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*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}}nd.prototype.ValueTypeName="";nd.prototype.TimeBufferType=Float32Array;nd.prototype.ValueBufferType=Float32Array;nd.prototype.DefaultInterpolation=y5;class Cv extends nd{constructor(e,n,r){super(e,n,r)}}Cv.prototype.ValueTypeName="bool";Cv.prototype.ValueBufferType=Array;Cv.prototype.DefaultInterpolation=vS;Cv.prototype.InterpolantFactoryMethodLinear=void 0;Cv.prototype.InterpolantFactoryMethodSmooth=void 0;class _9 extends nd{constructor(e,n,r,i){super(e,n,r,i)}}_9.prototype.ValueTypeName="color";class AS extends nd{constructor(e,n,r,i){super(e,n,r,i)}}AS.prototype.ValueTypeName="number";class GY extends Py{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let c=e*a;for(let d=c+a;c!==d;c+=4)Ua.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Aw extends nd{constructor(e,n,r,i){super(e,n,r,i)}InterpolantFactoryMethodLinear(e){return new GY(this.times,this.values,this.getValueSize(),e)}}Aw.prototype.ValueTypeName="quaternion";Aw.prototype.InterpolantFactoryMethodSmooth=void 0;class Av extends nd{constructor(e,n,r){super(e,n,r)}}Av.prototype.ValueTypeName="string";Av.prototype.ValueBufferType=Array;Av.prototype.DefaultInterpolation=vS;Av.prototype.InterpolantFactoryMethodLinear=void 0;Av.prototype.InterpolantFactoryMethodSmooth=void 0;class NS extends nd{constructor(e,n,r,i){super(e,n,r,i)}}NS.prototype.ValueTypeName="vector";class RS{constructor(e="",n=-1,r=[],i=JT){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=iu(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)n.push(Xwe(r[o]).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,o=r.length;s!==o;++s)n.push(nd.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const d=UY(l);l=WR(l,1,d),c=WR(c,1,d),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new AS(".morphTargetInfluences["+n[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}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 a=0,l=e.length;a<l;a++){const c=e[a],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 o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return o}static parseAnimation(e,n){if(pn("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Un("AnimationClip: No animation in JSONLoader data."),null;const r=function(h,g,v,b,_){if(v.length!==0){const w=[],S=[];y9(v,w,S,b),w.length!==0&&_.push(new h(g,w,S))}},i=[],s=e.name||"default",o=e.fps||30,a=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 AS(".morphTargetInfluence["+_+"]",w,S))}l=v.length*o}else{const v=".bones["+n[h].name+"]";r(NS,v+".position",g,"pos",i),r(Aw,v+".quaternion",g,"rot",i),r(NS,v+".scale",g,"scl",i)}}return i.length===0?null:new this(s,l,i,a)}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 qwe(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return AS;case"vector":case"vector2":case"vector3":case"vector4":return NS;case"color":return _9;case"quaternion":return Aw;case"bool":case"boolean":return Cv;case"string":return Av}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function Xwe(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=qwe(t.type);if(t.times===void 0){const n=[],r=[];y9(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 Qf={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 S9{constructor(e,n,r){const i=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=n,this.onError=r,this._abortController=null,this.itemStart=function(d){a++,s===!1&&i.onStart!==void 0&&i.onStart(d,o,a),s=!0},this.itemEnd=function(d){o++,i.onProgress!==void 0&&i.onProgress(d,o,a),o===a&&(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 WY=new S9;class kc{constructor(e){this.manager=e!==void 0?e:WY,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}}kc.DEFAULT_MATERIAL_NAME="__DEFAULT";const Kh={};class Ywe extends Error{constructor(e,n){super(e),this.response=n}}class gp extends kc{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=Qf.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(Kh[e]!==void 0){Kh[e].push({onLoad:n,onProgress:r,onError:i});return}Kh[e]=[],Kh[e].push({onLoad:n,onProgress:r,onError:i});const o=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}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&pn("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Kh[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 I=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(I)}S.enqueue(N),E()}},A=>{S.error(A)})}}});return new Response(w)}else throw new Ywe(`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,a));case"json":return c.json();default:if(a==="")return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),g=h&&h[1]?h[1].toLowerCase():void 0,v=new TextDecoder(g);return c.arrayBuffer().then(b=>v.decode(b))}}}).then(c=>{Qf.add(`file:${e}`,c);const d=Kh[e];delete Kh[e];for(let h=0,g=d.length;h<g;h++){const v=d[h];v.onLoad&&v.onLoad(c)}}).catch(c=>{const d=Kh[e];if(d===void 0)throw this.manager.itemError(e),c;delete Kh[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 Kwe extends kc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new gp(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):Un(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r<e.length;r++){const i=RS.parse(e[r]);n.push(i)}return n}}class Zwe extends kc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=[],a=new cE,l=new gp(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);o[h]={width:v.width,height:v.height,format:v.format,mipmaps:v.mipmaps},c+=1,c===6&&(v.mipmapCount===1&&(a.minFilter=rs),a.image=o,a.format=v.format,a.needsUpdate=!0,n&&n(a))},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++){o[b]={mipmaps:[]};for(let _=0;_<g.mipmapCount;_++)o[b].mipmaps.push(g.mipmaps[b*g.mipmapCount+_]),o[b].format=g.format,o[b].width=g.width,o[b].height=g.height}a.image=o}else a.image.width=g.width,a.image.height=g.height,a.mipmaps=g.mipmaps;g.mipmapCount===1&&(a.minFilter=rs),a.format=g.format,a.needsUpdate=!0,n&&n(a)},r,i);return a}}const Vx=new WeakMap;class kS extends kc{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,o=Qf.get(`image:${e}`);if(o!==void 0){if(o.complete===!0)s.manager.itemStart(e),setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0);else{let h=Vx.get(o);h===void 0&&(h=[],Vx.set(o,h)),h.push({onLoad:n,onError:i})}return o}const a=_S("img");function l(){d(),n&&n(this);const h=Vx.get(this)||[];for(let g=0;g<h.length;g++){const v=h[g];v.onLoad&&v.onLoad(this)}Vx.delete(this),s.manager.itemEnd(e)}function c(h){d(),i&&i(h),Qf.remove(`image:${e}`);const g=Vx.get(this)||[];for(let v=0;v<g.length;v++){const b=g[v];b.onError&&b.onError(h)}Vx.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function d(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),Qf.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}}class Qwe extends kc{constructor(e){super(e)}load(e,n,r,i){const s=new ww;s.colorSpace=ll;const o=new kS(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(d){s.images[c]=d,a++,a===6&&(s.needsUpdate=!0,n&&n(s))},void 0,i)}for(let c=0;c<e.length;++c)l(c);return s}}class Jwe extends kc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Hd,a=new gp(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.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?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Tc,o.wrapT=c.wrapT!==void 0?c.wrapT:Tc,o.magFilter=c.magFilter!==void 0?c.magFilter:rs,o.minFilter=c.minFilter!==void 0?c.minFilter:rs,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=Zf),c.mipmapCount===1&&(o.minFilter=rs),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,n&&n(o,c)},r,i),o}}class e3e extends kc{constructor(e){super(e)}load(e,n,r,i){const s=new ro,o=new kS(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,n!==void 0&&n(s)},r,i),s}}class xm extends bi{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new yn(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 $Y extends xm{constructor(e,n,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(bi.DEFAULT_UP),this.updateMatrix(),this.groundColor=new yn(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 ze,Fz=new ze;class w9{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 jt(512,512),this.mapType=jl,this.map=null,this.mapPass=null,this.matrix=new rr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ky,this._frameExtents=new jt(1,1),this._viewportCount=1,this._viewports=[new di(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 lM=new ze,cM=new Ua,Nf=new ze;class TE extends bi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new rr,this.projectionMatrix=new rr,this.projectionMatrixInverse=new rr,this.coordinateSystem=Qc,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(lM,cM,Nf),Nf.x===1&&Nf.y===1&&Nf.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(lM,cM,Nf.set(1,1,1)).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorld.decompose(lM,cM,Nf),Nf.x===1&&Nf.y===1&&Nf.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(lM,cM,Nf.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const y0=new ze,Uz=new jt,Bz=new jt;class eo 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=ry*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(qg*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return ry*2*Math.atan(Math.tan(qg*.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){y0.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(y0.x,y0.y).multiplyScalar(-e/y0.z),y0.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(y0.x,y0.y).multiplyScalar(-e/y0.z)}getViewSize(e,n){return this.getViewBounds(e,Uz,Bz),n.subVectors(Bz,Uz)}setViewOffset(e,n,r,i,s,o){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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(qg*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,n-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/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 t3e extends w9{constructor(){super(new eo(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const n=this.camera,r=ry*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 qY extends xm{constructor(e,n,r=0,i=Math.PI/3,s=0,o=2){super(e,n),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(bi.DEFAULT_UP),this.updateMatrix(),this.target=new bi,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new t3e}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 n3e extends w9{constructor(){super(new eo(90,1,.5,500)),this.isPointLightShadow=!0}}class XY extends xm{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 n3e}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 Vd extends TE{constructor(e=-1,n=1,r=1,i=-1,s=.1,o=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=o,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,o){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=o,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,o=r+e,a=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,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,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 r3e extends w9{constructor(){super(new Vd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class YY extends xm{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(bi.DEFAULT_UP),this.updateMatrix(),this.target=new bi,this.shadow=new r3e}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 KY extends xm{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class ZY extends xm{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 M9{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new ze)}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,o=this.coefficients;return n.copy(o[0]).multiplyScalar(.282095),n.addScaledVector(o[1],.488603*i),n.addScaledVector(o[2],.488603*s),n.addScaledVector(o[3],.488603*r),n.addScaledVector(o[4],1.092548*(r*i)),n.addScaledVector(o[5],1.092548*(i*s)),n.addScaledVector(o[6],.315392*(3*s*s-1)),n.addScaledVector(o[7],1.092548*(r*s)),n.addScaledVector(o[8],.546274*(r*r-i*i)),n}getIrradianceAt(e,n){const r=e.x,i=e.y,s=e.z,o=this.coefficients;return n.copy(o[0]).multiplyScalar(.886227),n.addScaledVector(o[1],2*.511664*i),n.addScaledVector(o[2],2*.511664*s),n.addScaledVector(o[3],2*.511664*r),n.addScaledVector(o[4],2*.429043*r*i),n.addScaledVector(o[5],2*.429043*i*s),n.addScaledVector(o[6],.743125*s*s-.247708),n.addScaledVector(o[7],2*.429043*r*s),n.addScaledVector(o[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 QY extends xm{constructor(e=new M9,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 kc{constructor(e){super(e),this.textures={}}load(e,n,r,i){const s=this,o=new gp(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):Un(l),s.manager.itemError(e)}},r,i)}parse(e){const n=this.textures;function r(s){return n[s]===void 0&&pn("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 yn().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 o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new yn().setHex(o.value);break;case"v2":i.uniforms[s].value=new jt().fromArray(o.value);break;case"v3":i.uniforms[s].value=new ze().fromArray(o.value);break;case"v4":i.uniforms[s].value=new di().fromArray(o.value);break;case"m3":i.uniforms[s].value=new _r().fromArray(o.value);break;case"m4":i.uniforms[s].value=new rr().fromArray(o.value);break;default:i.uniforms[s].value=o.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 jt().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 jt().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:kY,SpriteMaterial:s9,RawShaderMaterial:v9,ShaderMaterial:au,PointsMaterial:a9,MeshPhysicalMaterial:DY,MeshStandardMaterial:x9,MeshPhongMaterial:IY,MeshToonMaterial:OY,MeshNormalMaterial:LY,MeshLambertMaterial:zY,MeshDepthMaterial:wE,MeshDistanceMaterial:ME,MeshBasicMaterial:Sp,MeshMatcapMaterial:jY,LineDashedMaterial:FY,LineBasicMaterial:$l,Material:xl};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 Sr{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 JY extends kc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new gp(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):Un(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=i1(w.type,S),A=new oE(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 o=e.isInstancedBufferGeometry?new CE:new Sr,a=e.data.index;if(a!==void 0){const v=i1(a.type,a.array);o.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 Jc(w,b.itemSize,b.offset,b.normalized)}else{const w=i1(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),o.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 Jc(N,E.itemSize,E.offset,E.normalized)}else{const N=i1(E.type,E.array);A=new Vi(N,E.itemSize,E.normalized)}E.name!==void 0&&(A.name=E.name),_.push(A)}o.morphAttributes[v]=_}e.data.morphTargetsRelative&&(o.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];o.addGroup(_.start,_.count,_.materialIndex)}const g=e.data.boundingSphere;return g!==void 0&&(o.boundingSphere=new Wo().fromJSON(g)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class i3e extends kc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=this.path===""?$R.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new gp(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.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)),Un("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 gp(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,n);let a;try{a=JSON.parse(o)}catch(c){throw new Error("ObjectLoader: Can't parse "+e+". "+c.message)}const l=a.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(a)}parse(e,n){const r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,i),o=this.parseImages(e.images,function(){n!==void 0&&n(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,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 o)if(o[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),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,i,a,o,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 G0().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,o=e.length;s<o;s++){const a=new aE().fromJSON(e[s],i);r[a.uuid]=a}return r}parseGeometries(e,n){const r={};if(e!==void 0){const i=new JY;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=i.parse(l);break;default:l.type in Lz?a=Lz[l.type].fromJSON(l,n):pn(`ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),r[l.uuid]=a}}return r}parseMaterials(e,n){const r={},i={};if(e!==void 0){const s=new EE;s.setTextures(n);for(let o=0,a=e.length;o<a;o++){const l=e[o];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=RS.parse(i);n[s.uuid]=s}return n}parseImages(e,n){const r=this,i={};let s;function o(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 a(l){if(typeof l=="string"){const c=l,d=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:r.resourcePath+c;return o(d)}else return l.data?{data:i1(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new S9(n);s=new kS(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=a(w);S!==null&&(S instanceof HTMLImageElement?v.push(S):v.push(new Hd(S.data,S.width,S.height)))}i[h.uuid]=new U0(v)}else{const v=a(h.url);i[h.uuid]=new U0(v)}}}return i}async parseImagesAsync(e){const n=this,r={};let i;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:n.resourcePath+a;return await i.loadAsync(l)}else return o.data?{data:i1(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new kS(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],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 Hd(b.data,b.width,b.height)))}r[l.uuid]=new U0(d)}else{const d=await s(l.url);r[l.uuid]=new U0(d)}}}return r}parseTextures(e,n){function r(s,o){return typeof s=="number"?s:(pn("ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const i={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&pn('ObjectLoader: No "image" specified for',a.uuid),n[a.image]===void 0&&pn("ObjectLoader: Undefined image",a.image);const l=n[a.image],c=l.data;let d;Array.isArray(c)?(d=new ww,c.length===6&&(d.needsUpdate=!0)):(c&&c.data?d=new Hd:d=new ro,c&&(d.needsUpdate=!0)),d.source=l,d.uuid=a.uuid,a.name!==void 0&&(d.name=a.name),a.mapping!==void 0&&(d.mapping=r(a.mapping,s3e)),a.channel!==void 0&&(d.channel=a.channel),a.offset!==void 0&&d.offset.fromArray(a.offset),a.repeat!==void 0&&d.repeat.fromArray(a.repeat),a.center!==void 0&&d.center.fromArray(a.center),a.rotation!==void 0&&(d.rotation=a.rotation),a.wrap!==void 0&&(d.wrapS=r(a.wrap[0],Hz),d.wrapT=r(a.wrap[1],Hz)),a.format!==void 0&&(d.format=a.format),a.internalFormat!==void 0&&(d.internalFormat=a.internalFormat),a.type!==void 0&&(d.type=a.type),a.colorSpace!==void 0&&(d.colorSpace=a.colorSpace),a.minFilter!==void 0&&(d.minFilter=r(a.minFilter,Vz)),a.magFilter!==void 0&&(d.magFilter=r(a.magFilter,Vz)),a.anisotropy!==void 0&&(d.anisotropy=a.anisotropy),a.flipY!==void 0&&(d.flipY=a.flipY),a.generateMipmaps!==void 0&&(d.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(d.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(d.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(d.compareFunction=a.compareFunction),a.userData!==void 0&&(d.userData=a.userData),i[a.uuid]=d}return i}parseObject(e,n,r,i,s){let o;function a(g){return n[g]===void 0&&pn("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&&pn("ObjectLoader: Undefined material",w),v.push(r[w])}return v}return r[g]===void 0&&pn("ObjectLoader: Undefined material",g),r[g]}}function c(g){return i[g]===void 0&&pn("ObjectLoader: Undefined texture",g),i[g]}let d,h;switch(e.type){case"Scene":o=new n9,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new yn(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new sE(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new iE(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(o.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new eo(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new Vd(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new KY(e.color,e.intensity);break;case"DirectionalLight":o=new YY(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new XY(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new ZY(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new qY(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new $Y(e.color,e.groundColor,e.intensity);break;case"LightProbe":const g=new M9().fromArray(e.sh);o=new QY(g,e.intensity);break;case"SkinnedMesh":d=a(e.geometry),h=l(e.material),o=new mY(d,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":d=a(e.geometry),h=l(e.material),o=new Us(d,h);break;case"InstancedMesh":d=a(e.geometry),h=l(e.material);const v=e.count,b=e.instanceMatrix,_=e.instanceColor;o=new gY(d,h,v),o.instanceMatrix=new dv(new Float32Array(b.array),16),_!==void 0&&(o.instanceColor=new dv(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":d=a(e.geometry),h=l(e.material),o=new vY(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=d,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._geometryInfo=e.geometryInfo.map(w=>{let S=null,E=null;return w.boundingBox!==void 0&&(S=new Ao().fromJSON(w.boundingBox)),w.boundingSphere!==void 0&&(E=new Wo().fromJSON(w.boundingSphere)),{...w,boundingBox:S,boundingSphere:E}}),o._instanceInfo=e.instanceInfo,o._availableInstanceIds=e._availableInstanceIds,o._availableGeometryIds=e._availableGeometryIds,o._nextIndexStart=e.nextIndexStart,o._nextVertexStart=e.nextVertexStart,o._geometryCount=e.geometryCount,o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._matricesTexture=c(e.matricesTexture.uuid),o._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(o.boundingSphere=new Wo().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new Ao().fromJSON(e.boundingBox));break;case"LOD":o=new pY;break;case"Line":o=new rm(a(e.geometry),l(e.material));break;case"LineLoop":o=new xY(a(e.geometry),l(e.material));break;case"LineSegments":o=new vh(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new yY(a(e.geometry),l(e.material));break;case"Sprite":o=new hY(l(e.material));break;case"Group":o=new s1;break;case"Bone":o=new o9;break;default:o=new bi}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.pivot!==void 0&&(o.pivot=new ze().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(o.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(o.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.static!==void 0&&(o.static=e.static),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const g=e.children;for(let v=0;v<g.length;v++)o.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];o.animations.push(s[b])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const g=e.levels;for(let v=0;v<g.length;v++){const b=g[v],_=o.getObjectByProperty("uuid",b.object);_!==void 0&&o.addLevel(_,b.distance,b.hysteresis)}}return o}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?pn("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 bi}})}}const s3e={UVMapping:$T,CubeReflectionMapping:oh,CubeRefractionMapping:em,EquirectangularReflectionMapping:O_,EquirectangularRefractionMapping:L_,CubeUVReflectionMapping:Ry},Hz={RepeatWrapping:mS,ClampToEdgeWrapping:Tc,MirroredRepeatWrapping:gS},Vz={NearestFilter:Co,NearestMipmapNearestFilter:$k,NearestMipmapLinearFilter:r1,LinearFilter:rs,LinearMipmapNearestFilter:z_,LinearMipmapLinearFilter:Zf},g6=new WeakMap;class o3e extends kc{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&pn("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&pn("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,o=Qf.get(`image-bitmap:${e}`);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{if(g6.has(o)===!0)i&&i(g6.get(o)),s.manager.itemError(e),s.manager.itemEnd(e);else return n&&n(c),s.manager.itemEnd(e),c});return}return setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,a.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Qf.add(`image-bitmap:${e}`,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),g6.set(l,c),Qf.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});Qf.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let uM;class T9{static getContext(){return uM===void 0&&(uM=new(window.AudioContext||window.webkitAudioContext)),uM}static setContext(e){uM=e}}class a3e extends kc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new gp(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);T9.getContext().decodeAudioData(c,function(h){n(h)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):Un(l),s.manager.itemError(e)}}}const Gz=new rr,Wz=new rr,fg=new rr;class l3e{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new eo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new eo,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,fg.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(qg*n.fov*.5)/n.zoom;let a,l;Wz.elements[12]=-i,Gz.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,fg.elements[0]=2*n.near/(l-a),fg.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(fg),a=-o*n.aspect-s,l=o*n.aspect-s,fg.elements[0]=2*n.near/(l-a),fg.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(fg)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Wz),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Gz)}}const Gx=-90,Wx=1;class eK extends bi{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new eo(Gx,Wx,e,n);i.layers=this.layers,this.add(i);const s=new eo(Gx,Wx,e,n);s.layers=this.layers,this.add(s);const o=new eo(Gx,Wx,e,n);o.layers=this.layers,this.add(o);const a=new eo(Gx,Wx,e,n);a.layers=this.layers,this.add(a);const l=new eo(Gx,Wx,e,n);l.layers=this.layers,this.add(l);const c=new eo(Gx,Wx,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===Qc)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),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.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),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.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,o,a,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,o),e.setRenderTarget(r,2,i),w&&e.autoClear===!1&&e.clearDepth(),e.render(n,a),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 tK extends eo{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class nK{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=c3e.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 c3e(){this._document.hidden===!1&&this.reset()}const hg=new ze,v6=new Ua,u3e=new ze,pg=new ze,mg=new ze;class d3e extends bi{constructor(){super(),this.type="AudioListener",this.context=T9.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new nK}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(hg,v6,u3e),pg.set(0,0,-1).applyQuaternion(v6),mg.set(0,1,0).applyQuaternion(v6),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(hg.x,r),n.positionY.linearRampToValueAtTime(hg.y,r),n.positionZ.linearRampToValueAtTime(hg.z,r),n.forwardX.linearRampToValueAtTime(pg.x,r),n.forwardY.linearRampToValueAtTime(pg.y,r),n.forwardZ.linearRampToValueAtTime(pg.z,r),n.upX.linearRampToValueAtTime(mg.x,r),n.upY.linearRampToValueAtTime(mg.y,r),n.upZ.linearRampToValueAtTime(mg.z,r)}else n.setPosition(hg.x,hg.y,hg.z),n.setOrientation(pg.x,pg.y,pg.z,mg.x,mg.y,mg.z)}}class rK extends bi{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){pn("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){pn("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){pn("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){pn("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){pn("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?(pn("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){pn("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"?(pn("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 gg=new ze,$z=new Ua,f3e=new ze,vg=new ze;class h3e extends rK{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(gg,$z,f3e),vg.set(0,0,1).applyQuaternion($z);const n=this.panner;if(n.positionX){const r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(gg.x,r),n.positionY.linearRampToValueAtTime(gg.y,r),n.positionZ.linearRampToValueAtTime(gg.z,r),n.orientationX.linearRampToValueAtTime(vg.x,r),n.orientationY.linearRampToValueAtTime(vg.y,r),n.orientationZ.linearRampToValueAtTime(vg.z,r)}else n.setPosition(gg.x,gg.y,gg.z),n.setOrientation(vg.x,vg.y,vg.z)}}class p3e{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 iK{constructor(e,n,r){this.binding=e,this.valueSize=r;let i,s,o;switch(n){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,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 o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)r[s+a]=r[a];o=n}else{o+=n;const a=n/o;this._mixBufferRegion(r,s,0,a,i)}this.cumulativeWeight=o}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,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=n*this._origIndex;this._mixBufferRegion(r,i,l,1-s,n)}o>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]){a.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,o=i;s!==o;++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 o=0;o!==s;++o)e[n+o]=e[r+o]}_slerp(e,n,r,i){Ua.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;Ua.multiplyQuaternionsFlat(e,o,e,n,e,r),Ua.slerpFlat(e,n,e,n,e,o,i)}_lerp(e,n,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=n+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,n,r,i,s){for(let o=0;o!==s;++o){const a=n+o;e[a]=e[a]+e[r+o]*i}}}const E9="\\[\\]\\.:\\/",m3e=new RegExp("["+E9+"]","g"),C9="[^"+E9+"]",g3e="[^"+E9.replace("\\.","")+"]",v3e=/((?:WC+[\/:])*)/.source.replace("WC",C9),x3e=/(WCOD+)?/.source.replace("WCOD",g3e),y3e=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",C9),b3e=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",C9),_3e=new RegExp("^"+v3e+x3e+y3e+b3e+"$"),S3e=["material","materials","bones","map"];class w3e{constructor(e,n,r){const i=r||xi.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 xi{constructor(e,n,r){this.path=n,this.parsedPath=r||xi.parseTrackName(n),this.node=xi.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 xi.Composite(e,n,r):new xi(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(m3e,"")}static parseTrackName(e){const n=_3e.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);S3e.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 o=0;o<s.length;o++){const a=s[o];if(a.name===n||a.uuid===n)return a;const l=r(a.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=xi.findNode(this.rootNode,n.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){pn("PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=n.objectIndex;switch(r){case"materials":if(!e.material){Un("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Un("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){Un("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){Un("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Un("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){Un("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){Un("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[i];if(o===void 0){const c=n.nodeName;Un("PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Un("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Un("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=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}xi.Composite=w3e;xi.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};xi.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};xi.prototype.GetterByBindingType=[xi.prototype._getValue_direct,xi.prototype._getValue_array,xi.prototype._getValue_arrayElement,xi.prototype._getValue_toArray];xi.prototype.SetterByBindingTypeAndVersioning=[[xi.prototype._setValue_direct,xi.prototype._setValue_direct_setNeedsUpdate,xi.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[xi.prototype._setValue_array,xi.prototype._setValue_array_setNeedsUpdate,xi.prototype._setValue_array_setMatrixWorldNeedsUpdate],[xi.prototype._setValue_arrayElement,xi.prototype._setValue_arrayElement_setNeedsUpdate,xi.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[xi.prototype._setValue_fromArray,xi.prototype._setValue_fromArray_setNeedsUpdate,xi.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class M3e{constructor(){this.isAnimationObjectGroup=!0,this.uuid=iu(),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,o=s.length;let a,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=o;_!==w;++_)s[_].push(new xi(g,r[_],i[_]))}else if(b<c){a=e[b];const _=--c,w=e[_];n[w.uuid]=b,e[b]=w,n[v]=_,e[_]=g;for(let S=0,E=o;S!==E;++S){const A=s[S],N=A[_];let I=A[b];A[b]=N,I===void 0&&(I=new xi(g,r[S],i[S])),A[_]=I}}else e[b]!==a&&Un("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 o=0,a=arguments.length;o!==a;++o){const l=arguments[o],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_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],d=c.uuid,h=n[d];if(h!==void 0)if(delete n[d],h<s){const g=--s,v=e[g],b=--o,_=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=--o,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 o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,h=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(h);for(let g=d,v=l.length;g!==v;++g){const b=l[g];h[g]=new xi(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,o=this._bindings,a=o.length-1,l=o[a],c=e[a];n[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class sK{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,o=s.length,a=new Array(o),l={endingStart:kg,endingEnd:kg};for(let c=0;c!==o;++c){const d=s[c].createInterpolant(null);a[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=YX,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,o=s/i,a=i/s;e.warp(1,o,n),this.warp(a,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,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=n/o,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 o=this._updateTime(n),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Jk:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case JT:default:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(o),c[d].accumulate(i,a)}}}_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 o=r===KX;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===XX){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,o)):this._setEndings(this.repetitions===0,!0,o)),i>=n||i<0){const a=Math.floor(i/n);i-=n*a,s+=Math.abs(a);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,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=Pg,i.endingEnd=Pg):(e?i.endingStart=this.zeroSlopeAtStart?Pg:kg:i.endingStart=xS,n?i.endingEnd=this.zeroSlopeAtEnd?Pg:kg:i.endingEnd=xS)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=n,a[1]=s+e,l[1]=r,this}}const T3e=new Float32Array(1);class E3e extends gh{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,o=e._propertyBindings,a=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,o[h]=b;else{if(b=o[h],b!==void 0){b._cacheIndex===null&&(++b.referenceCount,this._addInactiveBinding(b,l,v));continue}const _=n&&n._propertyBindings[h].binding.parsedPath;b=new iK(xi.create(r,v,_),g.ValueTypeName,g.getValueSize()),++b.referenceCount,this._addInactiveBinding(b,l,v),o[h]=b}a[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 o=s[n];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[n]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=i.length,i.push(e),o.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,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],d=e._byClipCacheIndex;c._byClipCacheIndex=d,l[d]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,g=(e._localRoot||this._root).uuid;delete h[g],l.length===0&&delete o[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 o=i[n];o===void 0&&(o={},i[n]=o),o[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,o=this._bindingsByRootAndName,a=o[i],l=n[n.length-1],c=e._cacheIndex;l._cacheIndex=c,n[c]=l,n.pop(),delete a[s],Object.keys(a).length===0&&delete o[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 b9(new Float32Array(2),new Float32Array(2),1,T3e),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 o=typeof e=="string"?RS.findByName(i,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(r===void 0&&(o!==null?r=o.blendMode:r=JT),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===r)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const d=new sK(this,o,n,r);return this._bindAction(d,c),this._addInactiveAction(d,a,s),d}existingAction(e,n){const r=n||this._root,i=r.uuid,s=typeof e=="string"?RS.findByName(r,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.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),o=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);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 o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];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 o in r){const a=r[o].actionByRoot,l=a[n];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const i=this._bindingsByRootAndName,s=i[n];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,n){const r=this.existingAction(e,n);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}}class C3e extends t9{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 A9{constructor(e){this.value=e}clone(){return new A9(this.value.clone===void 0?this.value:this.value.clone())}}let A3e=0;class N3e extends gh{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:A3e++}),this.name="",this.usage=bS,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 o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class M5 extends oE{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 R3e{constructor(e,n,r,i,s,o=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=n,this.itemSize=r,this.elementSize=i,this.count=s,this.normalized=o,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 oK{constructor(e,n,r=0,i=1/0){this.ray=new Tv(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new iy,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):Un("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 o=0,a=s.length;o<a;o++)qR(s[o],e,n,!0)}}class aK{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,pn("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=or(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(or(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class k3e{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 N9{constructor(e,n,r,i){N9.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 jt;class P3e{constructor(e=new jt(1/0,1/0),n=new jt(-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 ze,dM=new ze,$x=new ze,qx=new ze,x6=new ze,D3e=new ze,I3e=new ze;class lK{constructor(e=new ze,n=new ze){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),dM.subVectors(this.end,this.start);const r=dM.dot(dM);let s=dM.dot(Kz)/r;return n&&(s=or(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=D3e,r=I3e){const i=10000000000000001e-32;let s,o;const a=this.start,l=e.start,c=this.end,d=e.end;$x.subVectors(c,a),qx.subVectors(d,l),x6.subVectors(a,l);const h=$x.dot($x),g=qx.dot(qx),v=qx.dot(x6);if(h<=i&&g<=i)return n.copy(a),r.copy(l),n.sub(r),n.dot(n);if(h<=i)s=0,o=v/g,o=or(o,0,1);else{const b=$x.dot(x6);if(g<=i)o=0,s=or(-b/h,0,1);else{const _=$x.dot(qx),w=h*g-_*_;w!==0?s=or((_*v-b*g)/w,0,1):s=0,o=(_*s+v)/g,o<0?(o=0,s=or(-b/h,0,1)):o>1&&(o=1,s=or((_-b)/h,0,1))}}return n.copy(a).addScaledVector($x,s),r.copy(l).addScaledVector(qx,o),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 ze;class O3e extends bi{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new Sr,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 o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,d=a/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 vh(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 b0=new ze,fM=new rr,y6=new rr;class L3e extends vh{constructor(e){const n=cK(e),r=new Sr,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 o=new $l({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,o),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=n,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const a=new yn(255),l=new yn(65280);this.setColors(a,l)}updateMatrixWorld(e){const n=this.bones,r=this.geometry,i=r.getAttribute("position");y6.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<n.length;s++){const a=n[s];a.parent&&a.parent.isBone&&(fM.multiplyMatrices(y6,a.matrixWorld),b0.setFromMatrixPosition(fM),i.setXYZ(o,b0.x,b0.y,b0.z),fM.multiplyMatrices(y6,a.parent.matrixWorld),b0.setFromMatrixPosition(fM),i.setXYZ(o+1,b0.x,b0.y,b0.z),o+=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 cK(t){const e=[];t.isBone===!0&&e.push(t);for(let n=0;n<t.children.length;n++)e.push(...cK(t.children[n]));return e}class z3e extends Us{constructor(e,n,r){const i=new Cw(n,4,2),s=new Sp({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 j3e=new ze,Qz=new yn,Jz=new yn;class F3e extends bi{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const i=new Ew(n);i.rotateY(Math.PI*.5),this.material=new Sp({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=i.getAttribute("position"),o=new Float32Array(s.count*3);i.setAttribute("color",new Vi(o,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(j3e.setFromMatrixPosition(this.light.matrixWorld).negate())}}class U3e extends vh{constructor(e=10,n=10,r=4473924,i=8947848){r=new yn(r),i=new yn(i);const s=n/2,o=e/n,a=e/2,l=[],c=[];for(let g=0,v=0,b=-a;g<=n;g++,b+=o){l.push(-a,0,b,a,0,b),l.push(b,0,-a,b,0,a);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 Sr;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 B3e extends vh{constructor(e=10,n=16,r=8,i=64,s=4473924,o=8947848){s=new yn(s),o=new yn(o);const a=[],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;a.push(0,0,0),a.push(v,0,b);const _=h&1?s:o;l.push(_.r,_.g,_.b),l.push(_.r,_.g,_.b)}for(let h=0;h<r;h++){const g=h&1?s:o,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;a.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,a.push(w,0,S),l.push(g.r,g.g,g.b)}}const c=new Sr;c.setAttribute("position",new Cn(a,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 ze,hM=new ze,tj=new ze;class H3e extends bi{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 Sr;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 rm(i,s),this.add(this.lightPlane),i=new Sr,i.setAttribute("position",new Cn([0,0,0,0,0,1],3)),this.targetLine=new rm(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),hM.setFromMatrixPosition(this.light.target.matrixWorld),tj.subVectors(hM,ej),this.lightPlane.lookAt(hM),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(hM),this.targetLine.scale.z=tj.length()}}const pM=new ze,ho=new TE;class V3e extends vh{constructor(e){const n=new Sr,r=new $l({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(b,_){l(b),l(_)}function l(b){i.push(0,0,0),s.push(0,0,0),o[b]===void 0&&(o[b]=[]),o[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=o,this.update();const c=new yn(16755200),d=new yn(16711680),h=new yn(43775),g=new yn(16777215),v=new yn(3355443);this.setColors(c,d,h,g,v)}setColors(e,n,r,i,s){const a=this.geometry.getAttribute("color");return a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,n.r,n.g,n.b),a.setXYZ(25,n.r,n.g,n.b),a.setXYZ(26,n.r,n.g,n.b),a.setXYZ(27,n.r,n.g,n.b),a.setXYZ(28,n.r,n.g,n.b),a.setXYZ(29,n.r,n.g,n.b),a.setXYZ(30,n.r,n.g,n.b),a.setXYZ(31,n.r,n.g,n.b),a.setXYZ(32,r.r,r.g,r.b),a.setXYZ(33,r.r,r.g,r.b),a.setXYZ(34,r.r,r.g,r.b),a.setXYZ(35,r.r,r.g,r.b),a.setXYZ(36,r.r,r.g,r.b),a.setXYZ(37,r.r,r.g,r.b),a.setXYZ(38,i.r,i.g,i.b),a.setXYZ(39,i.r,i.g,i.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0,this}update(){const e=this.geometry,n=this.pointMap,r=1,i=1;let s,o;if(ho.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,o=0;else if(this.camera.coordinateSystem===Qc)s=-1,o=1;else if(this.camera.coordinateSystem===uv)s=0,o=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);To("c",n,e,ho,0,0,s),To("t",n,e,ho,0,0,o),To("n1",n,e,ho,-r,-i,s),To("n2",n,e,ho,r,-i,s),To("n3",n,e,ho,-r,i,s),To("n4",n,e,ho,r,i,s),To("f1",n,e,ho,-r,-i,o),To("f2",n,e,ho,r,-i,o),To("f3",n,e,ho,-r,i,o),To("f4",n,e,ho,r,i,o),To("u1",n,e,ho,r*.7,i*1.1,s),To("u2",n,e,ho,-r*.7,i*1.1,s),To("u3",n,e,ho,0,i*2,s),To("cf1",n,e,ho,-r,0,o),To("cf2",n,e,ho,r,0,o),To("cf3",n,e,ho,0,-i,o),To("cf4",n,e,ho,0,i,o),To("cn1",n,e,ho,-r,0,s),To("cn2",n,e,ho,r,0,s),To("cn3",n,e,ho,0,-i,s),To("cn4",n,e,ho,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function To(t,e,n,r,i,s,o){pM.set(i,s,o).unproject(r);const a=e[t];if(a!==void 0){const l=n.getAttribute("position");for(let c=0,d=a.length;c<d;c++)l.setXYZ(a[c],pM.x,pM.y,pM.z)}}const mM=new Ao;class G3e extends vh{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 Sr;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&&mM.setFromObject(this.object),mM.isEmpty())return;const e=mM.min,n=mM.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 W3e extends vh{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 Sr;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 $3e extends rm{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],o=new Sr;o.setAttribute("position",new Cn(s,3)),o.computeBoundingSphere(),super(o,new $l({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=n;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Sr;l.setAttribute("position",new Cn(a,3)),l.computeBoundingSphere(),this.add(new Us(l,new Sp({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 ze;let gM,b6;class q3e extends bi{constructor(e=new ze(0,0,1),n=new ze(0,0,0),r=1,i=16776960,s=r*.2,o=s*.2){super(),this.type="ArrowHelper",gM===void 0&&(gM=new Sr,gM.setAttribute("position",new Cn([0,0,0,0,1,0],3)),b6=new Tw(.5,1,5,1),b6.translate(0,-.5,0)),this.position.copy(n),this.line=new rm(gM,new $l({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Us(b6,new Sp({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,s,o)}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 X3e extends vh{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 Sr;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 yn,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 Y3e{constructor(){this.type="ShapePath",this.color=new yn,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new w5,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,o){return this.currentPath.bezierCurveTo(e,n,r,i,s,o),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 I=S[A],P=new G0;P.curves=I.curves,E.push(P)}return E}function r(S,E){const A=E.length;let N=!1;for(let I=A-1,P=0;P<A;I=P++){let L=E[I],R=E[P],O=R.x-L.x,F=R.y-L.y;if(Math.abs(F)>Number.EPSILON){if(F<0&&(L=E[P],O=-O,R=E[I],F=-F),S.y<L.y||S.y>R.y)continue;if(S.y===L.y){if(S.x===L.x)return!0}else{const U=F*(S.x-L.x)-O*(S.y-L.y);if(U===0)return!0;if(U<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=Bd.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new G0,l.curves=a.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++)a=s[S],_=a.getPoints(),o=i(_),o=e?!o:o,o?(!d&&g[b]&&b++,g[b]={s:new G0,p:_},g[b].s.curves=a.curves,d&&b++,v[b]=[]):v[b].push({h:a,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 I=v[A];for(let P=0;P<I.length;P++){const L=I[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 K3e extends gh{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){pn("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function Z3e(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 Q3e(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 J3e(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=e4e(r);switch(n){case Zk:return t*e;case KT:return t*e/i.components*i.byteLength;case Sw: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 Qk:return t*e*3/i.components*i.byteLength;case cl:return t*e*4/i.components*i.byteLength;case QT:return t*e*4/i.components*i.byteLength;case j_:case F_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case U_:case B_:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case H2:case G2:return Math.max(t,16)*Math.max(e,8)/4;case B2:case V2:return Math.max(t,8)*Math.max(e,8)/2;case W2:case $2:case X2:case Y2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case q2:case K2:case Z2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Q2:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case J2:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case e5:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case t5:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case n5:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case r5:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case i5:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case s5:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case o5:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case a5:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case l5:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case c5:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case u5:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case d5:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case f5:case h5:case p5:return Math.ceil(t/4)*Math.ceil(e/4)*16;case m5:case g5:return Math.ceil(t/4)*Math.ceil(e/4)*8;case v5:case x5:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function e4e(t){switch(t){case jl:case qk:return{byteLength:1,components:1};case ty:case Xk:case ah:return{byteLength:2,components:1};case XT:case YT:return{byteLength:2,components:4};case Zu:case qT:case Vl:return{byteLength:4,components:1};case Yk:case Kk:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}class t4e{static contain(e,n){return Z3e(e,n)}static cover(e,n){return Q3e(e,n)}static fill(e){return J3e(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:bw}}));typeof window<"u"&&(window.__THREE__?pn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=bw);/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */function uK(){let t=null,e=!1,n=null,r=null;function i(s,o){n(s,o),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 n4e(t){const e=new WeakMap;function n(a,l){const c=a.array,d=a.usage,h=c.byteLength,g=t.createBuffer();t.bindBuffer(l,g),t.bufferData(l,c,d),a.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)a.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:a.version,size:h}}function r(a,l,c){const d=l.array,h=l.updateRanges;if(t.bindBuffer(c,a),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(a){return a.isInterleavedBufferAttribute&&(a=a.data),e.get(a)}function s(a){a.isInterleavedBufferAttribute&&(a=a.data);const l=e.get(a);l&&(t.deleteBuffer(l.buffer),e.delete(a))}function o(a,l){if(a.isInterleavedBufferAttribute&&(a=a.data),a.isGLBufferAttribute){const d=e.get(a);(!d||d.version<a.version)&&e.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}const c=e.get(a);if(c===void 0)e.set(a,n(a,l));else if(c.version<a.version){if(c.size!==a.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,a,l),c.version=a.version}}return{get:i,remove:s,update:o}}var r4e=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,i4e=`#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`,s4e=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,o4e=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,a4e=`#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`,l4e=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,c4e=`#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`,u4e=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,d4e=`#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`,f4e=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,h4e=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,p4e=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,m4e=`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`,g4e=`#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`,v4e=`#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`,x4e=`#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`,y4e=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,b4e=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,_4e=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,S4e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#endif`,w4e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#endif`,M4e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec4 vColor;
#endif`,T4e=`#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`,E4e=`#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`,C4e=`#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`,A4e=`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`,N4e=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,R4e=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,k4e=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,P4e=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,D4e="gl_FragColor = linearToOutputTexel( gl_FragColor );",I4e=`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 );
}`,O4e=`#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`,L4e=`#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`,z4e=`#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`,j4e=`#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`,F4e=`#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`,U4e=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,B4e=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,H4e=`#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`,V4e=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,G4e=`#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
}`,W4e=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,$4e=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,q4e=`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`,X4e=`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`,Y4e=`#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`,K4e=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,Z4e=`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`,Q4e=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,J4e=`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`,eMe=`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`,tMe=`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 );
}`,nMe=`
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`,rMe=`#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`,iMe=`#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`,sMe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,oMe=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,aMe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,lMe=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,cMe=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,uMe=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,dMe=`#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`,fMe=`#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`,hMe=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,pMe=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,mMe=`#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`,gMe=`#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`,vMe=`#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`,xMe=`#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`,yMe=`#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`,bMe=`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;`,_Me=`#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`,SMe=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,wMe=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,MMe=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,TMe=`#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`,EMe=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,CMe=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,AMe=`#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`,NMe=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,RMe=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,kMe=`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
}`,PMe=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,DMe=`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;`,IMe=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,OMe=`#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`,LMe=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,zMe=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,jMe=`#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`,FMe=`#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`,UMe=`#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`,BMe=`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;
}`,HMe=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,VMe=`#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`,GMe=`#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`,WMe=`#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`,$Me=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,qMe=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,XMe=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,YMe=`#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; }`,KMe=`#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`,ZMe=`#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`,QMe=`#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`,JMe=`#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`,e2e=`#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`,t2e=`#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 n2e=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,r2e=`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>
}`,i2e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,s2e=`#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>
}`,o2e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,a2e=`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>
}`,l2e=`#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;
}`,c2e=`#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
}`,u2e=`#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;
}`,d2e=`#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 );
}`,f2e=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,h2e=`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>
}`,p2e=`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>
}`,m2e=`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>
}`,g2e=`#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>
}`,v2e=`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>
}`,x2e=`#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>
}`,y2e=`#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>
}`,b2e=`#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;
}`,_2e=`#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>
}`,S2e=`#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
}`,w2e=`#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
}`,M2e=`#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>
}`,T2e=`#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>
}`,E2e=`#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
}`,C2e=`#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>
}`,A2e=`#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>
}`,N2e=`#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>
}`,R2e=`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>
}`,k2e=`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>
}`,P2e=`#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>
}`,D2e=`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>
}`,I2e=`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>
}`,O2e=`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>
}`,Cr={alphahash_fragment:r4e,alphahash_pars_fragment:i4e,alphamap_fragment:s4e,alphamap_pars_fragment:o4e,alphatest_fragment:a4e,alphatest_pars_fragment:l4e,aomap_fragment:c4e,aomap_pars_fragment:u4e,batching_pars_vertex:d4e,batching_vertex:f4e,begin_vertex:h4e,beginnormal_vertex:p4e,bsdfs:m4e,iridescence_fragment:g4e,bumpmap_pars_fragment:v4e,clipping_planes_fragment:x4e,clipping_planes_pars_fragment:y4e,clipping_planes_pars_vertex:b4e,clipping_planes_vertex:_4e,color_fragment:S4e,color_pars_fragment:w4e,color_pars_vertex:M4e,color_vertex:T4e,common:E4e,cube_uv_reflection_fragment:C4e,defaultnormal_vertex:A4e,displacementmap_pars_vertex:N4e,displacementmap_vertex:R4e,emissivemap_fragment:k4e,emissivemap_pars_fragment:P4e,colorspace_fragment:D4e,colorspace_pars_fragment:I4e,envmap_fragment:O4e,envmap_common_pars_fragment:L4e,envmap_pars_fragment:z4e,envmap_pars_vertex:j4e,envmap_physical_pars_fragment:Y4e,envmap_vertex:F4e,fog_vertex:U4e,fog_pars_vertex:B4e,fog_fragment:H4e,fog_pars_fragment:V4e,gradientmap_pars_fragment:G4e,lightmap_pars_fragment:W4e,lights_lambert_fragment:$4e,lights_lambert_pars_fragment:q4e,lights_pars_begin:X4e,lights_toon_fragment:K4e,lights_toon_pars_fragment:Z4e,lights_phong_fragment:Q4e,lights_phong_pars_fragment:J4e,lights_physical_fragment:eMe,lights_physical_pars_fragment:tMe,lights_fragment_begin:nMe,lights_fragment_maps:rMe,lights_fragment_end:iMe,logdepthbuf_fragment:sMe,logdepthbuf_pars_fragment:oMe,logdepthbuf_pars_vertex:aMe,logdepthbuf_vertex:lMe,map_fragment:cMe,map_pars_fragment:uMe,map_particle_fragment:dMe,map_particle_pars_fragment:fMe,metalnessmap_fragment:hMe,metalnessmap_pars_fragment:pMe,morphinstance_vertex:mMe,morphcolor_vertex:gMe,morphnormal_vertex:vMe,morphtarget_pars_vertex:xMe,morphtarget_vertex:yMe,normal_fragment_begin:bMe,normal_fragment_maps:_Me,normal_pars_fragment:SMe,normal_pars_vertex:wMe,normal_vertex:MMe,normalmap_pars_fragment:TMe,clearcoat_normal_fragment_begin:EMe,clearcoat_normal_fragment_maps:CMe,clearcoat_pars_fragment:AMe,iridescence_pars_fragment:NMe,opaque_fragment:RMe,packing:kMe,premultiplied_alpha_fragment:PMe,project_vertex:DMe,dithering_fragment:IMe,dithering_pars_fragment:OMe,roughnessmap_fragment:LMe,roughnessmap_pars_fragment:zMe,shadowmap_pars_fragment:jMe,shadowmap_pars_vertex:FMe,shadowmap_vertex:UMe,shadowmask_pars_fragment:BMe,skinbase_vertex:HMe,skinning_pars_vertex:VMe,skinning_vertex:GMe,skinnormal_vertex:WMe,specularmap_fragment:$Me,specularmap_pars_fragment:qMe,tonemapping_fragment:XMe,tonemapping_pars_fragment:YMe,transmission_fragment:KMe,transmission_pars_fragment:ZMe,uv_pars_fragment:QMe,uv_pars_vertex:JMe,uv_vertex:e2e,worldpos_vertex:t2e,background_vert:n2e,background_frag:r2e,backgroundCube_vert:i2e,backgroundCube_frag:s2e,cube_vert:o2e,cube_frag:a2e,depth_vert:l2e,depth_frag:c2e,distance_vert:u2e,distance_frag:d2e,equirect_vert:f2e,equirect_frag:h2e,linedashed_vert:p2e,linedashed_frag:m2e,meshbasic_vert:g2e,meshbasic_frag:v2e,meshlambert_vert:x2e,meshlambert_frag:y2e,meshmatcap_vert:b2e,meshmatcap_frag:_2e,meshnormal_vert:S2e,meshnormal_frag:w2e,meshphong_vert:M2e,meshphong_frag:T2e,meshphysical_vert:E2e,meshphysical_frag:C2e,meshtoon_vert:A2e,meshtoon_frag:N2e,points_vert:R2e,points_frag:k2e,shadow_vert:P2e,shadow_frag:D2e,sprite_vert:I2e,sprite_frag:O2e},mn={common:{diffuse:{value:new yn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new _r},alphaMap:{value:null},alphaMapTransform:{value:new _r},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new _r}},envmap:{envMap:{value:null},envMapRotation:{value:new _r},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 _r}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new _r}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new _r},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new _r},normalScale:{value:new jt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new _r},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new _r}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new _r}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new _r}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new yn(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 yn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new _r},alphaTest:{value:0},uvTransform:{value:new _r}},sprite:{diffuse:{value:new yn(16777215)},opacity:{value:1},center:{value:new jt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new _r},alphaMap:{value:null},alphaMapTransform:{value:new _r},alphaTest:{value:0}}},Od={basic:{uniforms:Il([mn.common,mn.specularmap,mn.envmap,mn.aomap,mn.lightmap,mn.fog]),vertexShader:Cr.meshbasic_vert,fragmentShader:Cr.meshbasic_frag},lambert:{uniforms:Il([mn.common,mn.specularmap,mn.envmap,mn.aomap,mn.lightmap,mn.emissivemap,mn.bumpmap,mn.normalmap,mn.displacementmap,mn.fog,mn.lights,{emissive:{value:new yn(0)},envMapIntensity:{value:1}}]),vertexShader:Cr.meshlambert_vert,fragmentShader:Cr.meshlambert_frag},phong:{uniforms:Il([mn.common,mn.specularmap,mn.envmap,mn.aomap,mn.lightmap,mn.emissivemap,mn.bumpmap,mn.normalmap,mn.displacementmap,mn.fog,mn.lights,{emissive:{value:new yn(0)},specular:{value:new yn(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Cr.meshphong_vert,fragmentShader:Cr.meshphong_frag},standard:{uniforms:Il([mn.common,mn.envmap,mn.aomap,mn.lightmap,mn.emissivemap,mn.bumpmap,mn.normalmap,mn.displacementmap,mn.roughnessmap,mn.metalnessmap,mn.fog,mn.lights,{emissive:{value:new yn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Cr.meshphysical_vert,fragmentShader:Cr.meshphysical_frag},toon:{uniforms:Il([mn.common,mn.aomap,mn.lightmap,mn.emissivemap,mn.bumpmap,mn.normalmap,mn.displacementmap,mn.gradientmap,mn.fog,mn.lights,{emissive:{value:new yn(0)}}]),vertexShader:Cr.meshtoon_vert,fragmentShader:Cr.meshtoon_frag},matcap:{uniforms:Il([mn.common,mn.bumpmap,mn.normalmap,mn.displacementmap,mn.fog,{matcap:{value:null}}]),vertexShader:Cr.meshmatcap_vert,fragmentShader:Cr.meshmatcap_frag},points:{uniforms:Il([mn.points,mn.fog]),vertexShader:Cr.points_vert,fragmentShader:Cr.points_frag},dashed:{uniforms:Il([mn.common,mn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Cr.linedashed_vert,fragmentShader:Cr.linedashed_frag},depth:{uniforms:Il([mn.common,mn.displacementmap]),vertexShader:Cr.depth_vert,fragmentShader:Cr.depth_frag},normal:{uniforms:Il([mn.common,mn.bumpmap,mn.normalmap,mn.displacementmap,{opacity:{value:1}}]),vertexShader:Cr.meshnormal_vert,fragmentShader:Cr.meshnormal_frag},sprite:{uniforms:Il([mn.sprite,mn.fog]),vertexShader:Cr.sprite_vert,fragmentShader:Cr.sprite_frag},background:{uniforms:{uvTransform:{value:new _r},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Cr.background_vert,fragmentShader:Cr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new _r}},vertexShader:Cr.backgroundCube_vert,fragmentShader:Cr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Cr.cube_vert,fragmentShader:Cr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Cr.equirect_vert,fragmentShader:Cr.equirect_frag},distance:{uniforms:Il([mn.common,mn.displacementmap,{referencePosition:{value:new ze},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Cr.distance_vert,fragmentShader:Cr.distance_frag},shadow:{uniforms:Il([mn.lights,mn.fog,{color:{value:new yn(0)},opacity:{value:1}}]),vertexShader:Cr.shadow_vert,fragmentShader:Cr.shadow_frag}};Od.physical={uniforms:Il([Od.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new _r},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new _r},clearcoatNormalScale:{value:new jt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new _r},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new _r},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new _r},sheen:{value:0},sheenColor:{value:new yn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new _r},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new _r},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new _r},transmissionSamplerSize:{value:new jt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new _r},attenuationDistance:{value:0},attenuationColor:{value:new yn(0)},specularColor:{value:new yn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new _r},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new _r},anisotropyVector:{value:new jt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new _r}}]),vertexShader:Cr.meshphysical_vert,fragmentShader:Cr.meshphysical_frag};const vM={r:0,b:0,g:0},xg=new ou,L2e=new rr;function z2e(t,e,n,r,i,s){const o=new yn(0);let a=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(o,a):N&&N.isColor&&(w(N,1),A=!0);const I=t.xr.getEnvironmentBlendMode();I==="additive"?n.buffers.color.setClear(0,0,0,1,s):I==="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===Ry)?(c===void 0&&(c=new Us(new Ev(1,1,1),new au({name:"BackgroundCubeMaterial",uniforms:ay(Od.backgroundCube.uniforms),vertexShader:Od.backgroundCube.vertexShader,fragmentShader:Od.backgroundCube.fragmentShader,side:Gl,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(I,P,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),xg.copy(A.backgroundRotation),xg.x*=-1,xg.y*=-1,xg.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(xg.y*=-1,xg.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(L2e.makeRotationFromEuler(xg)),c.material.toneMapped=oi.getTransfer(N.colorSpace)!==Fi,(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 wp(2,2),new au({name:"BackgroundMaterial",uniforms:ay(Od.background.uniforms),vertexShader:Od.background.vertexShader,fragmentShader:Od.background.fragmentShader,side:mp,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=oi.getTransfer(N.colorSpace)!==Fi,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(vM,PY(t)),n.buffers.color.setClear(vM.r,vM.g,vM.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 o},setClearColor:function(E,A=1){o.set(E),a=A,w(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(E){a=E,w(o,a)},render:b,addToRenderList:_,dispose:S}}function j2e(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=g(null);let s=i,o=!1;function a(U,q,B,Z,G){let $=!1;const K=h(U,Z,B,q);s!==K&&(s=K,c(s.object)),$=v(U,Z,B,G),$&&b(U,Z,B,G),G!==null&&e.update(G,t.ELEMENT_ARRAY_BUFFER),($||o)&&(o=!1,N(U,q,B,Z),G!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function l(){return t.createVertexArray()}function c(U){return t.bindVertexArray(U)}function d(U){return t.deleteVertexArray(U)}function h(U,q,B,Z){const G=Z.wireframe===!0;let $=r[q.id];$===void 0&&($={},r[q.id]=$);const K=U.isInstancedMesh===!0?U.id:0;let Y=$[K];Y===void 0&&(Y={},$[K]=Y);let J=Y[B.id];J===void 0&&(J={},Y[B.id]=J);let H=J[G];return H===void 0&&(H=g(l()),J[G]=H),H}function g(U){const q=[],B=[],Z=[];for(let G=0;G<n;G++)q[G]=0,B[G]=0,Z[G]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:q,enabledAttributes:B,attributeDivisors:Z,object:U,attributes:{},index:null}}function v(U,q,B,Z){const G=s.attributes,$=q.attributes;let K=0;const Y=B.getAttributes();for(const J in Y)if(Y[J].location>=0){const z=G[J];let X=$[J];if(X===void 0&&(J==="instanceMatrix"&&U.instanceMatrix&&(X=U.instanceMatrix),J==="instanceColor"&&U.instanceColor&&(X=U.instanceColor)),z===void 0||z.attribute!==X||X&&z.data!==X.data)return!0;K++}return s.attributesNum!==K||s.index!==Z}function b(U,q,B,Z){const G={},$=q.attributes;let K=0;const Y=B.getAttributes();for(const J in Y)if(Y[J].location>=0){let z=$[J];z===void 0&&(J==="instanceMatrix"&&U.instanceMatrix&&(z=U.instanceMatrix),J==="instanceColor"&&U.instanceColor&&(z=U.instanceColor));const X={};X.attribute=z,z&&z.data&&(X.data=z.data),G[J]=X,K++}s.attributes=G,s.attributesNum=K,s.index=Z}function _(){const U=s.newAttributes;for(let q=0,B=U.length;q<B;q++)U[q]=0}function w(U){S(U,0)}function S(U,q){const B=s.newAttributes,Z=s.enabledAttributes,G=s.attributeDivisors;B[U]=1,Z[U]===0&&(t.enableVertexAttribArray(U),Z[U]=1),G[U]!==q&&(t.vertexAttribDivisor(U,q),G[U]=q)}function E(){const U=s.newAttributes,q=s.enabledAttributes;for(let B=0,Z=q.length;B<Z;B++)q[B]!==U[B]&&(t.disableVertexAttribArray(B),q[B]=0)}function A(U,q,B,Z,G,$,K){K===!0?t.vertexAttribIPointer(U,q,B,G,$):t.vertexAttribPointer(U,q,B,Z,G,$)}function N(U,q,B,Z){_();const G=Z.attributes,$=B.getAttributes(),K=q.defaultAttributeValues;for(const Y in $){const J=$[Y];if(J.location>=0){let H=G[Y];if(H===void 0&&(Y==="instanceMatrix"&&U.instanceMatrix&&(H=U.instanceMatrix),Y==="instanceColor"&&U.instanceColor&&(H=U.instanceColor)),H!==void 0){const z=H.normalized,X=H.itemSize,V=e.get(H);if(V===void 0)continue;const ie=V.buffer,ae=V.type,re=V.bytesPerElement,ce=ae===t.INT||ae===t.UNSIGNED_INT||H.gpuType===qT;if(H.isInterleavedBufferAttribute){const oe=H.data,fe=oe.stride,me=H.offset;if(oe.isInstancedInterleavedBuffer){for(let ye=0;ye<J.locationSize;ye++)S(J.location+ye,oe.meshPerAttribute);U.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let ye=0;ye<J.locationSize;ye++)w(J.location+ye);t.bindBuffer(t.ARRAY_BUFFER,ie);for(let ye=0;ye<J.locationSize;ye++)A(J.location+ye,X/J.locationSize,ae,z,fe*re,(me+X/J.locationSize*ye)*re,ce)}else{if(H.isInstancedBufferAttribute){for(let oe=0;oe<J.locationSize;oe++)S(J.location+oe,H.meshPerAttribute);U.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=H.meshPerAttribute*H.count)}else for(let oe=0;oe<J.locationSize;oe++)w(J.location+oe);t.bindBuffer(t.ARRAY_BUFFER,ie);for(let oe=0;oe<J.locationSize;oe++)A(J.location+oe,X/J.locationSize,ae,z,X*re,X/J.locationSize*oe*re,ce)}}else if(K!==void 0){const z=K[Y];if(z!==void 0)switch(z.length){case 2:t.vertexAttrib2fv(J.location,z);break;case 3:t.vertexAttrib3fv(J.location,z);break;case 4:t.vertexAttrib4fv(J.location,z);break;default:t.vertexAttrib1fv(J.location,z)}}}}E()}function I(){O();for(const U in r){const q=r[U];for(const B in q){const Z=q[B];for(const G in Z){const $=Z[G];for(const K in $)d($[K].object),delete $[K];delete Z[G]}}delete r[U]}}function P(U){if(r[U.id]===void 0)return;const q=r[U.id];for(const B in q){const Z=q[B];for(const G in Z){const $=Z[G];for(const K in $)d($[K].object),delete $[K];delete Z[G]}}delete r[U.id]}function L(U){for(const q in r){const B=r[q];for(const Z in B){const G=B[Z];if(G[U.id]===void 0)continue;const $=G[U.id];for(const K in $)d($[K].object),delete $[K];delete G[U.id]}}}function R(U){for(const q in r){const B=r[q],Z=U.isInstancedMesh===!0?U.id:0,G=B[Z];if(G!==void 0){for(const $ in G){const K=G[$];for(const Y in K)d(K[Y].object),delete K[Y];delete G[$]}delete B[Z],Object.keys(B).length===0&&delete r[q]}}}function O(){F(),o=!0,s!==i&&(s=i,c(s.object))}function F(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:O,resetDefaultState:F,dispose:I,releaseStatesOfGeometry:P,releaseStatesOfObject:R,releaseStatesOfProgram:L,initAttributes:_,enableAttribute:w,disableUnusedAttributes:E}}function F2e(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 o(c,d,h){h!==0&&(t.drawArraysInstanced(r,c,d,h),n.update(d,r,h))}function a(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++)o(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=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function U2e(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 o(L){return!(L!==cl&&r.convert(L)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(L){const R=L===ah&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(L!==jl&&r.convert(L)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&L!==Vl&&!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&&(pn("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),I=t.getParameter(t.MAX_SAMPLES),P=t.getParameter(t.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:h,reversedDepthBuffer:g,maxTextures:v,maxVertexTextures:b,maxTextureSize:_,maxCubemapSize:w,maxAttributes:S,maxVertexUniforms:E,maxVaryings:A,maxFragmentUniforms:N,maxSamples:I,samples:P}}function B2e(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new ep,a=new _r,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 I=0;I!==A;++I)N[I]=n[I];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;a.getNormalMatrix(E),(w===null||w.length<S)&&(w=new Float32Array(S));for(let A=0,N=v;A!==_;++A,N+=4)o.copy(h[A]).applyMatrix4(E,a),o.normal.toArray(w,N),w[N+3]=o.constant}l.value=w,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,w}}const B0=4,rj=[.125,.215,.35,.446,.526,.582],Cg=20,H2e=256,a_=new Vd,ij=new yn;let _6=null,S6=0,w6=0,M6=!1;const V2e=new ze;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:o=256,position:a=V2e}=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(o);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,r,i,l,a),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=aj(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=oj(),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,Xx(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===oh||e.mapping===em?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:cl,colorSpace:tm,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}=G2e(s)),this._blurMaterial=$2e(s,e,n),this._ggxMaterial=W2e(s,e,n)}return i}_compileMaterial(e){const n=new Us(new Sr,e);this._renderer.compile(n,a_)}_sceneToCubeUV(e,n,r,i,s){const l=new eo(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=ru,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(i),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Us(new Ev,new Sp({name:"PMREM.Background",side:Gl,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 I=this._cubeSize;Xx(i,N*I,A>2?I:0,I,I),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===oh||e.mapping===em;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=aj()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=oj());const s=i?this._cubemapMaterial:this._equirectMaterial,o=this._lodMeshes[0];o.material=s;const a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Xx(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,a_)}_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,o=this._ggxMaterial,a=this._lodMeshes[r];a.material=o;const l=o.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-B0?r-b+B0:0),S=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=v,l.mipInt.value=b-n,Xx(s,w,S,3*_,2*_),i.setRenderTarget(s),i.render(a,a_),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=b-r,Xx(e,w,S,3*_,2*_),i.setRenderTarget(e),i.render(a,a_)}_blur(e,n,r,i,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,n,r,i,"latitudinal",s),this._halfBlur(o,e,r,r,i,"longitudinal",s)}_halfBlur(e,n,r,i,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&Un("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*Cg-1),_=s/b,w=isFinite(s)?1+Math.floor(d*_):Cg;w>Cg&&pn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${Cg}`);const S=[];let E=0;for(let L=0;L<Cg;++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=o==="latitudinal",a&&(g.poleAxis.value=a);const{_lodMax:A}=this;g.dTheta.value=b,g.mipInt.value=A-r;const N=this._sizeLods[i],I=3*N*(i>A-B0?i-A+B0:0),P=4*(this._cubeSize-N);Xx(n,I,P,3*N,2*N),l.setRenderTarget(n),l.render(h,a_)}}function G2e(t){const e=[],n=[],r=[];let i=t;const s=t-B0+1+rj.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);e.push(a);let l=1/a;o>t-B0?l=rj[o-t+B0-1]:o===0&&(l=0),n.push(l);const c=1/(a-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 F=[P,P,P,P,P,P];N.set(F,S*b*P)}const I=new Sr;I.setAttribute("position",new Vi(E,_)),I.setAttribute("uv",new Vi(A,w)),I.setAttribute("faceIndex",new Vi(N,S)),r.push(new Us(I,null)),i>B0&&i--}return{lodMeshes:r,sizeLods:e,sigmas:n}}function sj(t,e,n){const r=new su(t,e,n);return r.texture.mapping=Ry,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Xx(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function W2e(t,e,n){return new au({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:H2e,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:nh,depthTest:!1,depthWrite:!1})}function $2e(t,e,n){const r=new Float32Array(Cg),i=new ze(0,1,0);return new au({name:"SphericalGaussianBlur",defines:{n:Cg,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:nh,depthTest:!1,depthWrite:!1})}function oj(){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:nh,depthTest:!1,depthWrite:!1})}function aj(){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:nh,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 R9 extends su{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 ww(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 Ev(5,5,5),s=new au({name:"CubemapFromEquirect",uniforms:ay(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Gl,blending:nh});s.uniforms.tEquirect.value=n;const o=new Us(i,s),a=n.minFilter;return n.minFilter===Zf&&(n.minFilter=rs),new eK(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n=!0,r=!0,i=!0){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,r,i);e.setRenderTarget(s)}}function q2e(t){let e=new WeakMap,n=new WeakMap,r=null;function i(g,v=!1){return g==null?null:v?o(g):s(g)}function s(g){if(g&&g.isTexture){const v=g.mapping;if(v===O_||v===L_)if(e.has(g)){const b=e.get(g).texture;return a(b,g.mapping)}else{const b=g.image;if(b&&b.height>0){const _=new R9(b.height);return _.fromEquirectangularTexture(t,g),e.set(g,_),g.addEventListener("dispose",c),a(_.texture,g.mapping)}else return null}}return g}function o(g){if(g&&g.isTexture){const v=g.mapping,b=v===O_||v===L_,_=v===oh||v===em;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 a(g,v){return v===O_?g.mapping=oh:v===L_&&(g.mapping=em),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 X2e(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&&wS("WebGLRenderer: "+r+" extension not supported."),i}}}function Y2e(t,e,n,r){const i={},s=new WeakMap;function o(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",o),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 a(h,g){return i[g.id]===!0||(g.addEventListener("dispose",o),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 I=E[A+0],P=E[A+1],L=E[A+2];g.push(I,P,P,L,L,I)}}else{const E=b.array;_=b.version;for(let A=0,N=E.length/3-1;A<N;A+=3){const I=A+0,P=A+1,L=A+2;g.push(I,P,P,L,L,I)}}const w=new(b.count>=65535?i9:r9)(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:a,update:l,getWireframeAttribute:d}}function K2e(t,e,n){let r;function i(g){r=g}let s,o;function a(g){s=g.type,o=g.bytesPerElement}function l(g,v){t.drawElements(r,v,s,g*o),n.update(v,r,1)}function c(g,v,b){b!==0&&(t.drawElementsInstanced(r,v,s,g*o,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]/o,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=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=h}function Z2e(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,o,a){switch(n.calls++,o){case t.TRIANGLES:n.triangles+=a*(s/3);break;case t.LINES:n.lines+=a*(s/2);break;case t.LINE_STRIP:n.lines+=a*(s-1);break;case t.LINE_LOOP:n.lines+=a*s;break;case t.POINTS:n.points+=a*s;break;default:Un("WebGLInfo: Unknown draw mode:",o);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 Q2e(t,e,n){const r=new WeakMap,i=new di;function s(o,a,l){const c=o.morphTargetInfluences,d=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=d!==void 0?d.length:0;let g=r.get(a);if(g===void 0||g.count!==h){let F=function(){R.dispose(),r.delete(a),a.removeEventListener("dispose",F)};var v=F;g!==void 0&&g.texture.dispose();const b=a.morphAttributes.position!==void 0,_=a.morphAttributes.normal!==void 0,w=a.morphAttributes.color!==void 0,S=a.morphAttributes.position||[],E=a.morphAttributes.normal||[],A=a.morphAttributes.color||[];let N=0;b===!0&&(N=1),_===!0&&(N=2),w===!0&&(N=3);let I=a.attributes.position.count*N,P=1;I>e.maxTextureSize&&(P=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const L=new Float32Array(I*P*4*h),R=new nE(L,I,P,h);R.type=Vl,R.needsUpdate=!0;const O=N*4;for(let U=0;U<h;U++){const q=S[U],B=E[U],Z=A[U],G=I*P*4*U;for(let $=0;$<q.count;$++){const K=$*O;b===!0&&(i.fromBufferAttribute(q,$),L[G+K+0]=i.x,L[G+K+1]=i.y,L[G+K+2]=i.z,L[G+K+3]=0),_===!0&&(i.fromBufferAttribute(B,$),L[G+K+4]=i.x,L[G+K+5]=i.y,L[G+K+6]=i.z,L[G+K+7]=0),w===!0&&(i.fromBufferAttribute(Z,$),L[G+K+8]=i.x,L[G+K+9]=i.y,L[G+K+10]=i.z,L[G+K+11]=Z.itemSize===4?i.w:1)}}g={count:h,texture:R,size:new jt(I,P)},r.set(a,g),a.addEventListener("dispose",F)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",o.morphTexture,n);else{let b=0;for(let w=0;w<c.length;w++)b+=c[w];const _=a.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 J2e(t,e,n,r,i){let s=new WeakMap;function o(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 a(){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:o,dispose:a}}const e5e={[Uk]:"LINEAR_TONE_MAPPING",[Bk]:"REINHARD_TONE_MAPPING",[Hk]:"CINEON_TONE_MAPPING",[WT]:"ACES_FILMIC_TONE_MAPPING",[Gk]:"AGX_TONE_MAPPING",[Wk]:"NEUTRAL_TONE_MAPPING",[Vk]:"CUSTOM_TONE_MAPPING"};function t5e(t,e,n,r,i){const s=new su(e,n,{type:t,depthBuffer:r,stencilBuffer:i}),o=new su(e,n,{type:ah,depthBuffer:!1,stencilBuffer:!1}),a=new Sr;a.setAttribute("position",new Cn([-1,3,0,-1,-1,0,3,-1,0],3)),a.setAttribute("uv",new Cn([0,2,0,0,2,0],2));const l=new v9({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(a,l),d=new Vd(-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),o.setSize(E,A);for(let N=0;N<w.length;N++){const I=w[N];I.setSize&&I.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 I=0;I<w.length;I++){const P=w[I];P.setSize&&P.setSize(A,N)}},this.begin=function(E,A){if(v||E.toneMapping===ru&&w.length===0)return!1;if(_=A,A!==null){const N=A.width,I=A.height;(s.width!==N||s.height!==I)&&this.setSize(N,I)}return S===!1&&E.setRenderTarget(s),b=E.toneMapping,E.toneMapping=ru,!0},this.hasRenderPass=function(){return S},this.end=function(E,A){E.toneMapping=b,v=!0;let N=s,I=o;for(let P=0;P<w.length;P++){const L=w[P];if(L.enabled!==!1&&(L.render(E,I,N,A),L.needsSwap!==!1)){const R=N;N=I,I=R}}if(h!==E.outputColorSpace||g!==E.toneMapping){h=E.outputColorSpace,g=E.toneMapping,l.defines={},oi.getTransfer(h)===Fi&&(l.defines.SRGB_TRANSFER="");const P=e5e[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(),o.dispose(),a.dispose(),l.dispose()}}const dK=new ro,ZR=new sy(1,1),fK=new nE,hK=new rE,pK=new ww,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 o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function aa(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 la(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 n5e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function r5e(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(aa(n,e))return;t.uniform2fv(this.addr,e),la(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)&&(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(aa(n,e))return;t.uniform3fv(this.addr,e),la(n,e)}}function s5e(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(aa(n,e))return;t.uniform4fv(this.addr,e),la(n,e)}}function o5e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(aa(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),la(n,e)}else{if(aa(n,r))return;fj.set(r),t.uniformMatrix2fv(this.addr,!1,fj),la(n,r)}}function a5e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(aa(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),la(n,e)}else{if(aa(n,r))return;dj.set(r),t.uniformMatrix3fv(this.addr,!1,dj),la(n,r)}}function l5e(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(aa(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),la(n,e)}else{if(aa(n,r))return;uj.set(r),t.uniformMatrix4fv(this.addr,!1,uj),la(n,r)}}function c5e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function u5e(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(aa(n,e))return;t.uniform2iv(this.addr,e),la(n,e)}}function d5e(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(aa(n,e))return;t.uniform3iv(this.addr,e),la(n,e)}}function f5e(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(aa(n,e))return;t.uniform4iv(this.addr,e),la(n,e)}}function h5e(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function p5e(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(aa(n,e))return;t.uniform2uiv(this.addr,e),la(n,e)}}function m5e(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(aa(n,e))return;t.uniform3uiv(this.addr,e),la(n,e)}}function g5e(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(aa(n,e))return;t.uniform4uiv(this.addr,e),la(n,e)}}function v5e(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=dK,n.setTexture2D(e||s,i)}function x5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||hK,i)}function y5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||pK,i)}function b5e(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||fK,i)}function _5e(t){switch(t){case 5126:return n5e;case 35664:return r5e;case 35665:return i5e;case 35666:return s5e;case 35674:return o5e;case 35675:return a5e;case 35676:return l5e;case 5124:case 35670:return c5e;case 35667:case 35671:return u5e;case 35668:case 35672:return d5e;case 35669:case 35673:return f5e;case 5125:return h5e;case 36294:return p5e;case 36295:return m5e;case 36296:return g5e;case 35678:case 36198:case 36298:case 36306:case 35682:return v5e;case 35679:case 36299:case 36307:return x5e;case 35680:case 36300:case 36308:case 36293:return y5e;case 36289:case 36303:case 36311:case 36292:return b5e}}function S5e(t,e){t.uniform1fv(this.addr,e)}function w5e(t,e){const n=Dy(e,this.size,2);t.uniform2fv(this.addr,n)}function M5e(t,e){const n=Dy(e,this.size,3);t.uniform3fv(this.addr,n)}function T5e(t,e){const n=Dy(e,this.size,4);t.uniform4fv(this.addr,n)}function E5e(t,e){const n=Dy(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function C5e(t,e){const n=Dy(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function A5e(t,e){const n=Dy(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function N5e(t,e){t.uniform1iv(this.addr,e)}function R5e(t,e){t.uniform2iv(this.addr,e)}function k5e(t,e){t.uniform3iv(this.addr,e)}function P5e(t,e){t.uniform4iv(this.addr,e)}function D5e(t,e){t.uniform1uiv(this.addr,e)}function I5e(t,e){t.uniform2uiv(this.addr,e)}function O5e(t,e){t.uniform3uiv(this.addr,e)}function L5e(t,e){t.uniform4uiv(this.addr,e)}function z5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);aa(r,s)||(t.uniform1iv(this.addr,s),la(r,s));let o;this.type===t.SAMPLER_2D_SHADOW?o=ZR:o=dK;for(let a=0;a!==i;++a)n.setTexture2D(e[a]||o,s[a])}function j5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);aa(r,s)||(t.uniform1iv(this.addr,s),la(r,s));for(let o=0;o!==i;++o)n.setTexture3D(e[o]||hK,s[o])}function F5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);aa(r,s)||(t.uniform1iv(this.addr,s),la(r,s));for(let o=0;o!==i;++o)n.setTextureCube(e[o]||pK,s[o])}function U5e(t,e,n){const r=this.cache,i=e.length,s=NE(n,i);aa(r,s)||(t.uniform1iv(this.addr,s),la(r,s));for(let o=0;o!==i;++o)n.setTexture2DArray(e[o]||fK,s[o])}function B5e(t){switch(t){case 5126:return S5e;case 35664:return w5e;case 35665:return M5e;case 35666:return T5e;case 35674:return E5e;case 35675:return C5e;case 35676:return A5e;case 5124:case 35670:return N5e;case 35667:case 35671:return R5e;case 35668:case 35672:return k5e;case 35669:case 35673:return P5e;case 5125:return D5e;case 36294:return I5e;case 36295:return O5e;case 36296:return L5e;case 35678:case 36198:case 36298:case 36306:case 35682:return z5e;case 35679:case 36299:case 36307:return j5e;case 35680:case 36300:case 36308:case 36293:return F5e;case 36289:case 36303:case 36311:case 36292:return U5e}}class H5e{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=_5e(n.type)}}class V5e{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=B5e(n.type)}}class G5e{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const i=this.seq;for(let s=0,o=i.length;s!==o;++s){const a=i[s];a.setValue(e,n[a.id],r)}}}const T6=/(\w+)(\])?(\[|\.)?/g;function hj(t,e){t.seq.push(e),t.map[e.id]=e}function W5e(t,e,n){const r=t.name,i=r.length;for(T6.lastIndex=0;;){const s=T6.exec(r),o=T6.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){hj(n,c===void 0?new H5e(a,t,e):new V5e(a,t,e));break}else{let h=n.map[a];h===void 0&&(h=new G5e(a),hj(n,h)),n=h}}}class GM{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let o=0;o<r;++o){const a=e.getActiveUniform(n,o),l=e.getUniformLocation(n,a.name);W5e(a,l,this)}const i=[],s=[];for(const o of this.seq)o.type===e.SAMPLER_2D_SHADOW||o.type===e.SAMPLER_CUBE_SHADOW||o.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(o):s.push(o);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,o=n.length;s!==o;++s){const a=n[s],l=r[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,i)}}static seqWithValue(e,n){const r=[];for(let i=0,s=e.length;i!==s;++i){const o=e[i];o.id in n&&r.push(o)}return r}}function pj(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const $5e=37297;let q5e=0;function X5e(t,e){const n=t.split(`
`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let o=i;o<s;o++){const a=o+1;r.push(`${a===e?">":" "} ${a}: ${n[o]}`)}return r.join(`
`)}const mj=new _r;function Y5e(t){oi._getMatrix(mj,oi.workingColorSpace,t);const e=`mat3( ${mj.elements.map(n=>n.toFixed(4))} )`;switch(oi.getTransfer(t)){case yS:return[e,"LinearTransferOETF"];case Fi:return[e,"sRGBTransferOETF"];default:return pn("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 o=/ERROR: 0:(\d+)/.exec(s);if(o){const a=parseInt(o[1]);return n.toUpperCase()+`

`+s+`

`+X5e(t.getShaderSource(e),a)}else return s}function K5e(t,e){const n=Y5e(e);return[`vec4 ${t}( vec4 value ) {`,`	return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
`)}const Z5e={[Uk]:"Linear",[Bk]:"Reinhard",[Hk]:"Cineon",[WT]:"ACESFilmic",[Gk]:"AgX",[Wk]:"Neutral",[Vk]:"Custom"};function Q5e(t,e){const n=Z5e[e];return n===void 0?(pn("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+t+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const xM=new ze;function J5e(){oi.getLuminanceCoefficients(xM);const t=xM.x.toFixed(4),e=xM.y.toFixed(4),n=xM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${t}, ${e}, ${n} );`,"	return dot( weights, rgb );","}"].join(`
`)}function eTe(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(__).join(`
`)}function tTe(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
`)}function nTe(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=t.getActiveAttrib(e,i),o=s.name;let a=1;s.type===t.FLOAT_MAT2&&(a=2),s.type===t.FLOAT_MAT3&&(a=3),s.type===t.FLOAT_MAT4&&(a=4),n[o]={type:s.type,location:t.getAttribLocation(e,o),locationSize:a}}return n}function __(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 rTe=/^[ \t]*#include +<([\w\d./]+)>/gm;function QR(t){return t.replace(rTe,sTe)}const iTe=new Map;function sTe(t,e){let n=Cr[e];if(n===void 0){const r=iTe.get(e);if(r!==void 0)n=Cr[r],pn('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 oTe=/#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(oTe,aTe)}function aTe(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 lTe={[b1]:"SHADOWMAP_TYPE_PCF",[Rg]:"SHADOWMAP_TYPE_VSM"};function cTe(t){return lTe[t.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const uTe={[oh]:"ENVMAP_TYPE_CUBE",[em]:"ENVMAP_TYPE_CUBE",[Ry]:"ENVMAP_TYPE_CUBE_UV"};function dTe(t){return t.envMap===!1?"ENVMAP_TYPE_CUBE":uTe[t.envMapMode]||"ENVMAP_TYPE_CUBE"}const fTe={[em]:"ENVMAP_MODE_REFRACTION"};function hTe(t){return t.envMap===!1?"ENVMAP_MODE_REFLECTION":fTe[t.envMapMode]||"ENVMAP_MODE_REFLECTION"}const pTe={[_w]:"ENVMAP_BLENDING_MULTIPLY",[WX]:"ENVMAP_BLENDING_MIX",[$X]:"ENVMAP_BLENDING_ADD"};function mTe(t){return t.envMap===!1?"ENVMAP_BLENDING_NONE":pTe[t.combine]||"ENVMAP_BLENDING_NONE"}function gTe(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 vTe(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=cTe(n),c=dTe(n),d=hTe(n),h=mTe(n),g=gTe(n),v=eTe(n),b=tTe(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(__).join(`
`),w.length>0&&(w+=`
`),S=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(__).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(__).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!==ru?"#define TONE_MAPPING":"",n.toneMapping!==ru?Cr.tonemapping_pars_fragment:"",n.toneMapping!==ru?Q5e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Cr.colorspace_pars_fragment,K5e("linearToOutputTexel",n.outputColorSpace),J5e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
`].filter(__).join(`
`)),o=QR(o),o=vj(o,n),o=xj(o,n),a=QR(a),a=vj(a,n),a=xj(a,n),o=yj(o),a=yj(a),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+o,N=E+S+a,I=pj(i,i.VERTEX_SHADER,A),P=pj(i,i.FRAGMENT_SHADER,N);i.attachShader(_,I),i.attachShader(_,P),n.index0AttributeName!==void 0?i.bindAttribLocation(_,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function L(U){if(t.debug.checkShaderErrors){const q=i.getProgramInfoLog(_)||"",B=i.getShaderInfoLog(I)||"",Z=i.getShaderInfoLog(P)||"",G=q.trim(),$=B.trim(),K=Z.trim();let Y=!0,J=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(Y=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,_,I,P);else{const H=gj(i,I,"vertex"),z=gj(i,P,"fragment");Un("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`

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

Program Info Log: `+G+`
`+H+`
`+z)}else G!==""?pn("WebGLProgram: Program Info Log:",G):($===""||K==="")&&(J=!1);J&&(U.diagnostics={runnable:Y,programLog:G,vertexShader:{log:$,prefix:w},fragmentShader:{log:K,prefix:S}})}i.deleteShader(I),i.deleteShader(P),R=new GM(i,_),O=nTe(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 F=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return F===!1&&(F=i.getProgramParameter(_,$5e)),F},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=q5e++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=I,this.fragmentShader=P,this}let xTe=0;class yTe{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),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.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 bTe(e),n.set(e,r)),r}}class bTe{constructor(e){this.id=xTe++,this.code=e,this.usedTimes=0}}function _Te(t,e,n,r,i,s){const o=new iy,a=new yTe,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,F,U,q){const B=U.fog,Z=q.geometry,G=R.isMeshStandardMaterial||R.isMeshLambertMaterial||R.isMeshPhongMaterial?U.environment:null,$=R.isMeshStandardMaterial||R.isMeshLambertMaterial&&!R.envMap||R.isMeshPhongMaterial&&!R.envMap,K=e.get(R.envMap||G,$),Y=K&&K.mapping===Ry?K.image.height:null,J=v[R.type];R.precision!==null&&(g=r.getMaxPrecision(R.precision),g!==R.precision&&pn("WebGLProgram.getParameters:",R.precision,"not supported, using",g,"instead."));const H=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,z=H!==void 0?H.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 V,ie,ae,re;if(J){const st=Od[J];V=st.vertexShader,ie=st.fragmentShader}else V=R.vertexShader,ie=R.fragmentShader,a.update(R),ae=a.getVertexShaderID(R),re=a.getFragmentShaderID(R);const ce=t.getRenderTarget(),oe=t.state.buffers.depth.getReversed(),fe=q.isInstancedMesh===!0,me=q.isBatchedMesh===!0,ye=!!R.map,Ee=!!R.matcap,Ge=!!K,_e=!!R.aoMap,De=!!R.lightMap,he=!!R.bumpMap,Le=!!R.normalMap,ne=!!R.displacementMap,We=!!R.emissiveMap,je=!!R.metalnessMap,be=!!R.roughnessMap,Xe=R.anisotropy>0,le=R.clearcoat>0,te=R.dispersion>0,Se=R.iridescence>0,ve=R.sheen>0,ge=R.transmission>0,Te=Xe&&!!R.anisotropyMap,He=le&&!!R.clearcoatMap,pe=le&&!!R.clearcoatNormalMap,qe=le&&!!R.clearcoatRoughnessMap,xt=Se&&!!R.iridescenceMap,nt=Se&&!!R.iridescenceThicknessMap,tt=ve&&!!R.sheenColorMap,Fe=ve&&!!R.sheenRoughnessMap,we=!!R.specularMap,ke=!!R.specularColorMap,Ze=!!R.specularIntensityMap,Ne=ge&&!!R.transmissionMap,Ke=ge&&!!R.thicknessMap,it=!!R.gradientMap,ht=!!R.alphaMap,Je=R.alphaTest>0,$e=!!R.alphaHash,Ae=!!R.extensions;let Oe=ru;R.toneMapped&&(ce===null||ce.isXRRenderTarget===!0)&&(Oe=t.toneMapping);const Ye={shaderID:J,shaderType:R.type,shaderName:R.name,vertexShader:V,fragmentShader:ie,defines:R.defines,customVertexShaderID:ae,customFragmentShaderID:re,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:g,batching:me,batchingColor:me&&q._colorsTexture!==null,instancing:fe,instancingColor:fe&&q.instanceColor!==null,instancingMorph:fe&&q.morphTexture!==null,outputColorSpace:ce===null?t.outputColorSpace:ce.isXRRenderTarget===!0?ce.texture.colorSpace:tm,alphaToCoverage:!!R.alphaToCoverage,map:ye,matcap:Ee,envMap:Ge,envMapMode:Ge&&K.mapping,envMapCubeUVHeight:Y,aoMap:_e,lightMap:De,bumpMap:he,normalMap:Le,displacementMap:ne,emissiveMap:We,normalMapObjectSpace:Le&&R.normalMapType===JX,normalMapTangentSpace:Le&&R.normalMapType===gm,metalnessMap:je,roughnessMap:be,anisotropy:Xe,anisotropyMap:Te,clearcoat:le,clearcoatMap:He,clearcoatNormalMap:pe,clearcoatRoughnessMap:qe,dispersion:te,iridescence:Se,iridescenceMap:xt,iridescenceThicknessMap:nt,sheen:ve,sheenColorMap:tt,sheenRoughnessMap:Fe,specularMap:we,specularColorMap:ke,specularIntensityMap:Ze,transmission:ge,transmissionMap:Ne,thicknessMap:Ke,gradientMap:it,opaque:R.transparent===!1&&R.blending===$g&&R.alphaToCoverage===!1,alphaMap:ht,alphaTest:Je,alphaHash:$e,combine:R.combine,mapUv:ye&&b(R.map.channel),aoMapUv:_e&&b(R.aoMap.channel),lightMapUv:De&&b(R.lightMap.channel),bumpMapUv:he&&b(R.bumpMap.channel),normalMapUv:Le&&b(R.normalMap.channel),displacementMapUv:ne&&b(R.displacementMap.channel),emissiveMapUv:We&&b(R.emissiveMap.channel),metalnessMapUv:je&&b(R.metalnessMap.channel),roughnessMapUv:be&&b(R.roughnessMap.channel),anisotropyMapUv:Te&&b(R.anisotropyMap.channel),clearcoatMapUv:He&&b(R.clearcoatMap.channel),clearcoatNormalMapUv:pe&&b(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:qe&&b(R.clearcoatRoughnessMap.channel),iridescenceMapUv:xt&&b(R.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&b(R.iridescenceThicknessMap.channel),sheenColorMapUv:tt&&b(R.sheenColorMap.channel),sheenRoughnessMapUv:Fe&&b(R.sheenRoughnessMap.channel),specularMapUv:we&&b(R.specularMap.channel),specularColorMapUv:ke&&b(R.specularColorMap.channel),specularIntensityMapUv:Ze&&b(R.specularIntensityMap.channel),transmissionMapUv:Ne&&b(R.transmissionMap.channel),thicknessMapUv:Ke&&b(R.thicknessMap.channel),alphaMapUv:ht&&b(R.alphaMap.channel),vertexTangents:!!Z.attributes.tangent&&(Le||Xe),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,pointsUvs:q.isPoints===!0&&!!Z.attributes.uv&&(ye||ht),fog:!!B,useFog:R.fog===!0,fogExp2:!!B&&B.isFogExp2,flatShading:R.wireframe===!1&&(R.flatShading===!0||Z.attributes.normal===void 0&&Le===!1&&(R.isMeshLambertMaterial||R.isMeshPhongMaterial||R.isMeshStandardMaterial||R.isMeshPhysicalMaterial)),sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:oe,skinning:q.isSkinnedMesh===!0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:z,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&&F.length>0,shadowMapType:t.shadowMap.type,toneMapping:Oe,decodeVideoTexture:ye&&R.map.isVideoTexture===!0&&oi.getTransfer(R.map.colorSpace)===Fi,decodeVideoTextureEmissive:We&&R.emissiveMap.isVideoTexture===!0&&oi.getTransfer(R.emissiveMap.colorSpace)===Fi,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===Yc,flipSided:R.side===Gl,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionClipCullDistance:Ae&&R.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ae&&R.extensions.multiDraw===!0||me)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()};return Ye.vertexUv1s=l.has(1),Ye.vertexUv2s=l.has(2),Ye.vertexUv3s=l.has(3),l.clear(),Ye}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 F in R.defines)O.push(F),O.push(R.defines[F]);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){o.disableAll(),O.instancing&&o.enable(0),O.instancingColor&&o.enable(1),O.instancingMorph&&o.enable(2),O.matcap&&o.enable(3),O.envMap&&o.enable(4),O.normalMapObjectSpace&&o.enable(5),O.normalMapTangentSpace&&o.enable(6),O.clearcoat&&o.enable(7),O.iridescence&&o.enable(8),O.alphaTest&&o.enable(9),O.vertexColors&&o.enable(10),O.vertexAlphas&&o.enable(11),O.vertexUv1s&&o.enable(12),O.vertexUv2s&&o.enable(13),O.vertexUv3s&&o.enable(14),O.vertexTangents&&o.enable(15),O.anisotropy&&o.enable(16),O.alphaHash&&o.enable(17),O.batching&&o.enable(18),O.dispersion&&o.enable(19),O.batchingColor&&o.enable(20),O.gradientMap&&o.enable(21),R.push(o.mask),o.disableAll(),O.fog&&o.enable(0),O.useFog&&o.enable(1),O.flatShading&&o.enable(2),O.logarithmicDepthBuffer&&o.enable(3),O.reversedDepthBuffer&&o.enable(4),O.skinning&&o.enable(5),O.morphTargets&&o.enable(6),O.morphNormals&&o.enable(7),O.morphColors&&o.enable(8),O.premultipliedAlpha&&o.enable(9),O.shadowMapEnabled&&o.enable(10),O.doubleSided&&o.enable(11),O.flipSided&&o.enable(12),O.useDepthPacking&&o.enable(13),O.dithering&&o.enable(14),O.transmission&&o.enable(15),O.sheen&&o.enable(16),O.opaque&&o.enable(17),O.pointsUvs&&o.enable(18),O.decodeVideoTexture&&o.enable(19),O.decodeVideoTextureEmissive&&o.enable(20),O.alphaToCoverage&&o.enable(21),R.push(o.mask)}function A(R){const O=v[R.type];let F;if(O){const U=Od[O];F=CS.clone(U.uniforms)}else F=R.uniforms;return F}function N(R,O){let F=d.get(O);return F!==void 0?++F.usedTimes:(F=new vTe(t,O,R,i),c.push(F),d.set(O,F)),F}function I(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){a.remove(R)}function L(){a.dispose()}return{getParameters:_,getProgramCacheKey:w,getUniforms:A,acquireProgram:N,releaseProgram:I,releaseShaderCache:P,programs:c,dispose:L}}function STe(){let t=new WeakMap;function e(o){return t.has(o)}function n(o){let a=t.get(o);return a===void 0&&(a={},t.set(o,a)),a}function r(o){t.delete(o)}function i(o,a,l){t.get(o)[a]=l}function s(){t=new WeakMap}return{has:e,get:n,remove:r,update:i,dispose:s}}function wTe(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 o(g){let v=0;return g.isInstancedMesh&&(v+=2),g.isSkinnedMesh&&(v+=1),v}function a(g,v,b,_,w,S){let E=t[e];return E===void 0?(E={id:g.id,object:g,geometry:v,material:b,materialVariant:o(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=o(g),E.groupOrder=_,E.renderOrder=g.renderOrder,E.z=w,E.group=S),e++,E}function l(g,v,b,_,w,S){const E=a(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=a(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||wTe),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 MTe(){let t=new WeakMap;function e(r,i){const s=t.get(r);let o;return s===void 0?(o=new Sj,t.set(r,[o])):i>=s.length?(o=new Sj,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function TTe(){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 ze,color:new yn};break;case"SpotLight":n={position:new ze,direction:new ze,color:new yn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new ze,color:new yn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new ze,skyColor:new yn,groundColor:new yn};break;case"RectAreaLight":n={color:new yn,position:new ze,halfWidth:new ze,halfHeight:new ze};break}return t[e.id]=n,n}}}function ETe(){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 jt};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new jt};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new jt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let CTe=0;function ATe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function NTe(t){const e=new TTe,n=ETe(),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 ze);const i=new ze,s=new rr,o=new rr;function a(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,I=0,P=0,L=0;c.sort(ATe);for(let O=0,F=c.length;O<F;O++){const U=c[O],q=U.color,B=U.intensity,Z=U.distance;let G=null;if(U.shadow&&U.shadow.map&&(U.shadow.map.texture.format===cv?G=U.shadow.map.texture:G=U.shadow.map.depthTexture||U.shadow.map.texture),U.isAmbientLight)d+=q.r*B,h+=q.g*B,g+=q.b*B;else if(U.isLightProbe){for(let $=0;$<9;$++)r.probe[$].addScaledVector(U.sh.coefficients[$],B);L++}else if(U.isDirectionalLight){const $=e.get(U);if($.color.copy(U.color).multiplyScalar(U.intensity),U.castShadow){const K=U.shadow,Y=n.get(U);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]=G,r.directionalShadowMatrix[v]=U.shadow.matrix,E++}r.directional[v]=$,v++}else if(U.isSpotLight){const $=e.get(U);$.position.setFromMatrixPosition(U.matrixWorld),$.color.copy(q).multiplyScalar(B),$.distance=Z,$.coneCos=Math.cos(U.angle),$.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),$.decay=U.decay,r.spot[_]=$;const K=U.shadow;if(U.map&&(r.spotLightMap[I]=U.map,I++,K.updateMatrices(U),U.castShadow&&P++),r.spotLightMatrix[_]=K.matrix,U.castShadow){const Y=n.get(U);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[_]=G,N++}_++}else if(U.isRectAreaLight){const $=e.get(U);$.color.copy(q).multiplyScalar(B),$.halfWidth.set(U.width*.5,0,0),$.halfHeight.set(0,U.height*.5,0),r.rectArea[w]=$,w++}else if(U.isPointLight){const $=e.get(U);if($.color.copy(U.color).multiplyScalar(U.intensity),$.distance=U.distance,$.decay=U.decay,U.castShadow){const K=U.shadow,Y=n.get(U);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]=G,r.pointShadowMatrix[b]=U.shadow.matrix,A++}r.point[b]=$,b++}else if(U.isHemisphereLight){const $=e.get(U);$.skyColor.copy(U.color).multiplyScalar(B),$.groundColor.copy(U.groundColor).multiplyScalar(B),r.hemi[S]=$,S++}}w>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=mn.LTC_FLOAT_1,r.rectAreaLTC2=mn.LTC_FLOAT_2):(r.rectAreaLTC1=mn.LTC_HALF_1,r.rectAreaLTC2=mn.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!==I||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+I-P,r.spotLightMap.length=I,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=I,R.numLightProbes=L,r.version=CTe++)}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),o.identity(),s.copy(A.matrixWorld),s.premultiply(w),o.extractRotation(s),N.halfWidth.set(A.width*.5,0,0),N.halfHeight.set(0,A.height*.5,0),N.halfWidth.applyMatrix4(o),N.halfHeight.applyMatrix4(o),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:a,setupView:l,state:r}}function wj(t){const e=new NTe(t),n=[],r=[];function i(d){c.camera=d,n.length=0,r.length=0}function s(d){n.push(d)}function o(d){r.push(d)}function a(){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:a,setupLightsView:l,pushLight:s,pushShadow:o}}function RTe(t){let e=new WeakMap;function n(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new wj(t),e.set(i,[a])):s>=o.length?(a=new wj(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}const kTe=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,PTe=`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 );
}`,DTe=[new ze(1,0,0),new ze(-1,0,0),new ze(0,1,0),new ze(0,-1,0),new ze(0,0,1),new ze(0,0,-1)],ITe=[new ze(0,-1,0),new ze(0,-1,0),new ze(0,0,1),new ze(0,0,-1),new ze(0,-1,0),new ze(0,-1,0)],Mj=new rr,l_=new ze,E6=new ze;function OTe(t,e,n){let r=new ky;const i=new jt,s=new jt,o=new di,a=new wE,l=new ME,c={},d=n.maxTextureSize,h={[mp]:Gl,[Gl]:mp,[Yc]:Yc},g=new au({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new jt},radius:{value:4}},vertexShader:kTe,fragmentShader:PTe}),v=g.clone();v.defines.HORIZONTAL_PASS=1;const b=new Sr;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=b1;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===I_&&(pn("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=b1);const O=t.getRenderTarget(),F=t.getActiveCubeFace(),U=t.getActiveMipmapLevel(),q=t.state;q.setBlending(nh),q.buffers.depth.getReversed()===!0?q.buffers.color.setClear(0,0,0,0):q.buffers.color.setClear(1,1,1,1),q.buffers.depth.setTest(!0),q.setScissorTest(!1);const B=S!==this.type;B&&L.traverse(function(Z){Z.material&&(Array.isArray(Z.material)?Z.material.forEach(G=>G.needsUpdate=!0):Z.material.needsUpdate=!0)});for(let Z=0,G=P.length;Z<G;Z++){const $=P[Z],K=$.shadow;if(K===void 0){pn("WebGLShadowMap:",$,"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 J=t.state.buffers.depth.getReversed();if(K.camera._reversedDepth=J,K.map===null||B===!0){if(K.map!==null&&(K.map.depthTexture!==null&&(K.map.depthTexture.dispose(),K.map.depthTexture=null),K.map.dispose()),this.type===Rg){if($.isPointLight){pn("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}K.map=new su(i.x,i.y,{format:cv,type:ah,minFilter:rs,magFilter:rs,generateMipmaps:!1}),K.map.texture.name=$.name+".shadowMap",K.map.depthTexture=new sy(i.x,i.y,Vl),K.map.depthTexture.name=$.name+".shadowMapDepth",K.map.depthTexture.format=lh,K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=Co,K.map.depthTexture.magFilter=Co}else $.isPointLight?(K.map=new R9(i.x),K.map.depthTexture=new _Y(i.x,Zu)):(K.map=new su(i.x,i.y),K.map.depthTexture=new sy(i.x,i.y,Zu)),K.map.depthTexture.name=$.name+".shadowMap",K.map.depthTexture.format=lh,this.type===b1?(K.map.depthTexture.compareFunction=J?tE:eE,K.map.depthTexture.minFilter=rs,K.map.depthTexture.magFilter=rs):(K.map.depthTexture.compareFunction=null,K.map.depthTexture.minFilter=Co,K.map.depthTexture.magFilter=Co);K.camera.updateProjectionMatrix()}const H=K.map.isWebGLCubeRenderTarget?6:1;for(let z=0;z<H;z++){if(K.map.isWebGLCubeRenderTarget)t.setRenderTarget(K.map,z),t.clear();else{z===0&&(t.setRenderTarget(K.map),t.clear());const X=K.getViewport(z);o.set(s.x*X.x,s.y*X.y,s.x*X.z,s.y*X.w),q.viewport(o)}if($.isPointLight){const X=K.camera,V=K.matrix,ie=$.distance||X.far;ie!==X.far&&(X.far=ie,X.updateProjectionMatrix()),l_.setFromMatrixPosition($.matrixWorld),X.position.copy(l_),E6.copy(X.position),E6.add(DTe[z]),X.up.copy(ITe[z]),X.lookAt(E6),X.updateMatrixWorld(),V.makeTranslation(-l_.x,-l_.y,-l_.z),Mj.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),K._frustum.setFromProjectionMatrix(Mj,X.coordinateSystem,X.reversedDepth)}else K.updateMatrices($);r=K.getFrustum(),N(L,R,K.camera,$,this.type)}K.isPointLightShadow!==!0&&this.type===Rg&&E(K,R),K.needsUpdate=!1}S=this.type,w.needsUpdate=!1,t.setRenderTarget(O,F,U)};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 su(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 F=null;const U=R.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(U!==void 0)F=U;else if(F=R.isPointLight===!0?l:a,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 q=F.uuid,B=L.uuid;let Z=c[q];Z===void 0&&(Z={},c[q]=Z);let G=Z[B];G===void 0&&(G=F.clone(),Z[B]=G,L.addEventListener("dispose",I)),F=G}if(F.visible=L.visible,F.wireframe=L.wireframe,O===Rg?F.side=L.shadowSide!==null?L.shadowSide:L.side:F.side=L.shadowSide!==null?L.shadowSide:h[L.side],F.alphaMap=L.alphaMap,F.alphaTest=L.alphaToCoverage===!0?.5:L.alphaTest,F.map=L.map,F.clipShadows=L.clipShadows,F.clippingPlanes=L.clippingPlanes,F.clipIntersection=L.clipIntersection,F.displacementMap=L.displacementMap,F.displacementScale=L.displacementScale,F.displacementBias=L.displacementBias,F.wireframeLinewidth=L.wireframeLinewidth,F.linewidth=L.linewidth,R.isPointLight===!0&&F.isMeshDistanceMaterial===!0){const q=t.properties.get(F);q.light=R}return F}function N(P,L,R,O,F){if(P.visible===!1)return;if(P.layers.test(L.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&F===Rg)&&(!P.frustumCulled||r.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,P.matrixWorld);const B=e.update(P),Z=P.material;if(Array.isArray(Z)){const G=B.groups;for(let $=0,K=G.length;$<K;$++){const Y=G[$],J=Z[Y.materialIndex];if(J&&J.visible){const H=A(P,J,O,F);P.onBeforeShadow(t,P,L,R,B,H,Y),t.renderBufferDirect(R,null,B,H,P,Y),P.onAfterShadow(t,P,L,R,B,H,Y)}}}else if(Z.visible){const G=A(P,Z,O,F);P.onBeforeShadow(t,P,L,R,B,G,null),t.renderBufferDirect(R,null,B,G,P,null),P.onAfterShadow(t,P,L,R,B,G,null)}}const q=P.children;for(let B=0,Z=q.length;B<Z;B++)N(q[B],L,R,O,F)}function I(P){P.target.removeEventListener("dispose",I);for(const R in c){const O=c[R],F=P.target.uuid;F in O&&(O[F].dispose(),delete O[F])}}}function LTe(t,e){function n(){let Ne=!1;const Ke=new di;let it=null;const ht=new di(0,0,0,0);return{setMask:function(Je){it!==Je&&!Ne&&(t.colorMask(Je,Je,Je,Je),it=Je)},setLocked:function(Je){Ne=Je},setClear:function(Je,$e,Ae,Oe,Ye){Ye===!0&&(Je*=Oe,$e*=Oe,Ae*=Oe),Ke.set(Je,$e,Ae,Oe),ht.equals(Ke)===!1&&(t.clearColor(Je,$e,Ae,Oe),ht.copy(Ke))},reset:function(){Ne=!1,it=null,ht.set(-1,0,0,0)}}}function r(){let Ne=!1,Ke=!1,it=null,ht=null,Je=null;return{setReversed:function($e){if(Ke!==$e){const Ae=e.get("EXT_clip_control");$e?Ae.clipControlEXT(Ae.LOWER_LEFT_EXT,Ae.ZERO_TO_ONE_EXT):Ae.clipControlEXT(Ae.LOWER_LEFT_EXT,Ae.NEGATIVE_ONE_TO_ONE_EXT),Ke=$e;const Oe=Je;Je=null,this.setClear(Oe)}},getReversed:function(){return Ke},setTest:function($e){$e?ce(t.DEPTH_TEST):oe(t.DEPTH_TEST)},setMask:function($e){it!==$e&&!Ne&&(t.depthMask($e),it=$e)},setFunc:function($e){if(Ke&&($e=aSe[$e]),ht!==$e){switch($e){case I2:t.depthFunc(t.NEVER);break;case O2:t.depthFunc(t.ALWAYS);break;case L2:t.depthFunc(t.LESS);break;case lv:t.depthFunc(t.LEQUAL);break;case z2:t.depthFunc(t.EQUAL);break;case j2:t.depthFunc(t.GEQUAL);break;case F2:t.depthFunc(t.GREATER);break;case U2:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}ht=$e}},setLocked:function($e){Ne=$e},setClear:function($e){Je!==$e&&(Je=$e,Ke&&($e=1-$e),t.clearDepth($e))},reset:function(){Ne=!1,it=null,ht=null,Je=null,Ke=!1}}}function i(){let Ne=!1,Ke=null,it=null,ht=null,Je=null,$e=null,Ae=null,Oe=null,Ye=null;return{setTest:function(st){Ne||(st?ce(t.STENCIL_TEST):oe(t.STENCIL_TEST))},setMask:function(st){Ke!==st&&!Ne&&(t.stencilMask(st),Ke=st)},setFunc:function(st,Rt,yt){(it!==st||ht!==Rt||Je!==yt)&&(t.stencilFunc(st,Rt,yt),it=st,ht=Rt,Je=yt)},setOp:function(st,Rt,yt){($e!==st||Ae!==Rt||Oe!==yt)&&(t.stencilOp(st,Rt,yt),$e=st,Ae=Rt,Oe=yt)},setLocked:function(st){Ne=st},setClear:function(st){Ye!==st&&(t.clearStencil(st),Ye=st)},reset:function(){Ne=!1,Ke=null,it=null,ht=null,Je=null,$e=null,Ae=null,Oe=null,Ye=null}}}const s=new n,o=new r,a=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,I=null,P=null,L=new yn(0,0,0),R=0,O=!1,F=null,U=null,q=null,B=null,Z=null;const G=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let $=!1,K=0;const Y=t.getParameter(t.VERSION);Y.indexOf("WebGL")!==-1?(K=parseFloat(/^WebGL (\d)/.exec(Y)[1]),$=K>=1):Y.indexOf("OpenGL ES")!==-1&&(K=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),$=K>=2);let J=null,H={};const z=t.getParameter(t.SCISSOR_BOX),X=t.getParameter(t.VIEWPORT),V=new di().fromArray(z),ie=new di().fromArray(X);function ae(Ne,Ke,it,ht){const Je=new Uint8Array(4),$e=t.createTexture();t.bindTexture(Ne,$e),t.texParameteri(Ne,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(Ne,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Ae=0;Ae<it;Ae++)Ne===t.TEXTURE_3D||Ne===t.TEXTURE_2D_ARRAY?t.texImage3D(Ke,0,t.RGBA,1,1,ht,0,t.RGBA,t.UNSIGNED_BYTE,Je):t.texImage2D(Ke+Ae,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,Je);return $e}const re={};re[t.TEXTURE_2D]=ae(t.TEXTURE_2D,t.TEXTURE_2D,1),re[t.TEXTURE_CUBE_MAP]=ae(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),re[t.TEXTURE_2D_ARRAY]=ae(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),re[t.TEXTURE_3D]=ae(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),ce(t.DEPTH_TEST),o.setFunc(lv),he(!1),Le(IR),ce(t.CULL_FACE),_e(nh);function ce(Ne){d[Ne]!==!0&&(t.enable(Ne),d[Ne]=!0)}function oe(Ne){d[Ne]!==!1&&(t.disable(Ne),d[Ne]=!1)}function fe(Ne,Ke){return h[Ne]!==Ke?(t.bindFramebuffer(Ne,Ke),h[Ne]=Ke,Ne===t.DRAW_FRAMEBUFFER&&(h[t.FRAMEBUFFER]=Ke),Ne===t.FRAMEBUFFER&&(h[t.DRAW_FRAMEBUFFER]=Ke),!0):!1}function me(Ne,Ke){let it=v,ht=!1;if(Ne){it=g.get(Ke),it===void 0&&(it=[],g.set(Ke,it));const Je=Ne.textures;if(it.length!==Je.length||it[0]!==t.COLOR_ATTACHMENT0){for(let $e=0,Ae=Je.length;$e<Ae;$e++)it[$e]=t.COLOR_ATTACHMENT0+$e;it.length=Je.length,ht=!0}}else it[0]!==t.BACK&&(it[0]=t.BACK,ht=!0);ht&&t.drawBuffers(it)}function ye(Ne){return b!==Ne?(t.useProgram(Ne),b=Ne,!0):!1}const Ee={[C0]:t.FUNC_ADD,[AX]:t.FUNC_SUBTRACT,[NX]:t.FUNC_REVERSE_SUBTRACT};Ee[RX]=t.MIN,Ee[kX]=t.MAX;const Ge={[PX]:t.ZERO,[DX]:t.ONE,[IX]:t.SRC_COLOR,[P2]:t.SRC_ALPHA,[UX]:t.SRC_ALPHA_SATURATE,[jX]:t.DST_COLOR,[LX]:t.DST_ALPHA,[OX]:t.ONE_MINUS_SRC_COLOR,[D2]:t.ONE_MINUS_SRC_ALPHA,[FX]:t.ONE_MINUS_DST_COLOR,[zX]:t.ONE_MINUS_DST_ALPHA,[BX]:t.CONSTANT_COLOR,[HX]:t.ONE_MINUS_CONSTANT_COLOR,[VX]:t.CONSTANT_ALPHA,[GX]:t.ONE_MINUS_CONSTANT_ALPHA};function _e(Ne,Ke,it,ht,Je,$e,Ae,Oe,Ye,st){if(Ne===nh){_===!0&&(oe(t.BLEND),_=!1);return}if(_===!1&&(ce(t.BLEND),_=!0),Ne!==CX){if(Ne!==w||st!==O){if((S!==C0||N!==C0)&&(t.blendEquation(t.FUNC_ADD),S=C0,N=C0),st)switch(Ne){case $g: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:Un("WebGLState: Invalid blending: ",Ne);break}else switch(Ne){case $g: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:Un("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case zR:Un("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Un("WebGLState: Invalid blending: ",Ne);break}E=null,A=null,I=null,P=null,L.set(0,0,0),R=0,w=Ne,O=st}return}Je=Je||Ke,$e=$e||it,Ae=Ae||ht,(Ke!==S||Je!==N)&&(t.blendEquationSeparate(Ee[Ke],Ee[Je]),S=Ke,N=Je),(it!==E||ht!==A||$e!==I||Ae!==P)&&(t.blendFuncSeparate(Ge[it],Ge[ht],Ge[$e],Ge[Ae]),E=it,A=ht,I=$e,P=Ae),(Oe.equals(L)===!1||Ye!==R)&&(t.blendColor(Oe.r,Oe.g,Oe.b,Ye),L.copy(Oe),R=Ye),w=Ne,O=!1}function De(Ne,Ke){Ne.side===Yc?oe(t.CULL_FACE):ce(t.CULL_FACE);let it=Ne.side===Gl;Ke&&(it=!it),he(it),Ne.blending===$g&&Ne.transparent===!1?_e(nh):_e(Ne.blending,Ne.blendEquation,Ne.blendSrc,Ne.blendDst,Ne.blendEquationAlpha,Ne.blendSrcAlpha,Ne.blendDstAlpha,Ne.blendColor,Ne.blendAlpha,Ne.premultipliedAlpha),o.setFunc(Ne.depthFunc),o.setTest(Ne.depthTest),o.setMask(Ne.depthWrite),s.setMask(Ne.colorWrite);const ht=Ne.stencilWrite;a.setTest(ht),ht&&(a.setMask(Ne.stencilWriteMask),a.setFunc(Ne.stencilFunc,Ne.stencilRef,Ne.stencilFuncMask),a.setOp(Ne.stencilFail,Ne.stencilZFail,Ne.stencilZPass)),We(Ne.polygonOffset,Ne.polygonOffsetFactor,Ne.polygonOffsetUnits),Ne.alphaToCoverage===!0?ce(t.SAMPLE_ALPHA_TO_COVERAGE):oe(t.SAMPLE_ALPHA_TO_COVERAGE)}function he(Ne){F!==Ne&&(Ne?t.frontFace(t.CW):t.frontFace(t.CCW),F=Ne)}function Le(Ne){Ne!==MX?(ce(t.CULL_FACE),Ne!==U&&(Ne===IR?t.cullFace(t.BACK):Ne===TX?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):oe(t.CULL_FACE),U=Ne}function ne(Ne){Ne!==q&&($&&t.lineWidth(Ne),q=Ne)}function We(Ne,Ke,it){Ne?(ce(t.POLYGON_OFFSET_FILL),(B!==Ke||Z!==it)&&(B=Ke,Z=it,o.getReversed()&&(Ke=-Ke),t.polygonOffset(Ke,it))):oe(t.POLYGON_OFFSET_FILL)}function je(Ne){Ne?ce(t.SCISSOR_TEST):oe(t.SCISSOR_TEST)}function be(Ne){Ne===void 0&&(Ne=t.TEXTURE0+G-1),J!==Ne&&(t.activeTexture(Ne),J=Ne)}function Xe(Ne,Ke,it){it===void 0&&(J===null?it=t.TEXTURE0+G-1:it=J);let ht=H[it];ht===void 0&&(ht={type:void 0,texture:void 0},H[it]=ht),(ht.type!==Ne||ht.texture!==Ke)&&(J!==it&&(t.activeTexture(it),J=it),t.bindTexture(Ne,Ke||re[Ne]),ht.type=Ne,ht.texture=Ke)}function le(){const Ne=H[J];Ne!==void 0&&Ne.type!==void 0&&(t.bindTexture(Ne.type,null),Ne.type=void 0,Ne.texture=void 0)}function te(){try{t.compressedTexImage2D(...arguments)}catch(Ne){Un("WebGLState:",Ne)}}function Se(){try{t.compressedTexImage3D(...arguments)}catch(Ne){Un("WebGLState:",Ne)}}function ve(){try{t.texSubImage2D(...arguments)}catch(Ne){Un("WebGLState:",Ne)}}function ge(){try{t.texSubImage3D(...arguments)}catch(Ne){Un("WebGLState:",Ne)}}function Te(){try{t.compressedTexSubImage2D(...arguments)}catch(Ne){Un("WebGLState:",Ne)}}function He(){try{t.compressedTexSubImage3D(...arguments)}catch(Ne){Un("WebGLState:",Ne)}}function pe(){try{t.texStorage2D(...arguments)}catch(Ne){Un("WebGLState:",Ne)}}function qe(){try{t.texStorage3D(...arguments)}catch(Ne){Un("WebGLState:",Ne)}}function xt(){try{t.texImage2D(...arguments)}catch(Ne){Un("WebGLState:",Ne)}}function nt(){try{t.texImage3D(...arguments)}catch(Ne){Un("WebGLState:",Ne)}}function tt(Ne){V.equals(Ne)===!1&&(t.scissor(Ne.x,Ne.y,Ne.z,Ne.w),V.copy(Ne))}function Fe(Ne){ie.equals(Ne)===!1&&(t.viewport(Ne.x,Ne.y,Ne.z,Ne.w),ie.copy(Ne))}function we(Ne,Ke){let it=c.get(Ke);it===void 0&&(it=new WeakMap,c.set(Ke,it));let ht=it.get(Ne);ht===void 0&&(ht=t.getUniformBlockIndex(Ke,Ne.name),it.set(Ne,ht))}function ke(Ne,Ke){const ht=c.get(Ke).get(Ne);l.get(Ke)!==ht&&(t.uniformBlockBinding(Ke,ht,Ne.__bindingPointIndex),l.set(Ke,ht))}function Ze(){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),o.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={},J=null,H={},h={},g=new WeakMap,v=[],b=null,_=!1,w=null,S=null,E=null,A=null,N=null,I=null,P=null,L=new yn(0,0,0),R=0,O=!1,F=null,U=null,q=null,B=null,Z=null,V.set(0,0,t.canvas.width,t.canvas.height),ie.set(0,0,t.canvas.width,t.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:ce,disable:oe,bindFramebuffer:fe,drawBuffers:me,useProgram:ye,setBlending:_e,setMaterial:De,setFlipSided:he,setCullFace:Le,setLineWidth:ne,setPolygonOffset:We,setScissorTest:je,activeTexture:be,bindTexture:Xe,unbindTexture:le,compressedTexImage2D:te,compressedTexImage3D:Se,texImage2D:xt,texImage3D:nt,updateUBOMapping:we,uniformBlockBinding:ke,texStorage2D:pe,texStorage3D:qe,texSubImage2D:ve,texSubImage3D:ge,compressedTexSubImage2D:Te,compressedTexSubImage3D:He,scissor:tt,viewport:Fe,reset:Ze}}function zTe(t,e,n,r,i,s,o){const a=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 jt,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(le,te){return v?new OffscreenCanvas(le,te):_S("canvas")}function _(le,te,Se){let ve=1;const ge=Xe(le);if((ge.width>Se||ge.height>Se)&&(ve=Se/Math.max(ge.width,ge.height)),ve<1)if(typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&le instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&le instanceof ImageBitmap||typeof VideoFrame<"u"&&le instanceof VideoFrame){const Te=Math.floor(ve*ge.width),He=Math.floor(ve*ge.height);h===void 0&&(h=b(Te,He));const pe=te?b(Te,He):h;return pe.width=Te,pe.height=He,pe.getContext("2d").drawImage(le,0,0,Te,He),pn("WebGLRenderer: Texture has been resized from ("+ge.width+"x"+ge.height+") to ("+Te+"x"+He+")."),pe}else return"data"in le&&pn("WebGLRenderer: Image in DataTexture is too big ("+ge.width+"x"+ge.height+")."),le;return le}function w(le){return le.generateMipmaps}function S(le){t.generateMipmap(le)}function E(le){return le.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:le.isWebGL3DRenderTarget?t.TEXTURE_3D:le.isWebGLArrayRenderTarget||le.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function A(le,te,Se,ve,ge=!1){if(le!==null){if(t[le]!==void 0)return t[le];pn("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+le+"'")}let Te=te;if(te===t.RED&&(Se===t.FLOAT&&(Te=t.R32F),Se===t.HALF_FLOAT&&(Te=t.R16F),Se===t.UNSIGNED_BYTE&&(Te=t.R8)),te===t.RED_INTEGER&&(Se===t.UNSIGNED_BYTE&&(Te=t.R8UI),Se===t.UNSIGNED_SHORT&&(Te=t.R16UI),Se===t.UNSIGNED_INT&&(Te=t.R32UI),Se===t.BYTE&&(Te=t.R8I),Se===t.SHORT&&(Te=t.R16I),Se===t.INT&&(Te=t.R32I)),te===t.RG&&(Se===t.FLOAT&&(Te=t.RG32F),Se===t.HALF_FLOAT&&(Te=t.RG16F),Se===t.UNSIGNED_BYTE&&(Te=t.RG8)),te===t.RG_INTEGER&&(Se===t.UNSIGNED_BYTE&&(Te=t.RG8UI),Se===t.UNSIGNED_SHORT&&(Te=t.RG16UI),Se===t.UNSIGNED_INT&&(Te=t.RG32UI),Se===t.BYTE&&(Te=t.RG8I),Se===t.SHORT&&(Te=t.RG16I),Se===t.INT&&(Te=t.RG32I)),te===t.RGB_INTEGER&&(Se===t.UNSIGNED_BYTE&&(Te=t.RGB8UI),Se===t.UNSIGNED_SHORT&&(Te=t.RGB16UI),Se===t.UNSIGNED_INT&&(Te=t.RGB32UI),Se===t.BYTE&&(Te=t.RGB8I),Se===t.SHORT&&(Te=t.RGB16I),Se===t.INT&&(Te=t.RGB32I)),te===t.RGBA_INTEGER&&(Se===t.UNSIGNED_BYTE&&(Te=t.RGBA8UI),Se===t.UNSIGNED_SHORT&&(Te=t.RGBA16UI),Se===t.UNSIGNED_INT&&(Te=t.RGBA32UI),Se===t.BYTE&&(Te=t.RGBA8I),Se===t.SHORT&&(Te=t.RGBA16I),Se===t.INT&&(Te=t.RGBA32I)),te===t.RGB&&(Se===t.UNSIGNED_INT_5_9_9_9_REV&&(Te=t.RGB9_E5),Se===t.UNSIGNED_INT_10F_11F_11F_REV&&(Te=t.R11F_G11F_B10F)),te===t.RGBA){const He=ge?yS:oi.getTransfer(ve);Se===t.FLOAT&&(Te=t.RGBA32F),Se===t.HALF_FLOAT&&(Te=t.RGBA16F),Se===t.UNSIGNED_BYTE&&(Te=He===Fi?t.SRGB8_ALPHA8:t.RGBA8),Se===t.UNSIGNED_SHORT_4_4_4_4&&(Te=t.RGBA4),Se===t.UNSIGNED_SHORT_5_5_5_1&&(Te=t.RGB5_A1)}return(Te===t.R16F||Te===t.R32F||Te===t.RG16F||Te===t.RG32F||Te===t.RGBA16F||Te===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Te}function N(le,te){let Se;return le?te===null||te===Zu||te===ny?Se=t.DEPTH24_STENCIL8:te===Vl?Se=t.DEPTH32F_STENCIL8:te===ty&&(Se=t.DEPTH24_STENCIL8,pn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):te===null||te===Zu||te===ny?Se=t.DEPTH_COMPONENT24:te===Vl?Se=t.DEPTH_COMPONENT32F:te===ty&&(Se=t.DEPTH_COMPONENT16),Se}function I(le,te){return w(le)===!0||le.isFramebufferTexture&&le.minFilter!==Co&&le.minFilter!==rs?Math.log2(Math.max(te.width,te.height))+1:le.mipmaps!==void 0&&le.mipmaps.length>0?le.mipmaps.length:le.isCompressedTexture&&Array.isArray(le.image)?te.mipmaps.length:1}function P(le){const te=le.target;te.removeEventListener("dispose",P),R(te),te.isVideoTexture&&d.delete(te)}function L(le){const te=le.target;te.removeEventListener("dispose",L),F(te)}function R(le){const te=r.get(le);if(te.__webglInit===void 0)return;const Se=le.source,ve=g.get(Se);if(ve){const ge=ve[te.__cacheKey];ge.usedTimes--,ge.usedTimes===0&&O(le),Object.keys(ve).length===0&&g.delete(Se)}r.remove(le)}function O(le){const te=r.get(le);t.deleteTexture(te.__webglTexture);const Se=le.source,ve=g.get(Se);delete ve[te.__cacheKey],o.memory.textures--}function F(le){const te=r.get(le);if(le.depthTexture&&(le.depthTexture.dispose(),r.remove(le.depthTexture)),le.isWebGLCubeRenderTarget)for(let ve=0;ve<6;ve++){if(Array.isArray(te.__webglFramebuffer[ve]))for(let ge=0;ge<te.__webglFramebuffer[ve].length;ge++)t.deleteFramebuffer(te.__webglFramebuffer[ve][ge]);else t.deleteFramebuffer(te.__webglFramebuffer[ve]);te.__webglDepthbuffer&&t.deleteRenderbuffer(te.__webglDepthbuffer[ve])}else{if(Array.isArray(te.__webglFramebuffer))for(let ve=0;ve<te.__webglFramebuffer.length;ve++)t.deleteFramebuffer(te.__webglFramebuffer[ve]);else t.deleteFramebuffer(te.__webglFramebuffer);if(te.__webglDepthbuffer&&t.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&t.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer)for(let ve=0;ve<te.__webglColorRenderbuffer.length;ve++)te.__webglColorRenderbuffer[ve]&&t.deleteRenderbuffer(te.__webglColorRenderbuffer[ve]);te.__webglDepthRenderbuffer&&t.deleteRenderbuffer(te.__webglDepthRenderbuffer)}const Se=le.textures;for(let ve=0,ge=Se.length;ve<ge;ve++){const Te=r.get(Se[ve]);Te.__webglTexture&&(t.deleteTexture(Te.__webglTexture),o.memory.textures--),r.remove(Se[ve])}r.remove(le)}let U=0;function q(){U=0}function B(){const le=U;return le>=i.maxTextures&&pn("WebGLTextures: Trying to use "+le+" texture units while this GPU supports only "+i.maxTextures),U+=1,le}function Z(le){const te=[];return te.push(le.wrapS),te.push(le.wrapT),te.push(le.wrapR||0),te.push(le.magFilter),te.push(le.minFilter),te.push(le.anisotropy),te.push(le.internalFormat),te.push(le.format),te.push(le.type),te.push(le.generateMipmaps),te.push(le.premultiplyAlpha),te.push(le.flipY),te.push(le.unpackAlignment),te.push(le.colorSpace),te.join()}function G(le,te){const Se=r.get(le);if(le.isVideoTexture&&je(le),le.isRenderTargetTexture===!1&&le.isExternalTexture!==!0&&le.version>0&&Se.__version!==le.version){const ve=le.image;if(ve===null)pn("WebGLRenderer: Texture marked for update but no image data found.");else if(ve.complete===!1)pn("WebGLRenderer: Texture marked for update but image is incomplete");else{re(Se,le,te);return}}else le.isExternalTexture&&(Se.__webglTexture=le.sourceTexture?le.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,Se.__webglTexture,t.TEXTURE0+te)}function $(le,te){const Se=r.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Se.__version!==le.version){re(Se,le,te);return}else le.isExternalTexture&&(Se.__webglTexture=le.sourceTexture?le.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,Se.__webglTexture,t.TEXTURE0+te)}function K(le,te){const Se=r.get(le);if(le.isRenderTargetTexture===!1&&le.version>0&&Se.__version!==le.version){re(Se,le,te);return}n.bindTexture(t.TEXTURE_3D,Se.__webglTexture,t.TEXTURE0+te)}function Y(le,te){const Se=r.get(le);if(le.isCubeDepthTexture!==!0&&le.version>0&&Se.__version!==le.version){ce(Se,le,te);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Se.__webglTexture,t.TEXTURE0+te)}const J={[mS]:t.REPEAT,[Tc]:t.CLAMP_TO_EDGE,[gS]:t.MIRRORED_REPEAT},H={[Co]:t.NEAREST,[$k]:t.NEAREST_MIPMAP_NEAREST,[r1]:t.NEAREST_MIPMAP_LINEAR,[rs]:t.LINEAR,[z_]:t.LINEAR_MIPMAP_NEAREST,[Zf]:t.LINEAR_MIPMAP_LINEAR},z={[eY]:t.NEVER,[sY]:t.ALWAYS,[tY]:t.LESS,[eE]:t.LEQUAL,[nY]:t.EQUAL,[tE]:t.GEQUAL,[rY]:t.GREATER,[iY]:t.NOTEQUAL};function X(le,te){if(te.type===Vl&&e.has("OES_texture_float_linear")===!1&&(te.magFilter===rs||te.magFilter===z_||te.magFilter===r1||te.magFilter===Zf||te.minFilter===rs||te.minFilter===z_||te.minFilter===r1||te.minFilter===Zf)&&pn("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(le,t.TEXTURE_WRAP_S,J[te.wrapS]),t.texParameteri(le,t.TEXTURE_WRAP_T,J[te.wrapT]),(le===t.TEXTURE_3D||le===t.TEXTURE_2D_ARRAY)&&t.texParameteri(le,t.TEXTURE_WRAP_R,J[te.wrapR]),t.texParameteri(le,t.TEXTURE_MAG_FILTER,H[te.magFilter]),t.texParameteri(le,t.TEXTURE_MIN_FILTER,H[te.minFilter]),te.compareFunction&&(t.texParameteri(le,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(le,t.TEXTURE_COMPARE_FUNC,z[te.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(te.magFilter===Co||te.minFilter!==r1&&te.minFilter!==Zf||te.type===Vl&&e.has("OES_texture_float_linear")===!1)return;if(te.anisotropy>1||r.get(te).__currentAnisotropy){const Se=e.get("EXT_texture_filter_anisotropic");t.texParameterf(le,Se.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(te.anisotropy,i.getMaxAnisotropy())),r.get(te).__currentAnisotropy=te.anisotropy}}}function V(le,te){let Se=!1;le.__webglInit===void 0&&(le.__webglInit=!0,te.addEventListener("dispose",P));const ve=te.source;let ge=g.get(ve);ge===void 0&&(ge={},g.set(ve,ge));const Te=Z(te);if(Te!==le.__cacheKey){ge[Te]===void 0&&(ge[Te]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,Se=!0),ge[Te].usedTimes++;const He=ge[le.__cacheKey];He!==void 0&&(ge[le.__cacheKey].usedTimes--,He.usedTimes===0&&O(te)),le.__cacheKey=Te,le.__webglTexture=ge[Te].texture}return Se}function ie(le,te,Se){return Math.floor(Math.floor(le/Se)/te)}function ae(le,te,Se,ve){const Te=le.updateRanges;if(Te.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,te.width,te.height,Se,ve,te.data);else{Te.sort((nt,tt)=>nt.start-tt.start);let He=0;for(let nt=1;nt<Te.length;nt++){const tt=Te[He],Fe=Te[nt],we=tt.start+tt.count,ke=ie(Fe.start,te.width,4),Ze=ie(tt.start,te.width,4);Fe.start<=we+1&&ke===Ze&&ie(Fe.start+Fe.count-1,te.width,4)===ke?tt.count=Math.max(tt.count,Fe.start+Fe.count-tt.start):(++He,Te[He]=Fe)}Te.length=He+1;const pe=t.getParameter(t.UNPACK_ROW_LENGTH),qe=t.getParameter(t.UNPACK_SKIP_PIXELS),xt=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,te.width);for(let nt=0,tt=Te.length;nt<tt;nt++){const Fe=Te[nt],we=Math.floor(Fe.start/4),ke=Math.ceil(Fe.count/4),Ze=we%te.width,Ne=Math.floor(we/te.width),Ke=ke,it=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,Ze),t.pixelStorei(t.UNPACK_SKIP_ROWS,Ne),n.texSubImage2D(t.TEXTURE_2D,0,Ze,Ne,Ke,it,Se,ve,te.data)}le.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,pe),t.pixelStorei(t.UNPACK_SKIP_PIXELS,qe),t.pixelStorei(t.UNPACK_SKIP_ROWS,xt)}}function re(le,te,Se){let ve=t.TEXTURE_2D;(te.isDataArrayTexture||te.isCompressedArrayTexture)&&(ve=t.TEXTURE_2D_ARRAY),te.isData3DTexture&&(ve=t.TEXTURE_3D);const ge=V(le,te),Te=te.source;n.bindTexture(ve,le.__webglTexture,t.TEXTURE0+Se);const He=r.get(Te);if(Te.version!==He.__version||ge===!0){n.activeTexture(t.TEXTURE0+Se);const pe=oi.getPrimaries(oi.workingColorSpace),qe=te.colorSpace===rp?null:oi.getPrimaries(te.colorSpace),xt=te.colorSpace===rp||pe===qe?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,xt);let nt=_(te.image,!1,i.maxTextureSize);nt=be(te,nt);const tt=s.convert(te.format,te.colorSpace),Fe=s.convert(te.type);let we=A(te.internalFormat,tt,Fe,te.colorSpace,te.isVideoTexture);X(ve,te);let ke;const Ze=te.mipmaps,Ne=te.isVideoTexture!==!0,Ke=He.__version===void 0||ge===!0,it=Te.dataReady,ht=I(te,nt);if(te.isDepthTexture)we=N(te.format===F0,te.type),Ke&&(Ne?n.texStorage2D(t.TEXTURE_2D,1,we,nt.width,nt.height):n.texImage2D(t.TEXTURE_2D,0,we,nt.width,nt.height,0,tt,Fe,null));else if(te.isDataTexture)if(Ze.length>0){Ne&&Ke&&n.texStorage2D(t.TEXTURE_2D,ht,we,Ze[0].width,Ze[0].height);for(let Je=0,$e=Ze.length;Je<$e;Je++)ke=Ze[Je],Ne?it&&n.texSubImage2D(t.TEXTURE_2D,Je,0,0,ke.width,ke.height,tt,Fe,ke.data):n.texImage2D(t.TEXTURE_2D,Je,we,ke.width,ke.height,0,tt,Fe,ke.data);te.generateMipmaps=!1}else Ne?(Ke&&n.texStorage2D(t.TEXTURE_2D,ht,we,nt.width,nt.height),it&&ae(te,nt,tt,Fe)):n.texImage2D(t.TEXTURE_2D,0,we,nt.width,nt.height,0,tt,Fe,nt.data);else if(te.isCompressedTexture)if(te.isCompressedArrayTexture){Ne&&Ke&&n.texStorage3D(t.TEXTURE_2D_ARRAY,ht,we,Ze[0].width,Ze[0].height,nt.depth);for(let Je=0,$e=Ze.length;Je<$e;Je++)if(ke=Ze[Je],te.format!==cl)if(tt!==null)if(Ne){if(it)if(te.layerUpdates.size>0){const Ae=YR(ke.width,ke.height,te.format,te.type);for(const Oe of te.layerUpdates){const Ye=ke.data.subarray(Oe*Ae/ke.data.BYTES_PER_ELEMENT,(Oe+1)*Ae/ke.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Je,0,0,Oe,ke.width,ke.height,1,tt,Ye)}te.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Je,0,0,0,ke.width,ke.height,nt.depth,tt,ke.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Je,we,ke.width,ke.height,nt.depth,0,ke.data,0,0);else pn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ne?it&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Je,0,0,0,ke.width,ke.height,nt.depth,tt,Fe,ke.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Je,we,ke.width,ke.height,nt.depth,0,tt,Fe,ke.data)}else{Ne&&Ke&&n.texStorage2D(t.TEXTURE_2D,ht,we,Ze[0].width,Ze[0].height);for(let Je=0,$e=Ze.length;Je<$e;Je++)ke=Ze[Je],te.format!==cl?tt!==null?Ne?it&&n.compressedTexSubImage2D(t.TEXTURE_2D,Je,0,0,ke.width,ke.height,tt,ke.data):n.compressedTexImage2D(t.TEXTURE_2D,Je,we,ke.width,ke.height,0,ke.data):pn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ne?it&&n.texSubImage2D(t.TEXTURE_2D,Je,0,0,ke.width,ke.height,tt,Fe,ke.data):n.texImage2D(t.TEXTURE_2D,Je,we,ke.width,ke.height,0,tt,Fe,ke.data)}else if(te.isDataArrayTexture)if(Ne){if(Ke&&n.texStorage3D(t.TEXTURE_2D_ARRAY,ht,we,nt.width,nt.height,nt.depth),it)if(te.layerUpdates.size>0){const Je=YR(nt.width,nt.height,te.format,te.type);for(const $e of te.layerUpdates){const Ae=nt.data.subarray($e*Je/nt.data.BYTES_PER_ELEMENT,($e+1)*Je/nt.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,$e,nt.width,nt.height,1,tt,Fe,Ae)}te.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,nt.width,nt.height,nt.depth,tt,Fe,nt.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,we,nt.width,nt.height,nt.depth,0,tt,Fe,nt.data);else if(te.isData3DTexture)Ne?(Ke&&n.texStorage3D(t.TEXTURE_3D,ht,we,nt.width,nt.height,nt.depth),it&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,nt.width,nt.height,nt.depth,tt,Fe,nt.data)):n.texImage3D(t.TEXTURE_3D,0,we,nt.width,nt.height,nt.depth,0,tt,Fe,nt.data);else if(te.isFramebufferTexture){if(Ke)if(Ne)n.texStorage2D(t.TEXTURE_2D,ht,we,nt.width,nt.height);else{let Je=nt.width,$e=nt.height;for(let Ae=0;Ae<ht;Ae++)n.texImage2D(t.TEXTURE_2D,Ae,we,Je,$e,0,tt,Fe,null),Je>>=1,$e>>=1}}else if(Ze.length>0){if(Ne&&Ke){const Je=Xe(Ze[0]);n.texStorage2D(t.TEXTURE_2D,ht,we,Je.width,Je.height)}for(let Je=0,$e=Ze.length;Je<$e;Je++)ke=Ze[Je],Ne?it&&n.texSubImage2D(t.TEXTURE_2D,Je,0,0,tt,Fe,ke):n.texImage2D(t.TEXTURE_2D,Je,we,tt,Fe,ke);te.generateMipmaps=!1}else if(Ne){if(Ke){const Je=Xe(nt);n.texStorage2D(t.TEXTURE_2D,ht,we,Je.width,Je.height)}it&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,tt,Fe,nt)}else n.texImage2D(t.TEXTURE_2D,0,we,tt,Fe,nt);w(te)&&S(ve),He.__version=Te.version,te.onUpdate&&te.onUpdate(te)}le.__version=te.version}function ce(le,te,Se){if(te.image.length!==6)return;const ve=V(le,te),ge=te.source;n.bindTexture(t.TEXTURE_CUBE_MAP,le.__webglTexture,t.TEXTURE0+Se);const Te=r.get(ge);if(ge.version!==Te.__version||ve===!0){n.activeTexture(t.TEXTURE0+Se);const He=oi.getPrimaries(oi.workingColorSpace),pe=te.colorSpace===rp?null:oi.getPrimaries(te.colorSpace),qe=te.colorSpace===rp||He===pe?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,qe);const xt=te.isCompressedTexture||te.image[0].isCompressedTexture,nt=te.image[0]&&te.image[0].isDataTexture,tt=[];for(let $e=0;$e<6;$e++)!xt&&!nt?tt[$e]=_(te.image[$e],!0,i.maxCubemapSize):tt[$e]=nt?te.image[$e].image:te.image[$e],tt[$e]=be(te,tt[$e]);const Fe=tt[0],we=s.convert(te.format,te.colorSpace),ke=s.convert(te.type),Ze=A(te.internalFormat,we,ke,te.colorSpace),Ne=te.isVideoTexture!==!0,Ke=Te.__version===void 0||ve===!0,it=ge.dataReady;let ht=I(te,Fe);X(t.TEXTURE_CUBE_MAP,te);let Je;if(xt){Ne&&Ke&&n.texStorage2D(t.TEXTURE_CUBE_MAP,ht,Ze,Fe.width,Fe.height);for(let $e=0;$e<6;$e++){Je=tt[$e].mipmaps;for(let Ae=0;Ae<Je.length;Ae++){const Oe=Je[Ae];te.format!==cl?we!==null?Ne?it&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,Ae,0,0,Oe.width,Oe.height,we,Oe.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,Ae,Ze,Oe.width,Oe.height,0,Oe.data):pn("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ne?it&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,Ae,0,0,Oe.width,Oe.height,we,ke,Oe.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,Ae,Ze,Oe.width,Oe.height,0,we,ke,Oe.data)}}}else{if(Je=te.mipmaps,Ne&&Ke){Je.length>0&&ht++;const $e=Xe(tt[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,ht,Ze,$e.width,$e.height)}for(let $e=0;$e<6;$e++)if(nt){Ne?it&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,0,0,0,tt[$e].width,tt[$e].height,we,ke,tt[$e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,0,Ze,tt[$e].width,tt[$e].height,0,we,ke,tt[$e].data);for(let Ae=0;Ae<Je.length;Ae++){const Ye=Je[Ae].image[$e].image;Ne?it&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,Ae+1,0,0,Ye.width,Ye.height,we,ke,Ye.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,Ae+1,Ze,Ye.width,Ye.height,0,we,ke,Ye.data)}}else{Ne?it&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,0,0,0,we,ke,tt[$e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,0,Ze,we,ke,tt[$e]);for(let Ae=0;Ae<Je.length;Ae++){const Oe=Je[Ae];Ne?it&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,Ae+1,0,0,we,ke,Oe.image[$e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+$e,Ae+1,Ze,we,ke,Oe.image[$e])}}}w(te)&&S(t.TEXTURE_CUBE_MAP),Te.__version=ge.version,te.onUpdate&&te.onUpdate(te)}le.__version=te.version}function oe(le,te,Se,ve,ge,Te){const He=s.convert(Se.format,Se.colorSpace),pe=s.convert(Se.type),qe=A(Se.internalFormat,He,pe,Se.colorSpace),xt=r.get(te),nt=r.get(Se);if(nt.__renderTarget=te,!xt.__hasExternalTextures){const tt=Math.max(1,te.width>>Te),Fe=Math.max(1,te.height>>Te);ge===t.TEXTURE_3D||ge===t.TEXTURE_2D_ARRAY?n.texImage3D(ge,Te,qe,tt,Fe,te.depth,0,He,pe,null):n.texImage2D(ge,Te,qe,tt,Fe,0,He,pe,null)}n.bindFramebuffer(t.FRAMEBUFFER,le),We(te)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ve,ge,nt.__webglTexture,0,ne(te)):(ge===t.TEXTURE_2D||ge>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&ge<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,ve,ge,nt.__webglTexture,Te),n.bindFramebuffer(t.FRAMEBUFFER,null)}function fe(le,te,Se){if(t.bindRenderbuffer(t.RENDERBUFFER,le),te.depthBuffer){const ve=te.depthTexture,ge=ve&&ve.isDepthTexture?ve.type:null,Te=N(te.stencilBuffer,ge),He=te.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;We(te)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ne(te),Te,te.width,te.height):Se?t.renderbufferStorageMultisample(t.RENDERBUFFER,ne(te),Te,te.width,te.height):t.renderbufferStorage(t.RENDERBUFFER,Te,te.width,te.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,He,t.RENDERBUFFER,le)}else{const ve=te.textures;for(let ge=0;ge<ve.length;ge++){const Te=ve[ge],He=s.convert(Te.format,Te.colorSpace),pe=s.convert(Te.type),qe=A(Te.internalFormat,He,pe,Te.colorSpace);We(te)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,ne(te),qe,te.width,te.height):Se?t.renderbufferStorageMultisample(t.RENDERBUFFER,ne(te),qe,te.width,te.height):t.renderbufferStorage(t.RENDERBUFFER,qe,te.width,te.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function me(le,te,Se){const ve=te.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(t.FRAMEBUFFER,le),!(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),ve){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 xt=s.convert(te.depthTexture.format),nt=s.convert(te.depthTexture.type);let tt;te.depthTexture.format===lh?tt=t.DEPTH_COMPONENT24:te.depthTexture.format===F0&&(tt=t.DEPTH24_STENCIL8);for(let Fe=0;Fe<6;Fe++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Fe,0,tt,te.width,te.height,0,xt,nt,null)}}else G(te.depthTexture,0);const Te=ge.__webglTexture,He=ne(te),pe=ve?t.TEXTURE_CUBE_MAP_POSITIVE_X+Se:t.TEXTURE_2D,qe=te.depthTexture.format===F0?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(te.depthTexture.format===lh)We(te)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,qe,pe,Te,0,He):t.framebufferTexture2D(t.FRAMEBUFFER,qe,pe,Te,0);else if(te.depthTexture.format===F0)We(te)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,qe,pe,Te,0,He):t.framebufferTexture2D(t.FRAMEBUFFER,qe,pe,Te,0);else throw new Error("Unknown depthTexture format")}function ye(le){const te=r.get(le),Se=le.isWebGLCubeRenderTarget===!0;if(te.__boundDepthTexture!==le.depthTexture){const ve=le.depthTexture;if(te.__depthDisposeCallback&&te.__depthDisposeCallback(),ve){const ge=()=>{delete te.__boundDepthTexture,delete te.__depthDisposeCallback,ve.removeEventListener("dispose",ge)};ve.addEventListener("dispose",ge),te.__depthDisposeCallback=ge}te.__boundDepthTexture=ve}if(le.depthTexture&&!te.__autoAllocateDepthBuffer)if(Se)for(let ve=0;ve<6;ve++)me(te.__webglFramebuffer[ve],le,ve);else{const ve=le.texture.mipmaps;ve&&ve.length>0?me(te.__webglFramebuffer[0],le,0):me(te.__webglFramebuffer,le,0)}else if(Se){te.__webglDepthbuffer=[];for(let ve=0;ve<6;ve++)if(n.bindFramebuffer(t.FRAMEBUFFER,te.__webglFramebuffer[ve]),te.__webglDepthbuffer[ve]===void 0)te.__webglDepthbuffer[ve]=t.createRenderbuffer(),fe(te.__webglDepthbuffer[ve],le,!1);else{const ge=le.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Te=te.__webglDepthbuffer[ve];t.bindRenderbuffer(t.RENDERBUFFER,Te),t.framebufferRenderbuffer(t.FRAMEBUFFER,ge,t.RENDERBUFFER,Te)}}else{const ve=le.texture.mipmaps;if(ve&&ve.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,le,!1);else{const ge=le.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Te=te.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,Te),t.framebufferRenderbuffer(t.FRAMEBUFFER,ge,t.RENDERBUFFER,Te)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Ee(le,te,Se){const ve=r.get(le);te!==void 0&&oe(ve.__webglFramebuffer,le,le.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Se!==void 0&&ye(le)}function Ge(le){const te=le.texture,Se=r.get(le),ve=r.get(te);le.addEventListener("dispose",L);const ge=le.textures,Te=le.isWebGLCubeRenderTarget===!0,He=ge.length>1;if(He||(ve.__webglTexture===void 0&&(ve.__webglTexture=t.createTexture()),ve.__version=te.version,o.memory.textures++),Te){Se.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(te.mipmaps&&te.mipmaps.length>0){Se.__webglFramebuffer[pe]=[];for(let qe=0;qe<te.mipmaps.length;qe++)Se.__webglFramebuffer[pe][qe]=t.createFramebuffer()}else Se.__webglFramebuffer[pe]=t.createFramebuffer()}else{if(te.mipmaps&&te.mipmaps.length>0){Se.__webglFramebuffer=[];for(let pe=0;pe<te.mipmaps.length;pe++)Se.__webglFramebuffer[pe]=t.createFramebuffer()}else Se.__webglFramebuffer=t.createFramebuffer();if(He)for(let pe=0,qe=ge.length;pe<qe;pe++){const xt=r.get(ge[pe]);xt.__webglTexture===void 0&&(xt.__webglTexture=t.createTexture(),o.memory.textures++)}if(le.samples>0&&We(le)===!1){Se.__webglMultisampledFramebuffer=t.createFramebuffer(),Se.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Se.__webglMultisampledFramebuffer);for(let pe=0;pe<ge.length;pe++){const qe=ge[pe];Se.__webglColorRenderbuffer[pe]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,Se.__webglColorRenderbuffer[pe]);const xt=s.convert(qe.format,qe.colorSpace),nt=s.convert(qe.type),tt=A(qe.internalFormat,xt,nt,qe.colorSpace,le.isXRRenderTarget===!0),Fe=ne(le);t.renderbufferStorageMultisample(t.RENDERBUFFER,Fe,tt,le.width,le.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+pe,t.RENDERBUFFER,Se.__webglColorRenderbuffer[pe])}t.bindRenderbuffer(t.RENDERBUFFER,null),le.depthBuffer&&(Se.__webglDepthRenderbuffer=t.createRenderbuffer(),fe(Se.__webglDepthRenderbuffer,le,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(Te){n.bindTexture(t.TEXTURE_CUBE_MAP,ve.__webglTexture),X(t.TEXTURE_CUBE_MAP,te);for(let pe=0;pe<6;pe++)if(te.mipmaps&&te.mipmaps.length>0)for(let qe=0;qe<te.mipmaps.length;qe++)oe(Se.__webglFramebuffer[pe][qe],le,te,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+pe,qe);else oe(Se.__webglFramebuffer[pe],le,te,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0);w(te)&&S(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(He){for(let pe=0,qe=ge.length;pe<qe;pe++){const xt=ge[pe],nt=r.get(xt);let tt=t.TEXTURE_2D;(le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(tt=le.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(tt,nt.__webglTexture),X(tt,xt),oe(Se.__webglFramebuffer,le,xt,t.COLOR_ATTACHMENT0+pe,tt,0),w(xt)&&S(tt)}n.unbindTexture()}else{let pe=t.TEXTURE_2D;if((le.isWebGL3DRenderTarget||le.isWebGLArrayRenderTarget)&&(pe=le.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(pe,ve.__webglTexture),X(pe,te),te.mipmaps&&te.mipmaps.length>0)for(let qe=0;qe<te.mipmaps.length;qe++)oe(Se.__webglFramebuffer[qe],le,te,t.COLOR_ATTACHMENT0,pe,qe);else oe(Se.__webglFramebuffer,le,te,t.COLOR_ATTACHMENT0,pe,0);w(te)&&S(pe),n.unbindTexture()}le.depthBuffer&&ye(le)}function _e(le){const te=le.textures;for(let Se=0,ve=te.length;Se<ve;Se++){const ge=te[Se];if(w(ge)){const Te=E(le),He=r.get(ge).__webglTexture;n.bindTexture(Te,He),S(Te),n.unbindTexture()}}}const De=[],he=[];function Le(le){if(le.samples>0){if(We(le)===!1){const te=le.textures,Se=le.width,ve=le.height;let ge=t.COLOR_BUFFER_BIT;const Te=le.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,He=r.get(le),pe=te.length>1;if(pe)for(let xt=0;xt<te.length;xt++)n.bindFramebuffer(t.FRAMEBUFFER,He.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+xt,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,He.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+xt,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,He.__webglMultisampledFramebuffer);const qe=le.texture.mipmaps;qe&&qe.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,He.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,He.__webglFramebuffer);for(let xt=0;xt<te.length;xt++){if(le.resolveDepthBuffer&&(le.depthBuffer&&(ge|=t.DEPTH_BUFFER_BIT),le.stencilBuffer&&le.resolveStencilBuffer&&(ge|=t.STENCIL_BUFFER_BIT)),pe){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,He.__webglColorRenderbuffer[xt]);const nt=r.get(te[xt]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,nt,0)}t.blitFramebuffer(0,0,Se,ve,0,0,Se,ve,ge,t.NEAREST),l===!0&&(De.length=0,he.length=0,De.push(t.COLOR_ATTACHMENT0+xt),le.depthBuffer&&le.resolveDepthBuffer===!1&&(De.push(Te),he.push(Te),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,he)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,De))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),pe)for(let xt=0;xt<te.length;xt++){n.bindFramebuffer(t.FRAMEBUFFER,He.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+xt,t.RENDERBUFFER,He.__webglColorRenderbuffer[xt]);const nt=r.get(te[xt]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,He.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+xt,t.TEXTURE_2D,nt,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,He.__webglMultisampledFramebuffer)}else if(le.depthBuffer&&le.resolveDepthBuffer===!1&&l){const te=le.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[te])}}}function ne(le){return Math.min(i.maxSamples,le.samples)}function We(le){const te=r.get(le);return le.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&te.__useRenderToTexture!==!1}function je(le){const te=o.render.frame;d.get(le)!==te&&(d.set(le,te),le.update())}function be(le,te){const Se=le.colorSpace,ve=le.format,ge=le.type;return le.isCompressedTexture===!0||le.isVideoTexture===!0||Se!==tm&&Se!==rp&&(oi.getTransfer(Se)===Fi?(ve!==cl||ge!==jl)&&pn("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Un("WebGLTextures: Unsupported texture color space:",Se)),te}function Xe(le){return typeof HTMLImageElement<"u"&&le instanceof HTMLImageElement?(c.width=le.naturalWidth||le.width,c.height=le.naturalHeight||le.height):typeof VideoFrame<"u"&&le instanceof VideoFrame?(c.width=le.displayWidth,c.height=le.displayHeight):(c.width=le.width,c.height=le.height),c}this.allocateTextureUnit=B,this.resetTextureUnits=q,this.setTexture2D=G,this.setTexture2DArray=$,this.setTexture3D=K,this.setTextureCube=Y,this.rebindTextures=Ee,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=_e,this.updateMultisampleRenderTarget=Le,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=We,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function mK(t,e){function n(r,i=rp){let s;const o=oi.getTransfer(i);if(r===jl)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===Yk)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===Kk)return t.UNSIGNED_INT_10F_11F_11F_REV;if(r===qk)return t.BYTE;if(r===Xk)return t.SHORT;if(r===ty)return t.UNSIGNED_SHORT;if(r===qT)return t.INT;if(r===Zu)return t.UNSIGNED_INT;if(r===Vl)return t.FLOAT;if(r===ah)return t.HALF_FLOAT;if(r===Zk)return t.ALPHA;if(r===Qk)return t.RGB;if(r===cl)return t.RGBA;if(r===lh)return t.DEPTH_COMPONENT;if(r===F0)return t.DEPTH_STENCIL;if(r===KT)return t.RED;if(r===Sw)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===j_||r===F_||r===U_||r===B_)if(o===Fi)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===j_)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===F_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===U_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===B_)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===j_)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===F_)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===U_)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===B_)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===B2||r===H2||r===V2||r===G2)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===B2)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===H2)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===V2)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===G2)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===W2||r===$2||r===q2||r===X2||r===Y2||r===K2||r===Z2)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===W2||r===$2)return o===Fi?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===q2)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(r===X2)return s.COMPRESSED_R11_EAC;if(r===Y2)return s.COMPRESSED_SIGNED_R11_EAC;if(r===K2)return s.COMPRESSED_RG11_EAC;if(r===Z2)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(r===Q2||r===J2||r===e5||r===t5||r===n5||r===r5||r===i5||r===s5||r===o5||r===a5||r===l5||r===c5||r===u5||r===d5)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===Q2)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===J2)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===e5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===t5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===n5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===r5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===i5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===s5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===o5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===a5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===l5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===c5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===u5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===d5)return o===Fi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===f5||r===h5||r===p5)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===f5)return o===Fi?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===h5)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===p5)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===m5||r===g5||r===v5||r===x5)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===m5)return s.COMPRESSED_RED_RGTC1_EXT;if(r===g5)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===v5)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===x5)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===ny?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}const jTe=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,FTe=`
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 UTe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const r=new l9(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:jTe,fragmentShader:FTe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Us(new wp(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class BTe extends gh{constructor(e,n){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,h=null,g=null,v=null,b=null;const _=typeof XRWebGLBinding<"u",w=new UTe,S={},E=n.getContextAttributes();let A=null,N=null;const I=[],P=[],L=new jt;let R=null;const O=new eo;O.viewport=new di;const F=new eo;F.viewport=new di;const U=[O,F],q=new tK;let B=null,Z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(re){let ce=I[re];return ce===void 0&&(ce=new VM,I[re]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(re){let ce=I[re];return ce===void 0&&(ce=new VM,I[re]=ce),ce.getGripSpace()},this.getHand=function(re){let ce=I[re];return ce===void 0&&(ce=new VM,I[re]=ce),ce.getHandSpace()};function G(re){const ce=P.indexOf(re.inputSource);if(ce===-1)return;const oe=I[ce];oe!==void 0&&(oe.update(re.inputSource,re.frame,c||o),oe.dispatchEvent({type:re.type,data:re.inputSource}))}function $(){i.removeEventListener("select",G),i.removeEventListener("selectstart",G),i.removeEventListener("selectend",G),i.removeEventListener("squeeze",G),i.removeEventListener("squeezestart",G),i.removeEventListener("squeezeend",G),i.removeEventListener("end",$),i.removeEventListener("inputsourceschange",K);for(let re=0;re<I.length;re++){const ce=P[re];ce!==null&&(P[re]=null,I[re].disconnect(ce))}B=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,ae.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&&pn("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(re){a=re,r.isPresenting===!0&&pn("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},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",G),i.addEventListener("selectstart",G),i.addEventListener("selectend",G),i.addEventListener("squeeze",G),i.addEventListener("squeezestart",G),i.addEventListener("squeezeend",G),i.addEventListener("end",$),i.addEventListener("inputsourceschange",K),E.xrCompatible!==!0&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(L),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let oe=null,fe=null,me=null;E.depth&&(me=E.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,oe=E.stencil?F0:lh,fe=E.stencil?ny:Zu);const ye={colorFormat:n.RGBA8,depthFormat:me,scaleFactor:s};h=this.getBinding(),g=h.createProjectionLayer(ye),i.updateRenderState({layers:[g]}),e.setPixelRatio(1),e.setSize(g.textureWidth,g.textureHeight,!1),N=new su(g.textureWidth,g.textureHeight,{format:cl,type:jl,depthTexture:new sy(g.textureWidth,g.textureHeight,fe,void 0,void 0,void 0,void 0,void 0,void 0,oe),stencilBuffer:E.stencil,colorSpace:e.outputColorSpace,samples:E.antialias?4:0,resolveDepthBuffer:g.ignoreDepthValues===!1,resolveStencilBuffer:g.ignoreDepthValues===!1})}else{const oe={antialias:E.antialias,alpha:!0,depth:E.depth,stencil:E.stencil,framebufferScaleFactor:s};v=new XRWebGLLayer(i,n,oe),i.updateRenderState({baseLayer:v}),e.setPixelRatio(1),e.setSize(v.framebufferWidth,v.framebufferHeight,!1),N=new su(v.framebufferWidth,v.framebufferHeight,{format:cl,type:jl,colorSpace:e.outputColorSpace,stencilBuffer:E.stencil,resolveDepthBuffer:v.ignoreDepthValues===!1,resolveStencilBuffer:v.ignoreDepthValues===!1})}N.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),ae.setContext(i),ae.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 ce=0;ce<re.removed.length;ce++){const oe=re.removed[ce],fe=P.indexOf(oe);fe>=0&&(P[fe]=null,I[fe].disconnect(oe))}for(let ce=0;ce<re.added.length;ce++){const oe=re.added[ce];let fe=P.indexOf(oe);if(fe===-1){for(let ye=0;ye<I.length;ye++)if(ye>=P.length){P.push(oe),fe=ye;break}else if(P[ye]===null){P[ye]=oe,fe=ye;break}if(fe===-1)break}const me=I[fe];me&&me.connect(oe)}}const Y=new ze,J=new ze;function H(re,ce,oe){Y.setFromMatrixPosition(ce.matrixWorld),J.setFromMatrixPosition(oe.matrixWorld);const fe=Y.distanceTo(J),me=ce.projectionMatrix.elements,ye=oe.projectionMatrix.elements,Ee=me[14]/(me[10]-1),Ge=me[14]/(me[10]+1),_e=(me[9]+1)/me[5],De=(me[9]-1)/me[5],he=(me[8]-1)/me[0],Le=(ye[8]+1)/ye[0],ne=Ee*he,We=Ee*Le,je=fe/(-he+Le),be=je*-he;if(ce.matrixWorld.decompose(re.position,re.quaternion,re.scale),re.translateX(be),re.translateZ(je),re.matrixWorld.compose(re.position,re.quaternion,re.scale),re.matrixWorldInverse.copy(re.matrixWorld).invert(),me[10]===-1)re.projectionMatrix.copy(ce.projectionMatrix),re.projectionMatrixInverse.copy(ce.projectionMatrixInverse);else{const Xe=Ee+je,le=Ge+je,te=ne-be,Se=We+(fe-be),ve=_e*Ge/le*Xe,ge=De*Ge/le*Xe;re.projectionMatrix.makePerspective(te,Se,ve,ge,Xe,le),re.projectionMatrixInverse.copy(re.projectionMatrix).invert()}}function z(re,ce){ce===null?re.matrixWorld.copy(re.matrix):re.matrixWorld.multiplyMatrices(ce.matrixWorld,re.matrix),re.matrixWorldInverse.copy(re.matrixWorld).invert()}this.updateCamera=function(re){if(i===null)return;let ce=re.near,oe=re.far;w.texture!==null&&(w.depthNear>0&&(ce=w.depthNear),w.depthFar>0&&(oe=w.depthFar)),q.near=F.near=O.near=ce,q.far=F.far=O.far=oe,(B!==q.near||Z!==q.far)&&(i.updateRenderState({depthNear:q.near,depthFar:q.far}),B=q.near,Z=q.far),q.layers.mask=re.layers.mask|6,O.layers.mask=q.layers.mask&-5,F.layers.mask=q.layers.mask&-3;const fe=re.parent,me=q.cameras;z(q,fe);for(let ye=0;ye<me.length;ye++)z(me[ye],fe);me.length===2?H(q,O,F):q.projectionMatrix.copy(O.projectionMatrix),X(re,q,fe)};function X(re,ce,oe){oe===null?re.matrix.copy(ce.matrixWorld):(re.matrix.copy(oe.matrixWorld),re.matrix.invert(),re.matrix.multiply(ce.matrixWorld)),re.matrix.decompose(re.position,re.quaternion,re.scale),re.updateMatrixWorld(!0),re.projectionMatrix.copy(ce.projectionMatrix),re.projectionMatrixInverse.copy(ce.projectionMatrixInverse),re.isPerspectiveCamera&&(re.fov=ry*2*Math.atan(1/re.projectionMatrix.elements[5]),re.zoom=1)}this.getCamera=function(){return q},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(q)},this.getCameraTexture=function(re){return S[re]};let V=null;function ie(re,ce){if(d=ce.getViewerPose(c||o),b=ce,d!==null){const oe=d.views;v!==null&&(e.setRenderTargetFramebuffer(N,v.framebuffer),e.setRenderTarget(N));let fe=!1;oe.length!==q.cameras.length&&(q.cameras.length=0,fe=!0);for(let Ge=0;Ge<oe.length;Ge++){const _e=oe[Ge];let De=null;if(v!==null)De=v.getViewport(_e);else{const Le=h.getViewSubImage(g,_e);De=Le.viewport,Ge===0&&(e.setRenderTargetTextures(N,Le.colorTexture,Le.depthStencilTexture),e.setRenderTarget(N))}let he=U[Ge];he===void 0&&(he=new eo,he.layers.enable(Ge),he.viewport=new di,U[Ge]=he),he.matrix.fromArray(_e.transform.matrix),he.matrix.decompose(he.position,he.quaternion,he.scale),he.projectionMatrix.fromArray(_e.projectionMatrix),he.projectionMatrixInverse.copy(he.projectionMatrix).invert(),he.viewport.set(De.x,De.y,De.width,De.height),Ge===0&&(q.matrix.copy(he.matrix),q.matrix.decompose(q.position,q.quaternion,q.scale)),fe===!0&&q.cameras.push(he)}const me=i.enabledFeatures;if(me&&me.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){h=r.getBinding();const Ge=h.getDepthInformation(oe[0]);Ge&&Ge.isValid&&Ge.texture&&w.init(Ge,i.renderState)}if(me&&me.includes("camera-access")&&_){e.state.unbindTexture(),h=r.getBinding();for(let Ge=0;Ge<oe.length;Ge++){const _e=oe[Ge].camera;if(_e){let De=S[_e];De||(De=new l9,S[_e]=De);const he=h.getCameraImage(_e);De.sourceTexture=he}}}}for(let oe=0;oe<I.length;oe++){const fe=P[oe],me=I[oe];fe!==null&&me!==void 0&&me.update(fe,ce,c||o)}V&&V(re,ce),ce.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:ce}),b=null}const ae=new uK;ae.setAnimationLoop(ie),this.setAnimationLoop=function(re){V=re},this.dispose=function(){}}}const yg=new ou,HTe=new rr;function VTe(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,PY(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?(o(w,S),S.isLineDashedMaterial&&a(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===Gl&&(w.bumpScale.value*=-1)),S.normalMap&&(w.normalMap.value=S.normalMap,n(S.normalMap,w.normalMapTransform),w.normalScale.value.copy(S.normalScale),S.side===Gl&&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,yg.copy(N),yg.x*=-1,yg.y*=-1,yg.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(yg.y*=-1,yg.z*=-1),w.envMapRotation.value.setFromMatrix4(HTe.makeRotationFromEuler(yg)),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 o(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 a(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===Gl&&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 GTe(t,e,n,r){let i={},s={},o=[];const a=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 I=A.program;r.updateUBOMapping(E,I);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(),I=E.__size,P=E.usage;return t.bindBuffer(t.UNIFORM_BUFFER,N),t.bufferData(t.UNIFORM_BUFFER,I,P),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,A,N),N}function h(){for(let E=0;E<a;E++)if(o.indexOf(E)===-1)return o.push(E),E;return Un("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function g(E){const A=i[E.id],N=E.uniforms,I=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,F=R.length;O<F;O++){const U=R[O];if(v(U,P,O,I)===!0){const q=U.__offset,B=Array.isArray(U.value)?U.value:[U.value];let Z=0;for(let G=0;G<B.length;G++){const $=B[G],K=_($);typeof $=="number"||typeof $=="boolean"?(U.__data[0]=$,t.bufferSubData(t.UNIFORM_BUFFER,q+Z,U.__data)):$.isMatrix3?(U.__data[0]=$.elements[0],U.__data[1]=$.elements[1],U.__data[2]=$.elements[2],U.__data[3]=0,U.__data[4]=$.elements[3],U.__data[5]=$.elements[4],U.__data[6]=$.elements[5],U.__data[7]=0,U.__data[8]=$.elements[6],U.__data[9]=$.elements[7],U.__data[10]=$.elements[8],U.__data[11]=0):($.toArray(U.__data,Z),Z+=K.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,q,U.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function v(E,A,N,I){const P=E.value,L=A+"_"+N;if(I[L]===void 0)return typeof P=="number"||typeof P=="boolean"?I[L]=P:I[L]=P.clone(),!0;{const R=I[L];if(typeof P=="number"||typeof P=="boolean"){if(R!==P)return I[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 I=16;for(let L=0,R=A.length;L<R;L++){const O=Array.isArray(A[L])?A[L]:[A[L]];for(let F=0,U=O.length;F<U;F++){const q=O[F],B=Array.isArray(q.value)?q.value:[q.value];for(let Z=0,G=B.length;Z<G;Z++){const $=B[Z],K=_($),Y=N%I,J=Y%K.boundary,H=Y+J;N+=J,H!==0&&I-H<K.storage&&(N+=I-H),q.__data=new Float32Array(K.storage/Float32Array.BYTES_PER_ELEMENT),q.__offset=N,N+=K.storage}}}const P=N%I;return P>0&&(N+=I-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?pn("WebGLRenderer: Texture samplers can not be part of an uniforms group."):pn("WebGLRenderer: Unsupported uniform value type.",E),A}function w(E){const A=E.target;A.removeEventListener("dispose",w);const N=o.indexOf(A.__bindingPointIndex);o.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]);o=[],i={},s={}}return{bind:l,update:c,dispose:S}}const WTe=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 $Te(){return Rf===null&&(Rf=new Hd(WTe,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 gK{constructor(e={}){const{canvas:n=aY(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:g=!1,outputBufferType:v=jl}=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=o;const _=v,w=new Set([QT,ZT,Sw]),S=new Set([jl,Zu,ty,ny,XT,YT]),E=new Uint32Array(4),A=new Int32Array(4);let N=null,I=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=ru,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const O=this;let F=!1;this._outputColorSpace=ll;let U=0,q=0,B=null,Z=-1,G=null;const $=new di,K=new di;let Y=null;const J=new yn(0);let H=0,z=n.width,X=n.height,V=1,ie=null,ae=null;const re=new di(0,0,z,X),ce=new di(0,0,z,X);let oe=!1;const fe=new ky;let me=!1,ye=!1;const Ee=new rr,Ge=new ze,_e=new di,De={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let he=!1;function Le(){return B===null?V:1}let ne=r;function We(xe,ot){return n.getContext(xe,ot)}try{const xe={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:h};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${bw}`),n.addEventListener("webglcontextlost",Ae,!1),n.addEventListener("webglcontextrestored",Oe,!1),n.addEventListener("webglcontextcreationerror",Ye,!1),ne===null){const ot="webgl2";if(ne=We(ot,xe),ne===null)throw We(ot)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(xe){throw Un("WebGLRenderer: "+xe.message),xe}let je,be,Xe,le,te,Se,ve,ge,Te,He,pe,qe,xt,nt,tt,Fe,we,ke,Ze,Ne,Ke,it,ht;function Je(){je=new X2e(ne),je.init(),Ke=new mK(ne,je),be=new U2e(ne,je,e,Ke),Xe=new LTe(ne,je),be.reversedDepthBuffer&&g&&Xe.buffers.depth.setReversed(!0),le=new Z2e(ne),te=new STe,Se=new zTe(ne,je,Xe,te,be,Ke,le),ve=new q2e(O),ge=new n4e(ne),it=new j2e(ne,ge),Te=new Y2e(ne,ge,le,it),He=new J2e(ne,Te,ge,it,le),ke=new Q2e(ne,be,Se),tt=new B2e(te),pe=new _Te(O,ve,je,be,it,tt),qe=new VTe(O,te),xt=new MTe,nt=new RTe(je),we=new z2e(O,ve,Xe,He,b,l),Fe=new OTe(O,He,be),ht=new GTe(ne,le,be,Xe),Ze=new F2e(ne,je,le),Ne=new K2e(ne,je,le),le.programs=pe.programs,O.capabilities=be,O.extensions=je,O.properties=te,O.renderLists=xt,O.shadowMap=Fe,O.state=Xe,O.info=le}Je(),_!==jl&&(R=new t5e(_,n.width,n.height,i,s));const $e=new BTe(O,ne);this.xr=$e,this.getContext=function(){return ne},this.getContextAttributes=function(){return ne.getContextAttributes()},this.forceContextLoss=function(){const xe=je.get("WEBGL_lose_context");xe&&xe.loseContext()},this.forceContextRestore=function(){const xe=je.get("WEBGL_lose_context");xe&&xe.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(xe){xe!==void 0&&(V=xe,this.setSize(z,X,!1))},this.getSize=function(xe){return xe.set(z,X)},this.setSize=function(xe,ot,bt=!0){if($e.isPresenting){pn("WebGLRenderer: Can't change size while VR device is presenting.");return}z=xe,X=ot,n.width=Math.floor(xe*V),n.height=Math.floor(ot*V),bt===!0&&(n.style.width=xe+"px",n.style.height=ot+"px"),R!==null&&R.setSize(n.width,n.height),this.setViewport(0,0,xe,ot)},this.getDrawingBufferSize=function(xe){return xe.set(z*V,X*V).floor()},this.setDrawingBufferSize=function(xe,ot,bt){z=xe,X=ot,V=bt,n.width=Math.floor(xe*bt),n.height=Math.floor(ot*bt),this.setViewport(0,0,xe,ot)},this.setEffects=function(xe){if(_===jl){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(xe){for(let ot=0;ot<xe.length;ot++)if(xe[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(xe||[])},this.getCurrentViewport=function(xe){return xe.copy($)},this.getViewport=function(xe){return xe.copy(re)},this.setViewport=function(xe,ot,bt,mt){xe.isVector4?re.set(xe.x,xe.y,xe.z,xe.w):re.set(xe,ot,bt,mt),Xe.viewport($.copy(re).multiplyScalar(V).round())},this.getScissor=function(xe){return xe.copy(ce)},this.setScissor=function(xe,ot,bt,mt){xe.isVector4?ce.set(xe.x,xe.y,xe.z,xe.w):ce.set(xe,ot,bt,mt),Xe.scissor(K.copy(ce).multiplyScalar(V).round())},this.getScissorTest=function(){return oe},this.setScissorTest=function(xe){Xe.setScissorTest(oe=xe)},this.setOpaqueSort=function(xe){ie=xe},this.setTransparentSort=function(xe){ae=xe},this.getClearColor=function(xe){return xe.copy(we.getClearColor())},this.setClearColor=function(){we.setClearColor(...arguments)},this.getClearAlpha=function(){return we.getClearAlpha()},this.setClearAlpha=function(){we.setClearAlpha(...arguments)},this.clear=function(xe=!0,ot=!0,bt=!0){let mt=0;if(xe){let pt=!1;if(B!==null){const $t=B.texture.format;pt=w.has($t)}if(pt){const $t=B.texture.type,Zt=S.has($t),en=we.getClearColor(),Jt=we.getClearAlpha(),Mn=en.r,jn=en.g,Gn=en.b;Zt?(E[0]=Mn,E[1]=jn,E[2]=Gn,E[3]=Jt,ne.clearBufferuiv(ne.COLOR,0,E)):(A[0]=Mn,A[1]=jn,A[2]=Gn,A[3]=Jt,ne.clearBufferiv(ne.COLOR,0,A))}else mt|=ne.COLOR_BUFFER_BIT}ot&&(mt|=ne.DEPTH_BUFFER_BIT),bt&&(mt|=ne.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),mt!==0&&ne.clear(mt)},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",Ae,!1),n.removeEventListener("webglcontextrestored",Oe,!1),n.removeEventListener("webglcontextcreationerror",Ye,!1),we.dispose(),xt.dispose(),nt.dispose(),te.dispose(),ve.dispose(),He.dispose(),it.dispose(),ht.dispose(),pe.dispose(),$e.dispose(),$e.removeEventListener("sessionstart",Ue),$e.removeEventListener("sessionend",ct),St.stop()};function Ae(xe){xe.preventDefault(),SS("WebGLRenderer: Context Lost."),F=!0}function Oe(){SS("WebGLRenderer: Context Restored."),F=!1;const xe=le.autoReset,ot=Fe.enabled,bt=Fe.autoUpdate,mt=Fe.needsUpdate,pt=Fe.type;Je(),le.autoReset=xe,Fe.enabled=ot,Fe.autoUpdate=bt,Fe.needsUpdate=mt,Fe.type=pt}function Ye(xe){Un("WebGLRenderer: A WebGL context could not be created. Reason: ",xe.statusMessage)}function st(xe){const ot=xe.target;ot.removeEventListener("dispose",st),Rt(ot)}function Rt(xe){yt(xe),te.remove(xe)}function yt(xe){const ot=te.get(xe).programs;ot!==void 0&&(ot.forEach(function(bt){pe.releaseProgram(bt)}),xe.isShaderMaterial&&pe.releaseShaderCache(xe))}this.renderBufferDirect=function(xe,ot,bt,mt,pt,$t){ot===null&&(ot=De);const Zt=pt.isMesh&&pt.matrixWorld.determinant()<0,en=Xn(xe,ot,bt,mt,pt);Xe.setMaterial(mt,Zt);let Jt=bt.index,Mn=1;if(mt.wireframe===!0){if(Jt=Te.getWireframeAttribute(bt),Jt===void 0)return;Mn=2}const jn=bt.drawRange,Gn=bt.attributes.position;let ln=jn.start*Mn,sr=(jn.start+jn.count)*Mn;$t!==null&&(ln=Math.max(ln,$t.start*Mn),sr=Math.min(sr,($t.start+$t.count)*Mn)),Jt!==null?(ln=Math.max(ln,0),sr=Math.min(sr,Jt.count)):Gn!=null&&(ln=Math.max(ln,0),sr=Math.min(sr,Gn.count));const Yr=sr-ln;if(Yr<0||Yr===1/0)return;it.setup(pt,mt,en,bt,Jt);let ti,dr=Ze;if(Jt!==null&&(ti=ge.get(Jt),dr=Ne,dr.setIndex(ti)),pt.isMesh)mt.wireframe===!0?(Xe.setLineWidth(mt.wireframeLinewidth*Le()),dr.setMode(ne.LINES)):dr.setMode(ne.TRIANGLES);else if(pt.isLine){let kr=mt.linewidth;kr===void 0&&(kr=1),Xe.setLineWidth(kr*Le()),pt.isLineSegments?dr.setMode(ne.LINES):pt.isLineLoop?dr.setMode(ne.LINE_LOOP):dr.setMode(ne.LINE_STRIP)}else pt.isPoints?dr.setMode(ne.POINTS):pt.isSprite&&dr.setMode(ne.TRIANGLES);if(pt.isBatchedMesh)if(pt._multiDrawInstances!==null)wS("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),dr.renderMultiDrawInstances(pt._multiDrawStarts,pt._multiDrawCounts,pt._multiDrawCount,pt._multiDrawInstances);else if(je.get("WEBGL_multi_draw"))dr.renderMultiDraw(pt._multiDrawStarts,pt._multiDrawCounts,pt._multiDrawCount);else{const kr=pt._multiDrawStarts,rn=pt._multiDrawCounts,ss=pt._multiDrawCount,Nn=Jt?ge.get(Jt).bytesPerElement:1,gs=te.get(mt).currentProgram.getUniforms();for(let Rs=0;Rs<ss;Rs++)gs.setValue(ne,"_gl_DrawID",Rs),dr.render(kr[Rs]/Nn,rn[Rs])}else if(pt.isInstancedMesh)dr.renderInstances(ln,Yr,pt.count);else if(bt.isInstancedBufferGeometry){const kr=bt._maxInstanceCount!==void 0?bt._maxInstanceCount:1/0,rn=Math.min(bt.instanceCount,kr);dr.renderInstances(ln,Yr,rn)}else dr.render(ln,Yr)};function Tt(xe,ot,bt){xe.transparent===!0&&xe.side===Yc&&xe.forceSinglePass===!1?(xe.side=Gl,xe.needsUpdate=!0,on(xe,ot,bt),xe.side=mp,xe.needsUpdate=!0,on(xe,ot,bt),xe.side=Yc):on(xe,ot,bt)}this.compile=function(xe,ot,bt=null){bt===null&&(bt=xe),I=nt.get(bt),I.init(ot),L.push(I),bt.traverseVisible(function(pt){pt.isLight&&pt.layers.test(ot.layers)&&(I.pushLight(pt),pt.castShadow&&I.pushShadow(pt))}),xe!==bt&&xe.traverseVisible(function(pt){pt.isLight&&pt.layers.test(ot.layers)&&(I.pushLight(pt),pt.castShadow&&I.pushShadow(pt))}),I.setupLights();const mt=new Set;return xe.traverse(function(pt){if(!(pt.isMesh||pt.isPoints||pt.isLine||pt.isSprite))return;const $t=pt.material;if($t)if(Array.isArray($t))for(let Zt=0;Zt<$t.length;Zt++){const en=$t[Zt];Tt(en,bt,pt),mt.add(en)}else Tt($t,bt,pt),mt.add($t)}),I=L.pop(),mt},this.compileAsync=function(xe,ot,bt=null){const mt=this.compile(xe,ot,bt);return new Promise(pt=>{function $t(){if(mt.forEach(function(Zt){te.get(Zt).currentProgram.isReady()&&mt.delete(Zt)}),mt.size===0){pt(xe);return}setTimeout($t,10)}je.get("KHR_parallel_shader_compile")!==null?$t():setTimeout($t,10)})};let Et=null;function Dt(xe){Et&&Et(xe)}function Ue(){St.stop()}function ct(){St.start()}const St=new uK;St.setAnimationLoop(Dt),typeof self<"u"&&St.setContext(self),this.setAnimationLoop=function(xe){Et=xe,$e.setAnimationLoop(xe),xe===null?St.stop():St.start()},$e.addEventListener("sessionstart",Ue),$e.addEventListener("sessionend",ct),this.render=function(xe,ot){if(ot!==void 0&&ot.isCamera!==!0){Un("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;const bt=$e.enabled===!0&&$e.isPresenting===!0,mt=R!==null&&(B===null||bt)&&R.begin(O,B);if(xe.matrixWorldAutoUpdate===!0&&xe.updateMatrixWorld(),ot.parent===null&&ot.matrixWorldAutoUpdate===!0&&ot.updateMatrixWorld(),$e.enabled===!0&&$e.isPresenting===!0&&(R===null||R.isCompositing()===!1)&&($e.cameraAutoUpdate===!0&&$e.updateCamera(ot),ot=$e.getCamera()),xe.isScene===!0&&xe.onBeforeRender(O,xe,ot,B),I=nt.get(xe,L.length),I.init(ot),L.push(I),Ee.multiplyMatrices(ot.projectionMatrix,ot.matrixWorldInverse),fe.setFromProjectionMatrix(Ee,Qc,ot.reversedDepth),ye=this.localClippingEnabled,me=tt.init(this.clippingPlanes,ye),N=xt.get(xe,P.length),N.init(),P.push(N),$e.enabled===!0&&$e.isPresenting===!0){const Zt=O.xr.getDepthSensingMesh();Zt!==null&&kt(Zt,ot,-1/0,O.sortObjects)}kt(xe,ot,0,O.sortObjects),N.finish(),O.sortObjects===!0&&N.sort(ie,ae),he=$e.enabled===!1||$e.isPresenting===!1||$e.hasDepthSensing()===!1,he&&we.addToRenderList(N,xe),this.info.render.frame++,me===!0&&tt.beginShadows();const pt=I.state.shadowsArray;if(Fe.render(pt,xe,ot),me===!0&&tt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(mt&&R.hasRenderPass())===!1){const Zt=N.opaque,en=N.transmissive;if(I.setupLights(),ot.isArrayCamera){const Jt=ot.cameras;if(en.length>0)for(let Mn=0,jn=Jt.length;Mn<jn;Mn++){const Gn=Jt[Mn];Xt(Zt,en,xe,Gn)}he&&we.render(xe);for(let Mn=0,jn=Jt.length;Mn<jn;Mn++){const Gn=Jt[Mn];Ut(N,xe,Gn,Gn.viewport)}}else en.length>0&&Xt(Zt,en,xe,ot),he&&we.render(xe),Ut(N,xe,ot)}B!==null&&q===0&&(Se.updateMultisampleRenderTarget(B),Se.updateRenderTargetMipmap(B)),mt&&R.end(O),xe.isScene===!0&&xe.onAfterRender(O,xe,ot),it.resetDefaultState(),Z=-1,G=null,L.pop(),L.length>0?(I=L[L.length-1],me===!0&&tt.setGlobalState(O.clippingPlanes,I.state.camera)):I=null,P.pop(),P.length>0?N=P[P.length-1]:N=null};function kt(xe,ot,bt,mt){if(xe.visible===!1)return;if(xe.layers.test(ot.layers)){if(xe.isGroup)bt=xe.renderOrder;else if(xe.isLOD)xe.autoUpdate===!0&&xe.update(ot);else if(xe.isLight)I.pushLight(xe),xe.castShadow&&I.pushShadow(xe);else if(xe.isSprite){if(!xe.frustumCulled||fe.intersectsSprite(xe)){mt&&_e.setFromMatrixPosition(xe.matrixWorld).applyMatrix4(Ee);const Zt=He.update(xe),en=xe.material;en.visible&&N.push(xe,Zt,en,bt,_e.z,null)}}else if((xe.isMesh||xe.isLine||xe.isPoints)&&(!xe.frustumCulled||fe.intersectsObject(xe))){const Zt=He.update(xe),en=xe.material;if(mt&&(xe.boundingSphere!==void 0?(xe.boundingSphere===null&&xe.computeBoundingSphere(),_e.copy(xe.boundingSphere.center)):(Zt.boundingSphere===null&&Zt.computeBoundingSphere(),_e.copy(Zt.boundingSphere.center)),_e.applyMatrix4(xe.matrixWorld).applyMatrix4(Ee)),Array.isArray(en)){const Jt=Zt.groups;for(let Mn=0,jn=Jt.length;Mn<jn;Mn++){const Gn=Jt[Mn],ln=en[Gn.materialIndex];ln&&ln.visible&&N.push(xe,Zt,ln,bt,_e.z,Gn)}}else en.visible&&N.push(xe,Zt,en,bt,_e.z,null)}}const $t=xe.children;for(let Zt=0,en=$t.length;Zt<en;Zt++)kt($t[Zt],ot,bt,mt)}function Ut(xe,ot,bt,mt){const{opaque:pt,transmissive:$t,transparent:Zt}=xe;I.setupLightsView(bt),me===!0&&tt.setGlobalState(O.clippingPlanes,bt),mt&&Xe.viewport($.copy(mt)),pt.length>0&&hn(pt,ot,bt),$t.length>0&&hn($t,ot,bt),Zt.length>0&&hn(Zt,ot,bt),Xe.buffers.depth.setTest(!0),Xe.buffers.depth.setMask(!0),Xe.buffers.color.setMask(!0),Xe.setPolygonOffset(!1)}function Xt(xe,ot,bt,mt){if((bt.isScene===!0?bt.overrideMaterial:null)!==null)return;if(I.state.transmissionRenderTarget[mt.id]===void 0){const ln=je.has("EXT_color_buffer_half_float")||je.has("EXT_color_buffer_float");I.state.transmissionRenderTarget[mt.id]=new su(1,1,{generateMipmaps:!0,type:ln?ah:jl,minFilter:Zf,samples:be.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:oi.workingColorSpace})}const $t=I.state.transmissionRenderTarget[mt.id],Zt=mt.viewport||$;$t.setSize(Zt.z*O.transmissionResolutionScale,Zt.w*O.transmissionResolutionScale);const en=O.getRenderTarget(),Jt=O.getActiveCubeFace(),Mn=O.getActiveMipmapLevel();O.setRenderTarget($t),O.getClearColor(J),H=O.getClearAlpha(),H<1&&O.setClearColor(16777215,.5),O.clear(),he&&we.render(bt);const jn=O.toneMapping;O.toneMapping=ru;const Gn=mt.viewport;if(mt.viewport!==void 0&&(mt.viewport=void 0),I.setupLightsView(mt),me===!0&&tt.setGlobalState(O.clippingPlanes,mt),hn(xe,bt,mt),Se.updateMultisampleRenderTarget($t),Se.updateRenderTargetMipmap($t),je.has("WEBGL_multisampled_render_to_texture")===!1){let ln=!1;for(let sr=0,Yr=ot.length;sr<Yr;sr++){const ti=ot[sr],{object:dr,geometry:kr,material:rn,group:ss}=ti;if(rn.side===Yc&&dr.layers.test(mt.layers)){const Nn=rn.side;rn.side=Gl,rn.needsUpdate=!0,Lt(dr,bt,mt,kr,rn,ss),rn.side=Nn,rn.needsUpdate=!0,ln=!0}}ln===!0&&(Se.updateMultisampleRenderTarget($t),Se.updateRenderTargetMipmap($t))}O.setRenderTarget(en,Jt,Mn),O.setClearColor(J,H),Gn!==void 0&&(mt.viewport=Gn),O.toneMapping=jn}function hn(xe,ot,bt){const mt=ot.isScene===!0?ot.overrideMaterial:null;for(let pt=0,$t=xe.length;pt<$t;pt++){const Zt=xe[pt],{object:en,geometry:Jt,group:Mn}=Zt;let jn=Zt.material;jn.allowOverride===!0&&mt!==null&&(jn=mt),en.layers.test(bt.layers)&&Lt(en,ot,bt,Jt,jn,Mn)}}function Lt(xe,ot,bt,mt,pt,$t){xe.onBeforeRender(O,ot,bt,mt,pt,$t),xe.modelViewMatrix.multiplyMatrices(bt.matrixWorldInverse,xe.matrixWorld),xe.normalMatrix.getNormalMatrix(xe.modelViewMatrix),pt.onBeforeRender(O,ot,bt,mt,xe,$t),pt.transparent===!0&&pt.side===Yc&&pt.forceSinglePass===!1?(pt.side=Gl,pt.needsUpdate=!0,O.renderBufferDirect(bt,ot,mt,pt,xe,$t),pt.side=mp,pt.needsUpdate=!0,O.renderBufferDirect(bt,ot,mt,pt,xe,$t),pt.side=Yc):O.renderBufferDirect(bt,ot,mt,pt,xe,$t),xe.onAfterRender(O,ot,bt,mt,pt,$t)}function on(xe,ot,bt){ot.isScene!==!0&&(ot=De);const mt=te.get(xe),pt=I.state.lights,$t=I.state.shadowsArray,Zt=pt.state.version,en=pe.getParameters(xe,pt.state,$t,ot,bt),Jt=pe.getProgramCacheKey(en);let Mn=mt.programs;mt.environment=xe.isMeshStandardMaterial||xe.isMeshLambertMaterial||xe.isMeshPhongMaterial?ot.environment:null,mt.fog=ot.fog;const jn=xe.isMeshStandardMaterial||xe.isMeshLambertMaterial&&!xe.envMap||xe.isMeshPhongMaterial&&!xe.envMap;mt.envMap=ve.get(xe.envMap||mt.environment,jn),mt.envMapRotation=mt.environment!==null&&xe.envMap===null?ot.environmentRotation:xe.envMapRotation,Mn===void 0&&(xe.addEventListener("dispose",st),Mn=new Map,mt.programs=Mn);let Gn=Mn.get(Jt);if(Gn!==void 0){if(mt.currentProgram===Gn&&mt.lightsStateVersion===Zt)return kn(xe,en),Gn}else en.uniforms=pe.getUniforms(xe),xe.onBeforeCompile(en,O),Gn=pe.acquireProgram(en,Jt),Mn.set(Jt,Gn),mt.uniforms=en.uniforms;const ln=mt.uniforms;return(!xe.isShaderMaterial&&!xe.isRawShaderMaterial||xe.clipping===!0)&&(ln.clippingPlanes=tt.uniform),kn(xe,en),mt.needsLights=Qn(xe),mt.lightsStateVersion=Zt,mt.needsLights&&(ln.ambientLightColor.value=pt.state.ambient,ln.lightProbe.value=pt.state.probe,ln.directionalLights.value=pt.state.directional,ln.directionalLightShadows.value=pt.state.directionalShadow,ln.spotLights.value=pt.state.spot,ln.spotLightShadows.value=pt.state.spotShadow,ln.rectAreaLights.value=pt.state.rectArea,ln.ltc_1.value=pt.state.rectAreaLTC1,ln.ltc_2.value=pt.state.rectAreaLTC2,ln.pointLights.value=pt.state.point,ln.pointLightShadows.value=pt.state.pointShadow,ln.hemisphereLights.value=pt.state.hemi,ln.directionalShadowMatrix.value=pt.state.directionalShadowMatrix,ln.spotLightMatrix.value=pt.state.spotLightMatrix,ln.spotLightMap.value=pt.state.spotLightMap,ln.pointShadowMatrix.value=pt.state.pointShadowMatrix),mt.currentProgram=Gn,mt.uniformsList=null,Gn}function Ht(xe){if(xe.uniformsList===null){const ot=xe.currentProgram.getUniforms();xe.uniformsList=GM.seqWithValue(ot.seq,xe.uniforms)}return xe.uniformsList}function kn(xe,ot){const bt=te.get(xe);bt.outputColorSpace=ot.outputColorSpace,bt.batching=ot.batching,bt.batchingColor=ot.batchingColor,bt.instancing=ot.instancing,bt.instancingColor=ot.instancingColor,bt.instancingMorph=ot.instancingMorph,bt.skinning=ot.skinning,bt.morphTargets=ot.morphTargets,bt.morphNormals=ot.morphNormals,bt.morphColors=ot.morphColors,bt.morphTargetsCount=ot.morphTargetsCount,bt.numClippingPlanes=ot.numClippingPlanes,bt.numIntersection=ot.numClipIntersection,bt.vertexAlphas=ot.vertexAlphas,bt.vertexTangents=ot.vertexTangents,bt.toneMapping=ot.toneMapping}function Xn(xe,ot,bt,mt,pt){ot.isScene!==!0&&(ot=De),Se.resetTextureUnits();const $t=ot.fog,Zt=mt.isMeshStandardMaterial||mt.isMeshLambertMaterial||mt.isMeshPhongMaterial?ot.environment:null,en=B===null?O.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:tm,Jt=mt.isMeshStandardMaterial||mt.isMeshLambertMaterial&&!mt.envMap||mt.isMeshPhongMaterial&&!mt.envMap,Mn=ve.get(mt.envMap||Zt,Jt),jn=mt.vertexColors===!0&&!!bt.attributes.color&&bt.attributes.color.itemSize===4,Gn=!!bt.attributes.tangent&&(!!mt.normalMap||mt.anisotropy>0),ln=!!bt.morphAttributes.position,sr=!!bt.morphAttributes.normal,Yr=!!bt.morphAttributes.color;let ti=ru;mt.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(ti=O.toneMapping);const dr=bt.morphAttributes.position||bt.morphAttributes.normal||bt.morphAttributes.color,kr=dr!==void 0?dr.length:0,rn=te.get(mt),ss=I.state.lights;if(me===!0&&(ye===!0||xe!==G)){const Ii=xe===G&&mt.id===Z;tt.setState(mt,xe,Ii)}let Nn=!1;mt.version===rn.__version?(rn.needsLights&&rn.lightsStateVersion!==ss.state.version||rn.outputColorSpace!==en||pt.isBatchedMesh&&rn.batching===!1||!pt.isBatchedMesh&&rn.batching===!0||pt.isBatchedMesh&&rn.batchingColor===!0&&pt.colorTexture===null||pt.isBatchedMesh&&rn.batchingColor===!1&&pt.colorTexture!==null||pt.isInstancedMesh&&rn.instancing===!1||!pt.isInstancedMesh&&rn.instancing===!0||pt.isSkinnedMesh&&rn.skinning===!1||!pt.isSkinnedMesh&&rn.skinning===!0||pt.isInstancedMesh&&rn.instancingColor===!0&&pt.instanceColor===null||pt.isInstancedMesh&&rn.instancingColor===!1&&pt.instanceColor!==null||pt.isInstancedMesh&&rn.instancingMorph===!0&&pt.morphTexture===null||pt.isInstancedMesh&&rn.instancingMorph===!1&&pt.morphTexture!==null||rn.envMap!==Mn||mt.fog===!0&&rn.fog!==$t||rn.numClippingPlanes!==void 0&&(rn.numClippingPlanes!==tt.numPlanes||rn.numIntersection!==tt.numIntersection)||rn.vertexAlphas!==jn||rn.vertexTangents!==Gn||rn.morphTargets!==ln||rn.morphNormals!==sr||rn.morphColors!==Yr||rn.toneMapping!==ti||rn.morphTargetsCount!==kr)&&(Nn=!0):(Nn=!0,rn.__version=mt.version);let gs=rn.currentProgram;Nn===!0&&(gs=on(mt,ot,pt));let Rs=!1,Di=!1,vs=!1;const gr=gs.getUniforms(),fi=rn.uniforms;if(Xe.useProgram(gs.program)&&(Rs=!0,Di=!0,vs=!0),mt.id!==Z&&(Z=mt.id,Di=!0),Rs||G!==xe){Xe.buffers.depth.getReversed()&&xe.reversedDepth!==!0&&(xe._reversedDepth=!0,xe.updateProjectionMatrix()),gr.setValue(ne,"projectionMatrix",xe.projectionMatrix),gr.setValue(ne,"viewMatrix",xe.matrixWorldInverse);const qo=gr.map.cameraPosition;qo!==void 0&&qo.setValue(ne,Ge.setFromMatrixPosition(xe.matrixWorld)),be.logarithmicDepthBuffer&&gr.setValue(ne,"logDepthBufFC",2/(Math.log(xe.far+1)/Math.LN2)),(mt.isMeshPhongMaterial||mt.isMeshToonMaterial||mt.isMeshLambertMaterial||mt.isMeshBasicMaterial||mt.isMeshStandardMaterial||mt.isShaderMaterial)&&gr.setValue(ne,"isOrthographic",xe.isOrthographicCamera===!0),G!==xe&&(G=xe,Di=!0,vs=!0)}if(rn.needsLights&&(ss.state.directionalShadowMap.length>0&&gr.setValue(ne,"directionalShadowMap",ss.state.directionalShadowMap,Se),ss.state.spotShadowMap.length>0&&gr.setValue(ne,"spotShadowMap",ss.state.spotShadowMap,Se),ss.state.pointShadowMap.length>0&&gr.setValue(ne,"pointShadowMap",ss.state.pointShadowMap,Se)),pt.isSkinnedMesh){gr.setOptional(ne,pt,"bindMatrix"),gr.setOptional(ne,pt,"bindMatrixInverse");const Ii=pt.skeleton;Ii&&(Ii.boneTexture===null&&Ii.computeBoneTexture(),gr.setValue(ne,"boneTexture",Ii.boneTexture,Se))}pt.isBatchedMesh&&(gr.setOptional(ne,pt,"batchingTexture"),gr.setValue(ne,"batchingTexture",pt._matricesTexture,Se),gr.setOptional(ne,pt,"batchingIdTexture"),gr.setValue(ne,"batchingIdTexture",pt._indirectTexture,Se),gr.setOptional(ne,pt,"batchingColorTexture"),pt._colorsTexture!==null&&gr.setValue(ne,"batchingColorTexture",pt._colorsTexture,Se));const ks=bt.morphAttributes;if((ks.position!==void 0||ks.normal!==void 0||ks.color!==void 0)&&ke.update(pt,bt,gs),(Di||rn.receiveShadow!==pt.receiveShadow)&&(rn.receiveShadow=pt.receiveShadow,gr.setValue(ne,"receiveShadow",pt.receiveShadow)),(mt.isMeshStandardMaterial||mt.isMeshLambertMaterial||mt.isMeshPhongMaterial)&&mt.envMap===null&&ot.environment!==null&&(fi.envMapIntensity.value=ot.environmentIntensity),fi.dfgLUT!==void 0&&(fi.dfgLUT.value=$Te()),Di&&(gr.setValue(ne,"toneMappingExposure",O.toneMappingExposure),rn.needsLights&&zn(fi,vs),$t&&mt.fog===!0&&qe.refreshFogUniforms(fi,$t),qe.refreshMaterialUniforms(fi,mt,V,X,I.state.transmissionRenderTarget[xe.id]),GM.upload(ne,Ht(rn),fi,Se)),mt.isShaderMaterial&&mt.uniformsNeedUpdate===!0&&(GM.upload(ne,Ht(rn),fi,Se),mt.uniformsNeedUpdate=!1),mt.isSpriteMaterial&&gr.setValue(ne,"center",pt.center),gr.setValue(ne,"modelViewMatrix",pt.modelViewMatrix),gr.setValue(ne,"normalMatrix",pt.normalMatrix),gr.setValue(ne,"modelMatrix",pt.matrixWorld),mt.isShaderMaterial||mt.isRawShaderMaterial){const Ii=mt.uniformsGroups;for(let qo=0,ua=Ii.length;qo<ua;qo++){const wa=Ii[qo];ht.update(wa,gs),ht.bind(wa,gs)}}return gs}function zn(xe,ot){xe.ambientLightColor.needsUpdate=ot,xe.lightProbe.needsUpdate=ot,xe.directionalLights.needsUpdate=ot,xe.directionalLightShadows.needsUpdate=ot,xe.pointLights.needsUpdate=ot,xe.pointLightShadows.needsUpdate=ot,xe.spotLights.needsUpdate=ot,xe.spotLightShadows.needsUpdate=ot,xe.rectAreaLights.needsUpdate=ot,xe.hemisphereLights.needsUpdate=ot}function Qn(xe){return xe.isMeshLambertMaterial||xe.isMeshToonMaterial||xe.isMeshPhongMaterial||xe.isMeshStandardMaterial||xe.isShadowMaterial||xe.isShaderMaterial&&xe.lights===!0}this.getActiveCubeFace=function(){return U},this.getActiveMipmapLevel=function(){return q},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(xe,ot,bt){const mt=te.get(xe);mt.__autoAllocateDepthBuffer=xe.resolveDepthBuffer===!1,mt.__autoAllocateDepthBuffer===!1&&(mt.__useRenderToTexture=!1),te.get(xe.texture).__webglTexture=ot,te.get(xe.depthTexture).__webglTexture=mt.__autoAllocateDepthBuffer?void 0:bt,mt.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(xe,ot){const bt=te.get(xe);bt.__webglFramebuffer=ot,bt.__useDefaultFramebuffer=ot===void 0};const Pn=ne.createFramebuffer();this.setRenderTarget=function(xe,ot=0,bt=0){B=xe,U=ot,q=bt;let mt=null,pt=!1,$t=!1;if(xe){const en=te.get(xe);if(en.__useDefaultFramebuffer!==void 0){Xe.bindFramebuffer(ne.FRAMEBUFFER,en.__webglFramebuffer),$.copy(xe.viewport),K.copy(xe.scissor),Y=xe.scissorTest,Xe.viewport($),Xe.scissor(K),Xe.setScissorTest(Y),Z=-1;return}else if(en.__webglFramebuffer===void 0)Se.setupRenderTarget(xe);else if(en.__hasExternalTextures)Se.rebindTextures(xe,te.get(xe.texture).__webglTexture,te.get(xe.depthTexture).__webglTexture);else if(xe.depthBuffer){const jn=xe.depthTexture;if(en.__boundDepthTexture!==jn){if(jn!==null&&te.has(jn)&&(xe.width!==jn.image.width||xe.height!==jn.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Se.setupDepthRenderbuffer(xe)}}const Jt=xe.texture;(Jt.isData3DTexture||Jt.isDataArrayTexture||Jt.isCompressedArrayTexture)&&($t=!0);const Mn=te.get(xe).__webglFramebuffer;xe.isWebGLCubeRenderTarget?(Array.isArray(Mn[ot])?mt=Mn[ot][bt]:mt=Mn[ot],pt=!0):xe.samples>0&&Se.useMultisampledRTT(xe)===!1?mt=te.get(xe).__webglMultisampledFramebuffer:Array.isArray(Mn)?mt=Mn[bt]:mt=Mn,$.copy(xe.viewport),K.copy(xe.scissor),Y=xe.scissorTest}else $.copy(re).multiplyScalar(V).floor(),K.copy(ce).multiplyScalar(V).floor(),Y=oe;if(bt!==0&&(mt=Pn),Xe.bindFramebuffer(ne.FRAMEBUFFER,mt)&&Xe.drawBuffers(xe,mt),Xe.viewport($),Xe.scissor(K),Xe.setScissorTest(Y),pt){const en=te.get(xe.texture);ne.framebufferTexture2D(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_CUBE_MAP_POSITIVE_X+ot,en.__webglTexture,bt)}else if($t){const en=ot;for(let Jt=0;Jt<xe.textures.length;Jt++){const Mn=te.get(xe.textures[Jt]);ne.framebufferTextureLayer(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0+Jt,Mn.__webglTexture,bt,en)}}else if(xe!==null&&bt!==0){const en=te.get(xe.texture);ne.framebufferTexture2D(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_2D,en.__webglTexture,bt)}Z=-1},this.readRenderTargetPixels=function(xe,ot,bt,mt,pt,$t,Zt,en=0){if(!(xe&&xe.isWebGLRenderTarget)){Un("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Jt=te.get(xe).__webglFramebuffer;if(xe.isWebGLCubeRenderTarget&&Zt!==void 0&&(Jt=Jt[Zt]),Jt){Xe.bindFramebuffer(ne.FRAMEBUFFER,Jt);try{const Mn=xe.textures[en],jn=Mn.format,Gn=Mn.type;if(xe.textures.length>1&&ne.readBuffer(ne.COLOR_ATTACHMENT0+en),!be.textureFormatReadable(jn)){Un("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!be.textureTypeReadable(Gn)){Un("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ot>=0&&ot<=xe.width-mt&&bt>=0&&bt<=xe.height-pt&&ne.readPixels(ot,bt,mt,pt,Ke.convert(jn),Ke.convert(Gn),$t)}finally{const Mn=B!==null?te.get(B).__webglFramebuffer:null;Xe.bindFramebuffer(ne.FRAMEBUFFER,Mn)}}},this.readRenderTargetPixelsAsync=async function(xe,ot,bt,mt,pt,$t,Zt,en=0){if(!(xe&&xe.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Jt=te.get(xe).__webglFramebuffer;if(xe.isWebGLCubeRenderTarget&&Zt!==void 0&&(Jt=Jt[Zt]),Jt)if(ot>=0&&ot<=xe.width-mt&&bt>=0&&bt<=xe.height-pt){Xe.bindFramebuffer(ne.FRAMEBUFFER,Jt);const Mn=xe.textures[en],jn=Mn.format,Gn=Mn.type;if(xe.textures.length>1&&ne.readBuffer(ne.COLOR_ATTACHMENT0+en),!be.textureFormatReadable(jn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!be.textureTypeReadable(Gn))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const ln=ne.createBuffer();ne.bindBuffer(ne.PIXEL_PACK_BUFFER,ln),ne.bufferData(ne.PIXEL_PACK_BUFFER,$t.byteLength,ne.STREAM_READ),ne.readPixels(ot,bt,mt,pt,Ke.convert(jn),Ke.convert(Gn),0);const sr=B!==null?te.get(B).__webglFramebuffer:null;Xe.bindFramebuffer(ne.FRAMEBUFFER,sr);const Yr=ne.fenceSync(ne.SYNC_GPU_COMMANDS_COMPLETE,0);return ne.flush(),await oSe(ne,Yr,4),ne.bindBuffer(ne.PIXEL_PACK_BUFFER,ln),ne.getBufferSubData(ne.PIXEL_PACK_BUFFER,0,$t),ne.deleteBuffer(ln),ne.deleteSync(Yr),$t}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(xe,ot=null,bt=0){const mt=Math.pow(2,-bt),pt=Math.floor(xe.image.width*mt),$t=Math.floor(xe.image.height*mt),Zt=ot!==null?ot.x:0,en=ot!==null?ot.y:0;Se.setTexture2D(xe,0),ne.copyTexSubImage2D(ne.TEXTURE_2D,bt,0,0,Zt,en,pt,$t),Xe.unbindTexture()};const lr=ne.createFramebuffer(),ir=ne.createFramebuffer();this.copyTextureToTexture=function(xe,ot,bt=null,mt=null,pt=0,$t=0){let Zt,en,Jt,Mn,jn,Gn,ln,sr,Yr;const ti=xe.isCompressedTexture?xe.mipmaps[$t]:xe.image;if(bt!==null)Zt=bt.max.x-bt.min.x,en=bt.max.y-bt.min.y,Jt=bt.isBox3?bt.max.z-bt.min.z:1,Mn=bt.min.x,jn=bt.min.y,Gn=bt.isBox3?bt.min.z:0;else{const fi=Math.pow(2,-pt);Zt=Math.floor(ti.width*fi),en=Math.floor(ti.height*fi),xe.isDataArrayTexture?Jt=ti.depth:xe.isData3DTexture?Jt=Math.floor(ti.depth*fi):Jt=1,Mn=0,jn=0,Gn=0}mt!==null?(ln=mt.x,sr=mt.y,Yr=mt.z):(ln=0,sr=0,Yr=0);const dr=Ke.convert(ot.format),kr=Ke.convert(ot.type);let rn;ot.isData3DTexture?(Se.setTexture3D(ot,0),rn=ne.TEXTURE_3D):ot.isDataArrayTexture||ot.isCompressedArrayTexture?(Se.setTexture2DArray(ot,0),rn=ne.TEXTURE_2D_ARRAY):(Se.setTexture2D(ot,0),rn=ne.TEXTURE_2D),ne.pixelStorei(ne.UNPACK_FLIP_Y_WEBGL,ot.flipY),ne.pixelStorei(ne.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ot.premultiplyAlpha),ne.pixelStorei(ne.UNPACK_ALIGNMENT,ot.unpackAlignment);const ss=ne.getParameter(ne.UNPACK_ROW_LENGTH),Nn=ne.getParameter(ne.UNPACK_IMAGE_HEIGHT),gs=ne.getParameter(ne.UNPACK_SKIP_PIXELS),Rs=ne.getParameter(ne.UNPACK_SKIP_ROWS),Di=ne.getParameter(ne.UNPACK_SKIP_IMAGES);ne.pixelStorei(ne.UNPACK_ROW_LENGTH,ti.width),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,ti.height),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,Mn),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,jn),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,Gn);const vs=xe.isDataArrayTexture||xe.isData3DTexture,gr=ot.isDataArrayTexture||ot.isData3DTexture;if(xe.isDepthTexture){const fi=te.get(xe),ks=te.get(ot),Ii=te.get(fi.__renderTarget),qo=te.get(ks.__renderTarget);Xe.bindFramebuffer(ne.READ_FRAMEBUFFER,Ii.__webglFramebuffer),Xe.bindFramebuffer(ne.DRAW_FRAMEBUFFER,qo.__webglFramebuffer);for(let ua=0;ua<Jt;ua++)vs&&(ne.framebufferTextureLayer(ne.READ_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,te.get(xe).__webglTexture,pt,Gn+ua),ne.framebufferTextureLayer(ne.DRAW_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,te.get(ot).__webglTexture,$t,Yr+ua)),ne.blitFramebuffer(Mn,jn,Zt,en,ln,sr,Zt,en,ne.DEPTH_BUFFER_BIT,ne.NEAREST);Xe.bindFramebuffer(ne.READ_FRAMEBUFFER,null),Xe.bindFramebuffer(ne.DRAW_FRAMEBUFFER,null)}else if(pt!==0||xe.isRenderTargetTexture||te.has(xe)){const fi=te.get(xe),ks=te.get(ot);Xe.bindFramebuffer(ne.READ_FRAMEBUFFER,lr),Xe.bindFramebuffer(ne.DRAW_FRAMEBUFFER,ir);for(let Ii=0;Ii<Jt;Ii++)vs?ne.framebufferTextureLayer(ne.READ_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,fi.__webglTexture,pt,Gn+Ii):ne.framebufferTexture2D(ne.READ_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_2D,fi.__webglTexture,pt),gr?ne.framebufferTextureLayer(ne.DRAW_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ks.__webglTexture,$t,Yr+Ii):ne.framebufferTexture2D(ne.DRAW_FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_2D,ks.__webglTexture,$t),pt!==0?ne.blitFramebuffer(Mn,jn,Zt,en,ln,sr,Zt,en,ne.COLOR_BUFFER_BIT,ne.NEAREST):gr?ne.copyTexSubImage3D(rn,$t,ln,sr,Yr+Ii,Mn,jn,Zt,en):ne.copyTexSubImage2D(rn,$t,ln,sr,Mn,jn,Zt,en);Xe.bindFramebuffer(ne.READ_FRAMEBUFFER,null),Xe.bindFramebuffer(ne.DRAW_FRAMEBUFFER,null)}else gr?xe.isDataTexture||xe.isData3DTexture?ne.texSubImage3D(rn,$t,ln,sr,Yr,Zt,en,Jt,dr,kr,ti.data):ot.isCompressedArrayTexture?ne.compressedTexSubImage3D(rn,$t,ln,sr,Yr,Zt,en,Jt,dr,ti.data):ne.texSubImage3D(rn,$t,ln,sr,Yr,Zt,en,Jt,dr,kr,ti):xe.isDataTexture?ne.texSubImage2D(ne.TEXTURE_2D,$t,ln,sr,Zt,en,dr,kr,ti.data):xe.isCompressedTexture?ne.compressedTexSubImage2D(ne.TEXTURE_2D,$t,ln,sr,ti.width,ti.height,dr,ti.data):ne.texSubImage2D(ne.TEXTURE_2D,$t,ln,sr,Zt,en,dr,kr,ti);ne.pixelStorei(ne.UNPACK_ROW_LENGTH,ss),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,Nn),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,gs),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,Rs),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,Di),$t===0&&ot.generateMipmaps&&ne.generateMipmap(rn),Xe.unbindTexture()},this.initRenderTarget=function(xe){te.get(xe).__webglFramebuffer===void 0&&Se.setupRenderTarget(xe)},this.initTexture=function(xe){xe.isCubeTexture?Se.setTextureCube(xe,0):xe.isData3DTexture?Se.setTexture3D(xe,0):xe.isDataArrayTexture||xe.isCompressedArrayTexture?Se.setTexture2DArray(xe,0):Se.setTexture2D(xe,0),Xe.unbindTexture()},this.resetState=function(){U=0,q=0,B=null,Xe.reset(),it.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Qc}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=oi._getDrawingBufferColorSpace(e),n.unpackColorSpace=oi._getUnpackColorSpace()}}const qTe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:WT,AddEquation:C0,AddOperation:$X,AdditiveAnimationBlendMode:Jk,AdditiveBlending:OR,AgXToneMapping:Gk,AlphaFormat:Zk,AlwaysCompare:sY,AlwaysDepth:O2,AlwaysStencilFunc:UR,AmbientLight:KY,AnimationAction:sK,AnimationClip:RS,AnimationLoader:Kwe,AnimationMixer:E3e,AnimationObjectGroup:M3e,AnimationUtils:$we,ArcCurve:SY,ArrayCamera:tK,ArrowHelper:q3e,AttachedBindMode:jR,Audio:rK,AudioAnalyser:p3e,AudioContext:T9,AudioListener:d3e,AudioLoader:a3e,AxesHelper:X3e,BackSide:Gl,BasicDepthPacking:ZX,BasicShadowMap:EX,BatchedMesh:vY,BezierInterpolant:VY,Bone:o9,BooleanKeyframeTrack:Cv,Box2:P3e,Box3:Ao,Box3Helper:W3e,BoxGeometry:Ev,BoxHelper:G3e,BufferAttribute:Vi,BufferGeometry:Sr,BufferGeometryLoader:JY,ByteType:qk,Cache:Qf,Camera:TE,CameraHelper:V3e,CanvasTexture:fwe,CapsuleGeometry:uE,CatmullRomCurve3:wY,CineonToneMapping:Hk,CircleGeometry:dE,ClampToEdgeWrapping:Tc,Clock:aK,Color:yn,ColorKeyframeTrack:_9,ColorManagement:oi,Compatibility:tSe,CompressedArrayTexture:uwe,CompressedCubeTexture:dwe,CompressedTexture:cE,CompressedTextureLoader:Zwe,ConeGeometry:Tw,ConstantAlphaFactor:VX,ConstantColorFactor:BX,Controls:K3e,CubeCamera:eK,CubeDepthTexture:_Y,CubeReflectionMapping:oh,CubeRefractionMapping:em,CubeTexture:ww,CubeTextureLoader:Qwe,CubeUVReflectionMapping:Ry,CubicBezierCurve:d9,CubicBezierCurve3:MY,CubicInterpolant:BY,CullFaceBack:IR,CullFaceFront:TX,CullFaceFrontBack:p_e,CullFaceNone:MX,Curve:Zd,CurvePath:EY,CustomBlending:CX,CustomToneMapping:Vk,CylinderGeometry:Mw,Cylindrical:k3e,Data3DTexture:rE,DataArrayTexture:nE,DataTexture:Hd,DataTextureLoader:Jwe,DataUtils:zSe,DecrementStencilOp:P_e,DecrementWrapStencilOp:I_e,DefaultLoadingManager:WY,DepthFormat:lh,DepthStencilFormat:F0,DepthTexture:sy,DetachedBindMode:qX,DirectionalLight:YY,DirectionalLightHelper:H3e,DiscreteInterpolant:HY,DodecahedronGeometry:fE,DoubleSide:Yc,DstAlphaFactor:LX,DstColorFactor:jX,DynamicCopyUsage:Y_e,DynamicDrawUsage:V_e,DynamicReadUsage:$_e,EdgesGeometry:c9,EllipseCurve:hE,EqualCompare:nY,EqualDepth:z2,EqualStencilFunc:j_e,EquirectangularReflectionMapping:O_,EquirectangularRefractionMapping:L_,Euler:ou,EventDispatcher:gh,ExternalTexture:l9,ExtrudeGeometry:pE,FileLoader:gp,Float16BufferAttribute:GSe,Float32BufferAttribute:Cn,FloatType:Vl,Fog:sE,FogExp2:iE,FramebufferTexture:cwe,FrontSide:mp,Frustum:ky,FrustumArray:lE,GLBufferAttribute:R3e,GLSL1:Z_e,GLSL3:BR,GreaterCompare:rY,GreaterDepth:F2,GreaterEqualCompare:tE,GreaterEqualDepth:j2,GreaterEqualStencilFunc:H_e,GreaterStencilFunc:U_e,GridHelper:U3e,Group:s1,HalfFloatType:ah,HemisphereLight:$Y,HemisphereLightHelper:F3e,IcosahedronGeometry:mE,ImageBitmapLoader:o3e,ImageLoader:kS,ImageUtils:uY,IncrementStencilOp:k_e,IncrementWrapStencilOp:D_e,InstancedBufferAttribute:dv,InstancedBufferGeometry:CE,InstancedInterleavedBuffer:M5,InstancedMesh:gY,Int16BufferAttribute:HSe,Int32BufferAttribute:VSe,Int8BufferAttribute:FSe,IntType:qT,InterleavedBuffer:oE,InterleavedBufferAttribute:Jc,Interpolant:Py,InterpolateBezier:FR,InterpolateDiscrete:vS,InterpolateLinear:y5,InterpolateSmooth:HM,InterpolationSamplingMode:eSe,InterpolationSamplingType:J_e,InvertStencilOp:O_e,KeepStencilOp:Tg,KeyframeTrack:nd,LOD:pY,LatheGeometry:gE,Layers:iy,LessCompare:tY,LessDepth:L2,LessEqualCompare:eE,LessEqualDepth:lv,LessEqualStencilFunc:F_e,LessStencilFunc:z_e,Light:xm,LightProbe:QY,Line:rm,Line3:lK,LineBasicMaterial:$l,LineCurve:f9,LineCurve3:TY,LineDashedMaterial:FY,LineLoop:xY,LineSegments:vh,LinearFilter:rs,LinearInterpolant:b9,LinearMipMapLinearFilter:y_e,LinearMipMapNearestFilter:x_e,LinearMipmapLinearFilter:Zf,LinearMipmapNearestFilter:z_,LinearSRGBColorSpace:tm,LinearToneMapping:Uk,LinearTransfer:yS,Loader:kc,LoaderUtils:$R,LoadingManager:S9,LoopOnce:XX,LoopPingPong:KX,LoopRepeat:YX,MOUSE:wg,Material:xl,MaterialBlending:m_e,MaterialLoader:EE,MathUtils:cY,Matrix2:N9,Matrix3:_r,Matrix4:rr,MaxEquation:kX,Mesh:Us,MeshBasicMaterial:Sp,MeshDepthMaterial:wE,MeshDistanceMaterial:ME,MeshLambertMaterial:zY,MeshMatcapMaterial:jY,MeshNormalMaterial:LY,MeshPhongMaterial:IY,MeshPhysicalMaterial:DY,MeshStandardMaterial:x9,MeshToonMaterial:OY,MinEquation:RX,MirroredRepeatWrapping:gS,MixOperation:WX,MultiplyBlending:zR,MultiplyOperation:_w,NearestFilter:Co,NearestMipMapLinearFilter:v_e,NearestMipMapNearestFilter:g_e,NearestMipmapLinearFilter:r1,NearestMipmapNearestFilter:$k,NeutralToneMapping:Wk,NeverCompare:eY,NeverDepth:I2,NeverStencilFunc:L_e,NoBlending:nh,NoColorSpace:rp,NoNormalPacking:E_e,NoToneMapping:ru,NormalAnimationBlendMode:JT,NormalBlending:$g,NormalGAPacking:A_e,NormalRGPacking:C_e,NotEqualCompare:iY,NotEqualDepth:U2,NotEqualStencilFunc:B_e,NumberKeyframeTrack:AS,Object3D:bi,ObjectLoader:i3e,ObjectSpaceNormalMap:JX,OctahedronGeometry:Ew,OneFactor:DX,OneMinusConstantAlphaFactor:GX,OneMinusConstantColorFactor:HX,OneMinusDstAlphaFactor:zX,OneMinusDstColorFactor:FX,OneMinusSrcAlphaFactor:D2,OneMinusSrcColorFactor:OX,OrthographicCamera:Vd,PCFShadowMap:b1,PCFSoftShadowMap:I_,PMREMGenerator:KR,Path:w5,PerspectiveCamera:eo,Plane:ep,PlaneGeometry:wp,PlaneHelper:$3e,PointLight:XY,PointLightHelper:z3e,Points:yY,PointsMaterial:a9,PolarGridHelper:B3e,PolyhedronGeometry:vm,PositionalAudio:h3e,PropertyBinding:xi,PropertyMixer:iK,QuadraticBezierCurve:h9,QuadraticBezierCurve3:p9,Quaternion:Ua,QuaternionKeyframeTrack:Aw,QuaternionLinearInterpolant:GY,R11_EAC_Format:X2,RED_GREEN_RGTC2_Format:v5,RED_RGTC1_Format:m5,REVISION:bw,RG11_EAC_Format:K2,RGBADepthPacking:QX,RGBAFormat:cl,RGBAIntegerFormat:QT,RGBA_ASTC_10x10_Format:c5,RGBA_ASTC_10x5_Format:o5,RGBA_ASTC_10x6_Format:a5,RGBA_ASTC_10x8_Format:l5,RGBA_ASTC_12x10_Format:u5,RGBA_ASTC_12x12_Format:d5,RGBA_ASTC_4x4_Format:Q2,RGBA_ASTC_5x4_Format:J2,RGBA_ASTC_5x5_Format:e5,RGBA_ASTC_6x5_Format:t5,RGBA_ASTC_6x6_Format:n5,RGBA_ASTC_8x5_Format:r5,RGBA_ASTC_8x6_Format:i5,RGBA_ASTC_8x8_Format:s5,RGBA_BPTC_Format:f5,RGBA_ETC2_EAC_Format:q2,RGBA_PVRTC_2BPPV1_Format:G2,RGBA_PVRTC_4BPPV1_Format:V2,RGBA_S3TC_DXT1_Format:F_,RGBA_S3TC_DXT3_Format:U_,RGBA_S3TC_DXT5_Format:B_,RGBDepthPacking:M_e,RGBFormat:Qk,RGBIntegerFormat:b_e,RGB_BPTC_SIGNED_Format:h5,RGB_BPTC_UNSIGNED_Format:p5,RGB_ETC1_Format:W2,RGB_ETC2_Format:$2,RGB_PVRTC_2BPPV1_Format:H2,RGB_PVRTC_4BPPV1_Format:B2,RGB_S3TC_DXT1_Format:j_,RGDepthPacking:T_e,RGFormat:cv,RGIntegerFormat:ZT,RawShaderMaterial:v9,Ray:Tv,Raycaster:oK,RectAreaLight:ZY,RedFormat:KT,RedIntegerFormat:Sw,ReinhardToneMapping:Bk,RenderTarget:t9,RenderTarget3D:C3e,RepeatWrapping:mS,ReplaceStencilOp:R_e,ReverseSubtractEquation:NX,RingGeometry:vE,SIGNED_R11_EAC_Format:Y2,SIGNED_RED_GREEN_RGTC2_Format:x5,SIGNED_RED_RGTC1_Format:g5,SIGNED_RG11_EAC_Format:Z2,SRGBColorSpace:ll,SRGBTransfer:Fi,Scene:n9,ShaderChunk:Cr,ShaderLib:Od,ShaderMaterial:au,ShadowMaterial:kY,Shape:G0,ShapeGeometry:xE,ShapePath:Y3e,ShapeUtils:Bd,ShortType:Xk,Skeleton:aE,SkeletonHelper:L3e,SkinnedMesh:mY,Source:U0,Sphere:Wo,SphereGeometry:Cw,Spherical:XR,SphericalHarmonics3:M9,SplineCurve:m9,SpotLight:qY,SpotLightHelper:O3e,Sprite:hY,SpriteMaterial:s9,SrcAlphaFactor:P2,SrcAlphaSaturateFactor:UX,SrcColorFactor:IX,StaticCopyUsage:X_e,StaticDrawUsage:bS,StaticReadUsage:W_e,StereoCamera:l3e,StreamCopyUsage:K_e,StreamDrawUsage:G_e,StreamReadUsage:q_e,StringKeyframeTrack:Av,SubtractEquation:AX,SubtractiveBlending:LR,TOUCH:Mg,TangentSpaceNormalMap:gm,TetrahedronGeometry:yE,Texture:ro,TextureLoader:e3e,TextureUtils:t4e,Timer:nK,TimestampQuery:Q_e,TorusGeometry:bE,TorusKnotGeometry:_E,Triangle:Mc,TriangleFanDrawMode:w_e,TriangleStripDrawMode:S_e,TrianglesDrawMode:__e,TubeGeometry:SE,UVMapping:$T,Uint16BufferAttribute:r9,Uint32BufferAttribute:i9,Uint8BufferAttribute:USe,Uint8ClampedBufferAttribute:BSe,Uniform:A9,UniformsGroup:N3e,UniformsLib:mn,UniformsUtils:CS,UnsignedByteType:jl,UnsignedInt101111Type:Kk,UnsignedInt248Type:ny,UnsignedInt5999Type:Yk,UnsignedIntType:Zu,UnsignedShort4444Type:XT,UnsignedShort5551Type:YT,UnsignedShortType:ty,VSMShadowMap:Rg,Vector2:jt,Vector3:ze,Vector4:di,VectorKeyframeTrack:NS,VideoFrameTexture:lwe,VideoTexture:bY,WebGL3DRenderTarget:ASe,WebGLArrayRenderTarget:CSe,WebGLCoordinateSystem:Qc,WebGLCubeRenderTarget:R9,WebGLRenderTarget:su,WebGLRenderer:gK,WebGLUtils:mK,WebGPUCoordinateSystem:uv,WebXRController:VM,WireframeGeometry:g9,WrapAroundEnding:xS,ZeroCurvatureEnding:kg,ZeroFactor:PX,ZeroSlopeEnding:Pg,ZeroStencilOp:N_e,createCanvasElement:aY,error:Un,getConsoleFunction:sSe,log:SS,setConsoleFunction:iSe,warn:pn,warnOnce:wS},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 XTe(){if(Tj)return A6;Tj=1;var t=GS(),e=Fne();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,o=t.useEffect,a=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=a(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,I=h===void 0?null:h;return[function(){return S(d())},I===null?void 0:function(){return S(I())}]},[d,h,g,v]);var w=i(c,b[0],b[1]);return o(function(){_.hasValue=!0,_.value=w},[w]),l(w),w},A6}var Ej;function YTe(){return Ej||(Ej=1,C6.exports=XTe()),C6.exports}var KTe=YTe();const ZTe=uy(KTe),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,a={setState:r,getState:i,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=e=t(r,i,a);return a},QTe=(t=>t?Cj(t):Cj),{useSyncExternalStoreWithSelector:JTe}=ZTe,eEe=t=>t;function tEe(t,e=eEe,n){const r=JTe(t.subscribe,t.getState,t.getInitialState,e,n);return Jr.useDebugValue(r),r}const Aj=(t,e)=>{const n=QTe(t),r=(i,s=e)=>tEe(n,i,s);return Object.assign(r,n),r},nEe=((t,e)=>t?Aj(t,e):Aj),rEe=t=>typeof t=="object"&&typeof t.then=="function",yM=[];function iEe(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 sEe(t,e=null,n=!1,r={}){e===null&&(e=[t]);for(const s of yM)if(iEe(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=yM.indexOf(i);s!==-1&&yM.splice(s,1)},promise:(rEe(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(yM.push(i),!n)throw i.promise}const oEe=(t,e,n)=>sEe(t,e,!1,n);var JR=DF();const aEe=uy(JR);function k9(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=e?t.return:t.child;for(;r;){const i=k9(r,e,n);if(i)return i;r=e?null:r.sibling}}function vK(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const P9=vK(T.createContext(null));class xK extends T.Component{render(){return T.createElement(P9.Provider,{value:this._reactInternals},this.props.children)}}function yK(){const t=T.useContext(P9);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=k9(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 lEe=Symbol.for("react.context"),cEe=t=>t!==null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===lEe;function uEe(){const t=yK(),[e]=T.useState(()=>new Map);e.clear();let n=t;for(;n;){const r=n.type;cEe(r)&&r!==P9&&!e.has(r)&&e.set(r,T.use(vK(r))),n=n.return}return e}function dEe(){const t=uEe();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(xK,{...e})),[t])}function bK(t){let e=t.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const _K=t=>t&&t.isOrthographicCamera,fEe=t=>t&&t.hasOwnProperty("current"),hEe=t=>t!=null&&(typeof t=="string"||typeof t=="number"||t.isColor),Nw=((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 SK(t){const e=T.useRef(t);return Nw(()=>void(e.current=t),[t]),e}function pEe(){const t=yK(),e=dEe();return T.useMemo(()=>({children:n})=>{const i=!!k9(t,!0,s=>s.type===T.StrictMode)?T.StrictMode:T.Fragment;return p.jsx(i,{children:p.jsx(e,{children:n})})},[t,e])}function mEe({set:t}){return Nw(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}const gEe=(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 wK(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 Yx(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 o=Qs.arr(t);if(o&&n==="reference")return t===e;if((o||s)&&t===e)return!0;let a;for(a in t)if(!(a in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(a in i?e:t)if(!Qs.equ(t[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:t)if(t[a]!==e[a])return!1;if(Qs.und(a)){if(o&&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 vEe(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 MK=["children","key","ref"];function xEe(t){const e={};for(const n in t)MK.includes(n)||(e[n]=t[n]);return e}function T5(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:xEe(r),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=s)),s}function PS(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 E5(t,e){if(Qs.str(e.props.attach)){if(Nj.test(e.props.attach)){const i=e.props.attach.replace(Nj,""),{root:s,key:o}=PS(t.object,i);Array.isArray(s[o])||(s[o]=[])}const{root:n,key:r}=PS(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 C5(t,e){if(Qs.str(e.props.attach)){const{root:n,key:r}=PS(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=[...MK,"args","dispose","attach","object","onUpdate","dispose"],Rj=new Map;function yEe(t){let e=Rj.get(t.constructor);try{e||(e=new t.constructor,Rj.set(t.constructor,e))}catch{}return e}function bEe(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}=PS(t.object,r);if(i.constructor&&i.constructor.length===0){const o=yEe(i);Qs.und(o)||(n[s]=o[s])}else n[s]=0}return n}const _Ee=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],SEe=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function A0(t,e){var n;const r=t.__r3f,i=r&&bK(r).getState(),s=r==null?void 0:r.eventCount;for(const a in e){let l=e[a];if(e7.includes(a))continue;if(r&&SEe.test(a)){typeof l=="function"?r.handlers[a]=l:delete r.handlers[a],r.eventCount=Object.keys(r.handlers).length;continue}if(l===void 0)continue;let{root:c,key:d,target:h}=PS(t,a);if(h===void 0&&(typeof c!="object"||c===null))throw Error(`R3F: Cannot set "${a}". Ensure it is an object before setting "${d}".`);if(h instanceof iy&&l instanceof iy)h.mask=l.mask;else if(h instanceof yn&&hEe(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 o;c[d]=l,i&&!i.linear&&_Ee.includes(d)&&(o=c[d])!=null&&o.isTexture&&c[d].format===cl&&c[d].type===jl&&(c[d].colorSpace=ll)}}if(r!=null&&r.parent&&i!=null&&i.internal&&(n=r.object)!=null&&n.isObject3D&&s!==r.eventCount){const a=r.object,l=i.internal.interaction.indexOf(a);l>-1&&i.internal.interaction.splice(l,1),r.eventCount&&a.raycast!==null&&i.internal.interaction.push(a)}return r&&r.props.attach===void 0&&(r.object.isBufferGeometry?r.props.attach="geometry":r.object.isMaterial&&(r.props.attach="material")),r&&Iy(r),t}function Iy(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 wEe(t,e){t.manual||(_K(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 bM(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function TK(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function MEe(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)=>{TK(n.capturedMap,e,r,i)})}function TEe(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=Yx(v[S]);E&&(E.raycaster.camera=void 0)}d.previousRoot||d.events.compute==null||d.events.compute(l,d);function b(S){const E=Yx(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=Yx(S.object),N=Yx(E.object);return!A||!N?S.distance-E.distance:N.events.priority-A.events.priority||S.distance-E.distance}).filter(S=>{const E=bM(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(bM(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=Yx(v.object);if(b||v.object.traverseAncestors(_=>{const w=Yx(_);if(w)return b=w,!1}),b){const{raycaster:_,pointer:w,camera:S,internal:E}=b,A=new ze(w.x,w.y,0).unproject(S),N=O=>{var F,U;return(F=(U=E.capturedMap.get(O))==null?void 0:U.has(v.eventObject))!=null?F:!1},I=O=>{const F={intersection:v,target:c.target};E.capturedMap.has(O)?E.capturedMap.get(O).set(v.eventObject,F):E.capturedMap.set(O,new Map([[v.eventObject,F]])),c.target.setPointerCapture(O)},P=O=>{const F=E.capturedMap.get(O);F&&TK(E.capturedMap,v.eventObject,F,O)};let L={};for(let O in c){let F=c[O];typeof F!="function"&&(L[O]=F)}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(F=>F.eventObject===v.eventObject))){const F=l.slice(0,l.indexOf(v));s([...F,v])}},target:{hasPointerCapture:N,setPointerCapture:I,releasePointerCapture:P},currentTarget:{hasPointerCapture:N,setPointerCapture:I,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(bM(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 o(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 a(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&&(o(d,g.interaction),h&&h(d)),v&&s(w);function E(A){const N=A.eventObject,I=N.__r3f;if(!(I!=null&&I.eventCount))return;const P=I.handlers;if(v){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const L=bM(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))&&(o(d,g.interaction.filter(R=>!g.initialHits.includes(R))),L(A)):b&&g.initialHits.includes(N)&&o(d,g.interaction.filter(R=>!g.initialHits.includes(R)))}}i(w,d,S,E)}}return{handlePointer:a}}const kj=t=>!!(t!=null&&t.render),EK=T.createContext(null),EEe=(t,e)=>{const n=nEe((a,l)=>{const c=new ze,d=new ze,h=new ze;function g(S=l().camera,E=d,A=l().size){const{width:N,height:I,top:P,left:L}=A,R=N/I;E.isVector3?h.copy(E):h.set(...E);const O=S.getWorldPosition(c).distanceTo(h);if(_K(S))return{width:N/S.zoom,height:I/S.zoom,top:P,left:L,factor:1,distance:O,aspect:R};{const F=S.fov*Math.PI/180,U=2*Math.tan(F/2)*O,q=U*(N/I);return{width:q,height:U,top:P,left:L,factor:N/q,distance:O,aspect:R}}}let v;const b=S=>a(E=>({performance:{...E.performance,current:S}})),_=new jt;return{set:a,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 aK,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=>a(E=>({...E,events:{...E.events,...S}})),setSize:(S,E,A=0,N=0)=>{const I=l().camera,P={width:S,height:E,top:A,left:N};a(L=>({size:P,viewport:{...L.viewport,...g(I,d,P)}}))},setDpr:S=>a(E=>{const A=wK(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),a(()=>({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((I,P)=>I.priority-P.priority),()=>{const I=l().internal;I!=null&&I.subscribers&&(I.priority=I.priority-(E>0?1:0),I.subscribers=I.subscribers.filter(P=>P.ref!==S))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return n.subscribe(()=>{const{camera:a,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,wEe(a,l),c.dpr>0&&d.setPixelRatio(c.dpr);const g=typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,g)}a!==o&&(o=a,h(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};function CK(){const t=T.useContext(EK);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function qc(t=n=>n,e){return CK()(t,e)}function RE(t,e=0){const n=CK(),r=n.getState().internal.subscribe,i=SK(t);return Nw(()=>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 CEe=1,AEe=8,NEe=32,REe=2;var kEe={version:"9.5.0"};function PEe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Pj={exports:{}},Dj={exports:{}},Ij;function DEe(){return Ij||(Ij=1,(function(t){t.exports=function(e){function n(m,x,C,k){return new jy(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 o(m){if(s(m)!==m)throw Error(i(188))}function a(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 W=C.return;if(W===null)break;var ee=W.alternate;if(ee===null){if(k=W.return,k!==null){C=k;continue}break}if(W.child===ee.child){for(ee=W.child;ee;){if(ee===C)return o(W),m;if(ee===k)return o(W),x;ee=ee.sibling}throw Error(i(188))}if(C.return!==k.return)C=W,k=ee;else{for(var Re=!1,lt=W.child;lt;){if(lt===C){Re=!0,C=W,k=ee;break}if(lt===k){Re=!0,k=W,C=ee;break}lt=lt.sibling}if(!Re){for(lt=ee.child;lt;){if(lt===C){Re=!0,C=ee,k=W;break}if(lt===k){Re=!0,k=ee,C=W;break}lt=lt.sibling}if(!Re)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=vd&&m[vd]||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 Th:return"Fragment";case Ch:return"Profiler";case Eh:return"StrictMode";case Vv:return"Suspense";case gd:return"SuspenseList";case Om:return"Activity"}if(typeof m=="object")switch(m.$$typeof){case Mh:return"Portal";case sc:return m.displayName||"Context";case Im:return(m._context.displayName||"Context")+".Consumer";case Up:var x=m.render;return m=m.displayName,m||(m=x.displayName||x.name||"",m=m!==""?"ForwardRef("+m+")":"ForwardRef"),m;case Gv:return x=m.displayName||null,x!==null?x:h(m.type)||"Memo";case Na:x=m._payload,m=m._init;try{return h(m(x))}catch{}}return null}function g(m){return{current:m}}function v(m){0>Ph||(m.current=rx[Ph],rx[Ph]=null,Ph--)}function b(m,x){Ph++,rx[Ph]=m.current,m.current=x}function _(m){return m>>>=0,m===0?32:31-(ix(m)/S3|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 W=0,ee=m.suspendedLanes,Re=m.pingedLanes;m=m.warmLanes;var lt=k&134217727;return lt!==0?(k=lt&~ee,k!==0?W=w(k):(Re&=lt,Re!==0?W=w(Re):C||(C=lt&~m,C!==0&&(W=w(C))))):(lt=k&~ee,lt!==0?W=w(lt):Re!==0?W=w(Re):C||(C=k&~m,C!==0&&(W=w(C)))),W===0?0:x!==0&&x!==W&&(x&ee)===0&&(ee=W&-W,C=x&-x,ee>=C||ee===32&&(C&4194048)!==0)?x:W}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=qp;return qp<<=1,(qp&62914560)===0&&(qp=4194304),m}function I(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,W,ee){var Re=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 lt=m.entanglements,It=m.expirationTimes,Wt=m.hiddenUpdates;for(C=Re&~C;0<C;){var cn=31-Za(C),Yt=1<<cn;lt[cn]=0,It[cn]=-1;var bn=Wt[cn];if(bn!==null)for(Wt[cn]=null,cn=0;cn<bn.length;cn++){var hr=bn[cn];hr!==null&&(hr.lane&=-536870913)}C&=~Yt}k!==0&&R(m,k,0),ee!==0&&W===0&&m.tag!==0&&(m.suspendedLanes|=ee&~(Re&~x))}function R(m,x,C){m.pendingLanes|=x,m.suspendedLanes&=~x;var k=31-Za(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-Za(C),W=1<<k;W&x|m[k]&x&&(m[k]|=x),C&=~W}}function F(m,x){var C=x&-x;return C=(C&42)!==0?1:U(C),(C&(m.suspendedLanes|x))!==0?0:C}function U(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 q(m){return m&=-m,2<m?8<m?(m&134217727)!==0?32:268435456:8:2}function B(m){if(typeof wb=="function"&&T3(m),Qa&&typeof Qa.setStrictMode=="function")try{Qa.setStrictMode(Ih,m)}catch{}}function Z(m,x){return m===x&&(m!==0||1/m===1/x)||m!==m&&x!==x}function G(m){if(ux===void 0)try{throw Error()}catch(C){var x=C.stack.trim().match(/\n( *(at )?)/);ux=x&&x[1]||"",Mu=-1<C.stack.indexOf(`
    at`)?" (<anonymous>)":-1<C.stack.indexOf("@")?"@unknown:0:0":""}return`
`+ux+m+Mu}function $(m,x){if(!m||Gm)return"";Gm=!0;var C=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var k={DetermineComponentFrameRoot:function(){try{if(x){var Yt=function(){throw Error()};if(Object.defineProperty(Yt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Yt,[])}catch(hr){var bn=hr}Reflect.construct(m,[],Yt)}else{try{Yt.call()}catch(hr){bn=hr}m.call(Yt.prototype)}}else{try{throw Error()}catch(hr){bn=hr}(Yt=m())&&typeof Yt.catch=="function"&&Yt.catch(function(){})}}catch(hr){if(hr&&bn&&typeof hr.stack=="string")return[hr.stack,bn.stack]}return[null,null]}};k.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var W=Object.getOwnPropertyDescriptor(k.DetermineComponentFrameRoot,"name");W&&W.configurable&&Object.defineProperty(k.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var ee=k.DetermineComponentFrameRoot(),Re=ee[0],lt=ee[1];if(Re&&lt){var It=Re.split(`
`),Wt=lt.split(`
`);for(W=k=0;k<It.length&&!It[k].includes("DetermineComponentFrameRoot");)k++;for(;W<Wt.length&&!Wt[W].includes("DetermineComponentFrameRoot");)W++;if(k===It.length||W===Wt.length)for(k=It.length-1,W=Wt.length-1;1<=k&&0<=W&&It[k]!==Wt[W];)W--;for(;1<=k&&0<=W;k--,W--)if(It[k]!==Wt[W]){if(k!==1||W!==1)do if(k--,W--,0>W||It[k]!==Wt[W]){var cn=`
`+It[k].replace(" at new "," at ");return m.displayName&&cn.includes("<anonymous>")&&(cn=cn.replace("<anonymous>",m.displayName)),cn}while(1<=k&&0<=W);break}}}finally{Gm=!1,Error.prepareStackTrace=C}return(C=m?m.displayName||m.name:"")?G(C):""}function K(m,x){switch(m.tag){case 26:case 27:case 5:return G(m.type);case 16:return G("Lazy");case 13:return m.child!==x&&x!==null?G("Suspense Fallback"):G("Suspense");case 19:return G("SuspenseList");case 0:case 15:return $(m.type,!1);case 11:return $(m.type.render,!1);case 1:return $(m.type,!0);case 31:return G("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 J(m,x){if(typeof m=="object"&&m!==null){var C=Mb.get(m);return C!==void 0?C:(x={value:m,source:x,stack:Y(x)},Mb.set(m,x),x)}return{value:m,source:x,stack:Y(x)}}function H(m,x){bd[Tu++]=Wm,bd[Tu++]=zi,zi=m,Wm=x}function z(m,x,C){lc[Cl++]=Zo,lc[Cl++]=jc,lc[Cl++]=cc,cc=m;var k=Zo;m=jc;var W=32-Za(k)-1;k&=~(1<<W),C+=1;var ee=32-Za(x)+W;if(30<ee){var Re=W-W%5;ee=(k&(1<<Re)-1).toString(32),k>>=Re,W-=Re,Zo=1<<32-Za(x)+W|C<<W|k,jc=ee+m}else Zo=1<<ee|C<<W|k,jc=m}function X(m){m.return!==null&&(H(m,1),z(m,1,0))}function V(m){for(;m===zi;)zi=bd[--Tu],bd[Tu]=null,Wm=bd[--Tu],bd[Tu]=null;for(;m===cc;)cc=lc[--Cl],lc[Cl]=null,jc=lc[--Cl],lc[Cl]=null,Zo=lc[--Cl],lc[Cl]=null}function ie(m,x){lc[Cl++]=Zo,lc[Cl++]=jc,lc[Cl++]=cc,Zo=x.id,jc=x.overflow,cc=m}function ae(m,x){b(Qo,x),b(_d,m),b(zo,null),m=jw(x),v(zo),b(zo,m)}function re(){v(zo),v(_d),v(Qo)}function ce(m){m.memoizedState!==null&&b($m,m);var x=zo.current,C=Vp(x,m.type);x!==C&&(b(_d,m),b(zo,C))}function oe(m){_d.current===m&&(v(zo),v(_d)),$m.current===m&&(v($m),Ws?Rh._currentValue=Nh:Rh._currentValue2=Nh)}function fe(m){var x=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw De(J(x,m)),dx}function me(m,x){if(!ls)throw Error(i(175));u3(m.stateNode,m.type,m.memoizedProps,x,m)||fe(m,!0)}function ye(m){for(So=m.return;So;)switch(So.tag){case 5:case 31:case 13:ka=!1;return;case 27:case 3:ka=!0;return;default:So=So.return}}function Ee(m){if(!ls||m!==So)return!1;if(!Br)return ye(m),Br=!0,!1;var x=m.tag;if(_o?x!==3&&x!==27&&(x!==5||$p(m.type)&&!Ra(m.type,m.memoizedProps))&&cs&&fe(m):x!==3&&(x!==5||$p(m.type)&&!Ra(m.type,m.memoizedProps))&&cs&&fe(m),ye(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=fb(m)}else if(x===31){if(m=m.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));cs=f3(m)}else cs=_o&&x===27?n3(m.type,cs):So?t3(m.stateNode):null;return!0}function Ge(){ls&&(cs=So=null,Br=!1)}function _e(){var m=Eu;return m!==null&&(tl===null?tl=m:tl.push.apply(tl,m),Eu=null),m}function De(m){Eu===null?Eu=[m]:Eu.push(m)}function he(m,x,C){Ws?(b(uc,x._currentValue),x._currentValue=C):(b(uc,x._currentValue2),x._currentValue2=C)}function Le(m){var x=uc.current;Ws?m._currentValue=x:m._currentValue2=x,v(uc)}function ne(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 We(m,x,C,k){var W=m.child;for(W!==null&&(W.return=m);W!==null;){var ee=W.dependencies;if(ee!==null){var Re=W.child;ee=ee.firstContext;e:for(;ee!==null;){var lt=ee;ee=W;for(var It=0;It<x.length;It++)if(lt.context===x[It]){ee.lanes|=C,lt=ee.alternate,lt!==null&&(lt.lanes|=C),ne(ee.return,C,m),k||(Re=null);break e}ee=lt.next}}else if(W.tag===18){if(Re=W.return,Re===null)throw Error(i(341));Re.lanes|=C,ee=Re.alternate,ee!==null&&(ee.lanes|=C),ne(Re,C,m),Re=null}else Re=W.child;if(Re!==null)Re.return=W;else for(Re=W;Re!==null;){if(Re===m){Re=null;break}if(W=Re.sibling,W!==null){W.return=Re.return,Re=W;break}Re=Re.return}W=Re}}function je(m,x,C,k){m=null;for(var W=x,ee=!1;W!==null;){if(!ee){if((W.flags&524288)!==0)ee=!0;else if((W.flags&262144)!==0)break}if(W.tag===10){var Re=W.alternate;if(Re===null)throw Error(i(387));if(Re=Re.memoizedProps,Re!==null){var lt=W.type;qs(W.pendingProps.value,Re.value)||(m!==null?m.push(lt):m=[lt])}}else if(W===$m.current){if(Re=W.alternate,Re===null)throw Error(i(387));Re.memoizedState.memoizedState!==W.memoizedState.memoizedState&&(m!==null?m.push(Rh):m=[Rh])}W=W.return}m!==null&&We(x,m,C,k),x.flags|=262144}function be(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 Xe(m){$i=m,Fc=null,m=m.dependencies,m!==null&&(m.firstContext=null)}function le(m){return Se($i,m)}function te(m,x){return $i===null&&Xe(m),Se(m,x)}function Se(m,x){var C=Ws?x._currentValue:x._currentValue2;if(x={context:x,memoizedValue:C,next:null},Fc===null){if(m===null)throw Error(i(308));Fc=x,m.dependencies={lanes:0,firstContext:x},m.flags|=524288}else Fc=Fc.next=x;return C}function ve(){return{controller:new E3,data:new Map,refCount:0}}function ge(m){m.refCount--,m.refCount===0&&jo(HE,function(){m.controller.abort()})}function Te(){}function He(m){m!==Ci&&m.next===null&&(Ci===null?qm=Ci=m:Ci=Ci.next=m),dc=!0,pa||(pa=!0,we())}function pe(m,x){if(!fx&&dc){fx=!0;do for(var C=!1,k=qm;k!==null;){if(m!==0){var W=k.pendingLanes;if(W===0)var ee=0;else{var Re=k.suspendedLanes,lt=k.pingedLanes;ee=(1<<31-Za(42|m)+1)-1,ee&=W&~(Re&~lt),ee=ee&201326741?ee&201326741|1:ee?ee|2:0}ee!==0&&(C=!0,Fe(k,ee))}else ee=Hr,ee=S(k,k===Er?ee:0,k.cancelPendingCommit!==null||k.timeoutHandle!==Ka),(ee&3)===0||E(k,ee)||(C=!0,Fe(k,ee));k=k.next}while(C);fx=!1}}function qe(){xt()}function xt(){dc=pa=!1;var m=0;mf!==0&&Ah()&&(m=mf);for(var x=ha(),C=null,k=qm;k!==null;){var W=k.next,ee=nt(k,x);ee===0?(k.next=null,C===null?qm=W:C.next=W,W===null&&(Ci=C)):(C=k,(m!==0||(ee&3)!==0)&&(dc=!0)),k=W}uo!==0&&uo!==5||pe(m),mf!==0&&(mf=0)}function nt(m,x){for(var C=m.suspendedLanes,k=m.pingedLanes,W=m.expirationTimes,ee=m.pendingLanes&-62914561;0<ee;){var Re=31-Za(ee),lt=1<<Re,It=W[Re];It===-1?((lt&C)===0||(lt&k)!==0)&&(W[Re]=A(lt,x)):It<=x&&(m.expiredLanes|=lt),ee&=~lt}if(x=Er,C=Hr,C=S(m,m===x?C:0,m.cancelPendingCommit!==null||m.timeoutHandle!==Ka),k=m.callbackNode,C===0||m===x&&(Ni===2||Ni===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),q(C)){case 2:case 8:C=M3;break;case 32:C=Vm;break;case 268435456:C=lx;break;default:C=Vm}return k=tt.bind(null,m),C=Hm(C,k),m.callbackPriority=x,m.callbackNode=C,x}return k!==null&&k!==null&&ox(k),m.callbackPriority=2,m.callbackNode=null,2}function tt(m,x){if(uo!==0&&uo!==5)return m.callbackNode=null,m.callbackPriority=0,null;var C=m.callbackNode;if(_u()&&m.callbackNode!==C)return null;var k=Hr;return k=S(m,m===Er?k:0,m.cancelPendingCommit!==null||m.timeoutHandle!==Ka),k===0?null:(zc(m,k,x),nt(m,ha()),m.callbackNode!=null&&m.callbackNode===C?tt.bind(null,m):null)}function Fe(m,x){if(_u())return null;zc(m,x,!0)}function we(){Ky?Zy(function(){(Or&6)!==0?Hm(ax,qe):xt()}):Hm(ax,qe)}function ke(){if(mf===0){var m=Sd;m===0&&(m=sx,sx<<=1,(sx&261888)===0&&(sx=256)),mf=m}return mf}function Ze(m,x){if(Xp===null){var C=Xp=[];Tb=0,Sd=ke(),wo={status:"pending",value:void 0,then:function(k){C.push(k)}}}return Tb++,x.then(Ne,Ne),x}function Ne(){if(--Tb===0&&Xp!==null){wo!==null&&(wo.status="fulfilled");var m=Xp;Xp=null,Sd=0,wo=null;for(var x=0;x<m.length;x++)(0,m[x])()}}function Ke(m,x){var C=[],k={status:"pending",value:null,reason:null,then:function(W){C.push(W)}};return m.then(function(){k.status="fulfilled",k.value=x;for(var W=0;W<C.length;W++)(0,C[W])(x)},function(W){for(k.status="rejected",k.reason=W,W=0;W<C.length;W++)(0,C[W])(void 0)}),k}function it(){var m=gf.current;return m!==null?m:Er.pooledCache}function ht(m,x){x===null?b(gf,gf.current):b(gf,x.pool)}function Je(){var m=it();return m===null?null:{parent:Ws?us._currentValue:us._currentValue2,pool:m}}function $e(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 W=C[k];if(!BE.call(x,W)||!qs(m[W],x[W]))return!1}return!0}function Ae(m){return m=m.status,m==="fulfilled"||m==="rejected"}function Oe(m,x,C){switch(C=m[C],C===void 0?m.push(x):C!==x&&(x.then(Te,Te),x=C),x.status){case"fulfilled":return x.value;case"rejected":throw m=x.reason,Rt(m),m;default:if(typeof x.status=="string")x.then(Te,Te);else{if(m=Er,m!==null&&100<m.shellSuspendCounter)throw Error(i(482));m=x,m.status="pending",m.then(function(k){if(x.status==="pending"){var W=x;W.status="fulfilled",W.value=k}},function(k){if(x.status==="pending"){var W=x;W.status="rejected",W.reason=k}})}switch(x.status){case"fulfilled":return x.value;case"rejected":throw m=x.reason,Rt(m),m}throw Pa=x,Mo}}function Ye(m){try{var x=m._init;return x(m._payload)}catch(C){throw C!==null&&typeof C=="object"&&typeof C.then=="function"?(Pa=C,Mo):C}}function st(){if(Pa===null)throw Error(i(459));var m=Pa;return Pa=null,m}function Rt(m){if(m===Mo||m===hc)throw Error(i(483))}function yt(m){var x=Oh;return Oh+=1,vf===null&&(vf=[]),Oe(vf,m,x)}function Tt(m,x){x=x.props.ref,m.ref=x!==void 0?x:null}function Et(m,x){throw x.$$typeof===wh?Error(i(525)):(m=Object.prototype.toString.call(x),Error(i(31,m==="[object Object]"?"object with keys {"+Object.keys(x).join(", ")+"}":m)))}function Dt(m){function x(Ct,vt){if(m){var Pt=Ct.deletions;Pt===null?(Ct.deletions=[vt],Ct.flags|=16):Pt.push(vt)}}function C(Ct,vt){if(!m)return null;for(;vt!==null;)x(Ct,vt),vt=vt.sibling;return null}function k(Ct){for(var vt=new Map;Ct!==null;)Ct.key!==null?vt.set(Ct.key,Ct):vt.set(Ct.index,Ct),Ct=Ct.sibling;return vt}function W(Ct,vt){return Ct=Tl(Ct,vt),Ct.index=0,Ct.sibling=null,Ct}function ee(Ct,vt,Pt){return Ct.index=Pt,m?(Pt=Ct.alternate,Pt!==null?(Pt=Pt.index,Pt<vt?(Ct.flags|=67108866,vt):Pt):(Ct.flags|=67108866,vt)):(Ct.flags|=1048576,vt)}function Re(Ct){return m&&Ct.alternate===null&&(Ct.flags|=67108866),Ct}function lt(Ct,vt,Pt,sn){return vt===null||vt.tag!==6?(vt=Fy(Pt,Ct.mode,sn),vt.return=Ct,vt):(vt=W(vt,Pt),vt.return=Ct,vt)}function It(Ct,vt,Pt,sn){var $n=Pt.type;return $n===Th?cn(Ct,vt,Pt.props.children,sn,Pt.key):vt!==null&&(vt.elementType===$n||typeof $n=="object"&&$n!==null&&$n.$$typeof===Na&&Ye($n)===vt.type)?(vt=W(vt,Pt.props),Tt(vt,Pt),vt.return=Ct,vt):(vt=md(Pt.type,Pt.key,Pt.props,null,Ct.mode,sn),Tt(vt,Pt),vt.return=Ct,vt)}function Wt(Ct,vt,Pt,sn){return vt===null||vt.tag!==4||vt.stateNode.containerInfo!==Pt.containerInfo||vt.stateNode.implementation!==Pt.implementation?(vt=By(Pt,Ct.mode,sn),vt.return=Ct,vt):(vt=W(vt,Pt.children||[]),vt.return=Ct,vt)}function cn(Ct,vt,Pt,sn,$n){return vt===null||vt.tag!==7?(vt=ic(Pt,Ct.mode,sn,$n),vt.return=Ct,vt):(vt=W(vt,Pt),vt.return=Ct,vt)}function Yt(Ct,vt,Pt){if(typeof vt=="string"&&vt!==""||typeof vt=="number"||typeof vt=="bigint")return vt=Fy(""+vt,Ct.mode,Pt),vt.return=Ct,vt;if(typeof vt=="object"&&vt!==null){switch(vt.$$typeof){case Su:return Pt=md(vt.type,vt.key,vt.props,null,Ct.mode,Pt),Tt(Pt,vt),Pt.return=Ct,Pt;case Mh:return vt=By(vt,Ct.mode,Pt),vt.return=Ct,vt;case Na:return vt=Ye(vt),Yt(Ct,vt,Pt)}if(df(vt)||d(vt))return vt=ic(vt,Ct.mode,Pt,null),vt.return=Ct,vt;if(typeof vt.then=="function")return Yt(Ct,yt(vt),Pt);if(vt.$$typeof===sc)return Yt(Ct,te(Ct,vt),Pt);Et(Ct,vt)}return null}function bn(Ct,vt,Pt,sn){var $n=vt!==null?vt.key:null;if(typeof Pt=="string"&&Pt!==""||typeof Pt=="number"||typeof Pt=="bigint")return $n!==null?null:lt(Ct,vt,""+Pt,sn);if(typeof Pt=="object"&&Pt!==null){switch(Pt.$$typeof){case Su:return Pt.key===$n?It(Ct,vt,Pt,sn):null;case Mh:return Pt.key===$n?Wt(Ct,vt,Pt,sn):null;case Na:return Pt=Ye(Pt),bn(Ct,vt,Pt,sn)}if(df(Pt)||d(Pt))return $n!==null?null:cn(Ct,vt,Pt,sn,null);if(typeof Pt.then=="function")return bn(Ct,vt,yt(Pt),sn);if(Pt.$$typeof===sc)return bn(Ct,vt,te(Ct,Pt),sn);Et(Ct,Pt)}return null}function hr(Ct,vt,Pt,sn,$n){if(typeof sn=="string"&&sn!==""||typeof sn=="number"||typeof sn=="bigint")return Ct=Ct.get(Pt)||null,lt(vt,Ct,""+sn,$n);if(typeof sn=="object"&&sn!==null){switch(sn.$$typeof){case Su:return Ct=Ct.get(sn.key===null?Pt:sn.key)||null,It(vt,Ct,sn,$n);case Mh:return Ct=Ct.get(sn.key===null?Pt:sn.key)||null,Wt(vt,Ct,sn,$n);case Na:return sn=Ye(sn),hr(Ct,vt,Pt,sn,$n)}if(df(sn)||d(sn))return Ct=Ct.get(Pt)||null,cn(vt,Ct,sn,$n,null);if(typeof sn.then=="function")return hr(Ct,vt,Pt,yt(sn),$n);if(sn.$$typeof===sc)return hr(Ct,vt,Pt,te(vt,sn),$n);Et(vt,sn)}return null}function Ks(Ct,vt,Pt,sn){for(var $n=null,Cs=null,Yn=vt,ri=vt=0,Fo=null;Yn!==null&&ri<Pt.length;ri++){Yn.index>ri?(Fo=Yn,Yn=null):Fo=Yn.sibling;var hi=bn(Ct,Yn,Pt[ri],sn);if(hi===null){Yn===null&&(Yn=Fo);break}m&&Yn&&hi.alternate===null&&x(Ct,Yn),vt=ee(hi,vt,ri),Cs===null?$n=hi:Cs.sibling=hi,Cs=hi,Yn=Fo}if(ri===Pt.length)return C(Ct,Yn),Br&&H(Ct,ri),$n;if(Yn===null){for(;ri<Pt.length;ri++)Yn=Yt(Ct,Pt[ri],sn),Yn!==null&&(vt=ee(Yn,vt,ri),Cs===null?$n=Yn:Cs.sibling=Yn,Cs=Yn);return Br&&H(Ct,ri),$n}for(Yn=k(Yn);ri<Pt.length;ri++)Fo=hr(Yn,Ct,ri,Pt[ri],sn),Fo!==null&&(m&&Fo.alternate!==null&&Yn.delete(Fo.key===null?ri:Fo.key),vt=ee(Fo,vt,ri),Cs===null?$n=Fo:Cs.sibling=Fo,Cs=Fo);return m&&Yn.forEach(function(gc){return x(Ct,gc)}),Br&&H(Ct,ri),$n}function n0(Ct,vt,Pt,sn){if(Pt==null)throw Error(i(151));for(var $n=null,Cs=null,Yn=vt,ri=vt=0,Fo=null,hi=Pt.next();Yn!==null&&!hi.done;ri++,hi=Pt.next()){Yn.index>ri?(Fo=Yn,Yn=null):Fo=Yn.sibling;var gc=bn(Ct,Yn,hi.value,sn);if(gc===null){Yn===null&&(Yn=Fo);break}m&&Yn&&gc.alternate===null&&x(Ct,Yn),vt=ee(gc,vt,ri),Cs===null?$n=gc:Cs.sibling=gc,Cs=gc,Yn=Fo}if(hi.done)return C(Ct,Yn),Br&&H(Ct,ri),$n;if(Yn===null){for(;!hi.done;ri++,hi=Pt.next())hi=Yt(Ct,hi.value,sn),hi!==null&&(vt=ee(hi,vt,ri),Cs===null?$n=hi:Cs.sibling=hi,Cs=hi);return Br&&H(Ct,ri),$n}for(Yn=k(Yn);!hi.done;ri++,hi=Pt.next())hi=hr(Yn,Ct,ri,hi.value,sn),hi!==null&&(m&&hi.alternate!==null&&Yn.delete(hi.key===null?ri:hi.key),vt=ee(hi,vt,ri),Cs===null?$n=hi:Cs.sibling=hi,Cs=hi);return m&&Yn.forEach(function(VE){return x(Ct,VE)}),Br&&H(Ct,ri),$n}function Tf(Ct,vt,Pt,sn){if(typeof Pt=="object"&&Pt!==null&&Pt.type===Th&&Pt.key===null&&(Pt=Pt.props.children),typeof Pt=="object"&&Pt!==null){switch(Pt.$$typeof){case Su:e:{for(var $n=Pt.key;vt!==null;){if(vt.key===$n){if($n=Pt.type,$n===Th){if(vt.tag===7){C(Ct,vt.sibling),sn=W(vt,Pt.props.children),sn.return=Ct,Ct=sn;break e}}else if(vt.elementType===$n||typeof $n=="object"&&$n!==null&&$n.$$typeof===Na&&Ye($n)===vt.type){C(Ct,vt.sibling),sn=W(vt,Pt.props),Tt(sn,Pt),sn.return=Ct,Ct=sn;break e}C(Ct,vt);break}else x(Ct,vt);vt=vt.sibling}Pt.type===Th?(sn=ic(Pt.props.children,Ct.mode,sn,Pt.key),sn.return=Ct,Ct=sn):(sn=md(Pt.type,Pt.key,Pt.props,null,Ct.mode,sn),Tt(sn,Pt),sn.return=Ct,Ct=sn)}return Re(Ct);case Mh:e:{for($n=Pt.key;vt!==null;){if(vt.key===$n)if(vt.tag===4&&vt.stateNode.containerInfo===Pt.containerInfo&&vt.stateNode.implementation===Pt.implementation){C(Ct,vt.sibling),sn=W(vt,Pt.children||[]),sn.return=Ct,Ct=sn;break e}else{C(Ct,vt);break}else x(Ct,vt);vt=vt.sibling}sn=By(Pt,Ct.mode,sn),sn.return=Ct,Ct=sn}return Re(Ct);case Na:return Pt=Ye(Pt),Tf(Ct,vt,Pt,sn)}if(df(Pt))return Ks(Ct,vt,Pt,sn);if(d(Pt)){if($n=d(Pt),typeof $n!="function")throw Error(i(150));return Pt=$n.call(Pt),n0(Ct,vt,Pt,sn)}if(typeof Pt.then=="function")return Tf(Ct,vt,yt(Pt),sn);if(Pt.$$typeof===sc)return Tf(Ct,vt,te(Ct,Pt),sn);Et(Ct,Pt)}return typeof Pt=="string"&&Pt!==""||typeof Pt=="number"||typeof Pt=="bigint"?(Pt=""+Pt,vt!==null&&vt.tag===6?(C(Ct,vt.sibling),sn=W(vt,Pt),sn.return=Ct,Ct=sn):(C(Ct,vt),sn=Fy(Pt,Ct.mode,sn),sn.return=Ct,Ct=sn),Re(Ct)):C(Ct,vt)}return function(Ct,vt,Pt,sn){try{Oh=0;var $n=Tf(Ct,vt,Pt,sn);return vf=null,$n}catch(Yn){if(Yn===Mo||Yn===hc)throw Yn;var Cs=n(29,Yn,null,Ct.mode);return Cs.lanes=sn,Cs.return=Ct,Cs}finally{}}}function Ue(){for(var m=Au,x=Lh=Au=0;x<m;){var C=ea[x];ea[x++]=null;var k=ea[x];ea[x++]=null;var W=ea[x];ea[x++]=null;var ee=ea[x];if(ea[x++]=null,k!==null&&W!==null){var Re=k.pending;Re===null?W.next=W:(W.next=Re.next,Re.next=W),k.pending=W}ee!==0&&Ut(C,W,ee)}}function ct(m,x,C,k){ea[Au++]=m,ea[Au++]=x,ea[Au++]=C,ea[Au++]=k,Lh|=k,m.lanes|=k,m=m.alternate,m!==null&&(m.lanes|=k)}function St(m,x,C,k){return ct(m,x,C,k),Xt(m)}function kt(m,x){return ct(m,null,null,x),Xt(m)}function Ut(m,x,C){m.lanes|=C;var k=m.alternate;k!==null&&(k.lanes|=C);for(var W=!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||(W=!0)),m=ee,ee=ee.return;return m.tag===3?(ee=m.stateNode,W&&x!==null&&(W=31-Za(C),m=ee.hiddenUpdates,k=m[W],k===null?m[W]=[x]:k.push(x),x.lane=C|536870912),ee):null}function Xt(m){if(50<li)throw li=0,Jm=null,Error(i(185));for(var x=m.return;x!==null;)m=x,x=m.return;return m.tag===3?m.stateNode:null}function hn(m){m.updateQueue={baseState:m.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lt(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 on(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,(Or&2)!==0){var W=k.pending;return W===null?x.next=x:(x.next=W.next,W.next=x),k.pending=x,x=Xt(m),Ut(m,null,C),x}return ct(m,k,x,C),Xt(m)}function kn(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 Xn(m,x){var C=m.updateQueue,k=m.alternate;if(k!==null&&(k=k.updateQueue,C===k)){var W=null,ee=null;if(C=C.firstBaseUpdate,C!==null){do{var Re={lane:C.lane,tag:C.tag,payload:C.payload,callback:null,next:null};ee===null?W=ee=Re:ee=ee.next=Re,C=C.next}while(C!==null);ee===null?W=ee=x:ee=ee.next=x}else W=ee=x;C={baseState:k.baseState,firstBaseUpdate:W,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 zn(){if(px){var m=wo;if(m!==null)throw m}}function Qn(m,x,C,k){px=!1;var W=m.updateQueue;Al=!1;var ee=W.firstBaseUpdate,Re=W.lastBaseUpdate,lt=W.shared.pending;if(lt!==null){W.shared.pending=null;var It=lt,Wt=It.next;It.next=null,Re===null?ee=Wt:Re.next=Wt,Re=It;var cn=m.alternate;cn!==null&&(cn=cn.updateQueue,lt=cn.lastBaseUpdate,lt!==Re&&(lt===null?cn.firstBaseUpdate=Wt:lt.next=Wt,cn.lastBaseUpdate=It))}if(ee!==null){var Yt=W.baseState;Re=0,cn=Wt=It=null,lt=ee;do{var bn=lt.lane&-536870913,hr=bn!==lt.lane;if(hr?(Hr&bn)===bn:(k&bn)===bn){bn!==0&&bn===Sd&&(px=!0),cn!==null&&(cn=cn.next={lane:0,tag:lt.tag,payload:lt.payload,callback:null,next:null});e:{var Ks=m,n0=lt;bn=x;var Tf=C;switch(n0.tag){case 1:if(Ks=n0.payload,typeof Ks=="function"){Yt=Ks.call(Tf,Yt,bn);break e}Yt=Ks;break e;case 3:Ks.flags=Ks.flags&-65537|128;case 0:if(Ks=n0.payload,bn=typeof Ks=="function"?Ks.call(Tf,Yt,bn):Ks,bn==null)break e;Yt=Hv({},Yt,bn);break e;case 2:Al=!0}}bn=lt.callback,bn!==null&&(m.flags|=64,hr&&(m.flags|=8192),hr=W.callbacks,hr===null?W.callbacks=[bn]:hr.push(bn))}else hr={lane:bn,tag:lt.tag,payload:lt.payload,callback:lt.callback,next:null},cn===null?(Wt=cn=hr,It=Yt):cn=cn.next=hr,Re|=bn;if(lt=lt.next,lt===null){if(lt=W.shared.pending,lt===null)break;hr=lt,lt=hr.next,hr.next=null,W.lastBaseUpdate=hr,W.shared.pending=null}}while(!0);cn===null&&(It=Yt),W.baseState=It,W.firstBaseUpdate=Wt,W.lastBaseUpdate=cn,ee===null&&(W.shared.lanes=0),Md|=Re,m.lanes=Re,m.memoizedState=Yt}}function Pn(m,x){if(typeof m!="function")throw Error(i(191,m));m.call(x)}function lr(m,x){var C=m.callbacks;if(C!==null)for(m.callbacks=null,m=0;m<C.length;m++)Pn(C[m],x)}function ir(m,x){m=Ru,b(xf,m),b(zh,x),Ru=m|x.baseLanes}function xe(){b(xf,Ru),b(zh,zh.current)}function ot(){Ru=xf.current,v(zh),v(xf)}function bt(m){var x=m.alternate;b(zs,zs.current&1),b(Ja,m),el===null&&(x===null||zh.current!==null||x.memoizedState!==null)&&(el=m)}function mt(m){b(zs,zs.current),b(Ja,m),el===null&&(el=m)}function pt(m){m.tag===22?(b(zs,zs.current),b(Ja,m),el===null&&(el=m)):$t()}function $t(){b(zs,zs.current),b(Ja,Ja.current)}function Zt(m){v(Ja),el===m&&(el=null),v(zs)}function en(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)||Kv(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 Jt(){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 jn(m,x,C,k,W,ee){return wd=ee,yr=x,x.memoizedState=null,x.updateQueue=null,x.lanes=0,Hn.H=m===null||m.memoizedState===null?Ms:Nu,Zr=!1,ee=C(k,W),Zr=!1,wr&&(ee=ln(x,C,k,W)),Gn(m),ee}function Gn(m){Hn.H=Nl;var x=Fn!==null&&Fn.next!==null;if(wd=0,cr=Fn=yr=null,Tr=!1,pc=0,Uc=null,x)throw Error(i(300));m===null||es||(m=m.dependencies,m!==null&&be(m)&&(es=!0))}function ln(m,x,C,k){yr=m;var W=0;do{if(wr&&(Uc=null),pc=0,wr=!1,25<=W)throw Error(i(301));if(W+=1,cr=Fn=null,m.updateQueue!=null){var ee=m.updateQueue;ee.lastEffect=null,ee.events=null,ee.stores=null,ee.memoCache!=null&&(ee.memoCache.index=0)}Hn.H=yf,ee=x(C,k)}while(wr);return ee}function sr(){var m=Hn.H,x=m.useState()[0];return x=typeof x.then=="function"?Nn(x):x,m=m.useState()[0],(Fn!==null?Fn.memoizedState:null)!==m&&(yr.flags|=1024),x}function Yr(){var m=ma!==0;return ma=0,m}function ti(m,x,C){x.updateQueue=m.updateQueue,x.flags&=-2053,m.lanes&=~C}function dr(m){if(Tr){for(m=m.memoizedState;m!==null;){var x=m.queue;x!==null&&(x.pending=null),m=m.next}Tr=!1}wd=0,cr=Fn=yr=null,wr=!1,pc=ma=0,Uc=null}function kr(){var m={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return cr===null?yr.memoizedState=cr=m:cr=cr.next=m,cr}function rn(){if(Fn===null){var m=yr.alternate;m=m!==null?m.memoizedState:null}else m=Fn.next;var x=cr===null?yr.memoizedState:cr.next;if(x!==null)cr=x,Fn=m;else{if(m===null)throw yr.alternate===null?Error(i(467)):Error(i(310));Fn=m,m={memoizedState:Fn.memoizedState,baseState:Fn.baseState,baseQueue:Fn.baseQueue,queue:Fn.queue,next:null},cr===null?yr.memoizedState=cr=m:cr=cr.next=m}return cr}function ss(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Nn(m){var x=pc;return pc+=1,Uc===null&&(Uc=[]),m=Oe(Uc,m,x),x=yr,(cr===null?x.memoizedState:cr.next)===null&&(x=x.alternate,Hn.H=x===null||x.memoizedState===null?Ms:Nu),m}function gs(m){if(m!==null&&typeof m=="object"){if(typeof m.then=="function")return Nn(m);if(m.$$typeof===sc)return le(m)}throw Error(i(438,String(m)))}function Rs(m){var x=null,C=yr.updateQueue;if(C!==null&&(x=C.memoCache),x==null){var k=yr.alternate;k!==null&&(k=k.updateQueue,k!==null&&(k=k.memoCache,k!=null&&(x={data:k.data.map(function(W){return W.slice()}),index:0})))}if(x==null&&(x={data:[],index:0}),C===null&&(C=ss(),yr.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]=Vy;return x.index++,C}function Di(m,x){return typeof x=="function"?x(m):x}function vs(m){var x=rn();return gr(x,Fn,m)}function gr(m,x,C){var k=m.queue;if(k===null)throw Error(i(311));k.lastRenderedReducer=C;var W=m.baseQueue,ee=k.pending;if(ee!==null){if(W!==null){var Re=W.next;W.next=ee.next,ee.next=Re}x.baseQueue=W=ee,k.pending=null}if(ee=m.baseState,W===null)m.memoizedState=ee;else{x=W.next;var lt=Re=null,It=null,Wt=x,cn=!1;do{var Yt=Wt.lane&-536870913;if(Yt!==Wt.lane?(Hr&Yt)===Yt:(wd&Yt)===Yt){var bn=Wt.revertLane;if(bn===0)It!==null&&(It=It.next={lane:0,revertLane:0,gesture:null,action:Wt.action,hasEagerState:Wt.hasEagerState,eagerState:Wt.eagerState,next:null}),Yt===Sd&&(cn=!0);else if((wd&bn)===bn){Wt=Wt.next,bn===Sd&&(cn=!0);continue}else Yt={lane:0,revertLane:Wt.revertLane,gesture:null,action:Wt.action,hasEagerState:Wt.hasEagerState,eagerState:Wt.eagerState,next:null},It===null?(lt=It=Yt,Re=ee):It=It.next=Yt,yr.lanes|=bn,Md|=bn;Yt=Wt.action,Zr&&C(ee,Yt),ee=Wt.hasEagerState?Wt.eagerState:C(ee,Yt)}else bn={lane:Yt,revertLane:Wt.revertLane,gesture:Wt.gesture,action:Wt.action,hasEagerState:Wt.hasEagerState,eagerState:Wt.eagerState,next:null},It===null?(lt=It=bn,Re=ee):It=It.next=bn,yr.lanes|=Yt,Md|=Yt;Wt=Wt.next}while(Wt!==null&&Wt!==x);if(It===null?Re=ee:It.next=lt,!qs(ee,m.memoizedState)&&(es=!0,cn&&(C=wo,C!==null)))throw C;m.memoizedState=ee,m.baseState=Re,m.baseQueue=It,k.lastRenderedState=ee}return W===null&&(k.lanes=0),[m.memoizedState,k.dispatch]}function fi(m){var x=rn(),C=x.queue;if(C===null)throw Error(i(311));C.lastRenderedReducer=m;var k=C.dispatch,W=C.pending,ee=x.memoizedState;if(W!==null){C.pending=null;var Re=W=W.next;do ee=m(ee,Re.action),Re=Re.next;while(Re!==W);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=yr,W=rn(),ee=Br;if(ee){if(C===void 0)throw Error(i(407));C=C()}else C=x();var Re=!qs((Fn||W).memoizedState,C);if(Re&&(W.memoizedState=C,es=!0),W=W.queue,Fr(ua.bind(null,k,W,m),[m]),W.getSnapshot!==x||Re||cr!==null&&cr.memoizedState.tag&1){if(k.flags|=2048,xs(9,{destroy:void 0},qo.bind(null,k,W,C,x),null),Er===null)throw Error(i(349));ee||(wd&127)!==0||Ii(k,x,C)}return C}function Ii(m,x,C){m.flags|=16384,m={getSnapshot:x,value:C},x=yr.updateQueue,x===null?(x=ss(),yr.updateQueue=x,x.stores=[m]):(C=x.stores,C===null?x.stores=[m]:C.push(m))}function qo(m,x,C,k){x.value=C,x.getSnapshot=k,wa(x)&&ql(m)}function ua(m,x,C){return C(function(){wa(x)&&ql(m)})}function wa(m){var x=m.getSnapshot;m=m.value;try{var C=x();return!qs(m,C)}catch{return!0}}function ql(m){var x=kt(m,2);x!==null&&Ss(x,m,2)}function yl(m){var x=kr();if(typeof m=="function"){var C=m;if(m=C(),Zr){B(!0);try{C()}finally{B(!1)}}}return x.memoizedState=x.baseState=m,x.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:m},x}function da(m,x,C,k){return m.baseState=C,gr(m,Fn,typeof k=="function"?k:Di)}function Ps(m,x,C,k,W){if(yh(m))throw Error(i(485));if(m=x.action,m!==null){var ee={payload:W,action:m,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(Re){ee.listeners.push(Re)}};Hn.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,W=m.state;if(x.isTransition){var ee=Hn.T,Re={};Hn.T=Re;try{var lt=C(W,k),It=Hn.S;It!==null&&It(Re,lt),Va(m,x,lt)}catch(Wt){Ta(m,x,Wt)}finally{ee!==null&&Re.types!==null&&(ee.types=Re.types),Hn.T=ee}}else try{ee=C(W,k),Va(m,x,ee)}catch(Wt){Ta(m,x,Wt)}}function Va(m,x,C){C!==null&&typeof C=="object"&&typeof C.then=="function"?C.then(function(k){Ma(m,x,k)},function(k){return Ta(m,x,k)}):Ma(m,x,C)}function Ma(m,x,C){x.status="fulfilled",x.value=C,Pc(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 Ta(m,x,C){var k=m.pending;if(m.pending=null,k!==null){k=k.next;do x.status="rejected",x.reason=C,Pc(x),x=x.next;while(x!==k)}m.action=null}function Pc(m){m=m.listeners;for(var x=0;x<m.length;x++)(0,m[x])()}function Dc(m,x){return x}function Yl(m,x){if(Br){var C=Er.formState;if(C!==null){e:{var k=yr;if(Br){if(cs){var W=e3(cs,ka);if(W){cs=t3(W),k=lb(W);break e}}fe(k)}k=!1}k&&(x=C[0])}}C=kr(),C.memoizedState=C.baseState=x,k={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dc,lastRenderedState:x},C.queue=k,C=Sl.bind(null,yr,k),k.dispatch=C,k=yl(!1);var ee=Mp.bind(null,yr,!1,k.queue);return k=kr(),W={state:x,dispatch:null,action:m,pending:null},k.queue=W,C=Ps.bind(null,yr,W,ee,C),W.dispatch=C,k.memoizedState=m,[x,C,!1]}function Xo(m){var x=rn();return io(x,Fn,m)}function io(m,x,C){if(x=gr(m,x,Dc)[0],m=vs(Di)[0],typeof x=="object"&&x!==null&&typeof x.then=="function")try{var k=Nn(x)}catch(Re){throw Re===Mo?hc:Re}else k=x;x=rn();var W=x.queue,ee=W.dispatch;return C!==x.memoizedState&&(yr.flags|=2048,xs(9,{destroy:void 0},Ro.bind(null,W,C),null)),[k,ee,m]}function Ro(m,x){m.action=x}function bl(m){var x=rn(),C=Fn;if(C!==null)return io(x,C,m);rn(),x=x.memoizedState,C=rn();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=yr.updateQueue,x===null&&(x=ss(),yr.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 Ga(){return rn().memoizedState}function Wa(m,x,C,k){var W=kr();yr.flags|=m,W.memoizedState=xs(1|x,{destroy:void 0},C,k===void 0?null:k)}function Ic(m,x,C,k){var W=rn();k=k===void 0?null:k;var ee=W.memoizedState.inst;Fn!==null&&k!==null&&Mn(k,Fn.memoizedState.deps)?W.memoizedState=xs(x,ee,C,k):(yr.flags|=m,W.memoizedState=xs(1|x,ee,C,k))}function ni(m,x){Wa(8390656,8,m,x)}function Fr(m,x){Ic(2048,8,m,x)}function Yo(m){yr.flags|=4;var x=yr.updateQueue;if(x===null)x=ss(),yr.updateQueue=x,x.events=[m];else{var C=x.events;C===null?x.events=[m]:C.push(m)}}function vr(m){var x=rn().memoizedState;return Yo({ref:x,nextImpl:m}),function(){if((Or&2)!==0)throw Error(i(440));return x.impl.apply(void 0,arguments)}}function _i(m,x){return Ic(4,2,m,x)}function Oi(m,x){return Ic(4,4,m,x)}function $r(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 Ea(m,x,C){C=C!=null?C.concat([m]):null,Ic(4,4,$r.bind(null,x,m),C)}function _l(){}function Kl(m,x){var C=rn();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 vo(m,x){var C=rn();x=x===void 0?null:x;var k=C.memoizedState;if(x!==null&&Mn(x,k[1]))return k[0];if(k=m(),Zr){B(!0);try{m()}finally{B(!1)}}return C.memoizedState=[k,x],k}function mi(m,x,C){return C===void 0||(wd&1073741824)!==0&&(Hr&261930)===0?m.memoizedState=x:(m.memoizedState=C,m=fd(),yr.lanes|=m,Md|=m,C)}function xh(m,x,C,k){return qs(C,x)?C:zh.current!==null?(m=mi(m,C,k),qs(m,x)||(es=!0),m):(wd&42)===0||(wd&1073741824)!==0&&(Hr&261930)===0?(es=!0,m.memoizedState=C):(m=fd(),yr.lanes|=m,Md|=m,x)}function rd(m,x,C,k,W){var ee=oc();Ur(ee!==0&&8>ee?ee:8);var Re=Hn.T,lt={};Hn.T=lt,Mp(m,!1,x,C);try{var It=W(),Wt=Hn.S;if(Wt!==null&&Wt(lt,It),It!==null&&typeof It=="object"&&typeof It.then=="function"){var cn=Ke(It,k);xo(m,x,cn,as(m))}else xo(m,x,k,as(m))}catch(Yt){xo(m,x,{then:function(){},status:"rejected",reason:Yt},as())}finally{Ur(ee),Re!==null&&lt.types!==null&&(Re.types=lt.types),Hn.T=Re}}function id(m){var x=m.memoizedState;if(x!==null)return x;x={memoizedState:Nh,baseState:Nh,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:Nh},next:null};var C={};return x.next={memoizedState:C,baseState:C,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:C},next:null},m.memoizedState=x,m=m.alternate,m!==null&&(m.memoizedState=x),x}function Qd(){return le(Rh)}function fa(){return rn().memoizedState}function Gi(){return rn().memoizedState}function Hs(m){for(var x=m.return;x!==null;){switch(x.tag){case 24:case 3:var C=as();m=on(C);var k=Ht(x,m,C);k!==null&&(Ss(k,x,C),kn(k,x,C)),x={cache:ve()},m.payload=x;return}x=x.return}}function ys(m,x,C){var k=as();C={lane:k,revertLane:0,gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null},yh(m)?ym(x,C):(C=St(m,x,C,k),C!==null&&(Ss(C,m,k),Jd(C,x,k)))}function Sl(m,x,C){var k=as();xo(m,x,C,k)}function xo(m,x,C,k){var W={lane:k,revertLane:0,gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null};if(yh(m))ym(x,W);else{var ee=m.alternate;if(m.lanes===0&&(ee===null||ee.lanes===0)&&(ee=x.lastRenderedReducer,ee!==null))try{var Re=x.lastRenderedState,lt=ee(Re,C);if(W.hasEagerState=!0,W.eagerState=lt,qs(lt,Re))return ct(m,x,W,0),Er===null&&Ue(),!1}catch{}finally{}if(C=St(m,x,W,k),C!==null)return Ss(C,m,k),Jd(C,x,k),!0}return!1}function Mp(m,x,C,k){if(k={lane:2,revertLane:ke(),gesture:null,action:k,hasEagerState:!1,eagerState:null,next:null},yh(m)){if(x)throw Error(i(479))}else x=St(m,C,k,2),x!==null&&Ss(x,m,2)}function yh(m){var x=m.alternate;return m===yr||x!==null&&x===yr}function ym(m,x){wr=Tr=!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 sd(m,x,C,k){x=m.memoizedState,C=C(k,x),C=C==null?x:Hv({},x,C),m.memoizedState=C,m.lanes===0&&(m.updateQueue.baseState=C)}function Tp(m,x,C,k,W,ee,Re){return m=m.stateNode,typeof m.shouldComponentUpdate=="function"?m.shouldComponentUpdate(k,ee,Re):x.prototype&&x.prototype.isPureReactComponent?!$e(C,k)||!$e(W,ee):!0}function Ep(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&&Xm.enqueueReplaceState(x,x.state,null)}function od(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=Hv({},C));for(var W in m)C[W]===void 0&&(C[W]=m[W])}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(W){setTimeout(function(){throw W})}}function ad(m,x,C){return C=on(C),C.tag=3,C.payload={element:null},C.callback=function(){Zl(m,x)},C}function bm(m){return m=on(m),m.tag=3,m}function Cp(m,x,C,k){var W=C.type.getDerivedStateFromError;if(typeof W=="function"){var ee=k.value;m.payload=function(){return W(ee)},m.callback=function(){Ql(x,C,k)}}var Re=C.stateNode;Re!==null&&typeof Re.componentDidCatch=="function"&&(m.callback=function(){Ql(x,C,k),typeof W!="function"&&(Td===null?Td=new Set([this]):Td.add(this));var lt=k.stack;this.componentDidCatch(k.value,{componentStack:lt!==null?lt:""})})}function _m(m,x,C,k,W){if(C.flags|=32768,k!==null&&typeof k=="object"&&typeof k.then=="function"){if(x=C.alternate,x!==null&&je(x,C,W,!0),C=Ja.current,C!==null){switch(C.tag){case 31:case 13:return el===null?Lp():C.alternate===null&&Es===0&&(Es=3),C.flags&=-257,C.flags|=65536,C.lanes=W,k===Cu?C.flags|=16384:(x=C.updateQueue,x===null?C.updateQueue=new Set([k]):x.add(k),Fp(m,k,W)),!1;case 22:return C.flags|=65536,k===Cu?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)),Fp(m,k,W)),!1}throw Error(i(435,C.tag))}return Fp(m,k,W),Lp(),!1}if(Br)return x=Ja.current,x!==null?((x.flags&65536)===0&&(x.flags|=256),x.flags|=65536,x.lanes=W,k!==dx&&(m=Error(i(422),{cause:k}),De(J(m,C)))):(k!==dx&&(x=Error(i(423),{cause:k}),De(J(x,C))),m=m.current.alternate,m.flags|=65536,W&=-W,m.lanes|=W,k=J(k,C),W=ad(m.stateNode,k,W),Xn(m,W),Es!==4&&(Es=2)),!1;var ee=Error(i(520),{cause:k});if(ee=J(ee,C),Km===null?Km=[ee]:Km.push(ee),Es!==4&&(Es=2),x===null)return!0;k=J(k,C),C=x;do{switch(C.tag){case 3:return C.flags|=65536,m=W&-W,C.lanes|=m,m=ad(C.stateNode,k,m),Xn(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"&&(Td===null||!Td.has(ee))))return C.flags|=65536,W&=-W,C.lanes|=W,W=bm(W),Cp(W,m,C,k),Xn(C,W),!1}C=C.return}while(C!==null);return!1}function Vs(m,x,C,k){x.child=m===null?Eb(x,null,C,k):Jo(x,m.child,C,k)}function Sm(m,x,C,k,W){C=C.render;var ee=x.ref;if("ref"in k){var Re={};for(var lt in k)lt!=="ref"&&(Re[lt]=k[lt])}else Re=k;return Xe(x),k=jn(m,x,C,Re,ee,W),lt=Yr(),m!==null&&!es?(ti(m,x,W),Ve(m,x,W)):(Br&&lt&&X(x),x.flags|=1,Vs(m,x,k,W),x.child)}function wm(m,x,C,k,W){if(m===null){var ee=C.type;return typeof ee=="function"&&!_h(ee)&&ee.defaultProps===void 0&&C.compare===null?(x.tag=15,x.type=ee,Mm(m,x,ee,k,W)):(m=md(C.type,null,k,x,x.mode,W),m.ref=x.ref,m.return=x,x.child=m)}if(ee=m.child,!ut(m,W)){var Re=ee.memoizedProps;if(C=C.compare,C=C!==null?C:$e,C(Re,k)&&m.ref===x.ref)return Ve(m,x,W)}return x.flags|=1,m=Tl(ee,k),m.ref=x.ref,m.return=x,x.child=m}function Mm(m,x,C,k,W){if(m!==null){var ee=m.memoizedProps;if($e(ee,k)&&m.ref===x.ref)if(es=!1,x.pendingProps=k=ee,ut(m,W))(m.flags&131072)!==0&&(es=!0);else return x.lanes=m.lanes,Ve(m,x,W)}return cd(m,x,C,k,W)}function Tm(m,x,C,k){var W=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,W=0;k!==null;)W=W|k.lanes|k.childLanes,k=k.sibling;k=W&~ee}else k=0,x.child=null;return ld(m,x,ee,C,k)}if((C&536870912)!==0)x.memoizedState={baseLanes:0,cachePool:null},m!==null&&ht(x,ee!==null?ee.cachePool:null),ee!==null?ir(x,ee):xe(),pt(x);else return k=x.lanes=536870912,ld(m,x,ee!==null?ee.baseLanes|C:C,C,k)}else ee!==null?(ht(x,ee.cachePool),ir(x,ee),$t(),x.memoizedState=null):(m!==null&&ht(x,null),xe(),$t());return Vs(m,x,W,C),x.child}function du(m,x){return m!==null&&m.tag===22||x.stateNode!==null||(x.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),x.sibling}function ld(m,x,C,k,W){var ee=it();return ee=ee===null?null:{parent:Ws?us._currentValue:us._currentValue2,pool:ee},x.memoizedState={baseLanes:C,cachePool:ee},m!==null&&ht(x,null),xe(),pt(x),m!==null&&je(m,x,k,!0),x.childLanes=W,null}function Ap(m,x){return x=hu({mode:x.mode,children:x.children},m.mode),x.ref=m.ref,m.child=x,x.return=m,x}function Np(m,x,C){return Jo(x,m.child,null,C),m=Ap(x,x.pendingProps),m.flags|=2,Zt(x),x.memoizedState=null,m}function Em(m,x,C){var k=x.pendingProps,W=(x.flags&128)!==0;if(x.flags&=-129,m===null){if(Br){if(k.mode==="hidden")return m=Ap(x,k),x.lanes=536870912,du(null,m);if(mt(x),(m=cs)?(m=ub(m,ka),m!==null&&(x.memoizedState={dehydrated:m,treeContext:cc!==null?{id:Zo,overflow:jc}:null,retryLane:536870912,hydrationErrors:null},C=Uy(m),C.return=x,x.child=C,So=x,cs=null)):m=null,m===null)throw fe(x);return x.lanes=536870912,null}return Ap(x,k)}var ee=m.memoizedState;if(ee!==null){var Re=ee.dehydrated;if(mt(x),W)if(x.flags&256)x.flags&=-257,x=Np(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||je(m,x,C,!1),W=(C&m.childLanes)!==0,es||W){if(k=Er,k!==null&&(Re=F(k,C),Re!==0&&Re!==ee.retryLane))throw ee.retryLane=Re,kt(m,Re),Ss(k,m,Re),Da;Lp(),x=Np(m,x,C)}else m=ee.treeContext,ls&&(cs=s3(Re),So=x,Br=!0,Eu=null,ka=!1,m!==null&&ie(x,m)),x=Ap(x,k),x.flags|=4096;return x}return m=Tl(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 cd(m,x,C,k,W){return Xe(x),C=jn(m,x,C,k,void 0,W),k=Yr(),m!==null&&!es?(ti(m,x,W),Ve(m,x,W)):(Br&&k&&X(x),x.flags|=1,Vs(m,x,C,W),x.child)}function Ds(m,x,C,k,W,ee){return Xe(x),x.updateQueue=null,C=ln(x,k,C,W),Gn(m),k=Yr(),m!==null&&!es?(ti(m,x,ee),Ve(m,x,ee)):(Br&&k&&X(x),x.flags|=1,Vs(m,x,C,ee),x.child)}function fu(m,x,C,k,W){if(Xe(x),x.stateNode===null){var ee=wu,Re=C.contextType;typeof Re=="object"&&Re!==null&&(ee=le(Re)),ee=new C(k,ee),x.memoizedState=ee.state!==null&&ee.state!==void 0?ee.state:null,ee.updater=Xm,x.stateNode=ee,ee._reactInternals=x,ee=x.stateNode,ee.props=k,ee.state=x.memoizedState,ee.refs={},hn(x),Re=C.contextType,ee.context=typeof Re=="object"&&Re!==null?le(Re):wu,ee.state=x.memoizedState,Re=C.getDerivedStateFromProps,typeof Re=="function"&&(sd(x,C,Re,k),ee.state=x.memoizedState),typeof C.getDerivedStateFromProps=="function"||typeof ee.getSnapshotBeforeUpdate=="function"||typeof ee.UNSAFE_componentWillMount!="function"&&typeof ee.componentWillMount!="function"||(Re=ee.state,typeof ee.componentWillMount=="function"&&ee.componentWillMount(),typeof ee.UNSAFE_componentWillMount=="function"&&ee.UNSAFE_componentWillMount(),Re!==ee.state&&Xm.enqueueReplaceState(ee,ee.state,null),Qn(x,k,ee,W),zn(),ee.state=x.memoizedState),typeof ee.componentDidMount=="function"&&(x.flags|=4194308),k=!0}else if(m===null){ee=x.stateNode;var lt=x.memoizedProps,It=od(C,lt);ee.props=It;var Wt=ee.context,cn=C.contextType;Re=wu,typeof cn=="object"&&cn!==null&&(Re=le(cn));var Yt=C.getDerivedStateFromProps;cn=typeof Yt=="function"||typeof ee.getSnapshotBeforeUpdate=="function",lt=x.pendingProps!==lt,cn||typeof ee.UNSAFE_componentWillReceiveProps!="function"&&typeof ee.componentWillReceiveProps!="function"||(lt||Wt!==Re)&&Ep(x,ee,k,Re),Al=!1;var bn=x.memoizedState;ee.state=bn,Qn(x,k,ee,W),zn(),Wt=x.memoizedState,lt||bn!==Wt||Al?(typeof Yt=="function"&&(sd(x,C,Yt,k),Wt=x.memoizedState),(It=Al||Tp(x,C,It,k,bn,Wt,Re))?(cn||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=Re,k=It):(typeof ee.componentDidMount=="function"&&(x.flags|=4194308),k=!1)}else{ee=x.stateNode,Lt(m,x),Re=x.memoizedProps,cn=od(C,Re),ee.props=cn,Yt=x.pendingProps,bn=ee.context,Wt=C.contextType,It=wu,typeof Wt=="object"&&Wt!==null&&(It=le(Wt)),lt=C.getDerivedStateFromProps,(Wt=typeof lt=="function"||typeof ee.getSnapshotBeforeUpdate=="function")||typeof ee.UNSAFE_componentWillReceiveProps!="function"&&typeof ee.componentWillReceiveProps!="function"||(Re!==Yt||bn!==It)&&Ep(x,ee,k,It),Al=!1,bn=x.memoizedState,ee.state=bn,Qn(x,k,ee,W),zn();var hr=x.memoizedState;Re!==Yt||bn!==hr||Al||m!==null&&m.dependencies!==null&&be(m.dependencies)?(typeof lt=="function"&&(sd(x,C,lt,k),hr=x.memoizedState),(cn=Al||Tp(x,C,cn,k,bn,hr,It)||m!==null&&m.dependencies!==null&&be(m.dependencies))?(Wt||typeof ee.UNSAFE_componentWillUpdate!="function"&&typeof ee.componentWillUpdate!="function"||(typeof ee.componentWillUpdate=="function"&&ee.componentWillUpdate(k,hr,It),typeof ee.UNSAFE_componentWillUpdate=="function"&&ee.UNSAFE_componentWillUpdate(k,hr,It)),typeof ee.componentDidUpdate=="function"&&(x.flags|=4),typeof ee.getSnapshotBeforeUpdate=="function"&&(x.flags|=1024)):(typeof ee.componentDidUpdate!="function"||Re===m.memoizedProps&&bn===m.memoizedState||(x.flags|=4),typeof ee.getSnapshotBeforeUpdate!="function"||Re===m.memoizedProps&&bn===m.memoizedState||(x.flags|=1024),x.memoizedProps=k,x.memoizedState=hr),ee.props=k,ee.state=hr,ee.context=It,k=cn):(typeof ee.componentDidUpdate!="function"||Re===m.memoizedProps&&bn===m.memoizedState||(x.flags|=4),typeof ee.getSnapshotBeforeUpdate!="function"||Re===m.memoizedProps&&bn===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=Jo(x,m.child,null,W),x.child=Jo(x,null,C,W)):Vs(m,x,C,W),x.memoizedState=ee.state,m=x.child):m=Ve(m,x,W),m}function bs(m,x,C,k){return Ge(),x.flags|=256,Vs(m,x,C,k),x.child}function Rp(m){return{baseLanes:m,cachePool:Je()}}function bh(m,x,C){return m=m!==null?m.childLanes&~C:0,x&&(m|=Ia),m}function ud(m,x,C){var k=x.pendingProps,W=!1,ee=(x.flags&128)!==0,Re;if((Re=ee)||(Re=m!==null&&m.memoizedState===null?!1:(zs.current&2)!==0),Re&&(W=!0,x.flags&=-129),Re=(x.flags&32)!==0,x.flags&=-33,m===null){if(Br){if(W?bt(x):$t(),(m=cs)?(m=c3(m,ka),m!==null&&(x.memoizedState={dehydrated:m,treeContext:cc!==null?{id:Zo,overflow:jc}:null,retryLane:536870912,hydrationErrors:null},C=Uy(m),C.return=x,x.child=C,So=x,cs=null)):m=null,m===null)throw fe(x);return Kv(m)?x.lanes=32:x.lanes=536870912,null}var lt=k.children;return k=k.fallback,W?($t(),W=x.mode,lt=hu({mode:"hidden",children:lt},W),k=ic(k,W,C,null),lt.return=x,k.return=x,lt.sibling=k,x.child=lt,k=x.child,k.memoizedState=Rp(C),k.childLanes=bh(m,Re,C),x.memoizedState=jh,du(null,k)):(bt(x),kp(x,lt))}var It=m.memoizedState;if(It!==null&&(lt=It.dehydrated,lt!==null)){if(ee)x.flags&256?(bt(x),x.flags&=-257,x=Oc(m,x,C)):x.memoizedState!==null?($t(),x.child=m.child,x.flags|=128,x=null):($t(),lt=k.fallback,W=x.mode,k=hu({mode:"visible",children:k.children},W),lt=ic(lt,W,C,null),lt.flags|=2,k.return=x,lt.return=x,k.sibling=lt,x.child=k,Jo(x,m.child,null,C),k=x.child,k.memoizedState=Rp(C),k.childLanes=bh(m,Re,C),x.memoizedState=jh,x=du(null,k));else if(bt(x),Kv(lt))Re=Zv(lt).digest,k=Error(i(419)),k.stack="",k.digest=Re,De({value:k,source:null,stack:null}),x=Oc(m,x,C);else if(es||je(m,x,C,!1),Re=(C&m.childLanes)!==0,es||Re){if(Re=Er,Re!==null&&(k=F(Re,C),k!==0&&k!==It.retryLane))throw It.retryLane=k,kt(m,k),Ss(Re,m,k),Da;hf(lt)||Lp(),x=Oc(m,x,C)}else hf(lt)?(x.flags|=192,x.child=m.child,x=null):(m=It.treeContext,ls&&(cs=o3(lt),So=x,Br=!0,Eu=null,ka=!1,m!==null&&ie(x,m)),x=kp(x,k.children),x.flags|=4096);return x}return W?($t(),lt=k.fallback,W=x.mode,It=m.child,ee=It.sibling,k=Tl(It,{mode:"hidden",children:k.children}),k.subtreeFlags=It.subtreeFlags&65011712,ee!==null?lt=Tl(ee,lt):(lt=ic(lt,W,C,null),lt.flags|=2),lt.return=x,k.return=x,k.sibling=lt,x.child=k,du(null,k),k=x.child,lt=m.child.memoizedState,lt===null?lt=Rp(C):(W=lt.cachePool,W!==null?(It=Ws?us._currentValue:us._currentValue2,W=W.parent!==It?{parent:It,pool:It}:W):W=Je(),lt={baseLanes:lt.baseLanes|C,cachePool:W}),k.memoizedState=lt,k.childLanes=bh(m,Re,C),x.memoizedState=jh,du(m.child,k)):(bt(x),C=m.child,m=C.sibling,C=Tl(C,{mode:"visible",children:k.children}),C.return=x,C.sibling=null,m!==null&&(Re=x.deletions,Re===null?(x.deletions=[m],x.flags|=16):Re.push(m)),x.child=C,x.memoizedState=null,C)}function kp(m,x){return x=hu({mode:"visible",children:x},m.mode),x.return=m,m.child=x}function hu(m,x){return m=n(22,m,null,x),m.lanes=0,m}function Oc(m,x,C){return Jo(x,m.child,null,C),m=kp(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),ne(m.return,x,C)}function Ce(m,x,C,k,W,ee){var Re=m.memoizedState;Re===null?m.memoizedState={isBackwards:x,rendering:null,renderingStartTime:0,last:k,tail:C,tailMode:W,treeForkCount:ee}:(Re.isBackwards=x,Re.rendering=null,Re.renderingStartTime=0,Re.last=k,Re.tail=C,Re.tailMode=W,Re.treeForkCount=ee)}function Be(m,x,C){var k=x.pendingProps,W=k.revealOrder,ee=k.tail;k=k.children;var Re=zs.current,lt=(Re&2)!==0;if(lt?(Re=Re&1|2,x.flags|=128):Re&=1,b(zs,Re),Vs(m,x,k,C),k=Br?Wm:0,!lt&&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(W){case"forwards":for(C=x.child,W=null;C!==null;)m=C.alternate,m!==null&&en(m)===null&&(W=C),C=C.sibling;C=W,C===null?(W=x.child,x.child=null):(W=C.sibling,C.sibling=null),Ce(x,!1,W,C,ee,k);break;case"backwards":case"unstable_legacy-backwards":for(C=null,W=x.child,x.child=null;W!==null;){if(m=W.alternate,m!==null&&en(m)===null){x.child=W;break}m=W.sibling,W.sibling=C,C=W,W=m}Ce(x,!0,C,null,ee,k);break;case"together":Ce(x,!1,null,null,void 0,k);break;default:x.memoizedState=null}return x.child}function Ve(m,x,C){if(m!==null&&(x.dependencies=m.dependencies),Md|=x.lanes,(C&x.childLanes)===0)if(m!==null){if(je(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=Tl(m,m.pendingProps),x.child=C,C.return=x;m.sibling!==null;)m=m.sibling,C=C.sibling=Tl(m,m.pendingProps),C.return=x;C.sibling=null}return x.child}function ut(m,x){return(m.lanes&x)!==0?!0:(m=m.dependencies,!!(m!==null&&be(m)))}function _t(m,x,C){switch(x.tag){case 3:ae(x,x.stateNode.containerInfo),he(x,us,m.memoizedState.cache),Ge();break;case 27:case 5:ce(x);break;case 4:ae(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,mt(x),null;break;case 13:var k=x.memoizedState;if(k!==null)return k.dehydrated!==null?(bt(x),x.flags|=128,null):(C&x.child.childLanes)!==0?ud(m,x,C):(bt(x),m=Ve(m,x,C),m!==null?m.sibling:null);bt(x);break;case 19:var W=(m.flags&128)!==0;if(k=(C&x.childLanes)!==0,k||(je(m,x,C,!1),k=(C&x.childLanes)!==0),W){if(k)return Be(m,x,C);x.flags|=128}if(W=x.memoizedState,W!==null&&(W.rendering=null,W.tail=null,W.lastEffect=null),b(zs,zs.current),k)break;return null;case 22:return x.lanes=0,Tm(m,x,C,x.pendingProps);case 24:he(x,us,m.memoizedState.cache)}return Ve(m,x,C)}function Ft(m,x,C){if(m!==null)if(m.memoizedProps!==x.pendingProps)es=!0;else{if(!ut(m,C)&&(x.flags&128)===0)return es=!1,_t(m,x,C);es=(m.flags&131072)!==0}else es=!1,Br&&(x.flags&1048576)!==0&&z(x,Wm,x.index);switch(x.lanes=0,x.tag){case 16:e:{var k=x.pendingProps;if(m=Ye(x.elementType),x.type=m,typeof m=="function")_h(m)?(k=od(m,k),x.tag=1,x=fu(null,x,m,k,C)):(x.tag=0,x=cd(null,x,m,k,C));else{if(m!=null){var W=m.$$typeof;if(W===Up){x.tag=11,x=Sm(null,x,m,k,C);break e}else if(W===Gv){x.tag=14,x=wm(null,x,m,k,C);break e}}throw x=h(m)||m,Error(i(306,x,""))}}return x;case 0:return cd(m,x,x.type,x.pendingProps,C);case 1:return k=x.type,W=od(k,x.pendingProps),fu(m,x,k,W,C);case 3:e:{if(ae(x,x.stateNode.containerInfo),m===null)throw Error(i(387));var ee=x.pendingProps;W=x.memoizedState,k=W.element,Lt(m,x),Qn(x,ee,null,C);var Re=x.memoizedState;if(ee=Re.cache,he(x,us,ee),ee!==W.cache&&We(x,[us],C,!0),zn(),ee=Re.element,ls&&W.isDehydrated)if(W={element:ee,isDehydrated:!1,cache:Re.cache},x.updateQueue.baseState=W,x.memoizedState=W,x.flags&256){x=bs(m,x,ee,C);break e}else if(ee!==k){k=J(Error(i(424)),x),De(k),x=bs(m,x,ee,C);break e}else for(ls&&(cs=i3(x.stateNode.containerInfo),So=x,Br=!0,Eu=null,ka=!0),C=Eb(x,null,ee,C),x.child=C;C;)C.flags=C.flags&-3|4096,C=C.sibling;else{if(Ge(),ee===k){x=Ve(m,x,C);break e}Vs(m,x,ee,C)}x=x.child}return x;case 26:if(ac)return Jl(m,x),m===null?(C=mb(x.type,null,x.pendingProps,null))?x.memoizedState=C:Br||(x.stateNode=tx(x.type,x.pendingProps,Qo.current,x)):x.memoizedState=mb(x.type,m.memoizedProps,x.pendingProps,m.memoizedState),null;case 27:if(_o)return ce(x),m===null&&_o&&Br&&(k=x.stateNode=nx(x.type,x.pendingProps,Qo.current,zo.current,!1),So=x,ka=!0,cs=cb(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&&Br&&(x3(x.type,x.pendingProps,zo.current),(W=k=cs)&&(k=a3(k,x.type,x.pendingProps,ka),k!==null?(x.stateNode=k,So=x,cs=r3(k),ka=!1,W=!0):W=!1),W||fe(x)),ce(x),W=x.type,ee=x.pendingProps,Re=m!==null?m.memoizedProps:null,k=ee.children,Ra(W,ee)?k=null:Re!==null&&Ra(W,Re)&&(x.flags|=32),x.memoizedState!==null&&(W=jn(m,x,sr,null,null,C),Ws?Rh._currentValue=W:Rh._currentValue2=W),Jl(m,x),Vs(m,x,k,C),x.child;case 6:return m===null&&Br&&(pb(x.pendingProps,zo.current),(m=C=cs)&&(C=l3(C,x.pendingProps,ka),C!==null?(x.stateNode=C,So=x,cs=null,m=!0):m=!1),m||fe(x)),null;case 13:return ud(m,x,C);case 4:return ae(x,x.stateNode.containerInfo),k=x.pendingProps,m===null?x.child=Jo(x,null,k,C):Vs(m,x,k,C),x.child;case 11:return Sm(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 W=x.type._context,k=x.pendingProps.children,Xe(x),W=le(W),k=k(W),x.flags|=1,Vs(m,x,k,C),x.child;case 14:return wm(m,x,x.type,x.pendingProps,C);case 15:return Mm(m,x,x.type,x.pendingProps,C);case 19:return Be(m,x,C);case 31:return Em(m,x,C);case 22:return Tm(m,x,C,x.pendingProps);case 24:return Xe(x),k=le(us),m===null?(W=it(),W===null&&(W=Er,ee=ve(),W.pooledCache=ee,ee.refCount++,ee!==null&&(W.pooledCacheLanes|=C),W=ee),x.memoizedState={parent:k,cache:W},hn(x),he(x,us,W)):((m.lanes&C)!==0&&(Lt(m,x),Qn(x,null,null,C),zn()),W=m.memoizedState,ee=x.memoizedState,W.parent!==k?(W={parent:k,cache:k},x.memoizedState=W,x.lanes===0&&(x.memoizedState=x.updateQueue.baseState=W),he(x,us,k)):(k=ee.cache,he(x,us,k),k!==W.cache&&We(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 Gt(m){m.flags|=4}function Qt(m){El&&(m.flags|=8)}function gn(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 xn(m,x,C,k){if(Xr)for(C=x.child;C!==null;){if(C.tag===5||C.tag===6)zm(m,C.stateNode);else if(!(C.tag===4||_o&&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(El)for(var W=x.child;W!==null;){if(W.tag===5){var ee=W.stateNode;C&&k&&(ee=Jw(ee,W.type,W.memoizedProps)),zm(m,ee)}else if(W.tag===6)ee=W.stateNode,C&&k&&(ee=ab(ee,W.memoizedProps)),zm(m,ee);else if(W.tag!==4){if(W.tag===22&&W.memoizedState!==null)ee=W.child,ee!==null&&(ee.return=W),xn(m,W,!0,!0);else if(W.child!==null){W.child.return=W,W=W.child;continue}}if(W===x)break;for(;W.sibling===null;){if(W.return===null||W.return===x)return;W=W.return}W.sibling.return=W.return,W=W.sibling}}function Sn(m,x,C,k){var W=!1;if(El)for(var ee=x.child;ee!==null;){if(ee.tag===5){var Re=ee.stateNode;C&&k&&(Re=Jw(Re,ee.type,ee.memoizedProps)),sb(m,Re)}else if(ee.tag===6)Re=ee.stateNode,C&&k&&(Re=ab(Re,ee.memoizedProps)),sb(m,Re);else if(ee.tag!==4){if(ee.tag===22&&ee.memoizedState!==null)W=ee.child,W!==null&&(W.return=ee),Sn(m,ee,!0,!0),W=!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 W;ee=ee.return}ee.sibling.return=ee.return,ee=ee.sibling}return W}function er(m,x){if(El&&gn(m,x)){m=x.stateNode;var C=m.containerInfo,k=ib();Sn(k,x,!1,!1),m.pendingChildren=k,Gt(x),Qw(C,k)}}function Kr(m,x,C,k){if(Xr)m.memoizedProps!==k&&Gt(x);else if(El){var W=m.stateNode,ee=m.memoizedProps;if((m=gn(m,x))||ee!==k){var Re=zo.current;ee=Zw(W,C,ee,k,!m,null),ee===W?x.stateNode=W:(Qt(x),Ya(ee,C,k,Re)&&Gt(x),x.stateNode=ee,m&&xn(ee,x,!1,!1))}else x.stateNode=W}}function tr(m,x,C,k,W){if((m.mode&32)!==0&&(C===null?jm(x,k):Wp(x,C,k))){if(m.flags|=16777216,(W&335544128)===W||qy(x,k))if(ws(m.stateNode,x,k))m.flags|=8192;else if(qr())m.flags|=8192;else throw Pa=Cu,hx}else m.flags&=-16777217}function fr(m,x){if(yb(x)){if(m.flags|=16777216,!bb(x))if(qr())m.flags|=8192;else throw Pa=Cu,hx}else m.flags&=-16777217}function Bn(m,x){x!==null&&(m.flags|=4),m.flags&16384&&(x=m.tag!==22?N():536870912,m.lanes|=x,e0|=x)}function An(m,x){if(!Br)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 Wn(m){var x=m.alternate!==null&&m.alternate.child===m.child,C=0,k=0;if(x)for(var W=m.child;W!==null;)C|=W.lanes|W.childLanes,k|=W.subtreeFlags&65011712,k|=W.flags&65011712,W.return=m,W=W.sibling;else for(W=m.child;W!==null;)C|=W.lanes|W.childLanes,k|=W.subtreeFlags,k|=W.flags,W.return=m,W=W.sibling;return m.subtreeFlags|=k,m.childLanes=C,x}function Ji(m,x,C){var k=x.pendingProps;switch(V(x),x.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Wn(x),null;case 1:return Wn(x),null;case 3:return C=x.stateNode,k=null,m!==null&&(k=m.memoizedState.cache),x.memoizedState.cache!==k&&(x.flags|=2048),Le(us),re(),C.pendingContext&&(C.context=C.pendingContext,C.pendingContext=null),(m===null||m.child===null)&&(Ee(x)?Gt(x):m===null||m.memoizedState.isDehydrated&&(x.flags&256)===0||(x.flags|=1024,_e())),er(m,x),Wn(x),null;case 26:if(ac){var W=x.type,ee=x.memoizedState;return m===null?(Gt(x),ee!==null?(Wn(x),fr(x,ee)):(Wn(x),tr(x,W,null,k,C))):ee?ee!==m.memoizedState?(Gt(x),Wn(x),fr(x,ee)):(Wn(x),x.flags&=-16777217):(ee=m.memoizedProps,Xr?ee!==k&&Gt(x):Kr(m,x,W,k),Wn(x),tr(x,W,ee,k,C)),null}case 27:if(_o){if(oe(x),C=Qo.current,W=x.type,m!==null&&x.stateNode!=null)Xr?m.memoizedProps!==k&&Gt(x):Kr(m,x,W,k);else{if(!k){if(x.stateNode===null)throw Error(i(166));return Wn(x),null}m=zo.current,Ee(x)?me(x,m):(m=nx(W,k,C,m,!0),x.stateNode=m,Gt(x))}return Wn(x),null}case 5:if(oe(x),W=x.type,m!==null&&x.stateNode!=null)Kr(m,x,W,k);else{if(!k){if(x.stateNode===null)throw Error(i(166));return Wn(x),null}if(ee=zo.current,Ee(x))me(x,ee),m3(x.stateNode,W,k,ee)&&(x.flags|=64);else{var Re=Wy(W,k,Qo.current,ee,x);Qt(x),xn(Re,x,!1,!1),x.stateNode=Re,Ya(Re,W,k,ee)&&Gt(x)}}return Wn(x),tr(x,x.type,m===null?null:m.memoizedProps,x.pendingProps,C),null;case 6:if(m&&x.stateNode!=null)C=m.memoizedProps,Xr?C!==k&&Gt(x):El&&(C!==k?(m=Qo.current,C=zo.current,Qt(x),x.stateNode=xd(k,m,C,x)):x.stateNode=m.stateNode);else{if(typeof k!="string"&&x.stateNode===null)throw Error(i(166));if(m=Qo.current,C=zo.current,Ee(x)){if(!ls)throw Error(i(176));if(m=x.stateNode,C=x.memoizedProps,k=null,W=So,W!==null)switch(W.tag){case 27:case 5:k=W.memoizedProps}jE(m,C,x,k)||fe(x,!0)}else Qt(x),x.stateNode=xd(k,m,C,x)}return Wn(x),null;case 31:if(C=x.memoizedState,m===null||m.memoizedState!==null){if(k=Ee(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));db(m,x)}else Ge(),(x.flags&128)===0&&(x.memoizedState=null),x.flags|=4;Wn(x),m=!1}else C=_e(),m!==null&&m.memoizedState!==null&&(m.memoizedState.hydrationErrors=C),m=!0;if(!m)return x.flags&256?(Zt(x),x):(Zt(x),null);if((x.flags&128)!==0)throw Error(i(558))}return Wn(x),null;case 13:if(k=x.memoizedState,m===null||m.memoizedState!==null&&m.memoizedState.dehydrated!==null){if(W=Ee(x),k!==null&&k.dehydrated!==null){if(m===null){if(!W)throw Error(i(318));if(!ls)throw Error(i(344));if(W=x.memoizedState,W=W!==null?W.dehydrated:null,!W)throw Error(i(317));d3(W,x)}else Ge(),(x.flags&128)===0&&(x.memoizedState=null),x.flags|=4;Wn(x),W=!1}else W=_e(),m!==null&&m.memoizedState!==null&&(m.memoizedState.hydrationErrors=W),W=!0;if(!W)return x.flags&256?(Zt(x),x):(Zt(x),null)}return Zt(x),(x.flags&128)!==0?(x.lanes=C,x):(C=k!==null,m=m!==null&&m.memoizedState!==null,C&&(k=x.child,W=null,k.alternate!==null&&k.alternate.memoizedState!==null&&k.alternate.memoizedState.cachePool!==null&&(W=k.alternate.memoizedState.cachePool.pool),ee=null,k.memoizedState!==null&&k.memoizedState.cachePool!==null&&(ee=k.memoizedState.cachePool.pool),ee!==W&&(k.flags|=2048)),C!==m&&C&&(x.child.flags|=8192),Bn(x,x.updateQueue),Wn(x),null);case 4:return re(),er(m,x),m===null&&Li(x.stateNode.containerInfo),Wn(x),null;case 10:return Le(x.type),Wn(x),null;case 19:if(v(zs),k=x.memoizedState,k===null)return Wn(x),null;if(W=(x.flags&128)!==0,ee=k.rendering,ee===null)if(W)An(k,!1);else{if(Es!==0||m!==null&&(m.flags&128)!==0)for(m=x.child;m!==null;){if(ee=en(m),ee!==null){for(x.flags|=128,An(k,!1),m=ee.updateQueue,x.updateQueue=m,Bn(x,m),x.subtreeFlags=0,m=C,C=x.child;C!==null;)Fv(C,m),C=C.sibling;return b(zs,zs.current&1|2),Br&&H(x,k.treeForkCount),x.child}m=m.sibling}k.tail!==null&&ha()>Mf&&(x.flags|=128,W=!0,An(k,!1),x.lanes=4194304)}else{if(!W)if(m=en(ee),m!==null){if(x.flags|=128,W=!0,m=m.updateQueue,x.updateQueue=m,Bn(x,m),An(k,!0),k.tail===null&&k.tailMode==="hidden"&&!ee.alternate&&!Br)return Wn(x),null}else 2*ha()-k.renderingStartTime>Mf&&C!==536870912&&(x.flags|=128,W=!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=ha(),m.sibling=null,C=zs.current,b(zs,W?C&1|2:C&1),Br&&H(x,k.treeForkCount),m):(Wn(x),null);case 22:case 23:return Zt(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&&(Wn(x),x.subtreeFlags&6&&(x.flags|=8192)):Wn(x),C=x.updateQueue,C!==null&&Bn(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),Le(us),Wn(x),null;case 25:return null;case 30:return null}throw Error(i(156,x.tag))}function Is(m,x){switch(V(x),x.tag){case 1:return m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 3:return Le(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 oe(x),null;case 31:if(x.memoizedState!==null){if(Zt(x),x.alternate===null)throw Error(i(340));Ge()}return m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 13:if(Zt(x),m=x.memoizedState,m!==null&&m.dehydrated!==null){if(x.alternate===null)throw Error(i(340));Ge()}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 Le(x.type),null;case 22:case 23:return Zt(x),ot(),m!==null&&v(gf),m=x.flags,m&65536?(x.flags=m&-65537|128,x):null;case 24:return Le(us),null;case 25:return null;default:return null}}function gi(m,x){switch(V(x),x.tag){case 3:Le(us),re();break;case 26:case 27:case 5:oe(x);break;case 4:re();break;case 31:x.memoizedState!==null&&Zt(x);break;case 13:Zt(x);break;case 19:v(zs);break;case 10:Le(x.type);break;case 22:case 23:Zt(x),ot(),m!==null&&v(gf);break;case 24:Le(us)}}function ai(m,x){try{var C=x.updateQueue,k=C!==null?C.lastEffect:null;if(k!==null){var W=k.next;C=W;do{if((C.tag&m)===m){k=void 0;var ee=C.create,Re=C.inst;k=ee(),Re.destroy=k}C=C.next}while(C!==W)}}catch(lt){nr(x,x.return,lt)}}function os(m,x,C){try{var k=x.updateQueue,W=k!==null?k.lastEffect:null;if(W!==null){var ee=W.next;k=ee;do{if((k.tag&m)===m){var Re=k.inst,lt=Re.destroy;if(lt!==void 0){Re.destroy=void 0,W=x;var It=C,Wt=lt;try{Wt()}catch(cn){nr(W,It,cn)}}}k=k.next}while(k!==ee)}}catch(cn){nr(x,x.return,cn)}}function Os(m){var x=m.updateQueue;if(x!==null){var C=m.stateNode;try{lr(x,C)}catch(k){nr(m,m.return,k)}}}function Ko(m,x,C){C.props=od(m.type,m.memoizedProps),C.state=m.memoizedState;try{C.componentWillUnmount()}catch(k){nr(m,x,k)}}function ko(m,x){try{var C=m.ref;if(C!==null){switch(m.tag){case 26:case 27:case 5:var k=Hp(m.stateNode);break;case 30:k=m.stateNode;break;default:k=m.stateNode}typeof C=="function"?m.refCleanup=C(k):C.current=k}}catch(W){nr(m,x,W)}}function Hi(m,x){var C=m.ref,k=m.refCleanup;if(C!==null)if(typeof k=="function")try{k()}catch(W){nr(m,x,W)}finally{m.refCleanup=null,m=m.alternate,m!=null&&(m.refCleanup=null)}else if(typeof C=="function")try{C(null)}catch(W){nr(m,x,W)}else C.current=null}function Gs(m){var x=m.type,C=m.memoizedProps,k=m.stateNode;try{Vw(k,x,C,m)}catch(W){nr(m,m.return,W)}}function Po(m,x,C){try{Gw(m.stateNode,m.type,C,x,m)}catch(k){nr(m,m.return,k)}}function Ca(m){return m.tag===5||m.tag===3||(ac?m.tag===26:!1)||(_o?m.tag===27&&kh(m.type):!1)||m.tag===4}function so(m){e:for(;;){for(;m.sibling===null;){if(m.return===null||Ca(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(_o&&m.tag===27&&kh(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 oo(m,x,C){var k=m.tag;if(k===5||k===6)m=m.stateNode,x?$w(C,m,x):eb(C,m);else if(k!==4&&(_o&&k===27&&kh(m.type)&&(C=m.stateNode,x=null),m=m.child,m!==null))for(oo(m,x,C),m=m.sibling;m!==null;)oo(m,x,C),m=m.sibling}function yo(m,x,C){var k=m.tag;if(k===5||k===6)m=m.stateNode,x?Ww(C,m,x):Jy(C,m);else if(k!==4&&(_o&&k===27&&kh(m.type)&&(C=m.stateNode),m=m.child,m!==null))for(yo(m,x,C),m=m.sibling;m!==null;)yo(m,x,C),m=m.sibling}function Lc(m,x,C){m=m.containerInfo;try{ob(m,C)}catch(k){nr(x,x.return,k)}}function Do(m){var x=m.stateNode,C=m.memoizedProps;try{lo(m.type,C,x,m)}catch(k){nr(m,m.return,k)}}function Nv(m,x){for(Wv(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 W=x[k];W.ref.impl=W.nextImpl}break;case 11:case 15:break;case 1:if((x&1024)!==0&&C!==null){x=void 0,k=m,W=C.memoizedProps,C=C.memoizedState;var ee=k.stateNode;try{var Re=od(k.type,W);x=ee.getSnapshotBeforeUpdate(Re,C),ee.__reactInternalSnapshotBeforeUpdate=x}catch(lt){nr(k,k.return,lt)}}break;case 3:(x&1024)!==0&&Xr&&rb(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 kw(m,x,C){var k=C.flags;switch(C.tag){case 0:case 11:case 15:Aa(m,C),k&4&&ai(5,C);break;case 1:if(Aa(m,C),k&4)if(m=C.stateNode,x===null)try{m.componentDidMount()}catch(Re){nr(C,C.return,Re)}else{var W=od(C.type,x.memoizedProps);x=x.memoizedState;try{m.componentDidUpdate(W,x,m.__reactInternalSnapshotBeforeUpdate)}catch(Re){nr(C,C.return,Re)}}k&64&&Os(C),k&512&&ko(C,C.return);break;case 3:if(Aa(m,C),k&64&&(k=C.updateQueue,k!==null)){if(m=null,C.child!==null)switch(C.child.tag){case 27:case 5:m=Hp(C.child.stateNode);break;case 1:m=C.child.stateNode}try{lr(k,m)}catch(Re){nr(C,C.return,Re)}}break;case 27:_o&&x===null&&k&4&&Do(C);case 26:case 5:if(Aa(m,C),x===null){if(k&4)Gs(C);else if(k&64){m=C.type,x=C.memoizedProps,W=C.stateNode;try{h3(W,m,x,C)}catch(Re){nr(C,C.return,Re)}}}k&512&&ko(C,C.return);break;case 12:Aa(m,C);break;case 31:Aa(m,C),k&4&&tc(m,C);break;case 13:Aa(m,C),k&4&&Am(m,C),k&64&&(k=C.memoizedState,k!==null&&(k=k.dehydrated,k!==null&&(C=OE.bind(null,C),Qv(k,C))));break;case 22:if(k=C.memoizedState!==null||js,!k){x=x!==null&&x.memoizedState!==null||Fs,W=js;var ee=Fs;js=k,(Fs=x)&&!ee?rc(m,C,(C.subtreeFlags&8772)!==0):Aa(m,C),js=W,Fs=ee}break;case 30:break;default:Aa(m,C)}}function Ly(m){var x=m.alternate;x!==null&&(m.alternate=null,Ly(x)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(x=m.stateNode,x!==null&&$v(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;)Cm(m,x,C),C=C.sibling}function Cm(m,x,C){if(Qa&&typeof Qa.onCommitFiberUnmount=="function")try{Qa.onCommitFiberUnmount(Ih,C)}catch{}switch(C.tag){case 26:if(ac){Fs||Hi(C,x),ec(m,x,C),C.memoizedState?pf(C.memoizedState):C.stateNode&&xb(C.stateNode);break}case 27:if(_o){Fs||Hi(C,x);var k=Ts,W=Ys;kh(C.type)&&(Ts=C.stateNode,Ys=!1),ec(m,x,C),Lo(C.stateNode),Ts=k,Ys=W;break}case 5:Fs||Hi(C,x);case 6:if(Xr){if(k=Ts,W=Ys,Ts=null,ec(m,x,C),Ts=k,Ys=W,Ts!==null)if(Ys)try{tb(Ts,C.stateNode)}catch(ee){nr(C,x,ee)}else try{qw(Ts,C.stateNode)}catch(ee){nr(C,x,ee)}}else ec(m,x,C);break;case 18:Xr&&Ts!==null&&(Ys?Jv(Ts,C.stateNode):hb(Ts,C.stateNode));break;case 4:Xr?(k=Ts,W=Ys,Ts=C.stateNode.containerInfo,Ys=!0,ec(m,x,C),Ts=k,Ys=W):(El&&Lc(C.stateNode,C,ib()),ec(m,x,C));break;case 0:case 11:case 14:case 15:os(2,C,x),Fs||os(4,C,x),ec(m,x,C);break;case 1:Fs||(Hi(C,x),k=C.stateNode,typeof k.componentWillUnmount=="function"&&Ko(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 Am(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 Ab),x;case 22:return m=m.stateNode,x=m._retryCache,x===null&&(x=m._retryCache=new Ab),x;default:throw Error(i(435,m.tag))}}function dd(m,x){var C=nc(m);x.forEach(function(k){if(!C.has(k)){C.add(k);var W=LE.bind(null,m,k);k.then(W,W)}})}function Io(m,x){var C=x.deletions;if(C!==null)for(var k=0;k<C.length;k++){var W=C[k],ee=m,Re=x;if(Xr){var lt=Re;e:for(;lt!==null;){switch(lt.tag){case 27:if(_o){if(kh(lt.type)){Ts=lt.stateNode,Ys=!1;break e}break}case 5:Ts=lt.stateNode,Ys=!1;break e;case 3:case 4:Ts=lt.stateNode.containerInfo,Ys=!0;break e}lt=lt.return}if(Ts===null)throw Error(i(160));Cm(ee,Re,W),Ts=null,Ys=!1}else Cm(ee,Re,W);ee=W.alternate,ee!==null&&(ee.return=null),W.return=null}if(x.subtreeFlags&13886)for(x=x.child;x!==null;)Nm(x,m),x=x.sibling}function Nm(m,x){var C=m.alternate,k=m.flags;switch(m.tag){case 0:case 11:case 14:case 15:Io(x,m),Oo(m),k&4&&(os(3,m,m.return),ai(3,m),os(5,m,m.return));break;case 1:Io(x,m),Oo(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(ac){var W=Ai;if(Io(x,m),Oo(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=y3(W,m.type,m.memoizedProps,m):vb(W,m.type,m.stateNode):m.stateNode=gb(W,ee,m.memoizedProps):k!==ee?(k===null?C.stateNode!==null&&xb(C.stateNode):pf(k),ee===null?vb(W,m.type,m.stateNode):gb(W,ee,m.memoizedProps)):ee===null&&m.stateNode!==null&&Po(m,m.memoizedProps,C.memoizedProps)}break}case 27:if(_o){Io(x,m),Oo(m),k&512&&(Fs||C===null||Hi(C,C.return)),C!==null&&k&4&&Po(m,m.memoizedProps,C.memoizedProps);break}case 5:if(Io(x,m),Oo(m),k&512&&(Fs||C===null||Hi(C,C.return)),Xr){if(m.flags&32){W=m.stateNode;try{nb(W)}catch(Yt){nr(m,m.return,Yt)}}k&4&&m.stateNode!=null&&(W=m.memoizedProps,Po(m,W,C!==null?C.memoizedProps:W)),k&1024&&(Yp=!0)}else El&&m.alternate!==null&&(m.alternate.stateNode=m.stateNode);break;case 6:if(Io(x,m),Oo(m),k&4&&Xr){if(m.stateNode===null)throw Error(i(162));k=m.memoizedProps,C=C!==null?C.memoizedProps:k,W=m.stateNode;try{Hw(W,C,k)}catch(Yt){nr(m,m.return,Yt)}}break;case 3:if(ac?(b3(),W=Ai,Ai=Bm(x.containerInfo),Io(x,m),Ai=W):Io(x,m),Oo(m),k&4){if(Xr&&ls&&C!==null&&C.memoizedState.isDehydrated)try{p3(x.containerInfo)}catch(Yt){nr(m,m.return,Yt)}if(El){k=x.containerInfo,C=x.pendingChildren;try{ob(k,C)}catch(Yt){nr(m,m.return,Yt)}}}Yp&&(Yp=!1,Rv(m));break;case 4:ac?(C=Ai,Ai=Bm(m.stateNode.containerInfo),Io(x,m),Oo(m),Ai=C):(Io(x,m),Oo(m)),k&4&&El&&Lc(m.stateNode,m,m.stateNode.pendingChildren);break;case 12:Io(x,m),Oo(m);break;case 31:Io(x,m),Oo(m),k&4&&(k=m.updateQueue,k!==null&&(m.updateQueue=null,dd(m,k)));break;case 13:Io(x,m),Oo(m),m.child.flags&8192&&m.memoizedState!==null!=(C!==null&&C.memoizedState!==null)&&(Zm=ha()),k&4&&(k=m.updateQueue,k!==null&&(m.updateQueue=null,dd(m,k)));break;case 22:W=m.memoizedState!==null;var Re=C!==null&&C.memoizedState!==null,lt=js,It=Fs;if(js=lt||W,Fs=It||Re,Io(x,m),Fs=It,js=lt,Oo(m),k&8192&&(x=m.stateNode,x._visibility=W?x._visibility&-2:x._visibility|1,W&&(C===null||Re||js||Fs||ef(m)),Xr)){e:if(C=null,Xr)for(x=m;;){if(x.tag===5||ac&&x.tag===26){if(C===null){Re=C=x;try{ee=Re.stateNode,W?zE(ee):Yw(Re.stateNode,Re.memoizedProps)}catch(Yt){nr(Re,Re.return,Yt)}}}else if(x.tag===6){if(C===null){Re=x;try{var Wt=Re.stateNode;W?Xw(Wt):Kw(Wt,Re.memoizedProps)}catch(Yt){nr(Re,Re.return,Yt)}}}else if(x.tag===18){if(C===null){Re=x;try{var cn=Re.stateNode;W?g3(cn):v3(Re.stateNode)}catch(Yt){nr(Re,Re.return,Yt)}}}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,dd(m,C))));break;case 19:Io(x,m),Oo(m),k&4&&(k=m.updateQueue,k!==null&&(m.updateQueue=null,dd(m,k)));break;case 30:break;case 21:break;default:Io(x,m),Oo(m)}}function Oo(m){var x=m.flags;if(x&2){try{for(var C,k=m.return;k!==null;){if(Ca(k)){C=k;break}k=k.return}if(Xr){if(C==null)throw Error(i(160));switch(C.tag){case 27:if(_o){var W=C.stateNode,ee=so(m);yo(m,ee,W);break}case 5:var Re=C.stateNode;C.flags&32&&(nb(Re),C.flags&=-33);var lt=so(m);yo(m,lt,Re);break;case 3:case 4:var It=C.stateNode.containerInfo,Wt=so(m);oo(m,Wt,It);break;default:throw Error(i(161))}}}catch(cn){nr(m,m.return,cn)}m.flags&=-3}x&4096&&(m.flags&=-4097)}function Rv(m){if(m.subtreeFlags&1024)for(m=m.child;m!==null;){var x=m;Rv(x),x.tag===5&&x.flags&1024&&Yy(x.stateNode),m=m.sibling}}function Aa(m,x){if(x.subtreeFlags&8772)for(x=x.child;x!==null;)kw(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:os(4,x,x.return),ef(x);break;case 1:Hi(x,x.return);var C=x.stateNode;typeof C.componentWillUnmount=="function"&&Ko(x,x.return,C),ef(x);break;case 27:_o&&Lo(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,W=m,ee=x,Re=ee.flags;switch(ee.tag){case 0:case 11:case 15:rc(W,ee,C),ai(4,ee);break;case 1:if(rc(W,ee,C),k=ee,W=k.stateNode,typeof W.componentDidMount=="function")try{W.componentDidMount()}catch(Wt){nr(k,k.return,Wt)}if(k=ee,W=k.updateQueue,W!==null){var lt=k.stateNode;try{var It=W.shared.hiddenCallbacks;if(It!==null)for(W.shared.hiddenCallbacks=null,W=0;W<It.length;W++)Pn(It[W],lt)}catch(Wt){nr(k,k.return,Wt)}}C&&Re&64&&Os(ee),ko(ee,ee.return);break;case 27:_o&&Do(ee);case 26:case 5:rc(W,ee,C),C&&k===null&&Re&4&&Gs(ee),ko(ee,ee.return);break;case 12:rc(W,ee,C);break;case 31:rc(W,ee,C),C&&Re&4&&tc(W,ee);break;case 13:rc(W,ee,C),C&&Re&4&&Am(W,ee);break;case 22:ee.memoizedState===null&&rc(W,ee,C),ko(ee,ee.return);break;case 30:break;default:rc(W,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 zy(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;)kv(m,x,C,k),x=x.sibling}function kv(m,x,C,k){var W=x.flags;switch(x.tag){case 0:case 11:case 15:_s(m,x,C,k),W&2048&&ai(9,x);break;case 1:_s(m,x,C,k);break;case 3:_s(m,x,C,k),W&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(W&2048){_s(m,x,C,k),m=x.stateNode;try{var ee=x.memoizedProps,Re=ee.id,lt=ee.onPostCommit;typeof lt=="function"&&lt(Re,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,Re=x.alternate,x.memoizedState!==null?ee._visibility&2?_s(m,x,C,k):Pp(m,x):ee._visibility&2?_s(m,x,C,k):(ee._visibility|=2,$a(m,x,C,k,(x.subtreeFlags&10256)!==0||!1)),W&2048&&tf(Re,x);break;case 24:_s(m,x,C,k),W&2048&&zy(x.alternate,x);break;default:_s(m,x,C,k)}}function $a(m,x,C,k,W){for(W=W&&((x.subtreeFlags&10256)!==0||!1),x=x.child;x!==null;){var ee=m,Re=x,lt=C,It=k,Wt=Re.flags;switch(Re.tag){case 0:case 11:case 15:$a(ee,Re,lt,It,W),ai(8,Re);break;case 23:break;case 22:var cn=Re.stateNode;Re.memoizedState!==null?cn._visibility&2?$a(ee,Re,lt,It,W):Pp(ee,Re):(cn._visibility|=2,$a(ee,Re,lt,It,W)),W&&Wt&2048&&tf(Re.alternate,Re);break;case 24:$a(ee,Re,lt,It,W),W&&Wt&2048&&zy(Re.alternate,Re);break;default:$a(ee,Re,lt,It,W)}x=x.sibling}}function Pp(m,x){if(x.subtreeFlags&10256)for(x=x.child;x!==null;){var C=m,k=x,W=k.flags;switch(k.tag){case 22:Pp(C,k),W&2048&&tf(k.alternate,k);break;case 24:Pp(C,k),W&2048&&zy(k.alternate,k);break;default:Pp(C,k)}x=x.sibling}}function pu(m,x,C){if(m.subtreeFlags&Rl)for(m=m.child;m!==null;)nf(m,x,C),m=m.sibling}function nf(m,x,C){switch(m.tag){case 26:if(pu(m,x,C),m.flags&Rl)if(m.memoizedState!==null)_3(C,Ai,m.memoizedState,m.memoizedProps);else{var k=m.stateNode,W=m.type;m=m.memoizedProps,((x&335544128)===x||qy(W,m))&&qv(C,k,W,m)}break;case 5:pu(m,x,C),m.flags&Rl&&(k=m.stateNode,W=m.type,m=m.memoizedProps,((x&335544128)===x||qy(W,m))&&qv(C,k,W,m));break;case 3:case 4:ac?(k=Ai,Ai=Bm(m.stateNode.containerInfo),pu(m,x,C),Ai=k):pu(m,x,C);break;case 22:m.memoizedState===null&&(k=m.alternate,k!==null&&k.memoizedState!==null?(k=Rl,Rl=16777216,pu(m,x,C),Rl=k):pu(m,x,C));break;default:pu(m,x,C)}}function Pv(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,wl(k,m)}Pv(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&&os(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,Rm(m)):Dp(m);break;default:Dp(m)}}function Rm(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,wl(k,m)}Pv(m)}for(m=m.child;m!==null;){switch(x=m,x.tag){case 0:case 11:case 15:os(8,x,x.return),Rm(x);break;case 22:C=x.stateNode,C._visibility&2&&(C._visibility&=-3,Rm(x));break;default:Rm(x)}m=m.sibling}}function wl(m,x){for(;Xs!==null;){var C=Xs;switch(C.tag){case 0:case 11:case 15:os(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 W=k.sibling,ee=k.return;if(Ly(k),k===C){Xs=null;break e}if(W!==null){W.return=ee,Xs=W;break e}Xs=ee}}}function rf(m){var x=xr(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 Zp:e:{for(x=x.value,m=[m,0],C=0;C<m.length;){var k=m[C++],W=k.tag,ee=m[C++],Re=x[ee];if(W!==5&&W!==26&&W!==27||!ff(k)){for(;Re!=null&&sf(k,Re);)ee++,Re=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 Qp:if((C===5||C===26||C===27)&&Qy(m.stateNode,x.value))return!0;break;case bf:if((C===5||C===6||C===26||C===27)&&(m=Fm(m),m!==null&&0<=m.indexOf(x.value)))return!0;break;case Ym: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 Ip(m){switch(m.$$typeof){case mc:return"<"+(h(m.value)||"Unknown")+">";case Zp:return":has("+(Ip(m)||"")+")";case Qp:return'[role="'+m.value+'"]';case bf:return'"'+m.value+'"';case Ym:return'[data-testname="'+m.value+'"]';default:throw Error(i(365))}}function Op(m,x){var C=[];m=[m,0];for(var k=0;k<m.length;){var W=m[k++],ee=W.tag,Re=m[k++],lt=x[Re];if(ee!==5&&ee!==26&&ee!==27||!ff(W)){for(;lt!=null&&sf(W,lt);)Re++,lt=x[Re];if(Re===x.length)C.push(W);else for(W=W.child;W!==null;)m.push(W,Re),W=W.sibling}}return C}function qa(m,x){if(!bo)throw Error(i(363));m=rf(m),m=Op(m,x),x=[],m=Array.from(m);for(var C=0;C<m.length;){var k=m[C++],W=k.tag;if(W===5||W===26||W===27)ff(k)||x.push(k.stateNode);else for(k=k.child;k!==null;)m.push(k),k=k.sibling}return x}function as(){return(Or&2)!==0&&Hr!==0?Hr&-Hr:Hn.T!==null?ke():Gp()}function fd(){if(Ia===0)if((Hr&536870912)===0||Br){var m=Dh;Dh<<=1,(Dh&3932160)===0&&(Dh=262144),Ia=m}else Ia=536870912;return m=Ja.current,m!==null&&(m.flags|=32),Ia}function Ss(m,x,C){(m===Er&&(Ni===2||Ni===9)||m.cancelPendingCommit!==null)&&(Ls(m,0),gu(m,Hr,Ia,!1)),P(m,C),((Or&2)===0||m!==Er)&&(m===Er&&((Or&2)===0&&(wf|=C),Es===4&&gu(m,Hr,Ia,!1)),He(m))}function zc(m,x,C){if((Or&6)!==0)throw Error(i(327));var k=!C&&(x&127)===0&&(x&m.expiredLanes)===0||E(m,x),W=k?Iw(m,x):vu(m,x,!0),ee=k;do{if(W===0){_f&&!k&&gu(m,x,0,!1);break}else{if(C=m.current.alternate,ee&&!Pw(C)){W=vu(m,x,!1),ee=!1;continue}if(W===2){if(ee=x,m.errorRecoveryDisabledLanes&ee)var Re=0;else Re=m.pendingLanes&-536870913,Re=Re!==0?Re:Re&536870912?536870912:0;if(Re!==0){x=Re;e:{var lt=m;W=Km;var It=ls&&lt.current.memoizedState.isDehydrated;if(It&&(Ls(lt,Re).flags|=256),Re=vu(lt,Re,!1),Re!==2){if(Sf&&!It){lt.errorRecoveryDisabledLanes|=ee,wf|=ee,W=4;break e}ee=tl,tl=W,ee!==null&&(tl===null?tl=ee:tl.push.apply(tl,ee))}W=Re}if(ee=!1,W!==2)continue}}if(W===1){Ls(m,0),gu(m,x,0,!0);break}e:{switch(k=m,ee=W,ee){case 0:case 1:throw Error(i(345));case 4:if((x&4194048)!==x)break;case 6:gu(k,x,Ia,!Bc);break e;case 2:tl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((x&62914560)===x&&(W=Zm+300-ha(),10<W)){if(gu(k,x,Ia,!Bc),S(k,0,!0)!==0)break e;ku=x,k.timeoutHandle=$y(mu.bind(null,k,C,tl,Qm,mx,x,Ia,wf,e0,Bc,ee,"Throttled",-0,0),W);break e}mu(k,C,tl,Qm,mx,x,Ia,wf,e0,Bc,ee,null,-0,0)}}break}while(!0);He(m)}function mu(m,x,C,k,W,ee,Re,lt,It,Wt,cn,Yt,bn,hr){if(m.timeoutHandle=Ka,Yt=x.subtreeFlags,Yt&8192||(Yt&16785408)===16785408){Yt=Xy(),nf(x,ee,Yt);var Ks=(ee&62914560)===ee?Zm-ha():(ee&4194048)===ee?Uh-ha():0;if(Ks=Bw(Yt,Ks),Ks!==null){ku=ee,m.cancelPendingCommit=Ks(yu.bind(null,m,x,ee,C,k,W,Re,lt,It,cn,Yt,null,bn,hr)),gu(m,ee,Re,!Wt);return}}yu(m,x,ee,C,k,W,Re,lt,It)}function Pw(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 W=C[k],ee=W.getSnapshot;W=W.value;try{if(!qs(ee(),W))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 gu(m,x,C,k){x&=~Jp,x&=~wf,m.suspendedLanes|=x,m.pingedLanes&=~x,k&&(m.warmLanes|=x),k=m.expirationTimes;for(var W=x;0<W;){var ee=31-Za(W),Re=1<<ee;k[ee]=-1,W&=~Re}C!==0&&R(m,C,x)}function Iv(){return(Or&6)===0?(pe(0),!1):!0}function Ov(){if(Lr!==null){if(Ni===0)var m=Lr.return;else m=Lr,Fc=$i=null,dr(m),vf=null,Oh=0,m=Lr;for(;m!==null;)gi(m.alternate,m),m=m.return;Lr=null}}function Ls(m,x){var C=m.timeoutHandle;C!==Ka&&(m.timeoutHandle=Ka,Uw(C)),C=m.cancelPendingCommit,C!==null&&(m.cancelPendingCommit=null,C()),ku=0,Ov(),Er=m,Lr=C=Tl(m.current,null),Hr=x,Ni=0,co=null,Bc=!1,_f=E(m,x),Sf=!1,e0=Ia=Jp=wf=Md=Es=0,tl=Km=null,mx=!1,(x&8)!==0&&(x|=x&32);var k=m.entangledLanes;if(k!==0)for(m=m.entanglements,k&=x;0<k;){var W=31-Za(k),ee=1<<W;x|=m[W],k&=~ee}return Ru=x,Ue(),C}function Wi(m,x){yr=null,Hn.H=Nl,x===Mo||x===hc?(x=st(),Ni=3):x===hx?(x=st(),Ni=4):Ni=x===Da?8:x!==null&&typeof x=="object"&&typeof x.then=="function"?6:1,co=x,Lr===null&&(Es=1,Zl(m,J(x,m.current)))}function qr(){var m=Ja.current;return m===null?!0:(Hr&4194048)===Hr?el===null:(Hr&62914560)===Hr||(Hr&536870912)!==0?m===el:!1}function hd(){var m=Hn.H;return Hn.H=Nl,m===null?Nl:m}function Ml(){var m=Hn.A;return Hn.A=Kp,m}function Lp(){Es=4,Bc||(Hr&4194048)!==Hr&&Ja.current!==null||(_f=!0),(Md&134217727)===0&&(wf&134217727)===0||Er===null||gu(Er,Hr,Ia,!1)}function vu(m,x,C){var k=Or;Or|=2;var W=hd(),ee=Ml();(Er!==m||Hr!==x)&&(Qm=null,Ls(m,x)),x=!1;var Re=Es;e:do try{if(Ni!==0&&Lr!==null){var lt=Lr,It=co;switch(Ni){case 8:Ov(),Re=6;break e;case 3:case 2:case 9:case 6:Ja.current===null&&(x=!0);var Wt=Ni;if(Ni=0,co=null,xu(m,lt,It,Wt),C&&_f){Re=0;break e}break;default:Wt=Ni,Ni=0,co=null,xu(m,lt,It,Wt)}}Dw(),Re=Es;break}catch(cn){Wi(m,cn)}while(!0);return x&&m.shellSuspendCounter++,Fc=$i=null,Or=k,Hn.H=W,Hn.A=ee,Lr===null&&(Er=null,Hr=0,Ue()),Re}function Dw(){for(;Lr!==null;)of(Lr)}function Iw(m,x){var C=Or;Or|=2;var k=hd(),W=Ml();Er!==m||Hr!==x?(Qm=null,Mf=ha()+500,Ls(m,x)):_f=E(m,x);e:do try{if(Ni!==0&&Lr!==null){x=Lr;var ee=co;t:switch(Ni){case 1:Ni=0,co=null,xu(m,x,ee,1);break;case 2:case 9:if(Ae(ee)){Ni=0,co=null,Lv(x);break}x=function(){Ni!==2&&Ni!==9||Er!==m||(Ni=7),He(m)},ee.then(x,x);break e;case 3:Ni=7;break e;case 4:Ni=5;break e;case 7:Ae(ee)?(Ni=0,co=null,Lv(x)):(Ni=0,co=null,xu(m,x,ee,7));break;case 5:var Re=null;switch(Lr.tag){case 26:Re=Lr.memoizedState;case 5:case 27:var lt=Lr,It=lt.type,Wt=lt.pendingProps;if(Re?bb(Re):ws(lt.stateNode,It,Wt)){Ni=0,co=null;var cn=lt.sibling;if(cn!==null)Lr=cn;else{var Yt=lt.return;Yt!==null?(Lr=Yt,jp(Yt)):Lr=null}break t}}Ni=0,co=null,xu(m,x,ee,5);break;case 6:Ni=0,co=null,xu(m,x,ee,6);break;case 8:Ov(),Es=6;break e;default:throw Error(i(462))}}zp();break}catch(bn){Wi(m,bn)}while(!0);return Fc=$i=null,Hn.H=k,Hn.A=W,Or=C,Lr!==null?0:(Er=null,Hr=0,Ue(),Es)}function zp(){for(;Lr!==null&&!w3();)of(Lr)}function of(m){var x=Ft(m.alternate,m,Ru);m.memoizedProps=m.pendingProps,x===null?jp(m):Lr=x}function Lv(m){var x=m,C=x.alternate;switch(x.tag){case 15:case 0:x=Ds(C,x,x.pendingProps,x.type,void 0,Hr);break;case 11:x=Ds(C,x,x.pendingProps,x.type.render,x.ref,Hr);break;case 5:dr(x);default:gi(C,x),x=Lr=Fv(x,Ru),x=Ft(C,x,Ru)}m.memoizedProps=m.pendingProps,x===null?jp(m):Lr=x}function xu(m,x,C,k){Fc=$i=null,dr(x),vf=null,Oh=0;var W=x.return;try{if(_m(m,W,x,C,Hr)){Es=1,Zl(m,J(C,m.current)),Lr=null;return}}catch(ee){if(W!==null)throw Lr=W,ee;Es=1,Zl(m,J(C,m.current)),Lr=null;return}x.flags&32768?(Br||k===1?m=!0:_f||(Hr&536870912)!==0?m=!1:(Bc=m=!0,(k===2||k===9||k===3||k===6)&&(k=Ja.current,k!==null&&k.tag===13&&(k.flags|=16384))),af(x,m)):jp(x)}function jp(m){var x=m;do{if((x.flags&32768)!==0){af(x,Bc);return}m=x.return;var C=Ji(x.alternate,x,Ru);if(C!==null){Lr=C;return}if(x=x.sibling,x!==null){Lr=x;return}Lr=x=m}while(x!==null);Es===0&&(Es=5)}function af(m,x){do{var C=Is(m.alternate,m);if(C!==null){C.flags&=32767,Lr=C;return}if(C=m.return,C!==null&&(C.flags|=32768,C.subtreeFlags=0,C.deletions=null),!x&&(m=m.sibling,m!==null)){Lr=m;return}Lr=m=C}while(m!==null);Es=6,Lr=null}function yu(m,x,C,k,W,ee,Re,lt,It){m.cancelPendingCommit=null;do _u();while(uo!==0);if((Or&6)!==0)throw Error(i(327));if(x!==null){if(x===m.current)throw Error(i(177));if(ee=x.lanes|x.childLanes,ee|=Lh,L(m,C,ee,Re,lt,It),m===Er&&(Lr=Er=null,Hr=0),Bh=x,Ed=m,ku=C,t0=ee,gx=W,Nb=k,(x.subtreeFlags&10256)!==0||(x.flags&10256)!==0?(m.callbackNode=null,m.callbackPriority=0,ao(Vm,function(){return km(),null})):(m.callbackNode=null,m.callbackPriority=0),k=(x.flags&13878)!==0,(x.subtreeFlags&13878)!==0||k){k=Hn.T,Hn.T=null,W=oc(),Ur(2),Re=Or,Or|=4;try{Nv(m,x,C)}finally{Or=Re,Ur(W),Hn.T=k}}uo=1,pd(),bu(),zv()}}function pd(){if(uo===1){uo=0;var m=Ed,x=Bh,C=(x.flags&13878)!==0;if((x.subtreeFlags&13878)!==0||C){C=Hn.T,Hn.T=null;var k=oc();Ur(2);var W=Or;Or|=4;try{Nm(x,m),Fw(m.containerInfo)}finally{Or=W,Ur(k),Hn.T=C}}m.current=x,uo=2}}function bu(){if(uo===2){uo=0;var m=Ed,x=Bh,C=(x.flags&8772)!==0;if((x.subtreeFlags&8772)!==0||C){C=Hn.T,Hn.T=null;var k=oc();Ur(2);var W=Or;Or|=4;try{kw(m,x.alternate,x)}finally{Or=W,Ur(k),Hn.T=C}}uo=3}}function zv(){if(uo===4||uo===3){uo=0,Sb();var m=Ed,x=Bh,C=ku,k=Nb;(x.subtreeFlags&10256)!==0||(x.flags&10256)!==0?uo=5:(uo=0,Bh=Ed=null,jv(m,m.pendingLanes));var W=m.pendingLanes;if(W===0&&(Td=null),q(C),x=x.stateNode,Qa&&typeof Qa.onCommitFiberRoot=="function")try{Qa.onCommitFiberRoot(Ih,x,void 0,(x.current.flags&128)===128)}catch{}if(k!==null){x=Hn.T,W=oc(),Ur(2),Hn.T=null;try{for(var ee=m.onRecoverableError,Re=0;Re<k.length;Re++){var lt=k[Re];ee(lt.value,{componentStack:lt.stack})}}finally{Hn.T=x,Ur(W)}}(ku&3)!==0&&_u(),He(m),W=m.pendingLanes,(C&261930)!==0&&(W&42)!==0?m===Jm?li++:(li=0,Jm=m):li=0,ls&&Um(),pe(0)}}function jv(m,x){(m.pooledCacheLanes&=x)===0&&(x=m.pooledCache,x!=null&&(m.pooledCache=null,ge(x)))}function _u(){return pd(),bu(),zv(),km()}function km(){if(uo!==5)return!1;var m=Ed,x=t0;t0=0;var C=q(ku),k=32>C?32:C;C=Hn.T;var W=oc();try{Ur(k),Hn.T=null,k=gx,gx=null;var ee=Ed,Re=ku;if(uo=0,Bh=Ed=null,ku=0,(Or&6)!==0)throw Error(i(331));var lt=Or;if(Or|=4,Dv(ee.current),kv(ee,ee.current,Re,k),Or=lt,pe(0,!1),Qa&&typeof Qa.onPostCommitFiberRoot=="function")try{Qa.onPostCommitFiberRoot(Ih,ee)}catch{}return!0}finally{Ur(W),Hn.T=C,jv(m,x)}}function lf(m,x,C){x=J(C,x),x=ad(m.stateNode,x,2),m=Ht(m,x,2),m!==null&&(P(m,2),He(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"&&(Td===null||!Td.has(k))){m=J(C,m),C=bm(2),k=Ht(x,C,2),k!==null&&(Cp(C,k,x,m),P(k,2),He(k));break}}x=x.return}}function Fp(m,x,C){var k=m.pingCache;if(k===null){k=m.pingCache=new kl;var W=new Set;k.set(x,W)}else W=k.get(x),W===void 0&&(W=new Set,k.set(x,W));W.has(C)||(Sf=!0,W.add(C),m=Ow.bind(null,m,x,C),x.then(m,m))}function Ow(m,x,C){var k=m.pingCache;k!==null&&k.delete(x),m.pingedLanes|=m.suspendedLanes&C,m.warmLanes&=~C,Er===m&&(Hr&C)===C&&(Es===4||Es===3&&(Hr&62914560)===Hr&&300>ha()-Zm?(Or&2)===0&&Ls(m,0):Jp|=C,e0===Hr&&(e0=0)),He(m)}function Lw(m,x){x===0&&(x=N()),m=kt(m,x),m!==null&&(P(m,x),He(m))}function OE(m){var x=m.memoizedState,C=0;x!==null&&(C=x.retryLane),Lw(m,C)}function LE(m,x){var C=0;switch(m.tag){case 31:case 13:var k=m.stateNode,W=m.memoizedState;W!==null&&(C=W.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),Lw(m,C)}function ao(m,x){return Hm(m,x)}function jy(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 _h(m){return m=m.prototype,!(!m||!m.isReactComponent)}function Tl(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 Fv(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 md(m,x,C,k,W,ee){var Re=0;if(k=m,typeof m=="function")_h(m)&&(Re=1);else if(typeof m=="string")Re=ac&&_o?ex(m,C,zo.current)?26:_b(m)?27:5:ac?ex(m,C,zo.current)?26:5:_o&&_b(m)?27:5;else e:switch(m){case Om:return m=n(31,C,x,W),m.elementType=Om,m.lanes=ee,m;case Th:return ic(C.children,W,ee,x);case Eh:Re=8,W|=24;break;case Ch:return m=n(12,C,x,W|2),m.elementType=Ch,m.lanes=ee,m;case Vv:return m=n(13,C,x,W),m.elementType=Vv,m.lanes=ee,m;case gd:return m=n(19,C,x,W),m.elementType=gd,m.lanes=ee,m;default:if(typeof m=="object"&&m!==null)switch(m.$$typeof){case sc:Re=10;break e;case Im:Re=9;break e;case Up:Re=11;break e;case Gv:Re=14;break e;case Na:Re=16,k=null;break e}Re=29,C=Error(i(130,m===null?"null":typeof m,"")),k=null}return x=n(Re,C,x,W),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 Fy(m,x,C){return m=n(6,m,null,x),m.lanes=C,m}function Uy(m){var x=n(18,null,null,0);return x.stateNode=m,x}function By(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 zw(m,x,C,k,W,ee,Re,lt,It){this.tag=1,this.containerInfo=m,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ka,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=I(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=I(0),this.hiddenUpdates=I(null),this.identifierPrefix=k,this.onUncaughtError=W,this.onCaughtError=ee,this.onRecoverableError=Re,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=It,this.incompleteTransitions=new Map}function cf(m,x,C,k,W,ee,Re,lt,It,Wt,cn,Yt){return m=new zw(m,x,C,Re,It,Wt,cn,Yt,lt),x=1,ee===!0&&(x|=24),ee=n(3,null,null,x),m.current=ee,ee.stateNode=m,x=ve(),x.refCount++,m.pooledCache=x,x.refCount++,ee.memoizedState={element:k,isDehydrated:C,cache:x},hn(ee),m}function Uv(m){return m?(m=wu,m):wu}function Pm(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=a(x),m=m!==null?l(m):null,m===null?null:Hp(m.stateNode)}function Hy(m,x,C,k,W,ee){W=Uv(W),k.context===null?k.context=W:k.pendingContext=W,k=on(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),kn(C,m,x))}function Sh(m,x){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var C=m.retryLane;m.retryLane=C!==0&&C<x?C:x}}function Dm(m,x){Sh(m,x),(m=m.alternate)&&Sh(m,x)}var Mr={},Bv=Jr,Xa=aEe,Hv=Object.assign,wh=Symbol.for("react.element"),Su=Symbol.for("react.transitional.element"),Mh=Symbol.for("react.portal"),Th=Symbol.for("react.fragment"),Eh=Symbol.for("react.strict_mode"),Ch=Symbol.for("react.profiler"),Im=Symbol.for("react.consumer"),sc=Symbol.for("react.context"),Up=Symbol.for("react.forward_ref"),Vv=Symbol.for("react.suspense"),gd=Symbol.for("react.suspense_list"),Gv=Symbol.for("react.memo"),Na=Symbol.for("react.lazy"),Om=Symbol.for("react.activity"),Vy=Symbol.for("react.memo_cache_sentinel"),vd=Symbol.iterator,uf=Symbol.for("react.client.reference"),df=Array.isArray,Hn=Bv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Gy=e.rendererVersion,Lm=e.rendererPackageName,Bp=e.extraDevToolsConfig,Hp=e.getPublicInstance,jw=e.getRootHostContext,Vp=e.getChildHostContext,Wv=e.prepareForCommit,Fw=e.resetAfterCommit,Wy=e.createInstance;e.cloneMutableInstance;var zm=e.appendInitialChild,Ya=e.finalizeInitialChildren,Ra=e.shouldSetTextContent,xd=e.createTextInstance;e.cloneMutableTextInstance;var $y=e.scheduleTimeout,Uw=e.cancelTimeout,Ka=e.noTimeout,Ws=e.isPrimaryRenderer;e.warnsIfNotActing;var Xr=e.supportsMutation,El=e.supportsPersistence,ls=e.supportsHydration,xr=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var Li=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var Ur=e.setCurrentUpdatePriority,oc=e.getCurrentUpdatePriority,Gp=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var Ah=e.shouldAttemptEagerTransition,$v=e.detachDeletedInstance;e.requestPostPaintCallback;var jm=e.maySuspendCommit,Wp=e.maySuspendCommitOnUpdate,qy=e.maySuspendCommitInSyncRender,ws=e.preloadInstance,Xy=e.startSuspendingCommit,qv=e.suspendInstance;e.suspendOnActiveViewTransition;var Bw=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var Nh=e.NotPendingTransition,Rh=e.HostTransitionContext,Yy=e.resetFormInstance;e.bindToConsole;var Ky=e.supportsMicrotasks,Zy=e.scheduleMicrotask,bo=e.supportsTestSelectors,$s=e.findFiberRoot,Xv=e.getBoundingRect,Fm=e.getTextContent,ff=e.isHiddenSubtree,Qy=e.matchAccessibilityRole,yd=e.setFocusIfFocusable,Yv=e.setupIntersectionObserver,Jy=e.appendChild,eb=e.appendChildToContainer,Hw=e.commitTextUpdate,Vw=e.commitMount,Gw=e.commitUpdate,Ww=e.insertBefore,$w=e.insertInContainerBefore,qw=e.removeChild,tb=e.removeChildFromContainer,nb=e.resetTextContent,zE=e.hideInstance,Xw=e.hideTextInstance,Yw=e.unhideInstance,Kw=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 rb=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var Zw=e.cloneInstance,ib=e.createContainerChildSet,sb=e.appendChildToContainerChildSet,Qw=e.finalizeContainerChildren,ob=e.replaceContainerChildren,Jw=e.cloneHiddenInstance,ab=e.cloneHiddenTextInstance,hf=e.isSuspenseInstancePending,Kv=e.isSuspenseInstanceFallback,Zv=e.getSuspenseInstanceFallbackErrorDetails,Qv=e.registerSuspenseInstanceRetry,e3=e.canHydrateFormStateMarker,lb=e.isFormStateMarkerMatching,t3=e.getNextHydratableSibling,n3=e.getNextHydratableSiblingAfterSingleton,r3=e.getFirstHydratableChild,i3=e.getFirstHydratableChildWithinContainer,s3=e.getFirstHydratableChildWithinActivityInstance,o3=e.getFirstHydratableChildWithinSuspenseInstance,cb=e.getFirstHydratableChildWithinSingleton,a3=e.canHydrateInstance,l3=e.canHydrateTextInstance,ub=e.canHydrateActivityInstance,c3=e.canHydrateSuspenseInstance,u3=e.hydrateInstance,jE=e.hydrateTextInstance,db=e.hydrateActivityInstance,d3=e.hydrateSuspenseInstance,f3=e.getNextHydratableInstanceAfterActivityInstance,fb=e.getNextHydratableInstanceAfterSuspenseInstance,h3=e.commitHydratedInstance,p3=e.commitHydratedContainer,FE=e.commitHydratedActivityInstance,UE=e.commitHydratedSuspenseInstance,m3=e.finalizeHydratedChildren,Um=e.flushHydrationEvents;e.clearActivityBoundary;var hb=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var Jv=e.clearSuspenseBoundaryFromContainer,g3=e.hideDehydratedBoundary,v3=e.unhideDehydratedBoundary,$p=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var x3=e.validateHydratableInstance,pb=e.validateHydratableTextInstance,ac=e.supportsResources,ex=e.isHostHoistableType,Bm=e.getHoistableRoot,mb=e.getResource,gb=e.acquireResource,pf=e.releaseResource,y3=e.hydrateHoistable,vb=e.mountHoistable,xb=e.unmountHoistable,tx=e.createHoistableInstance,b3=e.prepareToCommitHoistables,yb=e.mayResourceSuspendCommit,bb=e.preloadResource,_3=e.suspendResource,_o=e.supportsSingletons,nx=e.resolveSingletonInstance,lo=e.acquireSingletonInstance,Lo=e.releaseSingletonInstance,_b=e.isHostSingletonType,kh=e.isSingletonScope,rx=[],Ph=-1,wu={},Za=Math.clz32?Math.clz32:_,ix=Math.log,S3=Math.LN2,sx=256,Dh=262144,qp=4194304,Hm=Xa.unstable_scheduleCallback,ox=Xa.unstable_cancelCallback,w3=Xa.unstable_shouldYield,Sb=Xa.unstable_requestPaint,ha=Xa.unstable_now,ax=Xa.unstable_ImmediatePriority,M3=Xa.unstable_UserBlockingPriority,Vm=Xa.unstable_NormalPriority,lx=Xa.unstable_IdlePriority,wb=Xa.log,T3=Xa.unstable_setDisableYieldValue,Ih=null,Qa=null,qs=typeof Object.is=="function"?Object.is:Z,cx=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,ux,Mu,Gm=!1,Mb=new WeakMap,bd=[],Tu=0,zi=null,Wm=0,lc=[],Cl=0,cc=null,Zo=1,jc="",zo=g(null),_d=g(null),Qo=g(null),$m=g(null),So=null,cs=null,Br=!1,Eu=null,ka=!1,dx=Error(i(519)),uc=g(null),$i=null,Fc=null,E3=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()})}},jo=Xa.unstable_scheduleCallback,HE=Xa.unstable_NormalPriority,us={$$typeof:sc,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},qm=null,Ci=null,pa=!1,dc=!1,fx=!1,mf=0,Xp=null,Tb=0,Sd=0,wo=null,fc=Hn.S;Hn.S=function(m,x){Uh=ha(),typeof x=="object"&&x!==null&&typeof x.then=="function"&&Ze(m,x),fc!==null&&fc(m,x)};var gf=g(null),Mo=Error(i(460)),hx=Error(i(474)),hc=Error(i(542)),Cu={then:function(){}},Pa=null,vf=null,Oh=0,Jo=Dt(!0),Eb=Dt(!1),ea=[],Au=0,Lh=0,Al=!1,px=!1,zh=g(null),xf=g(0),Ja=g(null),el=null,zs=g(0),wd=0,yr=null,Fn=null,cr=null,Tr=!1,wr=!1,Zr=!1,ma=0,pc=0,Uc=null,Cb=0,Nl={readContext:le,use:gs,useCallback:Jt,useContext:Jt,useEffect:Jt,useImperativeHandle:Jt,useLayoutEffect:Jt,useInsertionEffect:Jt,useMemo:Jt,useReducer:Jt,useRef:Jt,useState:Jt,useDebugValue:Jt,useDeferredValue:Jt,useTransition:Jt,useSyncExternalStore:Jt,useId:Jt,useHostTransitionStatus:Jt,useFormState:Jt,useActionState:Jt,useOptimistic:Jt,useMemoCache:Jt,useCacheRefresh:Jt};Nl.useEffectEvent=Jt;var Ms={readContext:le,use:gs,useCallback:function(m,x){return kr().memoizedState=[m,x===void 0?null:x],m},useContext:le,useEffect:ni,useImperativeHandle:function(m,x,C){C=C!=null?C.concat([m]):null,Wa(4194308,4,$r.bind(null,x,m),C)},useLayoutEffect:function(m,x){return Wa(4194308,4,m,x)},useInsertionEffect:function(m,x){Wa(4,2,m,x)},useMemo:function(m,x){var C=kr();x=x===void 0?null:x;var k=m();if(Zr){B(!0);try{m()}finally{B(!1)}}return C.memoizedState=[k,x],k},useReducer:function(m,x,C){var k=kr();if(C!==void 0){var W=C(x);if(Zr){B(!0);try{C(x)}finally{B(!1)}}}else W=x;return k.memoizedState=k.baseState=W,m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:m,lastRenderedState:W},k.queue=m,m=m.dispatch=ys.bind(null,yr,m),[k.memoizedState,m]},useRef:function(m){var x=kr();return m={current:m},x.memoizedState=m},useState:function(m){m=yl(m);var x=m.queue,C=Sl.bind(null,yr,x);return x.dispatch=C,[m.memoizedState,C]},useDebugValue:_l,useDeferredValue:function(m,x){var C=kr();return mi(C,m,x)},useTransition:function(){var m=yl(!1);return m=rd.bind(null,yr,m.queue,!0,!1),kr().memoizedState=m,[!1,m]},useSyncExternalStore:function(m,x,C){var k=yr,W=kr();if(Br){if(C===void 0)throw Error(i(407));C=C()}else{if(C=x(),Er===null)throw Error(i(349));(Hr&127)!==0||Ii(k,x,C)}W.memoizedState=C;var ee={value:C,getSnapshot:x};return W.queue=ee,ni(ua.bind(null,k,ee,m),[m]),k.flags|=2048,xs(9,{destroy:void 0},qo.bind(null,k,ee,C,x),null),C},useId:function(){var m=kr(),x=Er.identifierPrefix;if(Br){var C=jc,k=Zo;C=(k&~(1<<32-Za(k)-1)).toString(32)+C,x="_"+x+"R_"+C,C=ma++,0<C&&(x+="H"+C.toString(32)),x+="_"}else C=Cb++,x="_"+x+"r_"+C.toString(32)+"_";return m.memoizedState=x},useHostTransitionStatus:Qd,useFormState:Yl,useActionState:Yl,useOptimistic:function(m){var x=kr();x.memoizedState=x.baseState=m;var C={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return x.queue=C,x=Mp.bind(null,yr,!0,C),C.dispatch=x,[m,x]},useMemoCache:Rs,useCacheRefresh:function(){return kr().memoizedState=Hs.bind(null,yr)},useEffectEvent:function(m){var x=kr(),C={impl:m};return x.memoizedState=C,function(){if((Or&2)!==0)throw Error(i(440));return C.impl.apply(void 0,arguments)}}},Nu={readContext:le,use:gs,useCallback:Kl,useContext:le,useEffect:Fr,useImperativeHandle:Ea,useInsertionEffect:_i,useLayoutEffect:Oi,useMemo:vo,useReducer:vs,useRef:Ga,useState:function(){return vs(Di)},useDebugValue:_l,useDeferredValue:function(m,x){var C=rn();return xh(C,Fn.memoizedState,m,x)},useTransition:function(){var m=vs(Di)[0],x=rn().memoizedState;return[typeof m=="boolean"?m:Nn(m),x]},useSyncExternalStore:ks,useId:fa,useHostTransitionStatus:Qd,useFormState:Xo,useActionState:Xo,useOptimistic:function(m,x){var C=rn();return da(C,Fn,m,x)},useMemoCache:Rs,useCacheRefresh:Gi};Nu.useEffectEvent=vr;var yf={readContext:le,use:gs,useCallback:Kl,useContext:le,useEffect:Fr,useImperativeHandle:Ea,useInsertionEffect:_i,useLayoutEffect:Oi,useMemo:vo,useReducer:fi,useRef:Ga,useState:function(){return fi(Di)},useDebugValue:_l,useDeferredValue:function(m,x){var C=rn();return Fn===null?mi(C,m,x):xh(C,Fn.memoizedState,m,x)},useTransition:function(){var m=fi(Di)[0],x=rn().memoizedState;return[typeof m=="boolean"?m:Nn(m),x]},useSyncExternalStore:ks,useId:fa,useHostTransitionStatus:Qd,useFormState:bl,useActionState:bl,useOptimistic:function(m,x){var C=rn();return Fn!==null?da(C,Fn,m,x):(C.baseState=m,[m,C.queue.dispatch])},useMemoCache:Rs,useCacheRefresh:Gi};yf.useEffectEvent=vr;var Xm={enqueueSetState:function(m,x,C){m=m._reactInternals;var k=as(),W=on(k);W.payload=x,C!=null&&(W.callback=C),x=Ht(m,W,k),x!==null&&(Ss(x,m,k),kn(x,m,k))},enqueueReplaceState:function(m,x,C){m=m._reactInternals;var k=as(),W=on(k);W.tag=1,W.payload=x,C!=null&&(W.callback=C),x=Ht(m,W,k),x!==null&&(Ss(x,m,k),kn(x,m,k))},enqueueForceUpdate:function(m,x){m=m._reactInternals;var C=as(),k=on(C);k.tag=2,x!=null&&(k.callback=x),x=Ht(m,k,C),x!==null&&(Ss(x,m,C),kn(x,m,C))}},Da=Error(i(461)),es=!1,jh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},js=!1,Fs=!1,Yp=!1,Ab=typeof WeakSet=="function"?WeakSet:Set,Xs=null,Ts=null,Ys=!1,Ai=null,Rl=8192,Kp={getCacheForType:function(m){var x=le(us),C=x.data.get(m);return C===void 0&&(C=m(),x.data.set(m,C)),C},cacheSignal:function(){return le(us).controller.signal}},mc=0,Zp=1,Qp=2,Ym=3,bf=4;if(typeof Symbol=="function"&&Symbol.for){var Fh=Symbol.for;mc=Fh("selector.component"),Zp=Fh("selector.has_pseudo_class"),Qp=Fh("selector.role"),Ym=Fh("selector.test_id"),bf=Fh("selector.text")}var kl=typeof WeakMap=="function"?WeakMap:Map,Or=0,Er=null,Lr=null,Hr=0,Ni=0,co=null,Bc=!1,_f=!1,Sf=!1,Ru=0,Es=0,Md=0,wf=0,Jp=0,Ia=0,e0=0,Km=null,tl=null,mx=!1,Zm=0,Uh=0,Mf=1/0,Qm=null,Td=null,uo=0,Ed=null,Bh=null,ku=0,t0=0,gx=null,Nb=null,li=0,Jm=null;return Mr.attemptContinuousHydration=function(m){if(m.tag===13||m.tag===31){var x=kt(m,67108864);x!==null&&Ss(x,m,67108864),Dm(m,67108864)}},Mr.attemptHydrationAtCurrentPriority=function(m){if(m.tag===13||m.tag===31){var x=as();x=U(x);var C=kt(m,x);C!==null&&Ss(C,m,x),Dm(m,x)}},Mr.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-Za(x);m.entanglements[1]|=C,x&=~C}He(m),(Or&6)===0&&(Mf=ha()+500,pe(0))}}break;case 31:case 13:x=kt(m,2),x!==null&&Ss(x,m,2),Iv(),Dm(m,2)}},Mr.batchedUpdates=function(m,x){return m(x)},Mr.createComponentSelector=function(m){return{$$typeof:mc,value:m}},Mr.createContainer=function(m,x,C,k,W,ee,Re,lt,It,Wt){return cf(m,x,!1,null,C,k,ee,null,Re,lt,It,Wt)},Mr.createHasPseudoClassSelector=function(m){return{$$typeof:Zp,value:m}},Mr.createHydrationContainer=function(m,x,C,k,W,ee,Re,lt,It,Wt,cn,Yt,bn,hr){var Ks;return m=cf(C,k,!0,m,W,ee,lt,hr,It,Wt,cn,Yt),m.context=Uv(null),C=m.current,k=as(),k=U(k),W=on(k),W.callback=(Ks=x)!=null?Ks:null,Ht(C,W,k),x=k,m.current.lanes=x,P(m,x),He(m),m},Mr.createPortal=function(m,x,C){var k=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Mh,key:k==null?null:""+k,children:m,containerInfo:x,implementation:C}},Mr.createRoleSelector=function(m){return{$$typeof:Qp,value:m}},Mr.createTestNameSelector=function(m){return{$$typeof:Ym,value:m}},Mr.createTextSelector=function(m){return{$$typeof:bf,value:m}},Mr.defaultOnCaughtError=function(m){console.error(m)},Mr.defaultOnRecoverableError=function(m){cx(m)},Mr.defaultOnUncaughtError=function(m){cx(m)},Mr.deferredUpdates=function(m){var x=Hn.T,C=oc();try{return Ur(32),Hn.T=null,m()}finally{Ur(C),Hn.T=x}},Mr.discreteUpdates=function(m,x,C,k,W){var ee=Hn.T,Re=oc();try{return Ur(2),Hn.T=null,m(x,C,k,W)}finally{Ur(Re),Hn.T=ee,Or===0&&(Mf=ha()+500)}},Mr.findAllNodes=qa,Mr.findBoundingRects=function(m,x){if(!bo)throw Error(i(363));x=qa(m,x),m=[];for(var C=0;C<x.length;C++)m.push(Xv(x[C]));for(x=m.length-1;0<x;x--){C=m[x];for(var k=C.x,W=k+C.width,ee=C.y,Re=ee+C.height,lt=x-1;0<=lt;lt--)if(x!==lt){var It=m[lt],Wt=It.x,cn=Wt+It.width,Yt=It.y,bn=Yt+It.height;if(k>=Wt&&ee>=Yt&&W<=cn&&Re<=bn){m.splice(x,1);break}else if(k!==Wt||C.width!==It.width||bn<ee||Yt>Re){if(!(ee!==Yt||C.height!==It.height||cn<k||Wt>W)){Wt>k&&(It.width+=Wt-k,It.x=k),cn<W&&(It.width=W-Wt),m.splice(x,1);break}}else{Yt>ee&&(It.height+=Yt-ee,It.y=ee),bn<Re&&(It.height=Re-Yt),m.splice(x,1);break}}}return m},Mr.findHostInstance=Pm,Mr.findHostInstanceWithNoPortals=function(m){return m=a(m),m=m!==null?c(m):null,m===null?null:Hp(m.stateNode)},Mr.findHostInstanceWithWarning=function(m){return Pm(m)},Mr.flushPassiveEffects=_u,Mr.flushSyncFromReconciler=function(m){var x=Or;Or|=1;var C=Hn.T,k=oc();try{if(Ur(2),Hn.T=null,m)return m()}finally{Ur(k),Hn.T=C,Or=x,(Or&6)===0&&pe(0)}},Mr.flushSyncWork=Iv,Mr.focusWithin=function(m,x){if(!bo)throw Error(i(363));for(m=rf(m),x=Op(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)&&yd(C.stateNode))return!0;for(C=C.child;C!==null;)x.push(C),C=C.sibling}}return!1},Mr.getFindAllNodesFailureDescription=function(m,x){if(!bo)throw Error(i(363));var C=0,k=[];m=[rf(m),0];for(var W=0;W<m.length;){var ee=m[W++],Re=ee.tag,lt=m[W++],It=x[lt];if((Re!==5&&Re!==26&&Re!==27||!ff(ee))&&(sf(ee,It)&&(k.push(Ip(It)),lt++,lt>C&&(C=lt)),lt<x.length))for(ee=ee.child;ee!==null;)m.push(ee,lt),ee=ee.sibling}if(C<x.length){for(m=[];C<x.length;C++)m.push(Ip(x[C]));return`findAllNodes was able to match part of the selector:
  `+(k.join(" > ")+`

No matching component was found for:
  `)+m.join(" > ")}return null},Mr.getPublicRootInstance=function(m){if(m=m.current,!m.child)return null;switch(m.child.tag){case 27:case 5:return Hp(m.child.stateNode);default:return m.child.stateNode}},Mr.injectIntoDevTools=function(){var m={bundleType:0,version:Gy,rendererPackageName:Lm,currentDispatcherRef:Hn,reconcilerVersion:"19.2.0"};if(Bp!==null&&(m.rendererConfig=Bp),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),Qa=x}catch{}m=!!x.checkDCE}}return m},Mr.isAlreadyRendering=function(){return(Or&6)!==0},Mr.observeVisibleRects=function(m,x,C,k){if(!bo)throw Error(i(363));m=qa(m,x);var W=Yv(m,C,k).disconnect;return{disconnect:function(){W()}}},Mr.shouldError=function(){return null},Mr.shouldSuspend=function(){return!1},Mr.startHostTransition=function(m,x,C,k){if(m.tag!==5)throw Error(i(476));var W=id(m).queue;rd(m,W,x,Nh,C===null?r:function(){var ee=id(m);return ee.next===null&&(ee=m.alternate.memoizedState),xo(m,ee.next.queue,{},as()),C(k)})},Mr.updateContainer=function(m,x,C,k){var W=x.current,ee=as();return Hy(W,ee,m,x,C,k),ee},Mr.updateContainerSync=function(m,x,C,k){return Hy(x.current,2,m,x,C,k),2},Mr},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})(Dj)),Dj.exports}var Oj;function IEe(){return Oj||(Oj=1,Pj.exports=DEe()),Pj.exports}var OEe=IEe();const LEe=PEe(OEe);function zEe(t){const e=LEe(t);return e.injectIntoDevTools(),e}const AK=0,ly={},jEe=/^three(?=[A-Z])/,kE=t=>`${t[0].toUpperCase()}${t.slice(1)}`;let FEe=0;const UEe=t=>typeof t=="function";function BEe(t){if(UEe(t)){const e=`${FEe++}`;return ly[e]=t,e}else Object.assign(ly,t)}function NK(t,e){const n=kE(t),r=ly[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 HEe(t,e,n){var r;return t=kE(t)in ly?t:t.replace(jEe,""),NK(t,e),t==="primitive"&&(r=e.object)!=null&&r.__r3f&&delete e.object.__r3f,T5(e.object,n,t,e)}function VEe(t){if(!t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?C5(t.parent,t):Sc(t.object)&&(t.object.visible=!1),t.isHidden=!0,Iy(t)}}function RK(t){if(t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?E5(t.parent,t):Sc(t.object)&&t.props.visible!==!1&&(t.object.visible=!0),t.isHidden=!1,Iy(t)}}function D9(t,e,n){const r=e.root.getState();if(!(!t.parent&&t.object!==r.scene)){if(!e.object){var i,s;const o=ly[kE(e.type)];e.object=(i=e.props.object)!=null?i:new o(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(A0(e.object,e.props),e.props.attach)E5(t,e);else if(Sc(e.object)&&Sc(t.object)){const o=t.object.children.indexOf(n==null?void 0:n.object);if(n&&o!==-1){const a=t.object.children.indexOf(e.object);if(a!==-1){t.object.children.splice(a,1);const l=a<o?o-1:o;t.object.children.splice(l,0,e.object)}else e.object.parent=t.object,t.object.children.splice(o,0,e.object),e.object.dispatchEvent({type:"added"}),t.object.dispatchEvent({type:"childadded",child:e.object})}else t.object.add(e.object)}for(const o of e.children)D9(e,o);Iy(e)}}function N6(t,e){e&&(e.parent=t,t.children.push(e),D9(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),D9(t,e,n)}function kK(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?C5(t,e):Sc(e.object)&&Sc(t.object)&&(t.object.remove(e.object),MEe(bK(e),e.object));const i=e.props.dispose!==null&&n!==!1;for(let s=e.children.length-1;s>=0;s--){const o=e.children[s];t7(e,o,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&kK(e.object),n===void 0&&Iy(e)}function GEe(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 WM=[];function WEe(){for(const[n]of WM){const r=n.parent;if(r){n.props.attach?C5(r,n):Sc(n.object)&&Sc(r.object)&&r.object.remove(n.object);for(const i of n.children)i.props.attach?C5(n,i):Sc(i.object)&&Sc(n.object)&&n.object.remove(i.object)}n.isHidden&&RK(n),n.object.__r3f&&delete n.object.__r3f,n.type!=="primitive"&&kK(n.object)}for(const[n,r,i]of WM){n.props=r;const s=n.parent;if(s){var t,e;const o=ly[kE(n.type)];n.object=(t=n.props.object)!=null?t:new o(...(e=n.props.args)!=null?e:[]),n.object.__r3f=n,GEe(i,n.object),A0(n.object,n.props),n.props.attach?E5(s,n):Sc(n.object)&&Sc(s.object)&&s.object.add(n.object);for(const a of n.children)a.props.attach?E5(n,a):Sc(a.object)&&Sc(n.object)&&n.object.add(a.object);Iy(n)}}WM.length=0}const R6=()=>{},zj={};let _M=AK;const $Ee=0,qEe=4,n7=zEe({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:HEe,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,o,a;NK(e,r);let l=!1;if((t.type==="primitive"&&n.object!==r.object||((s=r.args)==null?void 0:s.length)!==((o=n.args)==null?void 0:o.length)||(a=r.args)!=null&&a.some((d,h)=>{var g;return d!==((g=n.args)==null?void 0:g[h])}))&&(l=!0),l)WM.push([t,{...r},i]);else{const d=bEe(t,r);Object.keys(d).length&&(Object.assign(t.props,d),A0(t.object,d))}(i.sibling===null||(i.flags&qEe)===$Ee)&&WEe()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:t=>t==null?void 0:t.object,prepareForCommit:()=>null,preparePortalMount:t=>T5(t.getState().scene,t,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:VEe,unhideInstance:RK,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){_M=t},getCurrentUpdatePriority(){return _M},resolveUpdatePriority(){var t;if(_M!==AK)return _M;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 REe;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return AEe;default:return NEe}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:kEe.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,Kx={objects:"shallow",strict:!1};function XEe(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 YEe(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||EEe(s7,Fj),o=n||n7.createContainer(s,CEe,null,!1,null,"",i,i,i,null);e||hv.set(t,{fiber:o,store:s});let a,l,c=!1,d=null;return{async configure(h={}){let g;d=new Promise(z=>g=z);let{gl:v,size:b,scene:_,events:w,onCreated:S,shadows:E=!1,linear:A=!1,flat:N=!1,legacy:I=!1,orthographic:P=!1,frameloop:L="always",dpr:R=[1,2],performance:O,raycaster:F,camera:U,onPointerMissed:q}=h,B=s.getState(),Z=B.gl;if(!B.gl){const z={canvas:t,powerPreference:"high-performance",antialias:!0,alpha:!0},X=typeof v=="function"?await v(z):v;kj(X)?Z=X:Z=new gK({...z,...v}),B.set({gl:Z})}let G=B.raycaster;G||B.set({raycaster:G=new oK});const{params:$,...K}=F||{};if(Qs.equ(K,G,Kx)||A0(G,{...K}),Qs.equ($,G.params,Kx)||A0(G,{params:{...G.params,...$}}),!B.camera||B.camera===l&&!Qs.equ(l,U,Kx)){l=U;const z=U==null?void 0:U.isCamera,X=z?U:P?new Vd(0,0,0,0,.1,1e3):new eo(75,0,.1,1e3);z||(X.position.z=5,U&&(A0(X,U),X.manual||("aspect"in U||"left"in U||"right"in U||"bottom"in U||"top"in U)&&(X.manual=!0,X.updateProjectionMatrix())),!B.camera&&!(U!=null&&U.rotation)&&X.lookAt(0,0,0)),B.set({camera:X}),G.camera=X}if(!B.scene){let z;_!=null&&_.isScene?(z=_,T5(z,s,"",{})):(z=new n9,T5(z,s,"",{}),_&&A0(z,_)),B.set({scene:z})}w&&!B.events.handlers&&B.set({events:w(s)});const Y=XEe(t,b);if(Qs.equ(Y,B.size,Kx)||B.setSize(Y.width,Y.height,Y.top,Y.left),R&&B.viewport.dpr!==wK(R)&&B.setDpr(R),B.frameloop!==L&&B.setFrameloop(L),B.onPointerMissed||B.set({onPointerMissed:q}),O&&!Qs.equ(O,B.performance,Kx)&&B.set(z=>({performance:{...z.performance,...O}})),!B.xr){var J;const z=(ie,ae)=>{const re=s.getState();re.frameloop!=="never"&&Fj(ie,!0,re,ae)},X=()=>{const ie=s.getState();ie.gl.xr.enabled=ie.gl.xr.isPresenting,ie.gl.xr.setAnimationLoop(ie.gl.xr.isPresenting?z:null),ie.gl.xr.isPresenting||s7(ie)},V={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((J=Z.xr)==null?void 0:J.addEventListener)=="function"&&V.connect(),B.set({xr:V})}if(Z.shadowMap){const z=Z.shadowMap.enabled,X=Z.shadowMap.type;if(Z.shadowMap.enabled=!!E,Qs.boo(E))Z.shadowMap.type=I_;else if(Qs.str(E)){var H;const V={basic:EX,percentage:b1,soft:I_,variance:Rg};Z.shadowMap.type=(H=V[E])!=null?H:I_}else Qs.obj(E)&&Object.assign(Z.shadowMap,E);(z!==Z.shadowMap.enabled||X!==Z.shadowMap.type)&&(Z.shadowMap.needsUpdate=!0)}return oi.enabled=!I,c||(Z.outputColorSpace=A?tm:ll,Z.toneMapping=N?ru:WT),B.legacy!==I&&B.set(()=>({legacy:I})),B.linear!==A&&B.set(()=>({linear:A})),B.flat!==N&&B.set(()=>({flat:N})),v&&!Qs.fun(v)&&!kj(v)&&!Qs.equ(v,Z,Kx)&&A0(Z,v),a=S,c=!0,g(),this},render(h){return!c&&!d&&this.configure(),d.then(()=>{n7.updateContainer(p.jsx(KEe,{store:s,children:h,onCreated:a,rootElement:t}),o,null,()=>{})}),s},unmount(){PK(t)}}}function KEe({store:t,children:e,onCreated:n,rootElement:r}){return Nw(()=>{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(EK.Provider,{value:t,children:e})}function PK(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,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),vEe(i.scene),hv.delete(t)}catch{}},500)})}}const ZEe=new Set,QEe=new Set,JEe=new Set;function k6(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function W_(t,e){switch(t){case"before":return k6(ZEe,e);case"after":return k6(QEe,e);case"tail":return k6(JEe,e)}}let P6,D6;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++)D6=P6[i],D6.ref.current(D6.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 A5=!1,i7=!1,I6,jj,Zx;function DK(t){jj=requestAnimationFrame(DK),A5=!0,I6=0,W_("before",t),i7=!0;for(const n of hv.values()){var e;Zx=n.store.getState(),Zx.internal.active&&(Zx.frameloop==="always"||Zx.internal.frames>0)&&!((e=Zx.gl.xr)!=null&&e.isPresenting)&&(I6+=r7(t,Zx))}if(i7=!1,W_("after",t),I6===0)return W_("tail",t),A5=!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,A5||(A5=!0,requestAnimationFrame(DK)))}function Fj(t,e=!0,n,r){if(e&&W_("before",t),n)r7(t,n,r);else for(const i of hv.values())r7(t,i.store.getState());e&&W_("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 eCe(t){const{handlePointer:e}=TEe(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 o=i.handlers[s],[a,l]=O6[s];n.addEventListener(a,o,{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],[o]=O6[i];r.connected.removeEventListener(o,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 tCe({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,o]=T.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=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(!a.current.element)return;const{left:E,top:A,width:N,height:I,bottom:P,right:L,x:R,y:O}=a.current.element.getBoundingClientRect(),F={left:E,top:A,width:N,height:I,bottom:P,right:L,x:R,y:O};a.current.element instanceof HTMLElement&&r&&(F.height=a.current.element.offsetHeight,F.width=a.current.element.offsetWidth),Object.freeze(F),d.current&&!sCe(a.current.lastBounds,F)&&o(a.current.lastBounds=F)};return[S,c?Uj(S,c):S,l?Uj(S,l):S]},[o,r,l,c]);function b(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(S=>S.removeEventListener("scroll",v,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function _(){a.current.element&&(a.current.resizeObserver=new i(v),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(S=>S.addEventListener("scroll",v,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{v()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const w=S=>{!S||S===a.current.element||(b(),a.current.element=S,a.current.scrollContainers=IK(S),_())};return rCe(v,!!e),nCe(g),T.useEffect(()=>{b(),_()},[e,v,g]),T.useEffect(()=>b,[]),[w,s,h]}function nCe(t){T.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function rCe(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 IK(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,...IK(t.parentElement)]}const iCe=["x","y","top","bottom","left","right","width","height"],sCe=(t,e)=>iCe.every(n=>t[n]===e[n]);function oCe({ref:t,children:e,fallback:n,resize:r,style:i,gl:s,events:o=eCe,eventSource:a,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:I,...P}){T.useMemo(()=>BEe(qTe),[]);const L=pEe(),[R,O]=tCe({scroll:!0,debounce:{scroll:50,resize:0},...r}),F=T.useRef(null),U=T.useRef(null);T.useImperativeHandle(t,()=>F.current);const q=SK(N),[B,Z]=T.useState(!1),[G,$]=T.useState(!1);if(B)throw B;if(G)throw G;const K=T.useRef(null);Nw(()=>{const J=F.current;if(O.width>0&&O.height>0&&J){K.current||(K.current=YEe(J));async function H(){await K.current.configure({gl:s,scene:A,events:o,shadows:c,linear:d,flat:h,legacy:g,orthographic:v,frameloop:b,dpr:_,performance:w,raycaster:S,camera:E,size:O,onPointerMissed:(...z)=>q.current==null?void 0:q.current(...z),onCreated:z=>{z.events.connect==null||z.events.connect(a?fEe(a)?a.current:a:U.current),l&&z.setEvents({compute:(X,V)=>{const ie=X[l+"X"],ae=X[l+"Y"];V.pointer.set(ie/V.size.width*2-1,-(ae/V.size.height)*2+1),V.raycaster.setFromCamera(V.pointer,V.camera)}}),I==null||I(z)}}),K.current.render(p.jsx(L,{children:p.jsx(gEe,{set:$,children:p.jsx(T.Suspense,{fallback:p.jsx(mEe,{set:Z}),children:e??null})})}))}H()}}),T.useEffect(()=>{const J=F.current;if(J)return()=>PK(J)},[]);const Y=a?"none":"auto";return p.jsx("div",{ref:U,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:F,style:{display:"block"},children:n})})})}function aCe(t){return p.jsx(xK,{children:p.jsx(oCe,{...t})})}function ch(){return ch=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},ch.apply(null,arguments)}const Rw=new ze,I9=new ze,lCe=new ze,Bj=new jt;function cCe(t,e,n){const r=Rw.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 uCe(t,e){const n=Rw.setFromMatrixPosition(t.matrixWorld),r=I9.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),s=e.getWorldDirection(lCe);return i.angleTo(s)>Math.PI/2}function dCe(t,e,n,r){const i=Rw.setFromMatrixPosition(t.matrixWorld),s=i.clone();s.project(e),Bj.set(s.x,s.y),n.setFromCamera(Bj,e);const o=n.intersectObjects(r,!0);if(o.length){const a=o[0].distance;return i.distanceTo(n.ray.origin)<a}return!0}function fCe(t,e){if(e instanceof Vd)return e.zoom;if(e instanceof eo){const n=Rw.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 hCe(t,e,n){if(e instanceof eo||e instanceof Vd){const r=Rw.setFromMatrixPosition(t.matrixWorld),i=I9.setFromMatrixPosition(e.matrixWorld),s=r.distanceTo(i),o=(n[1]-n[0])/(e.far-e.near),a=n[1]-o*e.far;return Math.round(o*s+a)}}const o7=t=>Math.abs(t)<1e-10?0:t;function OK(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=o7(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const pCe=(t=>e=>OK(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),mCe=(t=>(e,n)=>OK(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 gCe(t){return t&&typeof t=="object"&&"current"in t}const O9=T.forwardRef(({children:t,eps:e=.001,style:n,className:r,prepend:i,center:s,fullscreen:o,portal:a,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=cCe,as:A="div",wrapperClass:N,pointerEvents:I="auto",...P},L)=>{const{gl:R,camera:O,scene:F,size:U,raycaster:q,events:B,viewport:Z}=qc(),[G]=T.useState(()=>document.createElement(A)),$=T.useRef(null),K=T.useRef(null),Y=T.useRef(0),J=T.useRef([0,0]),H=T.useRef(null),z=T.useRef(null),X=(a==null?void 0:a.current)||B.connected||R.domElement.parentNode,V=T.useRef(null),ie=T.useRef(!1),ae=T.useMemo(()=>h&&h!=="blending"||Array.isArray(h)&&h.length&&gCe(h[0]),[h]);T.useLayoutEffect(()=>{const me=R.domElement;h&&h==="blending"?(me.style.zIndex=`${Math.floor(S[0]/2)}`,me.style.position="absolute",me.style.pointerEvents="none"):(me.style.zIndex=null,me.style.position=null,me.style.pointerEvents=null)},[h]),T.useLayoutEffect(()=>{if(K.current){const me=$.current=OF.createRoot(G);if(F.updateMatrixWorld(),d)G.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const ye=E(K.current,O,U);G.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${ye[0]}px,${ye[1]}px,0);transform-origin:0 0;`}return X&&(i?X.prepend(G):X.appendChild(G)),()=>{X&&X.removeChild(G),me.unmount()}}},[X,d]),T.useLayoutEffect(()=>{N&&(G.className=N)},[N]);const re=T.useMemo(()=>d?{position:"absolute",top:0,left:0,width:U.width,height:U.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-U.height/2,left:-U.width/2,width:U.width,height:U.height},...n},[n,s,o,U,d]),ce=T.useMemo(()=>({position:"absolute",pointerEvents:I}),[I]);T.useLayoutEffect(()=>{if(ie.current=!1,d){var me;(me=$.current)==null||me.render(T.createElement("div",{ref:H,style:re},T.createElement("div",{ref:z,style:ce},T.createElement("div",{ref:L,className:r,style:n,children:t}))))}else{var ye;(ye=$.current)==null||ye.render(T.createElement("div",{ref:L,style:re,className:r,children:t}))}});const oe=T.useRef(!0);RE(me=>{if(K.current){O.updateMatrixWorld(),K.current.updateWorldMatrix(!0,!1);const ye=d?J.current:E(K.current,O,U);if(d||Math.abs(Y.current-O.zoom)>e||Math.abs(J.current[0]-ye[0])>e||Math.abs(J.current[1]-ye[1])>e){const Ee=uCe(K.current,O);let Ge=!1;ae&&(Array.isArray(h)?Ge=h.map(Le=>Le.current):h!=="blending"&&(Ge=[F]));const _e=oe.current;if(Ge){const Le=dCe(K.current,O,q,Ge);oe.current=Le&&!Ee}else oe.current=!Ee;_e!==oe.current&&(g?g(!oe.current):G.style.display=oe.current?"block":"none");const De=Math.floor(S[0]/2),he=h?ae?[S[0],De]:[De-1,0]:S;if(G.style.zIndex=`${hCe(K.current,O,he)}`,d){const[Le,ne]=[U.width/2,U.height/2],We=O.projectionMatrix.elements[5]*ne,{isOrthographicCamera:je,top:be,left:Xe,bottom:le,right:te}=O,Se=pCe(O.matrixWorldInverse),ve=je?`scale(${We})translate(${o7(-(te+Xe)/2)}px,${o7((be+le)/2)}px)`:`translateZ(${We}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),G.style.width=U.width+"px",G.style.height=U.height+"px",G.style.perspective=je?"":`${We}px`,H.current&&z.current&&(H.current.style.transform=`${ve}${Se}translate(${Le}px,${ne}px)`,z.current.style.transform=mCe(ge,1/((l||10)/400)))}else{const Le=l===void 0?1:fCe(K.current,O)*l;G.style.transform=`translate3d(${ye[0]}px,${ye[1]}px,0) scale(${Le})`}J.current=ye,Y.current=O.zoom}}if(!ae&&V.current&&!ie.current)if(d){if(H.current){const ye=H.current.children[0];if(ye!=null&&ye.clientWidth&&ye!=null&&ye.clientHeight){const{isOrthographicCamera:Ee}=O;if(Ee||w)P.scale&&(Array.isArray(P.scale)?P.scale instanceof ze?V.current.scale.copy(P.scale.clone().divideScalar(1)):V.current.scale.set(1/P.scale[0],1/P.scale[1],1/P.scale[2]):V.current.scale.setScalar(1/P.scale));else{const Ge=(l||10)/400,_e=ye.clientWidth*Ge,De=ye.clientHeight*Ge;V.current.scale.set(_e,De,1)}ie.current=!0}}}else{const ye=G.children[0];if(ye!=null&&ye.clientWidth&&ye!=null&&ye.clientHeight){const Ee=1/Z.factor,Ge=ye.clientWidth*Ee,_e=ye.clientHeight*Ee;V.current.scale.set(Ge,_e,1),ie.current=!0}V.current.lookAt(me.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",ch({},P,{ref:K}),h&&!ae&&T.createElement("mesh",{castShadow:v,receiveShadow:b,ref:V},w||T.createElement("planeGeometry",null),_||T.createElement("shaderMaterial",{side:Yc,vertexShader:fe.vertexShader,fragmentShader:fe.fragmentShader})))}),LK=parseInt(bw.replace(/\D+/g,"")),zK=LK>=125?"uv1":"uv2";function vCe(t,e=Math.PI/3){const n=Math.cos(e),r=(1+1e-10)*100,i=[new ze,new ze,new ze],s=new ze,o=new ze,a=new ze,l=new ze;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),o.subVectors(E,A);const I=new ze().crossVectors(s,o).normalize();for(let P=0;P<3;P++){const L=i[P],R=c(L);R in g||(g[R]=[]),g[R].push(I)}}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),o.subVectors(E,A),a.crossVectors(s,o).normalize();for(let I=0;I<3;I++){const P=i[I],L=c(P),R=g[L];l.set(0,0,0);for(let O=0,F=R.length;O<F;O++){const U=R[O];a.dot(U)>n&&l.add(U)}l.normalize(),b.setXYZ(S+I,l.x,l.y,l.z)}}return d.setAttribute("normal",b),d}var xCe=Object.defineProperty,yCe=(t,e,n)=>e in t?xCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bCe=(t,e,n)=>(yCe(t,e+"",n),n);class _Ce{constructor(){bCe(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,o=i.length;s<o;s++)i[s].call(this,e);e.target=null}}}var SCe=Object.defineProperty,wCe=(t,e,n)=>e in t?SCe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kn=(t,e,n)=>(wCe(t,typeof e!="symbol"?e+"":e,n),n);const SM=new Tv,Hj=new ep,MCe=Math.cos(70*(Math.PI/180)),Vj=(t,e)=>(t%e+e)%e;let TCe=class extends _Ce{constructor(e,n){super(),Kn(this,"object"),Kn(this,"domElement"),Kn(this,"enabled",!0),Kn(this,"target",new ze),Kn(this,"minDistance",0),Kn(this,"maxDistance",1/0),Kn(this,"minZoom",0),Kn(this,"maxZoom",1/0),Kn(this,"minPolarAngle",0),Kn(this,"maxPolarAngle",Math.PI),Kn(this,"minAzimuthAngle",-1/0),Kn(this,"maxAzimuthAngle",1/0),Kn(this,"enableDamping",!1),Kn(this,"dampingFactor",.05),Kn(this,"enableZoom",!0),Kn(this,"zoomSpeed",1),Kn(this,"enableRotate",!0),Kn(this,"rotateSpeed",1),Kn(this,"enablePan",!0),Kn(this,"panSpeed",1),Kn(this,"screenSpacePanning",!0),Kn(this,"keyPanSpeed",7),Kn(this,"zoomToCursor",!1),Kn(this,"autoRotate",!1),Kn(this,"autoRotateSpeed",2),Kn(this,"reverseOrbit",!1),Kn(this,"reverseHorizontalOrbit",!1),Kn(this,"reverseVerticalOrbit",!1),Kn(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Kn(this,"mouseButtons",{LEFT:wg.ROTATE,MIDDLE:wg.DOLLY,RIGHT:wg.PAN}),Kn(this,"touches",{ONE:Mg.ROTATE,TWO:Mg.DOLLY_PAN}),Kn(this,"target0"),Kn(this,"position0"),Kn(this,"zoom0"),Kn(this,"_domElementKeyEvents",null),Kn(this,"getPolarAngle"),Kn(this,"getAzimuthalAngle"),Kn(this,"setPolarAngle"),Kn(this,"setAzimuthalAngle"),Kn(this,"getDistance"),Kn(this,"getZoomScale"),Kn(this,"listenToKeyEvents"),Kn(this,"stopListenToKeyEvents"),Kn(this,"saveState"),Kn(this,"reset"),Kn(this,"update"),Kn(this,"connect"),Kn(this,"dispose"),Kn(this,"dollyIn"),Kn(this,"dollyOut"),Kn(this,"getScale"),Kn(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=we=>{let ke=Vj(we,2*Math.PI),Ze=d.phi;Ze<0&&(Ze+=2*Math.PI),ke<0&&(ke+=2*Math.PI);let Ne=Math.abs(ke-Ze);2*Math.PI-Ne<Ne&&(ke<Ze?ke+=2*Math.PI:Ze+=2*Math.PI),h.phi=ke-Ze,r.update()},this.setAzimuthalAngle=we=>{let ke=Vj(we,2*Math.PI),Ze=d.theta;Ze<0&&(Ze+=2*Math.PI),ke<0&&(ke+=2*Math.PI);let Ne=Math.abs(ke-Ze);2*Math.PI-Ne<Ne&&(ke<Ze?ke+=2*Math.PI:Ze+=2*Math.PI),h.theta=ke-Ze,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=we=>{we.addEventListener("keydown",Te),this._domElementKeyEvents=we},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Te),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=a.NONE},this.update=(()=>{const we=new ze,ke=new ze(0,1,0),Ze=new Ua().setFromUnitVectors(e.up,ke),Ne=Ze.clone().invert(),Ke=new ze,it=new Ua,ht=2*Math.PI;return function(){const $e=r.object.position;Ze.setFromUnitVectors(e.up,ke),Ne.copy(Ze).invert(),we.copy($e).sub(r.target),we.applyQuaternion(Ze),d.setFromVector3(we),r.autoRotate&&l===a.NONE&&Z(q()),r.enableDamping?(d.theta+=h.theta*r.dampingFactor,d.phi+=h.phi*r.dampingFactor):(d.theta+=h.theta,d.phi+=h.phi);let Ae=r.minAzimuthAngle,Oe=r.maxAzimuthAngle;isFinite(Ae)&&isFinite(Oe)&&(Ae<-Math.PI?Ae+=ht:Ae>Math.PI&&(Ae-=ht),Oe<-Math.PI?Oe+=ht:Oe>Math.PI&&(Oe-=ht),Ae<=Oe?d.theta=Math.max(Ae,Math.min(Oe,d.theta)):d.theta=d.theta>(Ae+Oe)/2?Math.max(Ae,d.theta):Math.min(Oe,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=V(d.radius):d.radius=V(d.radius*g),we.setFromSpherical(d),we.applyQuaternion(Ne),$e.copy(r.target).add(we),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 Ye=!1;if(r.zoomToCursor&&O){let st=null;if(r.object instanceof eo&&r.object.isPerspectiveCamera){const Rt=we.length();st=V(Rt*g);const yt=Rt-st;r.object.position.addScaledVector(L,yt),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const Rt=new ze(R.x,R.y,0);Rt.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/g)),r.object.updateProjectionMatrix(),Ye=!0;const yt=new ze(R.x,R.y,0);yt.unproject(r.object),r.object.position.sub(yt).add(Rt),r.object.updateMatrixWorld(),st=we.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;st!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(st).add(r.object.position):(SM.origin.copy(r.object.position),SM.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(SM.direction))<MCe?e.lookAt(r.target):(Hj.setFromNormalAndCoplanarPoint(r.object.up,r.target),SM.intersectPlane(Hj,r.target))))}else r.object instanceof Vd&&r.object.isOrthographicCamera&&(Ye=g!==1,Ye&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/g)),r.object.updateProjectionMatrix()));return g=1,O=!1,Ye||Ke.distanceToSquared(r.object.position)>c||8*(1-it.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Ke.copy(r.object.position),it.copy(r.object.quaternion),Ye=!1,!0):!1}})(),this.connect=we=>{r.domElement=we,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",qe),r.domElement.addEventListener("pointerdown",Xe),r.domElement.addEventListener("pointercancel",te),r.domElement.addEventListener("wheel",ge)},this.dispose=()=>{var we,ke,Ze,Ne,Ke,it;r.domElement&&(r.domElement.style.touchAction="auto"),(we=r.domElement)==null||we.removeEventListener("contextmenu",qe),(ke=r.domElement)==null||ke.removeEventListener("pointerdown",Xe),(Ze=r.domElement)==null||Ze.removeEventListener("pointercancel",te),(Ne=r.domElement)==null||Ne.removeEventListener("wheel",ge),(Ke=r.domElement)==null||Ke.ownerDocument.removeEventListener("pointermove",le),(it=r.domElement)==null||it.ownerDocument.removeEventListener("pointerup",te),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",Te)};const r=this,i={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,d=new XR,h=new XR;let g=1;const v=new ze,b=new jt,_=new jt,w=new jt,S=new jt,E=new jt,A=new jt,N=new jt,I=new jt,P=new jt,L=new ze,R=new jt;let O=!1;const F=[],U={};function q(){return 2*Math.PI/60/60*r.autoRotateSpeed}function B(){return Math.pow(.95,r.zoomSpeed)}function Z(we){r.reverseOrbit||r.reverseHorizontalOrbit?h.theta+=we:h.theta-=we}function G(we){r.reverseOrbit||r.reverseVerticalOrbit?h.phi+=we:h.phi-=we}const $=(()=>{const we=new ze;return function(Ze,Ne){we.setFromMatrixColumn(Ne,0),we.multiplyScalar(-Ze),v.add(we)}})(),K=(()=>{const we=new ze;return function(Ze,Ne){r.screenSpacePanning===!0?we.setFromMatrixColumn(Ne,1):(we.setFromMatrixColumn(Ne,0),we.crossVectors(r.object.up,we)),we.multiplyScalar(Ze),v.add(we)}})(),Y=(()=>{const we=new ze;return function(Ze,Ne){const Ke=r.domElement;if(Ke&&r.object instanceof eo&&r.object.isPerspectiveCamera){const it=r.object.position;we.copy(it).sub(r.target);let ht=we.length();ht*=Math.tan(r.object.fov/2*Math.PI/180),$(2*Ze*ht/Ke.clientHeight,r.object.matrix),K(2*Ne*ht/Ke.clientHeight,r.object.matrix)}else Ke&&r.object instanceof Vd&&r.object.isOrthographicCamera?($(Ze*(r.object.right-r.object.left)/r.object.zoom/Ke.clientWidth,r.object.matrix),K(Ne*(r.object.top-r.object.bottom)/r.object.zoom/Ke.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function J(we){r.object instanceof eo&&r.object.isPerspectiveCamera||r.object instanceof Vd&&r.object.isOrthographicCamera?g=we:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function H(we){J(g/we)}function z(we){J(g*we)}function X(we){if(!r.zoomToCursor||!r.domElement)return;O=!0;const ke=r.domElement.getBoundingClientRect(),Ze=we.clientX-ke.left,Ne=we.clientY-ke.top,Ke=ke.width,it=ke.height;R.x=Ze/Ke*2-1,R.y=-(Ne/it)*2+1,L.set(R.x,R.y,1).unproject(r.object).sub(r.object.position).normalize()}function V(we){return Math.max(r.minDistance,Math.min(r.maxDistance,we))}function ie(we){b.set(we.clientX,we.clientY)}function ae(we){X(we),N.set(we.clientX,we.clientY)}function re(we){S.set(we.clientX,we.clientY)}function ce(we){_.set(we.clientX,we.clientY),w.subVectors(_,b).multiplyScalar(r.rotateSpeed);const ke=r.domElement;ke&&(Z(2*Math.PI*w.x/ke.clientHeight),G(2*Math.PI*w.y/ke.clientHeight)),b.copy(_),r.update()}function oe(we){I.set(we.clientX,we.clientY),P.subVectors(I,N),P.y>0?H(B()):P.y<0&&z(B()),N.copy(I),r.update()}function fe(we){E.set(we.clientX,we.clientY),A.subVectors(E,S).multiplyScalar(r.panSpeed),Y(A.x,A.y),S.copy(E),r.update()}function me(we){X(we),we.deltaY<0?z(B()):we.deltaY>0&&H(B()),r.update()}function ye(we){let ke=!1;switch(we.code){case r.keys.UP:Y(0,r.keyPanSpeed),ke=!0;break;case r.keys.BOTTOM:Y(0,-r.keyPanSpeed),ke=!0;break;case r.keys.LEFT:Y(r.keyPanSpeed,0),ke=!0;break;case r.keys.RIGHT:Y(-r.keyPanSpeed,0),ke=!0;break}ke&&(we.preventDefault(),r.update())}function Ee(){if(F.length==1)b.set(F[0].pageX,F[0].pageY);else{const we=.5*(F[0].pageX+F[1].pageX),ke=.5*(F[0].pageY+F[1].pageY);b.set(we,ke)}}function Ge(){if(F.length==1)S.set(F[0].pageX,F[0].pageY);else{const we=.5*(F[0].pageX+F[1].pageX),ke=.5*(F[0].pageY+F[1].pageY);S.set(we,ke)}}function _e(){const we=F[0].pageX-F[1].pageX,ke=F[0].pageY-F[1].pageY,Ze=Math.sqrt(we*we+ke*ke);N.set(0,Ze)}function De(){r.enableZoom&&_e(),r.enablePan&&Ge()}function he(){r.enableZoom&&_e(),r.enableRotate&&Ee()}function Le(we){if(F.length==1)_.set(we.pageX,we.pageY);else{const Ze=Fe(we),Ne=.5*(we.pageX+Ze.x),Ke=.5*(we.pageY+Ze.y);_.set(Ne,Ke)}w.subVectors(_,b).multiplyScalar(r.rotateSpeed);const ke=r.domElement;ke&&(Z(2*Math.PI*w.x/ke.clientHeight),G(2*Math.PI*w.y/ke.clientHeight)),b.copy(_)}function ne(we){if(F.length==1)E.set(we.pageX,we.pageY);else{const ke=Fe(we),Ze=.5*(we.pageX+ke.x),Ne=.5*(we.pageY+ke.y);E.set(Ze,Ne)}A.subVectors(E,S).multiplyScalar(r.panSpeed),Y(A.x,A.y),S.copy(E)}function We(we){const ke=Fe(we),Ze=we.pageX-ke.x,Ne=we.pageY-ke.y,Ke=Math.sqrt(Ze*Ze+Ne*Ne);I.set(0,Ke),P.set(0,Math.pow(I.y/N.y,r.zoomSpeed)),H(P.y),N.copy(I)}function je(we){r.enableZoom&&We(we),r.enablePan&&ne(we)}function be(we){r.enableZoom&&We(we),r.enableRotate&&Le(we)}function Xe(we){var ke,Ze;r.enabled!==!1&&(F.length===0&&((ke=r.domElement)==null||ke.ownerDocument.addEventListener("pointermove",le),(Ze=r.domElement)==null||Ze.ownerDocument.addEventListener("pointerup",te)),xt(we),we.pointerType==="touch"?He(we):Se(we))}function le(we){r.enabled!==!1&&(we.pointerType==="touch"?pe(we):ve(we))}function te(we){var ke,Ze,Ne;nt(we),F.length===0&&((ke=r.domElement)==null||ke.releasePointerCapture(we.pointerId),(Ze=r.domElement)==null||Ze.ownerDocument.removeEventListener("pointermove",le),(Ne=r.domElement)==null||Ne.ownerDocument.removeEventListener("pointerup",te)),r.dispatchEvent(o),l=a.NONE}function Se(we){let ke;switch(we.button){case 0:ke=r.mouseButtons.LEFT;break;case 1:ke=r.mouseButtons.MIDDLE;break;case 2:ke=r.mouseButtons.RIGHT;break;default:ke=-1}switch(ke){case wg.DOLLY:if(r.enableZoom===!1)return;ae(we),l=a.DOLLY;break;case wg.ROTATE:if(we.ctrlKey||we.metaKey||we.shiftKey){if(r.enablePan===!1)return;re(we),l=a.PAN}else{if(r.enableRotate===!1)return;ie(we),l=a.ROTATE}break;case wg.PAN:if(we.ctrlKey||we.metaKey||we.shiftKey){if(r.enableRotate===!1)return;ie(we),l=a.ROTATE}else{if(r.enablePan===!1)return;re(we),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function ve(we){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;ce(we);break;case a.DOLLY:if(r.enableZoom===!1)return;oe(we);break;case a.PAN:if(r.enablePan===!1)return;fe(we);break}}function ge(we){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(we.preventDefault(),r.dispatchEvent(s),me(we),r.dispatchEvent(o))}function Te(we){r.enabled===!1||r.enablePan===!1||ye(we)}function He(we){switch(tt(we),F.length){case 1:switch(r.touches.ONE){case Mg.ROTATE:if(r.enableRotate===!1)return;Ee(),l=a.TOUCH_ROTATE;break;case Mg.PAN:if(r.enablePan===!1)return;Ge(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case Mg.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;De(),l=a.TOUCH_DOLLY_PAN;break;case Mg.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;he(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function pe(we){switch(tt(we),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Le(we),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;ne(we),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;je(we),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;be(we),r.update();break;default:l=a.NONE}}function qe(we){r.enabled!==!1&&we.preventDefault()}function xt(we){F.push(we)}function nt(we){delete U[we.pointerId];for(let ke=0;ke<F.length;ke++)if(F[ke].pointerId==we.pointerId){F.splice(ke,1);return}}function tt(we){let ke=U[we.pointerId];ke===void 0&&(ke=new jt,U[we.pointerId]=ke),ke.set(we.pageX,we.pageY)}function Fe(we){const ke=we.pointerId===F[0].pointerId?F[1]:F[0];return U[ke.pointerId]}this.dollyIn=(we=B())=>{z(we),r.update()},this.dollyOut=(we=B())=>{H(we),r.update()},this.getScale=()=>g,this.setScale=we=>{J(we),r.update()},this.getZoomScale=()=>B(),n!==void 0&&this.connect(n),this.update()}};const Gj=new Ao,wM=new ze;class L9 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 M5(n,6,1);return this.setAttribute("instanceStart",new Jc(r,3,0)),this.setAttribute("instanceEnd",new Jc(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 M5(r,n*2,1);return this.setAttribute("instanceColorStart",new Jc(i,n,0)),this.setAttribute("instanceColorEnd",new Jc(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 g9(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ao);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 Wo),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,o=e.count;s<o;s++)wM.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(wM)),wM.fromBufferAttribute(n,s),i=Math.max(i,r.distanceToSquared(wM));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 jK extends L9{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 z9 extends au{constructor(e){super({type:"LineMaterial",uniforms:CS.clone(CS.merge([mn.common,mn.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new jt(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 <${LK>=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 di,Wj=new ze,$j=new ze,La=new di,za=new di,kf=new di,z6=new ze,j6=new rr,Fa=new lK,qj=new ze,MM=new Ao,TM=new Wo,Pf=new di;let Wf,Xg;function Xj(t,e,n){return Pf.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),Pf.multiplyScalar(1/Pf.w),Pf.x=Xg/n.width,Pf.y=Xg/n.height,Pf.applyMatrix4(t.projectionMatrixInverse),Pf.multiplyScalar(1/Pf.w),Math.abs(Math.max(Pf.x,Pf.y))}function ECe(t,e){const n=t.matrixWorld,r=t.geometry,i=r.attributes.instanceStart,s=r.attributes.instanceEnd,o=Math.min(r.instanceCount,i.count);for(let a=0,l=o;a<l;a++){Fa.start.fromBufferAttribute(i,a),Fa.end.fromBufferAttribute(s,a),Fa.applyMatrix4(n);const c=new ze,d=new ze;Wf.distanceSqToSegment(Fa.start,Fa.end,d,c),d.distanceTo(c)<Xg*.5&&e.push({point:d,pointOnLine:c,distance:Wf.origin.distanceTo(d),object:t,face:null,faceIndex:a,uv:null,[zK]:null})}}function CCe(t,e,n){const r=e.projectionMatrix,s=t.material.resolution,o=t.matrixWorld,a=t.geometry,l=a.attributes.instanceStart,c=a.attributes.instanceEnd,d=Math.min(a.instanceCount,l.count),h=-e.near;Wf.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,o);for(let g=0,v=d;g<v;g++){if(La.fromBufferAttribute(l,g),za.fromBufferAttribute(c,g),La.w=1,za.w=1,La.applyMatrix4(j6),za.applyMatrix4(j6),La.z>h&&za.z>h)continue;if(La.z>h){const A=La.z-za.z,N=(La.z-h)/A;La.lerp(za,N)}else if(za.z>h){const A=za.z-La.z,N=(za.z-h)/A;za.lerp(La,N)}La.applyMatrix4(r),za.applyMatrix4(r),La.multiplyScalar(1/La.w),za.multiplyScalar(1/za.w),La.x*=s.x/2,La.y*=s.y/2,za.x*=s.x/2,za.y*=s.y/2,Fa.start.copy(La),Fa.start.z=0,Fa.end.copy(za),Fa.end.z=0;const _=Fa.closestPointToPointParameter(z6,!0);Fa.at(_,qj);const w=cY.lerp(La.z,za.z,_),S=w>=-1&&w<=1,E=z6.distanceTo(qj)<Xg*.5;if(S&&E){Fa.start.fromBufferAttribute(l,g),Fa.end.fromBufferAttribute(c,g),Fa.start.applyMatrix4(o),Fa.end.applyMatrix4(o);const A=new ze,N=new ze;Wf.distanceSqToSegment(Fa.start,Fa.end,N,A),n.push({point:N,pointOnLine:A,distance:Wf.origin.distanceTo(N),object:t,face:null,faceIndex:g,uv:null,[zK]:null})}}}class FK extends Us{constructor(e=new L9,n=new z9({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 o=0,a=0,l=n.count;o<l;o++,a+=2)Wj.fromBufferAttribute(n,o),$j.fromBufferAttribute(r,o),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+Wj.distanceTo($j);const s=new M5(i,2,1);return e.setAttribute("instanceDistanceStart",new Jc(s,1,0)),e.setAttribute("instanceDistanceEnd",new Jc(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;Wf=e.ray;const o=this.matrixWorld,a=this.geometry,l=this.material;Xg=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),TM.copy(a.boundingSphere).applyMatrix4(o);let c;if(r)c=Xg*.5;else{const h=Math.max(i.near,TM.distanceToPoint(Wf.origin));c=Xj(i,h,l.resolution)}if(TM.radius+=c,Wf.intersectsSphere(TM)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),MM.copy(a.boundingBox).applyMatrix4(o);let d;if(r)d=Xg*.5;else{const h=Math.max(i.near,MM.distanceToPoint(Wf.origin));d=Xj(i,h,l.resolution)}MM.expandByScalar(d),Wf.intersectsBox(MM)!==!1&&(r?ECe(this,n):CCe(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 ACe extends FK{constructor(e=new jK,n=new z9({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}const NCe=T.forwardRef(function({points:e,color:n=16777215,vertexColors:r,linewidth:i,lineWidth:s,segments:o,dashed:a,...l},c){var d,h;const g=qc(S=>S.size),v=T.useMemo(()=>o?new FK:new ACe,[o]),[b]=T.useState(()=>new z9),_=(r==null||(d=r[0])==null?void 0:d.length)===4?4:3,w=T.useMemo(()=>{const S=o?new L9:new jK,E=e.map(A=>{const N=Array.isArray(A);return A instanceof ze||A instanceof di?[A.x,A.y,A.z]:A instanceof jt?[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 yn?N.toArray():N);S.setColors(A.flat(),_)}return S},[e,o,r,_]);return T.useLayoutEffect(()=>{v.computeLineDistances()},[e,v]),T.useLayoutEffect(()=>{a?b.defines.USE_DASH="":delete b.defines.USE_DASH,b.needsUpdate=!0},[a,b]),T.useEffect(()=>()=>{w.dispose(),b.dispose()},[w]),T.createElement("primitive",ch({object:v,ref:c},l),T.createElement("primitive",{object:w,attach:"geometry"}),T.createElement("primitive",ch({object:b,attach:"material",color:n,vertexColors:!!r,resolution:[g.width,g.height],linewidth:(h=i??s)!==null&&h!==void 0?h:1,dashed:a,transparent:_===4},l)))});function RCe(){var t=Object.create(null);function e(i,s){var o=i.id,a=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[o])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("<"+a+">.init",c),d&&(d=r("<"+a+">.getTransferables",d));var h=null;typeof c=="function"?h=c.apply(void 0,l):console.error("worker module init function failed to rehydrate"),t[o]={id:o,value:h,getTransferables:d},s(h)}catch(g){g&&g.noLog||console.error(g),s(g)}}function n(i,s){var o,a=i.id,l=i.args;(!t[a]||typeof t[a].value!="function")&&s(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var c=(o=t[a]).value.apply(o,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[a].getTransferables&&t[a].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 o=void 0;self.troikaDefine=function(l){return o=l};var a=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/

troikaDefine(
`+s+`
)`],{type:"application/javascript"}));try{importScripts(a)}catch(l){console.error(l)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(i){var s=i.data,o=s.messageId,a=s.action,l=s.data;try{a==="registerModule"&&e(l,function(c){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof c=="function"}})}),a==="callModule"&&n(l,function(c,d){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:c},d||void 0)})}catch(c){postMessage({messageId:o,success:!1,error:c.stack})}})}function kCe(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 UK=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 UK=function(){return t},t},PCe=0,DCe=0,F6=!1,$_=Object.create(null),q_=Object.create(null),a7=Object.create(null);function Oy(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=kCe(t);i==null&&(i="#default");var o="workerModule"+ ++PCe,a=t.name||o,l=null;e=e&&e.map(function(d){return typeof d=="function"&&!d.workerModuleData&&(F6=!0,d=Oy({workerId:i,name:"<"+a+"> function dependency: "+d.name,init:`function(){return (
`+$M(d)+`
)}`}),F6=!1),d&&d.workerModuleData&&(d=d.workerModuleData),d});function c(){for(var d=[],h=arguments.length;h--;)d[h]=arguments[h];if(!UK())return s.apply(void 0,d);if(!l){l=Yj(i,"registerModule",c.workerModuleData);var g=function(){l=null,q_[i].delete(g)};(q_[i]||(q_[i]=new Set)).add(g)}return l.then(function(v){var b=v.isCallable;if(b)return Yj(i,"callModule",{id:o,args:d});throw new Error("Worker module function was called but `init` did not return a callable function")})}return c.workerModuleData={isWorkerModule:!0,id:o,name:a,dependencies:e,init:$M(n),getTransferables:r&&$M(r)},c.onMainThread=s,c}function ICe(t){q_[t]&&q_[t].forEach(function(e){e()}),$_[t]&&($_[t].terminate(),delete $_[t])}function $M(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function OCe(t){var e=$_[t];if(!e){var n=$M(RCe);e=$_[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,o=a7[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete a7[s],o(i)}}return e}function Yj(t,e,n){return new Promise(function(r,i){var s=++DCe;a7[s]=function(o){o.success?r(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},OCe(t).postMessage({messageId:s,action:e,data:n})})}function BK(){var t=(function(e){function n(J,H,z,X,V,ie,ae,re){var ce=1-ae;re.x=ce*ce*J+2*ce*ae*z+ae*ae*V,re.y=ce*ce*H+2*ce*ae*X+ae*ae*ie}function r(J,H,z,X,V,ie,ae,re,ce,oe){var fe=1-ce;oe.x=fe*fe*fe*J+3*fe*fe*ce*z+3*fe*ce*ce*V+ce*ce*ce*ae,oe.y=fe*fe*fe*H+3*fe*fe*ce*X+3*fe*ce*ce*ie+ce*ce*ce*re}function i(J,H){for(var z=/([MLQCZ])([^MLQCZ]*)/g,X,V,ie,ae,re;X=z.exec(J);){var ce=X[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(oe){return parseFloat(oe)});switch(X[1]){case"M":ae=V=ce[0],re=ie=ce[1];break;case"L":(ce[0]!==ae||ce[1]!==re)&&H("L",ae,re,ae=ce[0],re=ce[1]);break;case"Q":{H("Q",ae,re,ae=ce[2],re=ce[3],ce[0],ce[1]);break}case"C":{H("C",ae,re,ae=ce[4],re=ce[5],ce[0],ce[1],ce[2],ce[3]);break}case"Z":(ae!==V||re!==ie)&&H("L",ae,re,V,ie);break}}}function s(J,H,z){z===void 0&&(z=16);var X={x:0,y:0};i(J,function(V,ie,ae,re,ce,oe,fe,me,ye){switch(V){case"L":H(ie,ae,re,ce);break;case"Q":{for(var Ee=ie,Ge=ae,_e=1;_e<z;_e++)n(ie,ae,oe,fe,re,ce,_e/(z-1),X),H(Ee,Ge,X.x,X.y),Ee=X.x,Ge=X.y;break}case"C":{for(var De=ie,he=ae,Le=1;Le<z;Le++)r(ie,ae,oe,fe,me,ye,re,ce,Le/(z-1),X),H(De,he,X.x,X.y),De=X.x,he=X.y;break}}})}var o="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);}",a="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(J,H){var z=J.getContext?J.getContext("webgl",c):J,X=l.get(z);if(!X){let De=function(be){var Xe=ie[be];if(!Xe&&(Xe=ie[be]=z.getExtension(be),!Xe))throw new Error(be+" not supported");return Xe},he=function(be,Xe){var le=z.createShader(Xe);return z.shaderSource(le,be),z.compileShader(le),le},Le=function(be,Xe,le,te){if(!ae[be]){var Se={},ve={},ge=z.createProgram();z.attachShader(ge,he(Xe,z.VERTEX_SHADER)),z.attachShader(ge,he(le,z.FRAGMENT_SHADER)),z.linkProgram(ge),ae[be]={program:ge,transaction:function(He){z.useProgram(ge),He({setUniform:function(qe,xt){for(var nt=[],tt=arguments.length-2;tt-- >0;)nt[tt]=arguments[tt+2];var Fe=ve[xt]||(ve[xt]=z.getUniformLocation(ge,xt));z["uniform"+qe].apply(z,[Fe].concat(nt))},setAttribute:function(qe,xt,nt,tt,Fe){var we=Se[qe];we||(we=Se[qe]={buf:z.createBuffer(),loc:z.getAttribLocation(ge,qe),data:null}),z.bindBuffer(z.ARRAY_BUFFER,we.buf),z.vertexAttribPointer(we.loc,xt,z.FLOAT,!1,0,0),z.enableVertexAttribArray(we.loc),V?z.vertexAttribDivisor(we.loc,tt):De("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(we.loc,tt),Fe!==we.data&&(z.bufferData(z.ARRAY_BUFFER,Fe,nt),we.data=Fe)}})}}}ae[be].transaction(te)},ne=function(be,Xe){ce++;try{z.activeTexture(z.TEXTURE0+ce);var le=re[be];le||(le=re[be]=z.createTexture(),z.bindTexture(z.TEXTURE_2D,le),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MIN_FILTER,z.NEAREST),z.texParameteri(z.TEXTURE_2D,z.TEXTURE_MAG_FILTER,z.NEAREST)),z.bindTexture(z.TEXTURE_2D,le),Xe(le,ce)}finally{ce--}},We=function(be,Xe,le){var te=z.createFramebuffer();oe.push(te),z.bindFramebuffer(z.FRAMEBUFFER,te),z.activeTexture(z.TEXTURE0+Xe),z.bindTexture(z.TEXTURE_2D,be),z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_2D,be,0);try{le(te)}finally{z.deleteFramebuffer(te),z.bindFramebuffer(z.FRAMEBUFFER,oe[--oe.length-1]||null)}},je=function(){ie={},ae={},re={},ce=-1,oe.length=0};var fe=De,me=he,ye=Le,Ee=ne,Ge=We,_e=je,V=typeof WebGL2RenderingContext<"u"&&z instanceof WebGL2RenderingContext,ie={},ae={},re={},ce=-1,oe=[];z.canvas.addEventListener("webglcontextlost",function(be){je(),be.preventDefault()},!1),l.set(z,X={gl:z,isWebGL2:V,getExtension:De,withProgram:Le,withTexture:ne,withTextureFramebuffer:We,handleContextLoss:je})}H(X)}function h(J,H,z,X,V,ie,ae,re){ae===void 0&&(ae=15),re===void 0&&(re=null),d(J,function(ce){var oe=ce.gl,fe=ce.withProgram,me=ce.withTexture;me("copy",function(ye,Ee){oe.texImage2D(oe.TEXTURE_2D,0,oe.RGBA,V,ie,0,oe.RGBA,oe.UNSIGNED_BYTE,H),fe("copy",o,a,function(Ge){var _e=Ge.setUniform,De=Ge.setAttribute;De("aUV",2,oe.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),_e("1i","image",Ee),oe.bindFramebuffer(oe.FRAMEBUFFER,re||null),oe.disable(oe.BLEND),oe.colorMask(ae&8,ae&4,ae&2,ae&1),oe.viewport(z,X,V,ie),oe.scissor(z,X,V,ie),oe.drawArrays(oe.TRIANGLES,0,3)})})})}function g(J,H,z){var X=J.width,V=J.height;d(J,function(ie){var ae=ie.gl,re=new Uint8Array(X*V*4);ae.readPixels(0,0,X,V,ae.RGBA,ae.UNSIGNED_BYTE,re),J.width=H,J.height=z,h(ae,re,0,0,X,V)})}var v=Object.freeze({__proto__:null,withWebGLContext:d,renderImageData:h,resizeWebGLCanvasWithoutClearing:g});function b(J,H,z,X,V,ie){ie===void 0&&(ie=1);var ae=new Uint8Array(J*H),re=X[2]-X[0],ce=X[3]-X[1],oe=[];s(z,function(De,he,Le,ne){oe.push({x1:De,y1:he,x2:Le,y2:ne,minX:Math.min(De,Le),minY:Math.min(he,ne),maxX:Math.max(De,Le),maxY:Math.max(he,ne)})}),oe.sort(function(De,he){return De.maxX-he.maxX});for(var fe=0;fe<J;fe++)for(var me=0;me<H;me++){var ye=Ge(X[0]+re*(fe+.5)/J,X[1]+ce*(me+.5)/H),Ee=Math.pow(1-Math.abs(ye)/V,ie)/2;ye<0&&(Ee=1-Ee),Ee=Math.max(0,Math.min(255,Math.round(Ee*255))),ae[me*J+fe]=Ee}return ae;function Ge(De,he){for(var Le=1/0,ne=1/0,We=oe.length;We--;){var je=oe[We];if(je.maxX+ne<=De)break;if(De+ne>je.minX&&he-ne<je.maxY&&he+ne>je.minY){var be=S(De,he,je.x1,je.y1,je.x2,je.y2);be<Le&&(Le=be,ne=Math.sqrt(Le))}}return _e(De,he)&&(ne=-ne),ne}function _e(De,he){for(var Le=0,ne=oe.length;ne--;){var We=oe[ne];if(We.maxX<=De)break;var je=We.y1>he!=We.y2>he&&De<(We.x2-We.x1)*(he-We.y1)/(We.y2-We.y1)+We.x1;je&&(Le+=We.y1<We.y2?1:-1)}return Le!==0}}function _(J,H,z,X,V,ie,ae,re,ce,oe){ie===void 0&&(ie=1),re===void 0&&(re=0),ce===void 0&&(ce=0),oe===void 0&&(oe=0),w(J,H,z,X,V,ie,ae,null,re,ce,oe)}function w(J,H,z,X,V,ie,ae,re,ce,oe,fe){ie===void 0&&(ie=1),ce===void 0&&(ce=0),oe===void 0&&(oe=0),fe===void 0&&(fe=0);for(var me=b(J,H,z,X,V,ie),ye=new Uint8Array(me.length*4),Ee=0;Ee<me.length;Ee++)ye[Ee*4+fe]=me[Ee];h(ae,ye,ce,oe,J,H,1<<3-fe,re)}function S(J,H,z,X,V,ie){var ae=V-z,re=ie-X,ce=ae*ae+re*re,oe=ce?Math.max(0,Math.min(1,((J-z)*ae+(H-X)*re)/ce)):0,fe=J-(z+oe*ae),me=H-(X+oe*re);return fe*fe+me*me}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);}",I="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={},F=new WeakMap;function U(J){if(!R&&!G(J))throw new Error("WebGL generation not supported")}function q(J,H,z,X,V,ie,ae){if(ie===void 0&&(ie=1),ae===void 0&&(ae=null),!ae&&(ae=L,!ae)){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");ae=L=re.getContext("webgl",{depth:!1})}U(ae);var ce=new Uint8Array(J*H*4);d(ae,function(ye){var Ee=ye.gl,Ge=ye.withTexture,_e=ye.withTextureFramebuffer;Ge("readable",function(De,he){Ee.texImage2D(Ee.TEXTURE_2D,0,Ee.RGBA,J,H,0,Ee.RGBA,Ee.UNSIGNED_BYTE,null),_e(De,he,function(Le){Z(J,H,z,X,V,ie,Ee,Le,0,0,0),Ee.readPixels(0,0,J,H,Ee.RGBA,Ee.UNSIGNED_BYTE,ce)})})});for(var oe=new Uint8Array(J*H),fe=0,me=0;fe<ce.length;fe+=4)oe[me++]=ce[fe];return oe}function B(J,H,z,X,V,ie,ae,re,ce,oe){ie===void 0&&(ie=1),re===void 0&&(re=0),ce===void 0&&(ce=0),oe===void 0&&(oe=0),Z(J,H,z,X,V,ie,ae,null,re,ce,oe)}function Z(J,H,z,X,V,ie,ae,re,ce,oe,fe){ie===void 0&&(ie=1),ce===void 0&&(ce=0),oe===void 0&&(oe=0),fe===void 0&&(fe=0),U(ae);var me=[];s(z,function(ye,Ee,Ge,_e){me.push(ye,Ee,Ge,_e)}),me=new Float32Array(me),d(ae,function(ye){var Ee=ye.gl,Ge=ye.isWebGL2,_e=ye.getExtension,De=ye.withProgram,he=ye.withTexture,Le=ye.withTextureFramebuffer,ne=ye.handleContextLoss;if(he("rawDistances",function(We,je){(J!==We._lastWidth||H!==We._lastHeight)&&Ee.texImage2D(Ee.TEXTURE_2D,0,Ee.RGBA,We._lastWidth=J,We._lastHeight=H,0,Ee.RGBA,Ee.UNSIGNED_BYTE,null),De("main",A,N,function(be){var Xe=be.setAttribute,le=be.setUniform,te=!Ge&&_e("ANGLE_instanced_arrays"),Se=!Ge&&_e("EXT_blend_minmax");Xe("aUV",2,Ee.STATIC_DRAW,0,P),Xe("aLineSegment",4,Ee.DYNAMIC_DRAW,1,me),le.apply(void 0,["4f","uGlyphBounds"].concat(X)),le("1f","uMaxDistance",V),le("1f","uExponent",ie),Le(We,je,function(ve){Ee.enable(Ee.BLEND),Ee.colorMask(!0,!0,!0,!0),Ee.viewport(0,0,J,H),Ee.scissor(0,0,J,H),Ee.blendFunc(Ee.ONE,Ee.ONE),Ee.blendEquationSeparate(Ee.FUNC_ADD,Ge?Ee.MAX:Se.MAX_EXT),Ee.clear(Ee.COLOR_BUFFER_BIT),Ge?Ee.drawArraysInstanced(Ee.TRIANGLES,0,3,me.length/4):te.drawArraysInstancedANGLE(Ee.TRIANGLES,0,3,me.length/4)})}),De("post",o,I,function(be){be.setAttribute("aUV",2,Ee.STATIC_DRAW,0,P),be.setUniform("1i","tex",je),Ee.bindFramebuffer(Ee.FRAMEBUFFER,re),Ee.disable(Ee.BLEND),Ee.colorMask(fe===0,fe===1,fe===2,fe===3),Ee.viewport(ce,oe,J,H),Ee.scissor(ce,oe,J,H),Ee.drawArrays(Ee.TRIANGLES,0,3)})}),Ee.isContextLost())throw ne(),new Error("webgl context lost")})}function G(J){var H=!J||J===L?O:J.canvas||J,z=F.get(H);if(z===void 0){R=!0;var X=null;try{var V=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],ie=q(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,J);z=ie&&V.length===ie.length&&ie.every(function(ae,re){return ae===V[re]}),z||(X="bad trial run results",console.info(V,ie))}catch(ae){z=!1,X=ae.message}X&&console.warn("WebGL SDF generation not supported:",X),R=!1,F.set(H,z)}return z}var $=Object.freeze({__proto__:null,generate:q,generateIntoCanvas:B,generateIntoFramebuffer:Z,isSupported:G});function K(J,H,z,X,V,ie){V===void 0&&(V=Math.max(X[2]-X[0],X[3]-X[1])/2),ie===void 0&&(ie=1);try{return q.apply($,arguments)}catch(ae){return console.info("WebGL SDF generation failed, falling back to JS",ae),b.apply(E,arguments)}}function Y(J,H,z,X,V,ie,ae,re,ce,oe){V===void 0&&(V=Math.max(X[2]-X[0],X[3]-X[1])/2),ie===void 0&&(ie=1),re===void 0&&(re=0),ce===void 0&&(ce=0),oe===void 0&&(oe=0);try{return B.apply($,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=$,e.webglUtils=v,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}function LCe(){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(ne,We){r[ne]=1<<We+1,i[r[ne]]=ne}),Object.freeze(r);var s=r.LRI|r.RLI|r.FSI,o=r.L|r.R|r.AL,a=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 ne=function(je){if(n.hasOwnProperty(je)){var be=0;n[je].split(",").forEach(function(Xe){var le=Xe.split("+"),te=le[0],Se=le[1];te=parseInt(te,36),Se=Se?parseInt(Se,36):0,d.set(be+=te,r[je]);for(var ve=0;ve<Se;ve++)d.set(++be,r[je])})}};for(var We in n)ne(We)}}function g(ne){return h(),d.get(ne.codePointAt(0))||r.L}function v(ne){return i[g(ne)]}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 _(ne,We){var je=36,be=0,Xe=new Map,le=We&&new Map,te;return ne.split(",").forEach(function Se(ve){if(ve.indexOf("+")!==-1)for(var ge=+ve;ge--;)Se(te);else{te=ve;var Te=ve.split(">"),He=Te[0],pe=Te[1];He=String.fromCodePoint(be+=parseInt(He,je)),pe=String.fromCodePoint(be+=parseInt(pe,je)),Xe.set(He,pe),We&&le.set(pe,He)}}),{map:Xe,reverseMap:le}}var w,S,E;function A(){if(!w){var ne=_(b.pairs,!0),We=ne.map,je=ne.reverseMap;w=We,S=je,E=_(b.canonical,!1).map}}function N(ne){return A(),w.get(ne)||null}function I(ne){return A(),S.get(ne)||null}function P(ne){return A(),E.get(ne)||null}var L=r.L,R=r.R,O=r.EN,F=r.ES,U=r.ET,q=r.AN,B=r.CS,Z=r.B,G=r.S,$=r.ON,K=r.BN,Y=r.NSM,J=r.AL,H=r.LRO,z=r.RLO,X=r.LRE,V=r.RLE,ie=r.PDF,ae=r.LRI,re=r.RLI,ce=r.FSI,oe=r.PDI;function fe(ne,We){for(var je=125,be=new Uint32Array(ne.length),Xe=0;Xe<ne.length;Xe++)be[Xe]=g(ne[Xe]);var le=new Map;function te(Gi,Hs){var ys=be[Gi];be[Gi]=Hs,le.set(ys,le.get(ys)-1),ys&a&&le.set(a,le.get(a)-1),le.set(Hs,(le.get(Hs)||0)+1),Hs&a&&le.set(a,(le.get(a)||0)+1)}for(var Se=new Uint8Array(ne.length),ve=new Map,ge=[],Te=null,He=0;He<ne.length;He++)Te||ge.push(Te={start:He,end:ne.length-1,level:We==="rtl"?1:We==="ltr"?0:Qd(He,!1)}),be[He]&Z&&(Te.end=He,Te=null);for(var pe=V|X|z|H|s|oe|ie|Z,qe=function(Gi){return Gi+(Gi&1?1:2)},xt=function(Gi){return Gi+(Gi&1?2:1)},nt=0;nt<ge.length;nt++){Te=ge[nt];var tt=[{_level:Te.level,_override:0,_isolate:0}],Fe=void 0,we=0,ke=0,Ze=0;le.clear();for(var Ne=Te.start;Ne<=Te.end;Ne++){var Ke=be[Ne];if(Fe=tt[tt.length-1],le.set(Ke,(le.get(Ke)||0)+1),Ke&a&&le.set(a,(le.get(a)||0)+1),Ke&pe)if(Ke&(V|X)){Se[Ne]=Fe._level;var it=(Ke===V?xt:qe)(Fe._level);it<=je&&!we&&!ke?tt.push({_level:it,_override:0,_isolate:0}):we||ke++}else if(Ke&(z|H)){Se[Ne]=Fe._level;var ht=(Ke===z?xt:qe)(Fe._level);ht<=je&&!we&&!ke?tt.push({_level:ht,_override:Ke&z?R:L,_isolate:0}):we||ke++}else if(Ke&s){Ke&ce&&(Ke=Qd(Ne+1,!0)===1?re:ae),Se[Ne]=Fe._level,Fe._override&&te(Ne,Fe._override);var Je=(Ke===re?xt:qe)(Fe._level);Je<=je&&we===0&&ke===0?(Ze++,tt.push({_level:Je,_override:0,_isolate:1,_isolInitIndex:Ne})):we++}else if(Ke&oe){if(we>0)we--;else if(Ze>0){for(ke=0;!tt[tt.length-1]._isolate;)tt.pop();var $e=tt[tt.length-1]._isolInitIndex;$e!=null&&(ve.set($e,Ne),ve.set(Ne,$e)),tt.pop(),Ze--}Fe=tt[tt.length-1],Se[Ne]=Fe._level,Fe._override&&te(Ne,Fe._override)}else Ke&ie?(we===0&&(ke>0?ke--:!Fe._isolate&&tt.length>1&&(tt.pop(),Fe=tt[tt.length-1])),Se[Ne]=Fe._level):Ke&Z&&(Se[Ne]=Te.level);else Se[Ne]=Fe._level,Fe._override&&Ke!==K&&te(Ne,Fe._override)}for(var Ae=[],Oe=null,Ye=Te.start;Ye<=Te.end;Ye++){var st=be[Ye];if(!(st&l)){var Rt=Se[Ye],yt=st&s,Tt=st===oe;Oe&&Rt===Oe._level?(Oe._end=Ye,Oe._endsWithIsolInit=yt):Ae.push(Oe={_start:Ye,_end:Ye,_level:Rt,_startsWithPDI:Tt,_endsWithIsolInit:yt})}}for(var Et=[],Dt=0;Dt<Ae.length;Dt++){var Ue=Ae[Dt];if(!Ue._startsWithPDI||Ue._startsWithPDI&&!ve.has(Ue._start)){for(var ct=[Oe=Ue],St=void 0;Oe&&Oe._endsWithIsolInit&&(St=ve.get(Oe._end))!=null;)for(var kt=Dt+1;kt<Ae.length;kt++)if(Ae[kt]._start===St){ct.push(Oe=Ae[kt]);break}for(var Ut=[],Xt=0;Xt<ct.length;Xt++)for(var hn=ct[Xt],Lt=hn._start;Lt<=hn._end;Lt++)Ut.push(Lt);for(var on=Se[Ut[0]],Ht=Te.level,kn=Ut[0]-1;kn>=0;kn--)if(!(be[kn]&l)){Ht=Se[kn];break}var Xn=Ut[Ut.length-1],zn=Se[Xn],Qn=Te.level;if(!(be[Xn]&s)){for(var Pn=Xn+1;Pn<=Te.end;Pn++)if(!(be[Pn]&l)){Qn=Se[Pn];break}}Et.push({_seqIndices:Ut,_sosType:Math.max(Ht,on)%2?R:L,_eosType:Math.max(Qn,zn)%2?R:L})}}for(var lr=0;lr<Et.length;lr++){var ir=Et[lr],xe=ir._seqIndices,ot=ir._sosType,bt=ir._eosType,mt=Se[xe[0]]&1?R:L;if(le.get(Y))for(var pt=0;pt<xe.length;pt++){var $t=xe[pt];if(be[$t]&Y){for(var Zt=ot,en=pt-1;en>=0;en--)if(!(be[xe[en]]&l)){Zt=be[xe[en]];break}te($t,Zt&(s|oe)?$:Zt)}}if(le.get(O))for(var Jt=0;Jt<xe.length;Jt++){var Mn=xe[Jt];if(be[Mn]&O)for(var jn=Jt-1;jn>=-1;jn--){var Gn=jn===-1?ot:be[xe[jn]];if(Gn&o){Gn===J&&te(Mn,q);break}}}if(le.get(J))for(var ln=0;ln<xe.length;ln++){var sr=xe[ln];be[sr]&J&&te(sr,R)}if(le.get(F)||le.get(B))for(var Yr=1;Yr<xe.length-1;Yr++){var ti=xe[Yr];if(be[ti]&(F|B)){for(var dr=0,kr=0,rn=Yr-1;rn>=0&&(dr=be[xe[rn]],!!(dr&l));rn--);for(var ss=Yr+1;ss<xe.length&&(kr=be[xe[ss]],!!(kr&l));ss++);dr===kr&&(be[ti]===F?dr===O:dr&(O|q))&&te(ti,dr)}}if(le.get(O))for(var Nn=0;Nn<xe.length;Nn++){var gs=xe[Nn];if(be[gs]&O){for(var Rs=Nn-1;Rs>=0&&be[xe[Rs]]&(U|l);Rs--)te(xe[Rs],O);for(Nn++;Nn<xe.length&&be[xe[Nn]]&(U|l|O);Nn++)be[xe[Nn]]!==O&&te(xe[Nn],O)}}if(le.get(U)||le.get(F)||le.get(B))for(var Di=0;Di<xe.length;Di++){var vs=xe[Di];if(be[vs]&(U|F|B)){te(vs,$);for(var gr=Di-1;gr>=0&&be[xe[gr]]&l;gr--)te(xe[gr],$);for(var fi=Di+1;fi<xe.length&&be[xe[fi]]&l;fi++)te(xe[fi],$)}}if(le.get(O))for(var ks=0,Ii=ot;ks<xe.length;ks++){var qo=xe[ks],ua=be[qo];ua&O?Ii===L&&te(qo,L):ua&o&&(Ii=ua)}if(le.get(a)){var wa=R|O|q,ql=wa|L,yl=[];{for(var da=[],Ps=0;Ps<xe.length;Ps++)if(be[xe[Ps]]&a){var Xl=ne[xe[Ps]],Va=void 0;if(N(Xl)!==null)if(da.length<63)da.push({char:Xl,seqIndex:Ps});else break;else if((Va=I(Xl))!==null)for(var Ma=da.length-1;Ma>=0;Ma--){var Ta=da[Ma].char;if(Ta===Va||Ta===I(P(Xl))||N(P(Ta))===Xl){yl.push([da[Ma].seqIndex,Ps]),da.length=Ma;break}}}yl.sort(function(Gi,Hs){return Gi[0]-Hs[0]})}for(var Pc=0;Pc<yl.length;Pc++){for(var Dc=yl[Pc],Yl=Dc[0],Xo=Dc[1],io=!1,Ro=0,bl=Yl+1;bl<Xo;bl++){var xs=xe[bl];if(be[xs]&ql){io=!0;var Ga=be[xs]&wa?R:L;if(Ga===mt){Ro=Ga;break}}}if(io&&!Ro){Ro=ot;for(var Wa=Yl-1;Wa>=0;Wa--){var Ic=xe[Wa];if(be[Ic]&ql){var ni=be[Ic]&wa?R:L;ni!==mt?Ro=ni:Ro=mt;break}}}if(Ro){if(be[xe[Yl]]=be[xe[Xo]]=Ro,Ro!==mt){for(var Fr=Yl+1;Fr<xe.length;Fr++)if(!(be[xe[Fr]]&l)){g(ne[xe[Fr]])&Y&&(be[xe[Fr]]=Ro);break}}if(Ro!==mt){for(var Yo=Xo+1;Yo<xe.length;Yo++)if(!(be[xe[Yo]]&l)){g(ne[xe[Yo]])&Y&&(be[xe[Yo]]=Ro);break}}}}for(var vr=0;vr<xe.length;vr++)if(be[xe[vr]]&a){for(var _i=vr,Oi=vr,$r=ot,Ea=vr-1;Ea>=0;Ea--)if(be[xe[Ea]]&l)_i=Ea;else{$r=be[xe[Ea]]&wa?R:L;break}for(var _l=bt,Kl=vr+1;Kl<xe.length;Kl++)if(be[xe[Kl]]&(a|l))Oi=Kl;else{_l=be[xe[Kl]]&wa?R:L;break}for(var vo=_i;vo<=Oi;vo++)be[xe[vo]]=$r===_l?$r:mt;vr=Oi}}}for(var mi=Te.start;mi<=Te.end;mi++){var xh=Se[mi],rd=be[mi];if(xh&1?rd&(L|O|q)&&Se[mi]++:rd&R?Se[mi]++:rd&(q|O)&&(Se[mi]+=2),rd&l&&(Se[mi]=mi===0?Te.level:Se[mi-1]),mi===Te.end||g(ne[mi])&(G|Z))for(var id=mi;id>=0&&g(ne[id])&c;id--)Se[id]=Te.level}}return{levels:Se,paragraphs:ge};function Qd(Gi,Hs){for(var ys=Gi;ys<ne.length;ys++){var Sl=be[ys];if(Sl&(R|J))return 1;if(Sl&(Z|L)||Hs&&Sl===oe)return 0;if(Sl&s){var xo=fa(ys);ys=xo===-1?ne.length:xo}}return 0}function fa(Gi){for(var Hs=1,ys=Gi+1;ys<ne.length;ys++){var Sl=be[ys];if(Sl&Z)break;if(Sl&oe){if(--Hs===0)return ys}else Sl&s&&Hs++}return-1}}var me="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",ye;function Ee(){if(!ye){var ne=_(me,!0),We=ne.map,je=ne.reverseMap;je.forEach(function(be,Xe){We.set(Xe,be)}),ye=We}}function Ge(ne){return Ee(),ye.get(ne)||null}function _e(ne,We,je,be){var Xe=ne.length;je=Math.max(0,je==null?0:+je),be=Math.min(Xe-1,be==null?Xe-1:+be);for(var le=new Map,te=je;te<=be;te++)if(We[te]&1){var Se=Ge(ne[te]);Se!==null&&le.set(te,Se)}return le}function De(ne,We,je,be){var Xe=ne.length;je=Math.max(0,je==null?0:+je),be=Math.min(Xe-1,be==null?Xe-1:+be);var le=[];return We.paragraphs.forEach(function(te){var Se=Math.max(je,te.start),ve=Math.min(be,te.end);if(Se<ve){for(var ge=We.levels.slice(Se,ve+1),Te=ve;Te>=Se&&g(ne[Te])&c;Te--)ge[Te]=te.level;for(var He=te.level,pe=1/0,qe=0;qe<ge.length;qe++){var xt=ge[qe];xt>He&&(He=xt),xt<pe&&(pe=xt|1)}for(var nt=He;nt>=pe;nt--)for(var tt=0;tt<ge.length;tt++)if(ge[tt]>=nt){for(var Fe=tt;tt+1<ge.length&&ge[tt+1]>=nt;)tt++;tt>Fe&&le.push([Fe+Se,tt+Se])}}}),le}function he(ne,We,je,be){var Xe=Le(ne,We,je,be),le=[].concat(ne);return Xe.forEach(function(te,Se){le[Se]=(We.levels[te]&1?Ge(ne[te]):null)||ne[te]}),le.join("")}function Le(ne,We,je,be){for(var Xe=De(ne,We,je,be),le=[],te=0;te<ne.length;te++)le[te]=te;return Xe.forEach(function(Se){for(var ve=Se[0],ge=Se[1],Te=le.slice(ve,ge+1),He=Te.length;He--;)le[ge-He]=Te[He]}),le}return e.closingToOpeningBracket=I,e.getBidiCharType=g,e.getBidiCharTypeName=v,e.getCanonicalBracket=P,e.getEmbeddingLevels=fe,e.getMirroredCharacter=Ge,e.getMirroredCharactersMap=_e,e.getReorderSegments=De,e.getReorderedIndices=Le,e.getReorderedString=he,e.openingToClosingBracket=N,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}const HK=/\bvoid\s+main\s*\(\s*\)\s*{/g;function l7(t){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function n(r,i){let s=Cr[i];return s?l7(s):r}return t.replace(e,n)}const ja=[];for(let t=0;t<256;t++)ja[t]=(t<16?"0":"")+t.toString(16);function zCe(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(ja[t&255]+ja[t>>8&255]+ja[t>>16&255]+ja[t>>24&255]+"-"+ja[e&255]+ja[e>>8&255]+"-"+ja[e>>16&15|64]+ja[e>>24&255]+"-"+ja[n&63|128]+ja[n>>8&255]+"-"+ja[n>>16&255]+ja[n>>24&255]+ja[r&255]+ja[r>>8&255]+ja[r>>16&255]+ja[r>>24&255]).toUpperCase()}const bg=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},jCe=Date.now(),Kj=new WeakMap,Zj=new Map;let FCe=1e10;function c7(t,e){const n=VCe(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=UCe(this,c,e,n);g=Zj[h]=v}c.vertexShader=g.vertexShader,c.fragmentShader=g.fragmentShader,bg(c.uniforms,this.uniforms),e.timeUniform&&(c.uniforms[e.timeUniform]={get value(){return Date.now()-jCe}}),this[i]&&this[i](c)},o=function(){return a(e.chained?t:t.clone())},a=function(c){const d=Object.create(c,l);return Object.defineProperty(d,"baseMaterial",{value:t}),Object.defineProperty(d,"id",{value:FCe++}),d.uuid=zCe(),d.uniforms=bg({},c.uniforms,e.uniforms),d.defines=bg({},c.defines,e.defines),d.defines[`TROIKA_DERIVED_MATERIAL_${n}`]="",d.extensions=bg({},c.extensions,e.extensions),d._listeners=void 0,d},l={constructor:{value:o},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&&(bg(this.extensions,c.extensions),bg(this.defines,c.defines),bg(this.uniforms,CS.clone(c.uniforms))),this}},clone:{writable:!0,configurable:!0,value:function(){const c=new t.constructor;return a(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:QX}),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]=o,new o}function UCe(t,{vertexShader:e,fragmentShader:n},r,i){let{vertexDefs:s,vertexMainIntro:o,vertexMainOutro:a,vertexTransform:l,fragmentDefs:c,fragmentMainIntro:d,fragmentMainOutro:h,fragmentColorTransform:g,customRewriter:v,timeUniform:b}=r;if(s=s||"",o=o||"",a=a||"",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}
}
`,o=`
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});
${o}
`,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,o,a),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(HK,`
${n}
void troikaOrigMain${e}() {`),t+=`
void main() {
  ${r}
  troikaOrigMain${e}();
  ${i}
}`),t}function BCe(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}let HCe=0;const Jj=new Map;function VCe(t){const e=JSON.stringify(t,BCe);let n=Jj.get(e);return n==null&&Jj.set(e,n=++HCe),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 GCe(){return typeof window>"u"&&(self.window=self),(function(t){var e={parse:function(i){var s=e._bin,o=new Uint8Array(i);if(s.readASCII(o,0,4)=="ttcf"){var a=4;s.readUshort(o,a),a+=2,s.readUshort(o,a),a+=2;var l=s.readUint(o,a);a+=4;for(var c=[],d=0;d<l;d++){var h=s.readUint(o,a);a+=4,c.push(e._readFont(o,h))}return c}return[e._readFont(o,0)]},_readFont:function(i,s){var o=e._bin,a=s;o.readFixed(i,s),s+=4;var l=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 c=["cmap","head","hhea","maxp","hmtx","name","OS/2","post","loca","glyf","kern","CFF ","GDEF","GPOS","GSUB","SVG "],d={_data:i,_offset:a},h={},g=0;g<l;g++){var v=o.readASCII(i,s,4);s+=4,o.readUint(i,s),s+=4;var b=o.readUint(i,s);s+=4;var _=o.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,o){for(var a=e._bin,l=a.readUshort(i,o+4),c=o+12,d=0;d<l;d++){var h=a.readASCII(i,c,4);c+=4,a.readUint(i,c),c+=4;var g=a.readUint(i,c);if(c+=4,a.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,o){for(var a=[],l=0;l<o;l++)a.push(e._bin.readUshort(i,s+2*l));return a},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,o){for(var a="",l=0;l<o;l++)a+=String.fromCharCode(i[s+l]);return a},readUnicode:function(i,s,o){for(var a="",l=0;l<o;l++){var c=i[s++]<<8|i[s++];a+=String.fromCharCode(c)}return a},_tdec:typeof window<"u"&&window.TextDecoder?new window.TextDecoder:null,readUTF8:function(i,s,o){var a=e._bin._tdec;return a&&s==0&&o==i.length?a.decode(i):e._bin.readASCII(i,s,o)},readBytes:function(i,s,o){for(var a=[],l=0;l<o;l++)a.push(i[s+l]);return a},readASCIIArray:function(i,s,o){for(var a=[],l=0;l<o;l++)a.push(String.fromCharCode(i[s+l]));return a},_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,o,a,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,o){var a=e._bin,l=s,c=[],d=a.readUshort(i,s);s+=2;for(var h=0;h<d;h++){var g=a.readUshort(i,s);s+=2;var v=e._lctf.readLookupTable(i,l+g,o);c.push(v)}return c},e._lctf.readLookupTable=function(i,s,o){var a=e._bin,l=s,c={tabs:[]};c.ltype=a.readUshort(i,s),s+=2,c.flag=a.readUshort(i,s),s+=2;var d=a.readUshort(i,s);s+=2;for(var h=c.ltype,g=0;g<d;g++){var v=a.readUshort(i,s);s+=2;var b=o(i,h,l+v,c);c.tabs.push(b)}return c},e._lctf.numOfOnes=function(i){for(var s=0,o=0;o<32;o++)(i>>>o&1)!=0&&s++;return s},e._lctf.readClassDef=function(i,s){var o=e._bin,a=[],l=o.readUshort(i,s);if(s+=2,l==1){var c=o.readUshort(i,s);s+=2;var d=o.readUshort(i,s);s+=2;for(var h=0;h<d;h++)a.push(c+h),a.push(c+h),a.push(o.readUshort(i,s)),s+=2}if(l==2){var g=o.readUshort(i,s);for(s+=2,h=0;h<g;h++)a.push(o.readUshort(i,s)),s+=2,a.push(o.readUshort(i,s)),s+=2,a.push(o.readUshort(i,s)),s+=2}return a},e._lctf.getInterval=function(i,s){for(var o=0;o<i.length;o+=3){var a=i[o],l=i[o+1];if(i[o+2],a<=s&&s<=l)return o}return-1},e._lctf.readCoverage=function(i,s){var o=e._bin,a={};a.fmt=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);return s+=2,a.fmt==1&&(a.tab=o.readUshorts(i,s,l)),a.fmt==2&&(a.tab=o.readUshorts(i,s,3*l)),a},e._lctf.coverageIndex=function(i,s){var o=i.tab;if(i.fmt==1)return o.indexOf(s);if(i.fmt==2){var a=e._lctf.getInterval(o,s);if(a!=-1)return o[a+2]+(s-o[a])}return-1},e._lctf.readFeatureList=function(i,s){var o=e._bin,a=s,l=[],c=o.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=o.readASCII(i,s,4);s+=4;var g=o.readUshort(i,s);s+=2;var v=e._lctf.readFeatureTable(i,a+g);v.tag=h.trim(),l.push(v)}return l},e._lctf.readFeatureTable=function(i,s){var o=e._bin,a=s,l={},c=o.readUshort(i,s);s+=2,c>0&&(l.featureParams=a+c);var d=o.readUshort(i,s);s+=2,l.tab=[];for(var h=0;h<d;h++)l.tab.push(o.readUshort(i,s+2*h));return l},e._lctf.readScriptList=function(i,s){var o=e._bin,a=s,l={},c=o.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=o.readASCII(i,s,4);s+=4;var g=o.readUshort(i,s);s+=2,l[h.trim()]=e._lctf.readScriptTable(i,a+g)}return l},e._lctf.readScriptTable=function(i,s){var o=e._bin,a=s,l={},c=o.readUshort(i,s);s+=2,c>0&&(l.default=e._lctf.readLangSysTable(i,a+c));var d=o.readUshort(i,s);s+=2;for(var h=0;h<d;h++){var g=o.readASCII(i,s,4);s+=4;var v=o.readUshort(i,s);s+=2,l[g.trim()]=e._lctf.readLangSysTable(i,a+v)}return l},e._lctf.readLangSysTable=function(i,s){var o=e._bin,a={};o.readUshort(i,s),s+=2,a.reqFeature=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);return s+=2,a.features=o.readUshorts(i,s,l),a},e.CFF={},e.CFF.parse=function(i,s,o){var a=e._bin;(i=new Uint8Array(i.buffer,s,o))[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(a.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(a.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(a.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=a.readUshort(i,s);for(s+=2,d=0;d<N+1;d++)v.FDSelect.push(a.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,o){var a;for(var l in s.Private&&(a=s.Private[1],s.Private=e.CFF.readDict(i,a,a+s.Private[0]),s.Private.Subrs&&e.CFF.readSubrs(i,a+s.Private.Subrs,s.Private)),s)["FamilyName","FontName","FullName","Notice","version","Copyright"].indexOf(l)!=-1&&(s[l]=o[s[l]-426+35])},e.CFF.readSubrs=function(i,s,o){var a=e._bin,l=[];s=e.CFF.readIndex(i,s,l);var c,d=l.length;c=d<1240?107:d<33900?1131:32768,o.Bias=c,o.Subrs=[];for(var h=0;h<l.length-1;h++)o.Subrs.push(a.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 o=0;o<i.charset.length;o++)if(i.charset[o]==s)return o;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,o){e._bin;var a=[".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++)a.push(i[s+d]);return a},e.CFF.readCharset=function(i,s,o){var a=e._bin,l=[".notdef"],c=i[s];if(s++,c==0)for(var d=0;d<o;d++){var h=a.readUshort(i,s);s+=2,l.push(h)}else{if(c!=1&&c!=2)throw"error: format: "+c;for(;l.length<o;){h=a.readUshort(i,s),s+=2;var g=0;for(c==1?(g=i[s],s++):(g=a.readUshort(i,s),s+=2),d=0;d<=g;d++)l.push(h),h++}}return l},e.CFF.readIndex=function(i,s,o){var a=e._bin,l=a.readUshort(i,s)+1,c=i[s+=2];if(s++,c==1)for(var d=0;d<l;d++)o.push(i[s+d]);else if(c==2)for(d=0;d<l;d++)o.push(a.readUshort(i,s+2*d));else if(c==3)for(d=0;d<l;d++)o.push(16777215&a.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,o){var a=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=a.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=a.readInt(i,s+1)/65535,d=5),o.val=g??"o"+h,o.size=d},e.CFF.readCharString=function(i,s,o){for(var a=s+o,l=e._bin,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;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,o){for(var a=e._bin,l={},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;if(d==28&&(b=a.readShort(i,s+1),g=3),d==29&&(b=a.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=a.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"],I=0;I<_.length;I++)A+=N[_[I]];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,o){i=new Uint8Array(i.buffer,s,o),s=0;var a=e._bin,l={};a.readUshort(i,s),s+=2;var c=a.readUshort(i,s);s+=2;var d=[];l.tables=[];for(var h=0;h<c;h++){var g=a.readUshort(i,s);s+=2;var v=a.readUshort(i,s);s+=2;var b=a.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=a.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 o=e._bin,a={};a.format=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);s+=2,o.readUshort(i,s),s+=2,a.map=[];for(var c=0;c<l-6;c++)a.map.push(i[s+c]);return a},e.cmap.parse4=function(i,s){var o=e._bin,a=s,l={};l.format=o.readUshort(i,s),s+=2;var c=o.readUshort(i,s);s+=2,o.readUshort(i,s),s+=2;var d=o.readUshort(i,s);s+=2;var h=d/2;l.searchRange=o.readUshort(i,s),s+=2,l.entrySelector=o.readUshort(i,s),s+=2,l.rangeShift=o.readUshort(i,s),s+=2,l.endCount=o.readUshorts(i,s,h),s+=2*h,s+=2,l.startCount=o.readUshorts(i,s,h),s+=2*h,l.idDelta=[];for(var g=0;g<h;g++)l.idDelta.push(o.readShort(i,s)),s+=2;for(l.idRangeOffset=o.readUshorts(i,s,h),s+=2*h,l.glyphIdArray=[];s<a+c;)l.glyphIdArray.push(o.readUshort(i,s)),s+=2;return l},e.cmap.parse6=function(i,s){var o=e._bin,a={};a.format=o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2,o.readUshort(i,s),s+=2,a.firstCode=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);s+=2,a.glyphIdArray=[];for(var c=0;c<l;c++)a.glyphIdArray.push(o.readUshort(i,s)),s+=2;return a},e.cmap.parse12=function(i,s){var o=e._bin,a={};a.format=o.readUshort(i,s),s+=2,s+=2,o.readUint(i,s),s+=4,o.readUint(i,s),s+=4;var l=o.readUint(i,s);s+=4,a.groups=[];for(var c=0;c<l;c++){var d=s+12*c,h=o.readUint(i,d+0),g=o.readUint(i,d+4),v=o.readUint(i,d+8);a.groups.push([h,g,v])}return a},e.glyf={},e.glyf.parse=function(i,s,o,a){for(var l=[],c=0;c<a.maxp.numGlyphs;c++)l.push(null);return l},e.glyf._parseGlyf=function(i,s){var o=e._bin,a=i._data,l=e._tabOffset(a,"glyf",i._offset)+i.loca[s];if(i.loca[s]==i.loca[s+1])return null;var c={};if(c.noc=o.readShort(a,l),l+=2,c.xMin=o.readShort(a,l),l+=2,c.yMin=o.readShort(a,l),l+=2,c.xMax=o.readShort(a,l),l+=2,c.yMax=o.readShort(a,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(o.readUshort(a,l)),l+=2;var h=o.readUshort(a,l);if(l+=2,a.length-l<h)return null;c.instructions=o.readBytes(a,l,h),l+=h;var g=c.endPts[c.noc-1]+1;for(c.flags=[],d=0;d<g;d++){var v=a[l];if(l++,c.flags.push(v),(8&v)!=0){var b=a[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?a[l]:-a[l]),l++):S?c.xs.push(0):(c.xs.push(o.readShort(a,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?a[l]:-a[l]),l++):S?c.ys.push(0):(c.ys.push(o.readShort(a,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=o.readUshort(a,l),l+=2;var I={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(I),I.glyphIndex=o.readUshort(a,l),l+=2,1&N){var P=o.readShort(a,l);l+=2;var L=o.readShort(a,l);l+=2}else P=o.readInt8(a,l),l++,L=o.readInt8(a,l),l++;2&N?(I.m.tx=P,I.m.ty=L):(I.p1=P,I.p2=L),8&N?(I.m.a=I.m.d=o.readF2dot14(a,l),l+=2):64&N?(I.m.a=o.readF2dot14(a,l),l+=2,I.m.d=o.readF2dot14(a,l),l+=2):128&N&&(I.m.a=o.readF2dot14(a,l),l+=2,I.m.b=o.readF2dot14(a,l),l+=2,I.m.c=o.readF2dot14(a,l),l+=2,I.m.d=o.readF2dot14(a,l),l+=2)}while(32&N);if(256&N){var R=o.readUshort(a,l);for(l+=2,c.instr=[],d=0;d<R;d++)c.instr.push(a[l]),l++}}return c},e.GDEF={},e.GDEF.parse=function(i,s,o,a){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,o,a){return e._lctf.parse(i,s,o,a,e.GPOS.subt)},e.GPOS.subt=function(i,s,o,a){var l=e._bin,c=o,d={};if(d.fmt=l.readUshort(i,o),o+=2,s==1||s==2||s==3||s==7||s==8&&d.fmt<=2){var h=l.readUshort(i,o);o+=2,d.coverage=e._lctf.readCoverage(i,h+c)}if(s==1&&d.fmt==1){var g=l.readUshort(i,o);o+=2,g!=0&&(d.pos=e.GPOS.readValueRecord(i,o,g))}else if(s==2&&d.fmt>=1&&d.fmt<=2){g=l.readUshort(i,o),o+=2;var v=l.readUshort(i,o);o+=2;var b=e._lctf.numOfOnes(g),_=e._lctf.numOfOnes(v);if(d.fmt==1){d.pairsets=[];var w=l.readUshort(i,o);o+=2;for(var S=0;S<w;S++){var E=c+l.readUshort(i,o);o+=2;var A=l.readUshort(i,E);E+=2;for(var N=[],I=0;I<A;I++){var P=l.readUshort(i,E);E+=2,g!=0&&(q=e.GPOS.readValueRecord(i,E,g),E+=2*b),v!=0&&(B=e.GPOS.readValueRecord(i,E,v),E+=2*_),N.push({gid2:P,val1:q,val2:B})}d.pairsets.push(N)}}if(d.fmt==2){var L=l.readUshort(i,o);o+=2;var R=l.readUshort(i,o);o+=2;var O=l.readUshort(i,o);o+=2;var F=l.readUshort(i,o);for(o+=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 U=[];for(I=0;I<F;I++){var q=null,B=null;g!=0&&(q=e.GPOS.readValueRecord(i,o,g),o+=2*b),v!=0&&(B=e.GPOS.readValueRecord(i,o,v),o+=2*_),U.push({val1:q,val2:B})}d.matrix.push(U)}}}else if(s==4&&d.fmt==1)d.markCoverage=e._lctf.readCoverage(i,l.readUshort(i,o)+c),d.baseCoverage=e._lctf.readCoverage(i,l.readUshort(i,o+2)+c),d.markClassCount=l.readUshort(i,o+4),d.markArray=e.GPOS.readMarkArray(i,l.readUshort(i,o+6)+c),d.baseArray=e.GPOS.readBaseArray(i,l.readUshort(i,o+8)+c,d.markClassCount);else if(s==6&&d.fmt==1)d.mark1Coverage=e._lctf.readCoverage(i,l.readUshort(i,o)+c),d.mark2Coverage=e._lctf.readCoverage(i,l.readUshort(i,o+2)+c),d.markClassCount=l.readUshort(i,o+4),d.mark1Array=e.GPOS.readMarkArray(i,l.readUshort(i,o+6)+c),d.mark2Array=e.GPOS.readBaseArray(i,l.readUshort(i,o+8)+c,d.markClassCount);else{if(s==9&&d.fmt==1){var Z=l.readUshort(i,o);o+=2;var G=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=Z;else if(a.ltype!=Z)throw"invalid extension substitution";return e.GPOS.subt(i,a.ltype,c+G)}console.debug("unsupported GPOS table LookupType",s,"format",d.fmt)}return d},e.GPOS.readValueRecord=function(i,s,o){var a=e._bin,l=[];return l.push(1&o?a.readShort(i,s):0),s+=1&o?2:0,l.push(2&o?a.readShort(i,s):0),s+=2&o?2:0,l.push(4&o?a.readShort(i,s):0),s+=4&o?2:0,l.push(8&o?a.readShort(i,s):0),s+=8&o?2:0,l},e.GPOS.readBaseArray=function(i,s,o){var a=e._bin,l=[],c=s,d=a.readUshort(i,s);s+=2;for(var h=0;h<d;h++){for(var g=[],v=0;v<o;v++)g.push(e.GPOS.readAnchorRecord(i,c+a.readUshort(i,s))),s+=2;l.push(g)}return l},e.GPOS.readMarkArray=function(i,s){var o=e._bin,a=[],l=s,c=o.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=e.GPOS.readAnchorRecord(i,o.readUshort(i,s+2)+l);h.markClass=o.readUshort(i,s),a.push(h),s+=4}return a},e.GPOS.readAnchorRecord=function(i,s){var o=e._bin,a={};return a.fmt=o.readUshort(i,s),a.x=o.readShort(i,s+2),a.y=o.readShort(i,s+4),a},e.GSUB={},e.GSUB.parse=function(i,s,o,a){return e._lctf.parse(i,s,o,a,e.GSUB.subt)},e.GSUB.subt=function(i,s,o,a){var l=e._bin,c=o,d={};if(d.fmt=l.readUshort(i,o),o+=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,o);o+=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,o),o+=2;else if(d.fmt==2){var g=l.readUshort(i,o);o+=2,d.newg=l.readUshorts(i,o,g),o+=2*d.newg.length}}else if(s==2&&d.fmt==1){g=l.readUshort(i,o),o+=2,d.seqs=[];for(var v=0;v<g;v++){var b=l.readUshort(i,o)+c;o+=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,o),o+=2,v=0;v<g;v++){var w=l.readUshort(i,o);o+=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,o);o+=2,d.cDef=e._lctf.readClassDef(i,c+S),d.scset=[];var E=l.readUshort(i,o);for(o+=2,v=0;v<E;v++){var A=l.readUshort(i,o);o+=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,o),o+=2;for(var N=[],I=0;I<g;I++)N.push(e._lctf.readCoverage(i,c+l.readUshort(i,o+2*I)));o+=2*g,v==0&&(d.backCvg=N),v==1&&(d.inptCvg=N),v==2&&(d.ahedCvg=N)}g=l.readUshort(i,o),o+=2,d.lookupRec=e.GSUB.readSubstLookupRecords(i,o,g)}}else{if(s==7&&d.fmt==1){var P=l.readUshort(i,o);o+=2;var L=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=P;else if(a.ltype!=P)throw"invalid extension substitution";return e.GSUB.subt(i,a.ltype,c+L)}console.debug("unsupported GSUB table LookupType",s,"format",d.fmt)}return d},e.GSUB.readSubClassSet=function(i,s){var o=e._bin.readUshort,a=s,l=[],c=o(i,s);s+=2;for(var d=0;d<c;d++){var h=o(i,s);s+=2,l.push(e.GSUB.readSubClassRule(i,a+h))}return l},e.GSUB.readSubClassRule=function(i,s){var o=e._bin.readUshort,a={},l=o(i,s),c=o(i,s+=2);s+=2,a.input=[];for(var d=0;d<l-1;d++)a.input.push(o(i,s)),s+=2;return a.substLookupRecords=e.GSUB.readSubstLookupRecords(i,s,c),a},e.GSUB.readSubstLookupRecords=function(i,s,o){for(var a=e._bin.readUshort,l=[],c=0;c<o;c++)l.push(a(i,s),a(i,s+2)),s+=4;return l},e.GSUB.readChainSubClassSet=function(i,s){var o=e._bin,a=s,l=[],c=o.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=o.readUshort(i,s);s+=2,l.push(e.GSUB.readChainSubClassRule(i,a+h))}return l},e.GSUB.readChainSubClassRule=function(i,s){for(var o=e._bin,a={},l=["backtrack","input","lookahead"],c=0;c<l.length;c++){var d=o.readUshort(i,s);s+=2,c==1&&d--,a[l[c]]=o.readUshorts(i,s,d),s+=2*a[l[c]].length}return d=o.readUshort(i,s),s+=2,a.subst=o.readUshorts(i,s,2*d),s+=2*a.subst.length,a},e.GSUB.readLigatureSet=function(i,s){var o=e._bin,a=s,l=[],c=o.readUshort(i,s);s+=2;for(var d=0;d<c;d++){var h=o.readUshort(i,s);s+=2,l.push(e.GSUB.readLigature(i,a+h))}return l},e.GSUB.readLigature=function(i,s){var o=e._bin,a={chain:[]};a.nglyph=o.readUshort(i,s),s+=2;var l=o.readUshort(i,s);s+=2;for(var c=0;c<l-1;c++)a.chain.push(o.readUshort(i,s)),s+=2;return a},e.head={},e.head.parse=function(i,s,o){var a=e._bin,l={};return a.readFixed(i,s),s+=4,l.fontRevision=a.readFixed(i,s),s+=4,a.readUint(i,s),s+=4,a.readUint(i,s),s+=4,l.flags=a.readUshort(i,s),s+=2,l.unitsPerEm=a.readUshort(i,s),s+=2,l.created=a.readUint64(i,s),s+=8,l.modified=a.readUint64(i,s),s+=8,l.xMin=a.readShort(i,s),s+=2,l.yMin=a.readShort(i,s),s+=2,l.xMax=a.readShort(i,s),s+=2,l.yMax=a.readShort(i,s),s+=2,l.macStyle=a.readUshort(i,s),s+=2,l.lowestRecPPEM=a.readUshort(i,s),s+=2,l.fontDirectionHint=a.readShort(i,s),s+=2,l.indexToLocFormat=a.readShort(i,s),s+=2,l.glyphDataFormat=a.readShort(i,s),s+=2,l},e.hhea={},e.hhea.parse=function(i,s,o){var a=e._bin,l={};return a.readFixed(i,s),s+=4,l.ascender=a.readShort(i,s),s+=2,l.descender=a.readShort(i,s),s+=2,l.lineGap=a.readShort(i,s),s+=2,l.advanceWidthMax=a.readUshort(i,s),s+=2,l.minLeftSideBearing=a.readShort(i,s),s+=2,l.minRightSideBearing=a.readShort(i,s),s+=2,l.xMaxExtent=a.readShort(i,s),s+=2,l.caretSlopeRise=a.readShort(i,s),s+=2,l.caretSlopeRun=a.readShort(i,s),s+=2,l.caretOffset=a.readShort(i,s),s+=2,s+=8,l.metricDataFormat=a.readShort(i,s),s+=2,l.numberOfHMetrics=a.readUshort(i,s),s+=2,l},e.hmtx={},e.hmtx.parse=function(i,s,o,a){for(var l=e._bin,c={aWidth:[],lsBearing:[]},d=0,h=0,g=0;g<a.maxp.numGlyphs;g++)g<a.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,o,a){var l=e._bin,c=l.readUshort(i,s);if(s+=2,c==1)return e.kern.parseV1(i,s-2,o,a);var d=l.readUshort(i,s);s+=2;for(var h={glyph1:[],rval:[]},g=0;g<d;g++){s+=2,o=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,o,a){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,o){var a=e._bin,l=-1,c=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 d=0;d<c;d++){var h=a.readUshort(i,s);s+=2;var g=a.readUshort(i,s);s+=2;var v=a.readShort(i,s);s+=2,h!=l&&(o.glyph1.push(h),o.rval.push({glyph2:[],vals:[]}));var b=o.rval[o.rval.length-1];b.glyph2.push(g),b.vals.push(v),l=h}return s},e.loca={},e.loca.parse=function(i,s,o,a){var l=e._bin,c=[],d=a.head.indexToLocFormat,h=a.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,o){var a=e._bin,l={},c=a.readUint(i,s);return s+=4,l.numGlyphs=a.readUshort(i,s),s+=2,c==65536&&(l.maxPoints=a.readUshort(i,s),s+=2,l.maxContours=a.readUshort(i,s),s+=2,l.maxCompositePoints=a.readUshort(i,s),s+=2,l.maxCompositeContours=a.readUshort(i,s),s+=2,l.maxZones=a.readUshort(i,s),s+=2,l.maxTwilightPoints=a.readUshort(i,s),s+=2,l.maxStorage=a.readUshort(i,s),s+=2,l.maxFunctionDefs=a.readUshort(i,s),s+=2,l.maxInstructionDefs=a.readUshort(i,s),s+=2,l.maxStackElements=a.readUshort(i,s),s+=2,l.maxSizeOfInstructions=a.readUshort(i,s),s+=2,l.maxComponentElements=a.readUshort(i,s),s+=2,l.maxComponentDepth=a.readUshort(i,s),s+=2),l},e.name={},e.name.parse=function(i,s,o){var a=e._bin,l={};a.readUshort(i,s),s+=2;var c=a.readUshort(i,s);s+=2,a.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=a.readUshort(i,s);s+=2;var _=a.readUshort(i,s);s+=2;var w=a.readUshort(i,s);s+=2;var S=a.readUshort(i,s);s+=2;var E=a.readUshort(i,s);s+=2;var A=a.readUshort(i,s);s+=2;var N,I=h[S],P=g+12*c+A;if(b==0)N=a.readUnicode(i,P,E/2);else if(b==3&&_==0)N=a.readUnicode(i,P,E/2);else if(_==0)N=a.readASCII(i,P,E);else if(_==1)N=a.readUnicode(i,P,E/2);else if(_==3)N=a.readUnicode(i,P,E/2);else{if(b!=1)throw"unknown encoding "+_+", platformID: "+b;N=a.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][I!==void 0?I: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,o){var a=e._bin.readUshort(i,s);s+=2;var l={};if(a==0)e["OS/2"].version0(i,s,l);else if(a==1)e["OS/2"].version1(i,s,l);else if(a==2||a==3||a==4)e["OS/2"].version2(i,s,l);else{if(a!=5)throw"unknown OS/2 table version: "+a;e["OS/2"].version5(i,s,l)}return l},e["OS/2"].version0=function(i,s,o){var a=e._bin;return o.xAvgCharWidth=a.readShort(i,s),s+=2,o.usWeightClass=a.readUshort(i,s),s+=2,o.usWidthClass=a.readUshort(i,s),s+=2,o.fsType=a.readUshort(i,s),s+=2,o.ySubscriptXSize=a.readShort(i,s),s+=2,o.ySubscriptYSize=a.readShort(i,s),s+=2,o.ySubscriptXOffset=a.readShort(i,s),s+=2,o.ySubscriptYOffset=a.readShort(i,s),s+=2,o.ySuperscriptXSize=a.readShort(i,s),s+=2,o.ySuperscriptYSize=a.readShort(i,s),s+=2,o.ySuperscriptXOffset=a.readShort(i,s),s+=2,o.ySuperscriptYOffset=a.readShort(i,s),s+=2,o.yStrikeoutSize=a.readShort(i,s),s+=2,o.yStrikeoutPosition=a.readShort(i,s),s+=2,o.sFamilyClass=a.readShort(i,s),s+=2,o.panose=a.readBytes(i,s,10),s+=10,o.ulUnicodeRange1=a.readUint(i,s),s+=4,o.ulUnicodeRange2=a.readUint(i,s),s+=4,o.ulUnicodeRange3=a.readUint(i,s),s+=4,o.ulUnicodeRange4=a.readUint(i,s),s+=4,o.achVendID=[a.readInt8(i,s),a.readInt8(i,s+1),a.readInt8(i,s+2),a.readInt8(i,s+3)],s+=4,o.fsSelection=a.readUshort(i,s),s+=2,o.usFirstCharIndex=a.readUshort(i,s),s+=2,o.usLastCharIndex=a.readUshort(i,s),s+=2,o.sTypoAscender=a.readShort(i,s),s+=2,o.sTypoDescender=a.readShort(i,s),s+=2,o.sTypoLineGap=a.readShort(i,s),s+=2,o.usWinAscent=a.readUshort(i,s),s+=2,o.usWinDescent=a.readUshort(i,s),s+=2},e["OS/2"].version1=function(i,s,o){var a=e._bin;return s=e["OS/2"].version0(i,s,o),o.ulCodePageRange1=a.readUint(i,s),s+=4,o.ulCodePageRange2=a.readUint(i,s),s+=4},e["OS/2"].version2=function(i,s,o){var a=e._bin;return s=e["OS/2"].version1(i,s,o),o.sxHeight=a.readShort(i,s),s+=2,o.sCapHeight=a.readShort(i,s),s+=2,o.usDefault=a.readUshort(i,s),s+=2,o.usBreak=a.readUshort(i,s),s+=2,o.usMaxContext=a.readUshort(i,s),s+=2},e["OS/2"].version5=function(i,s,o){var a=e._bin;return s=e["OS/2"].version2(i,s,o),o.usLowerOpticalPointSize=a.readUshort(i,s),s+=2,o.usUpperOpticalPointSize=a.readUshort(i,s),s+=2},e.post={},e.post.parse=function(i,s,o){var a=e._bin,l={};return l.version=a.readFixed(i,s),s+=4,l.italicAngle=a.readFixed(i,s),s+=4,l.underlinePosition=a.readShort(i,s),s+=2,l.underlineThickness=a.readShort(i,s),s+=2,l},e==null&&(e={}),e.U==null&&(e.U={}),e.U.codeToGlyph=function(i,s){var o=i.cmap,a=-1;if(o.p0e4!=null?a=o.p0e4:o.p3e1!=null?a=o.p3e1:o.p1e0!=null?a=o.p1e0:o.p0e3!=null&&(a=o.p0e3),a==-1)throw"no familiar platform and encoding!";var l=o.tables[a];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 o={cmds:[],crds:[]};if(i.SVG&&i.SVG.entries[s]){var a=i.SVG.entries[s];return a==null?o:(typeof a=="string"&&(a=e.SVG.toPath(a),i.SVG.entries[s]=a),a)}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,o)}else i.glyf&&e.U._drawGlyf(s,i,o);return o},e.U._drawGlyf=function(i,s,o){var a=s.glyf[i];a==null&&(a=s.glyf[i]=e.glyf._parseGlyf(s,i)),a!=null&&(a.noc>-1?e.U._simpleGlyph(a,o):e.U._compoGlyph(a,s,o))},e.U._simpleGlyph=function(i,s){for(var o=0;o<i.noc;o++){for(var a=o==0?0:i.endPts[o-1]+1,l=i.endPts[o],c=a;c<=l;c++){var d=c==a?l:c-1,h=c==l?a: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==a)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,o){for(var a=0;a<i.parts.length;a++){var l={cmds:[],crds:[]},c=i.parts[a];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];o.crds.push(g*d.a+v*d.b+d.tx),o.crds.push(g*d.c+v*d.d+d.ty)}for(h=0;h<l.cmds.length;h++)o.cmds.push(l.cmds[h])}},e.U._getGlyphClass=function(i,s){var o=e._lctf.getInterval(s,i);return o==-1?0:s[o+2]},e.U._applySubs=function(i,s,o,a){for(var l=i.length-s-1,c=0;c<o.tabs.length;c++)if(o.tabs[c]!=null){var d,h=o.tabs[c];if(!h.coverage||(d=e._lctf.coverageIndex(h.coverage,i[s]))!=-1){if(o.ltype==1)i[s],h.fmt==1?i[s]=i[s]+h.delta:i[s]=h.newg[d];else if(o.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(o.ltype==5&&h.fmt==2)for(var A=e._lctf.getInterval(h.cDef,i[s]),N=h.cDef[A+2],I=h.scset[N],P=0;P<I.length;P++){var L=I[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 F=L.substLookupRecords;for(v=0;v<F.length;v+=2)F[v],F[v+1]}}}else if(o.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 U=h.lookupRec;for(P=0;P<U.length;P+=2){A=U[P];var q=a[U[P+1]];e.U._applySubs(i,s+A,q,a)}}}}},e.U._glsCovered=function(i,s,o){for(var a=0;a<s.length;a++)if(e._lctf.coverageIndex(s[a],i[o+a])==-1)return!1;return!0},e.U.glyphsToPath=function(i,s,o){for(var a={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)a.crds.push(g.crds[v]+l),a.crds.push(g.crds[v+1]);for(o&&a.cmds.push(o),v=0;v<g.cmds.length;v++)a.cmds.push(g.cmds[v]);o&&a.cmds.push("X"),l+=i.hmtx.aWidth[d],c<s.length-1&&(l+=e.U.getPairAdjustment(i,d,h))}}return a},e.U.P={},e.U.P.moveTo=function(i,s,o){i.cmds.push("M"),i.crds.push(s,o)},e.U.P.lineTo=function(i,s,o){i.cmds.push("L"),i.crds.push(s,o)},e.U.P.curveTo=function(i,s,o,a,l,c,d){i.cmds.push("C"),i.crds.push(s,o,a,l,c,d)},e.U.P.qcurveTo=function(i,s,o,a,l){i.cmds.push("Q"),i.crds.push(s,o,a,l)},e.U.P.closePath=function(i){i.cmds.push("Z")},e.U._drawCFF=function(i,s,o,a,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,I=0,P=0,L=0,R=0,O=0,F=0,U={val:0,size:0};b<i.length;){e.CFF.getCharString(i,b,U);var q=U.val;if(b+=U.size,q=="o1"||q=="o18")c.length%2!=0&&!h&&(g=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,h=!0;else if(q=="o3"||q=="o23")c.length%2!=0&&!h&&(g=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,h=!0;else if(q=="o4")c.length>1&&!h&&(g=c.shift()+a.nominalWidthX,h=!0),v&&e.U.P.closePath(l),w+=c.pop(),e.U.P.moveTo(l,_,w),v=!0;else if(q=="o5")for(;c.length>0;)_+=c.shift(),w+=c.shift(),e.U.P.lineTo(l,_,w);else if(q=="o6"||q=="o7")for(var B=c.length,Z=q=="o6",G=0;G<B;G++){var $=c.shift();Z?_+=$:w+=$,Z=!Z,e.U.P.lineTo(l,_,w)}else if(q=="o8"||q=="o24"){B=c.length;for(var K=0;K+6<=B;)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;q=="o24"&&(_+=c.shift(),w+=c.shift(),e.U.P.lineTo(l,_,w))}else{if(q=="o11")break;if(q=="o1234"||q=="o1235"||q=="o1236"||q=="o1237")q=="o1234"&&(E=w,A=(S=_+c.shift())+c.shift(),F=N=E+c.shift(),P=N,R=w,_=(L=(I=(O=A+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,S,E,A,N,O,F),e.U.P.curveTo(l,I,P,L,R,_,w)),q=="o1235"&&(S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),O=A+c.shift(),F=N+c.shift(),I=O+c.shift(),P=F+c.shift(),L=I+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,F),e.U.P.curveTo(l,I,P,L,R,_,w)),q=="o1236"&&(S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),F=N=E+c.shift(),P=N,L=(I=(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,F),e.U.P.curveTo(l,I,P,L,R,_,w)),q=="o1237"&&(S=_+c.shift(),E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),O=A+c.shift(),F=N+c.shift(),I=O+c.shift(),P=F+c.shift(),L=I+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,F),e.U.P.curveTo(l,I,P,L,R,_,w));else if(q=="o14"){if(c.length>0&&!h&&(g=c.shift()+o.nominalWidthX,h=!0),c.length==4){var Y=c.shift(),J=c.shift(),H=c.shift(),z=c.shift(),X=e.CFF.glyphBySE(o,H),V=e.CFF.glyphBySE(o,z);e.U._drawCFF(o.CharStrings[X],s,o,a,l),s.x=Y,s.y=J,e.U._drawCFF(o.CharStrings[V],s,o,a,l)}v&&(e.U.P.closePath(l),v=!1)}else if(q=="o19"||q=="o20")c.length%2!=0&&!h&&(g=c.shift()+a.nominalWidthX),d+=c.length>>1,c.length=0,h=!0,b+=d+7>>3;else if(q=="o21")c.length>2&&!h&&(g=c.shift()+a.nominalWidthX,h=!0),w+=c.pop(),_+=c.pop(),v&&e.U.P.closePath(l),e.U.P.moveTo(l,_,w),v=!0;else if(q=="o22")c.length>1&&!h&&(g=c.shift()+a.nominalWidthX,h=!0),_+=c.pop(),v&&e.U.P.closePath(l),e.U.P.moveTo(l,_,w),v=!0;else if(q=="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(q=="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(q=="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(q=="o10"||q=="o29"){var ie=q=="o10"?a:o;if(c.length==0)console.debug("error: empty stack");else{var ae=c.pop(),re=ie.Subrs[ae+ie.Bias];s.x=_,s.y=w,s.nStems=d,s.haveWidth=h,s.width=g,s.open=v,e.U._drawCFF(re,s,o,a,l),_=s.x,w=s.y,d=s.nStems,h=s.haveWidth,g=s.width,v=s.open}}else if(q=="o30"||q=="o31"){var ce=c.length,oe=(K=0,q=="o31");for(K+=ce-(B=-3&ce);K<B;)oe?(E=w,A=(S=_+c.shift())+c.shift(),w=(N=E+c.shift())+c.shift(),B-K==5?(_=A+c.shift(),K++):_=A,oe=!1):(S=_,E=w+c.shift(),A=S+c.shift(),N=E+c.shift(),_=A+c.shift(),B-K==5?(w=N+c.shift(),K++):w=N,oe=!0),e.U.P.curveTo(l,S,E,A,N,_,w),K+=4}else{if((q+"").charAt(0)=="o")throw console.debug("Unknown operation: "+q,i),q;c.push(q)}}}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 WCe(){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]),o=new e([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),a=function(q,B){for(var Z=new n(31),G=0;G<31;++G)Z[G]=B+=1<<q[G-1];var $=new r(Z[30]);for(G=1;G<30;++G)for(var K=Z[G];K<Z[G+1];++K)$[K]=K-Z[G]<<5|G;return[Z,$]},l=a(i,2),c=l[0],d=l[1];c[28]=258,d[258]=28;for(var h=a(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(q,B,Z){for(var G=q.length,$=0,K=new n(B);$<G;++$)++K[q[$]-1];var Y,J=new n(B);for($=0;$<B;++$)J[$]=J[$-1]+K[$-1]<<1;{Y=new n(1<<B);var H=15-B;for($=0;$<G;++$)if(q[$])for(var z=$<<4|q[$],X=B-q[$],V=J[q[$]-1]++<<X,ie=V|(1<<X)-1;V<=ie;++V)Y[g[V]>>>H]=z}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(q){for(var B=q[0],Z=1;Z<q.length;++Z)q[Z]>B&&(B=q[Z]);return B},I=function(q,B,Z){var G=B/8|0;return(q[G]|q[G+1]<<8)>>(7&B)&Z},P=function(q,B){var Z=B/8|0;return(q[Z]|q[Z+1]<<8|q[Z+2]<<16)>>(7&B)},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(q,B,Z){var G=new Error(B||L[q]);if(G.code=q,Error.captureStackTrace&&Error.captureStackTrace(G,R),!Z)throw G;return G},O=function(q,B,Z){var G=q.length;if(!G||Z&&!Z.l&&G<5)return B||new e(0);var $=!B||Z,K=!Z||Z.i;Z||(Z={}),B||(B=new e(3*G));var Y,J=function(Fe){var we=B.length;if(Fe>we){var ke=new e(Math.max(2*we,Fe));ke.set(B),B=ke}},H=Z.f||0,z=Z.p||0,X=Z.b||0,V=Z.l,ie=Z.d,ae=Z.m,re=Z.n,ce=8*G;do{if(!V){Z.f=H=I(q,z,1);var oe=I(q,z+1,3);if(z+=3,!oe){var fe=q[(je=((Y=z)/8|0)+(7&Y&&1)+4)-4]|q[je-3]<<8,me=je+fe;if(me>G){K&&R(0);break}$&&J(X+fe),B.set(q.subarray(je,me),X),Z.b=X+=fe,Z.p=z=8*me;continue}if(oe==1)V=E,ie=A,ae=9,re=5;else if(oe==2){var ye=I(q,z,31)+257,Ee=I(q,z+10,15)+4,Ge=ye+I(q,z+5,31)+1;z+=14;for(var _e=new e(Ge),De=new e(19),he=0;he<Ee;++he)De[o[he]]=I(q,z+3*he,7);z+=3*Ee;var Le=N(De),ne=(1<<Le)-1,We=_(De,Le);for(he=0;he<Ge;){var je,be=We[I(q,z,ne)];if(z+=15&be,(je=be>>>4)<16)_e[he++]=je;else{var Xe=0,le=0;for(je==16?(le=3+I(q,z,3),z+=2,Xe=_e[he-1]):je==17?(le=3+I(q,z,7),z+=3):je==18&&(le=11+I(q,z,127),z+=7);le--;)_e[he++]=Xe}}var te=_e.subarray(0,ye),Se=_e.subarray(ye);ae=N(te),re=N(Se),V=_(te,ae),ie=_(Se,re)}else R(1);if(z>ce){K&&R(0);break}}$&&J(X+131072);for(var ve=(1<<ae)-1,ge=(1<<re)-1,Te=z;;Te=z){var He=(Xe=V[P(q,z)&ve])>>>4;if((z+=15&Xe)>ce){K&&R(0);break}if(Xe||R(2),He<256)B[X++]=He;else{if(He==256){Te=z,V=null;break}var pe=He-254;if(He>264){var qe=i[he=He-257];pe=I(q,z,(1<<qe)-1)+c[he],z+=qe}var xt=ie[P(q,z)&ge],nt=xt>>>4;if(xt||R(3),z+=15&xt,Se=h[nt],nt>3&&(qe=s[nt],Se+=P(q,z)&(1<<qe)-1,z+=qe),z>ce){K&&R(0);break}$&&J(X+131072);for(var tt=X+pe;X<tt;X+=4)B[X]=B[X-Se],B[X+1]=B[X+1-Se],B[X+2]=B[X+2-Se],B[X+3]=B[X+3-Se];X=tt}}Z.l=V,Z.p=Te,Z.b=X,V&&(H=1,Z.m=ae,Z.d=ie,Z.n=re)}while(!H);return X==B.length?B:(function(Fe,we,ke){(ke==null||ke>Fe.length)&&(ke=Fe.length);var Ze=new(Fe instanceof n?n:Fe instanceof r?r:e)(ke-we);return Ze.set(Fe.subarray(we,ke)),Ze})(B,0,X)},F=new e(0),U=typeof TextDecoder<"u"&&new TextDecoder;try{U.decode(F,{stream:!0})}catch{}return t.convert_streams=function(q){var B=new DataView(q),Z=0;function G(){var ye=B.getUint16(Z);return Z+=2,ye}function $(){var ye=B.getUint32(Z);return Z+=4,ye}function K(ye){fe.setUint16(me,ye),me+=2}function Y(ye){fe.setUint32(me,ye),me+=4}for(var J={signature:$(),flavor:$(),length:$(),numTables:G(),reserved:G(),totalSfntSize:$(),majorVersion:G(),minorVersion:G(),metaOffset:$(),metaLength:$(),metaOrigLength:$(),privOffset:$(),privLength:$()},H=0;Math.pow(2,H)<=J.numTables;)H++;H--;for(var z=16*Math.pow(2,H),X=16*J.numTables-z,V=12,ie=[],ae=0;ae<J.numTables;ae++)ie.push({tag:$(),offset:$(),compLength:$(),origLength:$(),origChecksum:$()}),V+=16;var re,ce=new Uint8Array(12+16*ie.length+ie.reduce((function(ye,Ee){return ye+Ee.origLength+4}),0)),oe=ce.buffer,fe=new DataView(oe),me=0;return Y(J.flavor),K(J.numTables),K(z),K(H),K(X),ie.forEach((function(ye){Y(ye.tag),Y(ye.origChecksum),Y(V),Y(ye.origLength),ye.outOffset=V,(V+=ye.origLength)%4!=0&&(V+=4-V%4)})),ie.forEach((function(ye){var Ee,Ge=q.slice(ye.offset,ye.offset+ye.compLength);if(ye.compLength!=ye.origLength){var _e=new Uint8Array(ye.origLength);Ee=new Uint8Array(Ge,2),O(Ee,_e)}else _e=new Uint8Array(Ge);ce.set(_e,ye.outOffset);var De=0;(V=ye.outOffset+ye.origLength)%4!=0&&(De=4-V%4),ce.set(new Uint8Array(De).buffer,ye.outOffset+ye.origLength),re=V+De})),oe.slice(0,re)},Object.defineProperty(t,"__esModule",{value:!0}),t})({}).convert_streams}function $Ce(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,o=4,a=8,l=16,c=32;let d;function h(L){if(!d){const R={R:s,L:i,D:o,C:l,U:c,T:a};d=new Map;for(let O in r){let F=0;r[O].split(",").forEach(U=>{let[q,B]=U.split("+");q=parseInt(q,36),B=B?parseInt(B,36):0,d.set(F+=q,R[O]);for(let Z=B;Z--;)d.set(++F,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,F=g,U=-1;for(let q=0;q<L.length;q++){const B=L.codePointAt(q);let Z=h(B)|0,G=g;Z&a||(O&(i|o|l)?Z&(s|o|l)?(G=b,(F===g||F===b)&&R[U]++):Z&(i|c)&&(F===v||F===_)&&R[U]--:O&(s|c)&&(F===v||F===_)&&R[U]--,F=R[q]=G,O=Z,U=q,B>65535&&q++)}return R}function E(L,R){const O=[];for(let U=0;U<R.length;U++){const q=R.codePointAt(U);q>65535&&U++,O.push(t.U.codeToGlyph(L,q))}const F=L.GSUB;if(F){const{lookupList:U,featureList:q}=F;let B;const Z=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,G=[];q.forEach($=>{if(Z.test($.tag))for(let K=0;K<$.tab.length;K++){if(G[$.tab[K]])continue;G[$.tab[K]]=!0;const Y=U[$.tab[K]],J=/^(isol|init|fina|medi)$/.test($.tag);J&&!B&&(B=S(R));for(let H=0;H<O.length;H++)(!B||!J||w[B[H]]===$.tag)&&t.U._applySubs(O,H,Y,U)}})}return O}function A(L,R){const O=new Int16Array(R.length*3);let F=0;for(;F<R.length;F++){const Z=R[F];if(Z===-1)continue;O[F*3+2]=L.hmtx.aWidth[Z];const G=L.GPOS;if(G){const $=G.lookupList;for(let K=0;K<$.length;K++){const Y=$[K];for(let J=0;J<Y.tabs.length;J++){const H=Y.tabs[J];if(Y.ltype===1){if(t._lctf.coverageIndex(H.coverage,Z)!==-1&&H.pos){B(H.pos,F);break}}else if(Y.ltype===2){let z=null,X=U();if(X!==-1){const V=t._lctf.coverageIndex(H.coverage,R[X]);if(V!==-1){if(H.fmt===1){const ie=H.pairsets[V];for(let ae=0;ae<ie.length;ae++)ie[ae].gid2===Z&&(z=ie[ae])}else if(H.fmt===2){const ie=t.U._getGlyphClass(R[X],H.classDef1),ae=t.U._getGlyphClass(Z,H.classDef2);z=H.matrix[ie][ae]}if(z){z.val1&&B(z.val1,X),z.val2&&B(z.val2,F);break}}}}else if(Y.ltype===4){const z=t._lctf.coverageIndex(H.markCoverage,Z);if(z!==-1){const X=U(q),V=X===-1?-1:t._lctf.coverageIndex(H.baseCoverage,R[X]);if(V!==-1){const ie=H.markArray[z],ae=H.baseArray[V][ie.markClass];O[F*3]=ae.x-ie.x+O[X*3]-O[X*3+2],O[F*3+1]=ae.y-ie.y+O[X*3+1];break}}}else if(Y.ltype===6){const z=t._lctf.coverageIndex(H.mark1Coverage,Z);if(z!==-1){const X=U();if(X!==-1){const V=R[X];if(N(L,V)===3){const ie=t._lctf.coverageIndex(H.mark2Coverage,V);if(ie!==-1){const ae=H.mark1Array[z],re=H.mark2Array[ie][ae.markClass];O[F*3]=re.x-ae.x+O[X*3]-O[X*3+2],O[F*3+1]=re.y-ae.y+O[X*3+1];break}}}}}}}}else if(L.kern&&!L.cff){const $=U();if($!==-1){const K=L.kern.glyph1.indexOf(R[$]);if(K!==-1){const Y=L.kern.rval[K].glyph2.indexOf(Z);Y!==-1&&(O[$*3+2]+=L.kern.rval[K].vals[Y])}}}}return O;function U(Z){for(let G=F-1;G>=0;G--)if(R[G]!==-1&&(!Z||Z(R[G])))return G;return-1}function q(Z){return N(L,Z)===1}function B(Z,G){for(let $=0;$<3;$++)O[G*3+$]+=Z[$]||0}}function N(L,R){const O=L.GDEF&&L.GDEF.glyphClassDef;return O?t.U._getGlyphClass(R,O):0}function I(...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"],F=L.hhea,U=L.head.unitsPerEm,q=I(O&&O.sTypoAscender,F&&F.ascender,U),B={unitsPerEm:U,ascender:q,descender:I(O&&O.sTypoDescender,F&&F.descender,0),capHeight:I(O&&O.sCapHeight,q),xHeight:I(O&&O.sxHeight,q),lineGap:I(O&&O.sTypoLineGap,F&&F.lineGap),supportsCodePoint(Z){return t.U.codeToGlyph(L,Z)>0},forEachGlyph(Z,G,$,K){let Y=0;const J=1/B.unitsPerEm*G,H=E(L,Z);let z=0;const X=A(L,H);return H.forEach((V,ie)=>{if(V!==-1){let ae=R[V];if(!ae){const{cmds:re,crds:ce}=t.U.glyphToPath(L,V);let oe="",fe=0;for(let _e=0,De=re.length;_e<De;_e++){const he=n[re[_e]];oe+=re[_e];for(let Le=1;Le<=he;Le++)oe+=(Le>1?",":"")+ce[fe++]}let me,ye,Ee,Ge;if(ce.length){me=ye=1/0,Ee=Ge=-1/0;for(let _e=0,De=ce.length;_e<De;_e+=2){let he=ce[_e],Le=ce[_e+1];he<me&&(me=he),Le<ye&&(ye=Le),he>Ee&&(Ee=he),Le>Ge&&(Ge=Le)}}else me=Ee=ye=Ge=0;ae=R[V]={index:V,advanceWidth:L.hmtx.aWidth[V],xMin:me,yMin:ye,xMax:Ee,yMax:Ge,path:oe}}K.call(null,ae,Y+X[ie*3]*J,X[ie*3+1]*J,z),Y+=X[ie*3+2]*J,$&&(Y+=$*G)}z+=Z.codePointAt(z)>65535?2:1}),Y}};return B}return function(R){const O=new Uint8Array(R,0,4),F=t._bin.readASCII(O,0,4);if(F==="wOFF")R=e(R);else if(F==="wOF2")throw new Error("woff2 fonts not supported");return P(t.parse(R)[0])}}const qCe=Oy({name:"Typr Font Parser",dependencies:[GCe,WCe,$Ce],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 XCe(){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,I){A.push((+I).toString(36)+":"+N.toString(36))})),A.join(",")},e.prototype.deserialize=function(A){var N=this;this.buckets.clear(),A.split(",").forEach((function(I){var P=I.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),I=(function(P){return(P&i)+n-1})(A).toString(16);return"codepoint-index/plane"+(A>>16)+"/"+N+"-"+I+".json"}function o(A,N){var I=A&r,P=N.codePointAt(I/6|0);return((P=(P||48)-48)&1<<I%6)!=0}function a(A,N){var I;(I=A,I.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){a(A,(function(I,P){for(var L=I;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(I){return N.add(I)})),h.set(A,N)),N}var b,_=new Map;function w(A,N,I){return A[N]?N:A[I]?I:(function(P){for(var L in P)return L})(A)}function S(A,N){var I=N;if(!A.includes(I)){I=1/0;for(var P=0;P<A.length;P++)Math.abs(A[P]-N)<Math.abs(I-N)&&(I=A[P])}return I}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 I,P=N.lang;P===void 0&&(P=new RegExp("\\p{Script=Hangul}","u").test(I=A)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(I)?"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 F=(N.dataUrl||g).replace(/\/$/g,""),U=new Map,q=new Uint8Array(A.length),B={},Z={},G=new Array(A.length),$=new Map,K=!1;function Y(z){var X=_.get(z);return X||(X=fetch(F+"/"+z).then((function(V){if(!V.ok)throw new Error(V.statusText);return V.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(V){if(F!==g)return K||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+F+'", trying default CDN. '+V.message),K=!0),F=g,_.delete(z),Y(z);throw V})),_.set(z,X)),X}for(var J=function(z){var X=A.codePointAt(z),V=s(X);G[z]=V,c[V]||$.has(V)||$.set(V,Y(V).then((function(ie){c[V]=ie}))),X>65535&&(z++,H=z)},H=0;H<A.length;H++)J(H);return Promise.all($.values()).then((function(){$.clear();for(var z=function(V){var ie=A.codePointAt(V),ae=null,re=c[G[V]],ce=void 0;for(var oe in re){var fe=Z[oe];if(fe===void 0&&(fe=Z[oe]=new RegExp(oe).test(P||"en")),fe){for(var me in ce=oe,re[oe])if(o(ie,re[oe][me])){ae=me;break}break}}if(!ae){e:for(var ye in re)if(ye!==ce){for(var Ee in re[ye])if(o(ie,re[ye][Ee])){ae=Ee;break e}}}ae||(console.debug("No font coverage for U+"+ie.toString(16)),ae="latin"),G[V]=ae,d[ae]||$.has(ae)||$.set(ae,Y("font-meta/"+ae+".json").then((function(Ge){d[ae]=Ge}))),ie>65535&&(V++,X=V)},X=0;X<A.length;X++)z(X);return Promise.all($.values())})).then((function(){for(var z,X=null,V=0;V<A.length;V++){var ie=A.codePointAt(V);if(X&&(E(ie)||v(X).has(ie)))q[V]=q[V-1];else{X=d[G[V]];var ae=B[X.id];if(!ae){var re=X.typeforms,ce=w(re,L,"sans-serif"),oe=w(re[ce],R,"normal"),fe=S((z=re[ce])===null||z===void 0?void 0:z[oe],O);ae=B[X.id]=F+"/font-files/"+X.id+"/"+ce+"."+oe+"."+fe+".woff"}var me=U.get(ae);me==null&&(me=U.size,U.set(ae,me)),q[V]=me}ie>65535&&(V++,q[V]=q[V-1])}return{fontUrls:Array.from(U.keys()),chars:q}}))},Object.defineProperty(t,"__esModule",{value:!0}),t})({})}function YCe(t,e){const n=Object.create(null),r=Object.create(null);function i(o,a){const l=c=>{console.error(`Failure loading font ${o}`,c)};try{const c=new XMLHttpRequest;c.open("get",o,!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=o,a(d)}catch(d){l(d)}},c.onerror=l,c.send()}catch(c){l(c)}}function s(o,a){let l=n[o];l?a(l):r[o]?r[o].push(a):(r[o]=[a],i(o,c=>{c.src=o,n[o]=c,r[o].forEach(d=>d(c)),delete r[o]}))}return function(o,a,{lang:l,fonts:c=[],style:d="normal",weight:h="normal",unicodeFontsURL:g}={}){const v=new Uint8Array(o.length),b=[];o.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 F=O,U=o.length;F<U;F++){const q=o.codePointAt(F);if(L===1&&b[v[F-1]].supportsCodePoint(q)||F>0&&/\s/.test(o[F]))v[F]=v[F-1],L===2&&(w[w.length-1][1]=F);else for(let B=v[F],Z=c.length;B<=Z;B++)if(B===Z){const G=L===2?w[w.length-1]:w[w.length]=[F,F];G[1]=F,L=2}else{v[F]=B;const{src:G,unicodeRange:$}=c[B];if(!$||A(q,$)){const K=n[G];if(!K){s(G,()=>{R(F)});return}if(K.supportsCodePoint(q)){let Y=_.get(K);typeof Y!="number"&&(Y=b.length,b.push(K),_.set(K,Y)),v[F]=Y,L=1;break}}}q>65535&&F+1<U&&(v[F+1]=v[F],F++,L===2&&(w[w.length-1][1]=F))}S()})()}else w.push([0,o.length-1]),S();function S(){if(w.length){const N=w.map(I=>o.substring(I[0],I[1]+1)).join(`
`);e.getFontsForString(N,{lang:l||void 0,style:d,weight:h,dataUrl:g}).then(({fontUrls:I,chars:P})=>{const L=b.length;let R=0;w.forEach(F=>{for(let U=0,q=F[1]-F[0];U<=q;U++)v[F[0]+U]=P[R++]+L;R++});let O=0;I.forEach((F,U)=>{s(F,q=>{b[U+L]=q,++O===I.length&&E()})})})}else E()}function E(){a({chars:v,fonts:b})}function A(N,I){for(let P=0;P<I.length;P++){const[L,R=L]=I[P];if(L<=N&&N<=R)return!0}return!1}}}const KCe=Oy({name:"FontResolver",dependencies:[YCe,qCe,XCe],init(t,e,n){return t(e,n())}});function ZCe(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 o({text:b,lang:_,fonts:w,style:S,weight:E,preResolvedFonts:A,unicodeFontsURL:N},I){const P=({chars:L,fonts:R})=>{let O,F;const U=[];for(let q=0;q<L.length;q++)L[q]!==F?(F=L[q],U.push(O={start:q,end:q,fontObj:R[L[q]]})):O.end=q;I(U)};A?P(A):t(b,P,{lang:_,fonts:w,style:S,weight:E,unicodeFontsURL:N})}function a({text:b="",font:_,lang:w,sdfGlyphSize:S=64,fontSize:E=400,fontWeight:A=1,fontStyle:N="normal",letterSpacing:I=0,lineHeight:P="normal",maxWidth:L=1/0,direction:R,textAlign:O="left",textIndent:F=0,whiteSpace:U="normal",overflowWrap:q="normal",anchorX:B=0,anchorY:Z=0,metricsOnly:G=!1,unicodeFontsURL:$,preResolvedFonts:K=null,includeCaretPositions:Y=!1,chunkedBoundsSize:J=8192,colorRanges:H=null},z){const X=h(),V={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,I=+I,L=+L,P=P||"normal",F=+F,o({text:b,lang:w,style:N,weight:A,fonts:typeof _=="string"?[{src:_}]:_,unicodeFontsURL:$,preResolvedFonts:K},ie=>{V.fontLoad=h()-X;const ae=isFinite(L);let re=null,ce=null,oe=null,fe=null,me=null,ye=null,Ee=null,Ge=null,_e=0,De=0,he=U!=="nowrap";const Le=new Map,ne=h();let We=F,je=0,be=new g;const Xe=[be];ie.forEach(ge=>{const{fontObj:Te}=ge,{ascender:He,descender:pe,unitsPerEm:qe,lineGap:xt,capHeight:nt,xHeight:tt}=Te;let Fe=Le.get(Te);if(!Fe){const Ke=E/qe,it=P==="normal"?(He-pe+xt)*Ke:P*E,ht=(it-(He-pe)*Ke)/2,Je=Math.min(it,(He-pe)*Ke),$e=(He+pe)/2*Ke+Je/2;Fe={index:Le.size,src:Te.src,fontObj:Te,fontSizeMult:Ke,unitsPerEm:qe,ascender:He*Ke,descender:pe*Ke,capHeight:nt*Ke,xHeight:tt*Ke,lineHeight:it,baseline:-ht-He*Ke,caretTop:$e,caretBottom:$e-Je},Le.set(Te,Fe)}const{fontSizeMult:we}=Fe,ke=b.slice(ge.start,ge.end+1);let Ze,Ne;Te.forEachGlyph(ke,E,I,(Ke,it,ht,Je)=>{it+=je,Je+=ge.start,Ze=it,Ne=Ke;const $e=b.charAt(Je),Ae=Ke.advanceWidth*we,Oe=be.count;let Ye;if("isEmpty"in Ke||(Ke.isWhitespace=!!$e&&new RegExp(i).test($e),Ke.canBreakAfter=!!$e&&s.test($e),Ke.isEmpty=Ke.xMin===Ke.xMax||Ke.yMin===Ke.yMax||r.test($e)),!Ke.isWhitespace&&!Ke.isEmpty&&De++,he&&ae&&!Ke.isWhitespace&&it+Ae+We>L&&Oe){if(be.glyphAt(Oe-1).glyphObj.canBreakAfter)Ye=new g,We=-it;else for(let Rt=Oe;Rt--;)if(Rt===0&&q==="break-word"){Ye=new g,We=-it;break}else if(be.glyphAt(Rt).glyphObj.canBreakAfter){Ye=be.splitAt(Rt+1);const yt=Ye.glyphAt(0).x;We-=yt;for(let Tt=Ye.count;Tt--;)Ye.glyphAt(Tt).x-=yt;break}Ye&&(be.isSoftWrapped=!0,be=Ye,Xe.push(be),_e=L)}let st=be.glyphAt(be.count);st.glyphObj=Ke,st.x=it+We,st.y=ht,st.width=Ae,st.charIndex=Je,st.fontData=Fe,$e===`
`&&(be=new g,Xe.push(be),We=-(it+Ae+I*E)+F)}),je=Ze+Ne.advanceWidth*we+I*E});let le=0;Xe.forEach(ge=>{let Te=!0;for(let He=ge.count;He--;){const pe=ge.glyphAt(He);Te&&!pe.glyphObj.isWhitespace&&(ge.width=pe.x+pe.width,ge.width>_e&&(_e=ge.width),Te=!1);let{lineHeight:qe,capHeight:xt,xHeight:nt,baseline:tt}=pe.fontData;qe>ge.lineHeight&&(ge.lineHeight=qe);const Fe=tt-ge.baseline;Fe<0&&(ge.baseline+=Fe,ge.cap+=Fe,ge.ex+=Fe),ge.cap=Math.max(ge.cap,ge.baseline+xt),ge.ex=Math.max(ge.ex,ge.baseline+nt)}ge.baseline-=le,ge.cap-=le,ge.ex-=le,le+=ge.lineHeight});let te=0,Se=0;if(B&&(typeof B=="number"?te=-B:typeof B=="string"&&(te=-_e*(B==="left"?0:B==="center"?.5:B==="right"?1:c(B)))),Z&&(typeof Z=="number"?Se=-Z:typeof Z=="string"&&(Se=Z==="top"?0:Z==="top-baseline"?-Xe[0].baseline:Z==="top-cap"?-Xe[0].cap:Z==="top-ex"?-Xe[0].ex:Z==="middle"?le/2:Z==="bottom"?le:Z==="bottom-baseline"?-Xe[Xe.length-1].baseline:c(Z)*le)),!G){const ge=e.getEmbeddingLevels(b,R);re=new Uint16Array(De),ce=new Uint8Array(De),oe=new Float32Array(De*2),fe={},Ee=[1/0,1/0,-1/0,-1/0],Ge=[],Y&&(ye=new Float32Array(b.length*4)),H&&(me=new Uint8Array(De*3));let Te=0,He=-1,pe=-1,qe,xt;if(Xe.forEach((nt,tt)=>{let{count:Fe,width:we}=nt;if(Fe>0){let ke=0;for(let Je=Fe;Je--&&nt.glyphAt(Je).glyphObj.isWhitespace;)ke++;let Ze=0,Ne=0;if(O==="center")Ze=(_e-we)/2;else if(O==="right")Ze=_e-we;else if(O==="justify"&&nt.isSoftWrapped){let Je=0;for(let $e=Fe-ke;$e--;)nt.glyphAt($e).glyphObj.isWhitespace&&Je++;Ne=(_e-we)/Je}if(Ne||Ze){let Je=0;for(let $e=0;$e<Fe;$e++){let Ae=nt.glyphAt($e);const Oe=Ae.glyphObj;Ae.x+=Ze+Je,Ne!==0&&Oe.isWhitespace&&$e<Fe-ke&&(Je+=Ne,Ae.width+=Ne)}}const Ke=e.getReorderSegments(b,ge,nt.glyphAt(0).charIndex,nt.glyphAt(nt.count-1).charIndex);for(let Je=0;Je<Ke.length;Je++){const[$e,Ae]=Ke[Je];let Oe=1/0,Ye=-1/0;for(let st=0;st<Fe;st++)if(nt.glyphAt(st).charIndex>=$e){let Rt=st,yt=st;for(;yt<Fe;yt++){let Tt=nt.glyphAt(yt);if(Tt.charIndex>Ae)break;yt<Fe-ke&&(Oe=Math.min(Oe,Tt.x),Ye=Math.max(Ye,Tt.x+Tt.width))}for(let Tt=Rt;Tt<yt;Tt++){const Et=nt.glyphAt(Tt);Et.x=Ye-(Et.x+Et.width-Oe)}break}}let it;const ht=Je=>it=Je;for(let Je=0;Je<Fe;Je++){const $e=nt.glyphAt(Je);it=$e.glyphObj;const Ae=it.index,Oe=ge.levels[$e.charIndex]&1;if(Oe){const Ye=e.getMirroredCharacter(b[$e.charIndex]);Ye&&$e.fontData.fontObj.forEachGlyph(Ye,0,0,ht)}if(Y){const{charIndex:Ye,fontData:st}=$e,Rt=$e.x+te,yt=$e.x+$e.width+te;ye[Ye*4]=Oe?yt:Rt,ye[Ye*4+1]=Oe?Rt:yt,ye[Ye*4+2]=nt.baseline+st.caretBottom+Se,ye[Ye*4+3]=nt.baseline+st.caretTop+Se;const Tt=Ye-He;Tt>1&&d(ye,He,Tt),He=Ye}if(H){const{charIndex:Ye}=$e;for(;Ye>pe;)pe++,H.hasOwnProperty(pe)&&(xt=H[pe])}if(!it.isWhitespace&&!it.isEmpty){const Ye=Te++,{fontSizeMult:st,src:Rt,index:yt}=$e.fontData,Tt=fe[Rt]||(fe[Rt]={});Tt[Ae]||(Tt[Ae]={path:it.path,pathBounds:[it.xMin,it.yMin,it.xMax,it.yMax]});const Et=$e.x+te,Dt=$e.y+nt.baseline+Se;oe[Ye*2]=Et,oe[Ye*2+1]=Dt;const Ue=Et+it.xMin*st,ct=Dt+it.yMin*st,St=Et+it.xMax*st,kt=Dt+it.yMax*st;Ue<Ee[0]&&(Ee[0]=Ue),ct<Ee[1]&&(Ee[1]=ct),St>Ee[2]&&(Ee[2]=St),kt>Ee[3]&&(Ee[3]=kt),Ye%J===0&&(qe={start:Ye,end:Ye,rect:[1/0,1/0,-1/0,-1/0]},Ge.push(qe)),qe.end++;const Ut=qe.rect;if(Ue<Ut[0]&&(Ut[0]=Ue),ct<Ut[1]&&(Ut[1]=ct),St>Ut[2]&&(Ut[2]=St),kt>Ut[3]&&(Ut[3]=kt),re[Ye]=Ae,ce[Ye]=yt,H){const Xt=Ye*3;me[Xt]=xt>>16&255,me[Xt+1]=xt>>8&255,me[Xt+2]=xt&255}}}}}),ye){const nt=b.length-He;nt>1&&d(ye,He,nt)}}const ve=[];Le.forEach(({index:ge,src:Te,unitsPerEm:He,ascender:pe,descender:qe,lineHeight:xt,capHeight:nt,xHeight:tt})=>{ve[ge]={src:Te,unitsPerEm:He,ascender:pe,descender:qe,lineHeight:xt,capHeight:nt,xHeight:tt}}),V.typesetting=h()-ne,z({glyphIds:re,glyphFontIndices:ce,glyphPositions:oe,glyphData:fe,fontData:ve,caretPositions:ye,glyphColors:me,chunkedBounds:Ge,fontSize:E,topBaseline:Se+Xe[0].baseline,blockBounds:[te,Se-le,te+_e,Se],visibleBounds:Ee,timings:V})})}function l(b,_){a({...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],I=(E-S)/w;for(let P=0;P<w;P++){const L=(_+P)*4;b[L]=S+I*P,b[L+1]=S+I*(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:a,measure:l}}const Yg=()=>(self.performance||Date).now(),PE=BK();let eF;function QCe(t,e,n,r,i,s,o,a,l,c,d=!0){return d?eAe(t,e,n,r,i,s,o,a,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,o,a,l,c))):nF(t,e,n,r,i,s,o,a,l,c)}const qM=[],JCe=5;let u7=0;function VK(){const t=Yg();for(;qM.length&&Yg()-t<JCe;)qM.shift()();u7=qM.length?setTimeout(VK,0):0}const eAe=(...t)=>new Promise((e,n)=>{qM.push(()=>{const r=Yg();try{PE.webgl.generateIntoCanvas(...t),e({timing:Yg()-r})}catch(i){n(i)}}),u7||(u7=setTimeout(VK,0))}),tAe=4,nAe=2e3,tF={};let rAe=0;function nF(t,e,n,r,i,s,o,a,l,c){const d="TroikaTextSDFGenerator_JS_"+rAe++%tAe;let h=tF[d];return h||(h=tF[d]={workerModule:Oy({name:d,workerId:d,dependencies:[BK,Yg],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=Yg(),_=new Uint8Array(g.length*4);for(let w=0;w<g.length;w++)_[w*4+c]=g[w];return PE.webglUtils.renderImageData(o,_,a,l,t,e,1<<3-c),v+=Yg()-b,--h.requests===0&&(h.idleTimer=setTimeout(()=>{ICe(d)},nAe)),{timing:v}})}function iAe(t){t._warm||(PE.webgl.isSupported(t),t._warm=!0)}const sAe=PE.webglUtils.resizeWebGLCanvasWithoutClearing,S_={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},oAe=new yn;function Qx(){return(self.performance||Date).now()}const rF=Object.create(null);function GK(t,e){t=cAe({},t);const n=Qx(),r=[];if(t.font&&r.push({label:"user",src:uAe(t.font)}),t.font=r,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||S_.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||S_.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=oAe.set(b).getHex()),g[v]=b}t.colorRanges=g}Object.freeze(t);const{textureWidth:i,sdfExponent:s}=S_,{sdfGlyphSize:o}=t,a=i/o*4;let l=rF[o];if(!l){const g=document.createElement("canvas");g.width=i,g.height=o*256/a,l=rF[o]={glyphCount:0,sdfGlyphSize:o,sdfCanvas:g,sdfTexture:new ro(g,void 0,void 0,void 0,rs,rs),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,aAe(l)}const{sdfTexture:c,sdfCanvas:d}=l;qK(t).then(g=>{const{glyphIds:v,glyphFontIndices:b,fontData:_,glyphPositions:w,fontSize:S,timings:E}=g,A=[],N=new Float32Array(v.length*4);let I=0,P=0;const L=Qx(),R=_.map(B=>{let Z=l.glyphsByFont.get(B.src);return Z||l.glyphsByFont.set(B.src,Z=new Map),Z});v.forEach((B,Z)=>{const G=b[Z],{src:$,unitsPerEm:K}=_[G];let Y=R[G].get(B);if(!Y){const{path:V,pathBounds:ie}=g.glyphData[$][B],ae=Math.max(ie[2]-ie[0],ie[3]-ie[1])/o*(S_.sdfMargin*o+.5),re=l.glyphCount++,ce=[ie[0]-ae,ie[1]-ae,ie[2]+ae,ie[3]+ae];R[G].set(B,Y={path:V,atlasIndex:re,sdfViewBox:ce}),A.push(Y)}const{sdfViewBox:J}=Y,H=w[P++],z=w[P++],X=S/K;N[I++]=H+J[0]*X,N[I++]=z+J[1]*X,N[I++]=H+J[2]*X,N[I++]=z+J[3]*X,v[Z]=Y.atlasIndex}),E.quads=(E.quads||0)+(Qx()-L);const O=Qx();E.sdf={};const F=d.height,U=Math.ceil(l.glyphCount/a),q=Math.pow(2,Math.ceil(Math.log2(U*o)));q>F&&(console.info(`Increasing SDF texture size ${F}->${q}`),sAe(d,i,q),c.dispose()),Promise.all(A.map(B=>WK(B,l,t.gpuAccelerateSDF).then(({timing:Z})=>{E.sdf[B.atlasIndex]=Z}))).then(()=>{A.length&&!l.contextLost&&($K(l),c.needsUpdate=!0),E.sdfTotal=Qx()-O,E.total=Qx()-n,e(Object.freeze({parameters:t,sdfTexture:c,sdfGlyphSize:o,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||iAe(d)})}function WK({path:t,atlasIndex:e,sdfViewBox:n},{sdfGlyphSize:r,sdfCanvas:i,contextLost:s},o){if(s)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:l}=S_,c=Math.max(n[2]-n[0],n[3]-n[1]),d=Math.floor(e/4),h=d%(a/r)*r,g=Math.floor(d/(a/r))*r,v=e%4;return QCe(r,r,t,n,c,l,i,h,g,v,o)}function aAe(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(WK(s,t,!0))})}),Promise.all(r).then(()=>{$K(t),t.sdfTexture.needsUpdate=!0})})}function lAe({font:t,characters:e,sdfGlyphSize:n},r){let i=Array.isArray(e)?e.join(`
`):""+e;GK({font:t,sdfGlyphSize:n,text:i},r)}function cAe(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}let EM;function uAe(t){return EM||(EM=typeof document>"u"?{}:document.createElement("a")),EM.href=t,EM.href}function $K(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 o=n.image.data;(!o||o.length!==r*i*4)&&(o=new Uint8Array(r*i*4),n.image={width:r,height:i,data:o},n.flipY=!1,n.isDataTexture=!0),s.readPixels(0,0,r,i,s.RGBA,s.UNSIGNED_BYTE,o)}}const dAe=Oy({name:"Typesetter",dependencies:[ZCe,KCe,LCe],init(t,e,n){return t(e,n())}}),qK=Oy({name:"Typesetter",dependencies:[dAe],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}});qK.onMainThread;const iF={};function fAe(t){let e=iF[t];return e||(e=iF[t]=new wp(1,1,t,t).translate(.5,.5,0)),e}const hAe="aTroikaGlyphBounds",sF="aTroikaGlyphIndex",pAe="aTroikaGlyphColor";class mAe 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 Wo,this.boundingBox=new Ao}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let n=fAe(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(hAe,e,4),this.updateAttributeData(sF,n,1),this.updateAttributeData(pAe,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:o,max:a,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:o(l(v)*g,l(b)*g),w=s((v-d)/h)!==s((b-d)/h)?g:a(l(v)*g,l(b)*g),S=s((v+i)/h)!==s((b+i)/h)?g*2:a(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 gAe=`
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;
`,vAe=`
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);
`,xAe=`
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;
}
`,yAe=`
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 bAe(t){const e=c7(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new jt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new di(0,0,0,0)},uTroikaClipRect:{value:new di(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new jt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new yn},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new _r},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:gAe,vertexTransform:vAe,fragmentDefs:xAe,fragmentColorTransform:yAe,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(HK,`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 j9=new Sp({color:16777215,side:Yc,transparent:!0}),oF=8421504,aF=new rr,CM=new ze,U6=new ze,c_=[],_Ae=new ze,B6="+x+y";function lF(t){return Array.isArray(t)?t[0]:t}let XK=()=>{const t=new Us(new wp(1,1),j9);return XK=()=>t,t},YK=()=>{const t=new Us(new wp(1,1,32,1),j9);return YK=()=>t,t};const SAe={type:"syncstart"},wAe={type:"synccomplete"},KK=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],MAe=KK.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let ZK=class extends Us{constructor(){const e=new mAe;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=oF,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(SAe),GK({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(wAe),e&&e()})))}onBeforeRender(e,n,r,i,s,o){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s)}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}createDerivedMaterial(e){return bAe(e)}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=j9.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:a,blockBounds:l}=i;r.uTroikaSDFTexture.value=a,r.uTroikaSDFTextureSize.value.set(a.image.width,a.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:I,outlineOpacity:P}=this;c=this._parsePercent(E)||0,d=Math.max(0,this._parsePercent(I)||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??oF),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 a=e.hasOwnProperty("color")?e.color:e.color=new yn;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||B6;if(o!==e._orientation){let a=r.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let l=o!==B6&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,d,h,g]=l;CM.set(0,0,0)[d]=c==="-"?1:-1,U6.set(0,0,0)[g]=h==="-"?-1:1,aF.lookAt(_Ae,CM.cross(U6),U6),a.setFromMatrix4(aF)}else a.identity();e._orientation=o}}_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 jt){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 jt){return CM.copy(e),this.localPositionToTextCoords(this.worldToLocal(CM),n)}raycast(e,n){const{textRenderInfo:r,curveRadius:i}=this;if(r){const s=r.blockBounds,o=i?YK():XK(),a=o.geometry,{position:l,uv:c}=a.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)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,c_.length=0,o.raycast(e,c_);for(let d=0;d<c_.length;d++)c_[d].object=this,n.push(c_[d])}}copy(e){const n=this.geometry;return super.copy(e),this.geometry=n,MAe.forEach(r=>{this[r]=e[r]}),this}clone(){return new this.constructor().copy(this)}};KK.forEach(t=>{const e="_private_"+t;Object.defineProperty(ZK.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});new Ao;new yn;const mo=T.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:r,fontSize:i=1,children:s,characters:o,onSync:a,...l},c)=>{const d=qc(({invalidate:b})=>b),[h]=T.useState(()=>new ZK),[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 oEe(()=>new Promise(b=>lAe({font:r,characters:o},b)),["troika-text",r,o]),T.useLayoutEffect(()=>void h.sync(()=>{d(),a&&a(h)})),T.useEffect(()=>()=>h.dispose(),[h]),T.createElement("primitive",ch({object:h,ref:c,font:r,text:v,anchorX:e,anchorY:n,fontSize:i,sdfGlyphSize:t},l),g)}),im=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],[]),o=T.useRef(null),a=T.useRef(null);return T.useLayoutEffect(()=>{const l=i.current.parent,c=e??(l==null?void 0:l.geometry);if(!c||o.current===c&&a.current===t)return;o.current=c,a.current=t;const h=new c9(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(NCe,ch({segments:!0,points:s,ref:i,raycast:()=>null},n))}),TAe=T.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},d)=>{const h=qc(P=>P.invalidate),g=qc(P=>P.camera),v=qc(P=>P.gl),b=qc(P=>P.events),_=qc(P=>P.setEvents),w=qc(P=>P.set),S=qc(P=>P.get),E=qc(P=>P.performance),A=e||g,N=r||b.connected||v.domElement,I=T.useMemo(()=>new TCe(A),[A]);return RE(()=>{I.enabled&&I.update()},-1),T.useEffect(()=>(s&&I.connect(s===!0?N:s),I.connect(N),()=>void I.dispose()),[s,N,n,I,h]),T.useEffect(()=>{const P=O=>{h(),n&&E.regress(),o&&o(O)},L=O=>{a&&a(O)},R=O=>{l&&l(O)};return I.addEventListener("change",P),I.addEventListener("start",L),I.addEventListener("end",R),()=>{I.removeEventListener("start",L),I.removeEventListener("end",R),I.removeEventListener("change",P)}},[o,a,l,I,h,_]),T.useEffect(()=>{if(t){const P=S().controls;return w({controls:I}),()=>w({controls:P})}},[t,I]),T.createElement("primitive",ch({ref:d,object:I,enableDamping:i},c))}),Of=1e-5;function EAe(t,e,n){const r=new G0,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 Gu=T.forwardRef(function({args:[e=1,n=1,r=1]=[],radius:i=.05,steps:s=1,smoothness:o=4,bevelSegments:a=4,creaseAngle:l=.4,children:c,...d},h){return T.createElement("mesh",ch({ref:h},d),T.createElement(CAe,{args:[e,n,r],radius:i,steps:s,smoothness:o,bevelSegments:a,creaseAngle:l}),c)}),CAe=T.forwardRef(function({args:[e=1,n=1,r=1]=[],radius:i=.05,steps:s=1,smoothness:o=4,bevelSegments:a=4,creaseAngle:l=.4,...c},d){const h=T.useMemo(()=>EAe(e,n,i),[e,n,i]),g=T.useMemo(()=>({depth:r-i*2,bevelEnabled:!0,bevelSegments:a*2,steps:s,bevelSize:i-Of,bevelThickness:i,curveSegments:o}),[r,i,o,a,s]),v=T.useRef(null);return T.useLayoutEffect(()=>{v.current&&(v.current.center(),vCe(v.current,l))},[h,g,l]),T.useImperativeHandle(d,()=>v.current),T.createElement("extrudeGeometry",ch({ref:v,args:[h,g]},c))});function vi(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function Ar(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 va(t){return typeof t=="string"?t:""}function H6(t){return!!t}function F9(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 vi(e)}function QK(t){if(!t)return null;const e=F9(t.setup);if(!e)return null;const n=va(e.model),r=va(e.schema_version),i=vi(e.cluster);if(!i)return null;const s=Array.isArray(i.nodes)?i.nodes:[],o=vi(e.trainer),a=vi(e.inference),l=new Map,c=Array.isArray(o==null?void 0:o.nodes)?o.nodes:[];for(const g of c){const v=vi(g);if(!v)continue;const b=Ar(v.node_id);if(b===null)continue;const _=Array.isArray(v.gpus)?v.gpus:[];for(const w of _){const S=vi(w);if(!S)continue;const E=Ar(S.gpu_index);E!==null&&l.set(`${b}-${E}`,{role:"trainer",gpu_index:E,rank:Ar(S.rank)??void 0,dp_rank:Ar(S.dp_rank)??void 0,tp_rank:Ar(S.tp_rank)??void 0,pp_rank:Ar(S.pp_rank)??void 0})}}const d=Array.isArray(a==null?void 0:a.nodes)?a.nodes:[];for(const g of d){const v=vi(g);if(!v)continue;const b=Ar(v.node_id);if(b===null)continue;const _=Array.isArray(v.gpus)?v.gpus:[];for(const w of _){const S=vi(w);if(!S)continue;const E=Ar(S.gpu_index);E!==null&&l.set(`${b}-${E}`,{role:"inference",gpu_index:E,server_idx:Ar(S.server_idx)??void 0,tp_group_id:Ar(S.tp_group_id)??void 0,port:Ar(S.port)??void 0,url:va(S.url)||void 0})}}const h=[];for(const g of s){const v=vi(g);if(!v)continue;const b=Ar(v.node_id)??0,_=vi(v.hardware),w=vi(_==null?void 0:_.cpu),S={model:va(w==null?void 0:w.model),cores:Ar(w==null?void 0:w.cores)??0,logical_cores:Ar(w==null?void 0:w.logical_cores)??0,sockets:Ar(w==null?void 0:w.sockets)??1,architecture:va(w==null?void 0:w.architecture),frequency_mhz:Ar(w==null?void 0:w.frequency_mhz)??0},E=vi(_==null?void 0:_.memory),A={total_gb:Ar(E==null?void 0:E.total_gb)??0},N=vi(_==null?void 0:_.gpu),P=(Array.isArray(N==null?void 0:N.devices)?N.devices:[]).map((B,Z)=>{const G=vi(B),$=Z,K=`${b}-${$}`,Y=l.get(K)??{role:"unassigned",gpu_index:$};return{hardware:{name:va(G==null?void 0:G.name),memory_total_gb:Ar(G==null?void 0:G.memory_total_gb)??0,pcie_gen:Ar(G==null?void 0:G.pcie_gen)??0,pcie_width:Ar(G==null?void 0:G.pcie_width)??0,serial:va(G==null?void 0:G.serial),uuid:va(G==null?void 0:G.uuid)},role:Y,local_index:$}}),L=vi(N==null?void 0:N.interconnect),R=L?{nvlink:H6(L.nvlink),topology:va(L.topology),links_per_gpu:Ar(L.links_per_gpu)??0,speed_gbps:Ar(L.speed_gbps)??0,connections:Ar(L.connections)??0}:null,O=vi(v.software),F=vi(O==null?void 0:O.os),U=vi(O==null?void 0:O.container),q=vi(O==null?void 0:O.packages);h.push({node_id:b,hostname:va(v.hostname),ip:va(v.ip),is_driver:H6(v.is_driver),cpu:S,memory:A,gpus:P,interconnect:R,os:va(F==null?void 0:F.platform),container:U?{runtime:va(U.runtime),is_container:H6(U.is_container)}:null,software:{cuda:va(q==null?void 0:q.cuda),pytorch:va(q==null?void 0:q.pytorch),python:va(q==null?void 0:q.python)}})}return{model:n,schema_version:r,nodes:h,total_gpus:Ar(i.total_gpus)??0,trainer_total_gpus:Ar(o==null?void 0:o.total_gpus)??0,inference_total_gpus:Ar(a==null?void 0:a.total_gpus)??0,trainer_config:o?{data_parallel_size:Ar(o.data_parallel_size)??0,megatron_tensor_parallel_size:Ar(o.megatron_tensor_parallel_size)??0,megatron_pipeline_parallel_size:Ar(o.megatron_pipeline_parallel_size)??0,backend:va(o.backend),world_size:Ar(o.world_size)??0}:null,inference_config:a?{num_servers:Ar(a.num_servers)??0,tensor_parallel_size:Ar(a.tensor_parallel_size)??0,placement_strategy:va(a.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 AAe(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 NAe({position:t,gpu:e,nodeId:n,onHover:r,onUnhover:i,onClick:s,isHovered:o}){const a=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}=AAe(e.hardware.name),h=.095;return p.jsxs("group",{position:t,children:[p.jsxs(Gu,{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:o?wn.gpuBodyHover:wn.gpuBody}),p.jsx(im,{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:a,side:Yc})]}),p.jsx(mo,{position:[-.285,h,-.2],rotation:[-Math.PI/2,0,0],fontSize:.04,color:wn.textBlack,anchorX:"left",anchorY:"middle",children:l})]}),p.jsx(mo,{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(mo,{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(mo,{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(mo,{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(mo,{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}`}),o&&p.jsx(O9,{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:a},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 RAe({position:t,memoryGb:e,isHovered:n,onHover:r,onUnhover:i}){return p.jsxs("group",{position:t,children:[p.jsxs(Gu,{args:[.85,.12,.35],radius:0,smoothness:4,onPointerOver:o=>{o.stopPropagation(),r()},onPointerOut:i,children:[p.jsx("meshBasicMaterial",{color:n?wn.moduleBodyHover:wn.moduleBody}),p.jsx(im,{color:wn.platformBorder,threshold:1,scale:1.002})]}),p.jsx(mo,{position:[0,.063,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:"VRAM"}),p.jsx(mo,{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 kAe(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 PAe({position:t,cpu:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const o=kAe(e.model);return p.jsxs("group",{position:t,children:[p.jsxs(Gu,{args:[.6,.08,.6],radius:0,smoothness:4,onPointerOver:a=>{a.stopPropagation(),r()},onPointerOut:i,onClick:a=>{a.stopPropagation(),s()},children:[p.jsx("meshBasicMaterial",{color:n?wn.gpuBodyHover:wn.chip}),p.jsx(im,{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(im,{color:wn.platformBorder,threshold:1,scale:1.002})]}),p.jsx(mo,{position:[0,.05,-.12],rotation:[-Math.PI/2,0,0],fontSize:.032,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:o}),p.jsx(mo,{position:[0,.05,0],rotation:[-Math.PI/2,0,0],fontSize:.045,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:"CPU"}),p.jsx(mo,{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(O9,{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 DAe({position:t,memory:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){return p.jsxs("group",{position:t,children:[p.jsxs(Gu,{args:[.6,.12,.35],radius:0,smoothness:4,onPointerOver:a=>{a.stopPropagation(),r()},onPointerOut:i,onClick:a=>{a.stopPropagation(),s()},children:[p.jsx("meshBasicMaterial",{color:n?wn.moduleBodyHover:wn.moduleBody}),p.jsx(im,{color:wn.platformBorder,threshold:1,scale:1.002})]}),p.jsx(mo,{position:[0,.063,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:wn.textBlack,anchorX:"center",anchorY:"middle",children:"RAM"}),p.jsx(mo,{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(O9,{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 IAe({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],o=(i+s)/2,a=s-i,c=t[0][2]-e/2-.18,d=.065;return p.jsxs("group",{children:[p.jsx(Gu,{args:[a,.02,.035],radius:.002,smoothness:4,position:[o,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(Gu,{args:[.02,.02,b],radius:.001,smoothness:2,position:[h[0],d,_],children:p.jsx("meshBasicMaterial",{color:wn.nvlink})})},g)}),p.jsx(mo,{position:[o,.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 OAe({node:t,position:e,hoveredItem:n,setHoveredItem:r,setSelectedItem:i}){const s=t.gpus.length,o=1.15,a=s*o,l=Math.max(a+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,I)=>[I*o-(a-o)/2,.14,b]),A=t.gpus.map((N,I)=>[I*o-(a-o)/2,.11,_]);return p.jsxs("group",{position:e,children:[p.jsxs(Gu,{args:[l,.06,c],radius:0,smoothness:4,children:[p.jsx("meshBasicMaterial",{color:wn.platform}),p.jsx(im,{color:wn.platformBorder,threshold:1,scale:1.002})]}),p.jsxs(mo,{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(mo,{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,I)=>{const P=E[I],L=[e[0]+P[0],e[1]+P[1],e[2]+P[2]];return p.jsxs("group",{children:[p.jsx(NAe,{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(RAe,{position:A[I],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)})]},I)}),p.jsx(IAe,{vramPositions:A,vramDepth:h,interconnect:t.interconnect}),(()=>{const N=[0,.09,S],I=[.75,.11,S],P=[e[0]+N[0],e[1]+N[1],e[2]+N[2]],L=[e[0]+I[0],e[1]+I[1],e[2]+I[2]];return p.jsxs(p.Fragment,{children:[p.jsx(PAe,{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(DAe,{position:I,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 $,K;const N=(($=t.gpus[0])==null?void 0:$.hardware.pcie_gen)??0,I=((K=t.gpus[0])==null?void 0:K.hardware.pcie_width)??0;if(N===0||s<1)return null;const P=[...E].sort((Y,J)=>Y[0]-J[0]),L=P[0][0],R=P[P.length-1][0],O=(L+R)/2,F=R-L,U=.065,q=w,B=S-g/2,Z=Math.abs(B-q),G=(q+B)/2;return p.jsxs("group",{children:[p.jsx(Gu,{args:[F,.02,.035],radius:.002,smoothness:4,position:[O,U,w],children:p.jsx("meshBasicMaterial",{color:wn.chipBorder})}),E.map((Y,J)=>{const H=b+d/2,z=Math.abs(w-H),X=(H+w)/2;return p.jsx("group",{children:p.jsx(Gu,{args:[.02,.02,z],radius:.001,smoothness:2,position:[Y[0],U,X],children:p.jsx("meshBasicMaterial",{color:wn.chipBorder})})},J)}),p.jsx(Gu,{args:[.02,.02,Z],radius:.001,smoothness:2,position:[0,U,G],children:p.jsx("meshBasicMaterial",{color:wn.chipBorder})}),p.jsx(mo,{position:[.15,.035,G],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${I}`})]})})(),(()=>{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(mo,{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 JK(){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 LAe({node:t,position:e,onClick:n}){const[r,i]=T.useState(!1),s=T.useRef(null);T.useEffect(()=>()=>{document.body.style.cursor="auto"},[]);const o=t.gpus.filter(b=>b.role.role==="trainer").length,a=t.gpus.filter(b=>b.role.role==="inference").length,l=t.gpus.length,c=(()=>{const b=[`${l} GPUs`],_=[];return o>0&&_.push(`${o}T`),a>0&&_.push(`${a}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(Gu,{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(im,{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(mo,{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(mo,{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(mo,{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(mo,{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 zAe({topology:t,onSelectNode:e}){const i=T.useMemo(()=>{const o=[],a=Math.ceil(Math.sqrt(t.nodes.length)),l=3.2,c=2.2;return t.nodes.forEach((d,h)=>{const g=Math.floor(h/a),v=h%a,_=-(Math.min(a,t.nodes.length-g*a)-1)*l/2;o.push([v*l+_,.3,g*c])}),o},[t.nodes]),s=T.useMemo(()=>{if(i.length===0)return{w:4,d:3,cx:0,cz:0};let o=1/0,a=-1/0,l=1/0,c=-1/0;for(const[h,,g]of i)o=Math.min(o,h-2.5/2),a=Math.max(a,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:a-o+d*2,d:c-l+d*2,cx:(o+a)/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(JK,{}),p.jsx("gridHelper",{args:[50,50,wn.gridColor,wn.gridColor],position:[0,-.04,0]}),p.jsxs(Gu,{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(im,{color:wn.platformBorder,threshold:1,scale:1.002})]}),t.nodes.map((o,a)=>p.jsx(LAe,{node:o,position:i[a],onClick:()=>e(o.node_id)},o.node_id))]})}function jAe({focusTarget:t,overviewPosition:e,overviewLookAt:n}){const{camera:r}=qc(),i=qc(g=>g.controls),s=T.useRef(new ze(...e)),o=T.useRef(new ze(...n)),a=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(),a.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),o.current.set(g,v,b),a.current=!0}else a.current=!1},[h]),RE(()=>{if(!i||!a.current)return;const g=.06;r.position.lerp(s.current,g);const v=i;v.target.lerp(o.current,g),i.update();const b=r.position.distanceTo(s.current),_=v.target.distanceTo(o.current);b<.01&&_<.01&&(r.position.copy(s.current),v.target.copy(o.current),i.update(),a.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 FAe({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 UAe({topology:t,hoveredItem:e,setHoveredItem:n,setSelectedItem:r,focusedItem:i}){const s=T.useMemo(()=>{const o=[],a=Math.ceil(Math.sqrt(t.nodes.length)),l=6.5,c=3.5;return t.nodes.forEach((d,h)=>{const g=Math.floor(h/a),v=h%a,_=-(Math.min(a,t.nodes.length-g*a)-1)*l/2;o.push([v*l+_,0,g*c])}),o},[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(JK,{}),p.jsx("gridHelper",{args:[50,50,wn.gridColor,wn.gridColor],position:[0,-.04,0]}),t.nodes.map((o,a)=>p.jsx(OAe,{node:o,position:s[a],hoveredItem:i?null:e,setHoveredItem:i?()=>{}:n,setSelectedItem:i?()=>{}:r},o.node_id))]})}function eZ({topology:t}){const[e,n]=T.useState(null),[r,i]=T.useState(null),[s,o]=T.useState(null),a=t.nodes.length>1,l=a&&s===null,c=T.useMemo(()=>{if(!a||s===null)return t;const S=t.nodes.find(E=>E.node_id===s);return S?{...t,nodes:[S]}:t},[t,s,a]),d=T.useMemo(()=>{const S=l?t:c,E=S.nodes.length,A=Math.max(...S.nodes.map(I=>I.gpus.length),1);if(l){const I=Math.max(4,E*1.5);return[I*.6,I*.9,I*.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(()=>{o(null),i(null),n(null)},[]),_=T.useCallback(S=>{o(S),i(null),n(null)},[]),w=r!==null;return p.jsxs("div",{className:"relative w-full h-full bg-white",children:[p.jsxs(aCe,{camera:{position:d,fov:45,near:.1,far:100},gl:{antialias:!0,alpha:!1},onCreated:({gl:S})=>{S.setClearColor(wn.background),S.toneMapping=ru},children:[l?p.jsx(zAe,{topology:t,onSelectNode:_}):p.jsx(UAe,{topology:c,hoveredItem:e,setHoveredItem:n,setSelectedItem:g,focusedItem:r}),p.jsx(jAe,{focusTarget:!l&&r?{position:r.worldPosition}:null,overviewPosition:d,overviewLookAt:h}),p.jsx(TAe,{makeDefault:!0,enablePan:!0,enableZoom:!0,enableRotate:!0,minDistance:1,maxDistance:30,maxPolarAngle:Math.PI/2-.05,onStart:()=>{r&&v()}})]}),a&&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(FAe,{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 tZ(t){if(t&&typeof t=="object"&&"value"in t)return tZ(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 BAe=[1,5,10,30,60,120,300],V6=gT,cF=gT,HAe=["torch_allocated_gb"],VAe="__timeline_noop_metric__";function DE(t){return F9(t==null?void 0:t.setup)}function GAe(t){const e=DE(t),n={},r=vi(e==null?void 0:e.trainer),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=vi(s);if(!o)continue;const a=Ar(o.node_id),l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const d=vi(c);if(!d)continue;const h=Ar(d.rank);h!==null&&(n[h]={node_id:a,local_rank:Ar(d.local_rank)})}}return n}function WAe(t){const e=DE(t),n=vi(e==null?void 0:e.inference);return Ar(n==null?void 0:n.num_servers)??void 0}function $Ae(t){const e=DE(t),n={},r=vi(e==null?void 0:e.inference),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=vi(s);if(!o)continue;const a=Ar(o.node_id),l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const d=vi(c);if(!d)continue;const h=Ar(d.server_idx);h!==null&&(h in n||(n[h]=a))}}return n}function uF(t){const e=DE(t),n=vi(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 qAe(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),o=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10),l=s*3600+o*60+a;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function XAe({value:t,onChange:e}){const[n,r]=T.useState(!1),[i,s]=T.useState(""),o=T.useRef(null),a=c=>{c&&(s(V6(t)),setTimeout(()=>{var d;return(d=o.current)==null?void 0:d.select()},0)),r(c)},l=()=>{const c=qAe(i);c!==null&&(e(c),r(!1))};return p.jsxs(oT,{open:n,onOpenChange:a,children:[p.jsx(aT,{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(Wr,{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:o,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:BAe.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 YAe(){var G,$,K,Y;const t=Pi(ml),[e,n]=un(Fce),[r,i]=un(Uce),s=!0,{data:o,isFetching:a,isPlaceholderData:l,error:c}=_ue(t||"",e,r,!!t),{data:d}=td(t||"",!!t,s),h=T.useMemo(()=>{var H;const J=(H=d==null?void 0:d.config)==null?void 0:H.trainer_devices;return tZ(J)},[(G=d==null?void 0:d.config)==null?void 0:G.trainer_devices]),g=(o==null?void 0:o.interval_start)??null,v=(o==null?void 0:o.interval_end)??null,b=a&&(l||!o),[_,w]=T.useState(()=>[...HAe]),S=T.useMemo(()=>{const J=Array.from(new Set(_.filter(H=>typeof H=="string"&&H.trim().length>0))).sort((H,z)=>H.localeCompare(z));return J.length>0?J:[VAe]},[_]),E=T.useMemo(()=>GAe(d==null?void 0:d.summary),[d==null?void 0:d.summary]),A=T.useMemo(()=>{const J={},H=(o==null?void 0:o.trainer_events)??[];for(const z of H){const X=z.rank;if(!Number.isFinite(X))continue;const V=J[X]??{node_id:null,local_rank:null},ie=V.node_id!==null?V.node_id:typeof z.node_id=="number"&&Number.isFinite(z.node_id)?z.node_id:null,ae=V.local_rank!==null?V.local_rank:typeof z.local_rank=="number"&&Number.isFinite(z.local_rank)?z.local_rank:null;J[X]={node_id:ie,local_rank:ae}}return J},[o==null?void 0:o.trainer_events]),N=T.useMemo(()=>{const J={};return new Set([...Object.keys(E).map(Number),...Object.keys(A).map(Number)]).forEach(z=>{const X=E[z],V=A[z];J[z]={node_id:(X==null?void 0:X.node_id)??(V==null?void 0:V.node_id)??null,local_rank:(X==null?void 0:X.local_rank)??(V==null?void 0:V.local_rank)??null}}),J},[E,A]),I=T.useMemo(()=>$Ae(d==null?void 0:d.summary),[d==null?void 0:d.summary]),P=T.useMemo(()=>{const J={},H=(o==null?void 0:o.inference_events)??[];for(const z of H){const X=z.server;Number.isFinite(X)&&J[X]===void 0&&typeof z.node_id=="number"&&Number.isFinite(z.node_id)&&(J[X]=z.node_id)}return J},[o==null?void 0:o.inference_events]),L=T.useMemo(()=>{const J={};return new Set([...Object.keys(I).map(Number),...Object.keys(P).map(Number)]).forEach(z=>{J[z]=I[z]??P[z]??null}),J},[I,P]),R=T.useMemo(()=>{const J=((o==null?void 0:o.trainer_events)??[]).map(z=>z.rank).filter(z=>Number.isFinite(z)),H=Object.keys(N).map(Number);return Array.from(new Set([...J,...H])).sort((z,X)=>z-X)},[o==null?void 0:o.trainer_events,N]),O=T.useMemo(()=>R.map(J=>{var H,z;return{rank:J,node_id:((H=N[J])==null?void 0:H.node_id)??null,local_rank:((z=N[J])==null?void 0:z.local_rank)??null}}),[R,N]),F=T.useMemo(()=>{const J=[];let H=!1;return R.forEach(z=>{var V;const X=(V=N[z])==null?void 0:V.local_rank;X!=null&&(J[z]=X,H=!0)}),H?J:h},[N,R,h]),U=Mue(t||"",S,O,g,v,!!t&&g!==null&&v!==null&&O.length>0),q=T.useMemo(()=>{const J={};return O.forEach((H,z)=>{var V;const X=(V=U[z])==null?void 0:V.data;J[H.rank]=(X==null?void 0:X.metrics)??[]}),J},[O,U]),B=T.useMemo(()=>{const J=[];U.forEach(X=>{const V=X.data;V!=null&&V.available_metrics&&V.available_metrics.forEach(ie=>{typeof ie=="string"&&J.push(ie)})});const H=Array.from(new Set(J));if(H.length>0)return H;const z=new Set;return U.forEach(X=>{var ie;const V=X.data;(ie=V==null?void 0:V.metrics)==null||ie.forEach(ae=>{typeof ae.metric_name=="string"&&z.add(ae.metric_name)})}),Array.from(z).sort((X,V)=>X.localeCompare(V))},[U]),Z=U.some(J=>J.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(Fk,{currentPage:e,totalPages:(o==null?void 0:o.total_pages)??1,onPageChange:n}),p.jsx(XAe,{value:r,onChange:J=>{const H=Math.floor(e*r/J);i(J),n(H)}}),g!==null&&v!==null&&(o==null?void 0:o.global_min_time)!=null&&p.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[cF(g-o.global_min_time)," – ",cF(v-o.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(th,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error: ",c instanceof Error?c.message:"Unknown error"]})})}),p.jsx(Hbe,{orchestratorData:o==null?void 0:o.orchestrator_events,trainerData:o==null?void 0:o.trainer_events,inferenceData:o==null?void 0:o.inference_events,isLoading:b,intervalStart:(o==null?void 0:o.interval_start)??0,intervalEnd:(o==null?void 0:o.interval_end)??r,trainerGpuMetricsByRank:q,trainerGpuMetricsIsLoading:Z,trainerAvailableGpuMetrics:B,selectedTrainerGpuMetrics:_,onSelectedTrainerGpuMetricsChange:w,trainerSystemGpuIndices:F,trainerRankInfoByRank:N,totalSetupNodes:uF(d==null?void 0:d.summary),inferenceServerNodeMap:L,numInferenceServers:WAe(d==null?void 0:d.summary)??(($=d==null?void 0:d.config)==null?void 0:$.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(KAe,{runPath:t,trainerEvents:o==null?void 0:o.trainer_events,totalSetupNodes:uF(d==null?void 0:d.summary)})]}):p.jsx(hm,{description:"Select a run from the sidebar to view the timeline."})}function KAe({runPath:t,trainerEvents:e,totalSetupNodes:n}){const[r,i]=un(EG),[s,o]=un(TG),[a,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}=Sue(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 ae of v.events)ae.sample_id!==void 0&&(ie[ae.sample_id]||(ie[ae.sample_id]=[]),ie[ae.sample_id].push(ae));return ie},[r,v]),_=T.useMemo(()=>{if(!v)return null;const ie=v.environment_response_times??[],ae=v.compute_reward_times??[],re={};for(const oe of ie)re[oe.sample_idx]||(re[oe.sample_idx]=[]),re[oe.sample_idx].push({turn_order:oe.turn_order,time:oe.time});for(const oe of Object.values(re))oe.sort((fe,me)=>fe.turn_order-me.turn_order);const ce={};for(const oe of ae)ce[oe.sample_idx]=oe.time;return{envBySample:re,rewardBySample:ce}},[v]),w=T.useMemo(()=>{if(!b)return null;let ie=1/0,ae=-1/0;for(const[re,ce]of Object.entries(b)){for(const oe of ce){ie=Math.min(ie,oe.start_time),ae=Math.max(ae,oe.end_time);let fe=oe.end_time;oe.environment_response_time&&oe.environment_response_time>0&&(fe+=oe.environment_response_time),oe.compute_reward_time&&oe.compute_reward_time>0&&(fe+=oe.compute_reward_time),ae=Math.max(ae,fe)}if(_){const oe=Number(re),fe=[...ce].sort((Ge,_e)=>Ge.start_time-_e.start_time),me=_.envBySample[oe]??[];let ye=-1/0;for(let Ge=0;Ge<fe.length;Ge++)ye=fe[Ge].end_time,Ge<me.length&&me[Ge].time>0&&(ye+=me[Ge].time);const Ee=_.rewardBySample[oe]??0;Ee>0&&(ye+=Ee),ae=Math.max(ae,ye)}}return ie===1/0?null:{start:ie,end:ae,duration:ae-ie}},[b,_]),{data:S}=wue(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 ae of E)ie[ae.rank]||(ie[ae.rank]=[]),ie[ae.rank].push(ae);return ie},[E]),N=T.useMemo(()=>s?(A[s.rank]||[]).find(ae=>ae.event_type===s.eventType&&ae.step===s.step&&ae.rank===s.rank&&!ae.event_type.includes("/"))??null:null,[s,A]),I=T.useMemo(()=>s?(A[s.rank]||[]).filter(ae=>ae.event_type.startsWith(s.eventType+"/")&&ae.step===s.step):[],[s,A]),P=Pi(dT),L=Pi(MG),R=T.useMemo(()=>!r||!b?[]:Object.keys(b).map(Number).map(ie=>({group_id:r.groupId,sample_idx:ie})),[r,b]),{data:O}=M8(t??"",R,!!t&&R.length>0&&P),F=!P||R.length===0||!!O,U=T.useMemo(()=>!P||!(O!=null&&O.statuses)?!1:O.statuses.some(ie=>ie.kind==="rollouts_discarded"),[P,O]),q=T.useMemo(()=>b?Object.values(b).some(ie=>ie.some(ae=>ae.is_canceled)):!1,[b]),{data:B}=OG(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(()=>!B||B.kind!=="rollouts_discarded"?null:B.discard_reason,[B]),G=T.useMemo(()=>{if(!B||B.kind===null)return null;const ie=B.samples_data;if(!ie||ie.length===0)return null;const ae=ie.map(re=>re.reward).filter(re=>re!==null);return ae.length===0?null:ae.every(re=>re===0)?"all_zero":ae.every(re=>re>0)?"all_positive":null},[B]),$=ie=>{switch(ie){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return ie.split("_").map(ae=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(" ")}},K=!!r,Y=!!s&&I.length>0&&!!N,J=a==="inference"&&!K&&Y?"trainer":a==="trainer"&&!Y&&K?"inference":a;if(!K&&!Y)return null;const H=()=>{J==="inference"?(i(null),Y&&l("trainer")):(o(null),K&&l("inference"))},z=N?IG(N.event_type,N.step,N.microbatch,N.minibatch):null,X=N?f2(N.event_type):void 0,V=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:[V&&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 ${J==="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 ${J==="trainer"?"bg-white text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Trainer"})]}),J==="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:q?"#adadad":U?"#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${F?"":" animate-pulse bg-muted"}`,style:F?{backgroundColor:q?"#c9c9c9":U?"#a1a1a1":r.isEval?"#10b981":"#0369a1"}:void 0}),p.jsxs("span",{className:"text-xs font-medium",children:["Group ",r.groupId]})]}),q&&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:$(Z)}),Z==="zero_advantage"&&G==="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"&&G==="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"})]}),J==="trainer"&&z&&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:[z.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:H,className:"ml-auto text-muted-foreground hover:text-foreground transition-colors p-1 rounded hover:bg-muted",children:p.jsx(ed,{className:"w-4 h-4"})})]}),p.jsxs("div",{className:"overflow-auto flex-1 min-h-0",children:[J==="inference"&&r&&b&&w&&p.jsx(r_e,{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}),J==="trainer"&&N&&I.length>0&&p.jsx(h_e,{parentEvent:N,childEvents:I})]})]})}function U9(t,e){const n=typeof IntersectionObserver>"u",[r,i]=T.useState(n),[s,o]=T.useState(n),a=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?(a.current&&(clearTimeout(a.current),a.current=null),o(!0)):(a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{o(!1),a.current=null},2e3))},{root:l,rootMargin:c,threshold:d});return g.observe(h),()=>{g.disconnect(),a.current&&clearTimeout(a.current)}},[t,l,c,d]),r||s}const AM={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"}]}},ZAe={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"}},QAe={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",a1="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 _0(t,e,n){for(const r of n.metrics){const i="simple"in r&&r.simple,s="group"in r?r.group:void 0,o="showZeroLine"in n?n.showZeroLine:!1,a="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:o,unit:a});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:o,unit:a})}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:o,unit:a,isHistogram:!0,histogramMetricType:dF(r.prefix)});const c=`${r.prefix}_${a1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:c,label:`${r.label} - Distribution Over Time`,prefix:r.prefix,suffix:a1,showZeroLine:o,unit:a,isDistributionOverTime:!0,histogramMetricType:dF(r.prefix)})}}function JAe(t,e={},n=[]){const r=[];for(const[i,s]of Object.entries(e))for(const[o,a]of Object.entries(s)){const l=o?`custom_${i}_${o}`:`custom_${i}`;_0(r,l,{label:t1(i),metrics:a.map(c=>({prefix:c,label:t1(c),simple:!0,group:o?t1(o):void 0}))})}_0(r,"rewards",AM.rewards),t.length>0&&_0(r,"rollout_metrics",{label:"Samples Metrics",metrics:t.flatMap(i=>[{prefix:`reward_${i}`,label:t1(i)},{prefix:`reward_${i}_gini_mean`,label:`${t1(i)} Sparsity (Gini)`,simple:!0}])}),_0(r,"advantage",AM.advantage),r.push(...e6e(n)),_0(r,"tokens",AM.tokens),_0(r,"rollouts_general",AM.rollouts_general);for(const[i,s]of Object.entries(ZAe))_0(r,i,s);for(const[i,s]of Object.entries(QAe))_0(r,i,s);return r}function e6e(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 o=t1(s),a=`${r} / ${o}`,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:a,metricKey:`${l}_${d}`,label:`${r} ${o} - ${h}`,prefix:l,suffix:d,isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${o1}`,label:`${r} ${o} - Histogram`,prefix:l,suffix:o1,isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${a1}`,label:`${r} ${o} - Distribution Over Time`,prefix:l,suffix:a1,isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}for(const s of["length_completion","length_prompt","length_sum"]){const o=s==="length_completion"?"Tokens Completion":s==="length_prompt"?"Tokens Prompt":"Tokens Total",a=`${r} / ${o}`,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:a,metricKey:`${l}_${d}`,label:`${r} ${o} - ${h}`,prefix:l,suffix:d,unit:"tokens",isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${o1}`,label:`${r} ${o} - Histogram`,prefix:l,suffix:o1,unit:"tokens",isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${a1}`,label:`${r} ${o} - Distribution Over Time`,prefix:l,suffix:a1,unit:"tokens",isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}}return e}function t1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function t6e(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 n6e(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 B9({openAtom:t=y8}={}){const[e,n]=un(t);return!Pi(ml)||e?null:p.jsx(Tn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Metrics"})}function H9({currentStep:t,maxSelectableStep:e,openAtom:n=y8,selectedMetricsAtom:r=qce,selectedStepAtom:i=uT,includeDiscardedDefaults:s=!1,evalConfig:o}){var fe,me;const[a,l]=un(n),[c,d]=un(r),[h,g]=T.useState(!1),v=h&&(o==null?void 0:o.selectedSampleIdx)!=null,[b,_]=T.useState(!1),[w,S]=T.useState(10),[E,A]=T.useState("10"),N=Pi(ml),I=Pi(cT),P=Pi(fT),L=!0,R=!!o,{data:O}=fm(),{data:F}=td(N||"",!!N,L),U=T.useMemo(()=>(F==null?void 0:F.available_rollout_metric_names)??[],[F==null?void 0:F.available_rollout_metric_names]),q=T.useMemo(()=>{var ye;return((ye=F==null?void 0:F.step_metrics_info)==null?void 0:ye.custom_metric_sections)??{}},[(fe=F==null?void 0:F.step_metrics_info)==null?void 0:fe.custom_metric_sections]),B=T.useMemo(()=>{var ye;return((ye=F==null?void 0:F.eval_info)==null?void 0:ye.evals)??[]},[(me=F==null?void 0:F.eval_info)==null?void 0:me.evals]),Z=T.useRef(!1);T.useEffect(()=>{if(R||Z.current)return;if(c.length>0){Z.current=!0;return}if(!F)return;Z.current=!0;const ye=["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",...U.flatMap(Ee=>[`reward_${Ee}_mean`,`reward_${Ee}_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(ye)},[F,U,R]);const G=T.useRef(new Set);T.useEffect(()=>{if(R||U.length===0)return;const ye=[];for(const Ee of U){if(!G.current.has(Ee)){const Ge=`reward_${Ee}_mean`,_e=`reward_${Ee}_distribution_over_time`;c.includes(Ge)||ye.push(Ge),c.includes(_e)||ye.push(_e)}G.current.add(Ee)}ye.length>0&&d(Ee=>[...Ee,...ye])},[U,R]);const $=T.useRef("");T.useEffect(()=>{if(!R||!o)return;const ye=`${o.prefix}|${o.rewardNames.join(",")}`;if(ye===$.current)return;$.current=ye;const Ee=o.prefix,Ge=[`${Ee}length_completion_mean`,`${Ee}length_completion_std`,`${Ee}length_completion_min`,`${Ee}length_completion_max`,`${Ee}length_completion_distribution_over_time`,...o.rewardNames.flatMap(_e=>[`${Ee}reward_${_e}_mean`,`${Ee}reward_${_e}_distribution_over_time`])];d(Ge)},[o,R,d]);const K=T.useMemo(()=>{const ye=(O==null?void 0:O.runs)||[],Ee=new Set(I);return N&&Ee.add(N),ye.filter(Ge=>Ee.has(Ge.run_id)).map(Ge=>({runPath:Ge.run_id,runName:Ge.name,color:Ge.color,isSelected:Ge.run_id===N}))},[N,I,O==null?void 0:O.runs]),Y=T.useMemo(()=>JAe(U,q,B),[U,q,B]),J=T.useMemo(()=>t6e(Y),[Y]),H=T.useMemo(()=>{const ye=new Set(Y.map(Ee=>Ee.metricKey));return c.filter(Ee=>ye.has(Ee))},[c,Y]),z=T.useMemo(()=>n6e(Y),[Y]),X=T.useMemo(()=>H.map(ye=>{const Ee=Y.find(Ge=>Ge.metricKey===ye);return{id:ye,metricKey:ye,label:(Ee==null?void 0:Ee.label)||ye,plotType:Ee!=null&&Ee.isHistogram?"histogram":Ee!=null&&Ee.isDistributionOverTime?"distribution_over_time":Ee!=null&&Ee.isEvalMetric?"eval_metric":"step_metric"}}),[H,Y]),V=ye=>{ye&&d(Ee=>Ee.includes(ye)?Ee.filter(Ge=>Ge!==ye):[...Ee,ye])},ie=ye=>{d(Ee=>Ee.filter(Ge=>Ge!==ye))},ae=ye=>Y.find(Ee=>Ee.metricKey===ye),[re,ce]=T.useState(null),oe=T.useCallback(ye=>{if(!ye||!a){ce(null);return}const Ee=ye.querySelector('[data-slot="scroll-area-viewport"]');Ee&&ce(Ee)},[a]);return!N||!a?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(nce,{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(Z1,{catalog:z,onSelect:ye=>V(ye.metricKey),existingPlots:X,children:p.jsxs("button",{type:"button",className:Nt("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",H.length>0?"text-foreground":"text-muted-foreground"),children:[p.jsx("span",{className:"font-medium",children:"Charts"}),H.length>0&&p.jsx("span",{className:"text-[10px] bg-accent text-accent-foreground rounded px-1.5 py-0 font-medium",children:H.length}),p.jsx(Wr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 ml-auto"})]})}),p.jsx(cS,{label:"EMA",variant:"selecting",size:"sm",enabled:b,onEnabledChange:_,value:E,onValueChange:A,onValueCommit:ye=>{const Ee=parseInt(ye,10);!isNaN(Ee)&&Ee>=2&&Ee<=100?(S(Ee),A(Ee.toString())):A(w.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"})]})}),p.jsx(bv,{ref:oe,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:(o==null?void 0:o.selectedSampleIdx)==null,children:"Selected"})]}),H.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(J).map(([ye,{label:Ee,metrics:Ge}])=>{const _e=Ge.filter(De=>H.includes(De.metricKey)).map(De=>De.metricKey);return _e.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:Ee}),p.jsx("div",{className:"space-y-4",children:_e.map(De=>{const he=ae(De);if(v&&(he!=null&&he.isHistogram||he!=null&&he.isDistributionOverTime||he!=null&&he.suffix&&he.suffix!=="mean"&&he.suffix!==""))return null;const Le=R&&v?`/s/${o.selectedSampleIdx}/`:"/",We=R&&De.startsWith("eval/")?De.replace(/^(eval\/[^/]+)\//,`$1${Le}`):De,je=(he==null?void 0:he.histogramMetricType)||"",be=R&&je.startsWith("eval/")?je.replace(/^(eval\/[^/]+)\//,`$1${Le}`):je,Xe=v&&(he==null?void 0:he.suffix)==="mean"?(he.label||De).replace(/ - Mean$/,""):(he==null?void 0:he.label)||De;return he!=null&&he.isHistogram?p.jsx(o6e,{runPath:N,step:t,metricType:be,label:Xe,showZeroLine:he==null?void 0:he.showZeroLine,unit:he==null?void 0:he.unit,isTokenMetric:(he==null?void 0:he.category)==="tokens",onRemove:()=>ie(De),scrollRoot:re},be):he!=null&&he.isDistributionOverTime?p.jsx(l6e,{runPath:N,metricType:be,label:Xe,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(De),selectedStepAtom:i,maxSelectableStep:e,scrollRoot:re},be):p.jsx(i6e,{runs:K,shouldPoll:L,metricKey:We,label:Xe,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(De),hoveredRunId:P,selectedStepAtom:i,maxSelectableStep:e,scrollRoot:re},De)})})]},ye)})]})})]})}function r6e(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 Df(t,e,n,r){const{isEval:i,evalName:s,rawMetricName:o,sampleIdx:a}=r6e(e),l=LG(t,e,n&&!i,r),c=Nue(t,s,o,n&&i,r,a);return i?c:l}function i6e({runs:t,shouldPoll:e,metricKey:n,label:r,showZeroLine:i,unit:s,isTokenMetric:o,showEma:a=!1,emaSpan:l=10,currentStep:c,onRemove:d,hoveredRunId:h=null,selectedStepAtom:g=uT,maxSelectableStep:v,scrollRoot:b=null}){var Ge,_e,De,he,Le,ne,We,je,be,Xe;const _=jd(g),w=T.useRef(null),S=T.useRef(null),E=T.useRef(null),A=T.useRef(null),N=T.useRef(null),I=U9(w,{root:b,threshold:0}),P=Df(((Ge=t[0])==null?void 0:Ge.runPath)||"",n,I&&!!t[0],e),L=Df(((_e=t[1])==null?void 0:_e.runPath)||"",n,I&&!!t[1],e),R=Df(((De=t[2])==null?void 0:De.runPath)||"",n,I&&!!t[2],e),O=Df(((he=t[3])==null?void 0:he.runPath)||"",n,I&&!!t[3],e),F=Df(((Le=t[4])==null?void 0:Le.runPath)||"",n,I&&!!t[4],e),U=Df(((ne=t[5])==null?void 0:ne.runPath)||"",n,I&&!!t[5],e),q=Df(((We=t[6])==null?void 0:We.runPath)||"",n,I&&!!t[6],e),B=Df(((je=t[7])==null?void 0:je.runPath)||"",n,I&&!!t[7],e),Z=Df(((be=t[8])==null?void 0:be.runPath)||"",n,I&&!!t[8],e),G=Df(((Xe=t[9])==null?void 0:Xe.runPath)||"",n,I&&!!t[9],e),$=T.useMemo(()=>{const le=t.filter(Se=>!Se.isSelected),te=t.filter(Se=>Se.isSelected);return[...le,...te]},[t]),K=T.useMemo(()=>$.slice(0,10),[$]),Y=T.useMemo(()=>{const le=new Map;return K.forEach((te,Se)=>{le.set(te.runPath,Se)}),le},[K]),{uplotData:J,seriesConfig:H,isFetching:z,isRefetching:X,isPlaceholderData:V,hasData:ie,minStep:ae,maxStep:re}=T.useMemo(()=>{const le=[P,L,R,O,F,U,q,B,Z,G],te=new Map;t.forEach((tt,Fe)=>{Fe<10&&te.set(tt.runPath,le[Fe])});const Se=new Set,ve=new Map;let ge=!1,Te=!1,He=!1;if($.forEach((tt,Fe)=>{var Ne;if(Fe>=10)return;const we=te.get(tt.runPath);if(!we)return;we.isFetching&&(ge=!0),we.isRefetching&&(Te=!0),we.isPlaceholderData&&(He=!0);const ke=((Ne=we.data)==null?void 0:Ne.metrics)||[],Ze=new Map;ke.forEach(Ke=>{Se.add(Ke.step),Ze.set(Ke.step,Ke.value)}),ve.set(Fe,Ze)}),Se.size===0)return{uplotData:null,seriesConfig:[],isFetching:ge,isRefetching:Te,isPlaceholderData:He,hasData:!1,minStep:0,maxStep:0};const pe=Array.from(Se).sort((tt,Fe)=>tt-Fe),qe=new Float64Array(pe),xt=[{label:"Step"}],nt=[qe];return $.forEach((tt,Fe)=>{if(Fe>=10)return;const we=ve.get(Fe)||new Map,ke=pe.map(it=>we.get(it)??null),Ze=h===tt.runPath,Ne=h!==null;let Ke;Ne&&!Ze?Ke=.1:Ke=a?.3:1,nt.push(ke),xt.push({label:av(tt),stroke:tt.color,width:1,alpha:Ke,spanGaps:!0,points:{show:!1}})}),a&&$.forEach((tt,Fe)=>{if(Fe>=10)return;const we=ve.get(Fe)||new Map,ke=2/(l+1);let Ze=null;const Ne=[];pe.forEach(Je=>{const $e=we.get(Je);$e!==void 0?(Ze===null?Ze=$e:Ze=ke*$e+(1-ke)*Ze,Ne.push(Ze)):Ne.push(null)});const Ke=h===tt.runPath,it=h!==null;let ht;it&&!Ke?ht=.1:ht=1,nt.push(Ne),xt.push({label:`${av(tt)} (EMA)`,stroke:tt.color,width:1.5,alpha:ht,spanGaps:!0,points:{show:!1}})}),{uplotData:nt,seriesConfig:xt,isFetching:ge,isRefetching:Te,isPlaceholderData:He,hasData:!0,minStep:pe[0],maxStep:pe[pe.length-1]}},[t,$,P,L,R,O,F,U,q,B,Z,G,a,l,h]),ce=n.split("_").pop()||"",oe=T.useCallback(le=>le==null?"N/A":o&&(ce==="min"||ce==="max")?Math.round(le).toLocaleString():Xu(le),[o,ce]),fe=T.useCallback(le=>Math.abs(le)>=1e3?`${parseFloat((le/1e3).toFixed(1))}k`:o?ce==="min"||ce==="max"?Math.round(le).toString():String(parseFloat(le.toFixed(1))):Number.isInteger(le)?le.toLocaleString():Math.abs(le)<.01&&le!==0?le.toExponential(1):String(parseFloat(le.toFixed(2))),[o,ce]),me=T.useCallback(le=>le>=1e3?`${(le/1e3).toFixed(0)}k`:le.toString(),[]);T.useEffect(()=>{if(!S.current||!J||!ie)return;const le=S.current,te=le.clientWidth,Se=160;let ve=1/0,ge=-1/0;for(let ht=1;ht<J.length;ht++){const Je=J[ht];for(let $e=0;$e<Je.length;$e++){const Ae=Je[$e];Ae!=null&&(Ae<ve&&(ve=Ae),Ae>ge&&(ge=Ae))}}const Te=ge-ve,He=Math.max(Math.abs(ge),Math.abs(ve)),pe=Math.max(He*.05,1e-10),qe=Math.max(Te*.1,pe);let xt,nt;i?(xt=Math.min(ve-qe,0),nt=Math.max(ge+qe,0)):(xt=ve-qe,nt=ge+qe);const tt="rgba(128, 128, 128, 0.15)",Fe="rgba(100, 100, 100, 0.9)",we=(ht,Je)=>{if(!Je||Je.length===0)return 36;const $e=Math.max(...Je.map(Ae=>Ae.length));return Math.max(36,$e*6+12)},ke=c!=null&&Number.isFinite(ae)&&Number.isFinite(re)&&c>=ae&&c<=re,Ze={width:te,height:Se,padding:[4,4,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[xt,nt]}},axes:[{stroke:Fe,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,Je)=>Je.map(me)},{stroke:Fe,grid:{stroke:tt,width:1},ticks:{stroke:tt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:we,values:(ht,Je)=>Je.map(fe)}],series:H,hooks:{draw:[ht=>{if(ke&&c!=null){const Je=ht.ctx,$e=ht.valToPos(c,"x",!0),Ae=ht.valToPos(nt,"y",!0),Oe=ht.valToPos(xt,"y",!0);Je.save(),Je.strokeStyle="rgba(128, 128, 128, 0.25)",Je.lineWidth=2,Je.beginPath(),Je.moveTo($e,Ae),Je.lineTo($e,Oe),Je.stroke(),Je.restore()}if(i&&xt<0&&nt>0){const Je=ht.ctx,$e=ht.valToPos(0,"y",!0),Ae=ht.valToPos(ht.scales.x.min,"x",!0),Oe=ht.valToPos(ht.scales.x.max,"x",!0);Je.save(),Je.strokeStyle="rgba(128, 128, 128, 0.5)",Je.lineWidth=1,Je.setLineDash([5,5]),Je.beginPath(),Je.moveTo(Ae,$e),Je.lineTo(Oe,$e),Je.stroke(),Je.restore()}}],setCursor:[ht=>{if(!A.current)return;const{left:Je,idx:$e}=ht.cursor;if(N.current=$e??null,$e==null||Je===void 0||Je<0){A.current.style.display="none";return}const Ae=J[0][$e];if(Ae===void 0){A.current.style.display="none";return}let Oe=`<div class="font-medium mb-1">Step ${Number(Ae).toLocaleString()}</div>`;const Ye=K.length;t.forEach(Et=>{var kt,Ut;const Dt=Y.get(Et.runPath);if(Dt===void 0)return;const Ue=Dt+1,ct=(kt=J[Ue])==null?void 0:kt[$e];let St;if(a){const Xt=Ye+Dt+1;St=(Ut=J[Xt])==null?void 0:Ut[$e]}ct!=null&&(Oe+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Et.color}"></div>
                    <span>${Y8(Et)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${a?.7:1}">${oe(ct)}${s?` ${s}`:""}</span>
                    ${a&&St!==void 0&&St!==null?`<span class="text-muted-foreground">(EMA: ${oe(St)})</span>`:""}
                  </div>
                </div>
              `)}),A.current.innerHTML=Oe,A.current.style.display="block",A.current.style.left="0px",A.current.style.top="0px";const st=A.current.getBoundingClientRect(),Rt=S.current.getBoundingClientRect();let yt=Rt.left+Je+15;yt+st.width+20>window.innerWidth&&(yt=Rt.left+Je-st.width-15+ht.bbox.left),yt=Math.max(4,yt);let Tt=Rt.top-st.height+20;Tt<4&&(Tt=Rt.bottom-20),A.current.style.left=`${yt-st.left}px`,A.current.style.top=`${Tt-st.top}px`}]}};E.current&&E.current.destroy();const Ne=new go(Ze,J,le);E.current=Ne;const Ke=()=>{const ht=N.current;if(ht!=null){let Je=J[0][ht];Je!==void 0&&!isNaN(Je)&&(v!=null&&Je>v&&(Je=v),_(Je))}};le.addEventListener("click",Ke);const it=new ResizeObserver(ht=>{for(const Je of ht){const{width:$e}=Je.contentRect;Ne&&$e>0&&Ne.setSize({width:$e,height:Se})}});return it.observe(le),()=>{le.removeEventListener("click",Ke),it.disconnect(),Ne.destroy(),E.current=null}},[J,H,ie,i,fe,me,oe,$,a,s,c,ae,re,_,v,t,K,Y]);const ye=T.useCallback(()=>{A.current&&(A.current.style.display="none")},[]),Ee=z&&(!X||V);return p.jsxs("div",{ref:w,className:Nt("group/card rounded-lg border border-gray-200 p-3 transition-opacity","bg-white",Ee&&"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(ed,{className:"h-3.5 w-3.5"})})})]}),ie?p.jsxs("div",{className:"h-40 cursor-pointer relative bg-white rounded",ref:S,onMouseLeave:ye,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&&!V&&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:z?"Loading...":"No data"})]})}function s6e(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=[],o=new Array(e).fill(0);for(let a=0;a<=e;a++)s.push(n+a*i);for(const a of t){let l=Math.floor((a-n)/i);l>=e&&(l=e-1),o[l]++}return{binEdges:s,counts:o}}function o6e({runPath:t,step:e,metricType:n,label:r,showZeroLine:i,isTokenMetric:s,onRemove:o,scrollRoot:a=null}){const l=T.useRef(null),c=T.useRef(null),d=T.useRef(null),h=T.useRef(null),g=U9(l,{root:a,threshold:0}),{data:v,isFetching:b,isRefetching:_,isPlaceholderData:w}=kue(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}=s6e(P,25),O=L.slice(0,-1).map((F,U)=>(F+L[U+1])/2);return{histogramData:{binEdges:L,binCenters:O,counts:R,totalCount:P.length,min:Math.min(...P),max:Math.max(...P),mean:P.reduce((F,U)=>F+U,0)/P.length},hasData:!0}},[v==null?void 0:v.values]),A=T.useCallback(P=>P==null?"N/A":s?Math.round(P).toLocaleString():Xu(P),[s]);T.useEffect(()=>{if(!c.current||!S||!E)return;const P=c.current,L=P.clientWidth,R=160,O=new Float64Array(S.binCenters),F=new Float64Array(S.counts),U=[O,F],B=Math.max(...S.counts)*1.1,Z="rgba(128, 128, 128, 0.15)",G="rgba(100, 100, 100, 0.9)",$="rgba(59, 130, 246, 0.7)",K=S.binEdges[1]-S.binEdges[0],J={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,B]}},axes:[{stroke:G,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,V)=>V.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:G,grid:{stroke:Z,width:1},ticks:{stroke:Z,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(X,V)=>{if(!V||V.length===0)return 36;const ie=Math.max(...V.map(ae=>ae.length));return Math.max(36,ie*6+12)},values:(X,V)=>V.map(ie=>ie>=1e3?`${(ie/1e3).toFixed(0)}k`:Math.round(ie).toString())}],series:[{label:"Value"},{label:"Count",stroke:$,fill:$,width:0,paths:(X,V)=>{const ie=new Path2D,{data:ae}=X,re=ae[0],ce=ae[V];for(let oe=0;oe<re.length;oe++){const fe=re[oe],me=ce[oe];if(me==null||me===0)continue;const ye=X.valToPos(fe-K/2,"x",!0),Ee=X.valToPos(fe+K/2,"x",!0),Ge=X.valToPos(0,"y",!0),_e=X.valToPos(me,"y",!0),De=Math.max(1,Ee-ye-1);ie.rect(ye+.5,_e,De,Ge-_e)}return{stroke:ie,fill:ie}}}],hooks:{draw:[X=>{if(i&&S.min<0&&S.max>0){const V=X.ctx,ie=X.valToPos(0,"x",!0),ae=X.valToPos(0,"y",!0),re=X.valToPos(B,"y",!0);V.save(),V.strokeStyle="rgba(128, 128, 128, 0.5)",V.lineWidth=1,V.setLineDash([5,5]),V.beginPath(),V.moveTo(ie,ae),V.lineTo(ie,re),V.stroke(),V.restore()}}],setCursor:[X=>{if(!h.current)return;const{left:V,idx:ie}=X.cursor;if(ie==null||V===void 0||V<0){h.current.style.display="none";return}const ae=S.binCenters[ie],re=S.counts[ie],ce=S.binEdges[ie],oe=S.binEdges[ie+1];if(ae===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(ce)} - ${A(oe)}</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 me=h.current.getBoundingClientRect(),ye=c.current.getBoundingClientRect();let Ee=ye.left+V+15;Ee+me.width+20>window.innerWidth&&(Ee=ye.left+V-me.width-15+X.bbox.left),Ee=Math.max(4,Ee);let Ge=ye.top-me.height+20;Ge<4&&(Ge=ye.bottom-20),h.current.style.left=`${Ee-me.left}px`,h.current.style.top=`${Ge-me.top}px`}]}};d.current&&d.current.destroy();const H=new go(J,U,P);d.current=H;const z=new ResizeObserver(X=>{for(const V of X){const{width:ie}=V.contentRect;H&&ie>0&&H.setSize({width:ie,height:R})}});return z.observe(P),()=>{z.disconnect(),H.destroy(),d.current=null}},[S,E,i,A]);const N=T.useCallback(()=>{h.current&&(h.current.style.display="none")},[]),I=b&&(!_||w);return p.jsxs("div",{ref:l,className:Nt("group/card rounded-lg border border-gray-200 p-3 transition-opacity","bg-white",I&&"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: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(ed,{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 N5=100;function a6e(t,e,n){const r=t.length;if(r<=N5)return{steps:t,counts:e};const i=Math.ceil(r/N5),s=[],o=[],a=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(a).fill(0);for(let g=l;g<c;g++){const v=e[g];for(let b=0;b<a;b++)h[b]+=v[b]||0}o.push(h)}return{steps:s,counts:o}}function l6e({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,currentStep:s,shouldPoll:o,onRemove:a,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=jd(l),S=U9(h,{root:d,threshold:0}),{data:E,isFetching:A,isRefetching:N,isPlaceholderData:I}=zG(t,e,S&&!!t&&!!e,o),P=E&&E.steps.length>0&&E.bin_edges.length>0,L=P&&E.steps.length>N5,R=T.useMemo(()=>!P||!E?null:L?a6e(E.steps,E.counts,E.bin_edges):{steps:E.steps,counts:E.counts},[P,E,L]),O=T.useCallback($=>$==null?"N/A":i?Math.round($).toLocaleString():Xu($),[i]),F=T.useCallback($=>Math.abs($)>=1e3?`${parseFloat(($/1e3).toFixed(1))}k`:i?Math.round($).toString():Number.isInteger($)?$.toLocaleString():Math.abs($)<.01&&$!==0?$.toExponential(1):String(parseFloat($.toFixed(2))),[i]),U=T.useCallback(()=>{const $={top:8,right:8,bottom:24,left:40};if(!v.current||!E)return $;const K=v.current.getContext("2d");if(!K)return $;const Y="10px system-ui, sans-serif",J=5;let H=0;K.save(),K.setTransform(1,0,0,1,0,0),K.font=Y;for(let z=0;z<J;z++){const X=(E.global_min??0)+z/(J-1)*((E.global_max??0)-(E.global_min??0)),V=F(X);H=Math.max(H,K.measureText(V).width)}return K.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(H)+12)}},[E,F]);T.useEffect(()=>{if(!g.current||!v.current||!P||!E||!R)return;const $=g.current,K=v.current,Y=K.getContext("2d");if(!Y)return;const J=$.clientWidth,H=160,z="rgba(100, 100, 100, 0.9)",X="rgba(128, 128, 128, 0.15)",V="10px system-ui, sans-serif",ie=window.devicePixelRatio||1;K.width=J*ie,K.height=H*ie,K.style.width=`${J}px`,K.style.height=`${H}px`,Y.scale(ie,ie),Y.font=V,Y.clearRect(0,0,J,H);const ae=U(),re=J-ae.left-ae.right,ce=H-ae.top-ae.bottom,oe=R.steps,fe=E.bin_edges,me=R.counts,ye=oe.length,Ee=fe.length-1;if(ye===0||Ee===0)return;let Ge=0;for(const be of me)for(const Xe of be)Xe>Ge&&(Ge=Xe);const _e=Math.min(5,ye),De=5,he=re/Math.max(ye,1),Le=be=>ae.left+(be+.5)*he,ne=be=>{const Xe=(E.global_max??1)-(E.global_min??0),le=(be-(E.global_min??0))/(Xe||1);return ae.top+ce-le*ce},We=be=>be===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(be/Ge)*.75})`;Y.strokeStyle=X,Y.lineWidth=1;for(let be=0;be<_e;be++){const Xe=Math.floor(be/Math.max(_e-1,1)*(ye-1)),le=Le(Xe);Y.beginPath(),Y.moveTo(le,ae.top),Y.lineTo(le,H-ae.bottom),Y.stroke()}for(let be=0;be<De;be++){const Xe=(E.global_min??0)+be/(De-1)*((E.global_max??0)-(E.global_min??0)),le=ne(Xe);Y.beginPath(),Y.moveTo(ae.left,le),Y.lineTo(J-ae.right,le),Y.stroke()}const je=he;for(let be=0;be<ye;be++){const Xe=ae.left+be*he,le=me[be];for(let te=0;te<Ee;te++){const Se=le[te];if(Se===0)continue;const ve=fe[te+1],ge=fe[te],Te=ne(ve),He=ne(ge),pe=Math.max(1,He-Te);Y.fillStyle=We(Se),Y.fillRect(Xe,Te,je,pe)}}if(r&&(E.global_min??0)<0&&(E.global_max??0)>0){const be=ne(0);Y.strokeStyle="rgba(128, 128, 128, 0.5)",Y.lineWidth=1,Y.setLineDash([5,5]),Y.beginPath(),Y.moveTo(ae.left,be),Y.lineTo(J-ae.right,be),Y.stroke(),Y.setLineDash([])}if(s!=null){let be=-1,Xe=1/0;for(let le=0;le<oe.length;le++){const te=Math.abs(oe[le]-s);te<Xe&&(Xe=te,be=le)}if(be>=0){const le=Le(be);Y.strokeStyle="rgba(128, 128, 128, 0.25)",Y.lineWidth=1,Y.beginPath(),Y.moveTo(le,ae.top),Y.lineTo(le,H-ae.bottom),Y.stroke()}}Y.strokeStyle=z,Y.lineWidth=1,Y.beginPath(),Y.moveTo(ae.left,H-ae.bottom),Y.lineTo(J-ae.right,H-ae.bottom),Y.stroke(),Y.beginPath(),Y.moveTo(ae.left,ae.top),Y.lineTo(ae.left,H-ae.bottom),Y.stroke(),Y.fillStyle=z,Y.font=V,Y.textAlign="center";for(let be=0;be<_e;be++){const Xe=Math.floor(be/Math.max(_e-1,1)*(ye-1)),le=oe[Xe],te=Le(Xe),Se=le>=1e3?`${(le/1e3).toFixed(0)}k`:le.toString();Y.fillText(Se,te,H-6)}Y.textAlign="right",Y.textBaseline="middle";for(let be=0;be<De;be++){const Xe=(E.global_min??0)+be/(De-1)*((E.global_max??0)-(E.global_min??0)),le=ne(Xe);Y.fillText(F(Xe),ae.left-4,le)}},[E,R,P,r,s,F,U]),T.useEffect(()=>{if(!g.current)return;const $=g.current,K=new ResizeObserver(()=>{if(v.current&&g.current){const Y=g.current.clientWidth;v.current.style.width=`${Y}px`}});return K.observe($),()=>{K.disconnect()}},[]);const q=T.useCallback($=>{if(!E||!R||!v.current||!g.current)return;const K=v.current.getBoundingClientRect(),Y=$.clientX-K.left,J=g.current.clientWidth,H=U(),z=J-H.left-H.right;if(z<=0)return;const X=(Y-H.left)/z,V=Math.round(X*(R.steps.length-1));if(V>=0&&V<R.steps.length){let ie=R.steps[V];c!=null&&ie>c&&(ie=c),w(ie)}},[E,R,U,w,c]),B=T.useCallback($=>{var Se;if(!E||!R||!b.current||!v.current||!g.current)return;const K=v.current.getBoundingClientRect(),Y=$.clientX-K.left,J=$.clientY-K.top,H=g.current.clientWidth,z=160,X=U(),V=H-X.left-X.right,ie=z-X.top-X.bottom;if(V<=0||ie<=0){_.current&&(_.current.style.display="none");return}if(Y<X.left||Y>H-X.right||J<X.top||J>z-X.bottom){b.current.style.display="none",_.current&&(_.current.style.display="none");return}const ae=(Y-X.left)/V,re=Math.min(R.steps.length-1,Math.max(0,Math.round(ae*(R.steps.length-1)))),ce=R.steps[re];if(_.current){const ve=V/Math.max(R.steps.length,1),ge=X.left+(re+.5)*ve;_.current.style.display="block",_.current.style.left=`${ge}px`,_.current.style.top=`${X.top}px`,_.current.style.bottom=`${X.bottom}px`}const oe=1-(J-X.top)/ie,fe=E.bin_edges.length-1,me=Math.min(fe-1,Math.max(0,Math.floor(oe*fe))),ye=E.bin_edges[me],Ee=E.bin_edges[me+1],Ge=((Se=R.counts[re])==null?void 0:Se[me])??0,De=(R.counts[re]??[]).reduce((ve,ge)=>ve+ge,0),he=De>0?(Ge/De*100).toFixed(1):"0.0",ne=L&&E.steps.length>N5?" (aggregated)":"";b.current.innerHTML=`
        <div class="font-medium mb-1">Step ${ce.toLocaleString()}${ne}</div>
        <div class="text-muted-foreground">Range: ${O(ye)} to ${O(Ee)}</div>
        <div class="text-muted-foreground">Count: ${Ge.toLocaleString()} (${he}%)</div>
      `,b.current.style.display="block",b.current.style.left="0px",b.current.style.top="0px";const We=b.current.getBoundingClientRect(),je=$.clientX;let be=je;be+We.width+20>window.innerWidth&&(be=je-We.width);const Xe=Math.max(4,window.innerWidth-We.width-4);be=Math.min(Math.max(4,be),Xe);const le=g.current.getBoundingClientRect();let te=le.top-We.height+20;te<4&&(te=le.bottom-20),b.current.style.left=`${be-We.left}px`,b.current.style.top=`${te-We.top}px`},[E,R,O,U,L]),Z=T.useCallback(()=>{b.current&&(b.current.style.display="none"),_.current&&(_.current.style.display="none")},[]),G=A&&(!N||I);return p.jsxs("div",{ref:h,className:Nt("group/card rounded-lg border border-gray-200 p-3 transition-opacity","bg-white",G&&"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: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(ed,{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:q,onMouseMove:B,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&&!I&&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 DS(t,e=60){if(!t)return"";const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"..."}function c6e(t){return t===null||Number.isNaN(t)?null:`hsl(${Math.max(0,Math.min(1,t))*120} 70% 38%)`}function G6(t,e,n){return e==null||n==null||e>=n?void 0:`hsl(${(Math.max(0,Math.min(1,(t-e)/(n-e)))*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 V9({openAtom:t=b8}={}){const[e,n]=un(t);return!Pi(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 G9({prompts:t,data:e,samplesData:n,rolloutMetrics:r,availableMetricNames:i,isLoading:s,step:o,currentStepIndex:a,totalSteps:l,onStepChange:c,hasSteps:d,stepValues:h,openAtom:g=b8,selectedGroupIdAtom:v=CG,selectedSampleIdxAtom:b=AG,viewModeAtom:_=RG,getGroupBadge:w,renderLeftControls:S,onGroupClick:E,hideRewardAdvantage:A=!1,envDetailsOverride:N}){var ke,Ze,Ne,Ke,it,ht,Je,$e;const[I,P]=un(g),[L,R]=un(v),[O,F]=un(b),[U,q]=un(_),[B,Z]=un(Yce),[G,$]=un(Kce),K=Pi(ml),{data:Y}=td(K||"",!!K,!0),J=(ke=Y==null?void 0:Y.config)==null?void 0:ke.max_tokens,H=T.useMemo(()=>fF(J),[J]),z=(Ze=Y==null?void 0:Y.config)==null?void 0:Ze.group_size,X=T.useMemo(()=>fF(z),[z]),V=T.useMemo(()=>{if(X==null||X<=1)return null;const Ae=Math.sqrt(X-1);return{min:-Ae,max:Ae}},[X]),ie=N??((Ne=Y==null?void 0:Y.config)==null?void 0:Ne.environments),ae=T.useMemo(()=>gw(ie),[ie]),re=T.useMemo(()=>{const Ae=vw(ie),Oe=xw(Y==null?void 0:Y.data_metric_ranges);return yw(Ae,Oe)},[ie,Y==null?void 0:Y.data_metric_ranges]),ce=T.useMemo(()=>{var Oe;const Ae=[ie,(Oe=Y==null?void 0:Y.summary)==null?void 0:Oe.env_details];for(const Ye of Ae){const st=jk(Ye);if(st.length!==0)return st.some(Rt=>(Rt==null?void 0:Rt.is_multi_turn)===!0)}return!1},[ie,(Ke=Y==null?void 0:Y.summary)==null?void 0:Ke.env_details]),[oe,fe]=T.useState(new Map),me=T.useMemo(()=>{if(!r)return null;const Ae=new Map;for(const Oe of r){let Ye=Ae.get(Oe.sample_idx);Ye||(Ye=new Map,Ae.set(Oe.sample_idx,Ye)),Ye.set(Oe.metric_name,{value:Oe.value,env:Oe.env})}return Ae},[r]);me!==null&&me!==oe&&fe(me);const ye=me??oe,[Ee,Ge]=T.useState([]),_e=T.useMemo(()=>{if(i!=null&&i.length)return i;if(!r)return null;const Ae=new Set;for(const Oe of r)Ae.add(Oe.metric_name);return[...Ae].sort()},[i,r]);_e!==null&&_e!==Ee&&Ge(_e);const De=_e??Ee,he=(Ae,Oe)=>{Z(Ye=>Oe===!0?Ye.includes(Ae)?Ye:[...Ye,Ae]:Ye.filter(st=>st!==Ae))};T.useEffect(()=>{if(!De.length&&!e)return;const Ae=new Set;A&&(Ae.add("reward"),Ae.add("advantage")),ce?Ae.add("gen_length"):(Ae.add("gen_length_sum"),Ae.add("gen_length_avg"));const Oe=hF.filter(st=>!Ae.has(st)),Ye=new Set([...Oe,...De]);Z(st=>{let Rt=st;!ce&&!st.includes("gen_length")&&(st.includes("gen_length_avg")||st.includes("gen_length_sum"))?Rt=[...Rt.filter(Tt=>Tt!=="gen_length_avg"&&Tt!=="gen_length_sum"),"gen_length"]:ce&&!st.includes("gen_length_avg")&&st.includes("gen_length")&&(Rt=[...Rt.filter(Tt=>Tt!=="gen_length"),"gen_length_avg"]);const yt=Rt.filter(Tt=>Ye.has(Tt));return yt.length===st.length&&yt.every((Tt,Et)=>Tt===st[Et])?st:yt})},[De,e,Z,A,ce]);const Le=T.useMemo(()=>{const Ae=new Set;A&&(Ae.add("reward"),Ae.add("advantage")),ce?Ae.add("gen_length"):(Ae.add("gen_length_sum"),Ae.add("gen_length_avg"));const Oe=[],Ye=new Set;for(const st of hF)Ae.has(st)||B.includes(st)&&!Ye.has(st)&&(Oe.push(st),Ye.add(st));for(const st of De)B.includes(st)&&!Ye.has(st)&&(Oe.push(st),Ye.add(st));return Oe},[B,De,A,ce]),[ne,We]=T.useState([]),je=T.useRef(0),be=T.useRef(null),Xe=T.useRef(o),le=T.useRef(0);T.useEffect(()=>{var Ye;const Ae=(Ye=be.current)==null?void 0:Ye.querySelector('[data-slot="scroll-area-viewport"]');if(!Ae)return;const Oe=()=>{le.current=Ae.scrollTop};return Ae.addEventListener("scroll",Oe,{passive:!0}),()=>Ae.removeEventListener("scroll",Oe)},[I]),T.useEffect(()=>{var Ae;if(o!==Xe.current){Xe.current=o,je.current=0,le.current=0;const Oe=(Ae=be.current)==null?void 0:Ae.querySelector('[data-slot="scroll-area-viewport"]');Oe&&(Oe.scrollTop=0)}},[o]);const te=T.useMemo(()=>{if(!t)return new Map;const Ae=new Map;for(const Oe of t)Ae.set(Oe.group_id,Oe);return Ae},[t]),Se=T.useMemo(()=>{if(!n)return new Map;const Ae=new Map;for(const Oe of n)Ae.set(Oe.sample_idx,Oe);return Ae},[n]),ve=T.useMemo(()=>{if(!e)return null;const Ae=new Map,Oe=new Map;for(const yt of e){const Tt=Ae.get(yt.sample_idx)||[];Tt.push(yt),Ae.set(yt.sample_idx,Tt),Oe.set(yt.sample_idx,yt.group_id)}const Ye=new Map;for(const[yt,Tt]of Ae){const Et=[...Tt].sort((kn,Xn)=>kn.turn_order-Xn.turn_order),Dt=Oe.get(yt)??-1,Ue=te.get(Dt)??null,ct=Se.get(yt),St=Et.find(kn=>kn.turn_type==="model"),kt=(St==null?void 0:St.content)??"";let Ut=null,Xt=null,hn=0,Lt=0;for(const kn of Et)kn.turn_type==="model"&&typeof kn.tokens=="number"&&(hn+=kn.tokens,Lt+=1);Lt>0&&(Ut=hn/Lt,Xt=hn);const on={sample_idx:yt,group_id:Dt,prompt:Ue,responsePreview:kt,turnsCount:Et.length,turnsData:Et,reward:(ct==null?void 0:ct.reward)??null,advantage:(ct==null?void 0:ct.advantage)??null,assistantTokens:Ut,assistantTokensTotal:Xt},Ht=Ye.get(Dt)||[];Ht.push(on),Ye.set(Dt,Ht)}const st=[];for(const[yt,Tt]of Ye){const Et=te.get(yt)??null;Tt.sort((Dt,Ue)=>Dt.sample_idx-Ue.sample_idx),st.push({group_id:yt,prompt:Et,samples:Tt,sampleCount:Tt.length})}return st.sort((yt,Tt)=>yt.group_id-Tt.group_id)},[e,te,Se]);ve!==null&&ve!==ne&&We(ve);const ge=ve??ne;T.useLayoutEffect(()=>{var Oe;const Ae=(Oe=be.current)==null?void 0:Oe.querySelector('[data-slot="scroll-area-viewport"]');Ae&&le.current>0&&Ae.scrollTop!==le.current&&(Ae.scrollTop=le.current)},[ge]);const Te=T.useMemo(()=>L===null?null:ge.find(Ae=>Ae.group_id===L)??null,[ge,L]),He=Te!==null,pe=T.useMemo(()=>{let Ae=0;for(const Oe of ge)for(const Ye of Oe.samples)Ye.assistantTokens!==null&&Ye.assistantTokens>Ae&&(Ae=Ye.assistantTokens);return Ae>0?Ae:null},[ge]),qe=H??pe,xt=T.useMemo(()=>{let Ae=0;for(const Oe of ge)for(const Ye of Oe.samples)Ye.assistantTokensTotal!==null&&Ye.assistantTokensTotal>Ae&&(Ae=Ye.assistantTokensTotal);return Ae>0?Ae:null},[ge]),nt=H!=null?Math.max(H,xt??0)||null:xt;T.useEffect(()=>{!He&&U==="samples"&&!s&&q("groups")},[He,U,q,s]);const tt=Ae=>{var Ye;const Oe=(Ye=be.current)==null?void 0:Ye.querySelector('[data-slot="scroll-area-viewport"]');if(Oe&&(je.current=Oe.scrollTop),E){const st=ge.find(Rt=>Rt.group_id===Ae);st&&E(Ae,st);return}R(Ae),q("samples")},Fe=Ae=>{F(Ae)},we=Ae=>{var Oe;if(Ae==="samples"&&!He){q("groups");return}if(Ae==="groups"||Ae==="samples"){if(U==="groups"&&Ae==="samples"){const Ye=(Oe=be.current)==null?void 0:Oe.querySelector('[data-slot="scroll-area-viewport"]');Ye&&(je.current=Ye.scrollTop)}q(Ae)}};return T.useEffect(()=>{U==="groups"&&je.current>0&&requestAnimationFrame(()=>{var Oe;const Ae=(Oe=be.current)==null?void 0:Oe.querySelector('[data-slot="scroll-area-viewport"]');Ae&&(Ae.scrollTop=je.current,le.current=je.current)})},[U]),T.useEffect(()=>{U!=="samples"||O===null||requestAnimationFrame(()=>{var Ye;const Ae=(Ye=be.current)==null?void 0:Ye.querySelector('[data-slot="scroll-area-viewport"]');if(!Ae)return;const Oe=Ae.querySelector(`[data-sample-idx="${O}"]`);Oe&&(Oe.scrollIntoView({block:"nearest",behavior:"smooth"}),setTimeout(()=>{le.current=Ae.scrollTop},350))})},[U,O]),!K||!I?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(Fk,{currentPage:a,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:U,setViewMode:q,hasSelectedGroupInStep:He,groups:ge}):p.jsxs(sv,{type:"single",variant:"outline",size:"sm",value:U,onValueChange:we,children:[p.jsx(Ul,{value:"groups",className:"text-xs px-2 py-1 h-7",children:"Groups"}),p.jsx(Ul,{value:"samples",className:"text-xs px-2 py-1 h-7",disabled:!He,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(mG,{className:"h-4 w-4"})})}),p.jsxs(pl,{align:"end",className:"min-w-[180px]",children:[p.jsx(H1,{children:"Settings"}),p.jsx(ul,{}),p.jsx(pi,{checked:G,onCheckedChange:Ae=>$(Ae===!0),onSelect:Ae=>Ae.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(H1,{children:"Display Metrics"}),p.jsx(ul,{}),ce?p.jsxs(p.Fragment,{children:[p.jsx(pi,{checked:B.includes("gen_length_sum"),onCheckedChange:Ae=>he("gen_length_sum",Ae),onSelect:Ae=>Ae.preventDefault(),children:"Gen. Length Sum"}),p.jsx(pi,{checked:B.includes("gen_length_avg"),onCheckedChange:Ae=>he("gen_length_avg",Ae),onSelect:Ae=>Ae.preventDefault(),children:"Gen. Length Avg"})]}):p.jsx(pi,{checked:B.includes("gen_length"),onCheckedChange:Ae=>he("gen_length",Ae),onSelect:Ae=>Ae.preventDefault(),children:"Gen. Length"}),!A&&p.jsx(pi,{checked:B.includes("reward"),onCheckedChange:Ae=>he("reward",Ae),onSelect:Ae=>Ae.preventDefault(),children:"Reward"}),!A&&p.jsx(pi,{checked:B.includes("advantage"),onCheckedChange:Ae=>he("advantage",Ae),onSelect:Ae=>Ae.preventDefault(),children:"Advantage"}),De.length>0&&p.jsx(ul,{}),De.map(Ae=>p.jsx(pi,{checked:B.includes(Ae),onCheckedChange:Oe=>he(Ae,Oe),onSelect:Oe=>Oe.preventDefault(),children:f7(Ae)},Ae))]})]}),p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>P(!1),children:p.jsx(ece,{className:"h-4 w-4"})})]})]})]}),p.jsx(bv,{ref:be,className:Nt("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"}):U==="groups"||!Te?p.jsx("div",{className:"p-2 space-y-1",children:ge.map(Ae=>p.jsx(u6e,{group:Ae,onClick:()=>tt(Ae.group_id),isSelected:L===Ae.group_id,tokenScaleMax:qe,tokenScaleSumMax:nt,envRewardRanges:ae,envMetricRanges:re,advantageRange:V,badge:w?w(Ae):null,displayMetrics:Le,metricsBySampleIdx:ye,tooltipsEnabled:G},Ae.group_id))}):p.jsxs("div",{className:"flex flex-col min-h-0",children:[p.jsxs(gv,{delayDuration:300,open:G?void 0:!1,children:[p.jsx(vv,{asChild:!0,children:p.jsxs("div",{className:"p-3 border-b border-border bg-muted/30 shrink-0 cursor-default",children:[((it=Te.prompt)==null?void 0:it.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:DS(Te.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:DS((ht=Te.prompt)==null?void 0:ht.prompt,150)})]})]})}),p.jsxs(xv,{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:[((Je=Te.prompt)==null?void 0:Je.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:Te.prompt.system_prompt})]}),(($e=Te.prompt)==null?void 0:$e.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:Te.prompt.prompt})]})]})]}),p.jsx("div",{className:"p-2 space-y-1",children:Te.samples.map(Ae=>p.jsx("div",{"data-sample-idx":Ae.sample_idx,children:p.jsx(p6e,{sample:Ae,isSelected:O===Ae.sample_idx,onClick:()=>Fe(Ae.sample_idx),envRewardRanges:ae,envMetricRanges:re,advantageRange:V,displayMetrics:Le,metricsBySampleIdx:ye,tokenScaleMax:qe,tokenScaleSumMax:nt,tooltipsEnabled:G})},Ae.sample_idx))})]})})]})}function u6e({group:t,onClick:e,isSelected:n,tokenScaleMax:r,tokenScaleSumMax:i,envRewardRanges:s,envMetricRanges:o,advantageRange:a,badge:l,displayMetrics:c,metricsBySampleIdx:d,tooltipsEnabled:h}){var g,v,b,_;return p.jsxs(gv,{delayDuration:300,open:h?void 0:!1,children:[p.jsx(vv,{asChild:!0,children:p.jsx("button",{onClick:e,className:Nt("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:DS(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:DS((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,a,o);return p.jsx("div",{title:E.label,className:Nt("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(xv,{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 d6e(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 nZ(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function f6e(t,e){switch(e){case"gen_length":case"gen_length_sum":case"gen_length_avg":return Math.round(t).toString();default:return nZ(t)}}function h6e(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,o,a,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)??c6e(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,(o==null?void 0:o.min)??null,(o==null?void 0:o.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=h6e(a,v,e),_=G6(g.value,(b==null?void 0:b.min)??null,(b==null?void 0:b.max)??null);return{value:g.value,color:_??null,label:`${f7(e)}: ${nZ(g.value)}`}}}}function p6e({sample:t,isSelected:e,onClick:n,envRewardRanges:r,envMetricRanges:i,advantageRange:s,displayMetrics:o,metricsBySampleIdx:a,tokenScaleMax:l,tokenScaleSumMax:c,tooltipsEnabled:d}){return p.jsxs(gv,{delayDuration:300,open:d?void 0:!1,children:[p.jsx(vv,{asChild:!0,children:p.jsx("button",{onClick:n,className:Nt("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:o.length>0?Math.max(2,o.filter(h=>h7(t,h,a,l,c,r,s,i,70).value!==null).length):2,overflowWrap:"anywhere"},children:DS(t.responsePreview,300)||"No response"}),o.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:o.map(h=>{const g=h7(t,h,a,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:f6e(g.value,h)},h)})})})]})})}),p.jsx(xv,{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:d6e(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 m6e(){var _e,De,he,Le;const t=Pi(ml),[e]=T7(),[n,r]=un(uT),[i,s]=un(CG),[o,a]=un(AG),l=Pi(NG),[c,d]=un(b8),[,h]=un(RG),g=Pi(y8),[v,b]=un(hT),[_,w]=un(pT),S=v.length+(_?1:0),E=ne=>{b(We=>We.includes(ne)?We.filter(je=>je!==ne):[...We,ne])},[A,N]=T.useState(0),[I,P]=T.useState(0),[L,R]=T.useState(!0),O=!0,F=T.useMemo(()=>{const ne=e.get("step");if(!ne)return null;const We=Number(ne);return Number.isFinite(We)?We:null},[e]),U=T.useMemo(()=>{const ne=e.get("sample");if(!ne)return null;const We=Number(ne);return Number.isFinite(We)?We:null},[e]),q=T.useMemo(()=>{const ne=e.get("group");if(!ne)return null;const We=Number(ne);return Number.isFinite(We)?We:null},[e]),B=T.useRef(null),Z=T.useRef({group:null,sample:null});T.useEffect(()=>{if(!t){B.current=null,Z.current={group:null,sample:null};return}if(F==null){B.current=null;return}F!==B.current&&(r(F),B.current=F)},[F,t,r]),T.useEffect(()=>{t&&(q==null||U==null||Z.current.group===q&&Z.current.sample===U||(s(q),a(U),d(!0),h("samples"),Z.current={group:q,sample:U}))},[q,U,t,s,a,d,h]);const{data:G,isLoading:$,error:K}=vue(t||"",n,!!t),{data:Y}=td(t||"",!!t,O),J=T.useMemo(()=>{var ne;return gw((ne=Y==null?void 0:Y.config)==null?void 0:ne.environments)},[(_e=Y==null?void 0:Y.config)==null?void 0:_e.environments]),H=T.useMemo(()=>{var je;const ne=vw((je=Y==null?void 0:Y.config)==null?void 0:je.environments),We=xw(Y==null?void 0:Y.data_metric_ranges);return yw(ne,We)},[(De=Y==null?void 0:Y.config)==null?void 0:De.environments,Y==null?void 0:Y.data_metric_ranges]),z=T.useMemo(()=>{var be;const ne=(be=Y==null?void 0:Y.config)==null?void 0:be.group_size,We=typeof ne=="object"&&ne!==null&&"value"in ne?Number(ne.value):Number(ne);if(!We||isNaN(We)||We<=1)return null;const je=Math.sqrt(We-1);return{min:-je,max:je}},[(he=Y==null?void 0:Y.config)==null?void 0:he.group_size]),X=T.useMemo(()=>{var ne;return(ne=G==null?void 0:G.available_steps)!=null&&ne.length&&n===null?G.available_steps[G.available_steps.length-1]:null},[G,n]);T.useEffect(()=>{X!==null&&n===null&&F==null&&r(X)},[X,F,n,r]);const V=ne=>{r(ne)},[ie,ae]=T.useState([]),[re,ce]=T.useState(null);t!==re&&(ae([]),ce(t));const oe=G==null?void 0:G.available_steps,fe=T.useMemo(()=>{const ne=oe??[];return[...new Set([...ie,...ne])].sort((je,be)=>je-be)},[oe,ie]);fe.length>ie.length&&ae(fe);const me=fe.length>0,ye=me?fe[fe.length-1]:0,Ee=T.useMemo(()=>{if(n==null)return fe.length-1;const ne=fe.indexOf(n);return ne>=0?ne:fe.length-1},[fe,n]),Ge=ne=>{ne>=0&&ne<fe.length&&V(fe[ne])};return t?p.jsxs("div",{className:"flex h-full overflow-hidden",children:[p.jsx(G9,{prompts:G==null?void 0:G.prompts,data:G==null?void 0:G.rollouts,samplesData:G==null?void 0:G.samples_data,rolloutMetrics:G==null?void 0:G.rollout_metrics,availableMetricNames:G==null?void 0:G.available_rollout_metric_names,isLoading:$,step:n??void 0,currentStepIndex:Ee,totalSteps:fe.length,onStepChange:Ge,hasSteps:me,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(V9,{}),l&&p.jsxs("div",{className:"text-sm text-muted-foreground",children:[p.jsxs("span",{children:["Step ",((Le=l.sample.turns[0])==null?void 0:Le.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(ne=>ne+1),R(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{P(ne=>ne+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(pi,{checked:_,onCheckedChange:ne=>w(!!ne),onSelect:ne=>ne.preventDefault(),children:"Format Think"}),p.jsx(pi,{checked:v.includes("markdown"),onCheckedChange:()=>E("markdown"),onSelect:ne=>ne.preventDefault(),children:"Markdown"}),p.jsx(pi,{checked:v.includes("latex"),onCheckedChange:()=>E("latex"),onSelect:ne=>ne.preventDefault(),children:"LaTeX"}),p.jsx(pi,{checked:v.includes("code"),onCheckedChange:()=>E("code"),onSelect:ne=>ne.preventDefault(),children:"Code"})]})]})]})]}),p.jsx(B9,{})]})})}),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(th,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",K instanceof Error?K.message:"Unknown error"]})})}),p.jsx(y1,{prompts:G==null?void 0:G.prompts,data:G==null?void 0:G.rollouts,samplesData:G==null?void 0:G.samples_data,rolloutMetrics:G==null?void 0:G.rollout_metrics,goldenAnswers:G==null?void 0:G.golden_answers,infoTurns:G==null?void 0:G.info_turns,isLoading:$,step:n??void 0,scrollToSampleId:U,filterGroupId:i,filterSampleIdx:o,collapseAllSignal:A,expandAllSignal:I,defaultSectionsOpen:L,envRewardRanges:J,envMetricRanges:H,advantageRange:z,renderOptions:v,formatThinkBlocks:_})]})})]}),p.jsx(H9,{currentStep:n,maxSelectableStep:ye})]}):p.jsx(hm,{description:"Select a run from the sidebar to view rollouts."})}function g6e(){var ve,ge,Te,He;const t=Pi(ml),[e]=T7(),[n,r]=un(GD),[i,s]=un(WD),[o,a]=un($D),l=Pi(qD),[c,d]=un(zC),[,h]=un(XD),g=Pi(LC),[v,b]=un(hT),[_,w]=un(pT),S=v.length+(_?1:0),E=pe=>{b(qe=>qe.includes(pe)?qe.filter(xt=>xt!==pe):[...qe,pe])},[A,N]=T.useState(0),[I,P]=T.useState(0),[L,R]=T.useState(!0),O=!0,F=T.useMemo(()=>{const pe=e.get("step")??e.get("trainer_step");if(!pe)return null;const qe=Number(pe);return Number.isFinite(qe)?qe:null},[e]),U=T.useMemo(()=>{const pe=e.get("sample");if(!pe)return null;const qe=Number(pe);return Number.isFinite(qe)?qe:null},[e]),q=T.useMemo(()=>{const pe=e.get("group");if(!pe)return null;const qe=Number(pe);return Number.isFinite(qe)?qe:null},[e]),B=T.useRef(null),Z=T.useRef({group:null,sample:null});T.useEffect(()=>{if(!t){B.current=null,Z.current={group:null,sample:null};return}if(F==null){B.current=null;return}F!==B.current&&(r(F),B.current=F)},[F,t,r]),T.useEffect(()=>{t&&(q==null||U==null||Z.current.group===q&&Z.current.sample===U||(s(q),a(U),d(!0),h("samples"),Z.current={group:q,sample:U}))},[q,U,t,s,a,d,h]);const{data:G,isLoading:$,error:K}=xue(t||"",n,!!t),{data:Y}=td(t||"",!!t,O),J=T.useMemo(()=>{var pe;return gw((pe=Y==null?void 0:Y.config)==null?void 0:pe.environments)},[(ve=Y==null?void 0:Y.config)==null?void 0:ve.environments]),H=T.useMemo(()=>{var xt;const pe=vw((xt=Y==null?void 0:Y.config)==null?void 0:xt.environments),qe=xw(Y==null?void 0:Y.data_metric_ranges);return yw(pe,qe)},[(ge=Y==null?void 0:Y.config)==null?void 0:ge.environments,Y==null?void 0:Y.data_metric_ranges]),z=T.useMemo(()=>{var nt;const pe=(nt=Y==null?void 0:Y.config)==null?void 0:nt.group_size,qe=typeof pe=="object"&&pe!==null&&"value"in pe?Number(pe.value):Number(pe);if(!qe||isNaN(qe)||qe<=1)return null;const xt=Math.sqrt(qe-1);return{min:-xt,max:xt}},[(Te=Y==null?void 0:Y.config)==null?void 0:Te.group_size]),X=T.useMemo(()=>{var pe;return(pe=G==null?void 0:G.available_trainer_steps)!=null&&pe.length&&n===null?G.available_trainer_steps[G.available_trainer_steps.length-1]:null},[G,n]);T.useEffect(()=>{X!==null&&n===null&&F==null&&r(X)},[X,F,n,r]);const V=pe=>{r(pe)},[ie,ae]=T.useState([]),[re,ce]=T.useState(null),[oe,fe]=T.useState(new Map);t!==re&&(ae([]),ce(t),fe(new Map));const me=G==null?void 0:G.available_trainer_steps,ye=T.useMemo(()=>{const pe=me??[];return[...new Set([...ie,...pe])].sort((xt,nt)=>xt-nt)},[me,ie]);ye.length>ie.length&&ae(ye);const Ee=ye.length>0,Ge=Ee?ye[ye.length-1]:0,_e=T.useMemo(()=>{if(n==null)return ye.length-1;const pe=ye.indexOf(n);return pe>=0?pe:ye.length-1},[ye,n]),De=pe=>{pe>=0&&pe<ye.length&&V(ye[pe])},he=T.useMemo(()=>{if(G!=null&&G.prompts)return G.prompts.map(pe=>({step:pe.trainer_step,group_id:pe.group_id,env:pe.env,system_prompt:pe.system_prompt,tokens_system_prompt:pe.tokens_system_prompt,prompt:pe.prompt,tokens_prompt:pe.tokens_prompt}))},[G]),Le=T.useMemo(()=>{if(G!=null&&G.rollouts)return G.rollouts.map(pe=>({step:pe.trainer_step,group_id:pe.group_id,sample_idx:pe.sample_idx,turn_order:pe.turn_order,turn_type:pe.turn_type,content:pe.content,tokens:pe.tokens}))},[G]),ne=T.useMemo(()=>{if(G!=null&&G.samples_data)return G.samples_data.map(pe=>({step:pe.trainer_step,group_id:pe.group_id,sample_idx:pe.sample_idx,reward:pe.reward,advantage:pe.advantage,turns:pe.turns,total_tokens:pe.total_tokens,raw_string:pe.raw_string}))},[G]),We=T.useMemo(()=>{if(!(G!=null&&G.rollout_metrics))return;const pe=n??0;return G.rollout_metrics.map(qe=>({step:pe,sample_idx:qe.sample_idx,env:qe.env,metric_name:qe.metric_name,value:qe.value}))},[G,n]),je=T.useMemo(()=>{if(!(G!=null&&G.golden_answers))return;const pe=n??0;return G.golden_answers.map(qe=>({step:pe,sample_idx:qe.sample_idx,env:qe.env,key:qe.key,value:qe.value}))},[G,n]),be=T.useMemo(()=>{if(!(G!=null&&G.info_turns))return;const pe=n??0;return G.info_turns.map(qe=>({step:pe,sample_idx:qe.sample_idx,turn_order:qe.turn_order,env:qe.env,info_key:qe.info_key,info_value:qe.info_value,info_type:qe.info_type}))},[G,n]),Xe=T.useMemo(()=>{if(!(G!=null&&G.prompts))return null;const pe=new Map;for(const qe of G.prompts)pe.set(qe.group_id,qe.discard_reason);return pe},[G]),le=Xe??oe;Xe&&Xe!==oe&&fe(Xe);const te=pe=>{switch(pe){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return pe.split("_").map(qe=>qe.charAt(0).toUpperCase()+qe.slice(1)).join(" ")}},Se=pe=>{switch(pe){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(G9,{prompts:he,data:Le,samplesData:ne,rolloutMetrics:We,isLoading:$,step:n??void 0,currentStepIndex:_e,totalSteps:ye.length,onStepChange:De,hasSteps:Ee,stepValues:ye,openAtom:zC,selectedGroupIdAtom:WD,selectedSampleIdxAtom:$D,viewModeAtom:XD,getGroupBadge:pe=>{const qe=le.get(pe.group_id);return qe?p.jsx($1,{variant:Se(qe),className:"text-[10px] h-4 px-1.5",children:te(qe)}):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(V9,{openAtom:zC}),l&&p.jsxs("div",{className:"text-sm text-muted-foreground",children:[p.jsxs("span",{children:["Step"," ",((He=l.sample.turns[0])==null?void 0:He.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(pe=>pe+1),R(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{P(pe=>pe+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(pi,{checked:_,onCheckedChange:pe=>w(!!pe),onSelect:pe=>pe.preventDefault(),children:"Format Think"}),p.jsx(pi,{checked:v.includes("markdown"),onCheckedChange:()=>E("markdown"),onSelect:pe=>pe.preventDefault(),children:"Markdown"}),p.jsx(pi,{checked:v.includes("latex"),onCheckedChange:()=>E("latex"),onSelect:pe=>pe.preventDefault(),children:"LaTeX"}),p.jsx(pi,{checked:v.includes("code"),onCheckedChange:()=>E("code"),onSelect:pe=>pe.preventDefault(),children:"Code"})]})]})]})]}),p.jsx(B9,{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(th,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",K instanceof Error?K.message:"Unknown error"]})})}),p.jsx(y1,{prompts:he,data:Le,samplesData:ne,rolloutMetrics:We,goldenAnswers:je,infoTurns:be,isLoading:$,step:n??void 0,scrollToSampleId:U,filterGroupId:i,filterSampleIdx:o,lastValidSampleAtom:qD,collapseAllSignal:A,expandAllSignal:I,defaultSectionsOpen:L,envRewardRanges:J,envMetricRanges:H,advantageRange:z,renderOptions:v,formatThinkBlocks:_})]})})]}),p.jsx(H9,{currentStep:n,maxSelectableStep:Ge,openAtom:LC,selectedMetricsAtom:Xce,selectedStepAtom:GD,includeDiscardedDefaults:!0})]}):p.jsx(hm,{description:"Select a run from the sidebar to view discarded rollouts."})}function v6e(){const t=Pi(ml),{data:e,error:n}=td(t||"",!!t,!1),r=T.useMemo(()=>QK(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(eZ,{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(hm,{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 x6e(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 R5(t,e,n){return n?`${t??"?"}:${e}`:`gpu:${e}`}function IS(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),o=Number.parseInt(r.slice(4,6),16);return`rgba(${i}, ${s}, ${o}, ${e})`}}return t}function m7(t,e){const n=new Map,r=[...t].sort((i,s)=>{const o=typeof i.node_id=="number"&&Number.isFinite(i.node_id)?i.node_id:Number.MAX_SAFE_INTEGER,a=typeof s.node_id=="number"&&Number.isFinite(s.node_id)?s.node_id:Number.MAX_SAFE_INTEGER;return o!==a?o-a: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,o=`${s??"?"}:${i.gpu_index}`;n.has(o)||n.set(o,{node_id:s,gpu_index:i.gpu_index})}return Array.from(n.values()).map((i,s)=>({seriesKey:R5(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 y6e(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:R5(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)),o=!!e&&e.size>0&&!s;return p.jsxs("div",{className:Nt("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:o?.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:o?IS(i.color,.25):i.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:i.label})]},i.seriesKey)})})}function b6e({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 o=!!(n!=null&&n.has(s.seriesKey)),a=!!n&&n.size>0&&!o;return p.jsxs("div",{className:Nt("flex items-center gap-1.5 select-none transition-opacity duration-150",i&&"cursor-pointer",o&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:a?.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:a?IS(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 o=!!(n!=null&&n.has(s.seriesKey)),a=!!n&&n.size>0&&!o;return p.jsxs("div",{className:Nt("flex items-center gap-1.5 select-none transition-opacity duration-150",i&&"cursor-pointer",o&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:a?.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:a?IS(s.color,.25):s.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`inference-${s.seriesKey}`)})})]})]})}function rZ(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 tv(t)}const iZ=28;function sZ(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,o=t[n];if(o!=null)return s(n)?n:null;let a=n-1,l=n+1;for(;a>=0||l<t.length;){const c=a>=0?t[a]: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[a])-i),_=Math.abs(Number(e[l])-i)<v?l:a;return s(_)?_:null}if(h)return s(a)?a:null;if(g)return s(l)?l:null;a-=1,l+=1}return null}function oZ(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)]),o=e[Math.floor(i)]+i%1*(e[Math.ceil(i)]-e[Math.floor(i)]),a=o-s,l=6;return{lower:s-l*a,upper:o+l*a}}function S1({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(ed,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function _6e({metricName:t,data:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const o=T.useRef(null),a=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:I}=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 F=1/0,U=-1/0;const q=[];for(const z of e){const X=typeof z.node_id=="number"&&Number.isFinite(z.node_id)?z.node_id:0;O.add(X),z.timestamp<F&&(F=z.timestamp),z.timestamp>U&&(U=z.timestamp),q.push(z.value)}const B=Array.from(O).sort((z,X)=>z-X),Z=i??{start:F,end:U},G={},$=new Set;for(const z of e){const X=typeof z.node_id=="number"&&Number.isFinite(z.node_id)?z.node_id:0;$.add(z.timestamp),G[z.timestamp]||(G[z.timestamp]={}),G[z.timestamp][X]=z.value}const K=Array.from($).sort((z,X)=>z-X);if(K.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:B,timeRange:Z,outlierBounds:null};const Y=K.map(z=>z-Z.start),J=[{label:"Time"}],H=[Y];for(let z=0;z<B.length;z++){const X=B[z],V=K.map(ie=>{var ae;return((ae=G[ie])==null?void 0:ae[X])??null});H.push(V),J.push({label:`Node ${X}`,stroke:fs[z%fs.length],width:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:H,seriesConfig:J,hasData:!0,nodeIds:B,timeRange:Z,outlierBounds:oZ(q)}},[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(!o.current||!w||!E)return;const O=o.current,F=O.clientWidth,U=192;let q=Number.POSITIVE_INFINITY,B=Number.NEGATIVE_INFINITY;for(let ae=1;ae<w.length;ae+=1){const re=w[ae];for(let ce=0;ce<re.length;ce+=1){const oe=re[ce];oe!=null&&(c&&I?oe>=I.lower&&oe<=I.upper&&(oe<q&&(q=oe),oe>B&&(B=oe)):(oe<q&&(q=oe),oe>B&&(B=oe)))}}q===Number.POSITIVE_INFINITY&&I&&(q=I.lower,B=I.upper);const Z=B-q,G=Math.max(Math.abs(B),Math.abs(q)),$=Math.max(G*.05,1e-10),K=Math.max(Z*.1,$),Y=[h!==null?h:Math.max(0,q-K),v!==null?v:B+K],J="rgba(128, 128, 128, 0.15)",H="rgba(100, 100, 100, 0.9)",X={width:F,height:U,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:(ae,re,ce)=>{const oe=N.end-N.start;return oe>0?[0,oe]:[re,ce]}},y:{range:Y}},axes:[{stroke:H,grid:{stroke:J,width:1},ticks:{stroke:J,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:(ae,re,ce,oe)=>[ce,oe],values:(ae,re)=>re.map(ce=>X0(N.start+Number(ce),N.end-N.start))},{stroke:H,grid:{stroke:J,width:1},ticks:{stroke:J,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(ae,re)=>{if(!re||re.length===0)return 40;const ce=Math.max(...re.map(oe=>oe.length));return Math.max(40,ce*7+14)},values:(ae,re)=>re.map(L)}],series:S,hooks:{setCursor:[ae=>{if(!l.current||!o.current)return;const{left:re,idx:ce}=ae.cursor;if(ce==null||re===void 0||re<0){l.current.style.display="none";return}const oe=w[0][ce];if(oe===void 0){l.current.style.display="none";return}const fe=w[0],me=(()=>{const je=ae.scales.x,be=Number(je.min),Xe=Number(je.max);if(!Number.isFinite(be)||!Number.isFinite(Xe))return null;const le=Math.abs(Xe-be);if(le<=0)return null;const te=Math.max(1,ae.bbox.width);return le*iZ/te})(),ye=rZ(Number(oe)+s),Ee=N.start+Number(oe);let _e=`<div class="font-medium mb-1">${X0(Ee,N.end-N.start)}</div>`;_e+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${ye}</div>`,_e+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Ee.toFixed(3)}</div>`;let De=!1;for(let je=0;je<A.length;je+=1){const be=w[je+1],Xe=sZ(be,fe,ce,me);if(Xe===null)continue;const le=be==null?void 0:be[Xe];if(le==null)continue;De=!0;const te=Xu(le);_e+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${fs[je%fs.length]}"></div>
                  <span class="text-muted-foreground">Node ${A[je]}:</span>
                  <span class="font-medium">${te} ${_.unit}</span>
                </div>
              `}if(!De){l.current.style.display="none";return}l.current.innerHTML=_e,l.current.style.display="block";const he=o.current.getBoundingClientRect(),Le=l.current.getBoundingClientRect();let ne=he.left+re+15;ne+Le.width+20>window.innerWidth&&(ne=he.left+re-Le.width-15+ae.bbox.left),ne=Math.max(4,ne);let We=he.top-Le.height+20;We<4&&(We=he.bottom-20),l.current.style.left=`${ne}px`,l.current.style.top=`${We}px`}]}};a.current&&a.current.destroy();const V=new go(X,w,O);a.current=V;const ie=new ResizeObserver(ae=>{for(const re of ae){const{width:ce}=re.contentRect;V&&ce>0&&V.setSize({width:ce,height:U})}});return ie.observe(O),()=>{ie.disconnect(),V.destroy(),a.current=null}},[w,E,S,t,N,s,P,_.unit,A,L,c,I,h,v]);const R=T.useCallback(()=>{l.current&&(l.current.style.display="none")},[]);return p.jsxs("div",{className:Nt("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(S1,{label:"Ignore Outliers",onRemove:()=>d(!1)}),h!==null&&p.jsx(S1,{label:`Min Y: ${h}`,onRemove:()=>g(null)}),v!==null&&p.jsx(S1,{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(ow,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(pi,{checked:c,onCheckedChange:d,children:"Ignore Outliers"}),p.jsx(ul,{}),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 F=O.target.value;g(F===""?null:Number(F))},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 F=O.target.value;b(F===""?null:Number(F))},onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation()})]})]})]})})]}),E?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: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:o,isRefetching:a,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(()=>o&&e.length>0?e:o&&e.length===0?p7:h,[o,e,h]);return g.length===0&&!o?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(b$,{metricName:v,data:b,gpuIndices:i,intervalStart:n,intervalEnd:r,seriesMode:s,showLegend:!1,isLoading:o,isRefetching:a,seriesRoles:l,activeSeriesKeys:c,xOffset:d,xAxisMode:"clock",xAxisTicks:"bounds"},v)})})}function S6e({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const o=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]),a=T.useMemo(()=>o.length>0?o:n?mF:o,[o,n]);return a.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:a.map(l=>{const c=t.filter(d=>d.metric_name===l);return p.jsx(_6e,{metricName:l,data:c,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s},l)})})}function w6e({metricName:t,data:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o=0}){const a=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:I,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 F=1/0,U=-1/0;const q=[];for(const z of e)O.add(z.server),z.timestamp<F&&(F=z.timestamp),z.timestamp>U&&(U=z.timestamp),q.push(z.value);const B=Array.from(O).sort((z,X)=>z-X),Z=s??{start:F,end:U},G={},$=new Set;for(const z of e)$.add(z.timestamp),G[z.timestamp]||(G[z.timestamp]={}),G[z.timestamp][z.server]=z.value;const K=Array.from($).sort((z,X)=>z-X);if(K.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:B,timeRange:Z,outlierBounds:null};const Y=K.map(z=>z-Z.start),J=[{label:"Time"}],H=[Y];for(let z=0;z<B.length;z++){const X=B[z],V=K.map(ae=>{var re;return((re=G[ae])==null?void 0:re[X])??null}),ie=!!i&&i.size>0&&!i.has(X);H.push(V),J.push({label:`Server ${X}`,stroke:ie?IS(fs[z%fs.length],.25):fs[z%fs.length],width:ie?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:H,seriesConfig:J,hasData:!0,serverIds:B,timeRange:Z,outlierBounds:oZ(q)}},[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(!a.current||!S||!A)return;const O=a.current,F=O.clientWidth,U=192;let q=Number.POSITIVE_INFINITY,B=Number.NEGATIVE_INFINITY;for(let ae=1;ae<S.length;ae+=1){const re=S[ae];for(let ce=0;ce<re.length;ce+=1){const oe=re[ce];oe!=null&&(d&&P?oe>=P.lower&&oe<=P.upper&&(oe<q&&(q=oe),oe>B&&(B=oe)):(oe<q&&(q=oe),oe>B&&(B=oe)))}}q===Number.POSITIVE_INFINITY&&P&&(q=P.lower,B=P.upper);const Z=B-q,G=Math.max(Math.abs(B),Math.abs(q)),$=Math.max(G*.05,1e-10),K=Math.max(Z*.1,$),Y=[g!==null?g:Math.max(0,q-K),b!==null?b:B+K],J="rgba(128, 128, 128, 0.15)",H="rgba(100, 100, 100, 0.9)",X={width:F,height:U,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:(ae,re,ce)=>{const oe=I.end-I.start;return oe>0?[0,oe]:[re,ce]}},y:{range:Y}},axes:[{stroke:H,grid:{stroke:J,width:1},ticks:{stroke:J,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:(ae,re,ce,oe)=>[ce,oe],values:(ae,re)=>re.map(ce=>X0(I.start+Number(ce),I.end-I.start))},{stroke:H,grid:{stroke:J,width:1},ticks:{stroke:J,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(ae,re)=>{if(!re||re.length===0)return 40;const ce=Math.max(...re.map(oe=>oe.length));return Math.max(40,ce*7+14)},values:(ae,re)=>re.map(L)}],series:E,hooks:{setCursor:[ae=>{if(!c.current||!a.current)return;const{left:re,idx:ce}=ae.cursor;if(ce==null||re===void 0||re<0){c.current.style.display="none";return}const oe=S[0][ce];if(oe===void 0){c.current.style.display="none";return}const fe=S[0],me=(()=>{const je=ae.scales.x,be=Number(je.min),Xe=Number(je.max);if(!Number.isFinite(be)||!Number.isFinite(Xe))return null;const le=Math.abs(Xe-be);if(le<=0)return null;const te=Math.max(1,ae.bbox.width);return le*iZ/te})(),ye=rZ(Number(oe)+o),Ee=I.start+Number(oe);let _e=`<div class="font-medium mb-1">${X0(Ee,I.end-I.start)}</div>`;_e+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${ye}</div>`,_e+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Ee.toFixed(3)}</div>`;let De=!1;for(let je=0;je<N.length;je+=1){const be=S[je+1],Xe=sZ(be,fe,ce,me);if(Xe===null)continue;const le=be==null?void 0:be[Xe];if(le==null)continue;De=!0;const te=Xu(le);_e+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${fs[je%fs.length]}"></div>
                  <span class="text-muted-foreground">Server ${N[je]}:</span>
                  <span class="font-medium">${te} ${w.unit}</span>
                </div>
              `}if(!De){c.current.style.display="none";return}c.current.innerHTML=_e,c.current.style.display="block";const he=a.current.getBoundingClientRect(),Le=c.current.getBoundingClientRect();let ne=he.left+re+15;ne+Le.width+20>window.innerWidth&&(ne=he.left+re-Le.width-15+ae.bbox.left),ne=Math.max(4,ne);let We=he.top-Le.height+20;We<4&&(We=he.bottom-20),c.current.style.left=`${ne}px`,c.current.style.top=`${We}px`}]}};l.current&&l.current.destroy();const V=new go(X,S,O);l.current=V;const ie=new ResizeObserver(ae=>{for(const re of ae){const{width:ce}=re.contentRect;V&&ce>0&&V.setSize({width:ce,height:U})}});return ie.observe(O),()=>{ie.disconnect(),V.destroy(),l.current=null}},[S,A,E,t,I,o,w.unit,N,L,d,P,g,b]);const R=T.useCallback(()=>{c.current&&(c.current.style.display="none")},[]);return p.jsxs("div",{className:Nt("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(S1,{label:"Ignore Outliers",onRemove:()=>h(!1)}),g!==null&&p.jsx(S1,{label:`Min Y: ${g}`,onRemove:()=>v(null)}),b!==null&&p.jsx(S1,{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(ow,{className:"h-3 w-3"})})}),p.jsxs(pl,{align:"end",className:"min-w-[160px]",children:[p.jsx(pi,{checked:d,onCheckedChange:h,children:"Ignore Outliers"}),p.jsx(ul,{}),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 F=O.target.value;v(F===""?null:Number(F))},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 F=O.target.value;_(F===""?null:Number(F))},onClick:O=>O.stopPropagation(),onKeyDown:O=>O.stopPropagation()})]})]})]})})]}),A?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: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 M6e({data:t,activeServerIds:e,onServerHover:n,onServerToggle:r}){const i=T.useMemo(()=>{const s=new Set;for(const a of t)s.add(a.server);return Array.from(s).sort((a,l)=>a-l).map((a,l)=>({serverId:a,label:`Server ${a}`,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 o=!!(e!=null&&e.has(s.serverId)),a=!!e&&e.size>0&&!o;return p.jsxs("div",{className:Nt("flex items-center gap-1.5 select-none transition-opacity duration-150",r&&"cursor-pointer",o&&"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(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:a?IS(s.color,.25):s.color}}),p.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},s.label)})})}function T6e({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o=0}){const a=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(()=>a.length>0?a:n?gF:a,[a,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(w6e,{metricName:c,data:d,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o},c)})})}function E6e({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(Wr,{className:Nt("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:o,open:a,onOpenChange:l,nodeMode:c,onNodeModeChange:d,xOffset:h=0}){const[g,v]=T.useState(!0),[b,_]=T.useState("combined"),w=a??g,S=l??v,E=c??b,A=d??_,[N,I]=T.useState(null),[P,L]=T.useState([]),R=i.size>1,O=T.useMemo(()=>{const Y=[],J=Array.from(i.keys()).sort((H,z)=>H-z);for(const H of J){const z=[...i.get(H)??[]].sort((X,V)=>X-V);for(const X of z)Y.push({nodeId:H,gpuIndex:X})}return Y.map((H,z)=>({seriesKey:R5(H.nodeId,H.gpuIndex,R),node_id:H.nodeId,gpu_index:H.gpuIndex,label:R?`Node ${H.nodeId} GPU ${H.gpuIndex}`:`GPU ${H.gpuIndex}`,color:R?fs[z%fs.length]:fs[H.gpuIndex%fs.length]}))},[i,R]),F=T.useMemo(()=>{const Y=m7(e,R);return Y.length>0?Y:O},[e,R,O]),U=T.useMemo(()=>{const Y=new Set;for(const J of e)Y.add(J.gpu_index);return Array.from(Y).sort((J,H)=>J-H)},[e]),q=T.useMemo(()=>{const Y=[],J=Array.from(i.keys()).sort((H,z)=>H-z);for(const H of J){const z=i.get(H),X=e.filter(ae=>(typeof ae.node_id=="number"?ae.node_id:null)===H&&z.includes(ae.gpu_index)),V=m7(X,!1),ie=V.length>0?V:z.map(ae=>({seriesKey:R5(H,ae,!1),node_id:H,gpu_index:ae,label:`GPU ${ae}`,color:fs[ae%fs.length]}));Y.push({nodeId:H,gpuIndices:z,data:X,labels:ie})}return Y},[e,i]),B=T.useMemo(()=>{const Y=new Set;return E==="combined"||!R?(F.forEach(J=>Y.add(J.seriesKey)),Y):(q.forEach(J=>{J.labels.forEach(H=>Y.add(H.seriesKey))}),Y)},[E,R,F,q]),Z=T.useCallback(Y=>{L(J=>{const H=J.filter(ae=>!B.has(ae)),z=J.filter(ae=>B.has(ae)),V=z.includes(Y)?z.filter(ae=>ae!==Y):[...z,Y],ie=B.size>0&&V.length===B.size?[]:V;return[...H,...ie]})},[B]),G=T.useMemo(()=>B.size===0?P:P.filter(Y=>B.has(Y)),[P,B]),$=T.useMemo(()=>N&&(B.size===0||B.has(N))?N:null,[N,B]),K=T.useMemo(()=>G.length>0?new Set(G):$?new Set([$]):null,[G,$]);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(Wr,{className:Nt("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(sv,{type:"single",variant:"selecting",size:"sm",value:E,onValueChange:Y=>{Y&&A(Y)},children:[p.jsx(Ul,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"}),p.jsx(Ul,{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:F,activeSeriesKeys:K,onSeriesHover:I,onSeriesToggle:Z}),p.jsx(v7,{data:e,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:U,seriesMode:R?"node_gpu":"gpu",isLoading:s,isRefetching:o,activeSeriesKeys:K,xOffset:h})]}):q.map(Y=>p.jsxs(E6e,{nodeId:Y.nodeId,gpuCount:Y.gpuIndices.length,children:[p.jsx(g7,{series:Y.labels,activeSeriesKeys:K,onSeriesHover:I,onSeriesToggle:Z}),p.jsx(v7,{data:Y.data,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:Y.gpuIndices,seriesMode:"gpu",isLoading:s,isRefetching:o,activeSeriesKeys:K,xOffset:h})]},Y.nodeId))})})]})}function C6e({gpuMetrics:t,cpuMetrics:e,vllmMetrics:n,availableGpuMetrics:r,availableCpuMetrics:i,availableVllmMetrics:s,trainerGpus:o,inferenceGpus:a,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:I,trainerNodeMode:P,onTrainerNodeModeChange:L,inferenceNodeMode:R,onInferenceNodeModeChange:O,overrideTimeRange:F,xOffset:U=0}){const[q,B]=T.useState(!0),[Z,G]=T.useState(!0),[$,K]=T.useState(!0),[Y,J]=T.useState("separated"),H=d??q,z=h??B,X=g??Z,V=v??G,ie=b??$,ae=_??K,re=w??Y,ce=S??J,[oe,fe]=T.useState(null),[me,ye]=T.useState([]),[Ee,Ge]=T.useState(null),[_e,De]=T.useState([]),he=T.useMemo(()=>F||x6e(t),[t,F]),Le=T.useMemo(()=>{const Ae=new Set(r),Oe=p7.filter(yt=>Ae.has(yt)),Ye=pF.filter(yt=>Ae.has(yt)),st=new Set([...p7,...pF]),Rt=r.filter(yt=>!st.has(yt)).sort();return[...Oe,...Ye,...Rt]},[r]),ne=T.useMemo(()=>new Set(o.map(Ae=>`${Ae.node_id}:${Ae.gpu_index}`)),[o]),We=T.useMemo(()=>new Set(a.map(Ae=>`${Ae.node_id}:${Ae.gpu_index}`)),[a]),je=T.useMemo(()=>ne.size===0?[]:t.filter(Ae=>{const Oe=typeof Ae.node_id=="number"&&Number.isFinite(Ae.node_id)?Ae.node_id:null;return Oe===null?!1:ne.has(`${Oe}:${Ae.gpu_index}`)}),[t,ne]),be=T.useMemo(()=>We.size===0?[]:t.filter(Ae=>{const Oe=typeof Ae.node_id=="number"&&Number.isFinite(Ae.node_id)?Ae.node_id:null;return Oe===null?!1:We.has(`${Oe}:${Ae.gpu_index}`)}),[t,We]),Xe=T.useMemo(()=>{const Ae=new Map;for(const Oe of o){const Ye=Ae.get(Oe.node_id)??[];Ye.includes(Oe.gpu_index)||Ye.push(Oe.gpu_index),Ae.set(Oe.node_id,Ye)}for(const[Oe,Ye]of Ae)Ae.set(Oe,Ye.sort((st,Rt)=>st-Rt));return Ae},[o]),le=T.useMemo(()=>{const Ae=new Map;for(const Oe of a){const Ye=Ae.get(Oe.node_id)??[];Ye.includes(Oe.gpu_index)||Ye.push(Oe.gpu_index),Ae.set(Oe.node_id,Ye)}for(const[Oe,Ye]of Ae)Ae.set(Oe,Ye.sort((st,Rt)=>st-Rt));return Ae},[a]),te=T.useMemo(()=>{const Ae=new Set;for(const Oe of t)Ae.add(Oe.gpu_index);return Array.from(Ae).sort((Oe,Ye)=>Oe-Ye)},[t]),Se=T.useMemo(()=>{const Ae=new Set;for(const Oe of t){const Ye=typeof Oe.node_id=="number"&&Number.isFinite(Oe.node_id)?Oe.node_id:null;Ae.add(Ye)}return Ae.size>1},[t]),ve=T.useMemo(()=>m7(t,Se),[t,Se]),ge=T.useMemo(()=>{if(o.length===0&&a.length===0)return[];const Ae=[...o,...a],Oe=new Set(Ae.map(Ye=>Ye.node_id)).size>1;return y6e(Ae,Oe)},[o,a]),Te=T.useMemo(()=>{const Ae=ve.length>0?ve:ge,Oe=new Set(o.map(Ye=>`${Ye.node_id}:${Ye.gpu_index}`));return Ae.filter(Ye=>{const st=`${Ye.node_id??"?"}:${Ye.gpu_index}`;return Oe.has(st)||Oe.has(`${Ye.node_id}:${Ye.gpu_index}`)})},[ve,ge,o]),He=T.useMemo(()=>{const Ae=ve.length>0?ve:ge,Oe=new Set(a.map(Ye=>`${Ye.node_id}:${Ye.gpu_index}`));return Ae.filter(Ye=>{const st=`${Ye.node_id??"?"}:${Ye.gpu_index}`;return Oe.has(st)||Oe.has(`${Ye.node_id}:${Ye.gpu_index}`)})},[ve,ge,a]),pe=T.useMemo(()=>{const Ae={},Oe=new Set(o.map(st=>`${st.node_id}:${st.gpu_index}`)),Ye=new Set(a.map(st=>`${st.node_id}:${st.gpu_index}`));if(Se)for(const st of t){const Rt=typeof st.node_id=="number"&&Number.isFinite(st.node_id)?st.node_id:null,yt=`${Rt??"?"}:${st.gpu_index}`,Tt=`${Rt}:${st.gpu_index}`;Oe.has(Tt)||Oe.has(yt)?Ae[yt]="Trainer":(Ye.has(Tt)||Ye.has(yt))&&(Ae[yt]="Inference")}else{for(const st of o)Ae[`gpu:${st.gpu_index}`]="Trainer";for(const st of a)Ae[`gpu:${st.gpu_index}`]="Inference"}return Ae},[t,o,a,Se]),qe=o.length>0||a.length>0,xt=je.length>0||!!l&&o.length>0,nt=be.length>0||!!l&&a.length>0,tt=T.useMemo(()=>{if(!qe)return ve;const Ae=new Map;for(const Oe of Te)Ae.set(Oe.seriesKey,Oe);for(const Oe of He)Ae.set(Oe.seriesKey,Oe);return Array.from(Ae.values())},[qe,ve,Te,He]),Fe=T.useMemo(()=>new Set(tt.map(Ae=>Ae.seriesKey)),[tt]),we=T.useMemo(()=>Fe.size===0?me:me.filter(Ae=>Fe.has(Ae)),[me,Fe]),ke=T.useCallback(Ae=>{ye(Oe=>{const Ye=Oe.filter(Et=>!Fe.has(Et)),st=Oe.filter(Et=>Fe.has(Et)),yt=st.includes(Ae)?st.filter(Et=>Et!==Ae):[...st,Ae],Tt=Fe.size>0&&yt.length===Fe.size?[]:yt;return[...Ye,...Tt]})},[Fe]),Ze=T.useMemo(()=>oe&&(Fe.size===0||Fe.has(oe))?oe:null,[oe,Fe]),Ne=T.useMemo(()=>we.length>0?Fe.size>0&&we.length===Fe.size?null:new Set(we):Ze?new Set([Ze]):null,[we,Ze,Fe]),Ke=T.useMemo(()=>{const Ae=new Set;for(const Oe of n??[])Ae.add(Oe.server);return Ae},[n]),it=T.useMemo(()=>Ke.size===0?_e:_e.filter(Ae=>Ke.has(Ae)),[_e,Ke]),ht=T.useCallback(Ae=>{De(Oe=>{const Ye=Oe.filter(Et=>!Ke.has(Et)),st=Oe.filter(Et=>Ke.has(Et)),yt=st.includes(Ae)?st.filter(Et=>Et!==Ae):[...st,Ae],Tt=Ke.size>0&&yt.length===Ke.size?[]:yt;return[...Ye,...Tt]})},[Ke]),Je=T.useMemo(()=>Ee===null?null:Ke.size===0||Ke.has(Ee)?Ee:null,[Ee,Ke]),$e=T.useMemo(()=>it.length>0?Ke.size>0&&it.length===Ke.size?null:new Set(it):Je!==null?new Set([Je]):null,[it,Je,Ke]);return p.jsxs("div",{className:"space-y-4",children:[p.jsxs(Ki,{open:H,onOpenChange:z,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(Wr,{className:Nt("h-4 w-4 text-muted-foreground transition-transform",!H&&"-rotate-90")}),p.jsx("h3",{className:"text-sm font-semibold",children:"GPU Metrics"})]})})}),H&&qe&&p.jsxs(sv,{type:"single",variant:"selecting",size:"sm",value:re,onValueChange:Ae=>{Ae&&ce(Ae)},children:[p.jsx(Ul,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Trainer/Inference"}),p.jsx(Ul,{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"||!qe?p.jsxs(p.Fragment,{children:[qe?p.jsx(b6e,{trainerLabels:Te,inferenceLabels:He,activeSeriesKeys:Ne,onSeriesHover:fe,onSeriesToggle:ke}):p.jsx(g7,{series:ve,activeSeriesKeys:Ne,onSeriesHover:fe,onSeriesToggle:ke}),p.jsx(v7,{data:t,metricNames:Le,intervalStart:he.start,intervalEnd:he.end,gpuIndices:te,seriesMode:Se?"node_gpu":"gpu",isLoading:l,isRefetching:c,seriesRoles:qe?pe:void 0,activeSeriesKeys:Ne,xOffset:U})]}):p.jsxs(p.Fragment,{children:[xt&&p.jsx(vF,{title:"Trainer",gpuData:je,gpuMetricNames:Le,timeRange:he,nodeGpuMap:Xe,isLoading:l,isRefetching:c,open:E,onOpenChange:A,nodeMode:P,onNodeModeChange:L,xOffset:U}),nt&&p.jsxs(p.Fragment,{children:[xt&&p.jsx("div",{className:"border-t border-gray-200 my-3"}),p.jsx(vF,{title:"Inference",gpuData:be,gpuMetricNames:Le,timeRange:he,nodeGpuMap:le,isLoading:l,isRefetching:c,open:N,onOpenChange:I,nodeMode:R,onNodeModeChange:O,xOffset:U})]}),!l&&je.length===0&&be.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:V,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(Wr,{className:Nt("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(S6e,{data:e,availableMetricNames:i,isLoading:l,isRefetching:c,overrideTimeRange:F,xOffset:U})})})]}),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:ae,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(Wr,{className:Nt("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(M6e,{data:n??[],activeServerIds:$e,onServerHover:Ge,onServerToggle:ht}),p.jsx(T6e,{data:n??[],availableMetricNames:s,isLoading:l,isRefetching:c,activeServerIds:$e,overrideTimeRange:F,xOffset:U})]})})]})]}):null]})}function A6e(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 a=e[s].trimStart();if(!a||a===")"){a===")"&&i.length>1&&i.pop();continue}const l=a.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=a.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 aZ(r),cZ(r),r}function xF(t){return/^\d+(-\d+)?$/.test(t)}function aZ(t){for(const r of t.children)aZ(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)&&lZ(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 lZ(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(!lZ(t.children[n],e.children[n]))return!1;return!0}function cZ(t){if(t.children.length===0)return t.estimatedParams*(t.repeatCount||1);let e=0;for(const n of t.children)e+=cZ(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 o=n[0]*n[1];return r?o+n[1]:o}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 o=n[0];return i.includes("rmsnorm")?o:r?o*2:o}if(i.startsWith("conv")&&n.length>=3){const[o,a,l]=n,c=o*a*l*(n[3]??l);return r?c+a:c}return 0}function N6e(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 uZ(t,e,1),e}function uZ(t,e,n){var i,s;const r=(t.repeatCount||1)*n;if(t.children.length===0&&t.type){const o=t.type;e.layerTypeCounts[o]=(e.layerTypeCounts[o]||0)+r,e.totalParams+=t.estimatedParams*r;const a=R6e(t);e.paramsByCategory[a]+=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 o of t.children)uZ(o,e,r)}if(t.children.length>0){const o=t.name.toLowerCase();if(o.includes("attn")||o.includes("attention")){for(const a of t.children)if(a.type.toLowerCase()==="linear"){const l=((s=a.args.match(/\d+/g))==null?void 0:s.map(Number))??[];if(l.length>=2){const c=a.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 R6e(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 cy(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 dZ(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 IE(t){return t?bF[t]?bF[t]:t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function k6e(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 k5(){return p.jsx("div",{className:"w-px h-4 bg-border mx-auto"})}function P6e({node:t}){const e=IE(t.name)||t.type,n=dZ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?cy(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 D6e({node:t}){const e=IE(t.name)||t.type,n=dZ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?cy(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 I6e({node:t}){const e=IE(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?cy(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(D6e,{node:i},s))})]})}function W9({node:t}){return t.children.length===0?p.jsx(P6e,{node:t}):t.repeatCount>1?p.jsx(O6e,{node:t}):t.children.every(n=>n.children.length===0)?p.jsx(I6e,{node:t}):p.jsx(L6e,{node:t})}function O6e({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(k5,{}),p.jsx(W9,{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 L6e({node:t}){const e=IE(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?cy(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(k5,{}),p.jsx(W9,{node:i})]},s))})]})}function z6e({root:t}){const e=T.useMemo(()=>k6e(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(k5,{}),p.jsx(W9,{node:n})]},r)),p.jsx(k5,{}),p.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Output"})]})}function j6e({stats:t,rawRepr:e}){const[n,r]=T.useState(!1),i=t.totalParams,s=T.useMemo(()=>Object.entries(t.paramsByCategory).filter(([,a])=>a>0).sort((a,l)=>l[1]-a[1]),[t.paramsByCategory]),o=T.useMemo(()=>Object.entries(t.layerTypeCounts).sort((a,l)=>l[1]-a[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:["~",cy(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(NM,{label:"Layers",value:String(t.numLayers)}),t.hiddenSize&&p.jsx(NM,{label:"Hidden size",value:t.hiddenSize.toLocaleString()}),t.vocabSize&&p.jsx(NM,{label:"Vocab size",value:t.vocabSize.toLocaleString()}),t.intermediateSize&&p.jsx(NM,{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(([a,l])=>p.jsx("div",{className:`${yF[a].bar}`,style:{width:`${l/i*100}%`,minWidth:l>0?"2px":0}},a))}),p.jsx("div",{className:"space-y-0.5",children:s.map(([a,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[a].bar}`}),p.jsx("span",{className:"capitalize text-muted-foreground",children:a}),p.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:[cy(l)," (",(l/i*100).toFixed(0),"%)"]})]},a))})]}),o.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:o.map(([a,l])=>p.jsxs("div",{className:"flex items-center text-xs",children:[p.jsx("span",{className:"text-foreground",children:a}),p.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:["×",l]})]},a))})]}),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(Wr,{className:"size-3"}):p.jsx(Vg,{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 NM({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 F6e({modelRepr:t}){const e=T.useMemo(()=>A6e(t),[t]),n=T.useMemo(()=>e?N6e(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(Xle,{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(z6e,{root:e})}),p.jsx(j6e,{stats:n,rawRepr:t})]})}function fZ(t){return F9(t==null?void 0:t.setup)}function U6e(t){const e=fZ(t),n=[],r=vi(e==null?void 0:e.trainer),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=vi(s);if(!o)continue;const a=Ar(o.node_id);if(a===null)continue;const l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const d=vi(c);if(!d)continue;const h=Ar(d.gpu_index);h!==null&&n.push({node_id:a,gpu_index:h})}}return n}function B6e(t){const e=fZ(t),n=[],r=vi(e==null?void 0:e.inference),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=vi(s);if(!o)continue;const a=Ar(o.node_id);if(a===null)continue;const l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const d=vi(c);if(!d)continue;const h=Ar(d.gpu_index);h!==null&&n.push({node_id:a,gpu_index:h})}}return n}const H6e=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],V6e=[1,5,10,30,60,120,300],q6=gT;function G6e(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),o=parseInt(r[2]||"0",10),a=parseInt(r[3]||"0",10),l=s*3600+o*60+a;return l>0?l:null}const i=parseFloat(e);return Number.isFinite(i)&&i>0?Math.round(i):null}function RM(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 W6e(t){const e=t.trim().toLowerCase();if(!e)return null;const n=e.match(/^(\d+(?:\.\d+)?)\s*ms$/i);if(n){const o=parseFloat(n[1]);return o>0?o/1e3:null}const r=/^(?:(\d+)\s*m)?\s*(?:(\d+(?:\.\d+)?)\s*s)?$/i,i=e.match(r);if(i&&(i[1]||i[2])){const o=parseInt(i[1]||"0",10),a=parseFloat(i[2]||"0"),l=o*60+a;return l>0?l:null}const s=parseFloat(e);return Number.isFinite(s)&&s>0?s:null}function $6e(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 o=n.get(s);o||(o={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,o)),o.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((o,a)=>o.timestamp-a.timestamp);const s=new Map;for(const o of i.entries){const a=Math.floor(o.timestamp/e);let l=s.get(a);l||(l={sum:0,count:0,ts:0},s.set(a,l)),l.sum+=o.value,l.count+=1,l.ts+=o.timestamp}for(const o of s.values())r.push({...i.key,timestamp:o.ts/o.count,value:o.sum/o.count})}return r}function q6e(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 o=n.get(s);o||(o={key:{metric_name:i.metric_name,node_id:i.node_id,source:i.source},entries:[]},n.set(s,o)),o.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((o,a)=>o.timestamp-a.timestamp);const s=new Map;for(const o of i.entries){const a=Math.floor(o.timestamp/e);let l=s.get(a);l||(l={sum:0,count:0,ts:0},s.set(a,l)),l.sum+=o.value,l.count+=1,l.ts+=o.timestamp}for(const o of s.values())r.push({...i.key,timestamp:o.ts/o.count,value:o.sum/o.count})}return r}function X6e(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 o=n.get(s);o||(o={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,o)),o.entries.push(i)}const r=[];for(const i of n.values()){i.entries.sort((o,a)=>o.timestamp-a.timestamp);const s=new Map;for(const o of i.entries){const a=Math.floor(o.timestamp/e);let l=s.get(a);l||(l={sum:0,count:0,ts:0},s.set(a,l)),l.sum+=o.value,l.count+=1,l.ts+=o.timestamp}for(const o of s.values())r.push({...i.key,timestamp:o.ts/o.count,value:o.sum/o.count})}return r}function Y6e({value:t,onChange:e}){const[n,r]=T.useState(!1),[i,s]=T.useState(""),o=T.useRef(null),a=c=>{c&&(s(q6(t)),setTimeout(()=>{var d;return(d=o.current)==null?void 0:d.select()},0)),r(c)},l=()=>{const c=G6e(i);c!==null&&(e(c),r(!1))};return p.jsxs(oT,{open:n,onOpenChange:a,children:[p.jsx(aT,{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(Wr,{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:o,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:V6e.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 K6e(){var Et;const[t,e]=T.useState(null),n=T.useRef(0),r=Pi(ml),i=!0,[s,o]=un(eue),[a,l]=un(tue),[c,d]=un(nue),[h,g]=un(rue),[v,b]=un(iue),[_,w]=un(sue),[S,E]=un(oue),[A,N]=un(aue),[I,P]=un(lue),[L,R]=un(cue),[O,F]=un(pue),[U,q]=un(uue),[B,Z]=un(due),[G,$]=un(fue),[K,Y]=un(hue),[J,H]=T.useState(RM(_));T.useEffect(()=>{t&&(t.scrollTop=S,n.current=S)},[t]),T.useEffect(()=>{if(!t)return;const Dt=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",Dt,{passive:!0}),()=>{t.removeEventListener("scroll",Dt),E(n.current)}},[t]);const{data:z,error:X}=td(r||"",!!r,i),V=T.useMemo(()=>QK(z==null?void 0:z.summary),[z==null?void 0:z.summary]),{data:ie,isFetching:ae,isPlaceholderData:re}=Tue(r||"",a,c,h,!!r),ce=!!r&&ie!==void 0,{data:oe,isFetching:fe,isPlaceholderData:me}=Eue(r||"",a,c,(ie==null?void 0:ie.global_min_time)??null,h,H6e,ce),ye=!!r&&ie!==void 0,{data:Ee,isFetching:Ge,isPlaceholderData:_e}=Cue(r||"",a,c,(ie==null?void 0:ie.global_min_time)??null,h,null,ye),De=(ie==null?void 0:ie.total_pages)??(oe==null?void 0:oe.total_pages)??null,he=ie,Le=oe,ne=Ee,[We,je]=T.useState([]),[be,Xe]=T.useState([]),[le,te]=T.useState([]);T.useEffect(()=>{he!=null&&he.available_metrics&&he.available_metrics.length>0&&je(he.available_metrics)},[he==null?void 0:he.available_metrics]),T.useEffect(()=>{Le!=null&&Le.available_metrics&&Le.available_metrics.length>0&&Xe(Le.available_metrics)},[Le==null?void 0:Le.available_metrics]),T.useEffect(()=>{ne!=null&&ne.available_metrics&&ne.available_metrics.length>0&&te(ne.available_metrics)},[ne==null?void 0:ne.available_metrics]);const[Se,ve]=T.useState(1),[ge,Te]=T.useState(null),[He,pe]=T.useState(null),[qe,xt]=T.useState(null);T.useEffect(()=>{De!==null&&De>0&&ve(De)},[De]),T.useEffect(()=>{const Dt=(he==null?void 0:he.global_min_time)??(Le==null?void 0:Le.global_min_time)??null;Dt!==null&&Te(Dt)},[he==null?void 0:he.global_min_time,Le==null?void 0:Le.global_min_time]),T.useEffect(()=>{const Dt=(he==null?void 0:he.interval_start)??(Le==null?void 0:Le.interval_start)??null,Ue=(he==null?void 0:he.interval_end)??(Le==null?void 0:Le.interval_end)??null;Dt!==null&&Ue!==null&&pe({start:Dt,end:Ue})},[he==null?void 0:he.interval_start,he==null?void 0:he.interval_end,Le==null?void 0:Le.interval_start,Le==null?void 0:Le.interval_end]),T.useEffect(()=>{ve(1),Te(null),pe(null),xt(null)},[r]);const nt=De??Se,tt=(he==null?void 0:he.interval_start)??(Le==null?void 0:Le.interval_start)??null,Fe=(he==null?void 0:he.interval_end)??(Le==null?void 0:Le.interval_end)??null,we=(he==null?void 0:he.global_min_time)??(Le==null?void 0:Le.global_min_time)??ge;T.useEffect(()=>{if(h&&De!==null&&De>0){const Dt=De-1;a!==Dt&&l(Dt)}},[h,De,a,l]);const ke=Dt=>{g(!1),l(Dt)},Ze=Dt=>{if(!h){const Ue=Math.floor(a*c/Dt);l(Ue)}d(Dt)},Ne=()=>{h?g(!1):(g(!0),De!==null&&De>0&&l(De-1))};T.useEffect(()=>{H(RM(_))},[_]);const Ke=T.useMemo(()=>{const Dt=(he==null?void 0:he.metrics)??[];return!v||_<=0?Dt:$6e(Dt,_)},[he==null?void 0:he.metrics,v,_]),it=T.useMemo(()=>{const Dt=(Le==null?void 0:Le.metrics)??[];return!v||_<=0?Dt:q6e(Dt,_)},[Le==null?void 0:Le.metrics,v,_]),ht=T.useMemo(()=>{const Dt=(ne==null?void 0:ne.metrics)??[];return!v||_<=0?Dt:X6e(Dt,_)},[ne==null?void 0:ne.metrics,v,_]),Je=T.useMemo(()=>{if(h){const kt=[],Ut=[];if((he==null?void 0:he.interval_start)!=null&&Ut.push(he.interval_start),(he==null?void 0:he.interval_end)!=null&&kt.push(he.interval_end),(Le==null?void 0:Le.interval_start)!=null&&Ut.push(Le.interval_start),(Le==null?void 0:Le.interval_end)!=null&&kt.push(Le.interval_end),(ne==null?void 0:ne.interval_start)!=null&&Ut.push(ne.interval_start),(ne==null?void 0:ne.interval_end)!=null&&kt.push(ne.interval_end),kt.length===0)return null;const Xt=Math.min(...kt),hn=Math.max(we??Xt,Xt-c),Lt=Ut.length>0?Math.max(...Ut):hn;return{start:Math.min(Xt,Math.max(hn,Lt)),end:Xt}}const Dt=(He==null?void 0:He.start)??null,Ue=(He==null?void 0:He.end)??null,ct=tt??Dt,St=Fe??Ue;return ct===null||St===null?null:{start:ct,end:St}},[h,he==null?void 0:he.interval_end,he==null?void 0:he.interval_start,Le==null?void 0:Le.interval_end,Le==null?void 0:Le.interval_start,ne==null?void 0:ne.interval_end,ne==null?void 0:ne.interval_start,we,c,tt,Fe,He==null?void 0:He.start,He==null?void 0:He.end]);T.useEffect(()=>{Je&&xt(Je)},[Je]);const $e=Je??qe,Ae=T.useMemo(()=>!$e||we===null?0:$e.start-we,[$e,we]),Oe=ae&&re||fe&&me||Ge&&_e,Ye=ae&&!he||ce&&fe&&!Le||ye&&Ge&&!ne,st=!Oe&&!Ye&&(ae&&!!he||fe&&!!Le||Ge&&!!ne),Rt=Oe||Ye,yt=T.useMemo(()=>U6e(z==null?void 0:z.summary),[z==null?void 0:z.summary]),Tt=T.useMemo(()=>B6e(z==null?void 0:z.summary),[z==null?void 0:z.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(sv,{type:"single",variant:"selecting",size:"sm",value:s,onValueChange:Dt=>{Dt&&o(Dt)},children:[p.jsx(Ul,{value:"metrics",className:"text-xs px-2 py-1 h-7",children:"Metrics"}),p.jsx(Ul,{value:"topology",className:"text-xs px-2 py-1 h-7",children:"Topology"}),p.jsx(Ul,{value:"model",className:"text-xs px-2 py-1 h-7",children:"Model"})]}),s==="metrics"&&p.jsxs(p.Fragment,{children:[p.jsx(Fk,{currentPage:a,totalPages:nt,onPageChange:ke}),p.jsx(Y6e,{value:c,onChange:Ze}),$e&&p.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[X0($e.start,$e.end-$e.start)," ","–"," ",X0($e.end,$e.end-$e.start)]}),p.jsx("button",{onClick:Ne,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(cS,{label:"Aggregate",variant:"selecting",size:"sm",inputType:"text",enabled:v,onEnabledChange:b,value:J,onValueChange:H,onValueCommit:Dt=>{const Ue=W6e(Dt);Ue!==null?(w(Ue),H(RM(Ue))):H(RM(_))},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(th,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",X instanceof Error?X.message:"Unknown error"]})})}),p.jsx(C6e,{gpuMetrics:Ke,cpuMetrics:it,vllmMetrics:ht,availableGpuMetrics:(he==null?void 0:he.available_metrics)??We,availableCpuMetrics:(Le==null?void 0:Le.available_metrics)??be,availableVllmMetrics:(ne==null?void 0:ne.available_metrics)??le,trainerGpus:yt,inferenceGpus:Tt,isLoading:Rt,isRefetching:st,roleMode:A,onRoleModeChange:N,systemMetricsOpen:I,onSystemMetricsOpenChange:P,cpuMetricsOpen:L,onCpuMetricsOpenChange:R,vllmMetricsOpen:O,onVllmMetricsOpenChange:F,trainerSectionOpen:U,onTrainerSectionOpenChange:q,inferenceSectionOpen:B,onInferenceSectionOpenChange:Z,trainerNodeMode:G,onTrainerNodeModeChange:$,inferenceNodeMode:K,onInferenceNodeModeChange:Y,overrideTimeRange:$e,xOffset:Ae})]})}),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"})]})}):z?!V||V.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(eZ,{topology:V})}):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"})]})}):z?(Et=z.summary)!=null&&Et.model_architecture?p.jsx("div",{className:"h-full w-full",children:p.jsx(F6e,{modelRepr:z.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(hm,{description:"Select a run from the sidebar to view infrastructure metrics."})}const hZ=1e4;function u_(t,e){return t*hZ+e}function Z6e(){var Te,He;const t=Pi(ml),[e]=T7(),[n,r]=un(YD),[i,s]=un(Qce),[o,a]=un(KD),[l,c]=un(ZD),d=Pi(QD),[h]=un(jC),[,g]=un(JD),v=Pi(FC),[b,_]=un(hT),[w,S]=un(pT),E=b.length+(w?1:0),A=pe=>{_(qe=>qe.includes(pe)?qe.filter(xt=>xt!==pe):[...qe,pe])},[N,I]=T.useState(0),[P,L]=T.useState(0),[R,O]=T.useState(!0),F=!0,U=T.useMemo(()=>{const pe=e.get("step");if(!pe)return null;const qe=Number(pe);return Number.isFinite(qe)?qe:null},[e]),q=T.useRef(null);T.useEffect(()=>{if(!t){q.current=null;return}if(U==null){q.current=null;return}U!==q.current&&(r(U),q.current=U)},[U,t,r]);const{data:B,isLoading:Z,error:G}=yue(t||"",n,i,!!t),{data:$}=td(t||"",!!t,F),K=((Te=$==null?void 0:$.summary)==null?void 0:Te.eval_env_details)??((He=$==null?void 0:$.config)==null?void 0:He.eval_env_details),Y=T.useMemo(()=>gw(K),[K]),J=T.useMemo(()=>{const pe=vw(K),qe=xw($==null?void 0:$.data_metric_ranges);return yw(pe,qe)},[K,$==null?void 0:$.data_metric_ranges]),[H,z]=T.useState([]),X=B==null?void 0:B.available_rollout_metric_names,V=X&&X.length>0?X:H;X&&X.length>0&&X!==H&&z(X);const ie=T.useMemo(()=>{if(i)return{prefix:`eval/${i}/`,rewardNames:V,selectedSampleIdx:o}},[i,V,o]);T.useEffect(()=>{if(!B)return;const pe=B.available_eval_names;pe.length&&(i&&pe.includes(i)||s(pe[0]))},[B==null?void 0:B.available_eval_names,i,s,B]);const ae=T.useMemo(()=>{var pe;return(pe=B==null?void 0:B.available_steps)!=null&&pe.length&&n===null?B.available_steps[B.available_steps.length-1]:null},[B==null?void 0:B.available_steps,n]);T.useEffect(()=>{ae!==null&&n===null&&U==null&&r(ae)},[ae,U,n,r]);const re=pe=>{r(pe)},[ce,oe]=T.useState([]),[fe,me]=T.useState(null);t!==fe&&(oe([]),me(t));const ye=B==null?void 0:B.available_steps,Ee=T.useMemo(()=>{const pe=ye??[];return[...new Set([...ce,...pe])].sort((xt,nt)=>xt-nt)},[ye,ce]);Ee.length>ce.length&&oe(Ee);const Ge=Ee.length>0,_e=Ge?Ee[Ee.length-1]:0,De=T.useMemo(()=>{if(n==null)return Ee.length-1;const pe=Ee.indexOf(n);return pe>=0?pe:Ee.length-1},[Ee,n]),he=pe=>{pe>=0&&pe<Ee.length&&re(Ee[pe])},Le=T.useMemo(()=>{if(B!=null&&B.prompts)return B.prompts.map(pe=>({step:pe.step,group_id:pe.sample_idx,env:pe.env,system_prompt:pe.system_prompt,tokens_system_prompt:pe.tokens_system_prompt,prompt:pe.prompt,tokens_prompt:pe.tokens_prompt}))},[B]),ne=T.useMemo(()=>{if(B!=null&&B.rollouts)return B.rollouts.map(pe=>({step:pe.step,group_id:pe.sample_idx,sample_idx:u_(pe.sample_idx,pe.completion_idx),turn_order:pe.turn_order,turn_type:pe.turn_type,content:pe.content,tokens:pe.tokens}))},[B]),We=T.useMemo(()=>{if(B!=null&&B.samples_data)return B.samples_data.map(pe=>({step:pe.step,group_id:pe.sample_idx,sample_idx:u_(pe.sample_idx,pe.completion_idx),reward:null,advantage:null,turns:pe.turns,total_tokens:null,raw_string:null}))},[B]),je=T.useMemo(()=>{if(B!=null&&B.rollout_metrics)return B.rollout_metrics.map(pe=>({step:pe.step,sample_idx:u_(pe.sample_idx,pe.completion_idx),env:pe.env,metric_name:pe.metric_name,value:pe.value}))},[B]),be=T.useMemo(()=>{if(B!=null&&B.golden_answers)return B.golden_answers.map(pe=>({step:pe.step,sample_idx:u_(pe.sample_idx,pe.completion_idx),env:pe.env,key:pe.key,value:pe.value}))},[B]),Xe=T.useMemo(()=>{if(B!=null&&B.info_turns)return B.info_turns.map(pe=>({step:pe.step,sample_idx:u_(pe.sample_idx,pe.completion_idx),turn_order:pe.turn_order,env:pe.env,info_key:pe.info_key,info_value:pe.info_value,info_type:pe.info_type}))},[B]),le=T.useMemo(()=>{if(!(B!=null&&B.samples_data))return new Map;const pe=new Map;for(const qe of B.samples_data)pe.set(qe.sample_idx,(pe.get(qe.sample_idx)??0)+1);return pe},[B]),te=T.useCallback((pe,qe)=>{const xt=le.get(pe)??qe.samples.length;if(a(pe),xt<=1){const nt=qe.samples[0];nt&&c(nt.sample_idx)}else g("samples")},[le,a,c,g]),Se=T.useCallback(()=>{g("groups")},[g]),ve=T.useCallback(({viewMode:pe})=>p.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[pe==="samples"&&p.jsx(Tn,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:Se,children:p.jsx(h8,{className:"h-4 w-4"})}),p.jsxs(Q8,{value:i??"",onValueChange:qe=>{s(qe),a(null),c(null),g("groups")},children:[p.jsx(ek,{className:"h-7 text-xs min-w-0 flex-1",children:p.jsx(J8,{placeholder:"Select eval..."})}),p.jsx(tk,{children:((B==null?void 0:B.available_eval_names)??[]).map(qe=>p.jsx(nk,{value:qe,className:"text-xs",children:qe},qe))})]})]}),[i,B==null?void 0:B.available_eval_names,s,a,c,g,Se]),ge=T.useMemo(()=>{var Fe;if(!d)return null;const pe=((Fe=d.sample.turns[0])==null?void 0:Fe.step)??n,qe=d.sample.group_id,nt=d.sample.sample_idx%hZ,tt=le.get(qe)??1;return{step:pe,evalSampleIdx:qe,completionIdx:nt,numCompletions:tt}},[d,n,le]);return t?p.jsxs("div",{className:"flex h-full overflow-hidden",children:[p.jsx(G9,{prompts:Le,data:ne,samplesData:We,rolloutMetrics:je,availableMetricNames:V,isLoading:Z,step:n??void 0,currentStepIndex:De,totalSteps:Ee.length,onStepChange:he,hasSteps:Ge,stepValues:Ee,openAtom:jC,selectedGroupIdAtom:KD,selectedSampleIdxAtom:ZD,viewModeAtom:JD,renderLeftControls:ve,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(V9,{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:()=>{I(pe=>pe+1),O(!1)},children:"Collapse All"}),p.jsx(Tn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{L(pe=>pe+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(pi,{checked:w,onCheckedChange:pe=>S(!!pe),onSelect:pe=>pe.preventDefault(),children:"Format Think"}),p.jsx(pi,{checked:b.includes("markdown"),onCheckedChange:()=>A("markdown"),onSelect:pe=>pe.preventDefault(),children:"Markdown"}),p.jsx(pi,{checked:b.includes("latex"),onCheckedChange:()=>A("latex"),onSelect:pe=>pe.preventDefault(),children:"LaTeX"}),p.jsx(pi,{checked:b.includes("code"),onCheckedChange:()=>A("code"),onSelect:pe=>pe.preventDefault(),children:"Code"})]})]})]})]}),ie&&p.jsx(B9,{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:[G&&p.jsx($u,{className:"border-destructive mb-6",children:p.jsx(th,{className:"pt-6",children:p.jsxs("p",{className:"text-destructive",children:["Error:"," ",G instanceof Error?G.message:"Unknown error"]})})}),p.jsx(y1,{prompts:Le,data:ne,samplesData:We,rolloutMetrics:je,goldenAnswers:be,infoTurns:Xe,isLoading:Z,step:n??void 0,filterGroupId:o,filterSampleIdx:l,lastValidSampleAtom:QD,collapseAllSignal:N,expandAllSignal:P,defaultSectionsOpen:R,envRewardRanges:Y,envMetricRanges:J,renderOptions:b,formatThinkBlocks:w})]})})]}),ie&&p.jsx(H9,{currentStep:n,maxSelectableStep:_e,openAtom:FC,selectedMetricsAtom:Jce,selectedStepAtom:YD,evalConfig:ie})]}):p.jsx(hm,{description:"Select a run from the sidebar to view evals."})}function Q6e(){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 J6e(){return p.jsxs(dle,{children:[p.jsx(Zue,{}),p.jsx("main",{className:"ml-56 h-screen overflow-hidden bg-background",children:p.jsxs(QQ,{children:[p.jsx(If,{path:"/",element:p.jsx(x0e,{})}),p.jsx(If,{path:"/metrics",element:p.jsx(b0e,{})}),p.jsx(If,{path:"/timeline",element:p.jsx(YAe,{})}),p.jsx(If,{path:"/rollouts",element:p.jsx(m6e,{})}),p.jsx(If,{path:"/rollouts-discarded",element:p.jsx(g6e,{})}),p.jsx(If,{path:"/topology",element:p.jsx(v6e,{})}),p.jsx(If,{path:"/infra",element:p.jsx(K6e,{})}),p.jsx(If,{path:"/evals",element:p.jsx(Z6e,{})}),p.jsx(If,{path:"/about",element:p.jsx(Q6e,{})})]})})]})}OF.createRoot(document.getElementById("root")).render(p.jsx(T.StrictMode,{children:p.jsx(wJ,{children:p.jsx(J6e,{})})}));
