var yD=t=>{throw TypeError(t)};var uA=(t,e,n)=>e.has(t)||yD("Cannot "+n);var et=(t,e,n)=>(uA(t,e,"read from private field"),n?n.call(t):e.get(t)),Fn=(t,e,n)=>e.has(t)?yD("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),wn=(t,e,n,r)=>(uA(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),fr=(t,e,n)=>(uA(t,e,"access private method"),n);var _4=(t,e,n,r)=>({set _(i){wn(t,e,i,n)},get _(){return et(t,e,r)}});function MJ(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 Vy(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var dA={exports:{}},g_={};/**
 * @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 bD;function TJ(){if(bD)return g_;bD=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 g_.Fragment=e,g_.jsx=n,g_.jsxs=n,g_}var _D;function CJ(){return _D||(_D=1,dA.exports=TJ()),dA.exports}var d=CJ(),fA={exports:{}},Cr={};/**
 * @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 wD;function EJ(){if(wD)return Cr;wD=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"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),m=Symbol.iterator;function x(j){return j===null||typeof j!="object"?null:(j=m&&j[m]||j["@@iterator"],typeof j=="function"?j:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,S={};function M(j,X,F){this.props=j,this.context=X,this.refs=S,this.updater=F||b}M.prototype.isReactComponent={},M.prototype.setState=function(j,X){if(typeof j!="object"&&typeof j!="function"&&j!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,j,X,"setState")},M.prototype.forceUpdate=function(j){this.updater.enqueueForceUpdate(this,j,"forceUpdate")};function T(){}T.prototype=M.prototype;function A(j,X,F){this.props=j,this.context=X,this.refs=S,this.updater=F||b}var N=A.prototype=new T;N.constructor=A,_(N,M.prototype),N.isPureReactComponent=!0;var D=Array.isArray;function k(){}var O={H:null,A:null,T:null,S:null},R=Object.prototype.hasOwnProperty;function L(j,X,F){var ce=F.ref;return{$$typeof:t,type:j,key:X,ref:ce!==void 0?ce:null,props:F}}function B(j,X){return L(j.type,X,j.props)}function H(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function $(j){var X={"=":"=0",":":"=2"};return"$"+j.replace(/[=:]/g,function(F){return X[F]})}var G=/\/+/g;function Z(j,X){return typeof j=="object"&&j!==null&&j.key!=null?$(""+j.key):X.toString(36)}function V(j){switch(j.status){case"fulfilled":return j.value;case"rejected":throw j.reason;default:switch(typeof j.status=="string"?j.then(k,k):(j.status="pending",j.then(function(X){j.status==="pending"&&(j.status="fulfilled",j.value=X)},function(X){j.status==="pending"&&(j.status="rejected",j.reason=X)})),j.status){case"fulfilled":return j.value;case"rejected":throw j.reason}}throw j}function W(j,X,F,ce,oe){var Q=typeof j;(Q==="undefined"||Q==="boolean")&&(j=null);var se=!1;if(j===null)se=!0;else switch(Q){case"bigint":case"string":case"number":se=!0;break;case"object":switch(j.$$typeof){case t:case e:se=!0;break;case f:return se=j._init,W(se(j._payload),X,F,ce,oe)}}if(se)return oe=oe(j),se=ce===""?"."+Z(j,0):ce,D(oe)?(F="",se!=null&&(F=se.replace(G,"$&/")+"/"),W(oe,X,F,"",function(fe){return fe})):oe!=null&&(H(oe)&&(oe=B(oe,F+(oe.key==null||j&&j.key===oe.key?"":(""+oe.key).replace(G,"$&/")+"/")+se)),X.push(oe)),1;se=0;var re=ce===""?".":ce+":";if(D(j))for(var K=0;K<j.length;K++)ce=j[K],Q=re+Z(ce,K),se+=W(ce,X,F,Q,oe);else if(K=x(j),typeof K=="function")for(j=K.call(j),K=0;!(ce=j.next()).done;)ce=ce.value,Q=re+Z(ce,K++),se+=W(ce,X,F,Q,oe);else if(Q==="object"){if(typeof j.then=="function")return W(V(j),X,F,ce,oe);throw X=String(j),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(j).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return se}function J(j,X,F){if(j==null)return j;var ce=[],oe=0;return W(j,ce,"","",function(Q){return X.call(F,Q,oe++)}),ce}function ne(j){if(j._status===-1){var X=j._result;X=X(),X.then(function(F){(j._status===0||j._status===-1)&&(j._status=1,j._result=F)},function(F){(j._status===0||j._status===-1)&&(j._status=2,j._result=F)}),j._status===-1&&(j._status=0,j._result=X)}if(j._status===1)return j._result.default;throw j._result}var ie=typeof reportError=="function"?reportError:function(j){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof j=="object"&&j!==null&&typeof j.message=="string"?String(j.message):String(j),error:j});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",j);return}console.error(j)},z={map:J,forEach:function(j,X,F){J(j,function(){X.apply(this,arguments)},F)},count:function(j){var X=0;return J(j,function(){X++}),X},toArray:function(j){return J(j,function(X){return X})||[]},only:function(j){if(!H(j))throw Error("React.Children.only expected to receive a single React element child.");return j}};return Cr.Activity=h,Cr.Children=z,Cr.Component=M,Cr.Fragment=n,Cr.Profiler=i,Cr.PureComponent=A,Cr.StrictMode=r,Cr.Suspense=l,Cr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Cr.__COMPILER_RUNTIME={__proto__:null,c:function(j){return O.H.useMemoCache(j)}},Cr.cache=function(j){return function(){return j.apply(null,arguments)}},Cr.cacheSignal=function(){return null},Cr.cloneElement=function(j,X,F){if(j==null)throw Error("The argument must be a React element, but you passed "+j+".");var ce=_({},j.props),oe=j.key;if(X!=null)for(Q in X.key!==void 0&&(oe=""+X.key),X)!R.call(X,Q)||Q==="key"||Q==="__self"||Q==="__source"||Q==="ref"&&X.ref===void 0||(ce[Q]=X[Q]);var Q=arguments.length-2;if(Q===1)ce.children=F;else if(1<Q){for(var se=Array(Q),re=0;re<Q;re++)se[re]=arguments[re+2];ce.children=se}return L(j.type,oe,ce)},Cr.createContext=function(j){return j={$$typeof:o,_currentValue:j,_currentValue2:j,_threadCount:0,Provider:null,Consumer:null},j.Provider=j,j.Consumer={$$typeof:s,_context:j},j},Cr.createElement=function(j,X,F){var ce,oe={},Q=null;if(X!=null)for(ce in X.key!==void 0&&(Q=""+X.key),X)R.call(X,ce)&&ce!=="key"&&ce!=="__self"&&ce!=="__source"&&(oe[ce]=X[ce]);var se=arguments.length-2;if(se===1)oe.children=F;else if(1<se){for(var re=Array(se),K=0;K<se;K++)re[K]=arguments[K+2];oe.children=re}if(j&&j.defaultProps)for(ce in se=j.defaultProps,se)oe[ce]===void 0&&(oe[ce]=se[ce]);return L(j,Q,oe)},Cr.createRef=function(){return{current:null}},Cr.forwardRef=function(j){return{$$typeof:a,render:j}},Cr.isValidElement=H,Cr.lazy=function(j){return{$$typeof:f,_payload:{_status:-1,_result:j},_init:ne}},Cr.memo=function(j,X){return{$$typeof:c,type:j,compare:X===void 0?null:X}},Cr.startTransition=function(j){var X=O.T,F={};O.T=F;try{var ce=j(),oe=O.S;oe!==null&&oe(F,ce),typeof ce=="object"&&ce!==null&&typeof ce.then=="function"&&ce.then(k,ie)}catch(Q){ie(Q)}finally{X!==null&&F.types!==null&&(X.types=F.types),O.T=X}},Cr.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Cr.use=function(j){return O.H.use(j)},Cr.useActionState=function(j,X,F){return O.H.useActionState(j,X,F)},Cr.useCallback=function(j,X){return O.H.useCallback(j,X)},Cr.useContext=function(j){return O.H.useContext(j)},Cr.useDebugValue=function(){},Cr.useDeferredValue=function(j,X){return O.H.useDeferredValue(j,X)},Cr.useEffect=function(j,X){return O.H.useEffect(j,X)},Cr.useEffectEvent=function(j){return O.H.useEffectEvent(j)},Cr.useId=function(){return O.H.useId()},Cr.useImperativeHandle=function(j,X,F){return O.H.useImperativeHandle(j,X,F)},Cr.useInsertionEffect=function(j,X){return O.H.useInsertionEffect(j,X)},Cr.useLayoutEffect=function(j,X){return O.H.useLayoutEffect(j,X)},Cr.useMemo=function(j,X){return O.H.useMemo(j,X)},Cr.useOptimistic=function(j,X){return O.H.useOptimistic(j,X)},Cr.useReducer=function(j,X,F){return O.H.useReducer(j,X,F)},Cr.useRef=function(j){return O.H.useRef(j)},Cr.useState=function(j){return O.H.useState(j)},Cr.useSyncExternalStore=function(j,X,F){return O.H.useSyncExternalStore(j,X,F)},Cr.useTransition=function(){return O.H.useTransition()},Cr.version="19.2.1",Cr}var SD;function wS(){return SD||(SD=1,fA.exports=EJ()),fA.exports}var w=wS();const ri=Vy(w),MU=MJ({__proto__:null,default:ri},[w]);var hA={exports:{}},x_={},pA={exports:{}},mA={};/**
 * @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 MD;function AJ(){return MD||(MD=1,(function(t){function e(W,J){var ne=W.length;W.push(J);e:for(;0<ne;){var ie=ne-1>>>1,z=W[ie];if(0<i(z,J))W[ie]=J,W[ne]=z,ne=ie;else break e}}function n(W){return W.length===0?null:W[0]}function r(W){if(W.length===0)return null;var J=W[0],ne=W.pop();if(ne!==J){W[0]=ne;e:for(var ie=0,z=W.length,j=z>>>1;ie<j;){var X=2*(ie+1)-1,F=W[X],ce=X+1,oe=W[ce];if(0>i(F,ne))ce<z&&0>i(oe,F)?(W[ie]=oe,W[ce]=ne,ie=ce):(W[ie]=F,W[X]=ne,ie=X);else if(ce<z&&0>i(oe,ne))W[ie]=oe,W[ce]=ne,ie=ce;else break e}}return J}function i(W,J){var ne=W.sortIndex-J.sortIndex;return ne!==0?ne:W.id-J.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=[],f=1,h=null,m=3,x=!1,b=!1,_=!1,S=!1,M=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function N(W){for(var J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=W)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function D(W){if(_=!1,N(W),!b)if(n(l)!==null)b=!0,k||(k=!0,$());else{var J=n(c);J!==null&&V(D,J.startTime-W)}}var k=!1,O=-1,R=5,L=-1;function B(){return S?!0:!(t.unstable_now()-L<R)}function H(){if(S=!1,k){var W=t.unstable_now();L=W;var J=!0;try{e:{b=!1,_&&(_=!1,T(O),O=-1),x=!0;var ne=m;try{t:{for(N(W),h=n(l);h!==null&&!(h.expirationTime>W&&B());){var ie=h.callback;if(typeof ie=="function"){h.callback=null,m=h.priorityLevel;var z=ie(h.expirationTime<=W);if(W=t.unstable_now(),typeof z=="function"){h.callback=z,N(W),J=!0;break t}h===n(l)&&r(l),N(W)}else r(l);h=n(l)}if(h!==null)J=!0;else{var j=n(c);j!==null&&V(D,j.startTime-W),J=!1}}break e}finally{h=null,m=ne,x=!1}J=void 0}}finally{J?$():k=!1}}}var $;if(typeof A=="function")$=function(){A(H)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,Z=G.port2;G.port1.onmessage=H,$=function(){Z.postMessage(null)}}else $=function(){M(H,0)};function V(W,J){O=M(function(){W(t.unstable_now())},J)}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(W){W.callback=null},t.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<W?Math.floor(1e3/W):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function(W){switch(m){case 1:case 2:case 3:var J=3;break;default:J=m}var ne=m;m=J;try{return W()}finally{m=ne}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(W,J){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var ne=m;m=W;try{return J()}finally{m=ne}},t.unstable_scheduleCallback=function(W,J,ne){var ie=t.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?ie+ne:ie):ne=ie,W){case 1:var z=-1;break;case 2:z=250;break;case 5:z=1073741823;break;case 4:z=1e4;break;default:z=5e3}return z=ne+z,W={id:f++,callback:J,priorityLevel:W,startTime:ne,expirationTime:z,sortIndex:-1},ne>ie?(W.sortIndex=ne,e(c,W),n(l)===null&&W===n(c)&&(_?(T(O),O=-1):_=!0,V(D,ne-ie))):(W.sortIndex=z,e(l,W),b||x||(b=!0,k||(k=!0,$()))),W},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(W){var J=m;return function(){var ne=m;m=J;try{return W.apply(this,arguments)}finally{m=ne}}}})(mA)),mA}var TD;function TU(){return TD||(TD=1,pA.exports=AJ()),pA.exports}var gA={exports:{}},hl={};/**
 * @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 CD;function NJ(){if(CD)return hl;CD=1;var t=wS();function e(l){var c="https://react.dev/errors/"+l;if(1<arguments.length){c+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)c+="&args[]="+encodeURIComponent(arguments[f])}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,f){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:f}}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 hl.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,hl.createPortal=function(l,c){var f=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,f)},hl.flushSync=function(l){var c=o.T,f=r.p;try{if(o.T=null,r.p=2,l)return l()}finally{o.T=c,r.p=f,r.d.f()}},hl.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))},hl.prefetchDNS=function(l){typeof l=="string"&&r.d.D(l)},hl.preinit=function(l,c){if(typeof l=="string"&&c&&typeof c.as=="string"){var f=c.as,h=a(f,c.crossOrigin),m=typeof c.integrity=="string"?c.integrity:void 0,x=typeof c.fetchPriority=="string"?c.fetchPriority:void 0;f==="style"?r.d.S(l,typeof c.precedence=="string"?c.precedence:void 0,{crossOrigin:h,integrity:m,fetchPriority:x}):f==="script"&&r.d.X(l,{crossOrigin:h,integrity:m,fetchPriority:x,nonce:typeof c.nonce=="string"?c.nonce:void 0})}},hl.preinitModule=function(l,c){if(typeof l=="string")if(typeof c=="object"&&c!==null){if(c.as==null||c.as==="script"){var f=a(c.as,c.crossOrigin);r.d.M(l,{crossOrigin:f,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)},hl.preload=function(l,c){if(typeof l=="string"&&typeof c=="object"&&c!==null&&typeof c.as=="string"){var f=c.as,h=a(f,c.crossOrigin);r.d.L(l,f,{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})}},hl.preloadModule=function(l,c){if(typeof l=="string")if(c){var f=a(c.as,c.crossOrigin);r.d.m(l,{as:typeof c.as=="string"&&c.as!=="script"?c.as:void 0,crossOrigin:f,integrity:typeof c.integrity=="string"?c.integrity:void 0})}else r.d.m(l)},hl.requestFormReset=function(l){r.d.r(l)},hl.unstable_batchedUpdates=function(l,c){return l(c)},hl.useFormState=function(l,c,f){return o.H.useFormState(l,c,f)},hl.useFormStatus=function(){return o.H.useHostTransitionStatus()},hl.version="19.2.1",hl}var ED;function CU(){if(ED)return gA.exports;ED=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(),gA.exports=NJ(),gA.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 AD;function kJ(){if(AD)return x_;AD=1;var t=TU(),e=wS(),n=CU();function r(u){var p="https://react.dev/errors/"+u;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+u+"; visit "+p+" 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 p=u,y=u;if(u.alternate)for(;p.return;)p=p.return;else{u=p;do p=u,(p.flags&4098)!==0&&(y=p.return),u=p.return;while(u)}return p.tag===3?y:null}function o(u){if(u.tag===13){var p=u.memoizedState;if(p===null&&(u=u.alternate,u!==null&&(p=u.memoizedState)),p!==null)return p.dehydrated}return null}function a(u){if(u.tag===31){var p=u.memoizedState;if(p===null&&(u=u.alternate,u!==null&&(p=u.memoizedState)),p!==null)return p.dehydrated}return null}function l(u){if(s(u)!==u)throw Error(r(188))}function c(u){var p=u.alternate;if(!p){if(p=s(u),p===null)throw Error(r(188));return p!==u?null:u}for(var y=u,C=p;;){var I=y.return;if(I===null)break;var U=I.alternate;if(U===null){if(C=I.return,C!==null){y=C;continue}break}if(I.child===U.child){for(U=I.child;U;){if(U===y)return l(I),u;if(U===C)return l(I),p;U=U.sibling}throw Error(r(188))}if(y.return!==C.return)y=I,C=U;else{for(var me=!1,je=I.child;je;){if(je===y){me=!0,y=I,C=U;break}if(je===C){me=!0,C=I,y=U;break}je=je.sibling}if(!me){for(je=U.child;je;){if(je===y){me=!0,y=U,C=I;break}if(je===C){me=!0,C=U,y=I;break}je=je.sibling}if(!me)throw Error(r(189))}}if(y.alternate!==C)throw Error(r(190))}if(y.tag!==3)throw Error(r(188));return y.stateNode.current===y?u:p}function f(u){var p=u.tag;if(p===5||p===26||p===27||p===6)return u;for(u=u.child;u!==null;){if(p=f(u),p!==null)return p;u=u.sibling}return null}var h=Object.assign,m=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),A=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),k=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),L=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),H=Symbol.iterator;function $(u){return u===null||typeof u!="object"?null:(u=H&&u[H]||u["@@iterator"],typeof u=="function"?u:null)}var G=Symbol.for("react.client.reference");function Z(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===G?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case _:return"Fragment";case M:return"Profiler";case S:return"StrictMode";case D:return"Suspense";case k:return"SuspenseList";case L:return"Activity"}if(typeof u=="object")switch(u.$$typeof){case b:return"Portal";case A:return u.displayName||"Context";case T:return(u._context.displayName||"Context")+".Consumer";case N:var p=u.render;return u=u.displayName,u||(u=p.displayName||p.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case O:return p=u.displayName||null,p!==null?p:Z(u.type)||"Memo";case R:p=u._payload,u=u._init;try{return Z(u(p))}catch{}}return null}var V=Array.isArray,W=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},ie=[],z=-1;function j(u){return{current:u}}function X(u){0>z||(u.current=ie[z],ie[z]=null,z--)}function F(u,p){z++,ie[z]=u.current,u.current=p}var ce=j(null),oe=j(null),Q=j(null),se=j(null);function re(u,p){switch(F(Q,p),F(oe,u),F(ce,null),p.nodeType){case 9:case 11:u=(u=p.documentElement)&&(u=u.namespaceURI)?HI(u):0;break;default:if(u=p.tagName,p=p.namespaceURI)p=HI(p),u=GI(p,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}X(ce),F(ce,u)}function K(){X(ce),X(oe),X(Q)}function fe(u){u.memoizedState!==null&&F(se,u);var p=ce.current,y=GI(p,u.type);p!==y&&(F(oe,u),F(ce,y))}function he(u){oe.current===u&&(X(ce),X(oe)),se.current===u&&(X(se),f_._currentValue=ne)}var ae,Se;function de(u){if(ae===void 0)try{throw Error()}catch(y){var p=y.stack.trim().match(/\n( *(at )?)/);ae=p&&p[1]||"",Se=-1<y.stack.indexOf(`
    at`)?" (<anonymous>)":-1<y.stack.indexOf("@")?"@unknown:0:0":""}return`
`+ae+u+Se}var Me=!1;function Ce(u,p){if(!u||Me)return"";Me=!0;var y=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var C={DetermineComponentFrameRoot:function(){try{if(p){var Jt=function(){throw Error()};if(Object.defineProperty(Jt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Jt,[])}catch(Ut){var Rt=Ut}Reflect.construct(u,[],Jt)}else{try{Jt.call()}catch(Ut){Rt=Ut}u.call(Jt.prototype)}}else{try{throw Error()}catch(Ut){Rt=Ut}(Jt=u())&&typeof Jt.catch=="function"&&Jt.catch(function(){})}}catch(Ut){if(Ut&&Rt&&typeof Ut.stack=="string")return[Ut.stack,Rt.stack]}return[null,null]}};C.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var I=Object.getOwnPropertyDescriptor(C.DetermineComponentFrameRoot,"name");I&&I.configurable&&Object.defineProperty(C.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var U=C.DetermineComponentFrameRoot(),me=U[0],je=U[1];if(me&&je){var ct=me.split(`
`),At=je.split(`
`);for(I=C=0;C<ct.length&&!ct[C].includes("DetermineComponentFrameRoot");)C++;for(;I<At.length&&!At[I].includes("DetermineComponentFrameRoot");)I++;if(C===ct.length||I===At.length)for(C=ct.length-1,I=At.length-1;1<=C&&0<=I&&ct[C]!==At[I];)I--;for(;1<=C&&0<=I;C--,I--)if(ct[C]!==At[I]){if(C!==1||I!==1)do if(C--,I--,0>I||ct[C]!==At[I]){var Wt=`
`+ct[C].replace(" at new "," at ");return u.displayName&&Wt.includes("<anonymous>")&&(Wt=Wt.replace("<anonymous>",u.displayName)),Wt}while(1<=C&&0<=I);break}}}finally{Me=!1,Error.prepareStackTrace=y}return(y=u?u.displayName||u.name:"")?de(y):""}function Re(u,p){switch(u.tag){case 26:case 27:case 5:return de(u.type);case 16:return de("Lazy");case 13:return u.child!==p&&p!==null?de("Suspense Fallback"):de("Suspense");case 19:return de("SuspenseList");case 0:case 15:return Ce(u.type,!1);case 11:return Ce(u.type.render,!1);case 1:return Ce(u.type,!0);case 31:return de("Activity");default:return""}}function le(u){try{var p="",y=null;do p+=Re(u,y),y=u,u=u.return;while(u);return p}catch(C){return`
Error generating stack: `+C.message+`
`+C.stack}}var He=Object.prototype.hasOwnProperty,Le=t.unstable_scheduleCallback,ze=t.unstable_cancelCallback,Ve=t.unstable_shouldYield,ue=t.unstable_requestPaint,Y=t.unstable_now,xe=t.unstable_getCurrentPriorityLevel,we=t.unstable_ImmediatePriority,Te=t.unstable_UserBlockingPriority,ge=t.unstable_NormalPriority,Ue=t.unstable_LowPriority,be=t.unstable_IdlePriority,ke=t.log,qe=t.unstable_setDisableYieldValue,Qe=null,nt=null;function st(u){if(typeof ke=="function"&&qe(u),nt&&typeof nt.setStrictMode=="function")try{nt.setStrictMode(Qe,u)}catch{}}var Pe=Math.clz32?Math.clz32:ye,Ke=Math.log,rt=Math.LN2;function ye(u){return u>>>=0,u===0?32:31-(Ke(u)/rt|0)|0}var $e=256,Ze=262144,ft=4194304;function lt(u){var p=u&42;if(p!==0)return p;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 Je(u,p,y){var C=u.pendingLanes;if(C===0)return 0;var I=0,U=u.suspendedLanes,me=u.pingedLanes;u=u.warmLanes;var je=C&134217727;return je!==0?(C=je&~U,C!==0?I=lt(C):(me&=je,me!==0?I=lt(me):y||(y=je&~u,y!==0&&(I=lt(y))))):(je=C&~U,je!==0?I=lt(je):me!==0?I=lt(me):y||(y=C&~u,y!==0&&(I=lt(y)))),I===0?0:p!==0&&p!==I&&(p&U)===0&&(U=I&-I,y=p&-p,U>=y||U===32&&(y&4194048)!==0)?p:I}function Ae(u,p){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&p)===0}function We(u,p){switch(u){case 1:case 2:case 4:case 8:case 64:return p+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 p+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 De(){var u=ft;return ft<<=1,(ft&62914560)===0&&(ft=4194304),u}function Ne(u){for(var p=[],y=0;31>y;y++)p.push(u);return p}function ot(u,p){u.pendingLanes|=p,p!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function dt(u,p,y,C,I,U){var me=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 je=u.entanglements,ct=u.expirationTimes,At=u.hiddenUpdates;for(y=me&~y;0<y;){var Wt=31-Pe(y),Jt=1<<Wt;je[Wt]=0,ct[Wt]=-1;var Rt=At[Wt];if(Rt!==null)for(At[Wt]=null,Wt=0;Wt<Rt.length;Wt++){var Ut=Rt[Wt];Ut!==null&&(Ut.lane&=-536870913)}y&=~Jt}C!==0&&Pt(u,C,0),U!==0&&I===0&&u.tag!==0&&(u.suspendedLanes|=U&~(me&~p))}function Pt(u,p,y){u.pendingLanes|=p,u.suspendedLanes&=~p;var C=31-Pe(p);u.entangledLanes|=p,u.entanglements[C]=u.entanglements[C]|1073741824|y&261930}function kt(u,p){var y=u.entangledLanes|=p;for(u=u.entanglements;y;){var C=31-Pe(y),I=1<<C;I&p|u[C]&p&&(u[C]|=p),y&=~I}}function wt(u,p){var y=p&-p;return y=(y&42)!==0?1:Vt(y),(y&(u.suspendedLanes|p))!==0?0:y}function Vt(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 rn(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function Bt(){var u=J.p;return u!==0?u:(u=window.event,u===void 0?32:fD(u.type))}function Gt(u,p){var y=J.p;try{return J.p=u,p()}finally{J.p=y}}var Dt=Math.random().toString(36).slice(2),Qt="__reactFiber$"+Dt,hn="__reactProps$"+Dt,It="__reactContainer$"+Dt,Lt="__reactEvents$"+Dt,zt="__reactListeners$"+Dt,pn="__reactHandles$"+Dt,Ot="__reactResources$"+Dt,Ct="__reactMarker$"+Dt;function tn(u){delete u[Qt],delete u[hn],delete u[Lt],delete u[zt],delete u[pn]}function en(u){var p=u[Qt];if(p)return p;for(var y=u.parentNode;y;){if(p=y[It]||y[Qt]){if(y=p.alternate,p.child!==null||y!==null&&y.child!==null)for(u=KI(u);u!==null;){if(y=u[Qt])return y;u=KI(u)}return p}u=y,y=u.parentNode}return null}function bn(u){if(u=u[Qt]||u[It]){var p=u.tag;if(p===5||p===6||p===13||p===31||p===26||p===27||p===3)return u}return null}function On(u){var p=u.tag;if(p===5||p===26||p===27||p===6)return u.stateNode;throw Error(r(33))}function _e(u){var p=u[Ot];return p||(p=u[Ot]={hoistableStyles:new Map,hoistableScripts:new Map}),p}function tt(u){u[Ct]=!0}var gt=new Set,pt={};function xt(u,p){$t(u,p),$t(u+"Capture",p)}function $t(u,p){for(pt[u]=p,u=0;u<p.length;u++)gt.add(p[u])}var sn=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]*$"),Zt={},Fe={};function bt(u){return He.call(Fe,u)?!0:He.call(Zt,u)?!1:sn.test(u)?Fe[u]=!0:(Zt[u]=!0,!1)}function Tt(u,p,y){if(bt(p))if(y===null)u.removeAttribute(p);else{switch(typeof y){case"undefined":case"function":case"symbol":u.removeAttribute(p);return;case"boolean":var C=p.toLowerCase().slice(0,5);if(C!=="data-"&&C!=="aria-"){u.removeAttribute(p);return}}u.setAttribute(p,""+y)}}function Yt(u,p,y){if(y===null)u.removeAttribute(p);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(p);return}u.setAttribute(p,""+y)}}function Ht(u,p,y,C){if(C===null)u.removeAttribute(y);else{switch(typeof C){case"undefined":case"function":case"symbol":case"boolean":u.removeAttribute(y);return}u.setAttributeNS(p,y,""+C)}}function Cn(u){switch(typeof u){case"bigint":case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function zn(u){var p=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(p==="checkbox"||p==="radio")}function Zn(u,p,y){var C=Object.getOwnPropertyDescriptor(u.constructor.prototype,p);if(!u.hasOwnProperty(p)&&typeof C<"u"&&typeof C.get=="function"&&typeof C.set=="function"){var I=C.get,U=C.set;return Object.defineProperty(u,p,{configurable:!0,get:function(){return I.call(this)},set:function(me){y=""+me,U.call(this,me)}}),Object.defineProperty(u,p,{enumerable:C.enumerable}),{getValue:function(){return y},setValue:function(me){y=""+me},stopTracking:function(){u._valueTracker=null,delete u[p]}}}}function Xn(u){if(!u._valueTracker){var p=zn(u)?"checked":"value";u._valueTracker=Zn(u,p,""+u[p])}}function ir(u){if(!u)return!1;var p=u._valueTracker;if(!p)return!0;var y=p.getValue(),C="";return u&&(C=zn(u)?u.checked?"true":"false":u.value),u=C,u!==y?(p.setValue(u),!0):!1}function dn(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 Wi=/[\n"\\]/g;function vn(u){return u.replace(Wi,function(p){return"\\"+p.charCodeAt(0).toString(16)+" "})}function ts(u,p,y,C,I,U,me,je){u.name="",me!=null&&typeof me!="function"&&typeof me!="symbol"&&typeof me!="boolean"?u.type=me:u.removeAttribute("type"),p!=null?me==="number"?(p===0&&u.value===""||u.value!=p)&&(u.value=""+Cn(p)):u.value!==""+Cn(p)&&(u.value=""+Cn(p)):me!=="submit"&&me!=="reset"||u.removeAttribute("value"),p!=null?Li(u,me,Cn(p)):y!=null?Li(u,me,Cn(y)):C!=null&&u.removeAttribute("value"),I==null&&U!=null&&(u.defaultChecked=!!U),I!=null&&(u.checked=I&&typeof I!="function"&&typeof I!="symbol"),je!=null&&typeof je!="function"&&typeof je!="symbol"&&typeof je!="boolean"?u.name=""+Cn(je):u.removeAttribute("name")}function Ds(u,p,y,C,I,U,me,je){if(U!=null&&typeof U!="function"&&typeof U!="symbol"&&typeof U!="boolean"&&(u.type=U),p!=null||y!=null){if(!(U!=="submit"&&U!=="reset"||p!=null)){Xn(u);return}y=y!=null?""+Cn(y):"",p=p!=null?""+Cn(p):y,je||p===u.value||(u.value=p),u.defaultValue=p}C=C??I,C=typeof C!="function"&&typeof C!="symbol"&&!!C,u.checked=je?u.checked:!!C,u.defaultChecked=!!C,me!=null&&typeof me!="function"&&typeof me!="symbol"&&typeof me!="boolean"&&(u.name=me),Xn(u)}function Li(u,p,y){p==="number"&&dn(u.ownerDocument)===u||u.defaultValue===""+y||(u.defaultValue=""+y)}function ws(u,p,y,C){if(u=u.options,p){p={};for(var I=0;I<y.length;I++)p["$"+y[I]]=!0;for(y=0;y<u.length;y++)I=p.hasOwnProperty("$"+u[y].value),u[y].selected!==I&&(u[y].selected=I),I&&C&&(u[y].defaultSelected=!0)}else{for(y=""+Cn(y),p=null,I=0;I<u.length;I++){if(u[I].value===y){u[I].selected=!0,C&&(u[I].defaultSelected=!0);return}p!==null||u[I].disabled||(p=u[I])}p!==null&&(p.selected=!0)}}function wr(u,p,y){if(p!=null&&(p=""+Cn(p),p!==u.value&&(u.value=p),y==null)){u.defaultValue!==p&&(u.defaultValue=p);return}u.defaultValue=y!=null?""+Cn(y):""}function mi(u,p,y,C){if(p==null){if(C!=null){if(y!=null)throw Error(r(92));if(V(C)){if(1<C.length)throw Error(r(93));C=C[0]}y=C}y==null&&(y=""),p=y}y=Cn(p),u.defaultValue=y,C=u.textContent,C===y&&C!==""&&C!==null&&(u.value=C),Xn(u)}function Os(u,p){if(p){var y=u.firstChild;if(y&&y===u.lastChild&&y.nodeType===3){y.nodeValue=p;return}}u.textContent=p}var ji=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 na(u,p,y){var C=p.indexOf("--")===0;y==null||typeof y=="boolean"||y===""?C?u.setProperty(p,""):p==="float"?u.cssFloat="":u[p]="":C?u.setProperty(p,y):typeof y!="number"||y===0||ji.has(p)?p==="float"?u.cssFloat=y:u[p]=(""+y).trim():u[p]=y+"px"}function ba(u,p,y){if(p!=null&&typeof p!="object")throw Error(r(62));if(u=u.style,y!=null){for(var C in y)!y.hasOwnProperty(C)||p!=null&&p.hasOwnProperty(C)||(C.indexOf("--")===0?u.setProperty(C,""):C==="float"?u.cssFloat="":u[C]="");for(var I in p)C=p[I],p.hasOwnProperty(I)&&y[I]!==C&&na(u,I,C)}else for(var U in p)p.hasOwnProperty(U)&&na(u,U,p[U])}function Pa(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 ic=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"]]),El=/^[\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 _a(u){return El.test(""+u)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":u}function Ls(){}var sc=null;function el(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Ia=null,Da=null;function Xc(u){var p=bn(u);if(p&&(u=p.stateNode)){var y=u[hn]||null;e:switch(u=p.stateNode,p.type){case"input":if(ts(u,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name),p=y.name,y.type==="radio"&&p!=null){for(y=u;y.parentNode;)y=y.parentNode;for(y=y.querySelectorAll('input[name="'+vn(""+p)+'"][type="radio"]'),p=0;p<y.length;p++){var C=y[p];if(C!==u&&C.form===u.form){var I=C[hn]||null;if(!I)throw Error(r(90));ts(C,I.value,I.defaultValue,I.defaultValue,I.checked,I.defaultChecked,I.type,I.name)}}for(p=0;p<y.length;p++)C=y[p],C.form===u.form&&ir(C)}break e;case"textarea":wr(u,y.value,y.defaultValue);break e;case"select":p=y.value,p!=null&&ws(u,!!y.multiple,p,!1)}}}var Yc=!1;function oc(u,p,y){if(Yc)return u(p,y);Yc=!0;try{var C=u(p);return C}finally{if(Yc=!1,(Ia!==null||Da!==null)&&(ru(),Ia&&(p=Ia,u=Da,Da=Ia=null,Xc(p),u)))for(p=0;p<u.length;p++)Xc(u[p])}}function ra(u,p){var y=u.stateNode;if(y===null)return null;var C=y[hn]||null;if(C===null)return null;y=C[p];e:switch(p){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(C=!C.disabled)||(u=u.type,C=!(u==="button"||u==="input"||u==="select"||u==="textarea")),u=!C;break e;default:u=!1}if(u)return null;if(y&&typeof y!="function")throw Error(r(231,p,typeof y));return y}var ho=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Uo=!1;if(ho)try{var Al={};Object.defineProperty(Al,"passive",{get:function(){Uo=!0}}),window.addEventListener("test",Al,Al),window.removeEventListener("test",Al,Al)}catch{Uo=!1}var Ss=null,tl=null,nl=null;function Kc(){if(nl)return nl;var u,p=tl,y=p.length,C,I="value"in Ss?Ss.value:Ss.textContent,U=I.length;for(u=0;u<y&&p[u]===I[u];u++);var me=y-u;for(C=1;C<=me&&p[y-C]===I[U-C];C++);return nl=I.slice(u,1<C?1-C:void 0)}function ii(u){var p=u.keyCode;return"charCode"in u?(u=u.charCode,u===0&&p===13&&(u=13)):u=p,u===10&&(u=13),32<=u||u===13?u:0}function Wr(){return!0}function ia(){return!1}function Sr(u){function p(y,C,I,U,me){this._reactName=y,this._targetInst=I,this.type=C,this.nativeEvent=U,this.target=me,this.currentTarget=null;for(var je in u)u.hasOwnProperty(je)&&(y=u[je],this[je]=y?y(U):U[je]);return this.isDefaultPrevented=(U.defaultPrevented!=null?U.defaultPrevented:U.returnValue===!1)?Wr:ia,this.isPropagationStopped=ia,this}return h(p.prototype,{preventDefault:function(){this.defaultPrevented=!0;var y=this.nativeEvent;y&&(y.preventDefault?y.preventDefault():typeof y.returnValue!="unknown"&&(y.returnValue=!1),this.isDefaultPrevented=Wr)},stopPropagation:function(){var y=this.nativeEvent;y&&(y.stopPropagation?y.stopPropagation():typeof y.cancelBubble!="unknown"&&(y.cancelBubble=!0),this.isPropagationStopped=Wr)},persist:function(){},isPersistent:Wr}),p}var Si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(u){return u.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zi=Sr(Si),Kr=h({},Si,{view:0,detail:0}),Oa=Sr(Kr),Nl,ac,Ao,xi=h({},Kr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qp,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!==Ao&&(Ao&&u.type==="mousemove"?(Nl=u.screenX-Ao.screenX,ac=u.screenY-Ao.screenY):ac=Nl=0,Ao=u),Nl)},movementY:function(u){return"movementY"in u?u.movementY:ac}}),Nh=Sr(xi),_d=h({},xi,{dataTransfer:0}),wd=Sr(_d),hf=h({},Kr,{relatedTarget:0}),wa=Sr(hf),Yi=h({},Si,{animationName:0,elapsedTime:0,pseudoElement:0}),Ks=Sr(Yi),Ms=h({},Si,{clipboardData:function(u){return"clipboardData"in u?u.clipboardData:window.clipboardData}}),kl=Sr(Ms),No=h({},Si,{data:0}),$p=Sr(No),kh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},J0={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"},pf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sd(u){var p=this.nativeEvent;return p.getModifierState?p.getModifierState(u):(u=pf[u])?!!p[u]:!1}function qp(){return Sd}var Xp=h({},Kr,{key:function(u){if(u.key){var p=kh[u.key]||u.key;if(p!=="Unidentified")return p}return u.type==="keypress"?(u=ii(u),u===13?"Enter":String.fromCharCode(u)):u.type==="keydown"||u.type==="keyup"?J0[u.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qp,charCode:function(u){return u.type==="keypress"?ii(u):0},keyCode:function(u){return u.type==="keydown"||u.type==="keyup"?u.keyCode:0},which:function(u){return u.type==="keypress"?ii(u):u.type==="keydown"||u.type==="keyup"?u.keyCode:0}}),Md=Sr(Xp),lc=h({},xi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),cc=Sr(lc),Td=h({},Kr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qp}),eg=Sr(Td),Yp=h({},Si,{propertyName:0,elapsedTime:0,pseudoElement:0}),tg=Sr(Yp),Zs=h({},xi,{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}),ng=Sr(Zs),rg=h({},Si,{newState:0,oldState:0}),ig=Sr(rg),sg=[9,13,27,32],Au=ho&&"CompositionEvent"in window,Cd=null;ho&&"documentMode"in document&&(Cd=document.documentMode);var Kp=ho&&"TextEvent"in window&&!Cd,Zp=ho&&(!Au||Cd&&8<Cd&&11>=Cd),og=" ",uc=!1;function Ed(u,p){switch(u){case"keyup":return sg.indexOf(p.keyCode)!==-1;case"keydown":return p.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function js(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Nu=!1;function Ts(u,p){switch(u){case"compositionend":return js(p);case"keypress":return p.which!==32?null:(uc=!0,og);case"textInput":return u=p.data,u===og&&uc?null:u;default:return null}}function Qp(u,p){if(Nu)return u==="compositionend"||!Au&&Ed(u,p)?(u=Kc(),nl=tl=Ss=null,Nu=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(p.ctrlKey||p.altKey||p.metaKey)||p.ctrlKey&&p.altKey){if(p.char&&1<p.char.length)return p.char;if(p.which)return String.fromCharCode(p.which)}return null;case"compositionend":return Zp&&p.locale!=="ko"?null:p.data;default:return null}}var Rh={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 Ad(u){var p=u&&u.nodeName&&u.nodeName.toLowerCase();return p==="input"?!!Rh[u.type]:p==="textarea"}function Jp(u,p,y,C){Ia?Da?Da.push(C):Da=[C]:Ia=C,p=o4(p,"onChange"),0<p.length&&(y=new zi("onChange","change",null,y,C),u.push({event:y,listeners:p}))}var ku=null,Zc=null;function ve(u){LI(u,0)}function Ie(u){var p=On(u);if(ir(p))return u}function Xe(u,p){if(u==="change")return p}var Ye=!1;if(ho){var ht;if(ho){var Mt="oninput"in document;if(!Mt){var Xt=document.createElement("div");Xt.setAttribute("oninput","return;"),Mt=typeof Xt.oninput=="function"}ht=Mt}else ht=!1;Ye=ht&&(!document.documentMode||9<document.documentMode)}function nn(){ku&&(ku.detachEvent("onpropertychange",fn),Zc=ku=null)}function fn(u){if(u.propertyName==="value"&&Ie(Zc)){var p=[];Jp(p,Zc,u,el(u)),oc(ve,p)}}function Nn(u,p,y){u==="focusin"?(nn(),ku=p,Zc=y,ku.attachEvent("onpropertychange",fn)):u==="focusout"&&nn()}function kn(u){if(u==="selectionchange"||u==="keyup"||u==="keydown")return Ie(Zc)}function Dn(u,p){if(u==="click")return Ie(p)}function cr(u,p){if(u==="input"||u==="change")return Ie(p)}function ei(u,p){return u===p&&(u!==0||1/u===1/p)||u!==u&&p!==p}var ur=typeof Object.is=="function"?Object.is:ei;function yr(u,p){if(ur(u,p))return!0;if(typeof u!="object"||u===null||typeof p!="object"||p===null)return!1;var y=Object.keys(u),C=Object.keys(p);if(y.length!==C.length)return!1;for(C=0;C<y.length;C++){var I=y[C];if(!He.call(p,I)||!ur(u[I],p[I]))return!1}return!0}function Yn(u){for(;u&&u.firstChild;)u=u.firstChild;return u}function Un(u,p){var y=Yn(u);u=0;for(var C;y;){if(y.nodeType===3){if(C=u+y.textContent.length,u<=p&&C>=p)return{node:y,offset:p-u};u=C}e:{for(;y;){if(y.nextSibling){y=y.nextSibling;break e}y=y.parentNode}y=void 0}y=Yn(y)}}function er(u,p){return u&&p?u===p?!0:u&&u.nodeType===3?!1:p&&p.nodeType===3?er(u,p.parentNode):"contains"in u?u.contains(p):u.compareDocumentPosition?!!(u.compareDocumentPosition(p)&16):!1:!1}function ns(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var p=dn(u.document);p instanceof u.HTMLIFrameElement;){try{var y=typeof p.contentWindow.location.href=="string"}catch{y=!1}if(y)u=p.contentWindow;else break;p=dn(u.document)}return p}function zs(u){var p=u&&u.nodeName&&u.nodeName.toLowerCase();return p&&(p==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||p==="textarea"||u.contentEditable==="true")}var vi=ho&&"documentMode"in document&&11>=document.documentMode,ui=null,ds=null,Fs=null,sa=!1;function Bo(u,p,y){var C=y.window===y?y.document:y.nodeType===9?y:y.ownerDocument;sa||ui==null||ui!==dn(C)||(C=ui,"selectionStart"in C&&zs(C)?C={start:C.selectionStart,end:C.selectionEnd}:(C=(C.ownerDocument&&C.ownerDocument.defaultView||window).getSelection(),C={anchorNode:C.anchorNode,anchorOffset:C.anchorOffset,focusNode:C.focusNode,focusOffset:C.focusOffset}),Fs&&yr(Fs,C)||(Fs=C,C=o4(ds,"onSelect"),0<C.length&&(p=new zi("onSelect","select",null,p,y),u.push({event:p,listeners:C}),p.target=ui)))}function $i(u,p){var y={};return y[u.toLowerCase()]=p.toLowerCase(),y["Webkit"+u]="webkit"+p,y["Moz"+u]="moz"+p,y}var Qs={animationend:$i("Animation","AnimationEnd"),animationiteration:$i("Animation","AnimationIteration"),animationstart:$i("Animation","AnimationStart"),transitionrun:$i("Transition","TransitionRun"),transitionstart:$i("Transition","TransitionStart"),transitioncancel:$i("Transition","TransitionCancel"),transitionend:$i("Transition","TransitionEnd")},Ho={},La={};ho&&(La=document.createElement("div").style,"AnimationEvent"in window||(delete Qs.animationend.animation,delete Qs.animationiteration.animation,delete Qs.animationstart.animation),"TransitionEvent"in window||delete Qs.transitionend.transition);function po(u){if(Ho[u])return Ho[u];if(!Qs[u])return u;var p=Qs[u],y;for(y in p)if(p.hasOwnProperty(y)&&y in La)return Ho[u]=p[y];return u}var mo=po("animationend"),ko=po("animationiteration"),Qc=po("animationstart"),Go=po("transitionrun"),tv=po("transitionstart"),c3=po("transitioncancel"),pb=po("transitionend"),dc=new Map,ag="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(" ");ag.push("scrollEnd");function fc(u,p){dc.set(u,p),xt(p,[u])}var lg=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var p=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(p))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}console.error(u)},hc=[],Nd=0,Vo=0;function cg(){for(var u=Nd,p=Vo=Nd=0;p<u;){var y=hc[p];hc[p++]=null;var C=hc[p];hc[p++]=null;var I=hc[p];hc[p++]=null;var U=hc[p];if(hc[p++]=null,C!==null&&I!==null){var me=C.pending;me===null?I.next=I:(I.next=me.next,me.next=I),C.pending=I}U!==0&&mf(y,I,U)}}function Wo(u,p,y,C){hc[Nd++]=u,hc[Nd++]=p,hc[Nd++]=y,hc[Nd++]=C,Vo|=C,u.lanes|=C,u=u.alternate,u!==null&&(u.lanes|=C)}function nv(u,p,y,C){return Wo(u,p,y,C),pc(u)}function ja(u,p){return Wo(u,null,null,p),pc(u)}function mf(u,p,y){u.lanes|=y;var C=u.alternate;C!==null&&(C.lanes|=y);for(var I=!1,U=u.return;U!==null;)U.childLanes|=y,C=U.alternate,C!==null&&(C.childLanes|=y),U.tag===22&&(u=U.stateNode,u===null||u._visibility&1||(I=!0)),u=U,U=U.return;return u.tag===3?(U=u.stateNode,I&&p!==null&&(I=31-Pe(y),u=U.hiddenUpdates,C=u[I],C===null?u[I]=[p]:C.push(p),p.lane=y|536870912),U):null}function pc(u){if(50<Df)throw Df=0,Kh=null,Error(r(185));for(var p=u.return;p!==null;)u=p,p=u.return;return u.tag===3?u.stateNode:null}var gf={};function mb(u,p,y,C){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=p,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Cs(u,p,y,C){return new mb(u,p,y,C)}function rv(u){return u=u.prototype,!(!u||!u.isReactComponent)}function rl(u,p){var y=u.alternate;return y===null?(y=Cs(u.tag,p,u.key,u.mode),y.elementType=u.elementType,y.type=u.type,y.stateNode=u.stateNode,y.alternate=u,u.alternate=y):(y.pendingProps=p,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,p=u.dependencies,y.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},y.sibling=u.sibling,y.index=u.index,y.ref=u.ref,y.refCleanup=u.refCleanup,y}function em(u,p){u.flags&=65011714;var y=u.alternate;return y===null?(u.childLanes=0,u.lanes=p,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,p=y.dependencies,u.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext}),u}function Ru(u,p,y,C,I,U){var me=0;if(C=u,typeof u=="function")rv(u)&&(me=1);else if(typeof u=="string")me=fJ(u,y,ce.current)?26:u==="html"||u==="head"||u==="body"?27:5;else e:switch(u){case L:return u=Cs(31,y,p,I),u.elementType=L,u.lanes=U,u;case _:return xf(y.children,I,U,p);case S:me=8,I|=24;break;case M:return u=Cs(12,y,p,I|2),u.elementType=M,u.lanes=U,u;case D:return u=Cs(13,y,p,I),u.elementType=D,u.lanes=U,u;case k:return u=Cs(19,y,p,I),u.elementType=k,u.lanes=U,u;default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case A:me=10;break e;case T:me=9;break e;case N:me=11;break e;case O:me=14;break e;case R:me=16,C=null;break e}me=29,y=Error(r(130,u===null?"null":typeof u,"")),C=null}return p=Cs(me,y,p,I),p.elementType=u,p.type=C,p.lanes=U,p}function xf(u,p,y,C){return u=Cs(7,u,C,p),u.lanes=y,u}function iv(u,p,y){return u=Cs(6,u,null,p),u.lanes=y,u}function tm(u){var p=Cs(18,null,null,0);return p.stateNode=u,p}function sv(u,p,y){return p=Cs(4,u.children!==null?u.children:[],u.key,p),p.lanes=y,p.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},p}var ug=new WeakMap;function Rl(u,p){if(typeof u=="object"&&u!==null){var y=ug.get(u);return y!==void 0?y:(p={value:u,source:p,stack:le(p)},ug.set(u,p),p)}return{value:u,source:p,stack:le(p)}}var vf=[],yf=0,nm=null,rm=0,il=[],fs=0,kd=null,Es=1,Jc="";function Pu(u,p){vf[yf++]=rm,vf[yf++]=nm,nm=u,rm=p}function u3(u,p,y){il[fs++]=Es,il[fs++]=Jc,il[fs++]=kd,kd=u;var C=Es;u=Jc;var I=32-Pe(C)-1;C&=~(1<<I),y+=1;var U=32-Pe(p)+I;if(30<U){var me=I-I%5;U=(C&(1<<me)-1).toString(32),C>>=me,I-=me,Es=1<<32-Pe(p)+I|y<<I|C,Jc=U+u}else Es=1<<U|y<<I|C,Jc=u}function Iu(u){u.return!==null&&(Pu(u,1),u3(u,1,0))}function ov(u){for(;u===nm;)nm=vf[--yf],vf[yf]=null,rm=vf[--yf],vf[yf]=null;for(;u===kd;)kd=il[--fs],il[fs]=null,Jc=il[--fs],il[fs]=null,Es=il[--fs],il[fs]=null}function av(u,p){il[fs++]=Es,il[fs++]=Jc,il[fs++]=kd,Es=p.id,Jc=p.overflow,kd=u}var Us=null,Ki=null,Zr=!1,Rd=null,Pl=!1,im=Error(r(519));function Du(u){var p=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ou(Rl(p,u)),im}function d3(u){var p=u.stateNode,y=u.type,C=u.memoizedProps;switch(p[Qt]=u,p[hn]=C,y){case"dialog":ni("cancel",p),ni("close",p);break;case"iframe":case"object":case"embed":ni("load",p);break;case"video":case"audio":for(y=0;y<Ec.length;y++)ni(Ec[y],p);break;case"source":ni("error",p);break;case"img":case"image":case"link":ni("error",p),ni("load",p);break;case"details":ni("toggle",p);break;case"input":ni("invalid",p),Ds(p,C.value,C.defaultValue,C.checked,C.defaultChecked,C.type,C.name,!0);break;case"select":ni("invalid",p);break;case"textarea":ni("invalid",p),mi(p,C.value,C.defaultValue,C.children)}y=C.children,typeof y!="string"&&typeof y!="number"&&typeof y!="bigint"||p.textContent===""+y||C.suppressHydrationWarning===!0||UI(p.textContent,y)?(C.popover!=null&&(ni("beforetoggle",p),ni("toggle",p)),C.onScroll!=null&&ni("scroll",p),C.onScrollEnd!=null&&ni("scrollend",p),C.onClick!=null&&(p.onclick=Ls),p=!0):p=!1,p||Du(u,!0)}function f3(u){for(Us=u.return;Us;)switch(Us.tag){case 5:case 31:case 13:Pl=!1;return;case 27:case 3:Pl=!0;return;default:Us=Us.return}}function sm(u){if(u!==Us)return!1;if(!Zr)return f3(u),Zr=!0,!1;var p=u.tag,y;if((y=p!==3&&p!==27)&&((y=p===5)&&(y=u.type,y=!(y!=="form"&&y!=="button")||YE(u.type,u.memoizedProps)),y=!y),y&&Ki&&Du(u),f3(u),p===13){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Ki=YI(u)}else if(p===31){if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));Ki=YI(u)}else p===27?(p=Ki,Tm(u.type)?(u=eA,eA=null,Ki=u):Ki=p):Ki=Us?Yu(u.stateNode.nextSibling):null;return!0}function bf(){Ki=Us=null,Zr=!1}function lv(){var u=Rd;return u!==null&&(Hs===null?Hs=u:Hs.push.apply(Hs,u),Rd=null),u}function Ou(u){Rd===null?Rd=[u]:Rd.push(u)}var om=j(null),_f=null,Lu=null;function Pd(u,p,y){F(om,p._currentValue),p._currentValue=y}function ju(u){u._currentValue=om.current,X(om)}function cv(u,p,y){for(;u!==null;){var C=u.alternate;if((u.childLanes&p)!==p?(u.childLanes|=p,C!==null&&(C.childLanes|=p)):C!==null&&(C.childLanes&p)!==p&&(C.childLanes|=p),u===y)break;u=u.return}}function uv(u,p,y,C){var I=u.child;for(I!==null&&(I.return=u);I!==null;){var U=I.dependencies;if(U!==null){var me=I.child;U=U.firstContext;e:for(;U!==null;){var je=U;U=I;for(var ct=0;ct<p.length;ct++)if(je.context===p[ct]){U.lanes|=y,je=U.alternate,je!==null&&(je.lanes|=y),cv(U.return,y,u),C||(me=null);break e}U=je.next}}else if(I.tag===18){if(me=I.return,me===null)throw Error(r(341));me.lanes|=y,U=me.alternate,U!==null&&(U.lanes|=y),cv(me,y,u),me=null}else me=I.child;if(me!==null)me.return=I;else for(me=I;me!==null;){if(me===u){me=null;break}if(I=me.sibling,I!==null){I.return=me.return,me=I;break}me=me.return}I=me}}function zu(u,p,y,C){u=null;for(var I=p,U=!1;I!==null;){if(!U){if((I.flags&524288)!==0)U=!0;else if((I.flags&262144)!==0)break}if(I.tag===10){var me=I.alternate;if(me===null)throw Error(r(387));if(me=me.memoizedProps,me!==null){var je=I.type;ur(I.pendingProps.value,me.value)||(u!==null?u.push(je):u=[je])}}else if(I===se.current){if(me=I.alternate,me===null)throw Error(r(387));me.memoizedState.memoizedState!==I.memoizedState.memoizedState&&(u!==null?u.push(f_):u=[f_])}I=I.return}u!==null&&uv(p,u,y,C),p.flags|=262144}function dg(u){for(u=u.firstContext;u!==null;){if(!ur(u.context._currentValue,u.memoizedValue))return!0;u=u.next}return!1}function wf(u){_f=u,Lu=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function dr(u){return h3(_f,u)}function am(u,p){return _f===null&&wf(u),h3(u,p)}function h3(u,p){var y=p._currentValue;if(p={context:p,memoizedValue:y,next:null},Lu===null){if(u===null)throw Error(r(308));Lu=p,u.dependencies={lanes:0,firstContext:p},u.flags|=524288}else Lu=Lu.next=p;return y}var p3=typeof AbortController<"u"?AbortController:function(){var u=[],p=this.signal={aborted:!1,addEventListener:function(y,C){u.push(C)}};this.abort=function(){p.aborted=!0,u.forEach(function(y){return y()})}},DE=t.unstable_scheduleCallback,OE=t.unstable_NormalPriority,go={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gb(){return{controller:new p3,data:new Map,refCount:0}}function Ph(u){u.refCount--,u.refCount===0&&DE(OE,function(){u.controller.abort()})}var Il=null,dv=0,Id=0,mc=null;function xb(u,p){if(Il===null){var y=Il=[];dv=0,Id=jt(),mc={status:"pending",value:void 0,then:function(C){y.push(C)}}}return dv++,p.then(vb,vb),p}function vb(){if(--dv===0&&Il!==null){mc!==null&&(mc.status="fulfilled");var u=Il;Il=null,Id=0,mc=null;for(var p=0;p<u.length;p++)(0,u[p])()}}function yb(u,p){var y=[],C={status:"pending",value:null,reason:null,then:function(I){y.push(I)}};return u.then(function(){C.status="fulfilled",C.value=p;for(var I=0;I<y.length;I++)(0,y[I])(p)},function(I){for(C.status="rejected",C.reason=I,I=0;I<y.length;I++)(0,y[I])(void 0)}),C}var m3=W.S;W.S=function(u,p){o_=Y(),typeof p=="object"&&p!==null&&typeof p.then=="function"&&xb(u,p),m3!==null&&m3(u,p)};var Sf=j(null);function fv(){var u=Sf.current;return u!==null?u:xr.pooledCache}function fg(u,p){p===null?F(Sf,Sf.current):F(Sf,p.pool)}function bb(){var u=fv();return u===null?null:{parent:go._currentValue,pool:u}}var Ih=Error(r(460)),hg=Error(r(474)),Pr=Error(r(542)),hv={then:function(){}};function sl(u){return u=u.status,u==="fulfilled"||u==="rejected"}function pv(u,p,y){switch(y=u[y],y===void 0?u.push(p):y!==p&&(p.then(Ls,Ls),p=y),p.status){case"fulfilled":return p.value;case"rejected":throw u=p.reason,Lh(u),u;default:if(typeof p.status=="string")p.then(Ls,Ls);else{if(u=xr,u!==null&&100<u.shellSuspendCounter)throw Error(r(482));u=p,u.status="pending",u.then(function(C){if(p.status==="pending"){var I=p;I.status="fulfilled",I.value=C}},function(C){if(p.status==="pending"){var I=p;I.status="rejected",I.reason=C}})}switch(p.status){case"fulfilled":return p.value;case"rejected":throw u=p.reason,Lh(u),u}throw Fu=p,Ih}}function Dh(u){try{var p=u._init;return p(u._payload)}catch(y){throw y!==null&&typeof y=="object"&&typeof y.then=="function"?(Fu=y,Ih):y}}var Fu=null;function Oh(){if(Fu===null)throw Error(r(459));var u=Fu;return Fu=null,u}function Lh(u){if(u===Ih||u===Pr)throw Error(r(483))}var jh=null,zh=0;function pg(u){var p=zh;return zh+=1,jh===null&&(jh=[]),pv(jh,u,p)}function gc(u,p){p=p.props.ref,u.ref=p!==void 0?p:null}function lm(u,p){throw p.$$typeof===m?Error(r(525)):(u=Object.prototype.toString.call(p),Error(r(31,u==="[object Object]"?"object with keys {"+Object.keys(p).join(", ")+"}":u)))}function mv(u){function p(_t,mt){if(u){var Et=_t.deletions;Et===null?(_t.deletions=[mt],_t.flags|=16):Et.push(mt)}}function y(_t,mt){if(!u)return null;for(;mt!==null;)p(_t,mt),mt=mt.sibling;return null}function C(_t){for(var mt=new Map;_t!==null;)_t.key!==null?mt.set(_t.key,_t):mt.set(_t.index,_t),_t=_t.sibling;return mt}function I(_t,mt){return _t=rl(_t,mt),_t.index=0,_t.sibling=null,_t}function U(_t,mt,Et){return _t.index=Et,u?(Et=_t.alternate,Et!==null?(Et=Et.index,Et<mt?(_t.flags|=67108866,mt):Et):(_t.flags|=67108866,mt)):(_t.flags|=1048576,mt)}function me(_t){return u&&_t.alternate===null&&(_t.flags|=67108866),_t}function je(_t,mt,Et,Kt){return mt===null||mt.tag!==6?(mt=iv(Et,_t.mode,Kt),mt.return=_t,mt):(mt=I(mt,Et),mt.return=_t,mt)}function ct(_t,mt,Et,Kt){var Jn=Et.type;return Jn===_?Wt(_t,mt,Et.props.children,Kt,Et.key):mt!==null&&(mt.elementType===Jn||typeof Jn=="object"&&Jn!==null&&Jn.$$typeof===R&&Dh(Jn)===mt.type)?(mt=I(mt,Et.props),gc(mt,Et),mt.return=_t,mt):(mt=Ru(Et.type,Et.key,Et.props,null,_t.mode,Kt),gc(mt,Et),mt.return=_t,mt)}function At(_t,mt,Et,Kt){return mt===null||mt.tag!==4||mt.stateNode.containerInfo!==Et.containerInfo||mt.stateNode.implementation!==Et.implementation?(mt=sv(Et,_t.mode,Kt),mt.return=_t,mt):(mt=I(mt,Et.children||[]),mt.return=_t,mt)}function Wt(_t,mt,Et,Kt,Jn){return mt===null||mt.tag!==7?(mt=xf(Et,_t.mode,Kt,Jn),mt.return=_t,mt):(mt=I(mt,Et),mt.return=_t,mt)}function Jt(_t,mt,Et){if(typeof mt=="string"&&mt!==""||typeof mt=="number"||typeof mt=="bigint")return mt=iv(""+mt,_t.mode,Et),mt.return=_t,mt;if(typeof mt=="object"&&mt!==null){switch(mt.$$typeof){case x:return Et=Ru(mt.type,mt.key,mt.props,null,_t.mode,Et),gc(Et,mt),Et.return=_t,Et;case b:return mt=sv(mt,_t.mode,Et),mt.return=_t,mt;case R:return mt=Dh(mt),Jt(_t,mt,Et)}if(V(mt)||$(mt))return mt=xf(mt,_t.mode,Et,null),mt.return=_t,mt;if(typeof mt.then=="function")return Jt(_t,pg(mt),Et);if(mt.$$typeof===A)return Jt(_t,am(_t,mt),Et);lm(_t,mt)}return null}function Rt(_t,mt,Et,Kt){var Jn=mt!==null?mt.key:null;if(typeof Et=="string"&&Et!==""||typeof Et=="number"||typeof Et=="bigint")return Jn!==null?null:je(_t,mt,""+Et,Kt);if(typeof Et=="object"&&Et!==null){switch(Et.$$typeof){case x:return Et.key===Jn?ct(_t,mt,Et,Kt):null;case b:return Et.key===Jn?At(_t,mt,Et,Kt):null;case R:return Et=Dh(Et),Rt(_t,mt,Et,Kt)}if(V(Et)||$(Et))return Jn!==null?null:Wt(_t,mt,Et,Kt,null);if(typeof Et.then=="function")return Rt(_t,mt,pg(Et),Kt);if(Et.$$typeof===A)return Rt(_t,mt,am(_t,Et),Kt);lm(_t,Et)}return null}function Ut(_t,mt,Et,Kt,Jn){if(typeof Kt=="string"&&Kt!==""||typeof Kt=="number"||typeof Kt=="bigint")return _t=_t.get(Et)||null,je(mt,_t,""+Kt,Jn);if(typeof Kt=="object"&&Kt!==null){switch(Kt.$$typeof){case x:return _t=_t.get(Kt.key===null?Et:Kt.key)||null,ct(mt,_t,Kt,Jn);case b:return _t=_t.get(Kt.key===null?Et:Kt.key)||null,At(mt,_t,Kt,Jn);case R:return Kt=Dh(Kt),Ut(_t,mt,Et,Kt,Jn)}if(V(Kt)||$(Kt))return _t=_t.get(Et)||null,Wt(mt,_t,Kt,Jn,null);if(typeof Kt.then=="function")return Ut(_t,mt,Et,pg(Kt),Jn);if(Kt.$$typeof===A)return Ut(_t,mt,Et,am(mt,Kt),Jn);lm(mt,Kt)}return null}function Bn(_t,mt,Et,Kt){for(var Jn=null,Mi=null,Wn=mt,zr=mt=0,oi=null;Wn!==null&&zr<Et.length;zr++){Wn.index>zr?(oi=Wn,Wn=null):oi=Wn.sibling;var Ti=Rt(_t,Wn,Et[zr],Kt);if(Ti===null){Wn===null&&(Wn=oi);break}u&&Wn&&Ti.alternate===null&&p(_t,Wn),mt=U(Ti,mt,zr),Mi===null?Jn=Ti:Mi.sibling=Ti,Mi=Ti,Wn=oi}if(zr===Et.length)return y(_t,Wn),Zr&&Pu(_t,zr),Jn;if(Wn===null){for(;zr<Et.length;zr++)Wn=Jt(_t,Et[zr],Kt),Wn!==null&&(mt=U(Wn,mt,zr),Mi===null?Jn=Wn:Mi.sibling=Wn,Mi=Wn);return Zr&&Pu(_t,zr),Jn}for(Wn=C(Wn);zr<Et.length;zr++)oi=Ut(Wn,_t,zr,Et[zr],Kt),oi!==null&&(u&&oi.alternate!==null&&Wn.delete(oi.key===null?zr:oi.key),mt=U(oi,mt,zr),Mi===null?Jn=oi:Mi.sibling=oi,Mi=oi);return u&&Wn.forEach(function(km){return p(_t,km)}),Zr&&Pu(_t,zr),Jn}function lr(_t,mt,Et,Kt){if(Et==null)throw Error(r(151));for(var Jn=null,Mi=null,Wn=mt,zr=mt=0,oi=null,Ti=Et.next();Wn!==null&&!Ti.done;zr++,Ti=Et.next()){Wn.index>zr?(oi=Wn,Wn=null):oi=Wn.sibling;var km=Rt(_t,Wn,Ti.value,Kt);if(km===null){Wn===null&&(Wn=oi);break}u&&Wn&&km.alternate===null&&p(_t,Wn),mt=U(km,mt,zr),Mi===null?Jn=km:Mi.sibling=km,Mi=km,Wn=oi}if(Ti.done)return y(_t,Wn),Zr&&Pu(_t,zr),Jn;if(Wn===null){for(;!Ti.done;zr++,Ti=Et.next())Ti=Jt(_t,Ti.value,Kt),Ti!==null&&(mt=U(Ti,mt,zr),Mi===null?Jn=Ti:Mi.sibling=Ti,Mi=Ti);return Zr&&Pu(_t,zr),Jn}for(Wn=C(Wn);!Ti.done;zr++,Ti=Et.next())Ti=Ut(Wn,_t,zr,Ti.value,Kt),Ti!==null&&(u&&Ti.alternate!==null&&Wn.delete(Ti.key===null?zr:Ti.key),mt=U(Ti,mt,zr),Mi===null?Jn=Ti:Mi.sibling=Ti,Mi=Ti);return u&&Wn.forEach(function(SJ){return p(_t,SJ)}),Zr&&Pu(_t,zr),Jn}function Ji(_t,mt,Et,Kt){if(typeof Et=="object"&&Et!==null&&Et.type===_&&Et.key===null&&(Et=Et.props.children),typeof Et=="object"&&Et!==null){switch(Et.$$typeof){case x:e:{for(var Jn=Et.key;mt!==null;){if(mt.key===Jn){if(Jn=Et.type,Jn===_){if(mt.tag===7){y(_t,mt.sibling),Kt=I(mt,Et.props.children),Kt.return=_t,_t=Kt;break e}}else if(mt.elementType===Jn||typeof Jn=="object"&&Jn!==null&&Jn.$$typeof===R&&Dh(Jn)===mt.type){y(_t,mt.sibling),Kt=I(mt,Et.props),gc(Kt,Et),Kt.return=_t,_t=Kt;break e}y(_t,mt);break}else p(_t,mt);mt=mt.sibling}Et.type===_?(Kt=xf(Et.props.children,_t.mode,Kt,Et.key),Kt.return=_t,_t=Kt):(Kt=Ru(Et.type,Et.key,Et.props,null,_t.mode,Kt),gc(Kt,Et),Kt.return=_t,_t=Kt)}return me(_t);case b:e:{for(Jn=Et.key;mt!==null;){if(mt.key===Jn)if(mt.tag===4&&mt.stateNode.containerInfo===Et.containerInfo&&mt.stateNode.implementation===Et.implementation){y(_t,mt.sibling),Kt=I(mt,Et.children||[]),Kt.return=_t,_t=Kt;break e}else{y(_t,mt);break}else p(_t,mt);mt=mt.sibling}Kt=sv(Et,_t.mode,Kt),Kt.return=_t,_t=Kt}return me(_t);case R:return Et=Dh(Et),Ji(_t,mt,Et,Kt)}if(V(Et))return Bn(_t,mt,Et,Kt);if($(Et)){if(Jn=$(Et),typeof Jn!="function")throw Error(r(150));return Et=Jn.call(Et),lr(_t,mt,Et,Kt)}if(typeof Et.then=="function")return Ji(_t,mt,pg(Et),Kt);if(Et.$$typeof===A)return Ji(_t,mt,am(_t,Et),Kt);lm(_t,Et)}return typeof Et=="string"&&Et!==""||typeof Et=="number"||typeof Et=="bigint"?(Et=""+Et,mt!==null&&mt.tag===6?(y(_t,mt.sibling),Kt=I(mt,Et),Kt.return=_t,_t=Kt):(y(_t,mt),Kt=iv(Et,_t.mode,Kt),Kt.return=_t,_t=Kt),me(_t)):y(_t,mt)}return function(_t,mt,Et,Kt){try{zh=0;var Jn=Ji(_t,mt,Et,Kt);return jh=null,Jn}catch(Wn){if(Wn===Ih||Wn===Pr)throw Wn;var Mi=Cs(29,Wn,null,_t.mode);return Mi.lanes=Kt,Mi.return=_t,Mi}finally{}}}var Dd=mv(!0),gv=mv(!1),za=!1;function mg(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function _b(u,p){u=u.updateQueue,p.updateQueue===u&&(p.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function Od(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function Mf(u,p,y){var C=u.updateQueue;if(C===null)return null;if(C=C.shared,($n&2)!==0){var I=C.pending;return I===null?p.next=p:(p.next=I.next,I.next=p),C.pending=p,p=pc(u),mf(u,null,y),p}return Wo(u,C,p,y),pc(u)}function Tf(u,p,y){if(p=p.updateQueue,p!==null&&(p=p.shared,(y&4194048)!==0)){var C=p.lanes;C&=u.pendingLanes,y|=C,p.lanes=y,kt(u,y)}}function Qn(u,p){var y=u.updateQueue,C=u.alternate;if(C!==null&&(C=C.updateQueue,y===C)){var I=null,U=null;if(y=y.firstBaseUpdate,y!==null){do{var me={lane:y.lane,tag:y.tag,payload:y.payload,callback:null,next:null};U===null?I=U=me:U=U.next=me,y=y.next}while(y!==null);U===null?I=U=p:U=U.next=p}else I=U=p;y={baseState:C.baseState,firstBaseUpdate:I,lastBaseUpdate:U,shared:C.shared,callbacks:C.callbacks},u.updateQueue=y;return}u=y.lastBaseUpdate,u===null?y.firstBaseUpdate=p:u.next=p,y.lastBaseUpdate=p}var wb=!1;function gg(){if(wb){var u=mc;if(u!==null)throw u}}function cm(u,p,y,C){wb=!1;var I=u.updateQueue;za=!1;var U=I.firstBaseUpdate,me=I.lastBaseUpdate,je=I.shared.pending;if(je!==null){I.shared.pending=null;var ct=je,At=ct.next;ct.next=null,me===null?U=At:me.next=At,me=ct;var Wt=u.alternate;Wt!==null&&(Wt=Wt.updateQueue,je=Wt.lastBaseUpdate,je!==me&&(je===null?Wt.firstBaseUpdate=At:je.next=At,Wt.lastBaseUpdate=ct))}if(U!==null){var Jt=I.baseState;me=0,Wt=At=ct=null,je=U;do{var Rt=je.lane&-536870913,Ut=Rt!==je.lane;if(Ut?(kr&Rt)===Rt:(C&Rt)===Rt){Rt!==0&&Rt===Id&&(wb=!0),Wt!==null&&(Wt=Wt.next={lane:0,tag:je.tag,payload:je.payload,callback:null,next:null});e:{var Bn=u,lr=je;Rt=p;var Ji=y;switch(lr.tag){case 1:if(Bn=lr.payload,typeof Bn=="function"){Jt=Bn.call(Ji,Jt,Rt);break e}Jt=Bn;break e;case 3:Bn.flags=Bn.flags&-65537|128;case 0:if(Bn=lr.payload,Rt=typeof Bn=="function"?Bn.call(Ji,Jt,Rt):Bn,Rt==null)break e;Jt=h({},Jt,Rt);break e;case 2:za=!0}}Rt=je.callback,Rt!==null&&(u.flags|=64,Ut&&(u.flags|=8192),Ut=I.callbacks,Ut===null?I.callbacks=[Rt]:Ut.push(Rt))}else Ut={lane:Rt,tag:je.tag,payload:je.payload,callback:je.callback,next:null},Wt===null?(At=Wt=Ut,ct=Jt):Wt=Wt.next=Ut,me|=Rt;if(je=je.next,je===null){if(je=I.shared.pending,je===null)break;Ut=je,je=Ut.next,Ut.next=null,I.lastBaseUpdate=Ut,I.shared.pending=null}}while(!0);Wt===null&&(ct=Jt),I.baseState=ct,I.firstBaseUpdate=At,I.lastBaseUpdate=Wt,U===null&&(I.shared.lanes=0),$u|=me,u.lanes=me,u.memoizedState=Jt}}function um(u,p){if(typeof u!="function")throw Error(r(191,u));u.call(p)}function g3(u,p){var y=u.callbacks;if(y!==null)for(u.callbacks=null,u=0;u<y.length;u++)um(y[u],p)}var dm=j(null),xv=j(0);function x3(u,p){u=jl,F(xv,u),F(dm,p),jl=u|p.baseLanes}function Sb(){F(xv,jl),F(dm,dm.current)}function xg(){jl=xv.current,X(dm),X(xv)}var ol=j(null),Fa=null;function Ld(u){var p=u.alternate;F(Qr,Qr.current&1),F(ol,u),Fa===null&&(p===null||dm.current!==null||p.memoizedState!==null)&&(Fa=u)}function Mb(u){F(Qr,Qr.current),F(ol,u),Fa===null&&(Fa=u)}function v3(u){u.tag===22?(F(Qr,Qr.current),F(ol,u),Fa===null&&(Fa=u)):al()}function al(){F(Qr,Qr.current),F(ol,ol.current)}function Js(u){X(ol),Fa===u&&(Fa=null),X(Qr)}var Qr=j(0);function Dl(u){for(var p=u;p!==null;){if(p.tag===13){var y=p.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||QE(y)||JE(y)))return p}else if(p.tag===19&&(p.memoizedProps.revealOrder==="forwards"||p.memoizedProps.revealOrder==="backwards"||p.memoizedProps.revealOrder==="unstable_legacy-backwards"||p.memoizedProps.revealOrder==="together")){if((p.flags&128)!==0)return p}else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===u)break;for(;p.sibling===null;){if(p.return===null||p.return===u)return null;p=p.return}p.sibling.return=p.return,p=p.sibling}return null}var hs=0,Mr=null,Fi=null,$r=null,xc=!1,fm=!1,Fh=!1,vv=0,vg=0,hm=null,Tb=0;function As(){throw Error(r(321))}function Cb(u,p){if(p===null)return!1;for(var y=0;y<p.length&&y<u.length;y++)if(!ur(u[y],p[y]))return!1;return!0}function yv(u,p,y,C,I,U){return hs=U,Mr=p,p.memoizedState=null,p.updateQueue=null,p.lanes=0,W.H=u===null||u.memoizedState===null?K3:$b,Fh=!1,U=y(C,I),Fh=!1,fm&&(U=Uh(p,y,C,I)),y3(u),U}function y3(u){W.H=pm;var p=Fi!==null&&Fi.next!==null;if(hs=0,$r=Fi=Mr=null,xc=!1,vg=0,hm=null,p)throw Error(r(300));u===null||xo||(u=u.dependencies,u!==null&&dg(u)&&(xo=!0))}function Uh(u,p,y,C){Mr=u;var I=0;do{if(fm&&(hm=null),vg=0,fm=!1,25<=I)throw Error(r(301));if(I+=1,$r=Fi=null,u.updateQueue!=null){var U=u.updateQueue;U.lastEffect=null,U.events=null,U.stores=null,U.memoCache!=null&&(U.memoCache.index=0)}W.H=vc,U=p(y,C)}while(fm);return U}function Bh(){var u=W.H,p=u.useState()[0];return p=typeof p.then=="function"?yg(p):p,u=u.useState()[0],(Fi!==null?Fi.memoizedState:null)!==u&&(Mr.flags|=1024),p}function Eb(){var u=vv!==0;return vv=0,u}function Ab(u,p,y){p.updateQueue=u.updateQueue,p.flags&=-2053,u.lanes&=~y}function Nb(u){if(xc){for(u=u.memoizedState;u!==null;){var p=u.queue;p!==null&&(p.pending=null),u=u.next}xc=!1}hs=0,$r=Fi=Mr=null,fm=!1,vg=vv=0,hm=null}function Ro(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $r===null?Mr.memoizedState=$r=u:$r=$r.next=u,$r}function eo(){if(Fi===null){var u=Mr.alternate;u=u!==null?u.memoizedState:null}else u=Fi.next;var p=$r===null?Mr.memoizedState:$r.next;if(p!==null)$r=p,Fi=u;else{if(u===null)throw Mr.alternate===null?Error(r(467)):Error(r(310));Fi=u,u={memoizedState:Fi.memoizedState,baseState:Fi.baseState,baseQueue:Fi.baseQueue,queue:Fi.queue,next:null},$r===null?Mr.memoizedState=$r=u:$r=$r.next=u}return $r}function bv(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function yg(u){var p=vg;return vg+=1,hm===null&&(hm=[]),u=pv(hm,u,p),p=Mr,($r===null?p.memoizedState:$r.next)===null&&(p=p.alternate,W.H=p===null||p.memoizedState===null?K3:$b),u}function Cf(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return yg(u);if(u.$$typeof===A)return dr(u)}throw Error(r(438,String(u)))}function kb(u){var p=null,y=Mr.updateQueue;if(y!==null&&(p=y.memoCache),p==null){var C=Mr.alternate;C!==null&&(C=C.updateQueue,C!==null&&(C=C.memoCache,C!=null&&(p={data:C.data.map(function(I){return I.slice()}),index:0})))}if(p==null&&(p={data:[],index:0}),y===null&&(y=bv(),Mr.updateQueue=y),y.memoCache=p,y=p.data[p.index],y===void 0)for(y=p.data[p.index]=Array(u),C=0;C<u;C++)y[C]=B;return p.index++,y}function jd(u,p){return typeof p=="function"?p(u):p}function _v(u){var p=eo();return Rb(p,Fi,u)}function Rb(u,p,y){var C=u.queue;if(C===null)throw Error(r(311));C.lastRenderedReducer=y;var I=u.baseQueue,U=C.pending;if(U!==null){if(I!==null){var me=I.next;I.next=U.next,U.next=me}p.baseQueue=I=U,C.pending=null}if(U=u.baseState,I===null)u.memoizedState=U;else{p=I.next;var je=me=null,ct=null,At=p,Wt=!1;do{var Jt=At.lane&-536870913;if(Jt!==At.lane?(kr&Jt)===Jt:(hs&Jt)===Jt){var Rt=At.revertLane;if(Rt===0)ct!==null&&(ct=ct.next={lane:0,revertLane:0,gesture:null,action:At.action,hasEagerState:At.hasEagerState,eagerState:At.eagerState,next:null}),Jt===Id&&(Wt=!0);else if((hs&Rt)===Rt){At=At.next,Rt===Id&&(Wt=!0);continue}else Jt={lane:0,revertLane:At.revertLane,gesture:null,action:At.action,hasEagerState:At.hasEagerState,eagerState:At.eagerState,next:null},ct===null?(je=ct=Jt,me=U):ct=ct.next=Jt,Mr.lanes|=Rt,$u|=Rt;Jt=At.action,Fh&&y(U,Jt),U=At.hasEagerState?At.eagerState:y(U,Jt)}else Rt={lane:Jt,revertLane:At.revertLane,gesture:At.gesture,action:At.action,hasEagerState:At.hasEagerState,eagerState:At.eagerState,next:null},ct===null?(je=ct=Rt,me=U):ct=ct.next=Rt,Mr.lanes|=Jt,$u|=Jt;At=At.next}while(At!==null&&At!==p);if(ct===null?me=U:ct.next=je,!ur(U,u.memoizedState)&&(xo=!0,Wt&&(y=mc,y!==null)))throw y;u.memoizedState=U,u.baseState=me,u.baseQueue=ct,C.lastRenderedState=U}return I===null&&(C.lanes=0),[u.memoizedState,C.dispatch]}function Pb(u){var p=eo(),y=p.queue;if(y===null)throw Error(r(311));y.lastRenderedReducer=u;var C=y.dispatch,I=y.pending,U=p.memoizedState;if(I!==null){y.pending=null;var me=I=I.next;do U=u(U,me.action),me=me.next;while(me!==I);ur(U,p.memoizedState)||(xo=!0),p.memoizedState=U,p.baseQueue===null&&(p.baseState=U),y.lastRenderedState=U}return[U,C]}function b3(u,p,y){var C=Mr,I=eo(),U=Zr;if(U){if(y===void 0)throw Error(r(407));y=y()}else y=p();var me=!ur((Fi||I).memoizedState,y);if(me&&(I.memoizedState=y,xo=!0),I=I.queue,Ub(S3.bind(null,C,I,u),[u]),I.getSnapshot!==p||me||$r!==null&&$r.memoizedState.tag&1){if(C.flags|=2048,Ef(9,{destroy:void 0},w3.bind(null,C,I,y,p),null),xr===null)throw Error(r(349));U||(hs&127)!==0||_3(C,p,y)}return y}function _3(u,p,y){u.flags|=16384,u={getSnapshot:p,value:y},p=Mr.updateQueue,p===null?(p=bv(),Mr.updateQueue=p,p.stores=[u]):(y=p.stores,y===null?p.stores=[u]:y.push(u))}function w3(u,p,y,C){p.value=y,p.getSnapshot=C,M3(p)&&T3(u)}function S3(u,p,y){return y(function(){M3(p)&&T3(u)})}function M3(u){var p=u.getSnapshot;u=u.value;try{var y=p();return!ur(u,y)}catch{return!0}}function T3(u){var p=ja(u,2);p!==null&&Dr(p,u,2)}function Ib(u){var p=Ro();if(typeof u=="function"){var y=u;if(u=y(),Fh){st(!0);try{y()}finally{st(!1)}}}return p.memoizedState=p.baseState=u,p.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jd,lastRenderedState:u},p}function Db(u,p,y,C){return u.baseState=y,Rb(u,Fi,typeof C=="function"?C:jd)}function LE(u,p,y,C,I){if(Tv(u))throw Error(r(485));if(u=p.action,u!==null){var U={payload:I,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(me){U.listeners.push(me)}};W.T!==null?y(!0):U.isTransition=!1,C(U),y=p.pending,y===null?(U.next=p.pending=U,C3(p,U)):(U.next=y.next,p.pending=y.next=U)}}function C3(u,p){var y=p.action,C=p.payload,I=u.state;if(p.isTransition){var U=W.T,me={};W.T=me;try{var je=y(I,C),ct=W.S;ct!==null&&ct(me,je),E3(u,p,je)}catch(At){Ob(u,p,At)}finally{U!==null&&me.types!==null&&(U.types=me.types),W.T=U}}else try{U=y(I,C),E3(u,p,U)}catch(At){Ob(u,p,At)}}function E3(u,p,y){y!==null&&typeof y=="object"&&typeof y.then=="function"?y.then(function(C){A3(u,p,C)},function(C){return Ob(u,p,C)}):A3(u,p,y)}function A3(u,p,y){p.status="fulfilled",p.value=y,N3(p),u.state=y,p=u.pending,p!==null&&(y=p.next,y===p?u.pending=null:(y=y.next,p.next=y,C3(u,y)))}function Ob(u,p,y){var C=u.pending;if(u.pending=null,C!==null){C=C.next;do p.status="rejected",p.reason=y,N3(p),p=p.next;while(p!==C)}u.action=null}function N3(u){u=u.listeners;for(var p=0;p<u.length;p++)(0,u[p])()}function Lb(u,p){return p}function jb(u,p){if(Zr){var y=xr.formState;if(y!==null){e:{var C=Mr;if(Zr){if(Ki){t:{for(var I=Ki,U=Pl;I.nodeType!==8;){if(!U){I=null;break t}if(I=Yu(I.nextSibling),I===null){I=null;break t}}U=I.data,I=U==="F!"||U==="F"?I:null}if(I){Ki=Yu(I.nextSibling),C=I.data==="F!";break e}}Du(C)}C=!1}C&&(p=y[0])}}return y=Ro(),y.memoizedState=y.baseState=p,C={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lb,lastRenderedState:p},y.queue=C,y=q3.bind(null,Mr,C),C.dispatch=y,C=Ib(!1),U=Wb.bind(null,Mr,!1,C.queue),C=Ro(),I={state:p,dispatch:null,action:u,pending:null},C.queue=I,y=LE.bind(null,Mr,I,U,y),I.dispatch=y,C.memoizedState=u,[p,y,!1]}function k3(u){var p=eo();return zb(p,Fi,u)}function zb(u,p,y){if(p=Rb(u,p,Lb)[0],u=_v(jd)[0],typeof p=="object"&&p!==null&&typeof p.then=="function")try{var C=yg(p)}catch(me){throw me===Ih?Pr:me}else C=p;p=eo();var I=p.queue,U=I.dispatch;return y!==p.memoizedState&&(Mr.flags|=2048,Ef(9,{destroy:void 0},R3.bind(null,I,y),null)),[C,U,u]}function R3(u,p){u.action=p}function Fb(u){var p=eo(),y=Fi;if(y!==null)return zb(p,y,u);eo(),p=p.memoizedState,y=eo();var C=y.queue.dispatch;return y.memoizedState=u,[p,C,!1]}function Ef(u,p,y,C){return u={tag:u,create:y,deps:C,inst:p,next:null},p=Mr.updateQueue,p===null&&(p=bv(),Mr.updateQueue=p),y=p.lastEffect,y===null?p.lastEffect=u.next=u:(C=y.next,y.next=u,u.next=C,p.lastEffect=u),u}function wv(){return eo().memoizedState}function Sv(u,p,y,C){var I=Ro();Mr.flags|=u,I.memoizedState=Ef(1|p,{destroy:void 0},y,C===void 0?null:C)}function Mv(u,p,y,C){var I=eo();C=C===void 0?null:C;var U=I.memoizedState.inst;Fi!==null&&C!==null&&Cb(C,Fi.memoizedState.deps)?I.memoizedState=Ef(p,U,y,C):(Mr.flags|=u,I.memoizedState=Ef(1|p,U,y,C))}function P3(u,p){Sv(8390656,8,u,p)}function Ub(u,p){Mv(2048,8,u,p)}function I3(u){Mr.flags|=4;var p=Mr.updateQueue;if(p===null)p=bv(),Mr.updateQueue=p,p.events=[u];else{var y=p.events;y===null?p.events=[u]:y.push(u)}}function D3(u){var p=eo().memoizedState;return I3({ref:p,nextImpl:u}),function(){if(($n&2)!==0)throw Error(r(440));return p.impl.apply(void 0,arguments)}}function O3(u,p){return Mv(4,2,u,p)}function L3(u,p){return Mv(4,4,u,p)}function j3(u,p){if(typeof p=="function"){u=u();var y=p(u);return function(){typeof y=="function"?y():p(null)}}if(p!=null)return u=u(),p.current=u,function(){p.current=null}}function z3(u,p,y){y=y!=null?y.concat([u]):null,Mv(4,4,j3.bind(null,p,u),y)}function Bb(){}function F3(u,p){var y=eo();p=p===void 0?null:p;var C=y.memoizedState;return p!==null&&Cb(p,C[1])?C[0]:(y.memoizedState=[u,p],u)}function U3(u,p){var y=eo();p=p===void 0?null:p;var C=y.memoizedState;if(p!==null&&Cb(p,C[1]))return C[0];if(C=u(),Fh){st(!0);try{u()}finally{st(!1)}}return y.memoizedState=[C,p],C}function Hb(u,p,y){return y===void 0||(hs&1073741824)!==0&&(kr&261930)===0?u.memoizedState=p:(u.memoizedState=y,u=Br(),Mr.lanes|=u,$u|=u,y)}function B3(u,p,y,C){return ur(y,p)?y:dm.current!==null?(u=Hb(u,y,C),ur(u,p)||(xo=!0),u):(hs&42)===0||(hs&1073741824)!==0&&(kr&261930)===0?(xo=!0,u.memoizedState=y):(u=Br(),Mr.lanes|=u,$u|=u,p)}function H3(u,p,y,C,I){var U=J.p;J.p=U!==0&&8>U?U:8;var me=W.T,je={};W.T=je,Wb(u,!1,p,y);try{var ct=I(),At=W.S;if(At!==null&&At(je,ct),ct!==null&&typeof ct=="object"&&typeof ct.then=="function"){var Wt=yb(ct,C);bg(u,p,Wt,Fl(u))}else bg(u,p,C,Fl(u))}catch(Jt){bg(u,p,{then:function(){},status:"rejected",reason:Jt},Fl())}finally{J.p=U,me!==null&&je.types!==null&&(me.types=je.types),W.T=me}}function jE(){}function Gb(u,p,y,C){if(u.tag!==5)throw Error(r(476));var I=G3(u).queue;H3(u,I,p,ne,y===null?jE:function(){return V3(u),y(C)})}function G3(u){var p=u.memoizedState;if(p!==null)return p;p={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jd,lastRenderedState:ne},next:null};var y={};return p.next={memoizedState:y,baseState:y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jd,lastRenderedState:y},next:null},u.memoizedState=p,u=u.alternate,u!==null&&(u.memoizedState=p),p}function V3(u){var p=G3(u);p.next===null&&(p=u.alternate.memoizedState),bg(u,p.next.queue,{},Fl())}function Vb(){return dr(f_)}function W3(){return eo().memoizedState}function $3(){return eo().memoizedState}function zE(u){for(var p=u.return;p!==null;){switch(p.tag){case 24:case 3:var y=Fl();u=Od(y);var C=Mf(p,u,y);C!==null&&(Dr(C,p,y),Tf(C,p,y)),p={cache:gb()},u.payload=p;return}p=p.return}}function FE(u,p,y){var C=Fl();y={lane:C,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},Tv(u)?X3(p,y):(y=nv(u,p,y,C),y!==null&&(Dr(y,u,C),Y3(y,p,C)))}function q3(u,p,y){var C=Fl();bg(u,p,y,C)}function bg(u,p,y,C){var I={lane:C,revertLane:0,gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null};if(Tv(u))X3(p,I);else{var U=u.alternate;if(u.lanes===0&&(U===null||U.lanes===0)&&(U=p.lastRenderedReducer,U!==null))try{var me=p.lastRenderedState,je=U(me,y);if(I.hasEagerState=!0,I.eagerState=je,ur(je,me))return Wo(u,p,I,0),xr===null&&cg(),!1}catch{}finally{}if(y=nv(u,p,I,C),y!==null)return Dr(y,u,C),Y3(y,p,C),!0}return!1}function Wb(u,p,y,C){if(C={lane:2,revertLane:jt(),gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null},Tv(u)){if(p)throw Error(r(479))}else p=nv(u,y,C,2),p!==null&&Dr(p,u,2)}function Tv(u){var p=u.alternate;return u===Mr||p!==null&&p===Mr}function X3(u,p){fm=xc=!0;var y=u.pending;y===null?p.next=p:(p.next=y.next,y.next=p),u.pending=p}function Y3(u,p,y){if((y&4194048)!==0){var C=p.lanes;C&=u.pendingLanes,y|=C,p.lanes=y,kt(u,y)}}var pm={readContext:dr,use:Cf,useCallback:As,useContext:As,useEffect:As,useImperativeHandle:As,useLayoutEffect:As,useInsertionEffect:As,useMemo:As,useReducer:As,useRef:As,useState:As,useDebugValue:As,useDeferredValue:As,useTransition:As,useSyncExternalStore:As,useId:As,useHostTransitionStatus:As,useFormState:As,useActionState:As,useOptimistic:As,useMemoCache:As,useCacheRefresh:As};pm.useEffectEvent=As;var K3={readContext:dr,use:Cf,useCallback:function(u,p){return Ro().memoizedState=[u,p===void 0?null:p],u},useContext:dr,useEffect:P3,useImperativeHandle:function(u,p,y){y=y!=null?y.concat([u]):null,Sv(4194308,4,j3.bind(null,p,u),y)},useLayoutEffect:function(u,p){return Sv(4194308,4,u,p)},useInsertionEffect:function(u,p){Sv(4,2,u,p)},useMemo:function(u,p){var y=Ro();p=p===void 0?null:p;var C=u();if(Fh){st(!0);try{u()}finally{st(!1)}}return y.memoizedState=[C,p],C},useReducer:function(u,p,y){var C=Ro();if(y!==void 0){var I=y(p);if(Fh){st(!0);try{y(p)}finally{st(!1)}}}else I=p;return C.memoizedState=C.baseState=I,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:I},C.queue=u,u=u.dispatch=FE.bind(null,Mr,u),[C.memoizedState,u]},useRef:function(u){var p=Ro();return u={current:u},p.memoizedState=u},useState:function(u){u=Ib(u);var p=u.queue,y=q3.bind(null,Mr,p);return p.dispatch=y,[u.memoizedState,y]},useDebugValue:Bb,useDeferredValue:function(u,p){var y=Ro();return Hb(y,u,p)},useTransition:function(){var u=Ib(!1);return u=H3.bind(null,Mr,u.queue,!0,!1),Ro().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,p,y){var C=Mr,I=Ro();if(Zr){if(y===void 0)throw Error(r(407));y=y()}else{if(y=p(),xr===null)throw Error(r(349));(kr&127)!==0||_3(C,p,y)}I.memoizedState=y;var U={value:y,getSnapshot:p};return I.queue=U,P3(S3.bind(null,C,U,u),[u]),C.flags|=2048,Ef(9,{destroy:void 0},w3.bind(null,C,U,y,p),null),y},useId:function(){var u=Ro(),p=xr.identifierPrefix;if(Zr){var y=Jc,C=Es;y=(C&~(1<<32-Pe(C)-1)).toString(32)+y,p="_"+p+"R_"+y,y=vv++,0<y&&(p+="H"+y.toString(32)),p+="_"}else y=Tb++,p="_"+p+"r_"+y.toString(32)+"_";return u.memoizedState=p},useHostTransitionStatus:Vb,useFormState:jb,useActionState:jb,useOptimistic:function(u){var p=Ro();p.memoizedState=p.baseState=u;var y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return p.queue=y,p=Wb.bind(null,Mr,!0,y),y.dispatch=p,[u,p]},useMemoCache:kb,useCacheRefresh:function(){return Ro().memoizedState=zE.bind(null,Mr)},useEffectEvent:function(u){var p=Ro(),y={impl:u};return p.memoizedState=y,function(){if(($n&2)!==0)throw Error(r(440));return y.impl.apply(void 0,arguments)}}},$b={readContext:dr,use:Cf,useCallback:F3,useContext:dr,useEffect:Ub,useImperativeHandle:z3,useInsertionEffect:O3,useLayoutEffect:L3,useMemo:U3,useReducer:_v,useRef:wv,useState:function(){return _v(jd)},useDebugValue:Bb,useDeferredValue:function(u,p){var y=eo();return B3(y,Fi.memoizedState,u,p)},useTransition:function(){var u=_v(jd)[0],p=eo().memoizedState;return[typeof u=="boolean"?u:yg(u),p]},useSyncExternalStore:b3,useId:W3,useHostTransitionStatus:Vb,useFormState:k3,useActionState:k3,useOptimistic:function(u,p){var y=eo();return Db(y,Fi,u,p)},useMemoCache:kb,useCacheRefresh:$3};$b.useEffectEvent=D3;var vc={readContext:dr,use:Cf,useCallback:F3,useContext:dr,useEffect:Ub,useImperativeHandle:z3,useInsertionEffect:O3,useLayoutEffect:L3,useMemo:U3,useReducer:Pb,useRef:wv,useState:function(){return Pb(jd)},useDebugValue:Bb,useDeferredValue:function(u,p){var y=eo();return Fi===null?Hb(y,u,p):B3(y,Fi.memoizedState,u,p)},useTransition:function(){var u=Pb(jd)[0],p=eo().memoizedState;return[typeof u=="boolean"?u:yg(u),p]},useSyncExternalStore:b3,useId:W3,useHostTransitionStatus:Vb,useFormState:Fb,useActionState:Fb,useOptimistic:function(u,p){var y=eo();return Fi!==null?Db(y,Fi,u,p):(y.baseState=u,[u,y.queue.dispatch])},useMemoCache:kb,useCacheRefresh:$3};vc.useEffectEvent=D3;function Cv(u,p,y,C){p=u.memoizedState,y=y(C,p),y=y==null?p:h({},p,y),u.memoizedState=y,u.lanes===0&&(u.updateQueue.baseState=y)}var _g={enqueueSetState:function(u,p,y){u=u._reactInternals;var C=Fl(),I=Od(C);I.payload=p,y!=null&&(I.callback=y),p=Mf(u,I,C),p!==null&&(Dr(p,u,C),Tf(p,u,C))},enqueueReplaceState:function(u,p,y){u=u._reactInternals;var C=Fl(),I=Od(C);I.tag=1,I.payload=p,y!=null&&(I.callback=y),p=Mf(u,I,C),p!==null&&(Dr(p,u,C),Tf(p,u,C))},enqueueForceUpdate:function(u,p){u=u._reactInternals;var y=Fl(),C=Od(y);C.tag=2,p!=null&&(C.callback=p),p=Mf(u,C,y),p!==null&&(Dr(p,u,y),Tf(p,u,y))}};function qb(u,p,y,C,I,U,me){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(C,U,me):p.prototype&&p.prototype.isPureReactComponent?!yr(y,C)||!yr(I,U):!0}function Xb(u,p,y,C){u=p.state,typeof p.componentWillReceiveProps=="function"&&p.componentWillReceiveProps(y,C),typeof p.UNSAFE_componentWillReceiveProps=="function"&&p.UNSAFE_componentWillReceiveProps(y,C),p.state!==u&&_g.enqueueReplaceState(p,p.state,null)}function Af(u,p){var y=p;if("ref"in p){y={};for(var C in p)C!=="ref"&&(y[C]=p[C])}if(u=u.defaultProps){y===p&&(y=h({},y));for(var I in u)y[I]===void 0&&(y[I]=u[I])}return y}function Z3(u){lg(u)}function Yb(u){console.error(u)}function Kb(u){lg(u)}function Ev(u,p){try{var y=u.onUncaughtError;y(p.value,{componentStack:p.stack})}catch(C){setTimeout(function(){throw C})}}function Q3(u,p,y){try{var C=u.onCaughtError;C(y.value,{componentStack:y.stack,errorBoundary:p.tag===1?p.stateNode:null})}catch(I){setTimeout(function(){throw I})}}function Zb(u,p,y){return y=Od(y),y.tag=3,y.payload={element:null},y.callback=function(){Ev(u,p)},y}function Qb(u){return u=Od(u),u.tag=3,u}function J3(u,p,y,C){var I=y.type.getDerivedStateFromError;if(typeof I=="function"){var U=C.value;u.payload=function(){return I(U)},u.callback=function(){Q3(p,y,C)}}var me=y.stateNode;me!==null&&typeof me.componentDidCatch=="function"&&(u.callback=function(){Q3(p,y,C),typeof I!="function"&&(ro===null?ro=new Set([this]):ro.add(this));var je=C.stack;this.componentDidCatch(C.value,{componentStack:je!==null?je:""})})}function Po(u,p,y,C,I){if(y.flags|=32768,C!==null&&typeof C=="object"&&typeof C.then=="function"){if(p=y.alternate,p!==null&&zu(p,y,I,!0),y=ol.current,y!==null){switch(y.tag){case 31:case 13:return Fa===null?_m():y.alternate===null&&Ns===0&&(Ns=3),y.flags&=-257,y.flags|=65536,y.lanes=I,C===hv?y.flags|=16384:(p=y.updateQueue,p===null?y.updateQueue=new Set([C]):p.add(C),Ig(u,C,I)),!1;case 22:return y.flags|=65536,C===hv?y.flags|=16384:(p=y.updateQueue,p===null?(p={transitions:null,markerInstances:null,retryQueue:new Set([C])},y.updateQueue=p):(y=p.retryQueue,y===null?p.retryQueue=new Set([C]):y.add(C)),Ig(u,C,I)),!1}throw Error(r(435,y.tag))}return Ig(u,C,I),_m(),!1}if(Zr)return p=ol.current,p!==null?((p.flags&65536)===0&&(p.flags|=256),p.flags|=65536,p.lanes=I,C!==im&&(u=Error(r(422),{cause:C}),Ou(Rl(u,y)))):(C!==im&&(p=Error(r(423),{cause:C}),Ou(Rl(p,y))),u=u.current.alternate,u.flags|=65536,I&=-I,u.lanes|=I,C=Rl(C,y),I=Zb(u.stateNode,C,I),Qn(u,I),Ns!==4&&(Ns=2)),!1;var U=Error(r(520),{cause:C});if(U=Rl(U,y),Yh===null?Yh=[U]:Yh.push(U),Ns!==4&&(Ns=2),p===null)return!0;C=Rl(C,y),y=p;do{switch(y.tag){case 3:return y.flags|=65536,u=I&-I,y.lanes|=u,u=Zb(y.stateNode,C,u),Qn(y,u),!1;case 1:if(p=y.type,U=y.stateNode,(y.flags&128)===0&&(typeof p.getDerivedStateFromError=="function"||U!==null&&typeof U.componentDidCatch=="function"&&(ro===null||!ro.has(U))))return y.flags|=65536,I&=-I,y.lanes|=I,I=Qb(I),J3(I,u,y,C),Qn(y,I),!1}y=y.return}while(y!==null);return!1}var Av=Error(r(461)),xo=!1;function $o(u,p,y,C){p.child=u===null?gv(p,null,y,C):Dd(p,u.child,y,C)}function Jb(u,p,y,C,I){y=y.render;var U=p.ref;if("ref"in C){var me={};for(var je in C)je!=="ref"&&(me[je]=C[je])}else me=C;return wf(p),C=yv(u,p,y,me,U,I),je=Eb(),u!==null&&!xo?(Ab(u,p,I),to(u,p,I)):(Zr&&je&&Iu(p),p.flags|=1,$o(u,p,C,I),p.child)}function Hh(u,p,y,C,I){if(u===null){var U=y.type;return typeof U=="function"&&!rv(U)&&U.defaultProps===void 0&&y.compare===null?(p.tag=15,p.type=U,Nv(u,p,U,C,I)):(u=Ru(y.type,null,C,p,p.mode,I),u.ref=p.ref,u.return=p,p.child=u)}if(U=u.child,!Ov(u,I)){var me=U.memoizedProps;if(y=y.compare,y=y!==null?y:yr,y(me,C)&&u.ref===p.ref)return to(u,p,I)}return p.flags|=1,u=rl(U,C),u.ref=p.ref,u.return=p,p.child=u}function Nv(u,p,y,C,I){if(u!==null){var U=u.memoizedProps;if(yr(U,C)&&u.ref===p.ref)if(xo=!1,p.pendingProps=C=U,Ov(u,I))(u.flags&131072)!==0&&(xo=!0);else return p.lanes=u.lanes,to(u,p,I)}return mm(u,p,y,C,I)}function Gh(u,p,y,C){var I=C.children,U=u!==null?u.memoizedState:null;if(u===null&&p.stateNode===null&&(p.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),C.mode==="hidden"){if((p.flags&128)!==0){if(U=U!==null?U.baseLanes|y:y,u!==null){for(C=p.child=u.child,I=0;C!==null;)I=I|C.lanes|C.childLanes,C=C.sibling;C=I&~U}else C=0,p.child=null;return ll(u,p,U,y,C)}if((y&536870912)!==0)p.memoizedState={baseLanes:0,cachePool:null},u!==null&&fg(p,U!==null?U.cachePool:null),U!==null?x3(p,U):Sb(),v3(p);else return C=p.lanes=536870912,ll(u,p,U!==null?U.baseLanes|y:y,y,C)}else U!==null?(fg(p,U.cachePool),x3(p,U),al(),p.memoizedState=null):(u!==null&&fg(p,null),Sb(),al());return $o(u,p,I,y),p.child}function Uu(u,p){return u!==null&&u.tag===22||p.stateNode!==null||(p.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.sibling}function ll(u,p,y,C,I){var U=fv();return U=U===null?null:{parent:go._currentValue,pool:U},p.memoizedState={baseLanes:y,cachePool:U},u!==null&&fg(p,null),Sb(),v3(p),u!==null&&zu(u,p,C,!0),p.childLanes=I,null}function kv(u,p){return p=Dv({mode:p.mode,children:p.children},u.mode),p.ref=u.ref,u.child=p,p.return=u,p}function e4(u,p,y){return Dd(p,u.child,null,y),u=kv(p,p.pendingProps),u.flags|=2,Js(p),p.memoizedState=null,u}function Rv(u,p,y){var C=p.pendingProps,I=(p.flags&128)!==0;if(p.flags&=-129,u===null){if(Zr){if(C.mode==="hidden")return u=kv(p,C),p.lanes=536870912,Uu(null,u);if(Mb(p),(u=Ki)?(u=XI(u,Pl),u=u!==null&&u.data==="&"?u:null,u!==null&&(p.memoizedState={dehydrated:u,treeContext:kd!==null?{id:Es,overflow:Jc}:null,retryLane:536870912,hydrationErrors:null},y=tm(u),y.return=p,p.child=y,Us=p,Ki=null)):u=null,u===null)throw Du(p);return p.lanes=536870912,null}return kv(p,C)}var U=u.memoizedState;if(U!==null){var me=U.dehydrated;if(Mb(p),I)if(p.flags&256)p.flags&=-257,p=e4(u,p,y);else if(p.memoizedState!==null)p.child=u.child,p.flags|=128,p=null;else throw Error(r(558));else if(xo||zu(u,p,y,!1),I=(y&u.childLanes)!==0,xo||I){if(C=xr,C!==null&&(me=wt(C,y),me!==0&&me!==U.retryLane))throw U.retryLane=me,ja(u,me),Dr(C,u,me),Av;_m(),p=e4(u,p,y)}else u=U.treeContext,Ki=Yu(me.nextSibling),Us=p,Zr=!0,Rd=null,Pl=!1,u!==null&&av(p,u),p=kv(p,C),p.flags|=4096;return p}return u=rl(u.child,{mode:C.mode,children:C.children}),u.ref=p.ref,p.child=u,u.return=p,u}function Vh(u,p){var y=p.ref;if(y===null)u!==null&&u.ref!==null&&(p.flags|=4194816);else{if(typeof y!="function"&&typeof y!="object")throw Error(r(284));(u===null||u.ref!==y)&&(p.flags|=4194816)}}function mm(u,p,y,C,I){return wf(p),y=yv(u,p,y,C,void 0,I),C=Eb(),u!==null&&!xo?(Ab(u,p,I),to(u,p,I)):(Zr&&C&&Iu(p),p.flags|=1,$o(u,p,y,I),p.child)}function wg(u,p,y,C,I,U){return wf(p),p.updateQueue=null,y=Uh(p,C,y,I),y3(u),C=Eb(),u!==null&&!xo?(Ab(u,p,U),to(u,p,U)):(Zr&&C&&Iu(p),p.flags|=1,$o(u,p,y,U),p.child)}function Pv(u,p,y,C,I){if(wf(p),p.stateNode===null){var U=gf,me=y.contextType;typeof me=="object"&&me!==null&&(U=dr(me)),U=new y(C,U),p.memoizedState=U.state!==null&&U.state!==void 0?U.state:null,U.updater=_g,p.stateNode=U,U._reactInternals=p,U=p.stateNode,U.props=C,U.state=p.memoizedState,U.refs={},mg(p),me=y.contextType,U.context=typeof me=="object"&&me!==null?dr(me):gf,U.state=p.memoizedState,me=y.getDerivedStateFromProps,typeof me=="function"&&(Cv(p,y,me,C),U.state=p.memoizedState),typeof y.getDerivedStateFromProps=="function"||typeof U.getSnapshotBeforeUpdate=="function"||typeof U.UNSAFE_componentWillMount!="function"&&typeof U.componentWillMount!="function"||(me=U.state,typeof U.componentWillMount=="function"&&U.componentWillMount(),typeof U.UNSAFE_componentWillMount=="function"&&U.UNSAFE_componentWillMount(),me!==U.state&&_g.enqueueReplaceState(U,U.state,null),cm(p,C,U,I),gg(),U.state=p.memoizedState),typeof U.componentDidMount=="function"&&(p.flags|=4194308),C=!0}else if(u===null){U=p.stateNode;var je=p.memoizedProps,ct=Af(y,je);U.props=ct;var At=U.context,Wt=y.contextType;me=gf,typeof Wt=="object"&&Wt!==null&&(me=dr(Wt));var Jt=y.getDerivedStateFromProps;Wt=typeof Jt=="function"||typeof U.getSnapshotBeforeUpdate=="function",je=p.pendingProps!==je,Wt||typeof U.UNSAFE_componentWillReceiveProps!="function"&&typeof U.componentWillReceiveProps!="function"||(je||At!==me)&&Xb(p,U,C,me),za=!1;var Rt=p.memoizedState;U.state=Rt,cm(p,C,U,I),gg(),At=p.memoizedState,je||Rt!==At||za?(typeof Jt=="function"&&(Cv(p,y,Jt,C),At=p.memoizedState),(ct=za||qb(p,y,ct,C,Rt,At,me))?(Wt||typeof U.UNSAFE_componentWillMount!="function"&&typeof U.componentWillMount!="function"||(typeof U.componentWillMount=="function"&&U.componentWillMount(),typeof U.UNSAFE_componentWillMount=="function"&&U.UNSAFE_componentWillMount()),typeof U.componentDidMount=="function"&&(p.flags|=4194308)):(typeof U.componentDidMount=="function"&&(p.flags|=4194308),p.memoizedProps=C,p.memoizedState=At),U.props=C,U.state=At,U.context=me,C=ct):(typeof U.componentDidMount=="function"&&(p.flags|=4194308),C=!1)}else{U=p.stateNode,_b(u,p),me=p.memoizedProps,Wt=Af(y,me),U.props=Wt,Jt=p.pendingProps,Rt=U.context,At=y.contextType,ct=gf,typeof At=="object"&&At!==null&&(ct=dr(At)),je=y.getDerivedStateFromProps,(At=typeof je=="function"||typeof U.getSnapshotBeforeUpdate=="function")||typeof U.UNSAFE_componentWillReceiveProps!="function"&&typeof U.componentWillReceiveProps!="function"||(me!==Jt||Rt!==ct)&&Xb(p,U,C,ct),za=!1,Rt=p.memoizedState,U.state=Rt,cm(p,C,U,I),gg();var Ut=p.memoizedState;me!==Jt||Rt!==Ut||za||u!==null&&u.dependencies!==null&&dg(u.dependencies)?(typeof je=="function"&&(Cv(p,y,je,C),Ut=p.memoizedState),(Wt=za||qb(p,y,Wt,C,Rt,Ut,ct)||u!==null&&u.dependencies!==null&&dg(u.dependencies))?(At||typeof U.UNSAFE_componentWillUpdate!="function"&&typeof U.componentWillUpdate!="function"||(typeof U.componentWillUpdate=="function"&&U.componentWillUpdate(C,Ut,ct),typeof U.UNSAFE_componentWillUpdate=="function"&&U.UNSAFE_componentWillUpdate(C,Ut,ct)),typeof U.componentDidUpdate=="function"&&(p.flags|=4),typeof U.getSnapshotBeforeUpdate=="function"&&(p.flags|=1024)):(typeof U.componentDidUpdate!="function"||me===u.memoizedProps&&Rt===u.memoizedState||(p.flags|=4),typeof U.getSnapshotBeforeUpdate!="function"||me===u.memoizedProps&&Rt===u.memoizedState||(p.flags|=1024),p.memoizedProps=C,p.memoizedState=Ut),U.props=C,U.state=Ut,U.context=ct,C=Wt):(typeof U.componentDidUpdate!="function"||me===u.memoizedProps&&Rt===u.memoizedState||(p.flags|=4),typeof U.getSnapshotBeforeUpdate!="function"||me===u.memoizedProps&&Rt===u.memoizedState||(p.flags|=1024),C=!1)}return U=C,Vh(u,p),C=(p.flags&128)!==0,U||C?(U=p.stateNode,y=C&&typeof y.getDerivedStateFromError!="function"?null:U.render(),p.flags|=1,u!==null&&C?(p.child=Dd(p,u.child,null,I),p.child=Dd(p,null,y,I)):$o(u,p,y,I),p.memoizedState=U.state,u=p.child):u=to(u,p,I),u}function t4(u,p,y,C){return bf(),p.flags|=256,$o(u,p,y,C),p.child}var e_={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sa(u){return{baseLanes:u,cachePool:bb()}}function Iv(u,p,y){return u=u!==null?u.childLanes&~y:0,p&&(u|=Ha),u}function n4(u,p,y){var C=p.pendingProps,I=!1,U=(p.flags&128)!==0,me;if((me=U)||(me=u!==null&&u.memoizedState===null?!1:(Qr.current&2)!==0),me&&(I=!0,p.flags&=-129),me=(p.flags&32)!==0,p.flags&=-33,u===null){if(Zr){if(I?Ld(p):al(),(u=Ki)?(u=XI(u,Pl),u=u!==null&&u.data!=="&"?u:null,u!==null&&(p.memoizedState={dehydrated:u,treeContext:kd!==null?{id:Es,overflow:Jc}:null,retryLane:536870912,hydrationErrors:null},y=tm(u),y.return=p,p.child=y,Us=p,Ki=null)):u=null,u===null)throw Du(p);return JE(u)?p.lanes=32:p.lanes=536870912,null}var je=C.children;return C=C.fallback,I?(al(),I=p.mode,je=Dv({mode:"hidden",children:je},I),C=xf(C,I,y,null),je.return=p,C.return=p,je.sibling=C,p.child=je,C=p.child,C.memoizedState=Sa(y),C.childLanes=Iv(u,me,y),p.memoizedState=e_,Uu(null,C)):(Ld(p),Sg(p,je))}var ct=u.memoizedState;if(ct!==null&&(je=ct.dehydrated,je!==null)){if(U)p.flags&256?(Ld(p),p.flags&=-257,p=t_(u,p,y)):p.memoizedState!==null?(al(),p.child=u.child,p.flags|=128,p=null):(al(),je=C.fallback,I=p.mode,C=Dv({mode:"visible",children:C.children},I),je=xf(je,I,y,null),je.flags|=2,C.return=p,je.return=p,C.sibling=je,p.child=C,Dd(p,u.child,null,y),C=p.child,C.memoizedState=Sa(y),C.childLanes=Iv(u,me,y),p.memoizedState=e_,p=Uu(null,C));else if(Ld(p),JE(je)){if(me=je.nextSibling&&je.nextSibling.dataset,me)var At=me.dgst;me=At,C=Error(r(419)),C.stack="",C.digest=me,Ou({value:C,source:null,stack:null}),p=t_(u,p,y)}else if(xo||zu(u,p,y,!1),me=(y&u.childLanes)!==0,xo||me){if(me=xr,me!==null&&(C=wt(me,y),C!==0&&C!==ct.retryLane))throw ct.retryLane=C,ja(u,C),Dr(me,u,C),Av;QE(je)||_m(),p=t_(u,p,y)}else QE(je)?(p.flags|=192,p.child=u.child,p=null):(u=ct.treeContext,Ki=Yu(je.nextSibling),Us=p,Zr=!0,Rd=null,Pl=!1,u!==null&&av(p,u),p=Sg(p,C.children),p.flags|=4096);return p}return I?(al(),je=C.fallback,I=p.mode,ct=u.child,At=ct.sibling,C=rl(ct,{mode:"hidden",children:C.children}),C.subtreeFlags=ct.subtreeFlags&65011712,At!==null?je=rl(At,je):(je=xf(je,I,y,null),je.flags|=2),je.return=p,C.return=p,C.sibling=je,p.child=C,Uu(null,C),C=p.child,je=u.child.memoizedState,je===null?je=Sa(y):(I=je.cachePool,I!==null?(ct=go._currentValue,I=I.parent!==ct?{parent:ct,pool:ct}:I):I=bb(),je={baseLanes:je.baseLanes|y,cachePool:I}),C.memoizedState=je,C.childLanes=Iv(u,me,y),p.memoizedState=e_,Uu(u.child,C)):(Ld(p),y=u.child,u=y.sibling,y=rl(y,{mode:"visible",children:C.children}),y.return=p,y.sibling=null,u!==null&&(me=p.deletions,me===null?(p.deletions=[u],p.flags|=16):me.push(u)),p.child=y,p.memoizedState=null,y)}function Sg(u,p){return p=Dv({mode:"visible",children:p},u.mode),p.return=u,u.child=p}function Dv(u,p){return u=Cs(22,u,null,p),u.lanes=0,u}function t_(u,p,y){return Dd(p,u.child,null,y),u=Sg(p,p.pendingProps.children),u.flags|=2,p.memoizedState=null,u}function r4(u,p,y){u.lanes|=p;var C=u.alternate;C!==null&&(C.lanes|=p),cv(u.return,p,y)}function Wh(u,p,y,C,I,U){var me=u.memoizedState;me===null?u.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:C,tail:y,tailMode:I,treeForkCount:U}:(me.isBackwards=p,me.rendering=null,me.renderingStartTime=0,me.last=C,me.tail=y,me.tailMode=I,me.treeForkCount=U)}function cl(u,p,y){var C=p.pendingProps,I=C.revealOrder,U=C.tail;C=C.children;var me=Qr.current,je=(me&2)!==0;if(je?(me=me&1|2,p.flags|=128):me&=1,F(Qr,me),$o(u,p,C,y),C=Zr?rm:0,!je&&u!==null&&(u.flags&128)!==0)e:for(u=p.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&r4(u,y,p);else if(u.tag===19)r4(u,y,p);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===p)break e;for(;u.sibling===null;){if(u.return===null||u.return===p)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}switch(I){case"forwards":for(y=p.child,I=null;y!==null;)u=y.alternate,u!==null&&Dl(u)===null&&(I=y),y=y.sibling;y=I,y===null?(I=p.child,p.child=null):(I=y.sibling,y.sibling=null),Wh(p,!1,I,y,U,C);break;case"backwards":case"unstable_legacy-backwards":for(y=null,I=p.child,p.child=null;I!==null;){if(u=I.alternate,u!==null&&Dl(u)===null){p.child=I;break}u=I.sibling,I.sibling=y,y=I,I=u}Wh(p,!0,y,null,U,C);break;case"together":Wh(p,!1,null,null,void 0,C);break;default:p.memoizedState=null}return p.child}function to(u,p,y){if(u!==null&&(p.dependencies=u.dependencies),$u|=p.lanes,(y&p.childLanes)===0)if(u!==null){if(zu(u,p,y,!1),(y&p.childLanes)===0)return null}else return null;if(u!==null&&p.child!==u.child)throw Error(r(153));if(p.child!==null){for(u=p.child,y=rl(u,u.pendingProps),p.child=y,y.return=p;u.sibling!==null;)u=u.sibling,y=y.sibling=rl(u,u.pendingProps),y.return=p;y.sibling=null}return p.child}function Ov(u,p){return(u.lanes&p)!==0?!0:(u=u.dependencies,!!(u!==null&&dg(u)))}function UE(u,p,y){switch(p.tag){case 3:re(p,p.stateNode.containerInfo),Pd(p,go,u.memoizedState.cache),bf();break;case 27:case 5:fe(p);break;case 4:re(p,p.stateNode.containerInfo);break;case 10:Pd(p,p.type,p.memoizedProps.value);break;case 31:if(p.memoizedState!==null)return p.flags|=128,Mb(p),null;break;case 13:var C=p.memoizedState;if(C!==null)return C.dehydrated!==null?(Ld(p),p.flags|=128,null):(y&p.child.childLanes)!==0?n4(u,p,y):(Ld(p),u=to(u,p,y),u!==null?u.sibling:null);Ld(p);break;case 19:var I=(u.flags&128)!==0;if(C=(y&p.childLanes)!==0,C||(zu(u,p,y,!1),C=(y&p.childLanes)!==0),I){if(C)return cl(u,p,y);p.flags|=128}if(I=p.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),F(Qr,Qr.current),C)break;return null;case 22:return p.lanes=0,Gh(u,p,y,p.pendingProps);case 24:Pd(p,go,u.memoizedState.cache)}return to(u,p,y)}function Lv(u,p,y){if(u!==null)if(u.memoizedProps!==p.pendingProps)xo=!0;else{if(!Ov(u,y)&&(p.flags&128)===0)return xo=!1,UE(u,p,y);xo=(u.flags&131072)!==0}else xo=!1,Zr&&(p.flags&1048576)!==0&&u3(p,rm,p.index);switch(p.lanes=0,p.tag){case 16:e:{var C=p.pendingProps;if(u=Dh(p.elementType),p.type=u,typeof u=="function")rv(u)?(C=Af(u,C),p.tag=1,p=Pv(null,p,u,C,y)):(p.tag=0,p=mm(null,p,u,C,y));else{if(u!=null){var I=u.$$typeof;if(I===N){p.tag=11,p=Jb(null,p,u,C,y);break e}else if(I===O){p.tag=14,p=Hh(null,p,u,C,y);break e}}throw p=Z(u)||u,Error(r(306,p,""))}}return p;case 0:return mm(u,p,p.type,p.pendingProps,y);case 1:return C=p.type,I=Af(C,p.pendingProps),Pv(u,p,C,I,y);case 3:e:{if(re(p,p.stateNode.containerInfo),u===null)throw Error(r(387));C=p.pendingProps;var U=p.memoizedState;I=U.element,_b(u,p),cm(p,C,null,y);var me=p.memoizedState;if(C=me.cache,Pd(p,go,C),C!==U.cache&&uv(p,[go],y,!0),gg(),C=me.element,U.isDehydrated)if(U={element:C,isDehydrated:!1,cache:me.cache},p.updateQueue.baseState=U,p.memoizedState=U,p.flags&256){p=t4(u,p,C,y);break e}else if(C!==I){I=Rl(Error(r(424)),p),Ou(I),p=t4(u,p,C,y);break e}else{switch(u=p.stateNode.containerInfo,u.nodeType){case 9:u=u.body;break;default:u=u.nodeName==="HTML"?u.ownerDocument.body:u}for(Ki=Yu(u.firstChild),Us=p,Zr=!0,Rd=null,Pl=!0,y=gv(p,null,C,y),p.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling}else{if(bf(),C===I){p=to(u,p,y);break e}$o(u,p,C,y)}p=p.child}return p;case 26:return Vh(u,p),u===null?(y=eD(p.type,null,p.pendingProps,null))?p.memoizedState=y:Zr||(y=p.type,u=p.pendingProps,C=a4(Q.current).createElement(y),C[Qt]=p,C[hn]=u,Va(C,y,u),tt(C),p.stateNode=C):p.memoizedState=eD(p.type,u.memoizedProps,p.pendingProps,u.memoizedState),null;case 27:return fe(p),u===null&&Zr&&(C=p.stateNode=ZI(p.type,p.pendingProps,Q.current),Us=p,Pl=!0,I=Ki,Tm(p.type)?(eA=I,Ki=Yu(C.firstChild)):Ki=I),$o(u,p,p.pendingProps.children,y),Vh(u,p),u===null&&(p.flags|=4194304),p.child;case 5:return u===null&&Zr&&((I=C=Ki)&&(C=JQ(C,p.type,p.pendingProps,Pl),C!==null?(p.stateNode=C,Us=p,Ki=Yu(C.firstChild),Pl=!1,I=!0):I=!1),I||Du(p)),fe(p),I=p.type,U=p.pendingProps,me=u!==null?u.memoizedProps:null,C=U.children,YE(I,U)?C=null:me!==null&&YE(I,me)&&(p.flags|=32),p.memoizedState!==null&&(I=yv(u,p,Bh,null,null,y),f_._currentValue=I),Vh(u,p),$o(u,p,C,y),p.child;case 6:return u===null&&Zr&&((u=y=Ki)&&(y=eJ(y,p.pendingProps,Pl),y!==null?(p.stateNode=y,Us=p,Ki=null,u=!0):u=!1),u||Du(p)),null;case 13:return n4(u,p,y);case 4:return re(p,p.stateNode.containerInfo),C=p.pendingProps,u===null?p.child=Dd(p,null,C,y):$o(u,p,C,y),p.child;case 11:return Jb(u,p,p.type,p.pendingProps,y);case 7:return $o(u,p,p.pendingProps,y),p.child;case 8:return $o(u,p,p.pendingProps.children,y),p.child;case 12:return $o(u,p,p.pendingProps.children,y),p.child;case 10:return C=p.pendingProps,Pd(p,p.type,C.value),$o(u,p,C.children,y),p.child;case 9:return I=p.type._context,C=p.pendingProps.children,wf(p),I=dr(I),C=C(I),p.flags|=1,$o(u,p,C,y),p.child;case 14:return Hh(u,p,p.type,p.pendingProps,y);case 15:return Nv(u,p,p.type,p.pendingProps,y);case 19:return cl(u,p,y);case 31:return Rv(u,p,y);case 22:return Gh(u,p,y,p.pendingProps);case 24:return wf(p),C=dr(go),u===null?(I=fv(),I===null&&(I=xr,U=gb(),I.pooledCache=U,U.refCount++,U!==null&&(I.pooledCacheLanes|=y),I=U),p.memoizedState={parent:C,cache:I},mg(p),Pd(p,go,I)):((u.lanes&y)!==0&&(_b(u,p),cm(p,null,null,y),gg()),I=u.memoizedState,U=p.memoizedState,I.parent!==C?(I={parent:C,cache:C},p.memoizedState=I,p.lanes===0&&(p.memoizedState=p.updateQueue.baseState=I),Pd(p,go,C)):(C=U.cache,Pd(p,go,C),C!==I.cache&&uv(p,[go],y,!0))),$o(u,p,p.pendingProps.children,y),p.child;case 29:throw p.pendingProps}throw Error(r(156,p.tag))}function Bu(u){u.flags|=4}function Mg(u,p,y,C,I){if((p=(u.mode&32)!==0)&&(p=!1),p){if(u.flags|=16777216,(I&335544128)===I)if(u.stateNode.complete)u.flags|=8192;else if(Rs())u.flags|=8192;else throw Fu=hv,hg}else u.flags&=-16777217}function n_(u,p){if(p.type!=="stylesheet"||(p.state.loading&4)!==0)u.flags&=-16777217;else if(u.flags|=16777216,!sD(p))if(Rs())u.flags|=8192;else throw Fu=hv,hg}function zd(u,p){p!==null&&(u.flags|=4),u.flags&16384&&(p=u.tag!==22?De():536870912,u.lanes|=p,rs|=p)}function Hu(u,p){if(!Zr)switch(u.tailMode){case"hidden":p=u.tail;for(var y=null;p!==null;)p.alternate!==null&&(y=p),p=p.sibling;y===null?u.tail=null:y.sibling=null;break;case"collapsed":y=u.tail;for(var C=null;y!==null;)y.alternate!==null&&(C=y),y=y.sibling;C===null?p||u.tail===null?u.tail=null:u.tail.sibling=null:C.sibling=null}}function Ui(u){var p=u.alternate!==null&&u.alternate.child===u.child,y=0,C=0;if(p)for(var I=u.child;I!==null;)y|=I.lanes|I.childLanes,C|=I.subtreeFlags&65011712,C|=I.flags&65011712,I.return=u,I=I.sibling;else for(I=u.child;I!==null;)y|=I.lanes|I.childLanes,C|=I.subtreeFlags,C|=I.flags,I.return=u,I=I.sibling;return u.subtreeFlags|=C,u.childLanes=y,p}function Tg(u,p,y){var C=p.pendingProps;switch(ov(p),p.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ui(p),null;case 1:return Ui(p),null;case 3:return y=p.stateNode,C=null,u!==null&&(C=u.memoizedState.cache),p.memoizedState.cache!==C&&(p.flags|=2048),ju(go),K(),y.pendingContext&&(y.context=y.pendingContext,y.pendingContext=null),(u===null||u.child===null)&&(sm(p)?Bu(p):u===null||u.memoizedState.isDehydrated&&(p.flags&256)===0||(p.flags|=1024,lv())),Ui(p),null;case 26:var I=p.type,U=p.memoizedState;return u===null?(Bu(p),U!==null?(Ui(p),n_(p,U)):(Ui(p),Mg(p,I,null,C,y))):U?U!==u.memoizedState?(Bu(p),Ui(p),n_(p,U)):(Ui(p),p.flags&=-16777217):(u=u.memoizedProps,u!==C&&Bu(p),Ui(p),Mg(p,I,u,C,y)),null;case 27:if(he(p),y=Q.current,I=p.type,u!==null&&p.stateNode!=null)u.memoizedProps!==C&&Bu(p);else{if(!C){if(p.stateNode===null)throw Error(r(166));return Ui(p),null}u=ce.current,sm(p)?d3(p):(u=ZI(I,C,y),p.stateNode=u,Bu(p))}return Ui(p),null;case 5:if(he(p),I=p.type,u!==null&&p.stateNode!=null)u.memoizedProps!==C&&Bu(p);else{if(!C){if(p.stateNode===null)throw Error(r(166));return Ui(p),null}if(U=ce.current,sm(p))d3(p);else{var me=a4(Q.current);switch(U){case 1:U=me.createElementNS("http://www.w3.org/2000/svg",I);break;case 2:U=me.createElementNS("http://www.w3.org/1998/Math/MathML",I);break;default:switch(I){case"svg":U=me.createElementNS("http://www.w3.org/2000/svg",I);break;case"math":U=me.createElementNS("http://www.w3.org/1998/Math/MathML",I);break;case"script":U=me.createElement("div"),U.innerHTML="<script><\/script>",U=U.removeChild(U.firstChild);break;case"select":U=typeof C.is=="string"?me.createElement("select",{is:C.is}):me.createElement("select"),C.multiple?U.multiple=!0:C.size&&(U.size=C.size);break;default:U=typeof C.is=="string"?me.createElement(I,{is:C.is}):me.createElement(I)}}U[Qt]=p,U[hn]=C;e:for(me=p.child;me!==null;){if(me.tag===5||me.tag===6)U.appendChild(me.stateNode);else if(me.tag!==4&&me.tag!==27&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===p)break e;for(;me.sibling===null;){if(me.return===null||me.return===p)break e;me=me.return}me.sibling.return=me.return,me=me.sibling}p.stateNode=U;e:switch(Va(U,I,C),I){case"button":case"input":case"select":case"textarea":C=!!C.autoFocus;break e;case"img":C=!0;break e;default:C=!1}C&&Bu(p)}}return Ui(p),Mg(p,p.type,u===null?null:u.memoizedProps,p.pendingProps,y),null;case 6:if(u&&p.stateNode!=null)u.memoizedProps!==C&&Bu(p);else{if(typeof C!="string"&&p.stateNode===null)throw Error(r(166));if(u=Q.current,sm(p)){if(u=p.stateNode,y=p.memoizedProps,C=null,I=Us,I!==null)switch(I.tag){case 27:case 5:C=I.memoizedProps}u[Qt]=p,u=!!(u.nodeValue===y||C!==null&&C.suppressHydrationWarning===!0||UI(u.nodeValue,y)),u||Du(p,!0)}else u=a4(u).createTextNode(C),u[Qt]=p,p.stateNode=u}return Ui(p),null;case 31:if(y=p.memoizedState,u===null||u.memoizedState!==null){if(C=sm(p),y!==null){if(u===null){if(!C)throw Error(r(318));if(u=p.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[Qt]=p}else bf(),(p.flags&128)===0&&(p.memoizedState=null),p.flags|=4;Ui(p),u=!1}else y=lv(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=y),u=!0;if(!u)return p.flags&256?(Js(p),p):(Js(p),null);if((p.flags&128)!==0)throw Error(r(558))}return Ui(p),null;case 13:if(C=p.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(I=sm(p),C!==null&&C.dehydrated!==null){if(u===null){if(!I)throw Error(r(318));if(I=p.memoizedState,I=I!==null?I.dehydrated:null,!I)throw Error(r(317));I[Qt]=p}else bf(),(p.flags&128)===0&&(p.memoizedState=null),p.flags|=4;Ui(p),I=!1}else I=lv(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=I),I=!0;if(!I)return p.flags&256?(Js(p),p):(Js(p),null)}return Js(p),(p.flags&128)!==0?(p.lanes=y,p):(y=C!==null,u=u!==null&&u.memoizedState!==null,y&&(C=p.child,I=null,C.alternate!==null&&C.alternate.memoizedState!==null&&C.alternate.memoizedState.cachePool!==null&&(I=C.alternate.memoizedState.cachePool.pool),U=null,C.memoizedState!==null&&C.memoizedState.cachePool!==null&&(U=C.memoizedState.cachePool.pool),U!==I&&(C.flags|=2048)),y!==u&&y&&(p.child.flags|=8192),zd(p,p.updateQueue),Ui(p),null);case 4:return K(),u===null&&VE(p.stateNode.containerInfo),Ui(p),null;case 10:return ju(p.type),Ui(p),null;case 19:if(X(Qr),C=p.memoizedState,C===null)return Ui(p),null;if(I=(p.flags&128)!==0,U=C.rendering,U===null)if(I)Hu(C,!1);else{if(Ns!==0||u!==null&&(u.flags&128)!==0)for(u=p.child;u!==null;){if(U=Dl(u),U!==null){for(p.flags|=128,Hu(C,!1),u=U.updateQueue,p.updateQueue=u,zd(p,u),p.subtreeFlags=0,u=y,y=p.child;y!==null;)em(y,u),y=y.sibling;return F(Qr,Qr.current&1|2),Zr&&Pu(p,C.treeForkCount),p.child}u=u.sibling}C.tail!==null&&Y()>no&&(p.flags|=128,I=!0,Hu(C,!1),p.lanes=4194304)}else{if(!I)if(u=Dl(U),u!==null){if(p.flags|=128,I=!0,u=u.updateQueue,p.updateQueue=u,zd(p,u),Hu(C,!0),C.tail===null&&C.tailMode==="hidden"&&!U.alternate&&!Zr)return Ui(p),null}else 2*Y()-C.renderingStartTime>no&&y!==536870912&&(p.flags|=128,I=!0,Hu(C,!1),p.lanes=4194304);C.isBackwards?(U.sibling=p.child,p.child=U):(u=C.last,u!==null?u.sibling=U:p.child=U,C.last=U)}return C.tail!==null?(u=C.tail,C.rendering=u,C.tail=u.sibling,C.renderingStartTime=Y(),u.sibling=null,y=Qr.current,F(Qr,I?y&1|2:y&1),Zr&&Pu(p,C.treeForkCount),u):(Ui(p),null);case 22:case 23:return Js(p),xg(),C=p.memoizedState!==null,u!==null?u.memoizedState!==null!==C&&(p.flags|=8192):C&&(p.flags|=8192),C?(y&536870912)!==0&&(p.flags&128)===0&&(Ui(p),p.subtreeFlags&6&&(p.flags|=8192)):Ui(p),y=p.updateQueue,y!==null&&zd(p,y.retryQueue),y=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),C=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(C=p.memoizedState.cachePool.pool),C!==y&&(p.flags|=2048),u!==null&&X(Sf),null;case 24:return y=null,u!==null&&(y=u.memoizedState.cache),p.memoizedState.cache!==y&&(p.flags|=2048),ju(go),Ui(p),null;case 25:return null;case 30:return null}throw Error(r(156,p.tag))}function yc(u,p){switch(ov(p),p.tag){case 1:return u=p.flags,u&65536?(p.flags=u&-65537|128,p):null;case 3:return ju(go),K(),u=p.flags,(u&65536)!==0&&(u&128)===0?(p.flags=u&-65537|128,p):null;case 26:case 27:case 5:return he(p),null;case 31:if(p.memoizedState!==null){if(Js(p),p.alternate===null)throw Error(r(340));bf()}return u=p.flags,u&65536?(p.flags=u&-65537|128,p):null;case 13:if(Js(p),u=p.memoizedState,u!==null&&u.dehydrated!==null){if(p.alternate===null)throw Error(r(340));bf()}return u=p.flags,u&65536?(p.flags=u&-65537|128,p):null;case 19:return X(Qr),null;case 4:return K(),null;case 10:return ju(p.type),null;case 22:case 23:return Js(p),xg(),u!==null&&X(Sf),u=p.flags,u&65536?(p.flags=u&-65537|128,p):null;case 24:return ju(go),null;case 25:return null;default:return null}}function Ol(u,p){switch(ov(p),p.tag){case 3:ju(go),K();break;case 26:case 27:case 5:he(p);break;case 4:K();break;case 31:p.memoizedState!==null&&Js(p);break;case 13:Js(p);break;case 19:X(Qr);break;case 10:ju(p.type);break;case 22:case 23:Js(p),xg(),u!==null&&X(Sf);break;case 24:ju(go)}}function bc(u,p){try{var y=p.updateQueue,C=y!==null?y.lastEffect:null;if(C!==null){var I=C.next;y=I;do{if((y.tag&u)===u){C=void 0;var U=y.create,me=y.inst;C=U(),me.destroy=C}y=y.next}while(y!==I)}}catch(je){di(p,p.return,je)}}function oa(u,p,y){try{var C=p.updateQueue,I=C!==null?C.lastEffect:null;if(I!==null){var U=I.next;C=U;do{if((C.tag&u)===u){var me=C.inst,je=me.destroy;if(je!==void 0){me.destroy=void 0,I=p;var ct=y,At=je;try{At()}catch(Wt){di(I,ct,Wt)}}}C=C.next}while(C!==U)}}catch(Wt){di(p,p.return,Wt)}}function eu(u){var p=u.updateQueue;if(p!==null){var y=u.stateNode;try{g3(p,y)}catch(C){di(u,u.return,C)}}}function qo(u,p,y){y.props=Af(u.type,u.memoizedProps),y.state=u.memoizedState;try{y.componentWillUnmount()}catch(C){di(u,p,C)}}function Fd(u,p){try{var y=u.ref;if(y!==null){switch(u.tag){case 26:case 27:case 5:var C=u.stateNode;break;case 30:C=u.stateNode;break;default:C=u.stateNode}typeof y=="function"?u.refCleanup=y(C):y.current=C}}catch(I){di(u,p,I)}}function aa(u,p){var y=u.ref,C=u.refCleanup;if(y!==null)if(typeof C=="function")try{C()}catch(I){di(u,p,I)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof y=="function")try{y(null)}catch(I){di(u,p,I)}else y.current=null}function Cg(u){var p=u.type,y=u.memoizedProps,C=u.stateNode;try{e:switch(p){case"button":case"input":case"select":case"textarea":y.autoFocus&&C.focus();break e;case"img":y.src?C.src=y.src:y.srcSet&&(C.srcset=y.srcSet)}}catch(I){di(u,u.return,I)}}function Io(u,p,y){try{var C=u.stateNode;qQ(C,u.type,y,p),C[hn]=p}catch(I){di(u,u.return,I)}}function ps(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&Tm(u.type)||u.tag===4}function qr(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||ps(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&&Tm(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 Gu(u,p,y){var C=u.tag;if(C===5||C===6)u=u.stateNode,p?(y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y).insertBefore(u,p):(p=y.nodeType===9?y.body:y.nodeName==="HTML"?y.ownerDocument.body:y,p.appendChild(u),y=y._reactRootContainer,y!=null||p.onclick!==null||(p.onclick=Ls));else if(C!==4&&(C===27&&Tm(u.type)&&(y=u.stateNode,p=null),u=u.child,u!==null))for(Gu(u,p,y),u=u.sibling;u!==null;)Gu(u,p,y),u=u.sibling}function Ua(u,p,y){var C=u.tag;if(C===5||C===6)u=u.stateNode,p?y.insertBefore(u,p):y.appendChild(u);else if(C!==4&&(C===27&&Tm(u.type)&&(y=u.stateNode),u=u.child,u!==null))for(Ua(u,p,y),u=u.sibling;u!==null;)Ua(u,p,y),u=u.sibling}function jv(u){var p=u.stateNode,y=u.memoizedProps;try{for(var C=u.type,I=p.attributes;I.length;)p.removeAttributeNode(I[0]);Va(p,C,y),p[Qt]=u,p[hn]=y}catch(U){di(u,u.return,U)}}var _c=!1,Zi=!1,tu=!1,i4=typeof WeakSet=="function"?WeakSet:Set,Xo=null;function BE(u,p){if(u=u.containerInfo,qE=p4,u=ns(u),zs(u)){if("selectionStart"in u)var y={start:u.selectionStart,end:u.selectionEnd};else e:{y=(y=u.ownerDocument)&&y.defaultView||window;var C=y.getSelection&&y.getSelection();if(C&&C.rangeCount!==0){y=C.anchorNode;var I=C.anchorOffset,U=C.focusNode;C=C.focusOffset;try{y.nodeType,U.nodeType}catch{y=null;break e}var me=0,je=-1,ct=-1,At=0,Wt=0,Jt=u,Rt=null;t:for(;;){for(var Ut;Jt!==y||I!==0&&Jt.nodeType!==3||(je=me+I),Jt!==U||C!==0&&Jt.nodeType!==3||(ct=me+C),Jt.nodeType===3&&(me+=Jt.nodeValue.length),(Ut=Jt.firstChild)!==null;)Rt=Jt,Jt=Ut;for(;;){if(Jt===u)break t;if(Rt===y&&++At===I&&(je=me),Rt===U&&++Wt===C&&(ct=me),(Ut=Jt.nextSibling)!==null)break;Jt=Rt,Rt=Jt.parentNode}Jt=Ut}y=je===-1||ct===-1?null:{start:je,end:ct}}else y=null}y=y||{start:0,end:0}}else y=null;for(XE={focusedElem:u,selectionRange:y},p4=!1,Xo=p;Xo!==null;)if(p=Xo,u=p.child,(p.subtreeFlags&1028)!==0&&u!==null)u.return=p,Xo=u;else for(;Xo!==null;){switch(p=Xo,U=p.alternate,u=p.flags,p.tag){case 0:if((u&4)!==0&&(u=p.updateQueue,u=u!==null?u.events:null,u!==null))for(y=0;y<u.length;y++)I=u[y],I.ref.impl=I.nextImpl;break;case 11:case 15:break;case 1:if((u&1024)!==0&&U!==null){u=void 0,y=p,I=U.memoizedProps,U=U.memoizedState,C=y.stateNode;try{var Bn=Af(y.type,I);u=C.getSnapshotBeforeUpdate(Bn,U),C.__reactInternalSnapshotBeforeUpdate=u}catch(lr){di(y,y.return,lr)}}break;case 3:if((u&1024)!==0){if(u=p.stateNode.containerInfo,y=u.nodeType,y===9)ZE(u);else if(y===1)switch(u.nodeName){case"HEAD":case"HTML":case"BODY":ZE(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=p.sibling,u!==null){u.return=p.return,Xo=u;break}Xo=p.return}}function ms(u,p,y){var C=y.flags;switch(y.tag){case 0:case 11:case 15:Mc(u,y),C&4&&bc(5,y);break;case 1:if(Mc(u,y),C&4)if(u=y.stateNode,p===null)try{u.componentDidMount()}catch(me){di(y,y.return,me)}else{var I=Af(y.type,p.memoizedProps);p=p.memoizedState;try{u.componentDidUpdate(I,p,u.__reactInternalSnapshotBeforeUpdate)}catch(me){di(y,y.return,me)}}C&64&&eu(y),C&512&&Fd(y,y.return);break;case 3:if(Mc(u,y),C&64&&(u=y.updateQueue,u!==null)){if(p=null,y.child!==null)switch(y.child.tag){case 27:case 5:p=y.child.stateNode;break;case 1:p=y.child.stateNode}try{g3(u,p)}catch(me){di(y,y.return,me)}}break;case 27:p===null&&C&4&&jv(y);case 26:case 5:Mc(u,y),p===null&&C&4&&Cg(y),C&512&&Fd(y,y.return);break;case 12:Mc(u,y);break;case 31:Mc(u,y),C&4&&Nf(u,y);break;case 13:Mc(u,y),C&4&&gm(u,y),C&64&&(u=y.memoizedState,u!==null&&(u=u.dehydrated,u!==null&&(y=E.bind(null,y),tJ(u,y))));break;case 22:if(C=y.memoizedState!==null||_c,!C){p=p!==null&&p.memoizedState!==null||Zi,I=_c;var U=Zi;_c=C,(Zi=p)&&!U?Ba(u,y,(y.subtreeFlags&8772)!==0):Mc(u,y),_c=I,Zi=U}break;case 30:break;default:Mc(u,y)}}function Eg(u){var p=u.alternate;p!==null&&(u.alternate=null,Eg(p)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(p=u.stateNode,p!==null&&tn(p)),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 Ai=null,Ma=!1;function wc(u,p,y){for(y=y.child;y!==null;)zv(u,p,y),y=y.sibling}function zv(u,p,y){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(Qe,y)}catch{}switch(y.tag){case 26:Zi||aa(y,p),wc(u,p,y),y.memoizedState?y.memoizedState.count--:y.stateNode&&(y=y.stateNode,y.parentNode.removeChild(y));break;case 27:Zi||aa(y,p);var C=Ai,I=Ma;Tm(y.type)&&(Ai=y.stateNode,Ma=!1),wc(u,p,y),c_(y.stateNode),Ai=C,Ma=I;break;case 5:Zi||aa(y,p);case 6:if(C=Ai,I=Ma,Ai=null,wc(u,p,y),Ai=C,Ma=I,Ai!==null)if(Ma)try{(Ai.nodeType===9?Ai.body:Ai.nodeName==="HTML"?Ai.ownerDocument.body:Ai).removeChild(y.stateNode)}catch(U){di(y,p,U)}else try{Ai.removeChild(y.stateNode)}catch(U){di(y,p,U)}break;case 18:Ai!==null&&(Ma?(u=Ai,$I(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,y.stateNode),$v(u)):$I(Ai,y.stateNode));break;case 4:C=Ai,I=Ma,Ai=y.stateNode.containerInfo,Ma=!0,wc(u,p,y),Ai=C,Ma=I;break;case 0:case 11:case 14:case 15:oa(2,y,p),Zi||oa(4,y,p),wc(u,p,y);break;case 1:Zi||(aa(y,p),C=y.stateNode,typeof C.componentWillUnmount=="function"&&qo(y,p,C)),wc(u,p,y);break;case 21:wc(u,p,y);break;case 22:Zi=(C=Zi)||y.memoizedState!==null,wc(u,p,y),Zi=C;break;default:wc(u,p,y)}}function Nf(u,p){if(p.memoizedState===null&&(u=p.alternate,u!==null&&(u=u.memoizedState,u!==null))){u=u.dehydrated;try{$v(u)}catch(y){di(p,p.return,y)}}}function gm(u,p){if(p.memoizedState===null&&(u=p.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{$v(u)}catch(y){di(p,p.return,y)}}function r_(u){switch(u.tag){case 31:case 13:case 19:var p=u.stateNode;return p===null&&(p=u.stateNode=new i4),p;case 22:return u=u.stateNode,p=u._retryCache,p===null&&(p=u._retryCache=new i4),p;default:throw Error(r(435,u.tag))}}function Ud(u,p){var y=r_(u);p.forEach(function(C){if(!y.has(C)){y.add(C);var I=P.bind(null,u,C);C.then(I,I)}})}function Do(u,p){var y=p.deletions;if(y!==null)for(var C=0;C<y.length;C++){var I=y[C],U=u,me=p,je=me;e:for(;je!==null;){switch(je.tag){case 27:if(Tm(je.type)){Ai=je.stateNode,Ma=!1;break e}break;case 5:Ai=je.stateNode,Ma=!1;break e;case 3:case 4:Ai=je.stateNode.containerInfo,Ma=!0;break e}je=je.return}if(Ai===null)throw Error(r(160));zv(U,me,I),Ai=null,Ma=!1,U=I.alternate,U!==null&&(U.return=null),I.return=null}if(p.subtreeFlags&13886)for(p=p.child;p!==null;)kf(p,u),p=p.sibling}var Sc=null;function kf(u,p){var y=u.alternate,C=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:Do(p,u),Oo(u),C&4&&(oa(3,u,u.return),bc(3,u),oa(5,u,u.return));break;case 1:Do(p,u),Oo(u),C&512&&(Zi||y===null||aa(y,y.return)),C&64&&_c&&(u=u.updateQueue,u!==null&&(C=u.callbacks,C!==null&&(y=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=y===null?C:y.concat(C))));break;case 26:var I=Sc;if(Do(p,u),Oo(u),C&512&&(Zi||y===null||aa(y,y.return)),C&4){var U=y!==null?y.memoizedState:null;if(C=u.memoizedState,y===null)if(C===null)if(u.stateNode===null){e:{C=u.type,y=u.memoizedProps,I=I.ownerDocument||I;t:switch(C){case"title":U=I.getElementsByTagName("title")[0],(!U||U[Ct]||U[Qt]||U.namespaceURI==="http://www.w3.org/2000/svg"||U.hasAttribute("itemprop"))&&(U=I.createElement(C),I.head.insertBefore(U,I.querySelector("head > title"))),Va(U,C,y),U[Qt]=u,tt(U),C=U;break e;case"link":var me=rD("link","href",I).get(C+(y.href||""));if(me){for(var je=0;je<me.length;je++)if(U=me[je],U.getAttribute("href")===(y.href==null||y.href===""?null:y.href)&&U.getAttribute("rel")===(y.rel==null?null:y.rel)&&U.getAttribute("title")===(y.title==null?null:y.title)&&U.getAttribute("crossorigin")===(y.crossOrigin==null?null:y.crossOrigin)){me.splice(je,1);break t}}U=I.createElement(C),Va(U,C,y),I.head.appendChild(U);break;case"meta":if(me=rD("meta","content",I).get(C+(y.content||""))){for(je=0;je<me.length;je++)if(U=me[je],U.getAttribute("content")===(y.content==null?null:""+y.content)&&U.getAttribute("name")===(y.name==null?null:y.name)&&U.getAttribute("property")===(y.property==null?null:y.property)&&U.getAttribute("http-equiv")===(y.httpEquiv==null?null:y.httpEquiv)&&U.getAttribute("charset")===(y.charSet==null?null:y.charSet)){me.splice(je,1);break t}}U=I.createElement(C),Va(U,C,y),I.head.appendChild(U);break;default:throw Error(r(468,C))}U[Qt]=u,tt(U),C=U}u.stateNode=C}else iD(I,u.type,u.stateNode);else u.stateNode=nD(I,C,u.memoizedProps);else U!==C?(U===null?y.stateNode!==null&&(y=y.stateNode,y.parentNode.removeChild(y)):U.count--,C===null?iD(I,u.type,u.stateNode):nD(I,C,u.memoizedProps)):C===null&&u.stateNode!==null&&Io(u,u.memoizedProps,y.memoizedProps)}break;case 27:Do(p,u),Oo(u),C&512&&(Zi||y===null||aa(y,y.return)),y!==null&&C&4&&Io(u,u.memoizedProps,y.memoizedProps);break;case 5:if(Do(p,u),Oo(u),C&512&&(Zi||y===null||aa(y,y.return)),u.flags&32){I=u.stateNode;try{Os(I,"")}catch(Bn){di(u,u.return,Bn)}}C&4&&u.stateNode!=null&&(I=u.memoizedProps,Io(u,I,y!==null?y.memoizedProps:I)),C&1024&&(tu=!0);break;case 6:if(Do(p,u),Oo(u),C&4){if(u.stateNode===null)throw Error(r(162));C=u.memoizedProps,y=u.stateNode;try{y.nodeValue=C}catch(Bn){di(u,u.return,Bn)}}break;case 3:if(u4=null,I=Sc,Sc=l4(p.containerInfo),Do(p,u),Sc=I,Oo(u),C&4&&y!==null&&y.memoizedState.isDehydrated)try{$v(p.containerInfo)}catch(Bn){di(u,u.return,Bn)}tu&&(tu=!1,Fv(u));break;case 4:C=Sc,Sc=l4(u.stateNode.containerInfo),Do(p,u),Oo(u),Sc=C;break;case 12:Do(p,u),Oo(u);break;case 31:Do(p,u),Oo(u),C&4&&(C=u.updateQueue,C!==null&&(u.updateQueue=null,Ud(u,C)));break;case 13:Do(p,u),Oo(u),u.child.flags&8192&&u.memoizedState!==null!=(y!==null&&y.memoizedState!==null)&&(xm=Y()),C&4&&(C=u.updateQueue,C!==null&&(u.updateQueue=null,Ud(u,C)));break;case 22:I=u.memoizedState!==null;var ct=y!==null&&y.memoizedState!==null,At=_c,Wt=Zi;if(_c=At||I,Zi=Wt||ct,Do(p,u),Zi=Wt,_c=At,Oo(u),C&8192)e:for(p=u.stateNode,p._visibility=I?p._visibility&-2:p._visibility|1,I&&(y===null||ct||_c||Zi||Vu(u)),y=null,p=u;;){if(p.tag===5||p.tag===26){if(y===null){ct=y=p;try{if(U=ct.stateNode,I)me=U.style,typeof me.setProperty=="function"?me.setProperty("display","none","important"):me.display="none";else{je=ct.stateNode;var Jt=ct.memoizedProps.style,Rt=Jt!=null&&Jt.hasOwnProperty("display")?Jt.display:null;je.style.display=Rt==null||typeof Rt=="boolean"?"":(""+Rt).trim()}}catch(Bn){di(ct,ct.return,Bn)}}}else if(p.tag===6){if(y===null){ct=p;try{ct.stateNode.nodeValue=I?"":ct.memoizedProps}catch(Bn){di(ct,ct.return,Bn)}}}else if(p.tag===18){if(y===null){ct=p;try{var Ut=ct.stateNode;I?qI(Ut,!0):qI(ct.stateNode,!1)}catch(Bn){di(ct,ct.return,Bn)}}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===u)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===u)break e;for(;p.sibling===null;){if(p.return===null||p.return===u)break e;y===p&&(y=null),p=p.return}y===p&&(y=null),p.sibling.return=p.return,p=p.sibling}C&4&&(C=u.updateQueue,C!==null&&(y=C.retryQueue,y!==null&&(C.retryQueue=null,Ud(u,y))));break;case 19:Do(p,u),Oo(u),C&4&&(C=u.updateQueue,C!==null&&(u.updateQueue=null,Ud(u,C)));break;case 30:break;case 21:break;default:Do(p,u),Oo(u)}}function Oo(u){var p=u.flags;if(p&2){try{for(var y,C=u.return;C!==null;){if(ps(C)){y=C;break}C=C.return}if(y==null)throw Error(r(160));switch(y.tag){case 27:var I=y.stateNode,U=qr(u);Ua(u,U,I);break;case 5:var me=y.stateNode;y.flags&32&&(Os(me,""),y.flags&=-33);var je=qr(u);Ua(u,je,me);break;case 3:case 4:var ct=y.stateNode.containerInfo,At=qr(u);Gu(u,At,ct);break;default:throw Error(r(161))}}catch(Wt){di(u,u.return,Wt)}u.flags&=-3}p&4096&&(u.flags&=-4097)}function Fv(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var p=u;Fv(p),p.tag===5&&p.flags&1024&&p.stateNode.reset(),u=u.sibling}}function Mc(u,p){if(p.subtreeFlags&8772)for(p=p.child;p!==null;)ms(u,p.alternate,p),p=p.sibling}function Vu(u){for(u=u.child;u!==null;){var p=u;switch(p.tag){case 0:case 11:case 14:case 15:oa(4,p,p.return),Vu(p);break;case 1:aa(p,p.return);var y=p.stateNode;typeof y.componentWillUnmount=="function"&&qo(p,p.return,y),Vu(p);break;case 27:c_(p.stateNode);case 26:case 5:aa(p,p.return),Vu(p);break;case 22:p.memoizedState===null&&Vu(p);break;case 30:Vu(p);break;default:Vu(p)}u=u.sibling}}function Ba(u,p,y){for(y=y&&(p.subtreeFlags&8772)!==0,p=p.child;p!==null;){var C=p.alternate,I=u,U=p,me=U.flags;switch(U.tag){case 0:case 11:case 15:Ba(I,U,y),bc(4,U);break;case 1:if(Ba(I,U,y),C=U,I=C.stateNode,typeof I.componentDidMount=="function")try{I.componentDidMount()}catch(At){di(C,C.return,At)}if(C=U,I=C.updateQueue,I!==null){var je=C.stateNode;try{var ct=I.shared.hiddenCallbacks;if(ct!==null)for(I.shared.hiddenCallbacks=null,I=0;I<ct.length;I++)um(ct[I],je)}catch(At){di(C,C.return,At)}}y&&me&64&&eu(U),Fd(U,U.return);break;case 27:jv(U);case 26:case 5:Ba(I,U,y),y&&C===null&&me&4&&Cg(U),Fd(U,U.return);break;case 12:Ba(I,U,y);break;case 31:Ba(I,U,y),y&&me&4&&Nf(I,U);break;case 13:Ba(I,U,y),y&&me&4&&gm(I,U);break;case 22:U.memoizedState===null&&Ba(I,U,y),Fd(U,U.return);break;case 30:break;default:Ba(I,U,y)}p=p.sibling}}function Rf(u,p){var y=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),u=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(u=p.memoizedState.cachePool.pool),u!==y&&(u!=null&&u.refCount++,y!=null&&Ph(y))}function $h(u,p){u=null,p.alternate!==null&&(u=p.alternate.memoizedState.cache),p=p.memoizedState.cache,p!==u&&(p.refCount++,u!=null&&Ph(u))}function la(u,p,y,C){if(p.subtreeFlags&10256)for(p=p.child;p!==null;)i_(u,p,y,C),p=p.sibling}function i_(u,p,y,C){var I=p.flags;switch(p.tag){case 0:case 11:case 15:la(u,p,y,C),I&2048&&bc(9,p);break;case 1:la(u,p,y,C);break;case 3:la(u,p,y,C),I&2048&&(u=null,p.alternate!==null&&(u=p.alternate.memoizedState.cache),p=p.memoizedState.cache,p!==u&&(p.refCount++,u!=null&&Ph(u)));break;case 12:if(I&2048){la(u,p,y,C),u=p.stateNode;try{var U=p.memoizedProps,me=U.id,je=U.onPostCommit;typeof je=="function"&&je(me,p.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(ct){di(p,p.return,ct)}}else la(u,p,y,C);break;case 31:la(u,p,y,C);break;case 13:la(u,p,y,C);break;case 23:break;case 22:U=p.stateNode,me=p.alternate,p.memoizedState!==null?U._visibility&2?la(u,p,y,C):Wu(u,p):U._visibility&2?la(u,p,y,C):(U._visibility|=2,ca(u,p,y,C,(p.subtreeFlags&10256)!==0||!1)),I&2048&&Rf(me,p);break;case 24:la(u,p,y,C),I&2048&&$h(p.alternate,p);break;default:la(u,p,y,C)}}function ca(u,p,y,C,I){for(I=I&&((p.subtreeFlags&10256)!==0||!1),p=p.child;p!==null;){var U=u,me=p,je=y,ct=C,At=me.flags;switch(me.tag){case 0:case 11:case 15:ca(U,me,je,ct,I),bc(8,me);break;case 23:break;case 22:var Wt=me.stateNode;me.memoizedState!==null?Wt._visibility&2?ca(U,me,je,ct,I):Wu(U,me):(Wt._visibility|=2,ca(U,me,je,ct,I)),I&&At&2048&&Rf(me.alternate,me);break;case 24:ca(U,me,je,ct,I),I&&At&2048&&$h(me.alternate,me);break;default:ca(U,me,je,ct,I)}p=p.sibling}}function Wu(u,p){if(p.subtreeFlags&10256)for(p=p.child;p!==null;){var y=u,C=p,I=C.flags;switch(C.tag){case 22:Wu(y,C),I&2048&&Rf(C.alternate,C);break;case 24:Wu(y,C),I&2048&&$h(C.alternate,C);break;default:Wu(y,C)}p=p.sibling}}var qh=8192;function Ll(u,p,y){if(u.subtreeFlags&qh)for(u=u.child;u!==null;)Uv(u,p,y),u=u.sibling}function Uv(u,p,y){switch(u.tag){case 26:Ll(u,p,y),u.flags&qh&&u.memoizedState!==null&&hJ(y,Sc,u.memoizedState,u.memoizedProps);break;case 5:Ll(u,p,y);break;case 3:case 4:var C=Sc;Sc=l4(u.stateNode.containerInfo),Ll(u,p,y),Sc=C;break;case 22:u.memoizedState===null&&(C=u.alternate,C!==null&&C.memoizedState!==null?(C=qh,qh=16777216,Ll(u,p,y),qh=C):Ll(u,p,y));break;default:Ll(u,p,y)}}function Xh(u){var p=u.alternate;if(p!==null&&(u=p.child,u!==null)){p.child=null;do p=u.sibling,u.sibling=null,u=p;while(u!==null)}}function Pf(u){var p=u.deletions;if((u.flags&16)!==0){if(p!==null)for(var y=0;y<p.length;y++){var C=p[y];Xo=C,Bs(C,u)}Xh(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)ul(u),u=u.sibling}function ul(u){switch(u.tag){case 0:case 11:case 15:Pf(u),u.flags&2048&&oa(9,u,u.return);break;case 3:Pf(u);break;case 12:Pf(u);break;case 22:var p=u.stateNode;u.memoizedState!==null&&p._visibility&2&&(u.return===null||u.return.tag!==13)?(p._visibility&=-3,dl(u)):Pf(u);break;default:Pf(u)}}function dl(u){var p=u.deletions;if((u.flags&16)!==0){if(p!==null)for(var y=0;y<p.length;y++){var C=p[y];Xo=C,Bs(C,u)}Xh(u)}for(u=u.child;u!==null;){switch(p=u,p.tag){case 0:case 11:case 15:oa(8,p,p.return),dl(p);break;case 22:y=p.stateNode,y._visibility&2&&(y._visibility&=-3,dl(p));break;default:dl(p)}u=u.sibling}}function Bs(u,p){for(;Xo!==null;){var y=Xo;switch(y.tag){case 0:case 11:case 15:oa(8,y,p);break;case 23:case 22:if(y.memoizedState!==null&&y.memoizedState.cachePool!==null){var C=y.memoizedState.cachePool.pool;C!=null&&C.refCount++}break;case 24:Ph(y.memoizedState.cache)}if(C=y.child,C!==null)C.return=y,Xo=C;else e:for(y=u;Xo!==null;){C=Xo;var I=C.sibling,U=C.return;if(Eg(C),C===y){Xo=null;break e}if(I!==null){I.return=U,Xo=I;break e}Xo=U}}}var Bd={getCacheForType:function(u){var p=dr(go),y=p.data.get(u);return y===void 0&&(y=u(),p.data.set(u,y)),y},cacheSignal:function(){return dr(go).controller.signal}},Tr=typeof WeakMap=="function"?WeakMap:Map,$n=0,xr=null,Ir=null,kr=0,ti=0,Ta=null,Tc=!1,nu=!1,s_=!1,jl=0,Ns=0,$u=0,If=0,Ag=0,Ha=0,rs=0,Yh=null,Hs=null,Gs=!1,xm=0,o_=0,no=1/0,ks=null,ro=null,Ni=0,zl=null,vm=null,Cc=0,ym=0,bm=null,Ng=null,Df=0,Kh=null;function Fl(){return($n&2)!==0&&kr!==0?kr&-kr:W.T!==null?jt():Bt()}function Br(){if(Ha===0)if((kr&536870912)===0||Zr){var u=Ze;Ze<<=1,(Ze&3932160)===0&&(Ze=262144),Ha=u}else Ha=536870912;return u=ol.current,u!==null&&(u.flags|=32),Ha}function Dr(u,p,y){(u===xr&&(ti===2||ti===9)||u.cancelPendingCommit!==null)&&(Lf(u,0),vo(u,kr,Ha,!1)),ot(u,y),(($n&2)===0||u!==xr)&&(u===xr&&(($n&2)===0&&(If|=y),Ns===4&&vo(u,kr,Ha,!1)),ln(u))}function Hr(u,p,y){if(($n&6)!==0)throw Error(r(327));var C=!y&&(p&127)===0&&(p&u.expiredLanes)===0||Ae(u,p),I=C?kg(u,p):Ga(u,p,!0),U=C;do{if(I===0){nu&&!C&&vo(u,p,0,!1);break}else{if(y=u.current.alternate,U&&!ki(y)){I=Ga(u,p,!1),U=!1;continue}if(I===2){if(U=p,u.errorRecoveryDisabledLanes&U)var me=0;else me=u.pendingLanes&-536870913,me=me!==0?me:me&536870912?536870912:0;if(me!==0){p=me;e:{var je=u;I=Yh;var ct=je.current.memoizedState.isDehydrated;if(ct&&(Lf(je,me).flags|=256),me=Ga(je,me,!1),me!==2){if(s_&&!ct){je.errorRecoveryDisabledLanes|=U,If|=U,I=4;break e}U=Hs,Hs=I,U!==null&&(Hs===null?Hs=U:Hs.push.apply(Hs,U))}I=me}if(U=!1,I!==2)continue}}if(I===1){Lf(u,0),vo(u,p,0,!0);break}e:{switch(C=u,U=I,U){case 0:case 1:throw Error(r(345));case 4:if((p&4194048)!==p)break;case 6:vo(C,p,Ha,!Tc);break e;case 2:Hs=null;break;case 3:case 5:break;default:throw Error(r(329))}if((p&62914560)===p&&(I=xm+300-Y(),10<I)){if(vo(C,p,Ha,!Tc),Je(C,0,!0)!==0)break e;Cc=p,C.timeoutHandle=VI(Xr.bind(null,C,y,Hs,ks,Gs,p,Ha,If,rs,Tc,U,"Throttled",-0,0),I);break e}Xr(C,y,Hs,ks,Gs,p,Ha,If,rs,Tc,U,null,-0,0)}}break}while(!0);ln(u)}function Xr(u,p,y,C,I,U,me,je,ct,At,Wt,Jt,Rt,Ut){if(u.timeoutHandle=-1,Jt=p.subtreeFlags,Jt&8192||(Jt&16785408)===16785408){Jt={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ls},Uv(p,U,Jt);var Bn=(U&62914560)===U?xm-Y():(U&4194048)===U?o_-Y():0;if(Bn=pJ(Jt,Bn),Bn!==null){Cc=U,u.cancelPendingCommit=Bn(Gd.bind(null,u,p,U,y,C,I,me,je,ct,Wt,Jt,null,Rt,Ut)),vo(u,U,me,!At);return}}Gd(u,p,U,y,C,I,me,je,ct)}function ki(u){for(var p=u;;){var y=p.tag;if((y===0||y===11||y===15)&&p.flags&16384&&(y=p.updateQueue,y!==null&&(y=y.stores,y!==null)))for(var C=0;C<y.length;C++){var I=y[C],U=I.getSnapshot;I=I.value;try{if(!ur(U(),I))return!1}catch{return!1}}if(y=p.child,p.subtreeFlags&16384&&y!==null)y.return=p,p=y;else{if(p===u)break;for(;p.sibling===null;){if(p.return===null||p.return===u)return!0;p=p.return}p.sibling.return=p.return,p=p.sibling}}return!0}function vo(u,p,y,C){p&=~Ag,p&=~If,u.suspendedLanes|=p,u.pingedLanes&=~p,C&&(u.warmLanes|=p),C=u.expirationTimes;for(var I=p;0<I;){var U=31-Pe(I),me=1<<U;C[U]=-1,I&=~me}y!==0&&Pt(u,y,p)}function ru(){return($n&6)===0?(Pn(0),!1):!0}function Of(){if(Ir!==null){if(ti===0)var u=Ir.return;else u=Ir,Lu=_f=null,Nb(u),jh=null,zh=0,u=Ir;for(;u!==null;)Ol(u.alternate,u),u=u.return;Ir=null}}function Lf(u,p){var y=u.timeoutHandle;y!==-1&&(u.timeoutHandle=-1,KQ(y)),y=u.cancelPendingCommit,y!==null&&(u.cancelPendingCommit=null,y()),Cc=0,Of(),xr=u,Ir=y=rl(u.current,null),kr=p,ti=0,Ta=null,Tc=!1,nu=Ae(u,p),s_=!1,rs=Ha=Ag=If=$u=Ns=0,Hs=Yh=null,Gs=!1,(p&8)!==0&&(p|=p&32);var C=u.entangledLanes;if(C!==0)for(u=u.entanglements,C&=p;0<C;){var I=31-Pe(C),U=1<<I;p|=u[I],C&=~U}return jl=p,cg(),y}function qu(u,p){Mr=null,W.H=pm,p===Ih||p===Pr?(p=Oh(),ti=3):p===hg?(p=Oh(),ti=4):ti=p===Av?8:p!==null&&typeof p=="object"&&typeof p.then=="function"?6:1,Ta=p,Ir===null&&(Ns=1,Ev(u,Rl(p,u.current)))}function Rs(){var u=ol.current;return u===null?!0:(kr&4194048)===kr?Fa===null:(kr&62914560)===kr||(kr&536870912)!==0?u===Fa:!1}function Hd(){var u=W.H;return W.H=pm,u===null?pm:u}function jf(){var u=W.A;return W.A=Bd,u}function _m(){Ns=4,Tc||(kr&4194048)!==kr&&ol.current!==null||(nu=!0),($u&134217727)===0&&(If&134217727)===0||xr===null||vo(xr,kr,Ha,!1)}function Ga(u,p,y){var C=$n;$n|=2;var I=Hd(),U=jf();(xr!==u||kr!==p)&&(ks=null,Lf(u,p)),p=!1;var me=Ns;e:do try{if(ti!==0&&Ir!==null){var je=Ir,ct=Ta;switch(ti){case 8:Of(),me=6;break e;case 3:case 2:case 9:case 6:ol.current===null&&(p=!0);var At=ti;if(ti=0,Ta=null,Zh(u,je,ct,At),y&&nu){me=0;break e}break;default:At=ti,ti=0,Ta=null,Zh(u,je,ct,At)}}wm(),me=Ns;break}catch(Wt){qu(u,Wt)}while(!0);return p&&u.shellSuspendCounter++,Lu=_f=null,$n=C,W.H=I,W.A=U,Ir===null&&(xr=null,kr=0,cg()),me}function wm(){for(;Ir!==null;)Bv(Ir)}function kg(u,p){var y=$n;$n|=2;var C=Hd(),I=jf();xr!==u||kr!==p?(ks=null,no=Y()+500,Lf(u,p)):nu=Ae(u,p);e:do try{if(ti!==0&&Ir!==null){p=Ir;var U=Ta;t:switch(ti){case 1:ti=0,Ta=null,Zh(u,p,U,1);break;case 2:case 9:if(sl(U)){ti=0,Ta=null,Rg(p);break}p=function(){ti!==2&&ti!==9||xr!==u||(ti=7),ln(u)},U.then(p,p);break e;case 3:ti=7;break e;case 4:ti=5;break e;case 7:sl(U)?(ti=0,Ta=null,Rg(p)):(ti=0,Ta=null,Zh(u,p,U,7));break;case 5:var me=null;switch(Ir.tag){case 26:me=Ir.memoizedState;case 5:case 27:var je=Ir;if(me?sD(me):je.stateNode.complete){ti=0,Ta=null;var ct=je.sibling;if(ct!==null)Ir=ct;else{var At=je.return;At!==null?(Ir=At,zf(At)):Ir=null}break t}}ti=0,Ta=null,Zh(u,p,U,5);break;case 6:ti=0,Ta=null,Zh(u,p,U,6);break;case 8:Of(),Ns=6;break e;default:throw Error(r(462))}}fl();break}catch(Wt){qu(u,Wt)}while(!0);return Lu=_f=null,W.H=C,W.A=I,$n=y,Ir!==null?0:(xr=null,kr=0,cg(),Ns)}function fl(){for(;Ir!==null&&!Ve();)Bv(Ir)}function Bv(u){var p=Lv(u.alternate,u,jl);u.memoizedProps=u.pendingProps,p===null?zf(u):Ir=p}function Rg(u){var p=u,y=p.alternate;switch(p.tag){case 15:case 0:p=wg(y,p,p.pendingProps,p.type,void 0,kr);break;case 11:p=wg(y,p,p.pendingProps,p.type.render,p.ref,kr);break;case 5:Nb(p);default:Ol(y,p),p=Ir=em(p,jl),p=Lv(y,p,jl)}u.memoizedProps=u.pendingProps,p===null?zf(u):Ir=p}function Zh(u,p,y,C){Lu=_f=null,Nb(p),jh=null,zh=0;var I=p.return;try{if(Po(u,I,p,y,kr)){Ns=1,Ev(u,Rl(y,u.current)),Ir=null;return}}catch(U){if(I!==null)throw Ir=I,U;Ns=1,Ev(u,Rl(y,u.current)),Ir=null;return}p.flags&32768?(Zr||C===1?u=!0:nu||(kr&536870912)!==0?u=!1:(Tc=u=!0,(C===2||C===9||C===3||C===6)&&(C=ol.current,C!==null&&C.tag===13&&(C.flags|=16384))),Pg(p,u)):zf(p)}function zf(u){var p=u;do{if((p.flags&32768)!==0){Pg(p,Tc);return}u=p.return;var y=Tg(p.alternate,p,jl);if(y!==null){Ir=y;return}if(p=p.sibling,p!==null){Ir=p;return}Ir=p=u}while(p!==null);Ns===0&&(Ns=5)}function Pg(u,p){do{var y=yc(u.alternate,u);if(y!==null){y.flags&=32767,Ir=y;return}if(y=u.return,y!==null&&(y.flags|=32768,y.subtreeFlags=0,y.deletions=null),!p&&(u=u.sibling,u!==null)){Ir=u;return}Ir=u=y}while(u!==null);Ns=6,Ir=null}function Gd(u,p,y,C,I,U,me,je,ct){u.cancelPendingCommit=null;do Sm();while(Ni!==0);if(($n&6)!==0)throw Error(r(327));if(p!==null){if(p===u.current)throw Error(r(177));if(U=p.lanes|p.childLanes,U|=Vo,dt(u,y,U,me,je,ct),u===xr&&(Ir=xr=null,kr=0),vm=p,zl=u,Cc=y,ym=U,bm=I,Ng=C,(p.subtreeFlags&10256)!==0||(p.flags&10256)!==0?(u.callbackNode=null,u.callbackPriority=0,q(ge,function(){return Hv(),null})):(u.callbackNode=null,u.callbackPriority=0),C=(p.flags&13878)!==0,(p.subtreeFlags&13878)!==0||C){C=W.T,W.T=null,I=J.p,J.p=2,me=$n,$n|=4;try{BE(u,p,y)}finally{$n=me,J.p=I,W.T=C}}Ni=1,yo(),Vd(),Qh()}}function yo(){if(Ni===1){Ni=0;var u=zl,p=vm,y=(p.flags&13878)!==0;if((p.subtreeFlags&13878)!==0||y){y=W.T,W.T=null;var C=J.p;J.p=2;var I=$n;$n|=4;try{kf(p,u);var U=XE,me=ns(u.containerInfo),je=U.focusedElem,ct=U.selectionRange;if(me!==je&&je&&je.ownerDocument&&er(je.ownerDocument.documentElement,je)){if(ct!==null&&zs(je)){var At=ct.start,Wt=ct.end;if(Wt===void 0&&(Wt=At),"selectionStart"in je)je.selectionStart=At,je.selectionEnd=Math.min(Wt,je.value.length);else{var Jt=je.ownerDocument||document,Rt=Jt&&Jt.defaultView||window;if(Rt.getSelection){var Ut=Rt.getSelection(),Bn=je.textContent.length,lr=Math.min(ct.start,Bn),Ji=ct.end===void 0?lr:Math.min(ct.end,Bn);!Ut.extend&&lr>Ji&&(me=Ji,Ji=lr,lr=me);var _t=Un(je,lr),mt=Un(je,Ji);if(_t&&mt&&(Ut.rangeCount!==1||Ut.anchorNode!==_t.node||Ut.anchorOffset!==_t.offset||Ut.focusNode!==mt.node||Ut.focusOffset!==mt.offset)){var Et=Jt.createRange();Et.setStart(_t.node,_t.offset),Ut.removeAllRanges(),lr>Ji?(Ut.addRange(Et),Ut.extend(mt.node,mt.offset)):(Et.setEnd(mt.node,mt.offset),Ut.addRange(Et))}}}}for(Jt=[],Ut=je;Ut=Ut.parentNode;)Ut.nodeType===1&&Jt.push({element:Ut,left:Ut.scrollLeft,top:Ut.scrollTop});for(typeof je.focus=="function"&&je.focus(),je=0;je<Jt.length;je++){var Kt=Jt[je];Kt.element.scrollLeft=Kt.left,Kt.element.scrollTop=Kt.top}}p4=!!qE,XE=qE=null}finally{$n=I,J.p=C,W.T=y}}u.current=p,Ni=2}}function Vd(){if(Ni===2){Ni=0;var u=zl,p=vm,y=(p.flags&8772)!==0;if((p.subtreeFlags&8772)!==0||y){y=W.T,W.T=null;var C=J.p;J.p=2;var I=$n;$n|=4;try{ms(u,p.alternate,p)}finally{$n=I,J.p=C,W.T=y}}Ni=3}}function Qh(){if(Ni===4||Ni===3){Ni=0,ue();var u=zl,p=vm,y=Cc,C=Ng;(p.subtreeFlags&10256)!==0||(p.flags&10256)!==0?Ni=5:(Ni=0,vm=zl=null,Xu(u,u.pendingLanes));var I=u.pendingLanes;if(I===0&&(ro=null),rn(y),p=p.stateNode,nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(Qe,p,void 0,(p.current.flags&128)===128)}catch{}if(C!==null){p=W.T,I=J.p,J.p=2,W.T=null;try{for(var U=u.onRecoverableError,me=0;me<C.length;me++){var je=C[me];U(je.value,{componentStack:je.stack})}}finally{W.T=p,J.p=I}}(Cc&3)!==0&&Sm(),ln(u),I=u.pendingLanes,(y&261930)!==0&&(I&42)!==0?u===Kh?Df++:(Df=0,Kh=u):Df=0,Pn(0)}}function Xu(u,p){(u.pooledCacheLanes&=p)===0&&(p=u.pooledCache,p!=null&&(u.pooledCache=null,Ph(p)))}function Sm(){return yo(),Vd(),Qh(),Hv()}function Hv(){if(Ni!==5)return!1;var u=zl,p=ym;ym=0;var y=rn(Cc),C=W.T,I=J.p;try{J.p=32>y?32:y,W.T=null,y=bm,bm=null;var U=zl,me=Cc;if(Ni=0,vm=zl=null,Cc=0,($n&6)!==0)throw Error(r(331));var je=$n;if($n|=4,ul(U.current),i_(U,U.current,me,y),$n=je,Pn(0,!1),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(Qe,U)}catch{}return!0}finally{J.p=I,W.T=C,Xu(u,p)}}function a_(u,p,y){p=Rl(y,p),p=Zb(u.stateNode,p,2),u=Mf(u,p,2),u!==null&&(ot(u,2),ln(u))}function di(u,p,y){if(u.tag===3)a_(u,u,y);else for(;p!==null;){if(p.tag===3){a_(p,u,y);break}else if(p.tag===1){var C=p.stateNode;if(typeof p.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(ro===null||!ro.has(C))){u=Rl(y,u),y=Qb(2),C=Mf(p,y,2),C!==null&&(J3(y,C,p,u),ot(C,2),ln(C));break}}p=p.return}}function Ig(u,p,y){var C=u.pingCache;if(C===null){C=u.pingCache=new Tr;var I=new Set;C.set(p,I)}else I=C.get(p),I===void 0&&(I=new Set,C.set(p,I));I.has(y)||(s_=!0,I.add(y),u=g.bind(null,u,p,y),p.then(u,u))}function g(u,p,y){var C=u.pingCache;C!==null&&C.delete(p),u.pingedLanes|=u.suspendedLanes&y,u.warmLanes&=~y,xr===u&&(kr&y)===y&&(Ns===4||Ns===3&&(kr&62914560)===kr&&300>Y()-xm?($n&2)===0&&Lf(u,0):Ag|=y,rs===kr&&(rs=0)),ln(u)}function v(u,p){p===0&&(p=De()),u=ja(u,p),u!==null&&(ot(u,p),ln(u))}function E(u){var p=u.memoizedState,y=0;p!==null&&(y=p.retryLane),v(u,y)}function P(u,p){var y=0;switch(u.tag){case 31:case 13:var C=u.stateNode,I=u.memoizedState;I!==null&&(y=I.retryLane);break;case 19:C=u.stateNode;break;case 22:C=u.stateNode._retryCache;break;default:throw Error(r(314))}C!==null&&C.delete(p),v(u,y)}function q(u,p){return Le(u,p)}var te=null,Oe=null,ut=!1,Ft=!1,on=!1,_n=0;function ln(u){u!==Oe&&u.next===null&&(Oe===null?te=Oe=u:Oe=Oe.next=u),Ft=!0,ut||(ut=!0,St())}function Pn(u,p){if(!on&&Ft){on=!0;do for(var y=!1,C=te;C!==null;){if(u!==0){var I=C.pendingLanes;if(I===0)var U=0;else{var me=C.suspendedLanes,je=C.pingedLanes;U=(1<<31-Pe(42|u)+1)-1,U&=I&~(me&~je),U=U&201326741?U&201326741|1:U?U|2:0}U!==0&&(y=!0,Nt(C,U))}else U=kr,U=Je(C,C===xr?U:0,C.cancelPendingCommit!==null||C.timeoutHandle!==-1),(U&3)===0||Ae(C,U)||(y=!0,Nt(C,U));C=C.next}while(y);on=!1}}function br(){io()}function io(){Ft=ut=!1;var u=0;_n!==0&&YQ()&&(u=_n);for(var p=Y(),y=null,C=te;C!==null;){var I=C.next,U=Mm(C,p);U===0?(C.next=null,y===null?te=I:y.next=I,I===null&&(Oe=y)):(y=C,(u!==0||(U&3)!==0)&&(Ft=!0)),C=I}Ni!==0&&Ni!==5||Pn(u),_n!==0&&(_n=0)}function Mm(u,p){for(var y=u.suspendedLanes,C=u.pingedLanes,I=u.expirationTimes,U=u.pendingLanes&-62914561;0<U;){var me=31-Pe(U),je=1<<me,ct=I[me];ct===-1?((je&y)===0||(je&C)!==0)&&(I[me]=We(je,p)):ct<=p&&(u.expiredLanes|=je),U&=~je}if(p=xr,y=kr,y=Je(u,u===p?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),C=u.callbackNode,y===0||u===p&&(ti===2||ti===9)||u.cancelPendingCommit!==null)return C!==null&&C!==null&&ze(C),u.callbackNode=null,u.callbackPriority=0;if((y&3)===0||Ae(u,y)){if(p=y&-y,p===u.callbackPriority)return p;switch(C!==null&&ze(C),rn(y)){case 2:case 8:y=Te;break;case 32:y=ge;break;case 268435456:y=be;break;default:y=ge}return C=Ff.bind(null,u),y=Le(y,C),u.callbackPriority=p,u.callbackNode=y,p}return C!==null&&C!==null&&ze(C),u.callbackPriority=2,u.callbackNode=null,2}function Ff(u,p){if(Ni!==0&&Ni!==5)return u.callbackNode=null,u.callbackPriority=0,null;var y=u.callbackNode;if(Sm()&&u.callbackNode!==y)return null;var C=kr;return C=Je(u,u===xr?C:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),C===0?null:(Hr(u,C,p),Mm(u,Y()),u.callbackNode!=null&&u.callbackNode===y?Ff.bind(null,u):null)}function Nt(u,p){if(Sm())return null;Hr(u,p,!0)}function St(){ZQ(function(){($n&6)!==0?Le(we,br):io()})}function jt(){if(_n===0){var u=Id;u===0&&(u=$e,$e<<=1,($e&261888)===0&&($e=256)),_n=u}return _n}function xn(u){return u==null||typeof u=="symbol"||typeof u=="boolean"?null:typeof u=="function"?u:_a(""+u)}function tr(u,p){var y=p.ownerDocument.createElement("input");return y.name=p.name,y.value=p.value,u.id&&y.setAttribute("form",u.id),p.parentNode.insertBefore(y,p),u=new FormData(u),y.parentNode.removeChild(y),u}function Ps(u,p,y,C,I){if(p==="submit"&&y&&y.stateNode===I){var U=xn((I[hn]||null).action),me=C.submitter;me&&(p=(p=me[hn]||null)?xn(p.formAction):me.getAttribute("formAction"),p!==null&&(U=p,me=null));var je=new zi("action","action",null,C,I);u.push({event:je,listeners:[{instance:null,listener:function(){if(C.defaultPrevented){if(_n!==0){var ct=me?tr(I,me):new FormData(I);Gb(y,{pending:!0,data:ct,method:I.method,action:U},null,ct)}}else typeof U=="function"&&(je.preventDefault(),ct=me?tr(I,me):new FormData(I),Gb(y,{pending:!0,data:ct,method:I.method,action:U},U,ct))},currentTarget:I}]})}}for(var sr=0;sr<ag.length;sr++){var si=ag[sr],Yo=si.toLowerCase(),gi=si[0].toUpperCase()+si.slice(1);fc(Yo,"on"+gi)}fc(mo,"onAnimationEnd"),fc(ko,"onAnimationIteration"),fc(Qc,"onAnimationStart"),fc("dblclick","onDoubleClick"),fc("focusin","onFocus"),fc("focusout","onBlur"),fc(Go,"onTransitionRun"),fc(tv,"onTransitionStart"),fc(c3,"onTransitionCancel"),fc(pb,"onTransitionEnd"),$t("onMouseEnter",["mouseout","mouseover"]),$t("onMouseLeave",["mouseout","mouseover"]),$t("onPointerEnter",["pointerout","pointerover"]),$t("onPointerLeave",["pointerout","pointerover"]),xt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xt("onBeforeInput",["compositionend","keypress","textInput","paste"]),xt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ec="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(" "),HE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ec));function LI(u,p){p=(p&4)!==0;for(var y=0;y<u.length;y++){var C=u[y],I=C.event;C=C.listeners;e:{var U=void 0;if(p)for(var me=C.length-1;0<=me;me--){var je=C[me],ct=je.instance,At=je.currentTarget;if(je=je.listener,ct!==U&&I.isPropagationStopped())break e;U=je,I.currentTarget=At;try{U(I)}catch(Wt){lg(Wt)}I.currentTarget=null,U=ct}else for(me=0;me<C.length;me++){if(je=C[me],ct=je.instance,At=je.currentTarget,je=je.listener,ct!==U&&I.isPropagationStopped())break e;U=je,I.currentTarget=At;try{U(I)}catch(Wt){lg(Wt)}I.currentTarget=null,U=ct}}}}function ni(u,p){var y=p[Lt];y===void 0&&(y=p[Lt]=new Set);var C=u+"__bubble";y.has(C)||(jI(p,u,2,!1),y.add(C))}function GE(u,p,y){var C=0;p&&(C|=4),jI(y,u,C,p)}var s4="_reactListening"+Math.random().toString(36).slice(2);function VE(u){if(!u[s4]){u[s4]=!0,gt.forEach(function(y){y!=="selectionchange"&&(HE.has(y)||GE(y,!1,u),GE(y,!0,u))});var p=u.nodeType===9?u:u.ownerDocument;p===null||p[s4]||(p[s4]=!0,GE("selectionchange",!1,p))}}function jI(u,p,y,C){switch(fD(p)){case 2:var I=xJ;break;case 8:I=vJ;break;default:I=sA}y=I.bind(null,p,y,u),I=void 0,!Uo||p!=="touchstart"&&p!=="touchmove"&&p!=="wheel"||(I=!0),C?I!==void 0?u.addEventListener(p,y,{capture:!0,passive:I}):u.addEventListener(p,y,!0):I!==void 0?u.addEventListener(p,y,{passive:I}):u.addEventListener(p,y,!1)}function WE(u,p,y,C,I){var U=C;if((p&1)===0&&(p&2)===0&&C!==null)e:for(;;){if(C===null)return;var me=C.tag;if(me===3||me===4){var je=C.stateNode.containerInfo;if(je===I)break;if(me===4)for(me=C.return;me!==null;){var ct=me.tag;if((ct===3||ct===4)&&me.stateNode.containerInfo===I)return;me=me.return}for(;je!==null;){if(me=en(je),me===null)return;if(ct=me.tag,ct===5||ct===6||ct===26||ct===27){C=U=me;continue e}je=je.parentNode}}C=C.return}oc(function(){var At=U,Wt=el(y),Jt=[];e:{var Rt=dc.get(u);if(Rt!==void 0){var Ut=zi,Bn=u;switch(u){case"keypress":if(ii(y)===0)break e;case"keydown":case"keyup":Ut=Md;break;case"focusin":Bn="focus",Ut=wa;break;case"focusout":Bn="blur",Ut=wa;break;case"beforeblur":case"afterblur":Ut=wa;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":Ut=Nh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ut=wd;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ut=eg;break;case mo:case ko:case Qc:Ut=Ks;break;case pb:Ut=tg;break;case"scroll":case"scrollend":Ut=Oa;break;case"wheel":Ut=ng;break;case"copy":case"cut":case"paste":Ut=kl;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ut=cc;break;case"toggle":case"beforetoggle":Ut=ig}var lr=(p&4)!==0,Ji=!lr&&(u==="scroll"||u==="scrollend"),_t=lr?Rt!==null?Rt+"Capture":null:Rt;lr=[];for(var mt=At,Et;mt!==null;){var Kt=mt;if(Et=Kt.stateNode,Kt=Kt.tag,Kt!==5&&Kt!==26&&Kt!==27||Et===null||_t===null||(Kt=ra(mt,_t),Kt!=null&&lr.push(l_(mt,Kt,Et))),Ji)break;mt=mt.return}0<lr.length&&(Rt=new Ut(Rt,Bn,null,y,Wt),Jt.push({event:Rt,listeners:lr}))}}if((p&7)===0){e:{if(Rt=u==="mouseover"||u==="pointerover",Ut=u==="mouseout"||u==="pointerout",Rt&&y!==sc&&(Bn=y.relatedTarget||y.fromElement)&&(en(Bn)||Bn[It]))break e;if((Ut||Rt)&&(Rt=Wt.window===Wt?Wt:(Rt=Wt.ownerDocument)?Rt.defaultView||Rt.parentWindow:window,Ut?(Bn=y.relatedTarget||y.toElement,Ut=At,Bn=Bn?en(Bn):null,Bn!==null&&(Ji=s(Bn),lr=Bn.tag,Bn!==Ji||lr!==5&&lr!==27&&lr!==6)&&(Bn=null)):(Ut=null,Bn=At),Ut!==Bn)){if(lr=Nh,Kt="onMouseLeave",_t="onMouseEnter",mt="mouse",(u==="pointerout"||u==="pointerover")&&(lr=cc,Kt="onPointerLeave",_t="onPointerEnter",mt="pointer"),Ji=Ut==null?Rt:On(Ut),Et=Bn==null?Rt:On(Bn),Rt=new lr(Kt,mt+"leave",Ut,y,Wt),Rt.target=Ji,Rt.relatedTarget=Et,Kt=null,en(Wt)===At&&(lr=new lr(_t,mt+"enter",Bn,y,Wt),lr.target=Et,lr.relatedTarget=Ji,Kt=lr),Ji=Kt,Ut&&Bn)t:{for(lr=VQ,_t=Ut,mt=Bn,Et=0,Kt=_t;Kt;Kt=lr(Kt))Et++;Kt=0;for(var Jn=mt;Jn;Jn=lr(Jn))Kt++;for(;0<Et-Kt;)_t=lr(_t),Et--;for(;0<Kt-Et;)mt=lr(mt),Kt--;for(;Et--;){if(_t===mt||mt!==null&&_t===mt.alternate){lr=_t;break t}_t=lr(_t),mt=lr(mt)}lr=null}else lr=null;Ut!==null&&zI(Jt,Rt,Ut,lr,!1),Bn!==null&&Ji!==null&&zI(Jt,Ji,Bn,lr,!0)}}e:{if(Rt=At?On(At):window,Ut=Rt.nodeName&&Rt.nodeName.toLowerCase(),Ut==="select"||Ut==="input"&&Rt.type==="file")var Mi=Xe;else if(Ad(Rt))if(Ye)Mi=cr;else{Mi=kn;var Wn=Nn}else Ut=Rt.nodeName,!Ut||Ut.toLowerCase()!=="input"||Rt.type!=="checkbox"&&Rt.type!=="radio"?At&&Pa(At.elementType)&&(Mi=Xe):Mi=Dn;if(Mi&&(Mi=Mi(u,At))){Jp(Jt,Mi,y,Wt);break e}Wn&&Wn(u,Rt,At),u==="focusout"&&At&&Rt.type==="number"&&At.memoizedProps.value!=null&&Li(Rt,"number",Rt.value)}switch(Wn=At?On(At):window,u){case"focusin":(Ad(Wn)||Wn.contentEditable==="true")&&(ui=Wn,ds=At,Fs=null);break;case"focusout":Fs=ds=ui=null;break;case"mousedown":sa=!0;break;case"contextmenu":case"mouseup":case"dragend":sa=!1,Bo(Jt,y,Wt);break;case"selectionchange":if(vi)break;case"keydown":case"keyup":Bo(Jt,y,Wt)}var zr;if(Au)e:{switch(u){case"compositionstart":var oi="onCompositionStart";break e;case"compositionend":oi="onCompositionEnd";break e;case"compositionupdate":oi="onCompositionUpdate";break e}oi=void 0}else Nu?Ed(u,y)&&(oi="onCompositionEnd"):u==="keydown"&&y.keyCode===229&&(oi="onCompositionStart");oi&&(Zp&&y.locale!=="ko"&&(Nu||oi!=="onCompositionStart"?oi==="onCompositionEnd"&&Nu&&(zr=Kc()):(Ss=Wt,tl="value"in Ss?Ss.value:Ss.textContent,Nu=!0)),Wn=o4(At,oi),0<Wn.length&&(oi=new $p(oi,u,null,y,Wt),Jt.push({event:oi,listeners:Wn}),zr?oi.data=zr:(zr=js(y),zr!==null&&(oi.data=zr)))),(zr=Kp?Ts(u,y):Qp(u,y))&&(oi=o4(At,"onBeforeInput"),0<oi.length&&(Wn=new $p("onBeforeInput","beforeinput",null,y,Wt),Jt.push({event:Wn,listeners:oi}),Wn.data=zr)),Ps(Jt,u,At,y,Wt)}LI(Jt,p)})}function l_(u,p,y){return{instance:u,listener:p,currentTarget:y}}function o4(u,p){for(var y=p+"Capture",C=[];u!==null;){var I=u,U=I.stateNode;if(I=I.tag,I!==5&&I!==26&&I!==27||U===null||(I=ra(u,y),I!=null&&C.unshift(l_(u,I,U)),I=ra(u,p),I!=null&&C.push(l_(u,I,U))),u.tag===3)return C;u=u.return}return[]}function VQ(u){if(u===null)return null;do u=u.return;while(u&&u.tag!==5&&u.tag!==27);return u||null}function zI(u,p,y,C,I){for(var U=p._reactName,me=[];y!==null&&y!==C;){var je=y,ct=je.alternate,At=je.stateNode;if(je=je.tag,ct!==null&&ct===C)break;je!==5&&je!==26&&je!==27||At===null||(ct=At,I?(At=ra(y,U),At!=null&&me.unshift(l_(y,At,ct))):I||(At=ra(y,U),At!=null&&me.push(l_(y,At,ct)))),y=y.return}me.length!==0&&u.push({event:p,listeners:me})}var WQ=/\r\n?/g,$Q=/\u0000|\uFFFD/g;function FI(u){return(typeof u=="string"?u:""+u).replace(WQ,`
`).replace($Q,"")}function UI(u,p){return p=FI(p),FI(u)===p}function Qi(u,p,y,C,I,U){switch(y){case"children":typeof C=="string"?p==="body"||p==="textarea"&&C===""||Os(u,C):(typeof C=="number"||typeof C=="bigint")&&p!=="body"&&Os(u,""+C);break;case"className":Yt(u,"class",C);break;case"tabIndex":Yt(u,"tabindex",C);break;case"dir":case"role":case"viewBox":case"width":case"height":Yt(u,y,C);break;case"style":ba(u,C,U);break;case"data":if(p!=="object"){Yt(u,"data",C);break}case"src":case"href":if(C===""&&(p!=="a"||y!=="href")){u.removeAttribute(y);break}if(C==null||typeof C=="function"||typeof C=="symbol"||typeof C=="boolean"){u.removeAttribute(y);break}C=_a(""+C),u.setAttribute(y,C);break;case"action":case"formAction":if(typeof C=="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 U=="function"&&(y==="formAction"?(p!=="input"&&Qi(u,p,"name",I.name,I,null),Qi(u,p,"formEncType",I.formEncType,I,null),Qi(u,p,"formMethod",I.formMethod,I,null),Qi(u,p,"formTarget",I.formTarget,I,null)):(Qi(u,p,"encType",I.encType,I,null),Qi(u,p,"method",I.method,I,null),Qi(u,p,"target",I.target,I,null)));if(C==null||typeof C=="symbol"||typeof C=="boolean"){u.removeAttribute(y);break}C=_a(""+C),u.setAttribute(y,C);break;case"onClick":C!=null&&(u.onclick=Ls);break;case"onScroll":C!=null&&ni("scroll",u);break;case"onScrollEnd":C!=null&&ni("scrollend",u);break;case"dangerouslySetInnerHTML":if(C!=null){if(typeof C!="object"||!("__html"in C))throw Error(r(61));if(y=C.__html,y!=null){if(I.children!=null)throw Error(r(60));u.innerHTML=y}}break;case"multiple":u.multiple=C&&typeof C!="function"&&typeof C!="symbol";break;case"muted":u.muted=C&&typeof C!="function"&&typeof C!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(C==null||typeof C=="function"||typeof C=="boolean"||typeof C=="symbol"){u.removeAttribute("xlink:href");break}y=_a(""+C),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":C!=null&&typeof C!="function"&&typeof C!="symbol"?u.setAttribute(y,""+C):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":C&&typeof C!="function"&&typeof C!="symbol"?u.setAttribute(y,""):u.removeAttribute(y);break;case"capture":case"download":C===!0?u.setAttribute(y,""):C!==!1&&C!=null&&typeof C!="function"&&typeof C!="symbol"?u.setAttribute(y,C):u.removeAttribute(y);break;case"cols":case"rows":case"size":case"span":C!=null&&typeof C!="function"&&typeof C!="symbol"&&!isNaN(C)&&1<=C?u.setAttribute(y,C):u.removeAttribute(y);break;case"rowSpan":case"start":C==null||typeof C=="function"||typeof C=="symbol"||isNaN(C)?u.removeAttribute(y):u.setAttribute(y,C);break;case"popover":ni("beforetoggle",u),ni("toggle",u),Tt(u,"popover",C);break;case"xlinkActuate":Ht(u,"http://www.w3.org/1999/xlink","xlink:actuate",C);break;case"xlinkArcrole":Ht(u,"http://www.w3.org/1999/xlink","xlink:arcrole",C);break;case"xlinkRole":Ht(u,"http://www.w3.org/1999/xlink","xlink:role",C);break;case"xlinkShow":Ht(u,"http://www.w3.org/1999/xlink","xlink:show",C);break;case"xlinkTitle":Ht(u,"http://www.w3.org/1999/xlink","xlink:title",C);break;case"xlinkType":Ht(u,"http://www.w3.org/1999/xlink","xlink:type",C);break;case"xmlBase":Ht(u,"http://www.w3.org/XML/1998/namespace","xml:base",C);break;case"xmlLang":Ht(u,"http://www.w3.org/XML/1998/namespace","xml:lang",C);break;case"xmlSpace":Ht(u,"http://www.w3.org/XML/1998/namespace","xml:space",C);break;case"is":Tt(u,"is",C);break;case"innerText":case"textContent":break;default:(!(2<y.length)||y[0]!=="o"&&y[0]!=="O"||y[1]!=="n"&&y[1]!=="N")&&(y=ic.get(y)||y,Tt(u,y,C))}}function $E(u,p,y,C,I,U){switch(y){case"style":ba(u,C,U);break;case"dangerouslySetInnerHTML":if(C!=null){if(typeof C!="object"||!("__html"in C))throw Error(r(61));if(y=C.__html,y!=null){if(I.children!=null)throw Error(r(60));u.innerHTML=y}}break;case"children":typeof C=="string"?Os(u,C):(typeof C=="number"||typeof C=="bigint")&&Os(u,""+C);break;case"onScroll":C!=null&&ni("scroll",u);break;case"onScrollEnd":C!=null&&ni("scrollend",u);break;case"onClick":C!=null&&(u.onclick=Ls);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!pt.hasOwnProperty(y))e:{if(y[0]==="o"&&y[1]==="n"&&(I=y.endsWith("Capture"),p=y.slice(2,I?y.length-7:void 0),U=u[hn]||null,U=U!=null?U[y]:null,typeof U=="function"&&u.removeEventListener(p,U,I),typeof C=="function")){typeof U!="function"&&U!==null&&(y in u?u[y]=null:u.hasAttribute(y)&&u.removeAttribute(y)),u.addEventListener(p,C,I);break e}y in u?u[y]=C:C===!0?u.setAttribute(y,""):Tt(u,y,C)}}}function Va(u,p,y){switch(p){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ni("error",u),ni("load",u);var C=!1,I=!1,U;for(U in y)if(y.hasOwnProperty(U)){var me=y[U];if(me!=null)switch(U){case"src":C=!0;break;case"srcSet":I=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,p));default:Qi(u,p,U,me,y,null)}}I&&Qi(u,p,"srcSet",y.srcSet,y,null),C&&Qi(u,p,"src",y.src,y,null);return;case"input":ni("invalid",u);var je=U=me=I=null,ct=null,At=null;for(C in y)if(y.hasOwnProperty(C)){var Wt=y[C];if(Wt!=null)switch(C){case"name":I=Wt;break;case"type":me=Wt;break;case"checked":ct=Wt;break;case"defaultChecked":At=Wt;break;case"value":U=Wt;break;case"defaultValue":je=Wt;break;case"children":case"dangerouslySetInnerHTML":if(Wt!=null)throw Error(r(137,p));break;default:Qi(u,p,C,Wt,y,null)}}Ds(u,U,je,ct,At,me,I,!1);return;case"select":ni("invalid",u),C=me=U=null;for(I in y)if(y.hasOwnProperty(I)&&(je=y[I],je!=null))switch(I){case"value":U=je;break;case"defaultValue":me=je;break;case"multiple":C=je;default:Qi(u,p,I,je,y,null)}p=U,y=me,u.multiple=!!C,p!=null?ws(u,!!C,p,!1):y!=null&&ws(u,!!C,y,!0);return;case"textarea":ni("invalid",u),U=I=C=null;for(me in y)if(y.hasOwnProperty(me)&&(je=y[me],je!=null))switch(me){case"value":C=je;break;case"defaultValue":I=je;break;case"children":U=je;break;case"dangerouslySetInnerHTML":if(je!=null)throw Error(r(91));break;default:Qi(u,p,me,je,y,null)}mi(u,C,I,U);return;case"option":for(ct in y)if(y.hasOwnProperty(ct)&&(C=y[ct],C!=null))switch(ct){case"selected":u.selected=C&&typeof C!="function"&&typeof C!="symbol";break;default:Qi(u,p,ct,C,y,null)}return;case"dialog":ni("beforetoggle",u),ni("toggle",u),ni("cancel",u),ni("close",u);break;case"iframe":case"object":ni("load",u);break;case"video":case"audio":for(C=0;C<Ec.length;C++)ni(Ec[C],u);break;case"image":ni("error",u),ni("load",u);break;case"details":ni("toggle",u);break;case"embed":case"source":case"link":ni("error",u),ni("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(At in y)if(y.hasOwnProperty(At)&&(C=y[At],C!=null))switch(At){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,p));default:Qi(u,p,At,C,y,null)}return;default:if(Pa(p)){for(Wt in y)y.hasOwnProperty(Wt)&&(C=y[Wt],C!==void 0&&$E(u,p,Wt,C,y,void 0));return}}for(je in y)y.hasOwnProperty(je)&&(C=y[je],C!=null&&Qi(u,p,je,C,y,null))}function qQ(u,p,y,C){switch(p){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var I=null,U=null,me=null,je=null,ct=null,At=null,Wt=null;for(Ut in y){var Jt=y[Ut];if(y.hasOwnProperty(Ut)&&Jt!=null)switch(Ut){case"checked":break;case"value":break;case"defaultValue":ct=Jt;default:C.hasOwnProperty(Ut)||Qi(u,p,Ut,null,C,Jt)}}for(var Rt in C){var Ut=C[Rt];if(Jt=y[Rt],C.hasOwnProperty(Rt)&&(Ut!=null||Jt!=null))switch(Rt){case"type":U=Ut;break;case"name":I=Ut;break;case"checked":At=Ut;break;case"defaultChecked":Wt=Ut;break;case"value":me=Ut;break;case"defaultValue":je=Ut;break;case"children":case"dangerouslySetInnerHTML":if(Ut!=null)throw Error(r(137,p));break;default:Ut!==Jt&&Qi(u,p,Rt,Ut,C,Jt)}}ts(u,me,je,ct,At,Wt,U,I);return;case"select":Ut=me=je=Rt=null;for(U in y)if(ct=y[U],y.hasOwnProperty(U)&&ct!=null)switch(U){case"value":break;case"multiple":Ut=ct;default:C.hasOwnProperty(U)||Qi(u,p,U,null,C,ct)}for(I in C)if(U=C[I],ct=y[I],C.hasOwnProperty(I)&&(U!=null||ct!=null))switch(I){case"value":Rt=U;break;case"defaultValue":je=U;break;case"multiple":me=U;default:U!==ct&&Qi(u,p,I,U,C,ct)}p=je,y=me,C=Ut,Rt!=null?ws(u,!!y,Rt,!1):!!C!=!!y&&(p!=null?ws(u,!!y,p,!0):ws(u,!!y,y?[]:"",!1));return;case"textarea":Ut=Rt=null;for(je in y)if(I=y[je],y.hasOwnProperty(je)&&I!=null&&!C.hasOwnProperty(je))switch(je){case"value":break;case"children":break;default:Qi(u,p,je,null,C,I)}for(me in C)if(I=C[me],U=y[me],C.hasOwnProperty(me)&&(I!=null||U!=null))switch(me){case"value":Rt=I;break;case"defaultValue":Ut=I;break;case"children":break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(r(91));break;default:I!==U&&Qi(u,p,me,I,C,U)}wr(u,Rt,Ut);return;case"option":for(var Bn in y)if(Rt=y[Bn],y.hasOwnProperty(Bn)&&Rt!=null&&!C.hasOwnProperty(Bn))switch(Bn){case"selected":u.selected=!1;break;default:Qi(u,p,Bn,null,C,Rt)}for(ct in C)if(Rt=C[ct],Ut=y[ct],C.hasOwnProperty(ct)&&Rt!==Ut&&(Rt!=null||Ut!=null))switch(ct){case"selected":u.selected=Rt&&typeof Rt!="function"&&typeof Rt!="symbol";break;default:Qi(u,p,ct,Rt,C,Ut)}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 lr in y)Rt=y[lr],y.hasOwnProperty(lr)&&Rt!=null&&!C.hasOwnProperty(lr)&&Qi(u,p,lr,null,C,Rt);for(At in C)if(Rt=C[At],Ut=y[At],C.hasOwnProperty(At)&&Rt!==Ut&&(Rt!=null||Ut!=null))switch(At){case"children":case"dangerouslySetInnerHTML":if(Rt!=null)throw Error(r(137,p));break;default:Qi(u,p,At,Rt,C,Ut)}return;default:if(Pa(p)){for(var Ji in y)Rt=y[Ji],y.hasOwnProperty(Ji)&&Rt!==void 0&&!C.hasOwnProperty(Ji)&&$E(u,p,Ji,void 0,C,Rt);for(Wt in C)Rt=C[Wt],Ut=y[Wt],!C.hasOwnProperty(Wt)||Rt===Ut||Rt===void 0&&Ut===void 0||$E(u,p,Wt,Rt,C,Ut);return}}for(var _t in y)Rt=y[_t],y.hasOwnProperty(_t)&&Rt!=null&&!C.hasOwnProperty(_t)&&Qi(u,p,_t,null,C,Rt);for(Jt in C)Rt=C[Jt],Ut=y[Jt],!C.hasOwnProperty(Jt)||Rt===Ut||Rt==null&&Ut==null||Qi(u,p,Jt,Rt,C,Ut)}function BI(u){switch(u){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function XQ(){if(typeof performance.getEntriesByType=="function"){for(var u=0,p=0,y=performance.getEntriesByType("resource"),C=0;C<y.length;C++){var I=y[C],U=I.transferSize,me=I.initiatorType,je=I.duration;if(U&&je&&BI(me)){for(me=0,je=I.responseEnd,C+=1;C<y.length;C++){var ct=y[C],At=ct.startTime;if(At>je)break;var Wt=ct.transferSize,Jt=ct.initiatorType;Wt&&BI(Jt)&&(ct=ct.responseEnd,me+=Wt*(ct<je?1:(je-At)/(ct-At)))}if(--C,p+=8*(U+me)/(I.duration/1e3),u++,10<u)break}}if(0<u)return p/u/1e6}return navigator.connection&&(u=navigator.connection.downlink,typeof u=="number")?u:5}var qE=null,XE=null;function a4(u){return u.nodeType===9?u:u.ownerDocument}function HI(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 GI(u,p){if(u===0)switch(p){case"svg":return 1;case"math":return 2;default:return 0}return u===1&&p==="foreignObject"?0:u}function YE(u,p){return u==="textarea"||u==="noscript"||typeof p.children=="string"||typeof p.children=="number"||typeof p.children=="bigint"||typeof p.dangerouslySetInnerHTML=="object"&&p.dangerouslySetInnerHTML!==null&&p.dangerouslySetInnerHTML.__html!=null}var KE=null;function YQ(){var u=window.event;return u&&u.type==="popstate"?u===KE?!1:(KE=u,!0):(KE=null,!1)}var VI=typeof setTimeout=="function"?setTimeout:void 0,KQ=typeof clearTimeout=="function"?clearTimeout:void 0,WI=typeof Promise=="function"?Promise:void 0,ZQ=typeof queueMicrotask=="function"?queueMicrotask:typeof WI<"u"?function(u){return WI.resolve(null).then(u).catch(QQ)}:VI;function QQ(u){setTimeout(function(){throw u})}function Tm(u){return u==="head"}function $I(u,p){var y=p,C=0;do{var I=y.nextSibling;if(u.removeChild(y),I&&I.nodeType===8)if(y=I.data,y==="/$"||y==="/&"){if(C===0){u.removeChild(I),$v(p);return}C--}else if(y==="$"||y==="$?"||y==="$~"||y==="$!"||y==="&")C++;else if(y==="html")c_(u.ownerDocument.documentElement);else if(y==="head"){y=u.ownerDocument.head,c_(y);for(var U=y.firstChild;U;){var me=U.nextSibling,je=U.nodeName;U[Ct]||je==="SCRIPT"||je==="STYLE"||je==="LINK"&&U.rel.toLowerCase()==="stylesheet"||y.removeChild(U),U=me}}else y==="body"&&c_(u.ownerDocument.body);y=I}while(y);$v(p)}function qI(u,p){var y=u;u=0;do{var C=y.nextSibling;if(y.nodeType===1?p?(y._stashedDisplay=y.style.display,y.style.display="none"):(y.style.display=y._stashedDisplay||"",y.getAttribute("style")===""&&y.removeAttribute("style")):y.nodeType===3&&(p?(y._stashedText=y.nodeValue,y.nodeValue=""):y.nodeValue=y._stashedText||""),C&&C.nodeType===8)if(y=C.data,y==="/$"){if(u===0)break;u--}else y!=="$"&&y!=="$?"&&y!=="$~"&&y!=="$!"||u++;y=C}while(y)}function ZE(u){var p=u.firstChild;for(p&&p.nodeType===10&&(p=p.nextSibling);p;){var y=p;switch(p=p.nextSibling,y.nodeName){case"HTML":case"HEAD":case"BODY":ZE(y),tn(y);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(y.rel.toLowerCase()==="stylesheet")continue}u.removeChild(y)}}function JQ(u,p,y,C){for(;u.nodeType===1;){var I=y;if(u.nodeName.toLowerCase()!==p.toLowerCase()){if(!C&&(u.nodeName!=="INPUT"||u.type!=="hidden"))break}else if(C){if(!u[Ct])switch(p){case"meta":if(!u.hasAttribute("itemprop"))break;return u;case"link":if(U=u.getAttribute("rel"),U==="stylesheet"&&u.hasAttribute("data-precedence"))break;if(U!==I.rel||u.getAttribute("href")!==(I.href==null||I.href===""?null:I.href)||u.getAttribute("crossorigin")!==(I.crossOrigin==null?null:I.crossOrigin)||u.getAttribute("title")!==(I.title==null?null:I.title))break;return u;case"style":if(u.hasAttribute("data-precedence"))break;return u;case"script":if(U=u.getAttribute("src"),(U!==(I.src==null?null:I.src)||u.getAttribute("type")!==(I.type==null?null:I.type)||u.getAttribute("crossorigin")!==(I.crossOrigin==null?null:I.crossOrigin))&&U&&u.hasAttribute("async")&&!u.hasAttribute("itemprop"))break;return u;default:return u}}else if(p==="input"&&u.type==="hidden"){var U=I.name==null?null:""+I.name;if(I.type==="hidden"&&u.getAttribute("name")===U)return u}else return u;if(u=Yu(u.nextSibling),u===null)break}return null}function eJ(u,p,y){if(p==="")return null;for(;u.nodeType!==3;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!y||(u=Yu(u.nextSibling),u===null))return null;return u}function XI(u,p){for(;u.nodeType!==8;)if((u.nodeType!==1||u.nodeName!=="INPUT"||u.type!=="hidden")&&!p||(u=Yu(u.nextSibling),u===null))return null;return u}function QE(u){return u.data==="$?"||u.data==="$~"}function JE(u){return u.data==="$!"||u.data==="$?"&&u.ownerDocument.readyState!=="loading"}function tJ(u,p){var y=u.ownerDocument;if(u.data==="$~")u._reactRetry=p;else if(u.data!=="$?"||y.readyState!=="loading")p();else{var C=function(){p(),y.removeEventListener("DOMContentLoaded",C)};y.addEventListener("DOMContentLoaded",C),u._reactRetry=C}}function Yu(u){for(;u!=null;u=u.nextSibling){var p=u.nodeType;if(p===1||p===3)break;if(p===8){if(p=u.data,p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"||p==="F!"||p==="F")break;if(p==="/$"||p==="/&")return null}}return u}var eA=null;function YI(u){u=u.nextSibling;for(var p=0;u;){if(u.nodeType===8){var y=u.data;if(y==="/$"||y==="/&"){if(p===0)return Yu(u.nextSibling);p--}else y!=="$"&&y!=="$!"&&y!=="$?"&&y!=="$~"&&y!=="&"||p++}u=u.nextSibling}return null}function KI(u){u=u.previousSibling;for(var p=0;u;){if(u.nodeType===8){var y=u.data;if(y==="$"||y==="$!"||y==="$?"||y==="$~"||y==="&"){if(p===0)return u;p--}else y!=="/$"&&y!=="/&"||p++}u=u.previousSibling}return null}function ZI(u,p,y){switch(p=a4(y),u){case"html":if(u=p.documentElement,!u)throw Error(r(452));return u;case"head":if(u=p.head,!u)throw Error(r(453));return u;case"body":if(u=p.body,!u)throw Error(r(454));return u;default:throw Error(r(451))}}function c_(u){for(var p=u.attributes;p.length;)u.removeAttributeNode(p[0]);tn(u)}var Ku=new Map,QI=new Set;function l4(u){return typeof u.getRootNode=="function"?u.getRootNode():u.nodeType===9?u:u.ownerDocument}var Jh=J.d;J.d={f:nJ,r:rJ,D:iJ,C:sJ,L:oJ,m:aJ,X:cJ,S:lJ,M:uJ};function nJ(){var u=Jh.f(),p=ru();return u||p}function rJ(u){var p=bn(u);p!==null&&p.tag===5&&p.type==="form"?V3(p):Jh.r(u)}var Gv=typeof document>"u"?null:document;function JI(u,p,y){var C=Gv;if(C&&typeof p=="string"&&p){var I=vn(p);I='link[rel="'+u+'"][href="'+I+'"]',typeof y=="string"&&(I+='[crossorigin="'+y+'"]'),QI.has(I)||(QI.add(I),u={rel:u,crossOrigin:y,href:p},C.querySelector(I)===null&&(p=C.createElement("link"),Va(p,"link",u),tt(p),C.head.appendChild(p)))}}function iJ(u){Jh.D(u),JI("dns-prefetch",u,null)}function sJ(u,p){Jh.C(u,p),JI("preconnect",u,p)}function oJ(u,p,y){Jh.L(u,p,y);var C=Gv;if(C&&u&&p){var I='link[rel="preload"][as="'+vn(p)+'"]';p==="image"&&y&&y.imageSrcSet?(I+='[imagesrcset="'+vn(y.imageSrcSet)+'"]',typeof y.imageSizes=="string"&&(I+='[imagesizes="'+vn(y.imageSizes)+'"]')):I+='[href="'+vn(u)+'"]';var U=I;switch(p){case"style":U=Vv(u);break;case"script":U=Wv(u)}Ku.has(U)||(u=h({rel:"preload",href:p==="image"&&y&&y.imageSrcSet?void 0:u,as:p},y),Ku.set(U,u),C.querySelector(I)!==null||p==="style"&&C.querySelector(u_(U))||p==="script"&&C.querySelector(d_(U))||(p=C.createElement("link"),Va(p,"link",u),tt(p),C.head.appendChild(p)))}}function aJ(u,p){Jh.m(u,p);var y=Gv;if(y&&u){var C=p&&typeof p.as=="string"?p.as:"script",I='link[rel="modulepreload"][as="'+vn(C)+'"][href="'+vn(u)+'"]',U=I;switch(C){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":U=Wv(u)}if(!Ku.has(U)&&(u=h({rel:"modulepreload",href:u},p),Ku.set(U,u),y.querySelector(I)===null)){switch(C){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(y.querySelector(d_(U)))return}C=y.createElement("link"),Va(C,"link",u),tt(C),y.head.appendChild(C)}}}function lJ(u,p,y){Jh.S(u,p,y);var C=Gv;if(C&&u){var I=_e(C).hoistableStyles,U=Vv(u);p=p||"default";var me=I.get(U);if(!me){var je={loading:0,preload:null};if(me=C.querySelector(u_(U)))je.loading=5;else{u=h({rel:"stylesheet",href:u,"data-precedence":p},y),(y=Ku.get(U))&&tA(u,y);var ct=me=C.createElement("link");tt(ct),Va(ct,"link",u),ct._p=new Promise(function(At,Wt){ct.onload=At,ct.onerror=Wt}),ct.addEventListener("load",function(){je.loading|=1}),ct.addEventListener("error",function(){je.loading|=2}),je.loading|=4,c4(me,p,C)}me={type:"stylesheet",instance:me,count:1,state:je},I.set(U,me)}}}function cJ(u,p){Jh.X(u,p);var y=Gv;if(y&&u){var C=_e(y).hoistableScripts,I=Wv(u),U=C.get(I);U||(U=y.querySelector(d_(I)),U||(u=h({src:u,async:!0},p),(p=Ku.get(I))&&nA(u,p),U=y.createElement("script"),tt(U),Va(U,"link",u),y.head.appendChild(U)),U={type:"script",instance:U,count:1,state:null},C.set(I,U))}}function uJ(u,p){Jh.M(u,p);var y=Gv;if(y&&u){var C=_e(y).hoistableScripts,I=Wv(u),U=C.get(I);U||(U=y.querySelector(d_(I)),U||(u=h({src:u,async:!0,type:"module"},p),(p=Ku.get(I))&&nA(u,p),U=y.createElement("script"),tt(U),Va(U,"link",u),y.head.appendChild(U)),U={type:"script",instance:U,count:1,state:null},C.set(I,U))}}function eD(u,p,y,C){var I=(I=Q.current)?l4(I):null;if(!I)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof y.precedence=="string"&&typeof y.href=="string"?(p=Vv(y.href),y=_e(I).hoistableStyles,C=y.get(p),C||(C={type:"style",instance:null,count:0,state:null},y.set(p,C)),C):{type:"void",instance:null,count:0,state:null};case"link":if(y.rel==="stylesheet"&&typeof y.href=="string"&&typeof y.precedence=="string"){u=Vv(y.href);var U=_e(I).hoistableStyles,me=U.get(u);if(me||(I=I.ownerDocument||I,me={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},U.set(u,me),(U=I.querySelector(u_(u)))&&!U._p&&(me.instance=U,me.state.loading=5),Ku.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},Ku.set(u,y),U||dJ(I,u,y,me.state))),p&&C===null)throw Error(r(528,""));return me}if(p&&C!==null)throw Error(r(529,""));return null;case"script":return p=y.async,y=y.src,typeof y=="string"&&p&&typeof p!="function"&&typeof p!="symbol"?(p=Wv(y),y=_e(I).hoistableScripts,C=y.get(p),C||(C={type:"script",instance:null,count:0,state:null},y.set(p,C)),C):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function Vv(u){return'href="'+vn(u)+'"'}function u_(u){return'link[rel="stylesheet"]['+u+"]"}function tD(u){return h({},u,{"data-precedence":u.precedence,precedence:null})}function dJ(u,p,y,C){u.querySelector('link[rel="preload"][as="style"]['+p+"]")?C.loading=1:(p=u.createElement("link"),C.preload=p,p.addEventListener("load",function(){return C.loading|=1}),p.addEventListener("error",function(){return C.loading|=2}),Va(p,"link",y),tt(p),u.head.appendChild(p))}function Wv(u){return'[src="'+vn(u)+'"]'}function d_(u){return"script[async]"+u}function nD(u,p,y){if(p.count++,p.instance===null)switch(p.type){case"style":var C=u.querySelector('style[data-href~="'+vn(y.href)+'"]');if(C)return p.instance=C,tt(C),C;var I=h({},y,{"data-href":y.href,"data-precedence":y.precedence,href:null,precedence:null});return C=(u.ownerDocument||u).createElement("style"),tt(C),Va(C,"style",I),c4(C,y.precedence,u),p.instance=C;case"stylesheet":I=Vv(y.href);var U=u.querySelector(u_(I));if(U)return p.state.loading|=4,p.instance=U,tt(U),U;C=tD(y),(I=Ku.get(I))&&tA(C,I),U=(u.ownerDocument||u).createElement("link"),tt(U);var me=U;return me._p=new Promise(function(je,ct){me.onload=je,me.onerror=ct}),Va(U,"link",C),p.state.loading|=4,c4(U,y.precedence,u),p.instance=U;case"script":return U=Wv(y.src),(I=u.querySelector(d_(U)))?(p.instance=I,tt(I),I):(C=y,(I=Ku.get(U))&&(C=h({},y),nA(C,I)),u=u.ownerDocument||u,I=u.createElement("script"),tt(I),Va(I,"link",C),u.head.appendChild(I),p.instance=I);case"void":return null;default:throw Error(r(443,p.type))}else p.type==="stylesheet"&&(p.state.loading&4)===0&&(C=p.instance,p.state.loading|=4,c4(C,y.precedence,u));return p.instance}function c4(u,p,y){for(var C=y.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),I=C.length?C[C.length-1]:null,U=I,me=0;me<C.length;me++){var je=C[me];if(je.dataset.precedence===p)U=je;else if(U!==I)break}U?U.parentNode.insertBefore(u,U.nextSibling):(p=y.nodeType===9?y.head:y,p.insertBefore(u,p.firstChild))}function tA(u,p){u.crossOrigin==null&&(u.crossOrigin=p.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=p.referrerPolicy),u.title==null&&(u.title=p.title)}function nA(u,p){u.crossOrigin==null&&(u.crossOrigin=p.crossOrigin),u.referrerPolicy==null&&(u.referrerPolicy=p.referrerPolicy),u.integrity==null&&(u.integrity=p.integrity)}var u4=null;function rD(u,p,y){if(u4===null){var C=new Map,I=u4=new Map;I.set(y,C)}else I=u4,C=I.get(y),C||(C=new Map,I.set(y,C));if(C.has(u))return C;for(C.set(u,null),y=y.getElementsByTagName(u),I=0;I<y.length;I++){var U=y[I];if(!(U[Ct]||U[Qt]||u==="link"&&U.getAttribute("rel")==="stylesheet")&&U.namespaceURI!=="http://www.w3.org/2000/svg"){var me=U.getAttribute(p)||"";me=u+me;var je=C.get(me);je?je.push(U):C.set(me,[U])}}return C}function iD(u,p,y){u=u.ownerDocument||u,u.head.insertBefore(y,p==="title"?u.querySelector("head > title"):null)}function fJ(u,p,y){if(y===1||p.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof p.precedence!="string"||typeof p.href!="string"||p.href==="")break;return!0;case"link":if(typeof p.rel!="string"||typeof p.href!="string"||p.href===""||p.onLoad||p.onError)break;switch(p.rel){case"stylesheet":return u=p.disabled,typeof p.precedence=="string"&&u==null;default:return!0}case"script":if(p.async&&typeof p.async!="function"&&typeof p.async!="symbol"&&!p.onLoad&&!p.onError&&p.src&&typeof p.src=="string")return!0}return!1}function sD(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function hJ(u,p,y,C){if(y.type==="stylesheet"&&(typeof C.media!="string"||matchMedia(C.media).matches!==!1)&&(y.state.loading&4)===0){if(y.instance===null){var I=Vv(C.href),U=p.querySelector(u_(I));if(U){p=U._p,p!==null&&typeof p=="object"&&typeof p.then=="function"&&(u.count++,u=d4.bind(u),p.then(u,u)),y.state.loading|=4,y.instance=U,tt(U);return}U=p.ownerDocument||p,C=tD(C),(I=Ku.get(I))&&tA(C,I),U=U.createElement("link"),tt(U);var me=U;me._p=new Promise(function(je,ct){me.onload=je,me.onerror=ct}),Va(U,"link",C),y.instance=U}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(y,p),(p=y.state.preload)&&(y.state.loading&3)===0&&(u.count++,y=d4.bind(u),p.addEventListener("load",y),p.addEventListener("error",y))}}var rA=0;function pJ(u,p){return u.stylesheets&&u.count===0&&h4(u,u.stylesheets),0<u.count||0<u.imgCount?function(y){var C=setTimeout(function(){if(u.stylesheets&&h4(u,u.stylesheets),u.unsuspend){var U=u.unsuspend;u.unsuspend=null,U()}},6e4+p);0<u.imgBytes&&rA===0&&(rA=62500*XQ());var I=setTimeout(function(){if(u.waitingForImages=!1,u.count===0&&(u.stylesheets&&h4(u,u.stylesheets),u.unsuspend)){var U=u.unsuspend;u.unsuspend=null,U()}},(u.imgBytes>rA?50:800)+p);return u.unsuspend=y,function(){u.unsuspend=null,clearTimeout(C),clearTimeout(I)}}:null}function d4(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)h4(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var f4=null;function h4(u,p){u.stylesheets=null,u.unsuspend!==null&&(u.count++,f4=new Map,p.forEach(mJ,u),f4=null,d4.call(u))}function mJ(u,p){if(!(p.state.loading&4)){var y=f4.get(u);if(y)var C=y.get(null);else{y=new Map,f4.set(u,y);for(var I=u.querySelectorAll("link[data-precedence],style[data-precedence]"),U=0;U<I.length;U++){var me=I[U];(me.nodeName==="LINK"||me.getAttribute("media")!=="not all")&&(y.set(me.dataset.precedence,me),C=me)}C&&y.set(null,C)}I=p.instance,me=I.getAttribute("data-precedence"),U=y.get(me)||C,U===C&&y.set(null,I),y.set(me,I),this.count++,C=d4.bind(this),I.addEventListener("load",C),I.addEventListener("error",C),U?U.parentNode.insertBefore(I,U.nextSibling):(u=u.nodeType===9?u.head:u,u.insertBefore(I,u.firstChild)),p.state.loading|=4}}var f_={$$typeof:A,Provider:null,Consumer:null,_currentValue:ne,_currentValue2:ne,_threadCount:0};function gJ(u,p,y,C,I,U,me,je,ct){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=Ne(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ne(0),this.hiddenUpdates=Ne(null),this.identifierPrefix=C,this.onUncaughtError=I,this.onCaughtError=U,this.onRecoverableError=me,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ct,this.incompleteTransitions=new Map}function oD(u,p,y,C,I,U,me,je,ct,At,Wt,Jt){return u=new gJ(u,p,y,me,ct,At,Wt,Jt,je),p=1,U===!0&&(p|=24),U=Cs(3,null,null,p),u.current=U,U.stateNode=u,p=gb(),p.refCount++,u.pooledCache=p,p.refCount++,U.memoizedState={element:C,isDehydrated:y,cache:p},mg(U),u}function aD(u){return u?(u=gf,u):gf}function lD(u,p,y,C,I,U){I=aD(I),C.context===null?C.context=I:C.pendingContext=I,C=Od(p),C.payload={element:y},U=U===void 0?null:U,U!==null&&(C.callback=U),y=Mf(u,C,p),y!==null&&(Dr(y,u,p),Tf(y,u,p))}function cD(u,p){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var y=u.retryLane;u.retryLane=y!==0&&y<p?y:p}}function iA(u,p){cD(u,p),(u=u.alternate)&&cD(u,p)}function uD(u){if(u.tag===13||u.tag===31){var p=ja(u,67108864);p!==null&&Dr(p,u,67108864),iA(u,67108864)}}function dD(u){if(u.tag===13||u.tag===31){var p=Fl();p=Vt(p);var y=ja(u,p);y!==null&&Dr(y,u,p),iA(u,p)}}var p4=!0;function xJ(u,p,y,C){var I=W.T;W.T=null;var U=J.p;try{J.p=2,sA(u,p,y,C)}finally{J.p=U,W.T=I}}function vJ(u,p,y,C){var I=W.T;W.T=null;var U=J.p;try{J.p=8,sA(u,p,y,C)}finally{J.p=U,W.T=I}}function sA(u,p,y,C){if(p4){var I=oA(C);if(I===null)WE(u,p,C,m4,y),hD(u,C);else if(bJ(I,u,p,y,C))C.stopPropagation();else if(hD(u,C),p&4&&-1<yJ.indexOf(u)){for(;I!==null;){var U=bn(I);if(U!==null)switch(U.tag){case 3:if(U=U.stateNode,U.current.memoizedState.isDehydrated){var me=lt(U.pendingLanes);if(me!==0){var je=U;for(je.pendingLanes|=2,je.entangledLanes|=2;me;){var ct=1<<31-Pe(me);je.entanglements[1]|=ct,me&=~ct}ln(U),($n&6)===0&&(no=Y()+500,Pn(0))}}break;case 31:case 13:je=ja(U,2),je!==null&&Dr(je,U,2),ru(),iA(U,2)}if(U=oA(C),U===null&&WE(u,p,C,m4,y),U===I)break;I=U}I!==null&&C.stopPropagation()}else WE(u,p,C,null,y)}}function oA(u){return u=el(u),aA(u)}var m4=null;function aA(u){if(m4=null,u=en(u),u!==null){var p=s(u);if(p===null)u=null;else{var y=p.tag;if(y===13){if(u=o(p),u!==null)return u;u=null}else if(y===31){if(u=a(p),u!==null)return u;u=null}else if(y===3){if(p.stateNode.current.memoizedState.isDehydrated)return p.tag===3?p.stateNode.containerInfo:null;u=null}else p!==u&&(u=null)}}return m4=u,null}function fD(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(xe()){case we:return 2;case Te:return 8;case ge:case Ue:return 32;case be:return 268435456;default:return 32}default:return 32}}var lA=!1,Cm=null,Em=null,Am=null,h_=new Map,p_=new Map,Nm=[],yJ="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 hD(u,p){switch(u){case"focusin":case"focusout":Cm=null;break;case"dragenter":case"dragleave":Em=null;break;case"mouseover":case"mouseout":Am=null;break;case"pointerover":case"pointerout":h_.delete(p.pointerId);break;case"gotpointercapture":case"lostpointercapture":p_.delete(p.pointerId)}}function m_(u,p,y,C,I,U){return u===null||u.nativeEvent!==U?(u={blockedOn:p,domEventName:y,eventSystemFlags:C,nativeEvent:U,targetContainers:[I]},p!==null&&(p=bn(p),p!==null&&uD(p)),u):(u.eventSystemFlags|=C,p=u.targetContainers,I!==null&&p.indexOf(I)===-1&&p.push(I),u)}function bJ(u,p,y,C,I){switch(p){case"focusin":return Cm=m_(Cm,u,p,y,C,I),!0;case"dragenter":return Em=m_(Em,u,p,y,C,I),!0;case"mouseover":return Am=m_(Am,u,p,y,C,I),!0;case"pointerover":var U=I.pointerId;return h_.set(U,m_(h_.get(U)||null,u,p,y,C,I)),!0;case"gotpointercapture":return U=I.pointerId,p_.set(U,m_(p_.get(U)||null,u,p,y,C,I)),!0}return!1}function pD(u){var p=en(u.target);if(p!==null){var y=s(p);if(y!==null){if(p=y.tag,p===13){if(p=o(y),p!==null){u.blockedOn=p,Gt(u.priority,function(){dD(y)});return}}else if(p===31){if(p=a(y),p!==null){u.blockedOn=p,Gt(u.priority,function(){dD(y)});return}}else if(p===3&&y.stateNode.current.memoizedState.isDehydrated){u.blockedOn=y.tag===3?y.stateNode.containerInfo:null;return}}}u.blockedOn=null}function g4(u){if(u.blockedOn!==null)return!1;for(var p=u.targetContainers;0<p.length;){var y=oA(u.nativeEvent);if(y===null){y=u.nativeEvent;var C=new y.constructor(y.type,y);sc=C,y.target.dispatchEvent(C),sc=null}else return p=bn(y),p!==null&&uD(p),u.blockedOn=y,!1;p.shift()}return!0}function mD(u,p,y){g4(u)&&y.delete(p)}function _J(){lA=!1,Cm!==null&&g4(Cm)&&(Cm=null),Em!==null&&g4(Em)&&(Em=null),Am!==null&&g4(Am)&&(Am=null),h_.forEach(mD),p_.forEach(mD)}function x4(u,p){u.blockedOn===p&&(u.blockedOn=null,lA||(lA=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,_J)))}var v4=null;function gD(u){v4!==u&&(v4=u,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){v4===u&&(v4=null);for(var p=0;p<u.length;p+=3){var y=u[p],C=u[p+1],I=u[p+2];if(typeof C!="function"){if(aA(C||y)===null)continue;break}var U=bn(y);U!==null&&(u.splice(p,3),p-=3,Gb(U,{pending:!0,data:I,method:y.method,action:C},C,I))}}))}function $v(u){function p(ct){return x4(ct,u)}Cm!==null&&x4(Cm,u),Em!==null&&x4(Em,u),Am!==null&&x4(Am,u),h_.forEach(p),p_.forEach(p);for(var y=0;y<Nm.length;y++){var C=Nm[y];C.blockedOn===u&&(C.blockedOn=null)}for(;0<Nm.length&&(y=Nm[0],y.blockedOn===null);)pD(y),y.blockedOn===null&&Nm.shift();if(y=(u.ownerDocument||u).$$reactFormReplay,y!=null)for(C=0;C<y.length;C+=3){var I=y[C],U=y[C+1],me=I[hn]||null;if(typeof U=="function")me||gD(y);else if(me){var je=null;if(U&&U.hasAttribute("formAction")){if(I=U,me=U[hn]||null)je=me.formAction;else if(aA(I)!==null)continue}else je=me.action;typeof je=="function"?y[C+1]=je:(y.splice(C,3),C-=3),gD(y)}}}function xD(){function u(U){U.canIntercept&&U.info==="react-transition"&&U.intercept({handler:function(){return new Promise(function(me){return I=me})},focusReset:"manual",scroll:"manual"})}function p(){I!==null&&(I(),I=null),C||setTimeout(y,20)}function y(){if(!C&&!navigation.transition){var U=navigation.currentEntry;U&&U.url!=null&&navigation.navigate(U.url,{state:U.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var C=!1,I=null;return navigation.addEventListener("navigate",u),navigation.addEventListener("navigatesuccess",p),navigation.addEventListener("navigateerror",p),setTimeout(y,100),function(){C=!0,navigation.removeEventListener("navigate",u),navigation.removeEventListener("navigatesuccess",p),navigation.removeEventListener("navigateerror",p),I!==null&&(I(),I=null)}}}function cA(u){this._internalRoot=u}y4.prototype.render=cA.prototype.render=function(u){var p=this._internalRoot;if(p===null)throw Error(r(409));var y=p.current,C=Fl();lD(y,C,u,p,null,null)},y4.prototype.unmount=cA.prototype.unmount=function(){var u=this._internalRoot;if(u!==null){this._internalRoot=null;var p=u.containerInfo;lD(u.current,2,null,u,null,null),ru(),p[It]=null}};function y4(u){this._internalRoot=u}y4.prototype.unstable_scheduleHydration=function(u){if(u){var p=Bt();u={blockedOn:null,target:u,priority:p};for(var y=0;y<Nm.length&&p!==0&&p<Nm[y].priority;y++);Nm.splice(y,0,u),y===0&&pD(u)}};var vD=e.version;if(vD!=="19.2.1")throw Error(r(527,vD,"19.2.1"));J.findDOMNode=function(u){var p=u._reactInternals;if(p===void 0)throw typeof u.render=="function"?Error(r(188)):(u=Object.keys(u).join(","),Error(r(268,u)));return u=c(p),u=u!==null?f(u):null,u=u===null?null:u.stateNode,u};var wJ={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:W,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var b4=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!b4.isDisabled&&b4.supportsFiber)try{Qe=b4.inject(wJ),nt=b4}catch{}}return x_.createRoot=function(u,p){if(!i(u))throw Error(r(299));var y=!1,C="",I=Z3,U=Yb,me=Kb;return p!=null&&(p.unstable_strictMode===!0&&(y=!0),p.identifierPrefix!==void 0&&(C=p.identifierPrefix),p.onUncaughtError!==void 0&&(I=p.onUncaughtError),p.onCaughtError!==void 0&&(U=p.onCaughtError),p.onRecoverableError!==void 0&&(me=p.onRecoverableError)),p=oD(u,1,!1,null,null,y,C,null,I,U,me,xD),u[It]=p.current,VE(u),new cA(p)},x_.hydrateRoot=function(u,p,y){if(!i(u))throw Error(r(299));var C=!1,I="",U=Z3,me=Yb,je=Kb,ct=null;return y!=null&&(y.unstable_strictMode===!0&&(C=!0),y.identifierPrefix!==void 0&&(I=y.identifierPrefix),y.onUncaughtError!==void 0&&(U=y.onUncaughtError),y.onCaughtError!==void 0&&(me=y.onCaughtError),y.onRecoverableError!==void 0&&(je=y.onRecoverableError),y.formState!==void 0&&(ct=y.formState)),p=oD(u,1,!0,p,y??null,C,I,ct,U,me,je,xD),p.context=aD(null),y=p.current,C=Fl(),C=Vt(C),I=Od(C),I.callback=null,Mf(y,I,C),y=C,p.current.lanes=y,ot(p,y),ln(p),u[It]=p.current,VE(u),new y4(p)},x_.version="19.2.1",x_}var ND;function RJ(){if(ND)return hA.exports;ND=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(),hA.exports=kJ(),hA.exports}var EU=RJ();/**
 * 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 kD="popstate";function RD(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function PJ(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 XN("",{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:Nw(i)}return DJ(e,n,null,t)}function uo(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function of(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function IJ(){return Math.random().toString(36).substring(2,10)}function PD(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 XN(t,e,n=null,r,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Wy(e):e,state:n,key:e&&e.key||r||IJ(),unstable_mask:i}}function Nw({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 Wy(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 DJ(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,a="POP",l=null,c=f();c==null&&(c=0,o.replaceState({...o.state,idx:c},""));function f(){return(o.state||{idx:null}).idx}function h(){a="POP";let S=f(),M=S==null?null:S-c;c=S,l&&l({action:a,location:_.location,delta:M})}function m(S,M){a="PUSH";let T=RD(S)?S:XN(_.location,S,M);c=f()+1;let A=PD(T,c),N=_.createHref(T.unstable_mask||T);try{o.pushState(A,"",N)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;i.location.assign(N)}s&&l&&l({action:a,location:_.location,delta:1})}function x(S,M){a="REPLACE";let T=RD(S)?S:XN(_.location,S,M);c=f();let A=PD(T,c),N=_.createHref(T.unstable_mask||T);o.replaceState(A,"",N),s&&l&&l({action:a,location:_.location,delta:0})}function b(S){return OJ(S)}let _={get action(){return a},get location(){return t(i,o)},listen(S){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(kD,h),l=S,()=>{i.removeEventListener(kD,h),l=null}},createHref(S){return e(i,S)},createURL:b,encodeLocation(S){let M=b(S);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:m,replace:x,go(S){return o.go(S)}};return _}function OJ(t,e=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),uo(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:Nw(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function AU(t,e,n="/"){return LJ(t,e,n,!1)}function LJ(t,e,n,r){let i=typeof e=="string"?Wy(e):e,s=Cp(i.pathname||"/",n);if(s==null)return null;let o=NU(t);jJ(o);let a=null;for(let l=0;a==null&&l<o.length;++l){let c=XJ(s);a=$J(o[l],c,r)}return a}function NU(t,e=[],n=[],r="",i=!1){let s=(o,a,l=i,c)=>{let f={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:a,route:o};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&l)return;uo(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let h=ch([r,f.relativePath]),m=n.concat(f);o.children&&o.children.length>0&&(uo(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),NU(o.children,e,m,h,l)),!(o.path==null&&!o.index)&&e.push({path:h,score:VJ(h,o.index),routesMeta:m})};return t.forEach((o,a)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))s(o,a);else for(let c of kU(o.path))s(o,a,!0,c)}),e}function kU(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=kU(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 jJ(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:WJ(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var zJ=/^:[\w-]+$/,FJ=3,UJ=2,BJ=1,HJ=10,GJ=-2,ID=t=>t==="*";function VJ(t,e){let n=t.split("/"),r=n.length;return n.some(ID)&&(r+=GJ),e&&(r+=UJ),n.filter(i=>!ID(i)).reduce((i,s)=>i+(zJ.test(s)?FJ:s===""?BJ:HJ),r)}function WJ(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 $J(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,f=s==="/"?e:e.slice(s.length)||"/",h=A2({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},f),m=l.route;if(!h&&c&&n&&!r[r.length-1].route.index&&(h=A2({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},f)),!h)return null;Object.assign(i,h.params),o.push({params:i,pathname:ch([s,h.pathname]),pathnameBase:QJ(ch([s,h.pathnameBase])),route:m}),h.pathnameBase!=="/"&&(s=ch([s,h.pathnameBase]))}return o}function A2(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=qJ(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:f,isOptional:h},m)=>{if(f==="*"){let b=a[m]||"";o=s.slice(0,s.length-b.length).replace(/(.)\/+$/,"$1")}const x=a[m];return h&&!x?c[f]=void 0:c[f]=(x||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:o,pattern:t}}function qJ(t,e=!1,n=!0){of(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,f)=>{if(r.push({paramName:a,isOptional:l!=null}),l){let h=f.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 XJ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return of(!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 Cp(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 YJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function KJ(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Wy(t):t,s;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?s=DD(n.substring(1),"/"):s=DD(n,e)):s=e,{pathname:s,search:JJ(r),hash:eee(i)}}function DD(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 xA(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 ZJ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function RU(t){let e=ZJ(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function m7(t,e,n,r=!1){let i;typeof t=="string"?i=Wy(t):(i={...t},uo(!i.pathname||!i.pathname.includes("?"),xA("?","pathname","search",i)),uo(!i.pathname||!i.pathname.includes("#"),xA("#","pathname","hash",i)),uo(!i.search||!i.search.includes("#"),xA("#","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 m=o.split("/");for(;m[0]==="..";)m.shift(),h-=1;i.pathname=m.join("/")}a=h>=0?e[h]:"/"}let l=KJ(i,a),c=o&&o!=="/"&&o.endsWith("/"),f=(s||o===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||f)&&(l.pathname+="/"),l}var ch=t=>t.join("/").replace(/\/\/+/g,"/"),QJ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),JJ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,eee=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,tee=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 nee(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function ree(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var PU=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function IU(t,e){let n=t;if(typeof n!="string"||!YJ.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(PU)try{let s=new URL(window.location.href),o=n.startsWith("//")?new URL(s.protocol+n):new URL(n),a=Cp(o.pathname,e);o.origin===s.origin&&a!=null?n=a+o.search+o.hash:i=!0}catch{of(!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 DU=["POST","PUT","PATCH","DELETE"];new Set(DU);var iee=["GET",...DU];new Set(iee);var $y=w.createContext(null);$y.displayName="DataRouter";var _T=w.createContext(null);_T.displayName="DataRouterState";var see=w.createContext(!1),OU=w.createContext({isTransitioning:!1});OU.displayName="ViewTransition";var oee=w.createContext(new Map);oee.displayName="Fetchers";var aee=w.createContext(null);aee.displayName="Await";var vd=w.createContext(null);vd.displayName="Navigation";var SS=w.createContext(null);SS.displayName="Location";var zp=w.createContext({outlet:null,matches:[],isDataRoute:!1});zp.displayName="Route";var g7=w.createContext(null);g7.displayName="RouteError";var LU="REACT_ROUTER_ERROR",lee="REDIRECT",cee="ROUTE_ERROR_RESPONSE";function uee(t){if(t.startsWith(`${LU}:${lee}:{`))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 dee(t){if(t.startsWith(`${LU}:${cee}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new tee(e.status,e.statusText,e.data)}catch{}}function fee(t,{relative:e}={}){uo(MS(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=w.useContext(vd),{hash:i,pathname:s,search:o}=TS(t,{relative:e}),a=s;return n!=="/"&&(a=s==="/"?n:ch([n,s])),r.createHref({pathname:a,search:o,hash:i})}function MS(){return w.useContext(SS)!=null}function bh(){return uo(MS(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(SS).location}var jU="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function zU(t){w.useContext(vd).static||w.useLayoutEffect(t)}function wT(){let{isDataRoute:t}=w.useContext(zp);return t?Tee():hee()}function hee(){uo(MS(),"useNavigate() may be used only in the context of a <Router> component.");let t=w.useContext($y),{basename:e,navigator:n}=w.useContext(vd),{matches:r}=w.useContext(zp),{pathname:i}=bh(),s=JSON.stringify(RU(r)),o=w.useRef(!1);return zU(()=>{o.current=!0}),w.useCallback((l,c={})=>{if(of(o.current,jU),!o.current)return;if(typeof l=="number"){n.go(l);return}let f=m7(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:ch([e,f.pathname])),(c.replace?n.replace:n.push)(f,c.state,c)},[e,n,s,i,t])}w.createContext(null);function TS(t,{relative:e}={}){let{matches:n}=w.useContext(zp),{pathname:r}=bh(),i=JSON.stringify(RU(n));return w.useMemo(()=>m7(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function pee(t,e){return FU(t,e)}function FU(t,e,n){var S;uo(MS(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=w.useContext(vd),{matches:i}=w.useContext(zp),s=i[i.length-1],o=s?s.params:{},a=s?s.pathname:"/",l=s?s.pathnameBase:"/",c=s&&s.route;{let M=c&&c.path||"";BU(a,!c||M.endsWith("*")||M.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${a}" (under <Route path="${M}">) 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="${M}"> to <Route path="${M==="/"?"*":`${M}/*`}">.`)}let f=bh(),h;if(e){let M=typeof e=="string"?Wy(e):e;uo(l==="/"||((S=M.pathname)==null?void 0:S.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 "${M.pathname}" was given in the \`location\` prop.`),h=M}else h=f;let m=h.pathname||"/",x=m;if(l!=="/"){let M=l.replace(/^\//,"").split("/");x="/"+m.replace(/^\//,"").split("/").slice(M.length).join("/")}let b=AU(t,{pathname:x});of(c||b!=null,`No routes matched location "${h.pathname}${h.search}${h.hash}" `),of(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 _=yee(b&&b.map(M=>Object.assign({},M,{params:Object.assign({},o,M.params),pathname:ch([l,r.encodeLocation?r.encodeLocation(M.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?l:ch([l,r.encodeLocation?r.encodeLocation(M.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:M.pathnameBase])})),i,n);return e&&_?w.createElement(SS.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...h},navigationType:"POP"}},_):_}function mee(){let t=Mee(),e=nee(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=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:s},"ErrorBoundary")," or"," ",w.createElement("code",{style:s},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},e),n?w.createElement("pre",{style:i},n):null,o)}var gee=w.createElement(mee,null),UU=class extends w.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=dee(t.digest);n&&(t=n)}let e=t!==void 0?w.createElement(zp.Provider,{value:this.props.routeContext},w.createElement(g7.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?w.createElement(xee,{error:t},e):e}};UU.contextType=see;var vA=new WeakMap;function xee({children:t,error:e}){let{basename:n}=w.useContext(vd);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=uee(e.digest);if(r){let i=vA.get(e);if(i)throw i;let s=IU(r.location,n);if(PU&&!vA.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 vA.set(e,o),o}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${s.absoluteURL||s.to}`})}}return t}function vee({routeContext:t,match:e,children:n}){let r=w.useContext($y);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),w.createElement(zp.Provider,{value:t},n)}function yee(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 f=i.findIndex(h=>h.route.id&&(s==null?void 0:s[h.route.id])!==void 0);uo(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(s).join(",")}`),i=i.slice(0,Math.min(i.length,f+1))}let o=!1,a=-1;if(n&&r){o=r.renderFallback;for(let f=0;f<i.length;f++){let h=i[f];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(a=f),h.route.id){let{loaderData:m,errors:x}=r,b=h.route.loader&&!m.hasOwnProperty(h.route.id)&&(!x||x[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?(f,h)=>{var m,x;l(f,{location:r.location,params:((x=(m=r.matches)==null?void 0:m[0])==null?void 0:x.params)??{},unstable_pattern:ree(r.matches),errorInfo:h})}:void 0;return i.reduceRight((f,h,m)=>{let x,b=!1,_=null,S=null;r&&(x=s&&h.route.id?s[h.route.id]:void 0,_=h.route.errorElement||gee,o&&(a<0&&m===0?(BU("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,S=null):a===m&&(b=!0,S=h.route.hydrateFallbackElement||null)));let M=e.concat(i.slice(0,m+1)),T=()=>{let A;return x?A=_:b?A=S:h.route.Component?A=w.createElement(h.route.Component,null):h.route.element?A=h.route.element:A=f,w.createElement(vee,{match:h,routeContext:{outlet:f,matches:M,isDataRoute:r!=null},children:A})};return r&&(h.route.ErrorBoundary||h.route.errorElement||m===0)?w.createElement(UU,{location:r.location,revalidation:r.revalidation,component:_,error:x,children:T(),routeContext:{outlet:null,matches:M,isDataRoute:!0},onError:c}):T()},null)}function x7(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function bee(t){let e=w.useContext($y);return uo(e,x7(t)),e}function _ee(t){let e=w.useContext(_T);return uo(e,x7(t)),e}function wee(t){let e=w.useContext(zp);return uo(e,x7(t)),e}function v7(t){let e=wee(t),n=e.matches[e.matches.length-1];return uo(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function See(){return v7("useRouteId")}function Mee(){var r;let t=w.useContext(g7),e=_ee("useRouteError"),n=v7("useRouteError");return t!==void 0?t:(r=e.errors)==null?void 0:r[n]}function Tee(){let{router:t}=bee("useNavigate"),e=v7("useNavigate"),n=w.useRef(!1);return zU(()=>{n.current=!0}),w.useCallback(async(i,s={})=>{of(n.current,jU),n.current&&(typeof i=="number"?await t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var OD={};function BU(t,e,n){!e&&!OD[t]&&(OD[t]=!0,of(!1,n))}w.memo(Cee);function Cee({routes:t,future:e,state:n,isStatic:r,onError:i}){return FU(t,void 0,{state:n,isStatic:r,onError:i})}function Xf(t){uo(!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 Eee({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1,unstable_useTransitions:o}){uo(!MS(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),l=w.useMemo(()=>({basename:a,navigator:i,static:s,unstable_useTransitions:o,future:{}}),[a,i,s,o]);typeof n=="string"&&(n=Wy(n));let{pathname:c="/",search:f="",hash:h="",state:m=null,key:x="default",unstable_mask:b}=n,_=w.useMemo(()=>{let S=Cp(c,a);return S==null?null:{location:{pathname:S,search:f,hash:h,state:m,key:x,unstable_mask:b},navigationType:r}},[a,c,f,h,m,x,r,b]);return of(_!=null,`<Router basename="${a}"> is not able to match the URL "${c}${f}${h}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:w.createElement(vd.Provider,{value:l},w.createElement(SS.Provider,{children:e,value:_}))}function Aee({children:t,location:e}){return pee(YN(t),e)}function YN(t,e=[]){let n=[];return w.Children.forEach(t,(r,i)=>{if(!w.isValidElement(r))return;let s=[...e,i];if(r.type===w.Fragment){n.push.apply(n,YN(r.props.children,s));return}uo(r.type===Xf,`[${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>`),uo(!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=YN(r.props.children,s)),n.push(o)}),n}var c2="get",u2="application/x-www-form-urlencoded";function ST(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function Nee(t){return ST(t)&&t.tagName.toLowerCase()==="button"}function kee(t){return ST(t)&&t.tagName.toLowerCase()==="form"}function Ree(t){return ST(t)&&t.tagName.toLowerCase()==="input"}function Pee(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Iee(t,e){return t.button===0&&(!e||e==="_self")&&!Pee(t)}function KN(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 Dee(t,e){let n=KN(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(s=>{n.append(i,s)})}),n}var w4=null;function Oee(){if(w4===null)try{new FormData(document.createElement("form"),0),w4=!1}catch{w4=!0}return w4}var Lee=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function yA(t){return t!=null&&!Lee.has(t)?(of(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${u2}"`),null):t}function jee(t,e){let n,r,i,s,o;if(kee(t)){let a=t.getAttribute("action");r=a?Cp(a,e):null,n=t.getAttribute("method")||c2,i=yA(t.getAttribute("enctype"))||u2,s=new FormData(t)}else if(Nee(t)||Ree(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?Cp(l,e):null,n=t.getAttribute("formmethod")||a.getAttribute("method")||c2,i=yA(t.getAttribute("formenctype"))||yA(a.getAttribute("enctype"))||u2,s=new FormData(a,t),!Oee()){let{name:c,type:f,value:h}=t;if(f==="image"){let m=c?`${c}.`:"";s.append(`${m}x`,"0"),s.append(`${m}y`,"0")}else c&&s.append(c,h)}}else{if(ST(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=c2,r=null,i=u2,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 y7(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function zee(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&&Cp(i.pathname,e)==="/"?i.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${r}`,i}async function Fee(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 Uee(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 Bee(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let o=await Fee(s,n);return o.links?o.links():[]}return[]}));return Wee(r.flat(1).filter(Uee).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function LD(t,e,n,r,i,s){let o=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,a=(l,c)=>{var f;return n[c].pathname!==l.pathname||((f=n[c].route.path)==null?void 0:f.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 f=r.routes[l.route.id];if(!f||!f.hasLoader)return!1;if(o(l,c)||a(l,c))return!0;if(l.route.shouldRevalidate){let m=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 m=="boolean")return m}return!0}):[]}function Hee(t,e,{includeHydrateFallback:n}={}){return Gee(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 Gee(t){return[...new Set(t)]}function Vee(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function Wee(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(Vee(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function HU(){let t=w.useContext($y);return y7(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function $ee(){let t=w.useContext(_T);return y7(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var b7=w.createContext(void 0);b7.displayName="FrameworkContext";function GU(){let t=w.useContext(b7);return y7(t,"You must render this element inside a <HydratedRouter> element"),t}function qee(t,e){let n=w.useContext(b7),[r,i]=w.useState(!1),[s,o]=w.useState(!1),{onFocus:a,onBlur:l,onMouseEnter:c,onMouseLeave:f,onTouchStart:h}=e,m=w.useRef(null);w.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let _=M=>{M.forEach(T=>{o(T.isIntersecting)})},S=new IntersectionObserver(_,{threshold:.5});return m.current&&S.observe(m.current),()=>{S.disconnect()}}},[t]),w.useEffect(()=>{if(r){let _=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(_)}}},[r]);let x=()=>{i(!0)},b=()=>{i(!1),o(!1)};return n?t!=="intent"?[s,m,{}]:[s,m,{onFocus:v_(a,x),onBlur:v_(l,b),onMouseEnter:v_(c,x),onMouseLeave:v_(f,b),onTouchStart:v_(h,x)}]:[!1,m,{}]}function v_(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function Xee({page:t,...e}){let{router:n}=HU(),r=w.useMemo(()=>AU(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?w.createElement(Kee,{page:t,matches:r,...e}):null}function Yee(t){let{manifest:e,routeModules:n}=GU(),[r,i]=w.useState([]);return w.useEffect(()=>{let s=!1;return Bee(t,e,n).then(o=>{s||i(o)}),()=>{s=!0}},[t,e,n]),r}function Kee({page:t,matches:e,...n}){let r=bh(),{future:i,manifest:s,routeModules:o}=GU(),{basename:a}=HU(),{loaderData:l,matches:c}=$ee(),f=w.useMemo(()=>LD(t,e,c,s,r,"data"),[t,e,c,s,r]),h=w.useMemo(()=>LD(t,e,c,s,r,"assets"),[t,e,c,s,r]),m=w.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let _=new Set,S=!1;if(e.forEach(T=>{var N;let A=s.routes[T.route.id];!A||!A.hasLoader||(!f.some(D=>D.route.id===T.route.id)&&T.route.id in l&&((N=o[T.route.id])!=null&&N.shouldRevalidate)||A.hasClientLoader?S=!0:_.add(T.route.id))}),_.size===0)return[];let M=zee(t,a,i.unstable_trailingSlashAwareDataRequests,"data");return S&&_.size>0&&M.searchParams.set("_routes",e.filter(T=>_.has(T.route.id)).map(T=>T.route.id).join(",")),[M.pathname+M.search]},[a,i.unstable_trailingSlashAwareDataRequests,l,r,s,f,e,t,o]),x=w.useMemo(()=>Hee(h,s),[h,s]),b=Yee(h);return w.createElement(w.Fragment,null,m.map(_=>w.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...n})),x.map(_=>w.createElement("link",{key:_,rel:"modulepreload",href:_,...n})),b.map(({key:_,link:S})=>w.createElement("link",{key:_,nonce:n.nonce,...S,crossOrigin:S.crossOrigin??n.crossOrigin})))}function Zee(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var Qee=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Qee&&(window.__reactRouterVersion="7.13.1")}catch{}function Jee({basename:t,children:e,unstable_useTransitions:n,window:r}){let i=w.useRef();i.current==null&&(i.current=PJ({window:r,v5Compat:!0}));let s=i.current,[o,a]=w.useState({action:s.action,location:s.location}),l=w.useCallback(c=>{n===!1?a(c):w.startTransition(()=>a(c))},[n]);return w.useLayoutEffect(()=>s.listen(l),[s,l]),w.createElement(Eee,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:s,unstable_useTransitions:n})}var VU=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,N2=w.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:s,replace:o,unstable_mask:a,state:l,target:c,to:f,preventScrollReset:h,viewTransition:m,unstable_defaultShouldRevalidate:x,...b},_){let{basename:S,navigator:M,unstable_useTransitions:T}=w.useContext(vd),A=typeof f=="string"&&VU.test(f),N=IU(f,S);f=N.to;let D=fee(f,{relative:i}),k=bh(),O=null;if(a){let V=m7(a,[],k.unstable_mask?k.unstable_mask.pathname:"/",!0);S!=="/"&&(V.pathname=V.pathname==="/"?S:ch([S,V.pathname])),O=M.createHref(V)}let[R,L,B]=qee(r,b),H=rte(f,{replace:o,unstable_mask:a,state:l,target:c,preventScrollReset:h,relative:i,viewTransition:m,unstable_defaultShouldRevalidate:x,unstable_useTransitions:T});function $(V){e&&e(V),V.defaultPrevented||H(V)}let G=!(N.isExternal||s),Z=w.createElement("a",{...b,...B,href:(G?O:void 0)||N.absoluteURL||D,onClick:G?$:e,ref:Zee(_,L),target:c,"data-discover":!A&&n==="render"?"true":void 0});return R&&!A?w.createElement(w.Fragment,null,Z,w.createElement(Xee,{page:D})):Z});N2.displayName="Link";var ete=w.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:o,viewTransition:a,children:l,...c},f){let h=TS(o,{relative:c.relative}),m=bh(),x=w.useContext(_T),{navigator:b,basename:_}=w.useContext(vd),S=x!=null&&lte(h)&&a===!0,M=b.encodeLocation?b.encodeLocation(h).pathname:h.pathname,T=m.pathname,A=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(T=T.toLowerCase(),A=A?A.toLowerCase():null,M=M.toLowerCase()),A&&_&&(A=Cp(A,_)||A);const N=M!=="/"&&M.endsWith("/")?M.length-1:M.length;let D=T===M||!i&&T.startsWith(M)&&T.charAt(N)==="/",k=A!=null&&(A===M||!i&&A.startsWith(M)&&A.charAt(M.length)==="/"),O={isActive:D,isPending:k,isTransitioning:S},R=D?e:void 0,L;typeof r=="function"?L=r(O):L=[r,D?"active":null,k?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let B=typeof s=="function"?s(O):s;return w.createElement(N2,{...c,"aria-current":R,className:L,ref:f,style:B,to:o,viewTransition:a},typeof l=="function"?l(O):l)});ete.displayName="NavLink";var tte=w.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:o=c2,action:a,onSubmit:l,relative:c,preventScrollReset:f,viewTransition:h,unstable_defaultShouldRevalidate:m,...x},b)=>{let{unstable_useTransitions:_}=w.useContext(vd),S=ote(),M=ate(a,{relative:c}),T=o.toLowerCase()==="get"?"get":"post",A=typeof a=="string"&&VU.test(a),N=D=>{if(l&&l(D),D.defaultPrevented)return;D.preventDefault();let k=D.nativeEvent.submitter,O=(k==null?void 0:k.getAttribute("formmethod"))||o,R=()=>S(k||D.currentTarget,{fetcherKey:e,method:O,navigate:n,replace:i,state:s,relative:c,preventScrollReset:f,viewTransition:h,unstable_defaultShouldRevalidate:m});_&&n!==!1?w.startTransition(()=>R()):R()};return w.createElement("form",{ref:b,method:T,action:M,onSubmit:r?l:N,...x,"data-discover":!A&&t==="render"?"true":void 0})});tte.displayName="Form";function nte(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function WU(t){let e=w.useContext($y);return uo(e,nte(t)),e}function rte(t,{target:e,replace:n,unstable_mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:l,unstable_useTransitions:c}={}){let f=wT(),h=bh(),m=TS(t,{relative:o});return w.useCallback(x=>{if(Iee(x,e)){x.preventDefault();let b=n!==void 0?n:Nw(h)===Nw(m),_=()=>f(t,{replace:b,unstable_mask:r,state:i,preventScrollReset:s,relative:o,viewTransition:a,unstable_defaultShouldRevalidate:l});c?w.startTransition(()=>_()):_()}},[h,f,m,n,r,i,e,t,s,o,a,l,c])}function _7(t){of(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=w.useRef(KN(t)),n=w.useRef(!1),r=bh(),i=w.useMemo(()=>Dee(r.search,n.current?null:e.current),[r.search]),s=wT(),o=w.useCallback((a,l)=>{const c=KN(typeof a=="function"?a(new URLSearchParams(i)):a);n.current=!0,s("?"+c,l)},[s,i]);return[i,o]}var ite=0,ste=()=>`__${String(++ite)}__`;function ote(){let{router:t}=WU("useSubmit"),{basename:e}=w.useContext(vd),n=See(),r=t.fetch,i=t.navigate;return w.useCallback(async(s,o={})=>{let{action:a,method:l,encType:c,formData:f,body:h}=jee(s,e);if(o.navigate===!1){let m=o.fetcherKey||ste();await r(m,n,o.action||a,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:f,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:f,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 ate(t,{relative:e}={}){let{basename:n}=w.useContext(vd),r=w.useContext(zp);uo(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...TS(t||".",{relative:e})},o=bh();if(t==null){s.search=o.search;let a=new URLSearchParams(s.search),l=a.getAll("index");if(l.some(f=>f==="")){a.delete("index"),l.filter(h=>h).forEach(h=>a.append("index",h));let f=a.toString();s.search=f?`?${f}`:""}}return(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:ch([n,s.pathname])),Nw(s)}function lte(t,{relative:e}={}){let n=w.useContext(OU);uo(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=WU("useViewTransitionState"),i=TS(t,{relative:e});if(!n.isTransitioning)return!1;let s=Cp(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=Cp(n.nextLocation.pathname,r)||n.nextLocation.pathname;return A2(i.pathname,o)!=null||A2(i.pathname,s)!=null}var Yl=CU();const cte=Vy(Yl);var Gx=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(){}},ute={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},Jm,p7,fU,dte=(fU=class{constructor(){Fn(this,Jm,ute);Fn(this,p7,!1)}setTimeoutProvider(t){wn(this,Jm,t)}setTimeout(t,e){return et(this,Jm).setTimeout(t,e)}clearTimeout(t){et(this,Jm).clearTimeout(t)}setInterval(t,e){return et(this,Jm).setInterval(t,e)}clearInterval(t){et(this,Jm).clearInterval(t)}},Jm=new WeakMap,p7=new WeakMap,fU),lx=new dte;function fte(t){setTimeout(t,0)}var Nx=typeof window>"u"||"Deno"in globalThis;function vl(){}function hte(t,e){return typeof t=="function"?t(e):t}function ZN(t){return typeof t=="number"&&t>=0&&t!==1/0}function $U(t,e){return Math.max(t+(e||0)-Date.now(),0)}function h0(t,e){return typeof t=="function"?t(e):t}function rd(t,e){return typeof t=="function"?t(e):t}function jD(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==w7(o,e.options))return!1}else if(!kw(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 zD(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(kx(e.options.mutationKey)!==kx(s))return!1}else if(!kw(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function w7(t,e){return((e==null?void 0:e.queryKeyHashFn)||kx)(t)}function kx(t){return JSON.stringify(t,(e,n)=>QN(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function kw(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>kw(t[n],e[n])):!1}var pte=Object.prototype.hasOwnProperty;function S7(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=FD(t)&&FD(e);if(!r&&!(QN(t)&&QN(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 f=0;f<a;f++){const h=r?f:o[f],m=t[h],x=e[h];if(m===x){l[h]=m,(r?f<s:pte.call(t,h))&&c++;continue}if(m===null||x===null||typeof m!="object"||typeof x!="object"){l[h]=x;continue}const b=S7(m,x,n+1);l[h]=b,b===m&&c++}return s===a&&c===s?t:l}function Rw(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 FD(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function QN(t){if(!UD(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!UD(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function UD(t){return Object.prototype.toString.call(t)==="[object Object]"}function mte(t){return new Promise(e=>{lx.setTimeout(e,t)})}function JN(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?S7(t,e):e}function ec(t){return t}function gte(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function xte(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var M7=Symbol();function qU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===M7?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function T7(t,e){return typeof t=="function"?t(...e):!!t}function vte(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 hx,e0,K1,hU,yte=(hU=class extends Gx{constructor(){super();Fn(this,hx);Fn(this,e0);Fn(this,K1);wn(this,K1,e=>{if(!Nx&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){et(this,e0)||this.setEventListener(et(this,K1))}onUnsubscribe(){var e;this.hasListeners()||((e=et(this,e0))==null||e.call(this),wn(this,e0,void 0))}setEventListener(e){var n;wn(this,K1,e),(n=et(this,e0))==null||n.call(this),wn(this,e0,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){et(this,hx)!==e&&(wn(this,hx,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof et(this,hx)=="boolean"?et(this,hx):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},hx=new WeakMap,e0=new WeakMap,K1=new WeakMap,hU),C7=new yte;function ek(){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 bte=fte;function _te(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=bte;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 To=_te(),Z1,t0,Q1,pU,wte=(pU=class extends Gx{constructor(){super();Fn(this,Z1,!0);Fn(this,t0);Fn(this,Q1);wn(this,Q1,e=>{if(!Nx&&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(){et(this,t0)||this.setEventListener(et(this,Q1))}onUnsubscribe(){var e;this.hasListeners()||((e=et(this,t0))==null||e.call(this),wn(this,t0,void 0))}setEventListener(e){var n;wn(this,Q1,e),(n=et(this,t0))==null||n.call(this),wn(this,t0,e(this.setOnline.bind(this)))}setOnline(e){et(this,Z1)!==e&&(wn(this,Z1,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return et(this,Z1)}},Z1=new WeakMap,t0=new WeakMap,Q1=new WeakMap,pU),k2=new wte;function Ste(t){return Math.min(1e3*2**t,3e4)}function XU(t){return(t??"online")==="online"?k2.isOnline():!0}var tk=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function YU(t){let e=!1,n=0,r;const i=ek(),s=()=>i.status!=="pending",o=_=>{var S;if(!s()){const M=new tk(_);m(M),(S=t.onCancel)==null||S.call(t,M)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>C7.isFocused()&&(t.networkMode==="always"||k2.isOnline())&&t.canRun(),f=()=>XU(t.networkMode)&&t.canRun(),h=_=>{s()||(r==null||r(),i.resolve(_))},m=_=>{s()||(r==null||r(),i.reject(_))},x=()=>new Promise(_=>{var S;r=M=>{(s()||c())&&_(M)},(S=t.onPause)==null||S.call(t)}).then(()=>{var _;r=void 0,s()||(_=t.onContinue)==null||_.call(t)}),b=()=>{if(s())return;let _;const S=n===0?t.initialPromise:void 0;try{_=S??t.fn()}catch(M){_=Promise.reject(M)}Promise.resolve(_).then(h).catch(M=>{var k;if(s())return;const T=t.retry??(Nx?0:3),A=t.retryDelay??Ste,N=typeof A=="function"?A(n,M):A,D=T===!0||typeof T=="number"&&n<T||typeof T=="function"&&T(n,M);if(e||!D){m(M);return}n++,(k=t.onFail)==null||k.call(t,n,M),mte(N).then(()=>c()?void 0:x()).then(()=>{e?m(M):b()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:f,start:()=>(f()?b():x().then(b),i)}}var px,mU,KU=(mU=class{constructor(){Fn(this,px)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ZN(this.gcTime)&&wn(this,px,lx.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Nx?1/0:300*1e3))}clearGcTimeout(){et(this,px)&&(lx.clearTimeout(et(this,px)),wn(this,px,void 0))}},px=new WeakMap,mU),mx,J1,td,gx,Aa,hS,xx,Kd,lp,gU,Mte=(gU=class extends KU{constructor(e){super();Fn(this,Kd);Fn(this,mx);Fn(this,J1);Fn(this,td);Fn(this,gx);Fn(this,Aa);Fn(this,hS);Fn(this,xx);wn(this,xx,!1),wn(this,hS,e.defaultOptions),this.setOptions(e.options),this.observers=[],wn(this,gx,e.client),wn(this,td,et(this,gx).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,wn(this,mx,HD(this.options)),this.state=e.state??et(this,mx),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=et(this,Aa))==null?void 0:e.promise}setOptions(e){if(this.options={...et(this,hS),...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=HD(this.options);n.data!==void 0&&(this.setState(BD(n.data,n.dataUpdatedAt)),wn(this,mx,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&et(this,td).remove(this)}setData(e,n){const r=JN(this.state.data,e,this.options);return fr(this,Kd,lp).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){fr(this,Kd,lp).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=et(this,Aa))==null?void 0:r.promise;return(i=et(this,Aa))==null||i.cancel(e),n?n.then(vl).catch(vl):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(et(this,mx))}isActive(){return this.observers.some(e=>rd(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===M7||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:!$U(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=et(this,Aa))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=et(this,Aa))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),et(this,td).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(et(this,Aa)&&(et(this,xx)?et(this,Aa).cancel({revert:!0}):et(this,Aa).cancelRetry()),this.scheduleGc()),et(this,td).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||fr(this,Kd,lp).call(this,{type:"invalidate"})}async fetch(e,n){var l,c,f,h,m,x,b,_,S,M,T,A;if(this.state.fetchStatus!=="idle"&&((l=et(this,Aa))==null?void 0:l.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(et(this,Aa))return et(this,Aa).continueRetry(),et(this,Aa).promise}if(e&&this.setOptions(e),!this.options.queryFn){const N=this.observers.find(D=>D.options.queryFn);N&&this.setOptions(N.options)}const r=new AbortController,i=N=>{Object.defineProperty(N,"signal",{enumerable:!0,get:()=>(wn(this,xx,!0),r.signal)})},s=()=>{const N=qU(this.options,n),k=(()=>{const O={client:et(this,gx),queryKey:this.queryKey,meta:this.meta};return i(O),O})();return wn(this,xx,!1),this.options.persister?this.options.persister(N,k,this):N(k)},a=(()=>{const N={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:et(this,gx),state:this.state,fetchFn:s};return i(N),N})();(c=this.options.behavior)==null||c.onFetch(a,this),wn(this,J1,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((f=a.fetchOptions)==null?void 0:f.meta))&&fr(this,Kd,lp).call(this,{type:"fetch",meta:(h=a.fetchOptions)==null?void 0:h.meta}),wn(this,Aa,YU({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:N=>{N instanceof tk&&N.revert&&this.setState({...et(this,J1),fetchStatus:"idle"}),r.abort()},onFail:(N,D)=>{fr(this,Kd,lp).call(this,{type:"failed",failureCount:N,error:D})},onPause:()=>{fr(this,Kd,lp).call(this,{type:"pause"})},onContinue:()=>{fr(this,Kd,lp).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const N=await et(this,Aa).start();if(N===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(N),(x=(m=et(this,td).config).onSuccess)==null||x.call(m,N,this),(_=(b=et(this,td).config).onSettled)==null||_.call(b,N,this.state.error,this),N}catch(N){if(N instanceof tk){if(N.silent)return et(this,Aa).promise;if(N.revert){if(this.state.data===void 0)throw N;return this.state.data}}throw fr(this,Kd,lp).call(this,{type:"error",error:N}),(M=(S=et(this,td).config).onError)==null||M.call(S,N,this),(A=(T=et(this,td).config).onSettled)==null||A.call(T,this.state.data,N,this),N}finally{this.scheduleGc()}}},mx=new WeakMap,J1=new WeakMap,td=new WeakMap,gx=new WeakMap,Aa=new WeakMap,hS=new WeakMap,xx=new WeakMap,Kd=new WeakSet,lp=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,...ZU(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...BD(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return wn(this,J1,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),To.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),et(this,td).notify({query:this,type:"updated",action:e})})},gU);function ZU(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:XU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function BD(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function HD(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 Rc,fi,pS,Gl,vx,ey,hp,n0,mS,ty,ny,yx,bx,r0,ry,Vi,G_,nk,rk,ik,sk,ok,ak,lk,QU,xU,E7=(xU=class extends Gx{constructor(e,n){super();Fn(this,Vi);Fn(this,Rc);Fn(this,fi);Fn(this,pS);Fn(this,Gl);Fn(this,vx);Fn(this,ey);Fn(this,hp);Fn(this,n0);Fn(this,mS);Fn(this,ty);Fn(this,ny);Fn(this,yx);Fn(this,bx);Fn(this,r0);Fn(this,ry,new Set);this.options=n,wn(this,Rc,e),wn(this,n0,null),wn(this,hp,ek()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(et(this,fi).addObserver(this),GD(et(this,fi),this.options)?fr(this,Vi,G_).call(this):this.updateResult(),fr(this,Vi,sk).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ck(et(this,fi),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ck(et(this,fi),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,fr(this,Vi,ok).call(this),fr(this,Vi,ak).call(this),et(this,fi).removeObserver(this)}setOptions(e){const n=this.options,r=et(this,fi);if(this.options=et(this,Rc).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof rd(this.options.enabled,et(this,fi))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");fr(this,Vi,lk).call(this),et(this,fi).setOptions(this.options),n._defaulted&&!Rw(this.options,n)&&et(this,Rc).getQueryCache().notify({type:"observerOptionsUpdated",query:et(this,fi),observer:this});const i=this.hasListeners();i&&VD(et(this,fi),r,this.options,n)&&fr(this,Vi,G_).call(this),this.updateResult(),i&&(et(this,fi)!==r||rd(this.options.enabled,et(this,fi))!==rd(n.enabled,et(this,fi))||h0(this.options.staleTime,et(this,fi))!==h0(n.staleTime,et(this,fi)))&&fr(this,Vi,nk).call(this);const s=fr(this,Vi,rk).call(this);i&&(et(this,fi)!==r||rd(this.options.enabled,et(this,fi))!==rd(n.enabled,et(this,fi))||s!==et(this,r0))&&fr(this,Vi,ik).call(this,s)}getOptimisticResult(e){const n=et(this,Rc).getQueryCache().build(et(this,Rc),e),r=this.createResult(n,e);return Cte(this,r)&&(wn(this,Gl,r),wn(this,ey,this.options),wn(this,vx,et(this,fi).state)),r}getCurrentResult(){return et(this,Gl)}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&&et(this,hp).status==="pending"&&et(this,hp).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){et(this,ry).add(e)}getCurrentQuery(){return et(this,fi)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=et(this,Rc).defaultQueryOptions(e),r=et(this,Rc).getQueryCache().build(et(this,Rc),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return fr(this,Vi,G_).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),et(this,Gl)))}createResult(e,n){var L;const r=et(this,fi),i=this.options,s=et(this,Gl),o=et(this,vx),a=et(this,ey),c=e!==r?e.state:et(this,pS),{state:f}=e;let h={...f},m=!1,x;if(n._optimisticResults){const B=this.hasListeners(),H=!B&&GD(e,n),$=B&&VD(e,r,n,i);(H||$)&&(h={...h,...ZU(f.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:b,errorUpdatedAt:_,status:S}=h;x=h.data;let M=!1;if(n.placeholderData!==void 0&&x===void 0&&S==="pending"){let B;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(B=s.data,M=!0):B=typeof n.placeholderData=="function"?n.placeholderData((L=et(this,ny))==null?void 0:L.state.data,et(this,ny)):n.placeholderData,B!==void 0&&(S="success",x=JN(s==null?void 0:s.data,B,n),m=!0)}if(n.select&&x!==void 0&&!M)if(s&&x===(o==null?void 0:o.data)&&n.select===et(this,mS))x=et(this,ty);else try{wn(this,mS,n.select),x=n.select(x),x=JN(s==null?void 0:s.data,x,n),wn(this,ty,x),wn(this,n0,null)}catch(B){wn(this,n0,B)}et(this,n0)&&(b=et(this,n0),x=et(this,ty),_=Date.now(),S="error");const T=h.fetchStatus==="fetching",A=S==="pending",N=S==="error",D=A&&T,k=x!==void 0,R={status:S,fetchStatus:h.fetchStatus,isPending:A,isSuccess:S==="success",isError:N,isInitialLoading:D,isLoading:D,data:x,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:T,isRefetching:T&&!A,isLoadingError:N&&!k,isPaused:h.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:N&&k,isStale:A7(e,n),refetch:this.refetch,promise:et(this,hp),isEnabled:rd(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const B=R.data!==void 0,H=R.status==="error"&&!B,$=V=>{H?V.reject(R.error):B&&V.resolve(R.data)},G=()=>{const V=wn(this,hp,R.promise=ek());$(V)},Z=et(this,hp);switch(Z.status){case"pending":e.queryHash===r.queryHash&&$(Z);break;case"fulfilled":(H||R.data!==Z.value)&&G();break;case"rejected":(!H||R.error!==Z.reason)&&G();break}}return R}updateResult(){const e=et(this,Gl),n=this.createResult(et(this,fi),this.options);if(wn(this,vx,et(this,fi).state),wn(this,ey,this.options),et(this,vx).data!==void 0&&wn(this,ny,et(this,fi)),Rw(n,e))return;wn(this,Gl,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!et(this,ry).size)return!0;const o=new Set(s??et(this,ry));return this.options.throwOnError&&o.add("error"),Object.keys(et(this,Gl)).some(a=>{const l=a;return et(this,Gl)[l]!==e[l]&&o.has(l)})};fr(this,Vi,QU).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&fr(this,Vi,sk).call(this)}},Rc=new WeakMap,fi=new WeakMap,pS=new WeakMap,Gl=new WeakMap,vx=new WeakMap,ey=new WeakMap,hp=new WeakMap,n0=new WeakMap,mS=new WeakMap,ty=new WeakMap,ny=new WeakMap,yx=new WeakMap,bx=new WeakMap,r0=new WeakMap,ry=new WeakMap,Vi=new WeakSet,G_=function(e){fr(this,Vi,lk).call(this);let n=et(this,fi).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(vl)),n},nk=function(){fr(this,Vi,ok).call(this);const e=h0(this.options.staleTime,et(this,fi));if(Nx||et(this,Gl).isStale||!ZN(e))return;const r=$U(et(this,Gl).dataUpdatedAt,e)+1;wn(this,yx,lx.setTimeout(()=>{et(this,Gl).isStale||this.updateResult()},r))},rk=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(et(this,fi)):this.options.refetchInterval)??!1},ik=function(e){fr(this,Vi,ak).call(this),wn(this,r0,e),!(Nx||rd(this.options.enabled,et(this,fi))===!1||!ZN(et(this,r0))||et(this,r0)===0)&&wn(this,bx,lx.setInterval(()=>{(this.options.refetchIntervalInBackground||C7.isFocused())&&fr(this,Vi,G_).call(this)},et(this,r0)))},sk=function(){fr(this,Vi,nk).call(this),fr(this,Vi,ik).call(this,fr(this,Vi,rk).call(this))},ok=function(){et(this,yx)&&(lx.clearTimeout(et(this,yx)),wn(this,yx,void 0))},ak=function(){et(this,bx)&&(lx.clearInterval(et(this,bx)),wn(this,bx,void 0))},lk=function(){const e=et(this,Rc).getQueryCache().build(et(this,Rc),this.options);if(e===et(this,fi))return;const n=et(this,fi);wn(this,fi,e),wn(this,pS,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},QU=function(e){To.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(et(this,Gl))}),et(this,Rc).getQueryCache().notify({query:et(this,fi),type:"observerResultsUpdated"})})},xU);function Tte(t,e){return rd(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function GD(t,e){return Tte(t,e)||t.state.data!==void 0&&ck(t,e,e.refetchOnMount)}function ck(t,e,n){if(rd(e.enabled,t)!==!1&&h0(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&A7(t,e)}return!1}function VD(t,e,n,r){return(t!==e||rd(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&A7(t,n)}function A7(t,e){return rd(e.enabled,t)!==!1&&t.isStaleByTime(h0(e.staleTime,t))}function Cte(t,e){return!Rw(t.getCurrentResult(),e)}function WD(t){return{onFetch:(e,n)=>{var f,h,m,x,b;const r=e.options,i=(m=(h=(f=e.fetchOptions)==null?void 0:f.meta)==null?void 0:h.fetchMore)==null?void 0:m.direction,s=((x=e.state.data)==null?void 0:x.pages)||[],o=((b=e.state.data)==null?void 0:b.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let _=!1;const S=A=>{vte(A,()=>e.signal,()=>_=!0)},M=qU(e.options,e.fetchOptions),T=async(A,N,D)=>{if(_)return Promise.reject();if(N==null&&A.pages.length)return Promise.resolve(A);const O=(()=>{const H={client:e.client,queryKey:e.queryKey,pageParam:N,direction:D?"backward":"forward",meta:e.options.meta};return S(H),H})(),R=await M(O),{maxPages:L}=e.options,B=D?xte:gte;return{pages:B(A.pages,R,L),pageParams:B(A.pageParams,N,L)}};if(i&&s.length){const A=i==="backward",N=A?Ete:$D,D={pages:s,pageParams:o},k=N(r,D);a=await T(D,k,A)}else{const A=t??s.length;do{const N=l===0?o[0]??r.initialPageParam:$D(r,a);if(l>0&&N==null)break;a=await T(a,N),l++}while(l<A)}return a};e.options.persister?e.fetchFn=()=>{var _,S;return(S=(_=e.options).persister)==null?void 0:S.call(_,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function $D(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 Ete(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 gS,Zf,xl,_x,Qf,Wm,vU,Ate=(vU=class extends KU{constructor(e){super();Fn(this,Qf);Fn(this,gS);Fn(this,Zf);Fn(this,xl);Fn(this,_x);wn(this,gS,e.client),this.mutationId=e.mutationId,wn(this,xl,e.mutationCache),wn(this,Zf,[]),this.state=e.state||JU(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){et(this,Zf).includes(e)||(et(this,Zf).push(e),this.clearGcTimeout(),et(this,xl).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){wn(this,Zf,et(this,Zf).filter(n=>n!==e)),this.scheduleGc(),et(this,xl).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){et(this,Zf).length||(this.state.status==="pending"?this.scheduleGc():et(this,xl).remove(this))}continue(){var e;return((e=et(this,_x))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,f,h,m,x,b,_,S,M,T,A,N,D,k,O;const n=()=>{fr(this,Qf,Wm).call(this,{type:"continue"})},r={client:et(this,gS),meta:this.options.meta,mutationKey:this.options.mutationKey};wn(this,_x,YU({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(R,L)=>{fr(this,Qf,Wm).call(this,{type:"failed",failureCount:R,error:L})},onPause:()=>{fr(this,Qf,Wm).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>et(this,xl).canRun(this)}));const i=this.state.status==="pending",s=!et(this,_x).canStart();try{if(i)n();else{fr(this,Qf,Wm).call(this,{type:"pending",variables:e,isPaused:s}),et(this,xl).config.onMutate&&await et(this,xl).config.onMutate(e,this,r);const L=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));L!==this.state.context&&fr(this,Qf,Wm).call(this,{type:"pending",context:L,variables:e,isPaused:s})}const R=await et(this,_x).start();return await((c=(l=et(this,xl).config).onSuccess)==null?void 0:c.call(l,R,e,this.state.context,this,r)),await((h=(f=this.options).onSuccess)==null?void 0:h.call(f,R,e,this.state.context,r)),await((x=(m=et(this,xl).config).onSettled)==null?void 0:x.call(m,R,null,this.state.variables,this.state.context,this,r)),await((_=(b=this.options).onSettled)==null?void 0:_.call(b,R,null,e,this.state.context,r)),fr(this,Qf,Wm).call(this,{type:"success",data:R}),R}catch(R){try{await((M=(S=et(this,xl).config).onError)==null?void 0:M.call(S,R,e,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((A=(T=this.options).onError)==null?void 0:A.call(T,R,e,this.state.context,r))}catch(L){Promise.reject(L)}try{await((D=(N=et(this,xl).config).onSettled)==null?void 0:D.call(N,void 0,R,this.state.variables,this.state.context,this,r))}catch(L){Promise.reject(L)}try{await((O=(k=this.options).onSettled)==null?void 0:O.call(k,void 0,R,e,this.state.context,r))}catch(L){Promise.reject(L)}throw fr(this,Qf,Wm).call(this,{type:"error",error:R}),R}finally{et(this,xl).runNext(this)}}},gS=new WeakMap,Zf=new WeakMap,xl=new WeakMap,_x=new WeakMap,Qf=new WeakSet,Wm=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),To.batch(()=>{et(this,Zf).forEach(r=>{r.onMutationUpdate(e)}),et(this,xl).notify({mutation:this,type:"updated",action:e})})},vU);function JU(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var pp,Zd,xS,yU,Nte=(yU=class extends Gx{constructor(e={}){super();Fn(this,pp);Fn(this,Zd);Fn(this,xS);this.config=e,wn(this,pp,new Set),wn(this,Zd,new Map),wn(this,xS,0)}build(e,n,r){const i=new Ate({client:e,mutationCache:this,mutationId:++_4(this,xS)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){et(this,pp).add(e);const n=S4(e);if(typeof n=="string"){const r=et(this,Zd).get(n);r?r.push(e):et(this,Zd).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(et(this,pp).delete(e)){const n=S4(e);if(typeof n=="string"){const r=et(this,Zd).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&et(this,Zd).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=S4(e);if(typeof n=="string"){const r=et(this,Zd).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=S4(e);if(typeof n=="string"){const i=(r=et(this,Zd).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(){To.batch(()=>{et(this,pp).forEach(e=>{this.notify({type:"removed",mutation:e})}),et(this,pp).clear(),et(this,Zd).clear()})}getAll(){return Array.from(et(this,pp))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>zD(n,r))}findAll(e={}){return this.getAll().filter(n=>zD(e,n))}notify(e){To.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return To.batch(()=>Promise.all(e.map(n=>n.continue().catch(vl))))}},pp=new WeakMap,Zd=new WeakMap,xS=new WeakMap,yU);function S4(t){var e;return(e=t.options.scope)==null?void 0:e.id}var mp,i0,Pc,gp,Tp,d2,uk,bU,kte=(bU=class extends Gx{constructor(n,r){super();Fn(this,Tp);Fn(this,mp);Fn(this,i0);Fn(this,Pc);Fn(this,gp);wn(this,mp,n),this.setOptions(r),this.bindMethods(),fr(this,Tp,d2).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var i;const r=this.options;this.options=et(this,mp).defaultMutationOptions(n),Rw(this.options,r)||et(this,mp).getMutationCache().notify({type:"observerOptionsUpdated",mutation:et(this,Pc),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&kx(r.mutationKey)!==kx(this.options.mutationKey)?this.reset():((i=et(this,Pc))==null?void 0:i.state.status)==="pending"&&et(this,Pc).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=et(this,Pc))==null||n.removeObserver(this)}onMutationUpdate(n){fr(this,Tp,d2).call(this),fr(this,Tp,uk).call(this,n)}getCurrentResult(){return et(this,i0)}reset(){var n;(n=et(this,Pc))==null||n.removeObserver(this),wn(this,Pc,void 0),fr(this,Tp,d2).call(this),fr(this,Tp,uk).call(this)}mutate(n,r){var i;return wn(this,gp,r),(i=et(this,Pc))==null||i.removeObserver(this),wn(this,Pc,et(this,mp).getMutationCache().build(et(this,mp),this.options)),et(this,Pc).addObserver(this),et(this,Pc).execute(n)}},mp=new WeakMap,i0=new WeakMap,Pc=new WeakMap,gp=new WeakMap,Tp=new WeakSet,d2=function(){var r;const n=((r=et(this,Pc))==null?void 0:r.state)??JU();wn(this,i0,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},uk=function(n){To.batch(()=>{var r,i,s,o,a,l,c,f;if(et(this,gp)&&this.hasListeners()){const h=et(this,i0).variables,m=et(this,i0).context,x={client:et(this,mp),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(i=(r=et(this,gp)).onSuccess)==null||i.call(r,n.data,h,m,x)}catch(b){Promise.reject(b)}try{(o=(s=et(this,gp)).onSettled)==null||o.call(s,n.data,null,h,m,x)}catch(b){Promise.reject(b)}}else if((n==null?void 0:n.type)==="error"){try{(l=(a=et(this,gp)).onError)==null||l.call(a,n.error,h,m,x)}catch(b){Promise.reject(b)}try{(f=(c=et(this,gp)).onSettled)==null||f.call(c,void 0,n.error,h,m,x)}catch(b){Promise.reject(b)}}}this.listeners.forEach(h=>{h(et(this,i0))})})},bU);function qD(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function Rte(t,e,n){const r=t.slice(0);return r[e]=n,r}var iy,lu,sy,oy,nd,s0,vS,yS,bS,_S,Qa,dk,fk,hk,pk,mk,_U,Pte=(_U=class extends Gx{constructor(e,n,r){super();Fn(this,Qa);Fn(this,iy);Fn(this,lu);Fn(this,sy);Fn(this,oy);Fn(this,nd);Fn(this,s0);Fn(this,vS);Fn(this,yS);Fn(this,bS);Fn(this,_S,[]);wn(this,iy,e),wn(this,oy,r),wn(this,sy,[]),wn(this,nd,[]),wn(this,lu,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&et(this,nd).forEach(e=>{e.subscribe(n=>{fr(this,Qa,pk).call(this,e,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,et(this,nd).forEach(e=>{e.destroy()})}setQueries(e,n){wn(this,sy,e),wn(this,oy,n),To.batch(()=>{const r=et(this,nd),i=fr(this,Qa,hk).call(this,et(this,sy));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,m)=>h!==r[m]),c=a||l,f=c?!0:o.some((h,m)=>{const x=et(this,lu)[m];return!x||!Rw(h,x)});!c&&!f||(c&&(wn(this,_S,i),wn(this,nd,s)),wn(this,lu,o),this.hasListeners()&&(c&&(qD(r,s).forEach(h=>{h.destroy()}),qD(s,r).forEach(h=>{h.subscribe(m=>{fr(this,Qa,pk).call(this,h,m)})})),fr(this,Qa,mk).call(this)))})}getCurrentResult(){return et(this,lu)}getQueries(){return et(this,nd).map(e=>e.getCurrentQuery())}getObservers(){return et(this,nd)}getOptimisticResult(e,n){const r=fr(this,Qa,hk).call(this,e),i=r.map(o=>o.observer.getOptimisticResult(o.defaultedQueryOptions)),s=r.map(o=>o.defaultedQueryOptions.queryHash);return[i,o=>fr(this,Qa,fk).call(this,o??i,n,s),()=>fr(this,Qa,dk).call(this,i,r)]}},iy=new WeakMap,lu=new WeakMap,sy=new WeakMap,oy=new WeakMap,nd=new WeakMap,s0=new WeakMap,vS=new WeakMap,yS=new WeakMap,bS=new WeakMap,_S=new WeakMap,Qa=new WeakSet,dk=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)})})})},fk=function(e,n,r){if(n){const i=et(this,bS),s=r!==void 0&&i!==void 0&&(i.length!==r.length||r.some((o,a)=>o!==i[a]));return(!et(this,s0)||et(this,lu)!==et(this,yS)||s||n!==et(this,vS))&&(wn(this,vS,n),wn(this,yS,et(this,lu)),r!==void 0&&wn(this,bS,r),wn(this,s0,S7(et(this,s0),n(e)))),et(this,s0)}return e},hk=function(e){const n=new Map;et(this,nd).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=et(this,iy).defaultQueryOptions(i),a=((l=n.get(s.queryHash))==null?void 0:l.shift())??new E7(et(this,iy),s);r.push({defaultedQueryOptions:s,observer:a})}),r},pk=function(e,n){const r=et(this,nd).indexOf(e);r!==-1&&(wn(this,lu,Rte(et(this,lu),r,n)),fr(this,Qa,mk).call(this))},mk=function(){var e;if(this.hasListeners()){const n=et(this,s0),r=fr(this,Qa,dk).call(this,et(this,lu),et(this,_S)),i=fr(this,Qa,fk).call(this,r,(e=et(this,oy))==null?void 0:e.combine);n!==i&&To.batch(()=>{this.listeners.forEach(s=>{s(et(this,lu))})})}},_U),Jf,wU,Ite=(wU=class extends Gx{constructor(e={}){super();Fn(this,Jf);this.config=e,wn(this,Jf,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??w7(i,n);let o=this.get(s);return o||(o=new Mte({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){et(this,Jf).has(e.queryHash)||(et(this,Jf).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=et(this,Jf).get(e.queryHash);n&&(e.destroy(),n===e&&et(this,Jf).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){To.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return et(this,Jf).get(e)}getAll(){return[...et(this,Jf).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>jD(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>jD(e,r)):n}notify(e){To.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){To.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){To.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Jf=new WeakMap,wU),So,o0,a0,ay,ly,l0,cy,uy,SU,Dte=(SU=class{constructor(t={}){Fn(this,So);Fn(this,o0);Fn(this,a0);Fn(this,ay);Fn(this,ly);Fn(this,l0);Fn(this,cy);Fn(this,uy);wn(this,So,t.queryCache||new Ite),wn(this,o0,t.mutationCache||new Nte),wn(this,a0,t.defaultOptions||{}),wn(this,ay,new Map),wn(this,ly,new Map),wn(this,l0,0)}mount(){_4(this,l0)._++,et(this,l0)===1&&(wn(this,cy,C7.subscribe(async t=>{t&&(await this.resumePausedMutations(),et(this,So).onFocus())})),wn(this,uy,k2.subscribe(async t=>{t&&(await this.resumePausedMutations(),et(this,So).onOnline())})))}unmount(){var t,e;_4(this,l0)._--,et(this,l0)===0&&((t=et(this,cy))==null||t.call(this),wn(this,cy,void 0),(e=et(this,uy))==null||e.call(this),wn(this,uy,void 0))}isFetching(t){return et(this,So).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return et(this,o0).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=et(this,So).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=et(this,So).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 et(this,So).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=et(this,So).get(r.queryHash),s=i==null?void 0:i.state.data,o=hte(e,s);if(o!==void 0)return et(this,So).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return To.batch(()=>et(this,So).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=et(this,So).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=et(this,So);To.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=et(this,So);return To.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=To.batch(()=>et(this,So).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(vl).catch(vl)}invalidateQueries(t,e={}){return To.batch(()=>(et(this,So).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=To.batch(()=>et(this,So).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(vl)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(vl)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=et(this,So).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(vl).catch(vl)}fetchInfiniteQuery(t){return t.behavior=WD(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(vl).catch(vl)}ensureInfiniteQueryData(t){return t.behavior=WD(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return k2.isOnline()?et(this,o0).resumePausedMutations():Promise.resolve()}getQueryCache(){return et(this,So)}getMutationCache(){return et(this,o0)}getDefaultOptions(){return et(this,a0)}setDefaultOptions(t){wn(this,a0,t)}setQueryDefaults(t,e){et(this,ay).set(kx(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...et(this,ay).values()],n={};return e.forEach(r=>{kw(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){et(this,ly).set(kx(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...et(this,ly).values()],n={};return e.forEach(r=>{kw(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...et(this,a0).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=w7(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===M7&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...et(this,a0).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){et(this,So).clear(),et(this,o0).clear()}},So=new WeakMap,o0=new WeakMap,a0=new WeakMap,ay=new WeakMap,ly=new WeakMap,l0=new WeakMap,cy=new WeakMap,uy=new WeakMap,SU),eB=w.createContext(void 0),Fp=t=>{const e=w.useContext(eB);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},Ote=({client:t,children:e})=>(w.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),d.jsx(eB.Provider,{value:t,children:e})),tB=w.createContext(!1),nB=()=>w.useContext(tB);tB.Provider;function Lte(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var jte=w.createContext(Lte()),rB=()=>w.useContext(jte),iB=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?T7(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},sB=t=>{w.useEffect(()=>{t.clearReset()},[t])},oB=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||T7(n,[t.error,r])),aB=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))}},zte=(t,e)=>t.isLoading&&t.isFetching&&!e,gk=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,xk=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function lB({queries:t,...e},n){const r=Fp(),i=nB(),s=rB(),o=w.useMemo(()=>t.map(_=>{const S=r.defaultQueryOptions(_);return S._optimisticResults=i?"isRestoring":"optimistic",S}),[t,r,i]);o.forEach(_=>{aB(_);const S=r.getQueryCache().get(_.queryHash);iB(_,s,S)}),sB(s);const[a]=w.useState(()=>new Pte(r,o,e)),[l,c,f]=a.getOptimisticResult(o,e.combine),h=!i&&e.subscribed!==!1;w.useSyncExternalStore(w.useCallback(_=>h?a.subscribe(To.batchCalls(_)):vl,[a,h]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),w.useEffect(()=>{a.setQueries(o,e)},[o,e,a]);const x=l.some((_,S)=>gk(o[S],_))?l.flatMap((_,S)=>{const M=o[S];if(M&&gk(M,_)){const T=new E7(r,M);return xk(M,T,s)}return[]}):[];if(x.length>0)throw Promise.all(x);const b=l.find((_,S)=>{const M=o[S];return M&&oB({result:_,errorResetBoundary:s,throwOnError:M.throwOnError,query:r.getQueryCache().get(M.queryHash),suspense:M.suspense})});if(b!=null&&b.error)throw b.error;return c(f())}function Fte(t,e,n){var m,x,b,_;const r=nB(),i=rB(),s=Fp(),o=s.defaultQueryOptions(t);(x=(m=s.getDefaultOptions().queries)==null?void 0:m._experimental_beforeQuery)==null||x.call(m,o);const a=s.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",aB(o),iB(o,i,a),sB(i);const l=!s.getQueryCache().get(o.queryHash),[c]=w.useState(()=>new e(s,o)),f=c.getOptimisticResult(o),h=!r&&t.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(S=>{const M=h?c.subscribe(To.batchCalls(S)):vl;return c.updateResult(),M},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),w.useEffect(()=>{c.setOptions(o)},[o,c]),gk(o,f))throw xk(o,c,i);if(oB({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((_=(b=s.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||_.call(b,o,f),o.experimental_prefetchInRender&&!Nx&&zte(f,r)){const S=l?xk(o,c,i):a==null?void 0:a.promise;S==null||S.catch(vl).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?f:c.trackResult(f)}function ci(t,e){return Fte(t,E7)}function Ute(t,e){const n=Fp(),[r]=w.useState(()=>new kte(n,t));w.useEffect(()=>{r.setOptions(t)},[r,t]);const i=w.useSyncExternalStore(w.useCallback(o=>r.subscribe(To.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=w.useCallback((o,a)=>{r.mutate(o,a).catch(vl)},[r]);if(i.error&&T7(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}const th={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function cB(t){return"init"in t}function vk(t){return!!t.write}function XD(t){return"v"in t||"e"in t}function R2(t){if("e"in t)throw t.e;if((th?"production":void 0)!=="production"&&!("v"in t))throw new Error("[Bug] atom state is not initialized");return t.v}function P2(t){return typeof(t==null?void 0:t.then)=="function"}function uB(t,e,n){if(!n.p.has(t)){n.p.add(t);const r=()=>n.p.delete(t);e.then(r,r)}}function dB(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 Bte=(t,e,...n)=>e.read(...n),Hte=(t,e,...n)=>e.write(...n),Gte=(t,e)=>{var n;return(n=e.INTERNAL_onInit)==null?void 0:n.call(e,t)},Vte=(t,e,n)=>{var r;return(r=e.onMount)==null?void 0:r.call(e,n)},Wte=(t,e)=>{var n;const r=ma(t),i=r[0],s=r[6],o=r[9];if((th?"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},$te=t=>{const e=ma(t),n=e[1],r=e[3],i=e[4],s=e[5],o=e[6],a=e[13],l=[],c=f=>{try{f()}catch(h){l.push(h)}};do{o.f&&c(o.f);const f=new Set,h=f.add.bind(f);r.forEach(m=>{var x;return(x=n.get(m))==null?void 0:x.l.forEach(h)}),r.clear(),s.forEach(h),s.clear(),i.forEach(h),i.clear(),f.forEach(c),r.size&&a(t)}while(r.size||s.size||i.size);if(l.length)throw new AggregateError(l)},qte=t=>{const e=ma(t),n=e[1],r=e[2],i=e[3],s=e[11],o=e[14],a=e[17],l=[],c=new WeakSet,f=new WeakSet,h=Array.from(i);for(;h.length;){const m=h[h.length-1],x=s(t,m);if(f.has(m)){h.pop();continue}if(c.has(m)){if(r.get(m)===x.n)l.push([m,x]);else if((th?"production":void 0)!=="production"&&r.has(m))throw new Error("[Bug] invalidated atom exists");f.add(m),h.pop();continue}c.add(m);for(const b of dB(m,x,n))c.has(b)||h.push(b)}for(let m=l.length-1;m>=0;--m){const[x,b]=l[m];let _=!1;for(const S of b.d.keys())if(S!==x&&i.has(S)){_=!0;break}_&&(o(t,x),a(t,x)),r.delete(x)}},yk=new WeakSet,Xte=(t,e)=>{var n,r;const i=ma(t),s=i[1],o=i[2],a=i[3],l=i[6],c=i[7],f=i[11],h=i[12],m=i[13],x=i[14],b=i[16],_=i[17],S=i[20],M=i[26],T=f(t,e);if(XD(T)){if(s.has(e)&&o.get(e)!==T.n)return T;let G=!1;for(const[Z,V]of T.d)if(x(t,Z).n!==V){G=!0;break}if(!G)return T}let A=!0;const N=new Set(T.d.keys()),D=new Map,k=()=>{for(const G of N)D.has(G)||T.d.delete(G)},O=()=>{if(s.has(e)){const G=!a.size;_(t,e),G&&(m(t),h(t))}},R=G=>{var Z;if(G===e){const W=f(t,G);if(!XD(W))if(cB(G))S(t,G,G.init);else throw new Error("no atom init");return R2(W)}const V=x(t,G);try{return R2(V)}finally{D.set(G,V.n),T.d.set(G,V.n),P2(T.v)&&uB(e,T.v,V),s.has(e)&&((Z=s.get(G))==null||Z.t.add(e)),A||O()}};let L,B;const H={get signal(){return L||(L=new AbortController),L.signal},get setSelf(){return(th?"production":void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(th?"production":void 0)!=="production"&&!vk(e)&&console.warn("setSelf function cannot be used with read-only atom"),!B&&vk(e)&&(B=(...G)=>{if((th?"production":void 0)!=="production"&&A&&console.warn("setSelf function cannot be called in sync"),!A)try{return b(t,e,...G)}finally{m(t),h(t)}}),B}},$=T.n;try{(th?"production":void 0)!=="production"&&yk.delete(t);const G=c(t,e,R,H);if((th?"production":void 0)!=="production"&&yk.has(t)&&console.warn("Detected store mutation during atom read. This is not supported."),S(t,e,G),P2(G)){M(t,G,()=>L==null?void 0:L.abort());const Z=()=>{k(),O()};G.then(Z,Z)}else k();return(n=l.r)==null||n.call(l,e),T}catch(G){return delete T.v,T.e=G,++T.n,T}finally{A=!1,$!==T.n&&o.get(e)===$&&(o.set(e,T.n),a.add(e),(r=l.c)==null||r.call(l,e))}},Yte=(t,e)=>{const n=ma(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 dB(a,l,r)){const f=s(t,c);i.get(c)!==f.n&&(i.set(c,f.n),o.push(c))}}},Kte=(t,e,...n)=>{const r=ma(t),i=r[3],s=r[6],o=r[8],a=r[11],l=r[12],c=r[13],f=r[14],h=r[15],m=r[16],x=r[17],b=r[20];let _=!0;const S=T=>R2(f(t,T)),M=(T,...A)=>{var N;const D=a(t,T);try{if(T===e){if(!cB(T))throw new Error("atom not writable");(th?"production":void 0)!=="production"&&yk.add(t);const k=D.n,O=A[0];b(t,T,O),x(t,T),k!==D.n&&(i.add(T),h(t,T),(N=s.c)==null||N.call(s,T));return}else return m(t,T,...A)}finally{_||(c(t),l(t))}};try{return o(t,e,S,M,...n)}finally{_=!1}},Zte=(t,e)=>{var n;const r=ma(t),i=r[1],s=r[3],o=r[6],a=r[11],l=r[15],c=r[18],f=r[19],h=a(t,e),m=i.get(e);if(m){for(const[x,b]of h.d)if(!m.d.has(x)){const _=a(t,x);c(t,x).t.add(e),m.d.add(x),b!==_.n&&(s.add(x),l(t,x),(n=o.c)==null||n.call(o,x))}for(const x of m.d)if(!h.d.has(x)){m.d.delete(x);const b=f(t,x);b==null||b.t.delete(e)}}},Qte=(t,e)=>{var n;const r=ma(t),i=r[1],s=r[4],o=r[6],a=r[10],l=r[11],c=r[12],f=r[13],h=r[14],m=r[16],x=r[18],b=l(t,e);let _=i.get(e);if(!_){h(t,e);for(const S of b.d.keys())x(t,S).t.add(e);if(_={l:new Set,d:new Set(b.d.keys()),t:new Set},i.set(e,_),vk(e)){const S=()=>{let M=!0;const T=(...A)=>{try{return m(t,e,...A)}finally{M||(f(t),c(t))}};try{const A=a(t,e,T);A&&(_.u=()=>{M=!0;try{A()}finally{M=!1}})}finally{M=!1}};s.add(S)}(n=o.m)==null||n.call(o,e)}return _},Jte=(t,e)=>{var n,r;const i=ma(t),s=i[1],o=i[5],a=i[6],l=i[11],c=i[19],f=l(t,e);let h=s.get(e);if(!h||h.l.size)return h;let m=!1;for(const x of h.t)if((n=s.get(x))!=null&&n.d.has(e)){m=!0;break}if(!m){h.u&&o.add(h.u),h=void 0,s.delete(e);for(const x of f.d.keys()){const b=c(t,x);b==null||b.t.delete(e)}(r=a.u)==null||r.call(a,e);return}return h},ene=(t,e,n)=>{const r=ma(t),i=r[11],s=r[27],o=i(t,e),a="v"in o,l=o.v;if(P2(n))for(const c of o.d.keys())uB(e,n,i(t,c));o.v=n,delete o.e,(!a||!Object.is(l,o.v))&&(++o.n,P2(l)&&s(t,l))},tne=(t,e)=>{const n=ma(t)[14];return R2(n(t,e))},nne=(t,e,...n)=>{const r=ma(t),i=r[12],s=r[13],o=r[16];try{return o(t,e,...n)}finally{s(t),i(t)}},rne=(t,e,n)=>{const r=ma(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)}},ine=(t,e,n)=>{const i=ma(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)},sne=(t,e)=>{const i=ma(t)[25].get(e);i==null||i.forEach(s=>s())},fB=new WeakMap,ma=t=>{const e=fB.get(t);if((th?"production":void 0)!=="production"&&!e)throw new Error("Store must be created by buildStore to read its building blocks");return e};function one(t){const e=ma(t),n=e[24];return n?n(e):e}function ane(...t){const e={get(r){const i=ma(e)[21];return i(e,r)},set(r,...i){const s=ma(e)[22];return s(e,r,...i)},sub(r,i){const s=ma(e)[23];return s(e,r,i)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},Bte,Hte,Gte,Vte,Wte,$te,qte,Xte,Yte,Kte,Zte,Qte,Jte,ene,tne,nne,rne,void 0,new WeakMap,ine,sne].map((r,i)=>t[i]||r);return fB.set(e,Object.freeze(n)),e}const hB={};let lne=0;function Ar(t,e){const n=`atom${++lne}`,r={toString(){return(hB?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof t=="function"?r.read=t:(r.init=t,r.read=cne,r.write=une),e&&(r.write=e),r}function cne(t){return t(this)}function une(t,e,n){return e(this,typeof n=="function"?n(t(this)):n)}function pB(){return ane()}let y_;function dne(){return y_||(y_=pB(),(hB?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=y_),globalThis.__JOTAI_DEFAULT_STORE__!==y_&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),y_}const fne={},bk=w.createContext(void 0);function mB(t){return w.useContext(bk)||dne()}function hne({children:t,store:e}){const n=w.useRef(null);return e?w.createElement(bk.Provider,{value:e},t):(n.current===null&&(n.current=pB()),w.createElement(bk.Provider,{value:n.current},t))}const _k=t=>typeof(t==null?void 0:t.then)=="function",wk=t=>{t.status||(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}))},pne=ri.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(wk(t),t)}),bA=new WeakMap,YD=(t,e,n)=>{const i=one(t)[26];let s=bA.get(e);return s||(s=new Promise((o,a)=>{let l=e;const c=m=>x=>{l===m&&o(x)},f=m=>x=>{l===m&&a(x)},h=()=>{try{const m=n();_k(m)?(bA.set(m,s),l=m,m.then(c(m),f(m)),i(t,m,h)):o(m)}catch(m){a(m)}};e.then(c(e),f(e)),i(t,e,h)}),bA.set(e,s)),s};function Kn(t,e){const{delay:n,unstable_promiseStatus:r=!ri.use}={},i=mB(),[[s,o,a],l]=w.useReducer(f=>{const h=i.get(t);return Object.is(f[0],h)&&f[1]===i&&f[2]===t?f:[h,i,t]},void 0,()=>[i.get(t),i,t]);let c=s;if((o!==i||a!==t)&&(l(),c=i.get(t)),w.useEffect(()=>{const f=i.sub(t,()=>{if(r)try{const h=i.get(t);_k(h)&&wk(YD(i,h,()=>i.get(t)))}catch{}if(typeof n=="number"){setTimeout(l,n);return}l()});return l(),f},[i,t,n,r]),w.useDebugValue(c),_k(c)){const f=YD(i,c,()=>i.get(t));return r&&wk(f),pne(f)}return c}function ad(t,e){const n=mB();return w.useCallback((...i)=>{if((fne?"production":void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...i)},[n,t])}function cn(t,e){return[Kn(t),ad(t)]}function KD(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function MT(...t){return e=>{let n=!1;const r=t.map(i=>{const s=KD(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():KD(t[i],null)}}}}function Vr(...t){return w.useCallback(MT(...t),t)}function g0(t){const e=mne(t),n=w.forwardRef((r,i)=>{const{children:s,...o}=r,a=w.Children.toArray(s),l=a.find(gne);if(l){const c=l.props.children,f=a.map(h=>h===l?w.Children.count(c)>1?w.Children.only(null):w.isValidElement(c)?c.props.children:null:h);return d.jsx(e,{...o,ref:i,children:w.isValidElement(c)?w.cloneElement(c,void 0,f):null})}return d.jsx(e,{...o,ref:i,children:s})});return n.displayName=`${t}.Slot`,n}var gB=g0("Slot");function mne(t){const e=w.forwardRef((n,r)=>{const{children:i,...s}=n;if(w.isValidElement(i)){const o=vne(i),a=xne(s,i.props);return i.type!==w.Fragment&&(a.ref=r?MT(r,o):o),w.cloneElement(i,a)}return w.Children.count(i)>1?w.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var xB=Symbol("radix.slottable");function vB(t){const e=({children:n})=>d.jsx(d.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=xB,e}function gne(t){return w.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===xB}function xne(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 vne(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 yne=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mr=yne.reduce((t,e)=>{const n=g0(`Primitive.${e}`),r=w.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function yB(t,e){t&&Yl.flushSync(()=>t.dispatchEvent(e))}var bB=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"}),bne="VisuallyHidden",_B=w.forwardRef((t,e)=>d.jsx(mr.span,{...t,ref:e,style:{...bB,...t.style}}));_B.displayName=bne;var _ne=_B;function wne(t,e){const n=w.createContext(e),r=s=>{const{children:o,...a}=s,l=w.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:o})};r.displayName=t+"Provider";function i(s){const o=w.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 Gc(t,e=[]){let n=[];function r(s,o){const a=w.createContext(o),l=n.length;n=[...n,o];const c=h=>{var M;const{scope:m,children:x,...b}=h,_=((M=m==null?void 0:m[t])==null?void 0:M[l])||a,S=w.useMemo(()=>b,Object.values(b));return d.jsx(_.Provider,{value:S,children:x})};c.displayName=s+"Provider";function f(h,m){var _;const x=((_=m==null?void 0:m[t])==null?void 0:_[l])||a,b=w.useContext(x);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[c,f]}const i=()=>{const s=n.map(o=>w.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return w.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,Sne(i,...e)]}function Sne(...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 w.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function N7(t){const e=t+"CollectionProvider",[n,r]=Gc(e),[i,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=_=>{const{scope:S,children:M}=_,T=ri.useRef(null),A=ri.useRef(new Map).current;return d.jsx(i,{scope:S,itemMap:A,collectionRef:T,children:M})};o.displayName=e;const a=t+"CollectionSlot",l=g0(a),c=ri.forwardRef((_,S)=>{const{scope:M,children:T}=_,A=s(a,M),N=Vr(S,A.collectionRef);return d.jsx(l,{ref:N,children:T})});c.displayName=a;const f=t+"CollectionItemSlot",h="data-radix-collection-item",m=g0(f),x=ri.forwardRef((_,S)=>{const{scope:M,children:T,...A}=_,N=ri.useRef(null),D=Vr(S,N),k=s(f,M);return ri.useEffect(()=>(k.itemMap.set(N,{ref:N,...A}),()=>void k.itemMap.delete(N))),d.jsx(m,{[h]:"",ref:D,children:T})});x.displayName=f;function b(_){const S=s(t+"CollectionConsumer",_);return ri.useCallback(()=>{const T=S.collectionRef.current;if(!T)return[];const A=Array.from(T.querySelectorAll(`[${h}]`));return Array.from(S.itemMap.values()).sort((k,O)=>A.indexOf(k.ref.current)-A.indexOf(O.ref.current))},[S.collectionRef,S.itemMap])}return[{Provider:o,Slot:c,ItemSlot:x},b,r]}function Tn(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 Ra=globalThis!=null&&globalThis.document?w.useLayoutEffect:()=>{},Mne=MU[" useInsertionEffect ".trim().toString()]||Ra;function pd({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=Tne({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const f=w.useRef(t!==void 0);w.useEffect(()=>{const h=f.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.`),f.current=a},[a,r])}const c=w.useCallback(f=>{var h;if(a){const m=Cne(f)?f(t):f;m!==t&&((h=o.current)==null||h.call(o,m))}else s(f)},[a,t,s,o]);return[l,c]}function Tne({defaultProp:t,onChange:e}){const[n,r]=w.useState(t),i=w.useRef(n),s=w.useRef(e);return Mne(()=>{s.current=e},[e]),w.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function Cne(t){return typeof t=="function"}function Ene(t,e){return w.useReducer((n,r)=>e[n][r]??n,t)}var Ja=t=>{const{present:e,children:n}=t,r=Ane(e),i=typeof n=="function"?n({present:r.isPresent}):w.Children.only(n),s=Vr(r.ref,Nne(i));return typeof n=="function"||r.isPresent?w.cloneElement(i,{ref:s}):null};Ja.displayName="Presence";function Ane(t){const[e,n]=w.useState(),r=w.useRef(null),i=w.useRef(t),s=w.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Ene(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const c=M4(r.current);s.current=a==="mounted"?c:"none"},[a]),Ra(()=>{const c=r.current,f=i.current;if(f!==t){const m=s.current,x=M4(c);t?l("MOUNT"):x==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(f&&m!==x?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Ra(()=>{if(e){let c;const f=e.ownerDocument.defaultView??window,h=x=>{const _=M4(r.current).includes(CSS.escape(x.animationName));if(x.target===e&&_&&(l("ANIMATION_END"),!i.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",c=f.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},m=x=>{x.target===e&&(s.current=M4(r.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{f.clearTimeout(c),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:w.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function M4(t){return(t==null?void 0:t.animationName)||"none"}function Nne(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 kne=MU[" useId ".trim().toString()]||(()=>{}),Rne=0;function Bc(t){const[e,n]=w.useState(kne());return Ra(()=>{n(r=>r??String(Rne++))},[t]),t||(e?`radix-${e}`:"")}var TT="Collapsible",[Pne]=Gc(TT),[Ine,k7]=Pne(TT),wB=w.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:o,...a}=t,[l,c]=pd({prop:r,defaultProp:i??!1,onChange:o,caller:TT});return d.jsx(Ine,{scope:n,disabled:s,contentId:Bc(),open:l,onOpenToggle:w.useCallback(()=>c(f=>!f),[c]),children:d.jsx(mr.div,{"data-state":P7(l),"data-disabled":s?"":void 0,...a,ref:e})})});wB.displayName=TT;var SB="CollapsibleTrigger",MB=w.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=k7(SB,n);return d.jsx(mr.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":P7(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Tn(t.onClick,i.onOpenToggle)})});MB.displayName=SB;var R7="CollapsibleContent",TB=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=k7(R7,t.__scopeCollapsible);return d.jsx(Ja,{present:n||i.open,children:({present:s})=>d.jsx(Dne,{...r,ref:e,present:s})})});TB.displayName=R7;var Dne=w.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=t,o=k7(R7,n),[a,l]=w.useState(r),c=w.useRef(null),f=Vr(e,c),h=w.useRef(0),m=h.current,x=w.useRef(0),b=x.current,_=o.open||a,S=w.useRef(_),M=w.useRef(void 0);return w.useEffect(()=>{const T=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(T)},[]),Ra(()=>{const T=c.current;if(T){M.current=M.current||{transitionDuration:T.style.transitionDuration,animationName:T.style.animationName},T.style.transitionDuration="0s",T.style.animationName="none";const A=T.getBoundingClientRect();h.current=A.height,x.current=A.width,S.current||(T.style.transitionDuration=M.current.transitionDuration,T.style.animationName=M.current.animationName),l(r)}},[o.open,r]),d.jsx(mr.div,{"data-state":P7(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!_,...s,ref:f,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...t.style},children:_&&i})});function P7(t){return t?"open":"closed"}var One=wB,Lne=MB,jne=TB,zne=w.createContext(void 0);function CS(t){const e=w.useContext(zne);return t||e||"ltr"}function pa(t){const e=w.useRef(t);return w.useEffect(()=>{e.current=t}),w.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Fne(t,e=globalThis==null?void 0:globalThis.document){const n=pa(t);w.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 Une="DismissableLayer",Sk="dismissableLayer.update",Bne="dismissableLayer.pointerDownOutside",Hne="dismissableLayer.focusOutside",ZD,CB=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qy=w.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=w.useContext(CB),[f,h]=w.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=w.useState({}),b=Vr(e,O=>h(O)),_=Array.from(c.layers),[S]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),M=_.indexOf(S),T=f?_.indexOf(f):-1,A=c.layersWithOutsidePointerEventsDisabled.size>0,N=T>=M,D=Wne(O=>{const R=O.target,L=[...c.branches].some(B=>B.contains(R));!N||L||(i==null||i(O),o==null||o(O),O.defaultPrevented||a==null||a())},m),k=$ne(O=>{const R=O.target;[...c.branches].some(B=>B.contains(R))||(s==null||s(O),o==null||o(O),O.defaultPrevented||a==null||a())},m);return Fne(O=>{T===c.layers.size-1&&(r==null||r(O),!O.defaultPrevented&&a&&(O.preventDefault(),a()))},m),w.useEffect(()=>{if(f)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(ZD=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),QD(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=ZD)}},[f,m,n,c]),w.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),QD())},[f,c]),w.useEffect(()=>{const O=()=>x({});return document.addEventListener(Sk,O),()=>document.removeEventListener(Sk,O)},[]),d.jsx(mr.div,{...l,ref:b,style:{pointerEvents:A?N?"auto":"none":void 0,...t.style},onFocusCapture:Tn(t.onFocusCapture,k.onFocusCapture),onBlurCapture:Tn(t.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Tn(t.onPointerDownCapture,D.onPointerDownCapture)})});qy.displayName=Une;var Gne="DismissableLayerBranch",Vne=w.forwardRef((t,e)=>{const n=w.useContext(CB),r=w.useRef(null),i=Vr(e,r);return w.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),d.jsx(mr.div,{...t,ref:i})});Vne.displayName=Gne;function Wne(t,e=globalThis==null?void 0:globalThis.document){const n=pa(t),r=w.useRef(!1),i=w.useRef(()=>{});return w.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){EB(Bne,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 $ne(t,e=globalThis==null?void 0:globalThis.document){const n=pa(t),r=w.useRef(!1);return w.useEffect(()=>{const i=s=>{s.target&&!r.current&&EB(Hne,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 QD(){const t=new CustomEvent(Sk);document.dispatchEvent(t)}function EB(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?yB(i,s):i.dispatchEvent(s)}var _A="focusScope.autoFocusOnMount",wA="focusScope.autoFocusOnUnmount",JD={bubbles:!1,cancelable:!0},qne="FocusScope",ES=w.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=w.useState(null),c=pa(i),f=pa(s),h=w.useRef(null),m=Vr(e,_=>l(_)),x=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let _=function(A){if(x.paused||!a)return;const N=A.target;a.contains(N)?h.current=N:$m(h.current,{select:!0})},S=function(A){if(x.paused||!a)return;const N=A.relatedTarget;N!==null&&(a.contains(N)||$m(h.current,{select:!0}))},M=function(A){if(document.activeElement===document.body)for(const D of A)D.removedNodes.length>0&&$m(a)};document.addEventListener("focusin",_),document.addEventListener("focusout",S);const T=new MutationObserver(M);return a&&T.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",S),T.disconnect()}}},[r,a,x.paused]),w.useEffect(()=>{if(a){t9.add(x);const _=document.activeElement;if(!a.contains(_)){const M=new CustomEvent(_A,JD);a.addEventListener(_A,c),a.dispatchEvent(M),M.defaultPrevented||(Xne(Jne(AB(a)),{select:!0}),document.activeElement===_&&$m(a))}return()=>{a.removeEventListener(_A,c),setTimeout(()=>{const M=new CustomEvent(wA,JD);a.addEventListener(wA,f),a.dispatchEvent(M),M.defaultPrevented||$m(_??document.body,{select:!0}),a.removeEventListener(wA,f),t9.remove(x)},0)}}},[a,c,f,x]);const b=w.useCallback(_=>{if(!n&&!r||x.paused)return;const S=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,M=document.activeElement;if(S&&M){const T=_.currentTarget,[A,N]=Yne(T);A&&N?!_.shiftKey&&M===N?(_.preventDefault(),n&&$m(A,{select:!0})):_.shiftKey&&M===A&&(_.preventDefault(),n&&$m(N,{select:!0})):M===T&&_.preventDefault()}},[n,r,x.paused]);return d.jsx(mr.div,{tabIndex:-1,...o,ref:m,onKeyDown:b})});ES.displayName=qne;function Xne(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if($m(r,{select:e}),document.activeElement!==n)return}function Yne(t){const e=AB(t),n=e9(e,t),r=e9(e.reverse(),t);return[n,r]}function AB(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 e9(t,e){for(const n of t)if(!Kne(n,{upTo:e}))return n}function Kne(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 Zne(t){return t instanceof HTMLInputElement&&"select"in t}function $m(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Zne(t)&&e&&t.select()}}var t9=Qne();function Qne(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=n9(t,e),t.unshift(e)},remove(e){var n;t=n9(t,e),(n=t[0])==null||n.resume()}}}function n9(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Jne(t){return t.filter(e=>e.tagName!=="A")}var ere="Portal",Xy=w.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=w.useState(!1);Ra(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?cte.createPortal(d.jsx(mr.div,{...r,ref:e}),o):null});Xy.displayName=ere;var SA=0;function CT(){w.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??r9()),document.body.insertAdjacentElement("beforeend",t[1]??r9()),SA++,()=>{SA===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),SA--}},[])}function r9(){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 nh=function(){return nh=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},nh.apply(this,arguments)};function NB(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 tre(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 f2="right-scroll-bar-position",h2="width-before-scroll-bar",nre="with-scroll-bars-hidden",rre="--removed-body-scroll-bar-size";function MA(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function ire(t,e){var n=w.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 sre=typeof window<"u"?w.useLayoutEffect:w.useEffect,i9=new WeakMap;function ore(t,e){var n=ire(null,function(r){return t.forEach(function(i){return MA(i,r)})});return sre(function(){var r=i9.get(n);if(r){var i=new Set(r),s=new Set(t),o=n.current;i.forEach(function(a){s.has(a)||MA(a,null)}),s.forEach(function(a){i.has(a)||MA(a,o)})}i9.set(n,t)},[t]),n}function are(t){return t}function lre(t,e){e===void 0&&(e=are);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 f=o;o=[],f.forEach(s)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(f){o.push(f),c()},filter:function(f){return o=o.filter(f),n}}}};return i}function cre(t){t===void 0&&(t={});var e=lre(null);return e.options=nh({async:!0,ssr:!1},t),e}var kB=function(t){var e=t.sideCar,n=NB(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 w.createElement(r,nh({},n))};kB.isSideCarExport=!0;function ure(t,e){return t.useMedium(e),kB}var RB=cre(),TA=function(){},ET=w.forwardRef(function(t,e){var n=w.useRef(null),r=w.useState({onScrollCapture:TA,onWheelCapture:TA,onTouchMoveCapture:TA}),i=r[0],s=r[1],o=t.forwardProps,a=t.children,l=t.className,c=t.removeScrollBar,f=t.enabled,h=t.shards,m=t.sideCar,x=t.noRelative,b=t.noIsolation,_=t.inert,S=t.allowPinchZoom,M=t.as,T=M===void 0?"div":M,A=t.gapMode,N=NB(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=m,k=ore([n,e]),O=nh(nh({},N),i);return w.createElement(w.Fragment,null,f&&w.createElement(D,{sideCar:RB,removeScrollBar:c,shards:h,noRelative:x,noIsolation:b,inert:_,setCallbacks:s,allowPinchZoom:!!S,lockRef:n,gapMode:A}),o?w.cloneElement(w.Children.only(a),nh(nh({},O),{ref:k})):w.createElement(T,nh({},O,{className:l,ref:k}),a))});ET.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ET.classNames={fullWidth:h2,zeroRight:f2};var dre=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function fre(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=dre();return e&&t.setAttribute("nonce",e),t}function hre(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function pre(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var mre=function(){var t=0,e=null;return{add:function(n){t==0&&(e=fre())&&(hre(e,n),pre(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},gre=function(){var t=mre();return function(e,n){w.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},PB=function(){var t=gre(),e=function(n){var r=n.styles,i=n.dynamic;return t(r,i),null};return e},xre={left:0,top:0,right:0,gap:0},CA=function(t){return parseInt(t||"",10)||0},vre=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[CA(n),CA(r),CA(i)]},yre=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return xre;var e=vre(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])}},bre=PB(),D1="data-scroll-locked",_re=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(nre,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(a,"px ").concat(r,`;
  }
  body[`).concat(D1,`] {
    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(f2,` {
    right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(h2,` {
    margin-right: `).concat(a,"px ").concat(r,`;
  }
  
  .`).concat(f2," .").concat(f2,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(h2," .").concat(h2,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(D1,`] {
    `).concat(rre,": ").concat(a,`px;
  }
`)},s9=function(){var t=parseInt(document.body.getAttribute(D1)||"0",10);return isFinite(t)?t:0},wre=function(){w.useEffect(function(){return document.body.setAttribute(D1,(s9()+1).toString()),function(){var t=s9()-1;t<=0?document.body.removeAttribute(D1):document.body.setAttribute(D1,t.toString())}},[])},Sre=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;wre();var s=w.useMemo(function(){return yre(i)},[i]);return w.createElement(bre,{styles:_re(s,!e,i,n?"":"!important")})},Mk=!1;if(typeof window<"u")try{var T4=Object.defineProperty({},"passive",{get:function(){return Mk=!0,!0}});window.addEventListener("test",T4,T4),window.removeEventListener("test",T4,T4)}catch{Mk=!1}var qv=Mk?{passive:!1}:!1,Mre=function(t){return t.tagName==="TEXTAREA"},IB=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Mre(t)&&n[e]==="visible")},Tre=function(t){return IB(t,"overflowY")},Cre=function(t){return IB(t,"overflowX")},o9=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=DB(t,r);if(i){var s=OB(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ere=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},Are=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},DB=function(t,e){return t==="v"?Tre(e):Cre(e)},OB=function(t,e){return t==="v"?Ere(e):Are(e)},Nre=function(t,e){return t==="h"&&e==="rtl"?-1:1},kre=function(t,e,n,r,i){var s=Nre(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,f=o>0,h=0,m=0;do{if(!a)break;var x=OB(t,a),b=x[0],_=x[1],S=x[2],M=_-S-s*b;(b||M)&&DB(t,a)&&(h+=M,m+=b);var T=a.parentNode;a=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(f&&Math.abs(h)<1||!f&&Math.abs(m)<1)&&(c=!0),c},C4=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},a9=function(t){return[t.deltaX,t.deltaY]},l9=function(t){return t&&"current"in t?t.current:t},Rre=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Pre=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},Ire=0,Xv=[];function Dre(t){var e=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),i=w.useState(Ire++)[0],s=w.useState(PB)[0],o=w.useRef(t);w.useEffect(function(){o.current=t},[t]),w.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var _=tre([t.lockRef.current],(t.shards||[]).map(l9),!0).filter(Boolean);return _.forEach(function(S){return S.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),_.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=w.useCallback(function(_,S){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!o.current.allowPinchZoom;var M=C4(_),T=n.current,A="deltaX"in _?_.deltaX:T[0]-M[0],N="deltaY"in _?_.deltaY:T[1]-M[1],D,k=_.target,O=Math.abs(A)>Math.abs(N)?"h":"v";if("touches"in _&&O==="h"&&k.type==="range")return!1;var R=window.getSelection(),L=R&&R.anchorNode,B=L?L===k||L.contains(k):!1;if(B)return!1;var H=o9(O,k);if(!H)return!0;if(H?D=O:(D=O==="v"?"h":"v",H=o9(O,k)),!H)return!1;if(!r.current&&"changedTouches"in _&&(A||N)&&(r.current=D),!D)return!0;var $=r.current||D;return kre($,S,_,$==="h"?A:N)},[]),l=w.useCallback(function(_){var S=_;if(!(!Xv.length||Xv[Xv.length-1]!==s)){var M="deltaY"in S?a9(S):C4(S),T=e.current.filter(function(D){return D.name===S.type&&(D.target===S.target||S.target===D.shadowParent)&&Rre(D.delta,M)})[0];if(T&&T.should){S.cancelable&&S.preventDefault();return}if(!T){var A=(o.current.shards||[]).map(l9).filter(Boolean).filter(function(D){return D.contains(S.target)}),N=A.length>0?a(S,A[0]):!o.current.noIsolation;N&&S.cancelable&&S.preventDefault()}}},[]),c=w.useCallback(function(_,S,M,T){var A={name:_,delta:S,target:M,should:T,shadowParent:Ore(M)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(N){return N!==A})},1)},[]),f=w.useCallback(function(_){n.current=C4(_),r.current=void 0},[]),h=w.useCallback(function(_){c(_.type,a9(_),_.target,a(_,t.lockRef.current))},[]),m=w.useCallback(function(_){c(_.type,C4(_),_.target,a(_,t.lockRef.current))},[]);w.useEffect(function(){return Xv.push(s),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",l,qv),document.addEventListener("touchmove",l,qv),document.addEventListener("touchstart",f,qv),function(){Xv=Xv.filter(function(_){return _!==s}),document.removeEventListener("wheel",l,qv),document.removeEventListener("touchmove",l,qv),document.removeEventListener("touchstart",f,qv)}},[]);var x=t.removeScrollBar,b=t.inert;return w.createElement(w.Fragment,null,b?w.createElement(s,{styles:Pre(i)}):null,x?w.createElement(Sre,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function Ore(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Lre=ure(RB,Dre);var AS=w.forwardRef(function(t,e){return w.createElement(ET,nh({},t,{ref:e,sideCar:Lre}))});AS.classNames=ET.classNames;var jre=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Yv=new WeakMap,E4=new WeakMap,A4={},EA=0,LB=function(t){return t&&(t.host||LB(t.parentNode))},zre=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=LB(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})},Fre=function(t,e,n,r){var i=zre(e,Array.isArray(t)?t:[t]);A4[n]||(A4[n]=new WeakMap);var s=A4[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 f=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(m){if(a.has(m))f(m);else try{var x=m.getAttribute(r),b=x!==null&&x!=="false",_=(Yv.get(m)||0)+1,S=(s.get(m)||0)+1;Yv.set(m,_),s.set(m,S),o.push(m),_===1&&b&&E4.set(m,!0),S===1&&m.setAttribute(n,"true"),b||m.setAttribute(r,"true")}catch(M){console.error("aria-hidden: cannot operate on ",m,M)}})};return f(e),a.clear(),EA++,function(){o.forEach(function(h){var m=Yv.get(h)-1,x=s.get(h)-1;Yv.set(h,m),s.set(h,x),m||(E4.has(h)||h.removeAttribute(r),E4.delete(h)),x||h.removeAttribute(n)}),EA--,EA||(Yv=new WeakMap,Yv=new WeakMap,E4=new WeakMap,A4={})}},AT=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=jre(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),Fre(r,i,n,"aria-hidden")):function(){return null}},NT="Dialog",[jB,zB]=Gc(NT),[Ure,uf]=jB(NT),FB=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=w.useRef(null),l=w.useRef(null),[c,f]=pd({prop:r,defaultProp:i??!1,onChange:s,caller:NT});return d.jsx(Ure,{scope:e,triggerRef:a,contentRef:l,contentId:Bc(),titleId:Bc(),descriptionId:Bc(),open:c,onOpenChange:f,onOpenToggle:w.useCallback(()=>f(h=>!h),[f]),modal:o,children:n})};FB.displayName=NT;var UB="DialogTrigger",BB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=uf(UB,n),s=Vr(e,i.triggerRef);return d.jsx(mr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":O7(i.open),...r,ref:s,onClick:Tn(t.onClick,i.onOpenToggle)})});BB.displayName=UB;var I7="DialogPortal",[Bre,HB]=jB(I7,{forceMount:void 0}),GB=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=uf(I7,e);return d.jsx(Bre,{scope:e,forceMount:n,children:w.Children.map(r,o=>d.jsx(Ja,{present:n||s.open,children:d.jsx(Xy,{asChild:!0,container:i,children:o})}))})};GB.displayName=I7;var I2="DialogOverlay",VB=w.forwardRef((t,e)=>{const n=HB(I2,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=uf(I2,t.__scopeDialog);return s.modal?d.jsx(Ja,{present:r||s.open,children:d.jsx(Gre,{...i,ref:e})}):null});VB.displayName=I2;var Hre=g0("DialogOverlay.RemoveScroll"),Gre=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=uf(I2,n);return d.jsx(AS,{as:Hre,allowPinchZoom:!0,shards:[i.contentRef],children:d.jsx(mr.div,{"data-state":O7(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Rx="DialogContent",WB=w.forwardRef((t,e)=>{const n=HB(Rx,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=uf(Rx,t.__scopeDialog);return d.jsx(Ja,{present:r||s.open,children:s.modal?d.jsx(Vre,{...i,ref:e}):d.jsx(Wre,{...i,ref:e})})});WB.displayName=Rx;var Vre=w.forwardRef((t,e)=>{const n=uf(Rx,t.__scopeDialog),r=w.useRef(null),i=Vr(e,n.contentRef,r);return w.useEffect(()=>{const s=r.current;if(s)return AT(s)},[]),d.jsx($B,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tn(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Tn(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:Tn(t.onFocusOutside,s=>s.preventDefault())})}),Wre=w.forwardRef((t,e)=>{const n=uf(Rx,t.__scopeDialog),r=w.useRef(!1),i=w.useRef(!1);return d.jsx($B,{...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()}})}),$B=w.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=uf(Rx,n),l=w.useRef(null),c=Vr(e,l);return CT(),d.jsxs(d.Fragment,{children:[d.jsx(ES,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:d.jsx(qy,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":O7(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(qre,{titleId:a.titleId}),d.jsx(Yre,{contentRef:l,descriptionId:a.descriptionId})]})]})}),D7="DialogTitle",qB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=uf(D7,n);return d.jsx(mr.h2,{id:i.titleId,...r,ref:e})});qB.displayName=D7;var XB="DialogDescription",YB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=uf(XB,n);return d.jsx(mr.p,{id:i.descriptionId,...r,ref:e})});YB.displayName=XB;var KB="DialogClose",ZB=w.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=uf(KB,n);return d.jsx(mr.button,{type:"button",...r,ref:e,onClick:Tn(t.onClick,()=>i.onOpenChange(!1))})});ZB.displayName=KB;function O7(t){return t?"open":"closed"}var QB="DialogTitleWarning",[$re,JB]=wne(QB,{contentName:Rx,titleName:D7,docsSlug:"dialog"}),qre=({titleId:t})=>{const e=JB(QB),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 w.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},Xre="DialogDescriptionWarning",Yre=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${JB(Xre).contentName}}.`;return w.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},eH=FB,tH=BB,nH=GB,rH=VB,iH=WB,sH=qB,oH=YB,L7=ZB,aH="AlertDialog",[Kre]=Gc(aH,[zB]),Up=zB(),lH=t=>{const{__scopeAlertDialog:e,...n}=t,r=Up(e);return d.jsx(eH,{...r,...n,modal:!0})};lH.displayName=aH;var Zre="AlertDialogTrigger",Qre=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Up(n);return d.jsx(tH,{...i,...r,ref:e})});Qre.displayName=Zre;var Jre="AlertDialogPortal",cH=t=>{const{__scopeAlertDialog:e,...n}=t,r=Up(e);return d.jsx(nH,{...r,...n})};cH.displayName=Jre;var eie="AlertDialogOverlay",uH=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Up(n);return d.jsx(rH,{...i,...r,ref:e})});uH.displayName=eie;var O1="AlertDialogContent",[tie,nie]=Kre(O1),rie=vB("AlertDialogContent"),dH=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,s=Up(n),o=w.useRef(null),a=Vr(e,o),l=w.useRef(null);return d.jsx($re,{contentName:O1,titleName:fH,docsSlug:"alert-dialog",children:d.jsx(tie,{scope:n,cancelRef:l,children:d.jsxs(iH,{role:"alertdialog",...s,...i,ref:a,onOpenAutoFocus:Tn(i.onOpenAutoFocus,c=>{var f;c.preventDefault(),(f=l.current)==null||f.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[d.jsx(rie,{children:r}),d.jsx(sie,{contentRef:o})]})})})});dH.displayName=O1;var fH="AlertDialogTitle",hH=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Up(n);return d.jsx(sH,{...i,...r,ref:e})});hH.displayName=fH;var pH="AlertDialogDescription",mH=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Up(n);return d.jsx(oH,{...i,...r,ref:e})});mH.displayName=pH;var iie="AlertDialogAction",gH=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=Up(n);return d.jsx(L7,{...i,...r,ref:e})});gH.displayName=iie;var xH="AlertDialogCancel",vH=w.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=nie(xH,n),s=Up(n),o=Vr(e,i);return d.jsx(L7,{...s,...r,ref:o})});vH.displayName=xH;var sie=({contentRef:t})=>{const e=`\`${O1}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${O1}\` by passing a \`${pH}\` 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 \`${O1}\`. 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 w.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},oie=lH,aie=cH,lie=uH,cie=dH,uie=gH,die=vH,fie=hH,hie=mH,AA={exports:{}},NA={};/**
 * @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 c9;function pie(){if(c9)return NA;c9=1;var t=wS();function e(h,m){return h===m&&(h!==0||1/h===1/m)||h!==h&&m!==m}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(h,m){var x=m(),b=r({inst:{value:x,getSnapshot:m}}),_=b[0].inst,S=b[1];return s(function(){_.value=x,_.getSnapshot=m,l(_)&&S({inst:_})},[h,x,m]),i(function(){return l(_)&&S({inst:_}),h(function(){l(_)&&S({inst:_})})},[h]),o(x),x}function l(h){var m=h.getSnapshot;h=h.value;try{var x=m();return!n(h,x)}catch{return!0}}function c(h,m){return m()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return NA.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,NA}var u9;function mie(){return u9||(u9=1,AA.exports=pie()),AA.exports}function gie(t){const e=w.useRef({value:t,previous:t});return w.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function xie(t){const[e,n]=w.useState(void 0);return Ra(()=>{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 vie=["top","right","bottom","left"],x0=Math.min,cu=Math.max,D2=Math.round,N4=Math.floor,uh=t=>({x:t,y:t}),yie={left:"right",right:"left",bottom:"top",top:"bottom"},bie={start:"end",end:"start"};function Tk(t,e,n){return cu(t,x0(e,n))}function Ep(t,e){return typeof t=="function"?t(e):t}function Ap(t){return t.split("-")[0]}function Yy(t){return t.split("-")[1]}function j7(t){return t==="x"?"y":"x"}function z7(t){return t==="y"?"height":"width"}const _ie=new Set(["top","bottom"]);function sh(t){return _ie.has(Ap(t))?"y":"x"}function F7(t){return j7(sh(t))}function wie(t,e,n){n===void 0&&(n=!1);const r=Yy(t),i=F7(t),s=z7(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=O2(o)),[o,O2(o)]}function Sie(t){const e=O2(t);return[Ck(t),e,Ck(e)]}function Ck(t){return t.replace(/start|end/g,e=>bie[e])}const d9=["left","right"],f9=["right","left"],Mie=["top","bottom"],Tie=["bottom","top"];function Cie(t,e,n){switch(t){case"top":case"bottom":return n?e?f9:d9:e?d9:f9;case"left":case"right":return e?Mie:Tie;default:return[]}}function Eie(t,e,n,r){const i=Yy(t);let s=Cie(Ap(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Ck)))),s}function O2(t){return t.replace(/left|right|bottom|top/g,e=>yie[e])}function Aie(t){return{top:0,right:0,bottom:0,left:0,...t}}function yH(t){return typeof t!="number"?Aie(t):{top:t,right:t,bottom:t,left:t}}function L2(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 h9(t,e,n){let{reference:r,floating:i}=t;const s=sh(e),o=F7(e),a=z7(o),l=Ap(e),c=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let x;switch(l){case"top":x={x:f,y:r.y-i.height};break;case"bottom":x={x:f,y:r.y+r.height};break;case"right":x={x:r.x+r.width,y:h};break;case"left":x={x:r.x-i.width,y:h};break;default:x={x:r.x,y:r.y}}switch(Yy(e)){case"start":x[o]-=m*(n&&c?-1:1);break;case"end":x[o]+=m*(n&&c?-1:1);break}return x}async function Nie(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:f="viewport",elementContext:h="floating",altBoundary:m=!1,padding:x=0}=Ep(e,t),b=yH(x),S=a[m?h==="floating"?"reference":"floating":h],M=L2(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(S)))==null||n?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:f,strategy:l})),T=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},D=L2(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:T,offsetParent:A,strategy:l}):T);return{top:(M.top-D.top+b.top)/N.y,bottom:(D.bottom-M.bottom+b.bottom)/N.y,left:(M.left-D.left+b.left)/N.x,right:(D.right-M.right+b.right)/N.x}}const kie=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:f,y:h}=h9(c,r,l),m=r,x={},b=0;for(let S=0;S<a.length;S++){var _;const{name:M,fn:T}=a[S],{x:A,y:N,data:D,reset:k}=await T({x:f,y:h,initialPlacement:r,placement:m,strategy:i,middlewareData:x,rects:c,platform:{...o,detectOverflow:(_=o.detectOverflow)!=null?_:Nie},elements:{reference:t,floating:e}});f=A??f,h=N??h,x={...x,[M]:{...x[M],...D}},k&&b<=50&&(b++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(c=k.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):k.rects),{x:f,y:h}=h9(c,m,l)),S=-1)}return{x:f,y:h,placement:m,strategy:i,middlewareData:x}},Rie=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:f=0}=Ep(t,e)||{};if(c==null)return{};const h=yH(f),m={x:n,y:r},x=F7(i),b=z7(x),_=await o.getDimensions(c),S=x==="y",M=S?"top":"left",T=S?"bottom":"right",A=S?"clientHeight":"clientWidth",N=s.reference[b]+s.reference[x]-m[x]-s.floating[b],D=m[x]-s.reference[x],k=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let O=k?k[A]:0;(!O||!await(o.isElement==null?void 0:o.isElement(k)))&&(O=a.floating[A]||s.floating[b]);const R=N/2-D/2,L=O/2-_[b]/2-1,B=x0(h[M],L),H=x0(h[T],L),$=B,G=O-_[b]-H,Z=O/2-_[b]/2+R,V=Tk($,Z,G),W=!l.arrow&&Yy(i)!=null&&Z!==V&&s.reference[b]/2-(Z<$?B:H)-_[b]/2<0,J=W?Z<$?Z-$:Z-G:0;return{[x]:m[x]+J,data:{[x]:V,centerOffset:Z-V-J,...W&&{alignmentOffset:J}},reset:W}}}),Pie=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:f=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:_=!0,...S}=Ep(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const M=Ap(i),T=sh(a),A=Ap(a)===a,N=await(l.isRTL==null?void 0:l.isRTL(c.floating)),D=m||(A||!_?[O2(a)]:Sie(a)),k=b!=="none";!m&&k&&D.push(...Eie(a,_,b,N));const O=[a,...D],R=await l.detectOverflow(e,S),L=[];let B=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&L.push(R[M]),h){const Z=wie(i,o,N);L.push(R[Z[0]],R[Z[1]])}if(B=[...B,{placement:i,overflows:L}],!L.every(Z=>Z<=0)){var H,$;const Z=(((H=s.flip)==null?void 0:H.index)||0)+1,V=O[Z];if(V&&(!(h==="alignment"?T!==sh(V):!1)||B.every(ne=>sh(ne.placement)===T?ne.overflows[0]>0:!0)))return{data:{index:Z,overflows:B},reset:{placement:V}};let W=($=B.filter(J=>J.overflows[0]<=0).sort((J,ne)=>J.overflows[1]-ne.overflows[1])[0])==null?void 0:$.placement;if(!W)switch(x){case"bestFit":{var G;const J=(G=B.filter(ne=>{if(k){const ie=sh(ne.placement);return ie===T||ie==="y"}return!0}).map(ne=>[ne.placement,ne.overflows.filter(ie=>ie>0).reduce((ie,z)=>ie+z,0)]).sort((ne,ie)=>ne[1]-ie[1])[0])==null?void 0:G[0];J&&(W=J);break}case"initialPlacement":W=a;break}if(i!==W)return{reset:{placement:W}}}return{}}}};function p9(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function m9(t){return vie.some(e=>t[e]>=0)}const Iie=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...s}=Ep(t,e);switch(i){case"referenceHidden":{const o=await r.detectOverflow(e,{...s,elementContext:"reference"}),a=p9(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:m9(a)}}}case"escaped":{const o=await r.detectOverflow(e,{...s,altBoundary:!0}),a=p9(o,n.floating);return{data:{escapedOffsets:a,escaped:m9(a)}}}default:return{}}}}},bH=new Set(["left","top"]);async function Die(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ap(n),a=Yy(n),l=sh(n)==="y",c=bH.has(o)?-1:1,f=s&&l?-1:1,h=Ep(e,t);let{mainAxis:m,crossAxis:x,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"&&(x=a==="end"?b*-1:b),l?{x:x*f,y:m*c}:{x:m*c,y:x*f}}const Oie=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 Die(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}}}}},Lie=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:M=>{let{x:T,y:A}=M;return{x:T,y:A}}},...c}=Ep(t,e),f={x:n,y:r},h=await s.detectOverflow(e,c),m=sh(Ap(i)),x=j7(m);let b=f[x],_=f[m];if(o){const M=x==="y"?"top":"left",T=x==="y"?"bottom":"right",A=b+h[M],N=b-h[T];b=Tk(A,b,N)}if(a){const M=m==="y"?"top":"left",T=m==="y"?"bottom":"right",A=_+h[M],N=_-h[T];_=Tk(A,_,N)}const S=l.fn({...e,[x]:b,[m]:_});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[x]:o,[m]:a}}}}}},jie=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}=Ep(t,e),f={x:n,y:r},h=sh(i),m=j7(h);let x=f[m],b=f[h];const _=Ep(a,e),S=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(l){const A=m==="y"?"height":"width",N=s.reference[m]-s.floating[A]+S.mainAxis,D=s.reference[m]+s.reference[A]-S.mainAxis;x<N?x=N:x>D&&(x=D)}if(c){var M,T;const A=m==="y"?"width":"height",N=bH.has(Ap(i)),D=s.reference[h]-s.floating[A]+(N&&((M=o.offset)==null?void 0:M[h])||0)+(N?0:S.crossAxis),k=s.reference[h]+s.reference[A]+(N?0:((T=o.offset)==null?void 0:T[h])||0)-(N?S.crossAxis:0);b<D?b=D:b>k&&(b=k)}return{[m]:x,[h]:b}}}},zie=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}=Ep(t,e),f=await o.detectOverflow(e,c),h=Ap(i),m=Yy(i),x=sh(i)==="y",{width:b,height:_}=s.floating;let S,M;h==="top"||h==="bottom"?(S=h,M=m===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(M=h,S=m==="end"?"top":"bottom");const T=_-f.top-f.bottom,A=b-f.left-f.right,N=x0(_-f[S],T),D=x0(b-f[M],A),k=!e.middlewareData.shift;let O=N,R=D;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=A),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(O=T),k&&!m){const B=cu(f.left,0),H=cu(f.right,0),$=cu(f.top,0),G=cu(f.bottom,0);x?R=b-2*(B!==0||H!==0?B+H:cu(f.left,f.right)):O=_-2*($!==0||G!==0?$+G:cu(f.top,f.bottom))}await l({...e,availableWidth:R,availableHeight:O});const L=await o.getDimensions(a.floating);return b!==L.width||_!==L.height?{reset:{rects:!0}}:{}}}};function kT(){return typeof window<"u"}function Ky(t){return _H(t)?(t.nodeName||"").toLowerCase():"#document"}function mu(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function _h(t){var e;return(e=(_H(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function _H(t){return kT()?t instanceof Node||t instanceof mu(t).Node:!1}function af(t){return kT()?t instanceof Element||t instanceof mu(t).Element:!1}function hh(t){return kT()?t instanceof HTMLElement||t instanceof mu(t).HTMLElement:!1}function g9(t){return!kT()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof mu(t).ShadowRoot}const Fie=new Set(["inline","contents"]);function NS(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=lf(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!Fie.has(i)}const Uie=new Set(["table","td","th"]);function Bie(t){return Uie.has(Ky(t))}const Hie=[":popover-open",":modal"];function RT(t){return Hie.some(e=>{try{return t.matches(e)}catch{return!1}})}const Gie=["transform","translate","scale","rotate","perspective"],Vie=["transform","translate","scale","rotate","perspective","filter"],Wie=["paint","layout","strict","content"];function U7(t){const e=B7(),n=af(t)?lf(t):t;return Gie.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)||Vie.some(r=>(n.willChange||"").includes(r))||Wie.some(r=>(n.contain||"").includes(r))}function $ie(t){let e=v0(t);for(;hh(e)&&!dy(e);){if(U7(e))return e;if(RT(e))return null;e=v0(e)}return null}function B7(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const qie=new Set(["html","body","#document"]);function dy(t){return qie.has(Ky(t))}function lf(t){return mu(t).getComputedStyle(t)}function PT(t){return af(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function v0(t){if(Ky(t)==="html")return t;const e=t.assignedSlot||t.parentNode||g9(t)&&t.host||_h(t);return g9(e)?e.host:e}function wH(t){const e=v0(t);return dy(e)?t.ownerDocument?t.ownerDocument.body:t.body:hh(e)&&NS(e)?e:wH(e)}function Pw(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=wH(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=mu(i);if(s){const a=Ek(o);return e.concat(o,o.visualViewport||[],NS(i)?i:[],a&&n?Pw(a):[])}return e.concat(i,Pw(i,[],n))}function Ek(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function SH(t){const e=lf(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=hh(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=D2(n)!==s||D2(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function H7(t){return af(t)?t:t.contextElement}function L1(t){const e=H7(t);if(!hh(e))return uh(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=SH(e);let o=(s?D2(n.width):n.width)/r,a=(s?D2(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Xie=uh(0);function MH(t){const e=mu(t);return!B7()||!e.visualViewport?Xie:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Yie(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==mu(t)?!1:e}function Px(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=H7(t);let o=uh(1);e&&(r?af(r)&&(o=L1(r)):o=L1(t));const a=Yie(s,n,r)?MH(s):uh(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const m=mu(s),x=r&&af(r)?mu(r):r;let b=m,_=Ek(b);for(;_&&r&&x!==b;){const S=L1(_),M=_.getBoundingClientRect(),T=lf(_),A=M.left+(_.clientLeft+parseFloat(T.paddingLeft))*S.x,N=M.top+(_.clientTop+parseFloat(T.paddingTop))*S.y;l*=S.x,c*=S.y,f*=S.x,h*=S.y,l+=A,c+=N,b=mu(_),_=Ek(b)}}return L2({width:f,height:h,x:l,y:c})}function IT(t,e){const n=PT(t).scrollLeft;return e?e.left+n:Px(_h(t)).left+n}function TH(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-IT(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function Kie(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=_h(r),a=e?RT(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=uh(1);const f=uh(0),h=hh(r);if((h||!h&&!s)&&((Ky(r)!=="body"||NS(o))&&(l=PT(r)),hh(r))){const x=Px(r);c=L1(r),f.x=x.x+r.clientLeft,f.y=x.y+r.clientTop}const m=o&&!h&&!s?TH(o,l):uh(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+m.x,y:n.y*c.y-l.scrollTop*c.y+f.y+m.y}}function Zie(t){return Array.from(t.getClientRects())}function Qie(t){const e=_h(t),n=PT(t),r=t.ownerDocument.body,i=cu(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=cu(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+IT(t);const a=-n.scrollTop;return lf(r).direction==="rtl"&&(o+=cu(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const x9=25;function Jie(t,e){const n=mu(t),r=_h(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const f=B7();(!f||f&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=IT(r);if(c<=0){const f=r.ownerDocument,h=f.body,m=getComputedStyle(h),x=f.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,b=Math.abs(r.clientWidth-h.clientWidth-x);b<=x9&&(s-=b)}else c<=x9&&(s+=c);return{width:s,height:o,x:a,y:l}}const ese=new Set(["absolute","fixed"]);function tse(t,e){const n=Px(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=hh(t)?L1(t):uh(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 v9(t,e,n){let r;if(e==="viewport")r=Jie(t,n);else if(e==="document")r=Qie(_h(t));else if(af(e))r=tse(e,n);else{const i=MH(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return L2(r)}function CH(t,e){const n=v0(t);return n===e||!af(n)||dy(n)?!1:lf(n).position==="fixed"||CH(n,e)}function nse(t,e){const n=e.get(t);if(n)return n;let r=Pw(t,[],!1).filter(a=>af(a)&&Ky(a)!=="body"),i=null;const s=lf(t).position==="fixed";let o=s?v0(t):t;for(;af(o)&&!dy(o);){const a=lf(o),l=U7(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&ese.has(i.position)||NS(o)&&!l&&CH(t,o))?r=r.filter(f=>f!==o):i=a,o=v0(o)}return e.set(t,r),r}function rse(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?RT(e)?[]:nse(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((c,f)=>{const h=v9(e,f,i);return c.top=cu(h.top,c.top),c.right=x0(h.right,c.right),c.bottom=x0(h.bottom,c.bottom),c.left=cu(h.left,c.left),c},v9(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function ise(t){const{width:e,height:n}=SH(t);return{width:e,height:n}}function sse(t,e,n){const r=hh(e),i=_h(e),s=n==="fixed",o=Px(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=uh(0);function c(){l.x=IT(i)}if(r||!r&&!s)if((Ky(e)!=="body"||NS(i))&&(a=PT(e)),r){const x=Px(e,!0,s,e);l.x=x.x+e.clientLeft,l.y=x.y+e.clientTop}else i&&c();s&&!r&&i&&c();const f=i&&!r&&!s?TH(i,a):uh(0),h=o.left+a.scrollLeft-l.x-f.x,m=o.top+a.scrollTop-l.y-f.y;return{x:h,y:m,width:o.width,height:o.height}}function kA(t){return lf(t).position==="static"}function y9(t,e){if(!hh(t)||lf(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return _h(t)===n&&(n=n.ownerDocument.body),n}function EH(t,e){const n=mu(t);if(RT(t))return n;if(!hh(t)){let i=v0(t);for(;i&&!dy(i);){if(af(i)&&!kA(i))return i;i=v0(i)}return n}let r=y9(t,e);for(;r&&Bie(r)&&kA(r);)r=y9(r,e);return r&&dy(r)&&kA(r)&&!U7(r)?n:r||$ie(t)||n}const ose=async function(t){const e=this.getOffsetParent||EH,n=this.getDimensions,r=await n(t.floating);return{reference:sse(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ase(t){return lf(t).direction==="rtl"}const lse={convertOffsetParentRelativeRectToViewportRelativeRect:Kie,getDocumentElement:_h,getClippingRect:rse,getOffsetParent:EH,getElementRects:ose,getClientRects:Zie,getDimensions:ise,getScale:L1,isElement:af,isRTL:ase};function AH(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function cse(t,e){let n=null,r;const i=_h(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:f,top:h,width:m,height:x}=c;if(a||e(),!m||!x)return;const b=N4(h),_=N4(i.clientWidth-(f+m)),S=N4(i.clientHeight-(h+x)),M=N4(f),A={rootMargin:-b+"px "+-_+"px "+-S+"px "+-M+"px",threshold:cu(0,x0(1,l))||1};let N=!0;function D(k){const O=k[0].intersectionRatio;if(O!==l){if(!N)return o();O?o(!1,O):r=setTimeout(()=>{o(!1,1e-7)},1e3)}O===1&&!AH(c,t.getBoundingClientRect())&&o(),N=!1}try{n=new IntersectionObserver(D,{...A,root:i.ownerDocument})}catch{n=new IntersectionObserver(D,A)}n.observe(t)}return o(!0),s}function use(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=H7(t),f=i||s?[...c?Pw(c):[],...Pw(e)]:[];f.forEach(M=>{i&&M.addEventListener("scroll",n,{passive:!0}),s&&M.addEventListener("resize",n)});const h=c&&a?cse(c,n):null;let m=-1,x=null;o&&(x=new ResizeObserver(M=>{let[T]=M;T&&T.target===c&&x&&(x.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var A;(A=x)==null||A.observe(e)})),n()}),c&&!l&&x.observe(c),x.observe(e));let b,_=l?Px(t):null;l&&S();function S(){const M=Px(t);_&&!AH(_,M)&&n(),_=M,b=requestAnimationFrame(S)}return n(),()=>{var M;f.forEach(T=>{i&&T.removeEventListener("scroll",n),s&&T.removeEventListener("resize",n)}),h==null||h(),(M=x)==null||M.disconnect(),x=null,l&&cancelAnimationFrame(b)}}const dse=Oie,fse=Lie,hse=Pie,pse=zie,mse=Iie,b9=Rie,gse=jie,xse=(t,e,n)=>{const r=new Map,i={platform:lse,...n},s={...i.platform,_c:r};return kie(t,e,{...i,platform:s})};var vse=typeof document<"u",yse=function(){},p2=vse?w.useLayoutEffect:yse;function j2(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(!j2(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)&&!j2(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function NH(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function _9(t,e){const n=NH(t);return Math.round(e*n)/n}function RA(t){const e=w.useRef(t);return p2(()=>{e.current=t}),e}function bse(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,[f,h]=w.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,x]=w.useState(r);j2(m,r)||x(r);const[b,_]=w.useState(null),[S,M]=w.useState(null),T=w.useCallback(ne=>{ne!==k.current&&(k.current=ne,_(ne))},[]),A=w.useCallback(ne=>{ne!==O.current&&(O.current=ne,M(ne))},[]),N=s||b,D=o||S,k=w.useRef(null),O=w.useRef(null),R=w.useRef(f),L=l!=null,B=RA(l),H=RA(i),$=RA(c),G=w.useCallback(()=>{if(!k.current||!O.current)return;const ne={placement:e,strategy:n,middleware:m};H.current&&(ne.platform=H.current),xse(k.current,O.current,ne).then(ie=>{const z={...ie,isPositioned:$.current!==!1};Z.current&&!j2(R.current,z)&&(R.current=z,Yl.flushSync(()=>{h(z)}))})},[m,e,n,H,$]);p2(()=>{c===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,h(ne=>({...ne,isPositioned:!1})))},[c]);const Z=w.useRef(!1);p2(()=>(Z.current=!0,()=>{Z.current=!1}),[]),p2(()=>{if(N&&(k.current=N),D&&(O.current=D),N&&D){if(B.current)return B.current(N,D,G);G()}},[N,D,G,B,L]);const V=w.useMemo(()=>({reference:k,floating:O,setReference:T,setFloating:A}),[T,A]),W=w.useMemo(()=>({reference:N,floating:D}),[N,D]),J=w.useMemo(()=>{const ne={position:n,left:0,top:0};if(!W.floating)return ne;const ie=_9(W.floating,f.x),z=_9(W.floating,f.y);return a?{...ne,transform:"translate("+ie+"px, "+z+"px)",...NH(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ie,top:z}},[n,a,W.floating,f.x,f.y]);return w.useMemo(()=>({...f,update:G,refs:V,elements:W,floatingStyles:J}),[f,G,V,W,J])}const _se=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?b9({element:r.current,padding:i}).fn(n):{}:r?b9({element:r,padding:i}).fn(n):{}}}},wse=(t,e)=>({...dse(t),options:[t,e]}),Sse=(t,e)=>({...fse(t),options:[t,e]}),Mse=(t,e)=>({...gse(t),options:[t,e]}),Tse=(t,e)=>({...hse(t),options:[t,e]}),Cse=(t,e)=>({...pse(t),options:[t,e]}),Ese=(t,e)=>({...mse(t),options:[t,e]}),Ase=(t,e)=>({..._se(t),options:[t,e]});var Nse="Arrow",kH=w.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...s}=t;return d.jsx(mr.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});kH.displayName=Nse;var kse=kH,G7="Popper",[RH,O0]=Gc(G7),[Rse,PH]=RH(G7),IH=t=>{const{__scopePopper:e,children:n}=t,[r,i]=w.useState(null);return d.jsx(Rse,{scope:e,anchor:r,onAnchorChange:i,children:n})};IH.displayName=G7;var DH="PopperAnchor",OH=w.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,s=PH(DH,n),o=w.useRef(null),a=Vr(e,o),l=w.useRef(null);return w.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:d.jsx(mr.div,{...i,ref:a})});OH.displayName=DH;var V7="PopperContent",[Pse,Ise]=RH(V7),LH=w.forwardRef((t,e)=>{var se,re,K,fe,he,ae;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:x="optimized",onPlaced:b,..._}=t,S=PH(V7,n),[M,T]=w.useState(null),A=Vr(e,Se=>T(Se)),[N,D]=w.useState(null),k=xie(N),O=(k==null?void 0:k.width)??0,R=(k==null?void 0:k.height)??0,L=r+(s!=="center"?"-"+s:""),B=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},H=Array.isArray(c)?c:[c],$=H.length>0,G={padding:B,boundary:H.filter(Ose),altBoundary:$},{refs:Z,floatingStyles:V,placement:W,isPositioned:J,middlewareData:ne}=bse({strategy:"fixed",placement:L,whileElementsMounted:(...Se)=>use(...Se,{animationFrame:x==="always"}),elements:{reference:S.anchor},middleware:[wse({mainAxis:i+R,alignmentAxis:o}),l&&Sse({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Mse():void 0,...G}),l&&Tse({...G}),Cse({...G,apply:({elements:Se,rects:de,availableWidth:Me,availableHeight:Ce})=>{const{width:Re,height:le}=de.reference,He=Se.floating.style;He.setProperty("--radix-popper-available-width",`${Me}px`),He.setProperty("--radix-popper-available-height",`${Ce}px`),He.setProperty("--radix-popper-anchor-width",`${Re}px`),He.setProperty("--radix-popper-anchor-height",`${le}px`)}}),N&&Ase({element:N,padding:a}),Lse({arrowWidth:O,arrowHeight:R}),m&&Ese({strategy:"referenceHidden",...G})]}),[ie,z]=FH(W),j=pa(b);Ra(()=>{J&&(j==null||j())},[J,j]);const X=(se=ne.arrow)==null?void 0:se.x,F=(re=ne.arrow)==null?void 0:re.y,ce=((K=ne.arrow)==null?void 0:K.centerOffset)!==0,[oe,Q]=w.useState();return Ra(()=>{M&&Q(window.getComputedStyle(M).zIndex)},[M]),d.jsx("div",{ref:Z.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:J?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[(fe=ne.transformOrigin)==null?void 0:fe.x,(he=ne.transformOrigin)==null?void 0:he.y].join(" "),...((ae=ne.hide)==null?void 0:ae.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(Pse,{scope:n,placedSide:ie,onArrowChange:D,arrowX:X,arrowY:F,shouldHideArrow:ce,children:d.jsx(mr.div,{"data-side":ie,"data-align":z,..._,ref:A,style:{..._.style,animation:J?void 0:"none"}})})})});LH.displayName=V7;var jH="PopperArrow",Dse={top:"bottom",right:"left",bottom:"top",left:"right"},zH=w.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,s=Ise(jH,r),o=Dse[s.placedSide];return d.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:d.jsx(kse,{...i,ref:n,style:{...i.style,display:"block"}})})});zH.displayName=jH;function Ose(t){return t!==null}var Lse=t=>({name:"transformOrigin",options:t,fn(e){var S,M,T;const{placement:n,rects:r,middlewareData:i}=e,o=((S=i.arrow)==null?void 0:S.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,f]=FH(n),h={start:"0%",center:"50%",end:"100%"}[f],m=(((M=i.arrow)==null?void 0:M.x)??0)+a/2,x=(((T=i.arrow)==null?void 0:T.y)??0)+l/2;let b="",_="";return c==="bottom"?(b=o?h:`${m}px`,_=`${-l}px`):c==="top"?(b=o?h:`${m}px`,_=`${r.floating.height+l}px`):c==="right"?(b=`${-l}px`,_=o?h:`${x}px`):c==="left"&&(b=`${r.floating.width+l}px`,_=o?h:`${x}px`),{data:{x:b,y:_}}}});function FH(t){const[e,n="center"]=t.split("-");return[e,n]}var kS=IH,RS=OH,DT=LH,OT=zH,PA="rovingFocusGroup.onEntryFocus",jse={bubbles:!1,cancelable:!0},PS="RovingFocusGroup",[Ak,UH,zse]=N7(PS),[Fse,LT]=Gc(PS,[zse]),[Use,Bse]=Fse(PS),BH=w.forwardRef((t,e)=>d.jsx(Ak.Provider,{scope:t.__scopeRovingFocusGroup,children:d.jsx(Ak.Slot,{scope:t.__scopeRovingFocusGroup,children:d.jsx(Hse,{...t,ref:e})})}));BH.displayName=PS;var Hse=w.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:f=!1,...h}=t,m=w.useRef(null),x=Vr(e,m),b=CS(s),[_,S]=pd({prop:o,defaultProp:a??null,onChange:l,caller:PS}),[M,T]=w.useState(!1),A=pa(c),N=UH(n),D=w.useRef(!1),[k,O]=w.useState(0);return w.useEffect(()=>{const R=m.current;if(R)return R.addEventListener(PA,A),()=>R.removeEventListener(PA,A)},[A]),d.jsx(Use,{scope:n,orientation:r,dir:b,loop:i,currentTabStopId:_,onItemFocus:w.useCallback(R=>S(R),[S]),onItemShiftTab:w.useCallback(()=>T(!0),[]),onFocusableItemAdd:w.useCallback(()=>O(R=>R+1),[]),onFocusableItemRemove:w.useCallback(()=>O(R=>R-1),[]),children:d.jsx(mr.div,{tabIndex:M||k===0?-1:0,"data-orientation":r,...h,ref:x,style:{outline:"none",...t.style},onMouseDown:Tn(t.onMouseDown,()=>{D.current=!0}),onFocus:Tn(t.onFocus,R=>{const L=!D.current;if(R.target===R.currentTarget&&L&&!M){const B=new CustomEvent(PA,jse);if(R.currentTarget.dispatchEvent(B),!B.defaultPrevented){const H=N().filter(W=>W.focusable),$=H.find(W=>W.active),G=H.find(W=>W.id===_),V=[$,G,...H].filter(Boolean).map(W=>W.ref.current);VH(V,f)}}D.current=!1}),onBlur:Tn(t.onBlur,()=>T(!1))})})}),HH="RovingFocusGroupItem",GH=w.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=t,l=Bc(),c=s||l,f=Bse(HH,n),h=f.currentTabStopId===c,m=UH(n),{onFocusableItemAdd:x,onFocusableItemRemove:b,currentTabStopId:_}=f;return w.useEffect(()=>{if(r)return x(),()=>b()},[r,x,b]),d.jsx(Ak.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:d.jsx(mr.span,{tabIndex:h?0:-1,"data-orientation":f.orientation,...a,ref:e,onMouseDown:Tn(t.onMouseDown,S=>{r?f.onItemFocus(c):S.preventDefault()}),onFocus:Tn(t.onFocus,()=>f.onItemFocus(c)),onKeyDown:Tn(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const M=Wse(S,f.orientation,f.dir);if(M!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let A=m().filter(N=>N.focusable).map(N=>N.ref.current);if(M==="last")A.reverse();else if(M==="prev"||M==="next"){M==="prev"&&A.reverse();const N=A.indexOf(S.currentTarget);A=f.loop?$se(A,N+1):A.slice(N+1)}setTimeout(()=>VH(A))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:_!=null}):o})})});GH.displayName=HH;var Gse={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Vse(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Wse(t,e,n){const r=Vse(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Gse[r]}function VH(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function $se(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var WH=BH,$H=GH,Nk=["Enter"," "],qse=["ArrowDown","PageUp","Home"],qH=["ArrowUp","PageDown","End"],Xse=[...qse,...qH],Yse={ltr:[...Nk,"ArrowRight"],rtl:[...Nk,"ArrowLeft"]},Kse={ltr:["ArrowLeft"],rtl:["ArrowRight"]},IS="Menu",[Iw,Zse,Qse]=N7(IS),[Vx,jT]=Gc(IS,[Qse,O0,LT]),DS=O0(),XH=LT(),[YH,L0]=Vx(IS),[Jse,OS]=Vx(IS),KH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=t,a=DS(e),[l,c]=w.useState(null),f=w.useRef(!1),h=pa(s),m=CS(i);return w.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),d.jsx(kS,{...a,children:d.jsx(YH,{scope:e,open:n,onOpenChange:h,content:l,onContentChange:c,children:d.jsx(Jse,{scope:e,onClose:w.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:f,dir:m,modal:o,children:r})})})};KH.displayName=IS;var eoe="MenuAnchor",W7=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=DS(n);return d.jsx(RS,{...i,...r,ref:e})});W7.displayName=eoe;var $7="MenuPortal",[toe,ZH]=Vx($7,{forceMount:void 0}),QH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,s=L0($7,e);return d.jsx(toe,{scope:e,forceMount:n,children:d.jsx(Ja,{present:n||s.open,children:d.jsx(Xy,{asChild:!0,container:i,children:r})})})};QH.displayName=$7;var fd="MenuContent",[noe,q7]=Vx(fd),JH=w.forwardRef((t,e)=>{const n=ZH(fd,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=L0(fd,t.__scopeMenu),o=OS(fd,t.__scopeMenu);return d.jsx(Iw.Provider,{scope:t.__scopeMenu,children:d.jsx(Ja,{present:r||s.open,children:d.jsx(Iw.Slot,{scope:t.__scopeMenu,children:o.modal?d.jsx(roe,{...i,ref:e}):d.jsx(ioe,{...i,ref:e})})})})}),roe=w.forwardRef((t,e)=>{const n=L0(fd,t.__scopeMenu),r=w.useRef(null),i=Vr(e,r);return w.useEffect(()=>{const s=r.current;if(s)return AT(s)},[]),d.jsx(X7,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Tn(t.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),ioe=w.forwardRef((t,e)=>{const n=L0(fd,t.__scopeMenu);return d.jsx(X7,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),soe=g0("MenuContent.ScrollLock"),X7=w.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,disableOutsideScroll:b,..._}=t,S=L0(fd,n),M=OS(fd,n),T=DS(n),A=XH(n),N=Zse(n),[D,k]=w.useState(null),O=w.useRef(null),R=Vr(e,O,S.onContentChange),L=w.useRef(0),B=w.useRef(""),H=w.useRef(0),$=w.useRef(null),G=w.useRef("right"),Z=w.useRef(0),V=b?AS:w.Fragment,W=b?{as:soe,allowPinchZoom:!0}:void 0,J=ie=>{var se,re;const z=B.current+ie,j=N().filter(K=>!K.disabled),X=document.activeElement,F=(se=j.find(K=>K.ref.current===X))==null?void 0:se.textValue,ce=j.map(K=>K.textValue),oe=xoe(ce,z,F),Q=(re=j.find(K=>K.textValue===oe))==null?void 0:re.ref.current;(function K(fe){B.current=fe,window.clearTimeout(L.current),fe!==""&&(L.current=window.setTimeout(()=>K(""),1e3))})(z),Q&&setTimeout(()=>Q.focus())};w.useEffect(()=>()=>window.clearTimeout(L.current),[]),CT();const ne=w.useCallback(ie=>{var j,X;return G.current===((j=$.current)==null?void 0:j.side)&&yoe(ie,(X=$.current)==null?void 0:X.area)},[]);return d.jsx(noe,{scope:n,searchRef:B,onItemEnter:w.useCallback(ie=>{ne(ie)&&ie.preventDefault()},[ne]),onItemLeave:w.useCallback(ie=>{var z;ne(ie)||((z=O.current)==null||z.focus(),k(null))},[ne]),onTriggerLeave:w.useCallback(ie=>{ne(ie)&&ie.preventDefault()},[ne]),pointerGraceTimerRef:H,onPointerGraceIntentChange:w.useCallback(ie=>{$.current=ie},[]),children:d.jsx(V,{...W,children:d.jsx(ES,{asChild:!0,trapped:i,onMountAutoFocus:Tn(s,ie=>{var z;ie.preventDefault(),(z=O.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:d.jsx(qy,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:c,onPointerDownOutside:f,onFocusOutside:h,onInteractOutside:m,onDismiss:x,children:d.jsx(WH,{asChild:!0,...A,dir:M.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:k,onEntryFocus:Tn(l,ie=>{M.isUsingKeyboardRef.current||ie.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(DT,{role:"menu","aria-orientation":"vertical","data-state":gG(S.open),"data-radix-menu-content":"",dir:M.dir,...T,..._,ref:R,style:{outline:"none",..._.style},onKeyDown:Tn(_.onKeyDown,ie=>{const j=ie.target.closest("[data-radix-menu-content]")===ie.currentTarget,X=ie.ctrlKey||ie.altKey||ie.metaKey,F=ie.key.length===1;j&&(ie.key==="Tab"&&ie.preventDefault(),!X&&F&&J(ie.key));const ce=O.current;if(ie.target!==ce||!Xse.includes(ie.key))return;ie.preventDefault();const Q=N().filter(se=>!se.disabled).map(se=>se.ref.current);qH.includes(ie.key)&&Q.reverse(),moe(Q)}),onBlur:Tn(t.onBlur,ie=>{ie.currentTarget.contains(ie.target)||(window.clearTimeout(L.current),B.current="")}),onPointerMove:Tn(t.onPointerMove,Dw(ie=>{const z=ie.target,j=Z.current!==ie.clientX;if(ie.currentTarget.contains(z)&&j){const X=ie.clientX>Z.current?"right":"left";G.current=X,Z.current=ie.clientX}}))})})})})})})});JH.displayName=fd;var ooe="MenuGroup",Y7=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(mr.div,{role:"group",...r,ref:e})});Y7.displayName=ooe;var aoe="MenuLabel",eG=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(mr.div,{...r,ref:e})});eG.displayName=aoe;var z2="MenuItem",w9="menu.itemSelect",zT=w.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,s=w.useRef(null),o=OS(z2,t.__scopeMenu),a=q7(z2,t.__scopeMenu),l=Vr(e,s),c=w.useRef(!1),f=()=>{const h=s.current;if(!n&&h){const m=new CustomEvent(w9,{bubbles:!0,cancelable:!0});h.addEventListener(w9,x=>r==null?void 0:r(x),{once:!0}),yB(h,m),m.defaultPrevented?c.current=!1:o.onClose()}};return d.jsx(tG,{...i,ref:l,disabled:n,onClick:Tn(t.onClick,f),onPointerDown:h=>{var m;(m=t.onPointerDown)==null||m.call(t,h),c.current=!0},onPointerUp:Tn(t.onPointerUp,h=>{var m;c.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:Tn(t.onKeyDown,h=>{const m=a.searchRef.current!=="";n||m&&h.key===" "||Nk.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});zT.displayName=z2;var tG=w.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=t,o=q7(z2,n),a=XH(n),l=w.useRef(null),c=Vr(e,l),[f,h]=w.useState(!1),[m,x]=w.useState("");return w.useEffect(()=>{const b=l.current;b&&x((b.textContent??"").trim())},[s.children]),d.jsx(Iw.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:d.jsx($H,{asChild:!0,...a,focusable:!r,children:d.jsx(mr.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:c,onPointerMove:Tn(t.onPointerMove,Dw(b=>{r?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Tn(t.onPointerLeave,Dw(b=>o.onItemLeave(b))),onFocus:Tn(t.onFocus,()=>h(!0)),onBlur:Tn(t.onBlur,()=>h(!1))})})})}),loe="MenuCheckboxItem",nG=w.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return d.jsx(aG,{scope:t.__scopeMenu,checked:n,children:d.jsx(zT,{role:"menuitemcheckbox","aria-checked":F2(n)?"mixed":n,...i,ref:e,"data-state":Q7(n),onSelect:Tn(i.onSelect,()=>r==null?void 0:r(F2(n)?!0:!n),{checkForDefaultPrevented:!1})})})});nG.displayName=loe;var rG="MenuRadioGroup",[coe,uoe]=Vx(rG,{value:void 0,onValueChange:()=>{}}),iG=w.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,s=pa(r);return d.jsx(coe,{scope:t.__scopeMenu,value:n,onValueChange:s,children:d.jsx(Y7,{...i,ref:e})})});iG.displayName=rG;var sG="MenuRadioItem",oG=w.forwardRef((t,e)=>{const{value:n,...r}=t,i=uoe(sG,t.__scopeMenu),s=n===i.value;return d.jsx(aG,{scope:t.__scopeMenu,checked:s,children:d.jsx(zT,{role:"menuitemradio","aria-checked":s,...r,ref:e,"data-state":Q7(s),onSelect:Tn(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});oG.displayName=sG;var K7="MenuItemIndicator",[aG,doe]=Vx(K7,{checked:!1}),lG=w.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,s=doe(K7,n);return d.jsx(Ja,{present:r||F2(s.checked)||s.checked===!0,children:d.jsx(mr.span,{...i,ref:e,"data-state":Q7(s.checked)})})});lG.displayName=K7;var foe="MenuSeparator",cG=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return d.jsx(mr.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});cG.displayName=foe;var hoe="MenuArrow",uG=w.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=DS(n);return d.jsx(OT,{...i,...r,ref:e})});uG.displayName=hoe;var Z7="MenuSub",[poe,dG]=Vx(Z7),fG=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:i}=t,s=L0(Z7,e),o=DS(e),[a,l]=w.useState(null),[c,f]=w.useState(null),h=pa(i);return w.useEffect(()=>(s.open===!1&&h(!1),()=>h(!1)),[s.open,h]),d.jsx(kS,{...o,children:d.jsx(YH,{scope:e,open:r,onOpenChange:h,content:c,onContentChange:f,children:d.jsx(poe,{scope:e,contentId:Bc(),triggerId:Bc(),trigger:a,onTriggerChange:l,children:n})})})};fG.displayName=Z7;var V_="MenuSubTrigger",hG=w.forwardRef((t,e)=>{const n=L0(V_,t.__scopeMenu),r=OS(V_,t.__scopeMenu),i=dG(V_,t.__scopeMenu),s=q7(V_,t.__scopeMenu),o=w.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,c={__scopeMenu:t.__scopeMenu},f=w.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return w.useEffect(()=>f,[f]),w.useEffect(()=>{const h=a.current;return()=>{window.clearTimeout(h),l(null)}},[a,l]),d.jsx(W7,{asChild:!0,...c,children:d.jsx(tG,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":gG(n.open),...t,ref:MT(e,i.onTriggerChange),onClick:h=>{var m;(m=t.onClick)==null||m.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Tn(t.onPointerMove,Dw(h=>{s.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Tn(t.onPointerLeave,Dw(h=>{var x,b;f();const m=(x=n.content)==null?void 0:x.getBoundingClientRect();if(m){const _=(b=n.content)==null?void 0:b.dataset.side,S=_==="right",M=S?-5:5,T=m[S?"left":"right"],A=m[S?"right":"left"];s.onPointerGraceIntentChange({area:[{x:h.clientX+M,y:h.clientY},{x:T,y:m.top},{x:A,y:m.top},{x:A,y:m.bottom},{x:T,y:m.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:Tn(t.onKeyDown,h=>{var x;const m=s.searchRef.current!=="";t.disabled||m&&h.key===" "||Yse[r.dir].includes(h.key)&&(n.onOpenChange(!0),(x=n.content)==null||x.focus(),h.preventDefault())})})})});hG.displayName=V_;var pG="MenuSubContent",mG=w.forwardRef((t,e)=>{const n=ZH(fd,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,s=L0(fd,t.__scopeMenu),o=OS(fd,t.__scopeMenu),a=dG(pG,t.__scopeMenu),l=w.useRef(null),c=Vr(e,l);return d.jsx(Iw.Provider,{scope:t.__scopeMenu,children:d.jsx(Ja,{present:r||s.open,children:d.jsx(Iw.Slot,{scope:t.__scopeMenu,children:d.jsx(X7,{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:f=>{var h;o.isUsingKeyboardRef.current&&((h=l.current)==null||h.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Tn(t.onFocusOutside,f=>{f.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Tn(t.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:Tn(t.onKeyDown,f=>{var x;const h=f.currentTarget.contains(f.target),m=Kse[o.dir].includes(f.key);h&&m&&(s.onOpenChange(!1),(x=a.trigger)==null||x.focus(),f.preventDefault())})})})})})});mG.displayName=pG;function gG(t){return t?"open":"closed"}function F2(t){return t==="indeterminate"}function Q7(t){return F2(t)?"indeterminate":t?"checked":"unchecked"}function moe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function goe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function xoe(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=goe(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 voe(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,f=a.y,h=l.x,m=l.y;f>r!=m>r&&n<(h-c)*(r-f)/(m-f)+c&&(i=!i)}return i}function yoe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return voe(n,e)}function Dw(t){return e=>e.pointerType==="mouse"?t(e):void 0}var xG=KH,vG=W7,yG=QH,bG=JH,_G=Y7,wG=eG,SG=zT,MG=nG,TG=iG,CG=oG,EG=lG,AG=cG,NG=uG,boe=fG,kG=hG,RG=mG,J7="ContextMenu",[_oe]=Gc(J7,[jT]),tc=jT(),[woe,PG]=_oe(J7),IG=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:i,modal:s=!0}=t,[o,a]=w.useState(!1),l=tc(e),c=pa(r),f=w.useCallback(h=>{a(h),c(h)},[c]);return d.jsx(woe,{scope:e,open:o,onOpenChange:f,modal:s,children:d.jsx(xG,{...l,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};IG.displayName=J7;var DG="ContextMenuTrigger",OG=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=t,s=PG(DG,n),o=tc(n),a=w.useRef({x:0,y:0}),l=w.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),c=w.useRef(0),f=w.useCallback(()=>window.clearTimeout(c.current),[]),h=m=>{a.current={x:m.clientX,y:m.clientY},s.onOpenChange(!0)};return w.useEffect(()=>f,[f]),w.useEffect(()=>void(r&&f()),[r,f]),d.jsxs(d.Fragment,{children:[d.jsx(vG,{...o,virtualRef:l}),d.jsx(mr.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:Tn(t.onContextMenu,m=>{f(),h(m),m.preventDefault()}),onPointerDown:r?t.onPointerDown:Tn(t.onPointerDown,k4(m=>{f(),c.current=window.setTimeout(()=>h(m),700)})),onPointerMove:r?t.onPointerMove:Tn(t.onPointerMove,k4(f)),onPointerCancel:r?t.onPointerCancel:Tn(t.onPointerCancel,k4(f)),onPointerUp:r?t.onPointerUp:Tn(t.onPointerUp,k4(f))})]})});OG.displayName=DG;var Soe="ContextMenuPortal",LG=t=>{const{__scopeContextMenu:e,...n}=t,r=tc(e);return d.jsx(yG,{...r,...n})};LG.displayName=Soe;var jG="ContextMenuContent",zG=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=PG(jG,n),s=tc(n),o=w.useRef(!1);return d.jsx(bG,{...s,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=t.onCloseAutoFocus)==null||l.call(t,a),!a.defaultPrevented&&o.current&&a.preventDefault(),o.current=!1},onInteractOutside:a=>{var l;(l=t.onInteractOutside)==null||l.call(t,a),!a.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});zG.displayName=jG;var Moe="ContextMenuGroup",Toe=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(_G,{...i,...r,ref:e})});Toe.displayName=Moe;var Coe="ContextMenuLabel",Eoe=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(wG,{...i,...r,ref:e})});Eoe.displayName=Coe;var Aoe="ContextMenuItem",FG=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(SG,{...i,...r,ref:e})});FG.displayName=Aoe;var Noe="ContextMenuCheckboxItem",koe=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(MG,{...i,...r,ref:e})});koe.displayName=Noe;var Roe="ContextMenuRadioGroup",Poe=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(TG,{...i,...r,ref:e})});Poe.displayName=Roe;var Ioe="ContextMenuRadioItem",Doe=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(CG,{...i,...r,ref:e})});Doe.displayName=Ioe;var Ooe="ContextMenuItemIndicator",Loe=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(EG,{...i,...r,ref:e})});Loe.displayName=Ooe;var joe="ContextMenuSeparator",zoe=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(AG,{...i,...r,ref:e})});zoe.displayName=joe;var Foe="ContextMenuArrow",Uoe=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(NG,{...i,...r,ref:e})});Uoe.displayName=Foe;var Boe="ContextMenuSubTrigger",Hoe=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(kG,{...i,...r,ref:e})});Hoe.displayName=Boe;var Goe="ContextMenuSubContent",Voe=w.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,i=tc(n);return d.jsx(RG,{...i,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Voe.displayName=Goe;function k4(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var Woe=IG,$oe=OG,qoe=LG,Xoe=zG,Yoe=FG,FT="DropdownMenu",[Koe]=Gc(FT,[jT]),Sl=jT(),[Zoe,UG]=Koe(FT),BG=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:a=!0}=t,l=Sl(e),c=w.useRef(null),[f,h]=pd({prop:i,defaultProp:s??!1,onChange:o,caller:FT});return d.jsx(Zoe,{scope:e,triggerId:Bc(),triggerRef:c,contentId:Bc(),open:f,onOpenChange:h,onOpenToggle:w.useCallback(()=>h(m=>!m),[h]),modal:a,children:d.jsx(xG,{...l,open:f,onOpenChange:h,dir:r,modal:a,children:n})})};BG.displayName=FT;var HG="DropdownMenuTrigger",GG=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,s=UG(HG,n),o=Sl(n);return d.jsx(vG,{asChild:!0,...o,children:d.jsx(mr.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:MT(e,s.triggerRef),onPointerDown:Tn(t.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(s.onOpenToggle(),s.open||a.preventDefault())}),onKeyDown:Tn(t.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&s.onOpenToggle(),a.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});GG.displayName=HG;var Qoe="DropdownMenuPortal",VG=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Sl(e);return d.jsx(yG,{...r,...n})};VG.displayName=Qoe;var WG="DropdownMenuContent",$G=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=UG(WG,n),s=Sl(n),o=w.useRef(!1);return d.jsx(bG,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:e,onCloseAutoFocus:Tn(t.onCloseAutoFocus,a=>{var l;o.current||(l=i.triggerRef.current)==null||l.focus(),o.current=!1,a.preventDefault()}),onInteractOutside:Tn(t.onInteractOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,f=l.button===2||c;(!i.modal||f)&&(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)"}})});$G.displayName=WG;var Joe="DropdownMenuGroup",eae=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(_G,{...i,...r,ref:e})});eae.displayName=Joe;var tae="DropdownMenuLabel",qG=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(wG,{...i,...r,ref:e})});qG.displayName=tae;var nae="DropdownMenuItem",XG=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(SG,{...i,...r,ref:e})});XG.displayName=nae;var rae="DropdownMenuCheckboxItem",YG=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(MG,{...i,...r,ref:e})});YG.displayName=rae;var iae="DropdownMenuRadioGroup",sae=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(TG,{...i,...r,ref:e})});sae.displayName=iae;var oae="DropdownMenuRadioItem",aae=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(CG,{...i,...r,ref:e})});aae.displayName=oae;var lae="DropdownMenuItemIndicator",KG=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(EG,{...i,...r,ref:e})});KG.displayName=lae;var cae="DropdownMenuSeparator",ZG=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(AG,{...i,...r,ref:e})});ZG.displayName=cae;var uae="DropdownMenuArrow",dae=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(NG,{...i,...r,ref:e})});dae.displayName=uae;var fae=t=>{const{__scopeDropdownMenu:e,children:n,open:r,onOpenChange:i,defaultOpen:s}=t,o=Sl(e),[a,l]=pd({prop:r,defaultProp:s??!1,onChange:i,caller:"DropdownMenuSub"});return d.jsx(boe,{...o,open:a,onOpenChange:l,children:n})},hae="DropdownMenuSubTrigger",QG=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(kG,{...i,...r,ref:e})});QG.displayName=hae;var pae="DropdownMenuSubContent",JG=w.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Sl(n);return d.jsx(RG,{...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)"}})});JG.displayName=pae;var mae=BG,gae=GG,xae=VG,vae=$G,yae=qG,bae=XG,_ae=YG,wae=KG,Sae=ZG,Mae=fae,Tae=QG,Cae=JG,Eae="Label",eV=w.forwardRef((t,e)=>d.jsx(mr.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())}}));eV.displayName=Eae;var Aae=eV;function kk(t,[e,n]){return Math.min(n,Math.max(e,t))}var UT="Popover",[tV]=Gc(UT,[O0]),LS=O0(),[Nae,j0]=tV(UT),nV=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=t,a=LS(e),l=w.useRef(null),[c,f]=w.useState(!1),[h,m]=pd({prop:r,defaultProp:i??!1,onChange:s,caller:UT});return d.jsx(kS,{...a,children:d.jsx(Nae,{scope:e,contentId:Bc(),triggerRef:l,open:h,onOpenChange:m,onOpenToggle:w.useCallback(()=>m(x=>!x),[m]),hasCustomAnchor:c,onCustomAnchorAdd:w.useCallback(()=>f(!0),[]),onCustomAnchorRemove:w.useCallback(()=>f(!1),[]),modal:o,children:n})})};nV.displayName=UT;var rV="PopoverAnchor",kae=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=j0(rV,n),s=LS(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return w.useEffect(()=>(o(),()=>a()),[o,a]),d.jsx(RS,{...s,...r,ref:e})});kae.displayName=rV;var iV="PopoverTrigger",sV=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=j0(iV,n),s=LS(n),o=Vr(e,i.triggerRef),a=d.jsx(mr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":uV(i.open),...r,ref:o,onClick:Tn(t.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:d.jsx(RS,{asChild:!0,...s,children:a})});sV.displayName=iV;var e8="PopoverPortal",[Rae,Pae]=tV(e8,{forceMount:void 0}),oV=t=>{const{__scopePopover:e,forceMount:n,children:r,container:i}=t,s=j0(e8,e);return d.jsx(Rae,{scope:e,forceMount:n,children:d.jsx(Ja,{present:n||s.open,children:d.jsx(Xy,{asChild:!0,container:i,children:r})})})};oV.displayName=e8;var fy="PopoverContent",aV=w.forwardRef((t,e)=>{const n=Pae(fy,t.__scopePopover),{forceMount:r=n.forceMount,...i}=t,s=j0(fy,t.__scopePopover);return d.jsx(Ja,{present:r||s.open,children:s.modal?d.jsx(Dae,{...i,ref:e}):d.jsx(Oae,{...i,ref:e})})});aV.displayName=fy;var Iae=g0("PopoverContent.RemoveScroll"),Dae=w.forwardRef((t,e)=>{const n=j0(fy,t.__scopePopover),r=w.useRef(null),i=Vr(e,r),s=w.useRef(!1);return w.useEffect(()=>{const o=r.current;if(o)return AT(o)},[]),d.jsx(AS,{as:Iae,allowPinchZoom:!0,children:d.jsx(lV,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Tn(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Tn(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:Tn(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Oae=w.forwardRef((t,e)=>{const n=j0(fy,t.__scopePopover),r=w.useRef(!1),i=w.useRef(!1);return d.jsx(lV,{...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()}})}),lV=w.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:f,...h}=t,m=j0(fy,n),x=LS(n);return CT(),d.jsx(ES,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:d.jsx(qy,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>m.onOpenChange(!1),children:d.jsx(DT,{"data-state":uV(m.open),role:"dialog",id:m.contentId,...x,...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)"}})})})}),cV="PopoverClose",Lae=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=j0(cV,n);return d.jsx(mr.button,{type:"button",...r,ref:e,onClick:Tn(t.onClick,()=>i.onOpenChange(!1))})});Lae.displayName=cV;var jae="PopoverArrow",zae=w.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,i=LS(n);return d.jsx(OT,{...i,...r,ref:e})});zae.displayName=jae;function uV(t){return t?"open":"closed"}var Fae=nV,Uae=sV,Bae=oV,Hae=aV;function Gae(t,e){return w.useReducer((n,r)=>e[n][r]??n,t)}var t8="ScrollArea",[dV]=Gc(t8),[Vae,yd]=dV(t8),fV=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:s=600,...o}=t,[a,l]=w.useState(null),[c,f]=w.useState(null),[h,m]=w.useState(null),[x,b]=w.useState(null),[_,S]=w.useState(null),[M,T]=w.useState(0),[A,N]=w.useState(0),[D,k]=w.useState(!1),[O,R]=w.useState(!1),L=Vr(e,H=>l(H)),B=CS(i);return d.jsx(Vae,{scope:n,type:r,dir:B,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:f,content:h,onContentChange:m,scrollbarX:x,onScrollbarXChange:b,scrollbarXEnabled:D,onScrollbarXEnabledChange:k,scrollbarY:_,onScrollbarYChange:S,scrollbarYEnabled:O,onScrollbarYEnabledChange:R,onCornerWidthChange:T,onCornerHeightChange:N,children:d.jsx(mr.div,{dir:B,...o,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":M+"px","--radix-scroll-area-corner-height":A+"px",...t.style}})})});fV.displayName=t8;var hV="ScrollAreaViewport",pV=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:i,...s}=t,o=yd(hV,n),a=w.useRef(null),l=Vr(e,a,o.onViewportChange);return d.jsxs(d.Fragment,{children:[d.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}),d.jsx(mr.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:d.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});pV.displayName=hV;var wh="ScrollAreaScrollbar",mV=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=yd(wh,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=t.orientation==="horizontal";return w.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?d.jsx(Wae,{...r,ref:e,forceMount:n}):i.type==="scroll"?d.jsx($ae,{...r,ref:e,forceMount:n}):i.type==="auto"?d.jsx(gV,{...r,ref:e,forceMount:n}):i.type==="always"?d.jsx(n8,{...r,ref:e}):null});mV.displayName=wh;var Wae=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=yd(wh,t.__scopeScrollArea),[s,o]=w.useState(!1);return w.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},f=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",f)}}},[i.scrollArea,i.scrollHideDelay]),d.jsx(Ja,{present:n||s,children:d.jsx(gV,{"data-state":s?"visible":"hidden",...r,ref:e})})}),$ae=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=yd(wh,t.__scopeScrollArea),s=t.orientation==="horizontal",o=HT(()=>l("SCROLL_END"),100),[a,l]=Gae("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 w.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,i.scrollHideDelay,l]),w.useEffect(()=>{const c=i.viewport,f=s?"scrollLeft":"scrollTop";if(c){let h=c[f];const m=()=>{const x=c[f];h!==x&&(l("SCROLL"),o()),h=x};return c.addEventListener("scroll",m),()=>c.removeEventListener("scroll",m)}},[i.viewport,s,l,o]),d.jsx(Ja,{present:n||a!=="hidden",children:d.jsx(n8,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Tn(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Tn(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),gV=w.forwardRef((t,e)=>{const n=yd(wh,t.__scopeScrollArea),{forceMount:r,...i}=t,[s,o]=w.useState(!1),a=t.orientation==="horizontal",l=HT(()=>{if(n.viewport){const c=n.viewport.offsetWidth<n.viewport.scrollWidth,f=n.viewport.offsetHeight<n.viewport.scrollHeight;o(a?c:f)}},10);return hy(n.viewport,l),hy(n.content,l),d.jsx(Ja,{present:r||s,children:d.jsx(n8,{"data-state":s?"visible":"hidden",...i,ref:e})})}),n8=w.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,i=yd(wh,t.__scopeScrollArea),s=w.useRef(null),o=w.useRef(0),[a,l]=w.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=_V(a.viewport,a.content),f={...r,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:m=>s.current=m,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:m=>o.current=m};function h(m,x){return Qae(m,o.current,a,x)}return n==="horizontal"?d.jsx(qae,{...f,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollLeft,x=S9(m,a,i.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollLeft=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollLeft=h(m,i.dir))}}):n==="vertical"?d.jsx(Xae,{...f,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollTop,x=S9(m,a);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollTop=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollTop=h(m))}}):null}),qae=w.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=yd(wh,t.__scopeScrollArea),[o,a]=w.useState(),l=w.useRef(null),c=Vr(e,l,s.onScrollbarXChange);return w.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(vV,{"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":BT(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.x),onDragScroll:f=>t.onDragScroll(f.x),onWheelScroll:(f,h)=>{if(s.viewport){const m=s.viewport.scrollLeft+f.deltaX;t.onWheelScroll(m),SV(m,h)&&f.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:B2(o.paddingLeft),paddingEnd:B2(o.paddingRight)}})}})}),Xae=w.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,s=yd(wh,t.__scopeScrollArea),[o,a]=w.useState(),l=w.useRef(null),c=Vr(e,l,s.onScrollbarYChange);return w.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),d.jsx(vV,{"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":BT(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.y),onDragScroll:f=>t.onDragScroll(f.y),onWheelScroll:(f,h)=>{if(s.viewport){const m=s.viewport.scrollTop+f.deltaY;t.onWheelScroll(m),SV(m,h)&&f.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:B2(o.paddingTop),paddingEnd:B2(o.paddingBottom)}})}})}),[Yae,xV]=dV(wh),vV=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:f,onResize:h,...m}=t,x=yd(wh,n),[b,_]=w.useState(null),S=Vr(e,L=>_(L)),M=w.useRef(null),T=w.useRef(""),A=x.viewport,N=r.content-r.viewport,D=pa(f),k=pa(l),O=HT(h,10);function R(L){if(M.current){const B=L.clientX-M.current.left,H=L.clientY-M.current.top;c({x:B,y:H})}}return w.useEffect(()=>{const L=B=>{const H=B.target;(b==null?void 0:b.contains(H))&&D(B,N)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[A,b,N,D]),w.useEffect(k,[r,k]),hy(b,O),hy(x.content,O),d.jsx(Yae,{scope:n,scrollbar:b,hasThumb:i,onThumbChange:pa(s),onThumbPointerUp:pa(o),onThumbPositionChange:k,onThumbPointerDown:pa(a),children:d.jsx(mr.div,{...m,ref:S,style:{position:"absolute",...m.style},onPointerDown:Tn(t.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),M.current=b.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),R(L))}),onPointerMove:Tn(t.onPointerMove,R),onPointerUp:Tn(t.onPointerUp,L=>{const B=L.target;B.hasPointerCapture(L.pointerId)&&B.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=T.current,x.viewport&&(x.viewport.style.scrollBehavior=""),M.current=null})})})}),U2="ScrollAreaThumb",yV=w.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=xV(U2,t.__scopeScrollArea);return d.jsx(Ja,{present:n||i.hasThumb,children:d.jsx(Kae,{ref:e,...r})})}),Kae=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,s=yd(U2,n),o=xV(U2,n),{onThumbPositionChange:a}=o,l=Vr(e,h=>o.onThumbChange(h)),c=w.useRef(void 0),f=HT(()=>{c.current&&(c.current(),c.current=void 0)},100);return w.useEffect(()=>{const h=s.viewport;if(h){const m=()=>{if(f(),!c.current){const x=Jae(h,a);c.current=x,a()}};return a(),h.addEventListener("scroll",m),()=>h.removeEventListener("scroll",m)}},[s.viewport,f,a]),d.jsx(mr.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:Tn(t.onPointerDownCapture,h=>{const x=h.target.getBoundingClientRect(),b=h.clientX-x.left,_=h.clientY-x.top;o.onThumbPointerDown({x:b,y:_})}),onPointerUp:Tn(t.onPointerUp,o.onThumbPointerUp)})});yV.displayName=U2;var r8="ScrollAreaCorner",bV=w.forwardRef((t,e)=>{const n=yd(r8,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.jsx(Zae,{...t,ref:e}):null});bV.displayName=r8;var Zae=w.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=yd(r8,n),[s,o]=w.useState(0),[a,l]=w.useState(0),c=!!(s&&a);return hy(i.scrollbarX,()=>{var h;const f=((h=i.scrollbarX)==null?void 0:h.offsetHeight)||0;i.onCornerHeightChange(f),l(f)}),hy(i.scrollbarY,()=>{var h;const f=((h=i.scrollbarY)==null?void 0:h.offsetWidth)||0;i.onCornerWidthChange(f),o(f)}),c?d.jsx(mr.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 B2(t){return t?parseInt(t,10):0}function _V(t,e){const n=t/e;return isNaN(n)?0:n}function BT(t){const e=_V(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Qae(t,e,n,r="ltr"){const i=BT(n),s=i/2,o=e||s,a=i-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,f=n.content-n.viewport,h=r==="ltr"?[0,f]:[f*-1,0];return wV([l,c],h)(t)}function S9(t,e,n="ltr"){const r=BT(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=kk(t,l);return wV([0,o],[0,a])(c)}function wV(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 SV(t,e){return t>0&&t<e}var Jae=(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 HT(t,e){const n=pa(t),r=w.useRef(0);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),w.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function hy(t,e){const n=pa(e);Ra(()=>{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 ele=fV,tle=pV,nle=bV,rle=[" ","Enter","ArrowUp","ArrowDown"],ile=[" ","Enter"],Ix="Select",[GT,VT,sle]=N7(Ix),[Zy]=Gc(Ix,[sle,O0]),WT=O0(),[ole,z0]=Zy(Ix),[ale,lle]=Zy(Ix),MV=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:f,autoComplete:h,disabled:m,required:x,form:b}=t,_=WT(e),[S,M]=w.useState(null),[T,A]=w.useState(null),[N,D]=w.useState(!1),k=CS(c),[O,R]=pd({prop:r,defaultProp:i??!1,onChange:s,caller:Ix}),[L,B]=pd({prop:o,defaultProp:a,onChange:l,caller:Ix}),H=w.useRef(null),$=S?b||!!S.closest("form"):!0,[G,Z]=w.useState(new Set),V=Array.from(G).map(W=>W.props.value).join(";");return d.jsx(kS,{..._,children:d.jsxs(ole,{required:x,scope:e,trigger:S,onTriggerChange:M,valueNode:T,onValueNodeChange:A,valueNodeHasChildren:N,onValueNodeHasChildrenChange:D,contentId:Bc(),value:L,onValueChange:B,open:O,onOpenChange:R,dir:k,triggerPointerDownPosRef:H,disabled:m,children:[d.jsx(GT.Provider,{scope:e,children:d.jsx(ale,{scope:t.__scopeSelect,onNativeOptionAdd:w.useCallback(W=>{Z(J=>new Set(J).add(W))},[]),onNativeOptionRemove:w.useCallback(W=>{Z(J=>{const ne=new Set(J);return ne.delete(W),ne})},[]),children:n})}),$?d.jsxs($V,{"aria-hidden":!0,required:x,tabIndex:-1,name:f,autoComplete:h,value:L,onChange:W=>B(W.target.value),disabled:m,form:b,children:[L===void 0?d.jsx("option",{value:""}):null,Array.from(G)]},V):null]})})};MV.displayName=Ix;var TV="SelectTrigger",CV=w.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,s=WT(n),o=z0(TV,n),a=o.disabled||r,l=Vr(e,o.onTriggerChange),c=VT(n),f=w.useRef("touch"),[h,m,x]=XV(_=>{const S=c().filter(A=>!A.disabled),M=S.find(A=>A.value===o.value),T=YV(S,_,M);T!==void 0&&o.onValueChange(T.value)}),b=_=>{a||(o.onOpenChange(!0),x()),_&&(o.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return d.jsx(RS,{asChild:!0,...s,children:d.jsx(mr.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":qV(o.value)?"":void 0,...i,ref:l,onClick:Tn(i.onClick,_=>{_.currentTarget.focus(),f.current!=="mouse"&&b(_)}),onPointerDown:Tn(i.onPointerDown,_=>{f.current=_.pointerType;const S=_.target;S.hasPointerCapture(_.pointerId)&&S.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(b(_),_.preventDefault())}),onKeyDown:Tn(i.onKeyDown,_=>{const S=h.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&m(_.key),!(S&&_.key===" ")&&rle.includes(_.key)&&(b(),_.preventDefault())})})})});CV.displayName=TV;var EV="SelectValue",AV=w.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...a}=t,l=z0(EV,n),{onValueNodeHasChildrenChange:c}=l,f=s!==void 0,h=Vr(e,l.onValueNodeChange);return Ra(()=>{c(f)},[c,f]),d.jsx(mr.span,{...a,ref:h,style:{pointerEvents:"none"},children:qV(l.value)?d.jsx(d.Fragment,{children:o}):s})});AV.displayName=EV;var cle="SelectIcon",NV=w.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return d.jsx(mr.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});NV.displayName=cle;var ule="SelectPortal",kV=t=>d.jsx(Xy,{asChild:!0,...t});kV.displayName=ule;var Dx="SelectContent",RV=w.forwardRef((t,e)=>{const n=z0(Dx,t.__scopeSelect),[r,i]=w.useState();if(Ra(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?Yl.createPortal(d.jsx(PV,{scope:t.__scopeSelect,children:d.jsx(GT.Slot,{scope:t.__scopeSelect,children:d.jsx("div",{children:t.children})})}),s):null}return d.jsx(IV,{...t,ref:e})});RV.displayName=Dx;var Yd=10,[PV,F0]=Zy(Dx),dle="SelectContentImpl",fle=g0("SelectContent.RemoveScroll"),IV=w.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:_,avoidCollisions:S,...M}=t,T=z0(Dx,n),[A,N]=w.useState(null),[D,k]=w.useState(null),O=Vr(e,se=>N(se)),[R,L]=w.useState(null),[B,H]=w.useState(null),$=VT(n),[G,Z]=w.useState(!1),V=w.useRef(!1);w.useEffect(()=>{if(A)return AT(A)},[A]),CT();const W=w.useCallback(se=>{const[re,...K]=$().map(ae=>ae.ref.current),[fe]=K.slice(-1),he=document.activeElement;for(const ae of se)if(ae===he||(ae==null||ae.scrollIntoView({block:"nearest"}),ae===re&&D&&(D.scrollTop=0),ae===fe&&D&&(D.scrollTop=D.scrollHeight),ae==null||ae.focus(),document.activeElement!==he))return},[$,D]),J=w.useCallback(()=>W([R,A]),[W,R,A]);w.useEffect(()=>{G&&J()},[G,J]);const{onOpenChange:ne,triggerPointerDownPosRef:ie}=T;w.useEffect(()=>{if(A){let se={x:0,y:0};const re=fe=>{var he,ae;se={x:Math.abs(Math.round(fe.pageX)-(((he=ie.current)==null?void 0:he.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((ae=ie.current)==null?void 0:ae.y)??0))}},K=fe=>{se.x<=10&&se.y<=10?fe.preventDefault():A.contains(fe.target)||ne(!1),document.removeEventListener("pointermove",re),ie.current=null};return ie.current!==null&&(document.addEventListener("pointermove",re),document.addEventListener("pointerup",K,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",re),document.removeEventListener("pointerup",K,{capture:!0})}}},[A,ne,ie]),w.useEffect(()=>{const se=()=>ne(!1);return window.addEventListener("blur",se),window.addEventListener("resize",se),()=>{window.removeEventListener("blur",se),window.removeEventListener("resize",se)}},[ne]);const[z,j]=XV(se=>{const re=$().filter(he=>!he.disabled),K=re.find(he=>he.ref.current===document.activeElement),fe=YV(re,se,K);fe&&setTimeout(()=>fe.ref.current.focus())}),X=w.useCallback((se,re,K)=>{const fe=!V.current&&!K;(T.value!==void 0&&T.value===re||fe)&&(L(se),fe&&(V.current=!0))},[T.value]),F=w.useCallback(()=>A==null?void 0:A.focus(),[A]),ce=w.useCallback((se,re,K)=>{const fe=!V.current&&!K;(T.value!==void 0&&T.value===re||fe)&&H(se)},[T.value]),oe=r==="popper"?Rk:DV,Q=oe===Rk?{side:a,sideOffset:l,align:c,alignOffset:f,arrowPadding:h,collisionBoundary:m,collisionPadding:x,sticky:b,hideWhenDetached:_,avoidCollisions:S}:{};return d.jsx(PV,{scope:n,content:A,viewport:D,onViewportChange:k,itemRefCallback:X,selectedItem:R,onItemLeave:F,itemTextRefCallback:ce,focusSelectedItem:J,selectedItemText:B,position:r,isPositioned:G,searchRef:z,children:d.jsx(AS,{as:fle,allowPinchZoom:!0,children:d.jsx(ES,{asChild:!0,trapped:T.open,onMountAutoFocus:se=>{se.preventDefault()},onUnmountAutoFocus:Tn(i,se=>{var re;(re=T.trigger)==null||re.focus({preventScroll:!0}),se.preventDefault()}),children:d.jsx(qy,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:se=>se.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:d.jsx(oe,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:se=>se.preventDefault(),...M,...Q,onPlaced:()=>Z(!0),ref:O,style:{display:"flex",flexDirection:"column",outline:"none",...M.style},onKeyDown:Tn(M.onKeyDown,se=>{const re=se.ctrlKey||se.altKey||se.metaKey;if(se.key==="Tab"&&se.preventDefault(),!re&&se.key.length===1&&j(se.key),["ArrowUp","ArrowDown","Home","End"].includes(se.key)){let fe=$().filter(he=>!he.disabled).map(he=>he.ref.current);if(["ArrowUp","End"].includes(se.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(se.key)){const he=se.target,ae=fe.indexOf(he);fe=fe.slice(ae+1)}setTimeout(()=>W(fe)),se.preventDefault()}})})})})})})});IV.displayName=dle;var hle="SelectItemAlignedPosition",DV=w.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,s=z0(Dx,n),o=F0(Dx,n),[a,l]=w.useState(null),[c,f]=w.useState(null),h=Vr(e,O=>f(O)),m=VT(n),x=w.useRef(!1),b=w.useRef(!0),{viewport:_,selectedItem:S,selectedItemText:M,focusSelectedItem:T}=o,A=w.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&_&&S&&M){const O=s.trigger.getBoundingClientRect(),R=c.getBoundingClientRect(),L=s.valueNode.getBoundingClientRect(),B=M.getBoundingClientRect();if(s.dir!=="rtl"){const he=B.left-R.left,ae=L.left-he,Se=O.left-ae,de=O.width+Se,Me=Math.max(de,R.width),Ce=window.innerWidth-Yd,Re=kk(ae,[Yd,Math.max(Yd,Ce-Me)]);a.style.minWidth=de+"px",a.style.left=Re+"px"}else{const he=R.right-B.right,ae=window.innerWidth-L.right-he,Se=window.innerWidth-O.right-ae,de=O.width+Se,Me=Math.max(de,R.width),Ce=window.innerWidth-Yd,Re=kk(ae,[Yd,Math.max(Yd,Ce-Me)]);a.style.minWidth=de+"px",a.style.right=Re+"px"}const H=m(),$=window.innerHeight-Yd*2,G=_.scrollHeight,Z=window.getComputedStyle(c),V=parseInt(Z.borderTopWidth,10),W=parseInt(Z.paddingTop,10),J=parseInt(Z.borderBottomWidth,10),ne=parseInt(Z.paddingBottom,10),ie=V+W+G+ne+J,z=Math.min(S.offsetHeight*5,ie),j=window.getComputedStyle(_),X=parseInt(j.paddingTop,10),F=parseInt(j.paddingBottom,10),ce=O.top+O.height/2-Yd,oe=$-ce,Q=S.offsetHeight/2,se=S.offsetTop+Q,re=V+W+se,K=ie-re;if(re<=ce){const he=H.length>0&&S===H[H.length-1].ref.current;a.style.bottom="0px";const ae=c.clientHeight-_.offsetTop-_.offsetHeight,Se=Math.max(oe,Q+(he?F:0)+ae+J),de=re+Se;a.style.height=de+"px"}else{const he=H.length>0&&S===H[0].ref.current;a.style.top="0px";const Se=Math.max(ce,V+_.offsetTop+(he?X:0)+Q)+K;a.style.height=Se+"px",_.scrollTop=re-ce+_.offsetTop}a.style.margin=`${Yd}px 0`,a.style.minHeight=z+"px",a.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>x.current=!0)}},[m,s.trigger,s.valueNode,a,c,_,S,M,s.dir,r]);Ra(()=>A(),[A]);const[N,D]=w.useState();Ra(()=>{c&&D(window.getComputedStyle(c).zIndex)},[c]);const k=w.useCallback(O=>{O&&b.current===!0&&(A(),T==null||T(),b.current=!1)},[A,T]);return d.jsx(mle,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:x,onScrollButtonChange:k,children:d.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:d.jsx(mr.div,{...i,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});DV.displayName=hle;var ple="SelectPopperPosition",Rk=w.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Yd,...s}=t,o=WT(n);return d.jsx(DT,{...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)"}})});Rk.displayName=ple;var[mle,i8]=Zy(Dx,{}),Pk="SelectViewport",OV=w.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,s=F0(Pk,n),o=i8(Pk,n),a=Vr(e,s.onViewportChange),l=w.useRef(0);return d.jsxs(d.Fragment,{children:[d.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}),d.jsx(GT.Slot,{scope:n,children:d.jsx(mr.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Tn(i.onScroll,c=>{const f=c.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const x=Math.abs(l.current-f.scrollTop);if(x>0){const b=window.innerHeight-Yd*2,_=parseFloat(h.style.minHeight),S=parseFloat(h.style.height),M=Math.max(_,S);if(M<b){const T=M+x,A=Math.min(b,T),N=T-A;h.style.height=A+"px",h.style.bottom==="0px"&&(f.scrollTop=N>0?N:0,h.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});OV.displayName=Pk;var LV="SelectGroup",[gle,xle]=Zy(LV),vle=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Bc();return d.jsx(gle,{scope:n,id:i,children:d.jsx(mr.div,{role:"group","aria-labelledby":i,...r,ref:e})})});vle.displayName=LV;var jV="SelectLabel",yle=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=xle(jV,n);return d.jsx(mr.div,{id:i.id,...r,ref:e})});yle.displayName=jV;var H2="SelectItem",[ble,zV]=Zy(H2),FV=w.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=t,a=z0(H2,n),l=F0(H2,n),c=a.value===r,[f,h]=w.useState(s??""),[m,x]=w.useState(!1),b=Vr(e,T=>{var A;return(A=l.itemRefCallback)==null?void 0:A.call(l,T,r,i)}),_=Bc(),S=w.useRef("touch"),M=()=>{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 d.jsx(ble,{scope:n,value:r,disabled:i,textId:_,isSelected:c,onItemTextChange:w.useCallback(T=>{h(A=>A||((T==null?void 0:T.textContent)??"").trim())},[]),children:d.jsx(GT.ItemSlot,{scope:n,value:r,disabled:i,textValue:f,children:d.jsx(mr.div,{role:"option","aria-labelledby":_,"data-highlighted":m?"":void 0,"aria-selected":c&&m,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:b,onFocus:Tn(o.onFocus,()=>x(!0)),onBlur:Tn(o.onBlur,()=>x(!1)),onClick:Tn(o.onClick,()=>{S.current!=="mouse"&&M()}),onPointerUp:Tn(o.onPointerUp,()=>{S.current==="mouse"&&M()}),onPointerDown:Tn(o.onPointerDown,T=>{S.current=T.pointerType}),onPointerMove:Tn(o.onPointerMove,T=>{var A;S.current=T.pointerType,i?(A=l.onItemLeave)==null||A.call(l):S.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Tn(o.onPointerLeave,T=>{var A;T.currentTarget===document.activeElement&&((A=l.onItemLeave)==null||A.call(l))}),onKeyDown:Tn(o.onKeyDown,T=>{var N;((N=l.searchRef)==null?void 0:N.current)!==""&&T.key===" "||(ile.includes(T.key)&&M(),T.key===" "&&T.preventDefault())})})})})});FV.displayName=H2;var W_="SelectItemText",UV=w.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...s}=t,o=z0(W_,n),a=F0(W_,n),l=zV(W_,n),c=lle(W_,n),[f,h]=w.useState(null),m=Vr(e,M=>h(M),l.onItemTextChange,M=>{var T;return(T=a.itemTextRefCallback)==null?void 0:T.call(a,M,l.value,l.disabled)}),x=f==null?void 0:f.textContent,b=w.useMemo(()=>d.jsx("option",{value:l.value,disabled:l.disabled,children:x},l.value),[l.disabled,l.value,x]),{onNativeOptionAdd:_,onNativeOptionRemove:S}=c;return Ra(()=>(_(b),()=>S(b)),[_,S,b]),d.jsxs(d.Fragment,{children:[d.jsx(mr.span,{id:l.textId,...s,ref:m}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Yl.createPortal(s.children,o.valueNode):null]})});UV.displayName=W_;var BV="SelectItemIndicator",HV=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return zV(BV,n).isSelected?d.jsx(mr.span,{"aria-hidden":!0,...r,ref:e}):null});HV.displayName=BV;var Ik="SelectScrollUpButton",GV=w.forwardRef((t,e)=>{const n=F0(Ik,t.__scopeSelect),r=i8(Ik,t.__scopeSelect),[i,s]=w.useState(!1),o=Vr(e,r.onScrollButtonChange);return Ra(()=>{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?d.jsx(WV,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});GV.displayName=Ik;var Dk="SelectScrollDownButton",VV=w.forwardRef((t,e)=>{const n=F0(Dk,t.__scopeSelect),r=i8(Dk,t.__scopeSelect),[i,s]=w.useState(!1),o=Vr(e,r.onScrollButtonChange);return Ra(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<c;s(f)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?d.jsx(WV,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});VV.displayName=Dk;var WV=w.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,s=F0("SelectScrollButton",n),o=w.useRef(null),a=VT(n),l=w.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return w.useEffect(()=>()=>l(),[l]),Ra(()=>{var f;const c=a().find(h=>h.ref.current===document.activeElement);(f=c==null?void 0:c.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),d.jsx(mr.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Tn(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Tn(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Tn(i.onPointerLeave,()=>{l()})})}),_le="SelectSeparator",wle=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return d.jsx(mr.div,{"aria-hidden":!0,...r,ref:e})});wle.displayName=_le;var Ok="SelectArrow",Sle=w.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=WT(n),s=z0(Ok,n),o=F0(Ok,n);return s.open&&o.position==="popper"?d.jsx(OT,{...i,...r,ref:e}):null});Sle.displayName=Ok;var Mle="SelectBubbleInput",$V=w.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const i=w.useRef(null),s=Vr(r,i),o=gie(e);return w.useEffect(()=>{const a=i.current;if(!a)return;const l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==e&&f){const h=new Event("change",{bubbles:!0});f.call(a,e),a.dispatchEvent(h)}},[o,e]),d.jsx(mr.select,{...n,style:{...bB,...n.style},ref:s,defaultValue:e})});$V.displayName=Mle;function qV(t){return t===""||t===void 0}function XV(t){const e=pa(t),n=w.useRef(""),r=w.useRef(0),i=w.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=w.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return w.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function YV(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=Tle(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 Tle(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Cle=MV,Ele=CV,Ale=AV,Nle=NV,kle=kV,Rle=RV,Ple=OV,Ile=FV,Dle=UV,Ole=HV,Lle=GV,jle=VV,KV="Toggle",s8=w.forwardRef((t,e)=>{const{pressed:n,defaultPressed:r,onPressedChange:i,...s}=t,[o,a]=pd({prop:n,onChange:i,defaultProp:r??!1,caller:KV});return d.jsx(mr.button,{type:"button","aria-pressed":o,"data-state":o?"on":"off","data-disabled":t.disabled?"":void 0,...s,ref:e,onClick:Tn(t.onClick,()=>{t.disabled||a(!o)})})});s8.displayName=KV;var zle=s8,U0="ToggleGroup",[ZV]=Gc(U0,[LT]),QV=LT(),o8=ri.forwardRef((t,e)=>{const{type:n,...r}=t;if(n==="single"){const i=r;return d.jsx(Fle,{...i,ref:e})}if(n==="multiple"){const i=r;return d.jsx(Ule,{...i,ref:e})}throw new Error(`Missing prop \`type\` expected on \`${U0}\``)});o8.displayName=U0;var[JV,eW]=ZV(U0),Fle=ri.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o,a]=pd({prop:n,defaultProp:r??"",onChange:i,caller:U0});return d.jsx(JV,{scope:t.__scopeToggleGroup,type:"single",value:ri.useMemo(()=>o?[o]:[],[o]),onItemActivate:a,onItemDeactivate:ri.useCallback(()=>a(""),[a]),children:d.jsx(tW,{...s,ref:e})})}),Ule=ri.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=t,[o,a]=pd({prop:n,defaultProp:r??[],onChange:i,caller:U0}),l=ri.useCallback(f=>a((h=[])=>[...h,f]),[a]),c=ri.useCallback(f=>a((h=[])=>h.filter(m=>m!==f)),[a]);return d.jsx(JV,{scope:t.__scopeToggleGroup,type:"multiple",value:o,onItemActivate:l,onItemDeactivate:c,children:d.jsx(tW,{...s,ref:e})})});o8.displayName=U0;var[Ble,Hle]=ZV(U0),tW=ri.forwardRef((t,e)=>{const{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:s,dir:o,loop:a=!0,...l}=t,c=QV(n),f=CS(o),h={role:"group",dir:f,...l};return d.jsx(Ble,{scope:n,rovingFocus:i,disabled:r,children:i?d.jsx(WH,{asChild:!0,...c,orientation:s,dir:f,loop:a,children:d.jsx(mr.div,{...h,ref:e})}):d.jsx(mr.div,{...h,ref:e})})}),G2="ToggleGroupItem",nW=ri.forwardRef((t,e)=>{const n=eW(G2,t.__scopeToggleGroup),r=Hle(G2,t.__scopeToggleGroup),i=QV(t.__scopeToggleGroup),s=n.value.includes(t.value),o=r.disabled||t.disabled,a={...t,pressed:s,disabled:o},l=ri.useRef(null);return r.rovingFocus?d.jsx($H,{asChild:!0,...i,focusable:!o,active:s,ref:l,children:d.jsx(M9,{...a,ref:e})}):d.jsx(M9,{...a,ref:e})});nW.displayName=G2;var M9=ri.forwardRef((t,e)=>{const{__scopeToggleGroup:n,value:r,...i}=t,s=eW(G2,n),o={role:"radio","aria-checked":t.pressed,"aria-pressed":void 0},a=s.type==="single"?o:void 0;return d.jsx(s8,{...a,...i,ref:e,onPressedChange:l=>{l?s.onItemActivate(r):s.onItemDeactivate(r)}})}),Gle=o8,Vle=nW,[$T]=Gc("Tooltip",[O0]),qT=O0(),rW="TooltipProvider",Wle=700,Lk="tooltip.open",[$le,a8]=$T(rW),iW=t=>{const{__scopeTooltip:e,delayDuration:n=Wle,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=t,o=w.useRef(!0),a=w.useRef(!1),l=w.useRef(0);return w.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),d.jsx($le,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:w.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:w.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:w.useCallback(c=>{a.current=c},[]),disableHoverableContent:i,children:s})};iW.displayName=rW;var Ow="Tooltip",[qle,jS]=$T(Ow),sW=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:i,onOpenChange:s,disableHoverableContent:o,delayDuration:a}=t,l=a8(Ow,t.__scopeTooltip),c=qT(e),[f,h]=w.useState(null),m=Bc(),x=w.useRef(0),b=o??l.disableHoverableContent,_=a??l.delayDuration,S=w.useRef(!1),[M,T]=pd({prop:r,defaultProp:i??!1,onChange:O=>{O?(l.onOpen(),document.dispatchEvent(new CustomEvent(Lk))):l.onClose(),s==null||s(O)},caller:Ow}),A=w.useMemo(()=>M?S.current?"delayed-open":"instant-open":"closed",[M]),N=w.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,T(!0)},[T]),D=w.useCallback(()=>{window.clearTimeout(x.current),x.current=0,T(!1)},[T]),k=w.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,T(!0),x.current=0},_)},[_,T]);return w.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),d.jsx(kS,{...c,children:d.jsx(qle,{scope:e,contentId:m,open:M,stateAttribute:A,trigger:f,onTriggerChange:h,onTriggerEnter:w.useCallback(()=>{l.isOpenDelayedRef.current?k():N()},[l.isOpenDelayedRef,k,N]),onTriggerLeave:w.useCallback(()=>{b?D():(window.clearTimeout(x.current),x.current=0)},[D,b]),onOpen:N,onClose:D,disableHoverableContent:b,children:n})})};sW.displayName=Ow;var jk="TooltipTrigger",oW=w.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=jS(jk,n),s=a8(jk,n),o=qT(n),a=w.useRef(null),l=Vr(e,a,i.onTriggerChange),c=w.useRef(!1),f=w.useRef(!1),h=w.useCallback(()=>c.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),d.jsx(RS,{asChild:!0,...o,children:d.jsx(mr.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Tn(t.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),f.current=!0)}),onPointerLeave:Tn(t.onPointerLeave,()=>{i.onTriggerLeave(),f.current=!1}),onPointerDown:Tn(t.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Tn(t.onFocus,()=>{c.current||i.onOpen()}),onBlur:Tn(t.onBlur,i.onClose),onClick:Tn(t.onClick,i.onClose)})})});oW.displayName=jk;var l8="TooltipPortal",[Xle,Yle]=$T(l8,{forceMount:void 0}),aW=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:i}=t,s=jS(l8,e);return d.jsx(Xle,{scope:e,forceMount:n,children:d.jsx(Ja,{present:n||s.open,children:d.jsx(Xy,{asChild:!0,container:i,children:r})})})};aW.displayName=l8;var py="TooltipContent",lW=w.forwardRef((t,e)=>{const n=Yle(py,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=t,o=jS(py,t.__scopeTooltip);return d.jsx(Ja,{present:r||o.open,children:o.disableHoverableContent?d.jsx(cW,{side:i,...s,ref:e}):d.jsx(Kle,{side:i,...s,ref:e})})}),Kle=w.forwardRef((t,e)=>{const n=jS(py,t.__scopeTooltip),r=a8(py,t.__scopeTooltip),i=w.useRef(null),s=Vr(e,i),[o,a]=w.useState(null),{trigger:l,onClose:c}=n,f=i.current,{onPointerInTransitChange:h}=r,m=w.useCallback(()=>{a(null),h(!1)},[h]),x=w.useCallback((b,_)=>{const S=b.currentTarget,M={x:b.clientX,y:b.clientY},T=tce(M,S.getBoundingClientRect()),A=nce(M,T),N=rce(_.getBoundingClientRect()),D=sce([...A,...N]);a(D),h(!0)},[h]);return w.useEffect(()=>()=>m(),[m]),w.useEffect(()=>{if(l&&f){const b=S=>x(S,f),_=S=>x(S,l);return l.addEventListener("pointerleave",b),f.addEventListener("pointerleave",_),()=>{l.removeEventListener("pointerleave",b),f.removeEventListener("pointerleave",_)}}},[l,f,x,m]),w.useEffect(()=>{if(o){const b=_=>{const S=_.target,M={x:_.clientX,y:_.clientY},T=(l==null?void 0:l.contains(S))||(f==null?void 0:f.contains(S)),A=!ice(M,o);T?m():A&&(m(),c())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[l,f,o,c,m]),d.jsx(cW,{...t,ref:s})}),[Zle,Qle]=$T(Ow,{isInside:!1}),Jle=vB("TooltipContent"),cW=w.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...a}=t,l=jS(py,n),c=qT(n),{onClose:f}=l;return w.useEffect(()=>(document.addEventListener(Lk,f),()=>document.removeEventListener(Lk,f)),[f]),w.useEffect(()=>{if(l.trigger){const h=m=>{const x=m.target;x!=null&&x.contains(l.trigger)&&f()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[l.trigger,f]),d.jsx(qy,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:f,children:d.jsxs(DT,{"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:[d.jsx(Jle,{children:r}),d.jsx(Zle,{scope:n,isInside:!0,children:d.jsx(_ne,{id:l.contentId,role:"tooltip",children:i||r})})]})})});lW.displayName=py;var uW="TooltipArrow",ece=w.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=qT(n);return Qle(uW,n).isInside?null:d.jsx(OT,{...i,...r,ref:e})});ece.displayName=uW;function tce(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 nce(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 rce(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 ice(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,f=a.y,h=l.x,m=l.y;f>r!=m>r&&n<(h-c)*(r-f)/(m-f)+c&&(i=!i)}return i}function sce(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),oce(e)}function oce(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 ace=iW,lce=sW,cce=oW,uce=aW,dce=lW;function dW(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=dW(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function fW(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=dW(t))&&(r&&(r+=" "),r+=e);return r}const fce=(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},hce=(t,e)=>({classGroupId:t,validator:e}),hW=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),V2="-",T9=[],pce="arbitrary..",mce=t=>{const e=xce(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return gce(o);const a=o.split(V2),l=a[0]===""&&a.length>1?1:0;return pW(a,l,e)},getConflictingClassGroupIds:(o,a)=>{if(a){const l=r[o],c=n[o];return l?c?fce(c,l):l:c||T9}return n[o]||T9}}},pW=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],s=n.nextPart.get(i);if(s){const c=pW(t,e+1,s);if(c)return c}const o=n.validators;if(o===null)return;const a=e===0?t.join(V2):t.slice(e).join(V2),l=o.length;for(let c=0;c<l;c++){const f=o[c];if(f.validator(a))return f.classGroupId}},gce=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?pce+r:void 0})(),xce=t=>{const{theme:e,classGroups:n}=t;return vce(n,e)},vce=(t,e)=>{const n=hW();for(const r in t){const i=t[r];c8(i,n,r,e)}return n},c8=(t,e,n,r)=>{const i=t.length;for(let s=0;s<i;s++){const o=t[s];yce(o,e,n,r)}},yce=(t,e,n,r)=>{if(typeof t=="string"){bce(t,e,n);return}if(typeof t=="function"){_ce(t,e,n,r);return}wce(t,e,n,r)},bce=(t,e,n)=>{const r=t===""?e:mW(e,t);r.classGroupId=n},_ce=(t,e,n,r)=>{if(Sce(t)){c8(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(hce(n,t))},wce=(t,e,n,r)=>{const i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,l]=i[o];c8(l,mW(e,a),n,r)}},mW=(t,e)=>{let n=t;const r=e.split(V2),i=r.length;for(let s=0;s<i;s++){const o=r[s];let a=n.nextPart.get(o);a||(a=hW(),n.nextPart.set(o,a)),n=a}return n},Sce=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Mce=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)}}},zk="!",C9=":",Tce=[],E9=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),Cce=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const s=[];let o=0,a=0,l=0,c;const f=i.length;for(let _=0;_<f;_++){const S=i[_];if(o===0&&a===0){if(S===C9){s.push(i.slice(l,_)),l=_+1;continue}if(S==="/"){c=_;continue}}S==="["?o++:S==="]"?o--:S==="("?a++:S===")"&&a--}const h=s.length===0?i:i.slice(l);let m=h,x=!1;h.endsWith(zk)?(m=h.slice(0,-1),x=!0):h.startsWith(zk)&&(m=h.slice(1),x=!0);const b=c&&c>l?c-l:void 0;return E9(s,x,m,b)};if(e){const i=e+C9,s=r;r=o=>o.startsWith(i)?s(o.slice(i.length)):E9(Tce,!1,o,void 0,!0)}if(n){const i=r;r=s=>n({className:s,parseClassName:i})}return r},Ece=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}},Ace=t=>({cache:Mce(t.cacheSize),parseClassName:Cce(t),sortModifiers:Ece(t),...mce(t)}),Nce=/\s+/,kce=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:s}=e,o=[],a=t.trim().split(Nce);let l="";for(let c=a.length-1;c>=0;c-=1){const f=a[c],{isExternal:h,modifiers:m,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:_}=n(f);if(h){l=f+(l.length>0?" "+l:l);continue}let S=!!_,M=r(S?b.substring(0,_):b);if(!M){if(!S){l=f+(l.length>0?" "+l:l);continue}if(M=r(b),!M){l=f+(l.length>0?" "+l:l);continue}S=!1}const T=m.length===0?"":m.length===1?m[0]:s(m).join(":"),A=x?T+zk:T,N=A+M;if(o.indexOf(N)>-1)continue;o.push(N);const D=i(M,S);for(let k=0;k<D.length;++k){const O=D[k];o.push(A+O)}l=f+(l.length>0?" "+l:l)}return l},Rce=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=gW(n))&&(i&&(i+=" "),i+=r);return i},gW=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=gW(t[r]))&&(n&&(n+=" "),n+=e);return n},Pce=(t,...e)=>{let n,r,i,s;const o=l=>{const c=e.reduce((f,h)=>h(f),t());return n=Ace(c),r=n.cache.get,i=n.cache.set,s=a,a(l)},a=l=>{const c=r(l);if(c)return c;const f=kce(l,n);return i(l,f),f};return s=o,(...l)=>s(Rce(...l))},Ice=[],ua=t=>{const e=n=>n[t]||Ice;return e.isThemeGetter=!0,e},xW=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,vW=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Dce=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Oce=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Lce=/\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$/,jce=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zce=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Fce=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rm=t=>Dce.test(t),Yr=t=>!!t&&!Number.isNaN(Number(t)),Pm=t=>!!t&&Number.isInteger(Number(t)),IA=t=>t.endsWith("%")&&Yr(t.slice(0,-1)),ep=t=>Oce.test(t),yW=()=>!0,Uce=t=>Lce.test(t)&&!jce.test(t),u8=()=>!1,Bce=t=>zce.test(t),Hce=t=>Fce.test(t),Gce=t=>!Hn(t)&&!Vn(t),Vce=t=>B0(t,wW,u8),Hn=t=>xW.test(t),Dg=t=>B0(t,SW,Uce),A9=t=>B0(t,Qce,Yr),Wce=t=>B0(t,TW,yW),$ce=t=>B0(t,MW,u8),N9=t=>B0(t,bW,u8),qce=t=>B0(t,_W,Hce),R4=t=>B0(t,CW,Bce),Vn=t=>vW.test(t),b_=t=>Wx(t,SW),Xce=t=>Wx(t,MW),k9=t=>Wx(t,bW),Yce=t=>Wx(t,wW),Kce=t=>Wx(t,_W),P4=t=>Wx(t,CW,!0),Zce=t=>Wx(t,TW,!0),B0=(t,e,n)=>{const r=xW.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Wx=(t,e,n=!1)=>{const r=vW.exec(t);return r?r[1]?e(r[1]):n:!1},bW=t=>t==="position"||t==="percentage",_W=t=>t==="image"||t==="url",wW=t=>t==="length"||t==="size"||t==="bg-size",SW=t=>t==="length",Qce=t=>t==="number",MW=t=>t==="family-name",TW=t=>t==="number"||t==="weight",CW=t=>t==="shadow",Jce=()=>{const t=ua("color"),e=ua("font"),n=ua("text"),r=ua("font-weight"),i=ua("tracking"),s=ua("leading"),o=ua("breakpoint"),a=ua("container"),l=ua("spacing"),c=ua("radius"),f=ua("shadow"),h=ua("inset-shadow"),m=ua("text-shadow"),x=ua("drop-shadow"),b=ua("blur"),_=ua("perspective"),S=ua("aspect"),M=ua("ease"),T=ua("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...N(),Vn,Hn],k=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],R=()=>[Vn,Hn,l],L=()=>[Rm,"full","auto",...R()],B=()=>[Pm,"none","subgrid",Vn,Hn],H=()=>["auto",{span:["full",Pm,Vn,Hn]},Pm,Vn,Hn],$=()=>[Pm,"auto",Vn,Hn],G=()=>["auto","min","max","fr",Vn,Hn],Z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...R()],J=()=>[Rm,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],ne=()=>[Rm,"screen","full","dvw","lvw","svw","min","max","fit",...R()],ie=()=>[Rm,"screen","full","lh","dvh","lvh","svh","min","max","fit",...R()],z=()=>[t,Vn,Hn],j=()=>[...N(),k9,N9,{position:[Vn,Hn]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",Yce,Vce,{size:[Vn,Hn]}],ce=()=>[IA,b_,Dg],oe=()=>["","none","full",c,Vn,Hn],Q=()=>["",Yr,b_,Dg],se=()=>["solid","dashed","dotted","double"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[Yr,IA,k9,N9],fe=()=>["","none",b,Vn,Hn],he=()=>["none",Yr,Vn,Hn],ae=()=>["none",Yr,Vn,Hn],Se=()=>[Yr,Vn,Hn],de=()=>[Rm,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ep],breakpoint:[ep],color:[yW],container:[ep],"drop-shadow":[ep],ease:["in","out","in-out"],font:[Gce],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ep],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ep],shadow:[ep],spacing:["px",Yr],text:[ep],"text-shadow":[ep],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Rm,Hn,Vn,S]}],container:["container"],columns:[{columns:[Yr,Hn,Vn,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:D()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{"inset-s":L(),start:L()}],end:[{"inset-e":L(),end:L()}],"inset-bs":[{"inset-bs":L()}],"inset-be":[{"inset-be":L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Pm,"auto",Vn,Hn]}],basis:[{basis:[Rm,"full","auto",a,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Yr,Rm,"auto","initial","none",Hn]}],grow:[{grow:["",Yr,Vn,Hn]}],shrink:[{shrink:["",Yr,Vn,Hn]}],order:[{order:[Pm,"first","last","none",Vn,Hn]}],"grid-cols":[{"grid-cols":B()}],"col-start-end":[{col:H()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":B()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...Z(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...Z()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":Z()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],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:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mbs:[{mbs:W()}],mbe:[{mbe:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:J()}],"inline-size":[{inline:["auto",...ne()]}],"min-inline-size":[{"min-inline":["auto",...ne()]}],"max-inline-size":[{"max-inline":["none",...ne()]}],"block-size":[{block:["auto",...ie()]}],"min-block-size":[{"min-block":["auto",...ie()]}],"max-block-size":[{"max-block":["none",...ie()]}],w:[{w:[a,"screen",...J()]}],"min-w":[{"min-w":[a,"screen","none",...J()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[o]},...J()]}],h:[{h:["screen","lh",...J()]}],"min-h":[{"min-h":["screen","lh","none",...J()]}],"max-h":[{"max-h":["screen","lh",...J()]}],"font-size":[{text:["base",n,b_,Dg]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,Zce,Wce]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",IA,Hn]}],"font-family":[{font:[Xce,$ce,e]}],"font-features":[{"font-features":[Hn]}],"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,Vn,Hn]}],"line-clamp":[{"line-clamp":[Yr,"none",Vn,A9]}],leading:[{leading:[s,...R()]}],"list-image":[{"list-image":["none",Vn,Hn]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Vn,Hn]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:[Yr,"from-font","auto",Vn,Dg]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[Yr,"auto",Vn,Hn]}],"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",Vn,Hn]}],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",Vn,Hn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:j()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Pm,Vn,Hn],radial:["",Vn,Hn],conic:[Pm,Vn,Hn]},Kce,qce]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:ce()}],"gradient-via-pos":[{via:ce()}],"gradient-to-pos":[{to:ce()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:Q()}],"border-w-x":[{"border-x":Q()}],"border-w-y":[{"border-y":Q()}],"border-w-s":[{"border-s":Q()}],"border-w-e":[{"border-e":Q()}],"border-w-bs":[{"border-bs":Q()}],"border-w-be":[{"border-be":Q()}],"border-w-t":[{"border-t":Q()}],"border-w-r":[{"border-r":Q()}],"border-w-b":[{"border-b":Q()}],"border-w-l":[{"border-l":Q()}],"divide-x":[{"divide-x":Q()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":Q()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...se(),"hidden","none"]}],"divide-style":[{divide:[...se(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-bs":[{"border-bs":z()}],"border-color-be":[{"border-be":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Yr,Vn,Hn]}],"outline-w":[{outline:["",Yr,b_,Dg]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",f,P4,R4]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",h,P4,R4]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[Yr,Dg]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":Q()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",m,P4,R4]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[Yr,Vn,Hn]}],"mix-blend":[{"mix-blend":[...re(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":re()}],"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":[Yr]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[Vn,Hn]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"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":[Yr]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:j()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Vn,Hn]}],filter:[{filter:["","none",Vn,Hn]}],blur:[{blur:fe()}],brightness:[{brightness:[Yr,Vn,Hn]}],contrast:[{contrast:[Yr,Vn,Hn]}],"drop-shadow":[{"drop-shadow":["","none",x,P4,R4]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",Yr,Vn,Hn]}],"hue-rotate":[{"hue-rotate":[Yr,Vn,Hn]}],invert:[{invert:["",Yr,Vn,Hn]}],saturate:[{saturate:[Yr,Vn,Hn]}],sepia:[{sepia:["",Yr,Vn,Hn]}],"backdrop-filter":[{"backdrop-filter":["","none",Vn,Hn]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[Yr,Vn,Hn]}],"backdrop-contrast":[{"backdrop-contrast":[Yr,Vn,Hn]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Yr,Vn,Hn]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Yr,Vn,Hn]}],"backdrop-invert":[{"backdrop-invert":["",Yr,Vn,Hn]}],"backdrop-opacity":[{"backdrop-opacity":[Yr,Vn,Hn]}],"backdrop-saturate":[{"backdrop-saturate":[Yr,Vn,Hn]}],"backdrop-sepia":[{"backdrop-sepia":["",Yr,Vn,Hn]}],"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",Vn,Hn]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Yr,"initial",Vn,Hn]}],ease:[{ease:["linear","initial",M,Vn,Hn]}],delay:[{delay:[Yr,Vn,Hn]}],animate:[{animate:["none",T,Vn,Hn]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Vn,Hn]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:he()}],"rotate-x":[{"rotate-x":he()}],"rotate-y":[{"rotate-y":he()}],"rotate-z":[{"rotate-z":he()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":["scale-3d"],skew:[{skew:Se()}],"skew-x":[{"skew-x":Se()}],"skew-y":[{"skew-y":Se()}],transform:[{transform:[Vn,Hn,"","none","gpu","cpu"]}],"transform-origin":[{origin:D()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":["translate-none"],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"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",Vn,Hn]}],"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",Vn,Hn]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[Yr,b_,Dg,A9]}],stroke:[{stroke:["none",...z()]}],"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"]}},eue=Pce(Jce);function vt(...t){return eue(fW(t))}function EW({delayDuration:t=0,...e}){return d.jsx(ace,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Np({...t}){return d.jsx(EW,{children:d.jsx(lce,{"data-slot":"tooltip",...t})})}function kp({...t}){return d.jsx(cce,{"data-slot":"tooltip-trigger",...t})}function Rp({className:t,sideOffset:e=4,children:n,...r}){return d.jsx(uce,{children:d.jsx(dce,{"data-slot":"tooltip-content",sideOffset:e,className:vt("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})})}const d8={},tue=Symbol((d8?"production":void 0)!=="production"?"RESET":""),AW=t=>typeof(t==null?void 0:t.then)=="function";function nue(t=()=>{try{return window.localStorage}catch(n){(d8?"production":void 0)!=="production"&&typeof window<"u"&&console.warn(n);return}},e){var n;let r,i;const s={getItem:(l,c)=>{var f,h;const m=b=>{if(b=b||"",r!==b){try{i=JSON.parse(b,e==null?void 0:e.reviver)}catch{return c}r=b}return i},x=(h=(f=t())==null?void 0:f.getItem(l))!=null?h:null;return AW(x)?x.then(m):m(x)},setItem:(l,c)=>{var f;return(f=t())==null?void 0:f.setItem(l,JSON.stringify(c,void 0))},removeItem:l=>{var c;return(c=t())==null?void 0:c.removeItem(l)}},o=l=>(c,f,h)=>l(c,m=>{let x;try{x=JSON.parse(m||"")}catch{x=h}f(x)});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 f=h=>{h.storageArea===t()&&h.key===l&&c(h.newValue)};return window.addEventListener("storage",f),()=>{window.removeEventListener("storage",f)}}),a&&(s.subscribe=o(a)),s}const rue=nue();function Eo(t,e,n=rue,r){const i=Ar(e);return(d8?"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},Ar(o=>o(i),(o,a,l)=>{const c=typeof l=="function"?l(o(i)):l;return c===tue?(a(i,e),n.removeItem(t)):AW(c)?c.then(f=>(a(i,f),n.setItem(t,f))):(a(i,c),n.setItem(t,c))})}const us=Eo("dark-mode",!1),NW=Ar(!1),kW=Ar(!1),RW=Ar(!1),iue=()=>{try{const t=localStorage.getItem("selected-run-path");if(t!==null)return JSON.parse(t)}catch{}return null},R9=Ar(iue()),wl=Ar(t=>t(R9),(t,e,n)=>{e(R9,n);try{n===null?localStorage.removeItem("selected-run-path"):localStorage.setItem("selected-run-path",JSON.stringify(n))}catch{}}),XT=Eo("visible-runs",[]),PW=Ar(!1),IW=Ar(!1);function _s(t){const e=Ar({});return Ar(n=>{const r=n(wl);if(!r)return t;const i=n(e);return Object.prototype.hasOwnProperty.call(i,r)?i[r]:t},(n,r,i)=>{const s=n(wl);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 DW=Ar(!1),OW=Ar(!1),sue=Eo("overview-show-ema",!1),oue=Eo("overview-ema-span",10),aue=Eo("overview-show-all-runs",!1),lue=[{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"}],cue=Eo("overview-plots",lue),uue=Ar(!1),due=Ar(10),fue=Ar("step"),hue=Ar(!1),pue=Ar(100),mue=Ar(3600),gue=Ar(0),xue=Ar("all"),vue=Ar(null),yue=Ar(null),f8=Ar({}),zS=Ar(60),bue=_s(0),_ue=Ar(30),YT=_s(null),P9=_s(null),wue=Ar(0),Sue=Ar(0),KT=Ar(!0),Mue=Ar(!0),LW=Ar(!1),Tue=Ar(!1),Cue=Ar(14),Eue=Ar(0),Aue=Eo("inference-max-lanes",128),jW=_s(null),zW=_s(null),Nue=Eo("rollouts-selected-metrics",[]),kue=Eo("rollouts-discarded-selected-metrics",[]),h8=Eo("rollouts-metrics-sidebar-open",!0),DA=Eo("rollouts-discarded-metrics-sidebar-open",!0),p8=Eo("rollouts-sample-picker-sidebar-open",!0),OA=Eo("rollouts-discarded-sample-picker-sidebar-open",!0),FW=_s(null),I9=_s(null),UW=_s(null),D9=_s(null),BW=_s(null),O9=_s(null),HW=Ar("groups"),Rue=Eo("rollouts-sample-picker-display-metrics",["gen_length_avg","reward"]),Pue=Eo("rollouts-sample-picker-tooltips",!0),Iue=Eo("rollouts-sample-view-metrics",[]),L9=Ar("groups"),j9=_s(null),Due=_s(null),z9=_s(null),F9=_s(null),U9=_s(null),LA=Eo("evals-sample-picker-sidebar-open",!0),B9=Ar("groups"),jA=Eo("evals-metrics-sidebar-open",!0),Oue=Eo("evals-selected-metrics",[]),Lue=Ar("metrics"),jue=_s(0),zue=Ar(60),Fue=Ar(!0),Uue=Ar(!1),Bue=Ar(1),Hue=_s(0),Gue=_s("separated"),Vue=_s(!0),Wue=_s(!0),$ue=_s(!0),que=_s(!0),Xue=_s("combined"),Yue=_s("combined"),Kue=_s(!0),Zue=Eo("sidebar-project-filter",null),ZT=Ar(null),QT=Eo("rollouts-render-options",["markdown","latex","code"]),JT=Eo("rollouts-format-think",!0),GW=Ar(null);function Que(){const t=Kn(us);return w.useEffect(()=>{document.documentElement.classList.toggle("dark",t)},[t]),null}function Jue({children:t}){const[e]=w.useState(()=>new Dte({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1}}}));return d.jsxs(hne,{children:[d.jsx(Que,{}),d.jsx(Ote,{client:e,children:d.jsx(EW,{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 ede=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),tde=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),H9=t=>{const e=tde(t);return e.charAt(0).toUpperCase()+e.slice(1)},VW=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),nde=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 rde={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 ide=w.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>w.createElement("svg",{ref:l,...rde,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:VW("lucide",i),...!s&&!nde(a)&&{"aria-hidden":"true"},...a},[...o.map(([c,f])=>w.createElement(c,f)),...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 Jr=(t,e)=>{const n=w.forwardRef(({className:r,...i},s)=>w.createElement(ide,{ref:s,iconNode:e,className:VW(`lucide-${ede(H9(t))}`,`lucide-${t}`,r),...i}));return n.displayName=H9(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 sde=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ode=Jr("arrow-down",sde);/**
 * @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 ade=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],m2=Jr("arrow-left",ade);/**
 * @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 lde=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],cde=Jr("arrow-right",lde);/**
 * @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 ude=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],dde=Jr("arrow-up",ude);/**
 * @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 fde=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],H0=Jr("check",fde);/**
 * @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 hde=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Rr=Jr("chevron-down",hde);/**
 * @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 pde=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],eC=Jr("chevron-left",pde);/**
 * @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 mde=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],p0=Jr("chevron-right",mde);/**
 * @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 gde=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],m8=Jr("chevron-up",gde);/**
 * @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 xde=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],vde=Jr("chevrons-left",xde);/**
 * @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 yde=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],bde=Jr("chevrons-right",yde);/**
 * @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 _de=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],wde=Jr("circle-check",_de);/**
 * @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 Sde=[["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"}]],Mde=Jr("circle-x",Sde);/**
 * @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 Tde=[["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"}]],tC=Jr("copy",Tde);/**
 * @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 Cde=[["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"}]],Ede=Jr("database",Cde);/**
 * @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 Ade=[["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"}]],Nde=Jr("file-code-corner",Ade);/**
 * @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 kde=[["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"}]],Rde=Jr("folder-open",kde);/**
 * @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 Pde=[["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"}]],Ide=Jr("folder",Pde);/**
 * @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 Dde=[["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"}]],nC=Jr("grip-vertical",Dde);/**
 * @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 Ode=[["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"}]],Lde=Jr("layers",Ode);/**
 * @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 jde=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ml=Jr("loader-circle",jde);/**
 * @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 zde=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],rC=Jr("maximize-2",zde);/**
 * @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 Fde=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Fk=Jr("menu",Fde);/**
 * @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 Ude=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],iC=Jr("minimize-2",Ude);/**
 * @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 Bde=[["path",{d:"M5 12h14",key:"1ays0h"}]],Hde=Jr("minus",Bde);/**
 * @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 Gde=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Vde=Jr("moon",Gde);/**
 * @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 Wde=[["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"}]],$de=Jr("panel-left-close",Wde);/**
 * @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 qde=[["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"}]],Xde=Jr("panel-right-close",qde);/**
 * @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 Yde=[["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"}]],WW=Jr("pencil",Yde);/**
 * @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 Kde=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],yp=Jr("plus",Kde);/**
 * @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 Zde=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qde=Jr("search",Zde);/**
 * @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 Jde=[["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"}]],$W=Jr("settings",Jde);/**
 * @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 efe=[["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"}]],df=Jr("sliders-horizontal",efe);/**
 * @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 tfe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],nfe=Jr("square",tfe);/**
 * @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 rfe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],ife=Jr("sun",rfe);/**
 * @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 sfe=[["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"}]],ofe=Jr("trash-2",sfe);/**
 * @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 afe=[["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"}]],lfe=Jr("triangle-alert",afe);/**
 * @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 cfe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ka=Jr("x",cfe);function Lc({...t}){return d.jsx(eH,{"data-slot":"dialog",...t})}function sC({...t}){return d.jsx(tH,{"data-slot":"dialog-trigger",...t})}function ufe({...t}){return d.jsx(nH,{"data-slot":"dialog-portal",...t})}function dfe({className:t,...e}){return d.jsx(rH,{"data-slot":"dialog-overlay",className:vt("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 jc({className:t,children:e,...n}){return d.jsxs(ufe,{children:[d.jsx(dfe,{}),d.jsxs(iH,{"data-slot":"dialog-content",className:vt("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,d.jsxs(L7,{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:[d.jsx(ka,{}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Wl({className:t,...e}){return d.jsx("div",{"data-slot":"dialog-header",className:vt("flex flex-col gap-2 text-center sm:text-left",t),...e})}function Km({className:t,...e}){return d.jsx("div",{"data-slot":"dialog-footer",className:vt("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...e})}function $l({className:t,...e}){return d.jsx(sH,{"data-slot":"dialog-title",className:vt("text-lg leading-none font-semibold",t),...e})}function cp({className:t,...e}){return d.jsx(oH,{"data-slot":"dialog-description",className:vt("text-muted-foreground text-sm",t),...e})}function Vs({...t}){return d.jsx(mae,{"data-slot":"dropdown-menu",...t})}function Ws({...t}){return d.jsx(gae,{"data-slot":"dropdown-menu-trigger",...t})}function $s({className:t,align:e="start",sideOffset:n=4,...r}){return d.jsx(xae,{children:d.jsx(vae,{"data-slot":"dropdown-menu-content",sideOffset:n,align:e,className:vt("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 Mo({className:t,inset:e,variant:n="default",...r}){return d.jsx(bae,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":n,className:vt("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 hr({className:t,children:e,checked:n,...r}){return d.jsxs(_ae,{"data-slot":"dropdown-menu-checkbox-item",className:vt("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:[d.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:d.jsx(wae,{children:d.jsx(H0,{})})}),e]})}function y0({className:t,inset:e,...n}){return d.jsx(yae,{"data-slot":"dropdown-menu-label","data-inset":e,className:vt("text-muted-foreground px-1.5 py-1 text-xs font-medium data-[inset]:pl-8",t),...n})}function ys({className:t,...e}){return d.jsx(Sae,{"data-slot":"dropdown-menu-separator",className:vt("bg-border -mx-1 my-1 h-px",t),...e})}function ffe({...t}){return d.jsx(Mae,{"data-slot":"dropdown-menu-sub",...t})}function hfe({className:t,inset:e,children:n,...r}){return d.jsxs(Tae,{"data-slot":"dropdown-menu-sub-trigger","data-inset":e,className:vt("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,d.jsx(p0,{className:"ml-auto"})]})}function pfe({className:t,...e}){return d.jsx(Cae,{"data-slot":"dropdown-menu-sub-content",className:vt("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 G9=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,V9=fW,g8=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return V9(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 f=n==null?void 0:n[c],h=s==null?void 0:s[c];if(f===null)return null;const m=G9(f)||G9(h);return i[c][m]}),a=n&&Object.entries(n).reduce((c,f)=>{let[h,m]=f;return m===void 0||(c[h]=m),c},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:h,className:m,...x}=f;return Object.entries(x).every(b=>{let[_,S]=b;return Array.isArray(S)?S.includes({...s,...a}[_]):{...s,...a}[_]===S})?[...c,h,m]:c},[]);return V9(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},mfe=g8("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-[3px] aria-invalid:ring-[3px] [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",destructive:"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Sn({className:t,variant:e="default",size:n="default",asChild:r=!1,...i}){const s=r?gB:"button";return d.jsx(s,{"data-slot":"button","data-variant":e,"data-size":n,className:vt(mfe({variant:e,size:n,className:t})),...i})}function tf({className:t,type:e,...n}){return d.jsx("input",{type:e,"data-slot":"input",className:vt("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 gfe({className:t,...e}){return d.jsx(Aae,{"data-slot":"label",className:vt("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 Ya({className:t,...e}){return d.jsx(Ml,{role:"status","aria-label":"Loading",className:vt("size-4 animate-spin",t),...e})}function $x({className:t,children:e,...n}){return d.jsxs(ele,{"data-slot":"scroll-area",className:vt("relative",t),...n,children:[d.jsx(tle,{"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}),d.jsx(xfe,{}),d.jsx(nle,{})]})}function xfe({className:t,orientation:e="vertical",...n}){return d.jsx(mV,{"data-slot":"scroll-area-scrollbar","data-orientation":e,orientation:e,className:vt("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:d.jsx(yV,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function oC({...t}){return d.jsx(Fae,{"data-slot":"popover",...t})}function aC({...t}){return d.jsx(Uae,{"data-slot":"popover-trigger",...t})}function lC({className:t,align:e="center",sideOffset:n=4,...r}){return d.jsx(Bae,{children:d.jsx(Hae,{"data-slot":"popover-content",align:e,sideOffset:n,className:vt("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 W2({...t}){return d.jsx(oie,{"data-slot":"alert-dialog",...t})}function vfe({...t}){return d.jsx(aie,{"data-slot":"alert-dialog-portal",...t})}function yfe({className:t,...e}){return d.jsx(lie,{"data-slot":"alert-dialog-overlay",className:vt("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 $2({className:t,size:e="default",...n}){return d.jsxs(vfe,{children:[d.jsx(yfe,{}),d.jsx(cie,{"data-slot":"alert-dialog-content","data-size":e,className:vt("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 q2({className:t,...e}){return d.jsx("div",{"data-slot":"alert-dialog-header",className:vt("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 X2({className:t,...e}){return d.jsx("div",{"data-slot":"alert-dialog-footer",className:vt("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 bfe({className:t,...e}){return d.jsx("div",{"data-slot":"alert-dialog-media",className:vt("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 Y2({className:t,...e}){return d.jsx(fie,{"data-slot":"alert-dialog-title",className:vt("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 K2({className:t,...e}){return d.jsx(hie,{"data-slot":"alert-dialog-description",className:vt("text-muted-foreground *:[a]:hover:text-foreground text-sm text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",t),...e})}function Z2({className:t,variant:e="default",size:n="default",...r}){return d.jsx(Sn,{variant:e,size:n,asChild:!0,children:d.jsx(uie,{"data-slot":"alert-dialog-action",className:vt(t),...r})})}function Q2({className:t,variant:e="outline",size:n="default",...r}){return d.jsx(Sn,{variant:e,size:n,asChild:!0,children:d.jsx(die,{"data-slot":"alert-dialog-cancel",className:vt(t),...r})})}const Gn="",qs=5e3,zA={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",compute_reward_start:"#f59e0b",compute_reward_end:"#f59e0b"},$_={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"},rw="#0284c7",FA="#10b981",cC="#ababab",uC="#555555",dC="#c9c9c9",Lw="#4a4a4a",W9={request:rw,weight_broadcast:"#f97316"},jw="#e6e9ed",x8="#2a2d32",fC="#6b7280";function v8(t){if(zA[t])return zA[t];for(const[e,n]of Object.entries(zA))if(t.startsWith(e))return n;return fC}function J2(t){if($_[t])return $_[t];if(t.includes("/")){const e=t.split("/")[0];if($_[e])return $_[e]}return fC}function qW(t){return W9[t]?W9[t]:fC}function e5(t){return t.replace(/_step_\d+$/,"").replace(/_/g," ")}function XW(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 G0(){return ci({queryKey:["runs"],queryFn:async()=>{const t=await fetch(`${Gn}/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:qs}})}function _fe(t=!0){return ci({queryKey:["removed-runs"],queryFn:async()=>{const e=await fetch(`${Gn}/removed-runs`);if(!e.ok)throw new Error("Failed to fetch removed runs");return e.json()},enabled:t})}function wfe(t=!0){return ci({queryKey:["known-projects"],queryFn:async()=>{const e=await fetch(`${Gn}/known-projects`);if(!e.ok)throw new Error("Failed to fetch known projects");return e.json()},enabled:t})}function Sfe(t,e,n,r){return ci({queryKey:["rollouts",t,e],queryFn:async()=>{const i=await fetch(`${Gn}/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:qs})}function Mfe(t,e,n,r){return ci({queryKey:["rollouts-discarded",t,e],queryFn:async()=>{const i=await fetch(`${Gn}/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:qs})}function Tfe(t,e,n,r,i){return ci({queryKey:["evals",t,e,n],queryFn:async()=>{const s=await fetch(`${Gn}/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:qs})}function YW(t,e,n,r,i){return ci({queryKey:["sample-details",t,e,n,i??!1],queryFn:async()=>{const s=await fetch(`${Gn}/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 y8(t,e,n,r=!1){const i=w.useMemo(()=>{const o=new Set,a=[];for(const l of e){const c=`${l.group_id}:${l.sample_idx}`;o.has(c)||(o.add(c),a.push(l))}return a.sort((l,c)=>l.group_id-c.group_id||l.sample_idx-c.sample_idx)},[e]),s=w.useMemo(()=>i.map(o=>`${o.group_id}:${o.sample_idx}`).join("|"),[i]);return ci({queryKey:["sample-statuses",t,s],queryFn:async()=>{const o=await fetch(`${Gn}/sample-statuses`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,samples:i})});if(!o.ok)throw new Error("Failed to fetch sample statuses");return o.json()},enabled:n&&!!t&&i.length>0,refetchInterval:r?qs:!1})}function Sh(t,e,n){return ci({queryKey:["run-summary",t],queryFn:async()=>{const r=await fetch(`${Gn}/run-summary/${encodeURIComponent(t)}`);if(!r.ok)throw new Error("Failed to fetch run summary");return r.json()},enabled:e&&!!t,refetchInterval:n?qs:!1})}function b8(t,e){const n=lB({queries:t.map(r=>({queryKey:["run-summary",r],queryFn:async()=>{const i=await fetch(`${Gn}/run-summary/${encodeURIComponent(r)}`);if(!i.ok)throw new Error("Failed to fetch run summary");return i.json()},enabled:!!r,refetchInterval:qs}))});return w.useMemo(()=>{var x,b,_;const r=n.map(S=>S.data).filter(S=>S!=null),i={};for(const S of r){const M=((x=S.step_metrics_info)==null?void 0:x.custom_metric_sections)??{};for(const[T,A]of Object.entries(M)){i[T]||(i[T]={});for(const[N,D]of Object.entries(A)){i[T][N]||(i[T][N]=[]);const k=new Set(i[T][N]);for(const O of D)k.has(O)||i[T][N].push(O)}}}const s=new Set;for(const S of r)for(const M of S.available_rollout_metric_names??[])s.add(M);const o=new Map;for(const S of r)for(const M of((b=S.eval_info)==null?void 0:b.evals)??[]){o.has(M.eval_name)||o.set(M.eval_name,new Set);const T=o.get(M.eval_name);for(const A of M.available_rollout_metric_names)T.add(A)}const a=Array.from(o.entries()).map(([S,M])=>({eval_name:S,available_rollout_metric_names:Array.from(M)})),l={};for(const S of r)for(const[M,T]of Object.entries(S.available_sample_tags??{})){l[M]||(l[M]=[]);const A=new Set(l[M]);for(const N of T)A.has(N)||l[M].push(N)}const c=new Set;for(const S of r)for(const M of S.available_envs??[])c.add(M);const f=Math.max(0,...r.map(S=>{var M;return((M=S.step_metrics_info)==null?void 0:M.local_steps)??0})),h=n.some(S=>S.isLoading),m=((_=n.find(S=>S.error))==null?void 0:_.error)??null;return{customMetricSections:i,availableRewardNames:Array.from(s),evalsList:a,availableSampleTags:l,availableEnvs:Array.from(c),totalSteps:f,isLoading:h,error:m}},[n])}function Cfe(t,e,n,r){return ci({queryKey:["logs",t,e,n],queryFn:async()=>{const i=await fetch(`${Gn}/api/logs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,page:e,page_size:500,...n})});if(!i.ok)throw new Error("Failed to fetch logs");return i.json()},enabled:!!t,refetchInterval:qs,placeholderData:ec})}function Efe(t,e){return ci({queryKey:["logs-summary",t],queryFn:async()=>{const n=await fetch(`${Gn}/api/logs/summary/${encodeURIComponent(t)}`);if(!n.ok)throw new Error("Failed to fetch logs summary");return n.json()},enabled:!!t,staleTime:1e4})}function $9(t,e){return ci({queryKey:["run-code-tree",t],queryFn:async()=>{const n=await fetch(`${Gn}/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 q9(t,e,n){return ci({queryKey:["run-code-file",t,e],queryFn:async()=>{const r=await fetch(`${Gn}/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:ec})}function Afe(t,e,n){return ci({queryKey:["run-code-diff-summary",t,e],queryFn:async()=>{const r=await fetch(`${Gn}/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:ec})}function Nfe(t,e,n,r,i){return ci({queryKey:["timeline-paginated",t,e,n],queryFn:async()=>{const s=await fetch(`${Gn}/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:qs,placeholderData:ec,gcTime:0})}function KW(t,e,n){return ci({queryKey:["inflight-generations",t],queryFn:async()=>{const r=await fetch(`${Gn}/events/inflight/${encodeURIComponent(t)}`);if(!r.ok)throw new Error("Failed to fetch inflight generations");return r.json()},enabled:e&&!!t,refetchInterval:qs,placeholderData:ec})}function kfe(t,e,n){return ci({queryKey:["inference-events-by-group",t,e],queryFn:async()=>{const r=await fetch(`${Gn}/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 Rfe(t,e,n,r,i){return ci({queryKey:["trainer-breakdown-events",t,e,n,r],queryFn:async()=>{const s=await fetch(`${Gn}/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 Ju(t,e,n,r=60){return ci({queryKey:["inference-performance",t,r],queryFn:async()=>{const i=await fetch(`${Gn}/inference-performance`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,bucket_seconds:r})});if(!i.ok)throw new Error("Failed to fetch inference performance");return i.json()},enabled:e&&!!t,refetchInterval:n?qs:!1,placeholderData:ec})}function ed(t,e,n,r=60){return ci({queryKey:["trainer-performance",t,r],queryFn:async()=>{const i=await fetch(`${Gn}/trainer-performance`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:t,bucket_seconds:r})});if(!i.ok)throw new Error("Failed to fetch trainer performance");return i.json()},enabled:e&&!!t,refetchInterval:n?qs:!1,placeholderData:ec})}function Pfe(t,e,n,r,i,s,o){const a=n.filter(l=>Number.isFinite(l.rank));return lB({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(`${Gn}/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:qs,placeholderData:ec}))})}function Ife(t,e,n,r,i,s){return ci({queryKey:["gpu-metrics-paginated",t,e,n,r],queryFn:async()=>{const o=await fetch(`${Gn}/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:qs,placeholderData:ec})}function Dfe(t,e,n,r,i,s,o,a){return ci({queryKey:["cpu-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${Gn}/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:qs,placeholderData:ec})}function Ofe(t,e,n,r,i,s,o,a){return ci({queryKey:["vllm-metrics-paginated",t,e,n,r,i,s],queryFn:async()=>{const l=await fetch(`${Gn}/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:qs,placeholderData:ec})}function Lfe(t,e,n,r,i,s){const o=Fp(),a=w.useRef([]),l=t.join("\0"),c=a.current.join("\0");if(l!==c){const f=a.current;if(f.length>0&&t.length<f.length){const h=new Set(f);if(t.every(x=>h.has(x))){const x=["step-metrics-multi",f,e,i,s],b=o.getQueryData(x);if(b){const _=new Set(t),S=["step-metrics-multi",t,e,i,s];o.setQueryData(S,{runs:b.runs.filter(M=>_.has(M.run_path))})}}}a.current=t}return ci({queryKey:["step-metrics-multi",t,e,i,s],queryFn:async()=>{const f={run_paths:t,metric_names:e,limit:1e5};i&&Object.keys(i).length>0&&(f.tag_filters=i),s&&s.length>0&&(f.env_filters=s);const h=await fetch(`${Gn}/step-metrics/multi`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok)throw new Error("Failed to fetch step metrics (multi-run)");return h.json()},enabled:n&&t.length>0,refetchInterval:r?qs:!1,staleTime:qs})}function Gr(t,e,n){return ci({queryKey:["step-times",t],queryFn:async()=>{const r=await fetch(`${Gn}/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?qs:!1})}function ZW(t,e,n,r){return ci({queryKey:["step-metric-single",t,e],queryFn:async()=>{const i=await fetch(`${Gn}/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?qs:!1,placeholderData:ec})}function jfe(t,e,n,r,i,s){return ci({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(`${Gn}/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?qs:!1,placeholderData:ec})}function zfe(t,e,n,r,i,s){const o=Fp(),a=w.useRef([]),l=t.join("\0"),c=a.current.join("\0");if(l!==c){const f=a.current;if(f.length>0&&t.length<f.length){const h=new Set(f);if(t.every(x=>h.has(x))){const x=["eval-step-metrics-multi",f,e,n,s],b=o.getQueryData(x);if(b){const _=new Set(t),S=["eval-step-metrics-multi",t,e,n,s];o.setQueryData(S,{runs:b.runs.filter(M=>_.has(M.run_path))})}}}a.current=t}return ci({queryKey:["eval-step-metrics-multi",t,e,n,s],queryFn:async()=>({runs:await Promise.all(t.map(async h=>{const m={run_path:h,eval_name:e,metric_names:n,limit:1e5};s&&s.length>0&&(m.env_filters=s);const x=await fetch(`${Gn}/eval-step-metrics`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)});if(!x.ok)return{run_path:h,metrics:[]};const b=await x.json();return{run_path:h,metrics:b.metrics??[]}}))}),enabled:r&&t.length>0&&!!e&&n.length>0,refetchInterval:i?qs:!1,staleTime:qs})}function Ffe(t,e,n,r){return ci({queryKey:["step-histogram",t,e,n],queryFn:async()=>{const i=await fetch(`${Gn}/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:ec})}function QW(t,e,n,r){return ci({queryKey:["step-distribution-over-time",t,e],queryFn:async()=>{const i=await fetch(`${Gn}/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?qs:!1,staleTime:3e4,placeholderData:ec})}function JW(){return ci({queryKey:["custom-metrics-layout"],queryFn:async()=>{const t=await fetch(`${Gn}/custom-metrics-layout`);if(!t.ok)throw new Error("Failed to fetch custom metrics layout");return t.json()},staleTime:6e4})}function Ufe(){return ci({queryKey:["custom-metrics-templates"],queryFn:async()=>{const t=await fetch(`${Gn}/custom-metrics-templates`);if(!t.ok)throw new Error("Failed to fetch custom metrics templates");return t.json()},staleTime:6e4})}function Bfe(t){return ci({queryKey:["custom-metrics-template",t],queryFn:async()=>{const e=await fetch(`${Gn}/custom-metrics-templates/${t}`);if(!e.ok)throw new Error("Failed to fetch template");return e.json()},enabled:!!t,staleTime:6e4})}function b0(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 bp(t){return`${t.toFixed(0)}s`}function _u(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 e$(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 hC(t){if(t<60)return`${e$(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 Uk(t){const e=`${e$(t)}s`;return t<60?e:`${hC(t)} <span class="text-muted-foreground font-normal">(${e})</span>`}function wu(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 qi(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 my(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 j1=16,Hfe=6,X9=4,Gfe=2;function t$(t,e=j1){const n=Math.max(Hfe,e);if(!t||t.length<=n)return{prefix:t,suffix:"",isTruncated:!1};const r=Math.max(Gfe,n-X9);return{prefix:t.slice(0,r),suffix:t.slice(-X9),isTruncated:!0}}function Pi({...t}){return d.jsx(One,{"data-slot":"collapsible",...t})}function Ii({...t}){return d.jsx(Lne,{"data-slot":"collapsible-trigger",...t})}function Di({...t}){return d.jsx(jne,{"data-slot":"collapsible-content",...t})}function Vfe(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 Wfe(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 $fe(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"?Vfe(t,2):String(t)}function qfe(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 Y9(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 Xfe(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 f=Wfe(c),h=l==="environments"?qfe(f):f;let m=!1;for(const x of e)if(x.match(l)){n.get(x.key).items.push({key:l,displayKey:Y9(l),value:h}),m=!0;break}m||(n.has("other")||n.set("other",{key:"other",label:"Other",items:[]}),n.get("other").items.push({key:l,displayKey:Y9(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 f=new Map(c.order.map((h,m)=>[h,m]));l.items.sort((h,m)=>{const x=f.get(h.key)??1/0,b=f.get(m.key)??1/0;return x!==b?x-b:h.key.localeCompare(m.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 Yfe({displayKey:t,value:e}){const n=$fe(e);return typeof e=="object"&&e!==null?d.jsxs("div",{className:"py-1 rounded-md hover:bg-muted/50 transition-colors group",children:[d.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:t}),d.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})]}):d.jsxs("div",{className:"flex items-baseline gap-2 py-1 rounded-md hover:bg-muted/50 transition-colors group",children:[d.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors whitespace-nowrap",children:t}),d.jsx("span",{className:"text-sm font-sans font-medium break-all",children:n})]})}const Kfe="ml-[22px]",Zfe="ml-[38px]";function n$({category:t,defaultOpen:e=!1,nested:n=!1,collapseAllSignal:r=0,expandAllSignal:i=0}){const[s,o]=w.useState(e),[a,l]=w.useState(r),[c,f]=w.useState(i);r!==a&&(l(r),o(!1)),i!==c&&(f(i),o(!0));const h=t.subcategories&&t.subcategories.length>0;return d.jsxs(Pi,{open:s,onOpenChange:o,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:vt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",n&&"ml-4"),children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!s&&"-rotate-90")}),d.jsx("span",{className:"text-sm font-semibold",children:t.label})]})})}),d.jsx(Di,{children:h?d.jsx("div",{className:"mt-1",children:t.subcategories.map(m=>d.jsx(n$,{category:m,nested:!0,collapseAllSignal:r,expandAllSignal:i},m.key))}):d.jsx("div",{className:vt("mt-1",n?Zfe:Kfe),children:t.items.map(m=>d.jsx(Yfe,{displayKey:m.displayKey,value:m.value},m.key))})})]})}function r$({config:t,collapseAllSignal:e=0,expandAllSignal:n=0}){const r=w.useMemo(()=>Xfe(t),[t]),i=new Set(["model","environments"]);return r.length===0?d.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"}):d.jsx("div",{className:"space-y-1",children:r.map(s=>d.jsx(n$,{category:s,defaultOpen:i.has(s.key),collapseAllSignal:e,expandAllSignal:n},s.key))})}const i$="#e67439",Qfe="linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%)",Jfe=["#865ed6","#f07fdd","#e67439","#87cec0","#dc4cdc","#ffb83e","#5ac5db","#239487","#fab796","#9bc750","#ad6f51","#c2337a","#a2a9ad","#538ae6","#f1444f","#479a60"];function z1(t){return Math.max(0,Math.min(1,t))}function wx(t){return Math.max(0,Math.min(255,Math.round(t)))}function t5({r:t,g:e,b:n}){const r=i=>i.toString(16).padStart(2,"0");return`#${r(wx(t))}${r(wx(e))}${r(wx(n))}`}function _8(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 ehe({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 the({h:t,s:e,v:n}){const r=(t%360+360)%360,i=z1(e),s=z1(n),o=s*i,a=o*(1-Math.abs(r/60%2-1)),l=s-o;let c=0,f=0,h=0;return r<60?(c=o,f=a):r<120?(c=a,f=o):r<180?(f=o,h=a):r<240?(f=a,h=o):r<300?(c=a,h=o):(c=o,h=a),{r:wx((c+l)*255),g:wx((f+l)*255),b:wx((h+l)*255)}}function nhe(t,e){const n=_8(t);if(!n)return"#000000";const r=z1(1-e);return t5({r:n.r*r,g:n.g*r,b:n.b*r})}function iw(t,e=i$){const n=_8(t);return n?t5(n):e}function rhe({value:t,onChange:e,className:n}){const r=w.useMemo(()=>iw(t,i$),[t]),i=w.useMemo(()=>_8(r),[r]),s=w.useMemo(()=>ehe(i),[i]),[o,a]=w.useState(r.slice(1).toUpperCase());w.useEffect(()=>{a(r.slice(1).toUpperCase())},[r]);const l=w.useCallback(x=>{const b=t5(the(x));e(b)},[e]),c=w.useCallback(x=>{const b=x.currentTarget.getBoundingClientRect(),_=z1((x.clientX-b.left)/b.width),S=z1((x.clientY-b.top)/b.height);l({h:s.h,s:_,v:1-S})},[s.h,l]),f=w.useCallback(x=>{const b=x.currentTarget.getBoundingClientRect(),_=z1((x.clientX-b.left)/b.width);l({h:_*360,s:s.s,v:s.v})},[s.s,s.v,l]),h=w.useCallback(()=>{const b=`#${o.replace(/[^0-9a-f]/gi,"")}`,_=iw(b,r);a(_.slice(1).toUpperCase()),_!==r&&e(_)},[o,r,e]),m=w.useCallback((x,b)=>{const _=Number.parseInt(b,10);if(Number.isNaN(_))return;const S={...i,[x]:wx(_)};e(t5(S))},[e,i]);return d.jsxs("div",{className:vt("w-[196px] space-y-1.5 text-[10px]",n),children:[d.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:x=>{x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId),c(x)},onPointerMove:x=>{x.currentTarget.hasPointerCapture(x.pointerId)&&c(x)},onPointerUp:x=>{x.currentTarget.hasPointerCapture(x.pointerId)&&x.currentTarget.releasePointerCapture(x.pointerId)},children:[d.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-white to-transparent"}),d.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black to-transparent"}),d.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}%`}})]}),d.jsx("div",{className:"relative h-2 w-full cursor-ew-resize rounded-md border border-border touch-none select-none",style:{background:Qfe},onPointerDown:x=>{x.preventDefault(),x.currentTarget.setPointerCapture(x.pointerId),f(x)},onPointerMove:x=>{x.currentTarget.hasPointerCapture(x.pointerId)&&f(x)},onPointerUp:x=>{x.currentTarget.hasPointerCapture(x.pointerId)&&x.currentTarget.releasePointerCapture(x.pointerId)},children:d.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)`}})}),d.jsxs("div",{className:"grid grid-cols-[1fr_48px] items-end gap-1",children:[d.jsxs("div",{className:"space-y-0.5",children:[d.jsx("label",{className:"text-[8px] uppercase tracking-wide text-muted-foreground",children:"Hex"}),d.jsx(tf,{value:o,onChange:x=>{a(x.target.value.replace(/[^0-9a-f]/gi,"").slice(0,6).toUpperCase())},onBlur:h,onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),h())},className:"h-6 px-1.5 font-sans !text-[11px] md:!text-[11px] uppercase","aria-label":"Hex color"})]}),d.jsx("div",{className:"h-6 rounded-md border border-border",style:{backgroundColor:r},"aria-label":"Selected color preview"})]}),d.jsx("div",{className:"grid grid-cols-3 gap-1",children:[["R",i.r,"r"],["G",i.g,"g"],["B",i.b,"b"]].map(([x,b,_])=>d.jsxs("div",{className:"space-y-0.5",children:[d.jsx("label",{className:"text-[8px] uppercase tracking-wide text-muted-foreground",children:x}),d.jsx(tf,{type:"number",min:0,max:255,value:b,onChange:S=>m(_,S.target.value),className:"h-6 px-1.5 !text-[11px] md:!text-[11px]","aria-label":`${x} channel`})]},x))}),d.jsx("div",{className:"grid grid-cols-8 gap-x-0.5 gap-y-1.5 pt-0.5",children:Jfe.map(x=>d.jsx("button",{type:"button",className:vt("h-4 w-4 rounded-[3px] border transition",r===x?"ring-1 ring-foreground/70 ring-offset-0":"hover:brightness-[0.97]"),style:{backgroundColor:x,borderColor:nhe(x,.2)},onClick:()=>e(x),"aria-label":`Use color ${x}`},x))})]})}function gy({...t}){return d.jsx(Cle,{"data-slot":"select",...t})}function xy({...t}){return d.jsx(Ale,{"data-slot":"select-value",...t})}function vy({className:t,size:e="default",children:n,...r}){return d.jsxs(Ele,{"data-slot":"select-trigger","data-size":e,className:vt("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,d.jsx(Nle,{asChild:!0,children:d.jsx(Rr,{className:"text-muted-foreground size-4 pointer-events-none"})})]})}function yy({className:t,children:e,position:n="item-aligned",align:r="center",...i}){return d.jsx(kle,{children:d.jsxs(Rle,{"data-slot":"select-content",className:vt("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:[d.jsx(ihe,{}),d.jsx(Ple,{"data-position":n,className:vt("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}),d.jsx(she,{})]})})}function Ox({className:t,children:e,...n}){return d.jsxs(Ile,{"data-slot":"select-item",className:vt("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:[d.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:d.jsx(Ole,{children:d.jsx(H0,{className:"pointer-events-none"})})}),d.jsx(Dle,{children:e})]})}function ihe({className:t,...e}){return d.jsx(Lle,{"data-slot":"select-scroll-up-button",className:vt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:d.jsx(m8,{})})}function she({className:t,...e}){return d.jsx(jle,{"data-slot":"select-scroll-down-button",className:vt("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4",t),...e,children:d.jsx(Rr,{})})}const s$=[{key:"pausing_syncs",label:"Pausing syncs"},{key:"exporting",label:"Exporting database"},{key:"importing",label:"Compressing data"},{key:"finalizing",label:"Finalizing"}],ohe=s$.map(t=>t.key);function ahe(t){return ohe.indexOf(t)}function UA(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 lhe({open:t,onOpenChange:e}){const[n,r]=w.useState(null),[i,s]=w.useState(!1),[o,a]=w.useState(null),l=w.useRef(null),c=o!=null&&o.status!=="idle"&&o.status!=="done"&&o.status!=="error",f=w.useCallback(async()=>{s(!0);try{const M=await fetch(`${Gn}/database-info`);if(M.ok){const T=await M.json();r(T.size_bytes)}}catch{}finally{s(!1)}},[]);w.useEffect(()=>(t&&(f(),a(null)),()=>{l.current&&clearInterval(l.current),l.current=null}),[t,f]);const h=async()=>{try{const M=await fetch(`${Gn}/compact-database`,{method:"POST"});if(!M.ok){const T=await M.json().catch(()=>({}));a({status:"error",error:T.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 T=await fetch(`${Gn}/compact-database/status`);if(T.ok){const A=await T.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(M){a({status:"error",error:M instanceof Error?M.message:"Unknown error",size_before:null,size_after:null})}},m=M=>{c&&!M||e(M)},x=o?ahe(o.status):-1,b=(o==null?void 0:o.status)==="done",_=(o==null?void 0:o.status)==="error",S=o!=null&&o.status!=="idle";return d.jsx(Lc,{open:t,onOpenChange:m,children:d.jsxs(jc,{className:vt("sm:max-w-md",c&&"[&>[data-slot=dialog-close]]:hidden"),onInteractOutside:M=>{c&&M.preventDefault()},onEscapeKeyDown:M=>{c&&M.preventDefault()},children:[d.jsxs(Wl,{children:[d.jsxs($l,{className:"flex items-center gap-2",children:[d.jsx(Ede,{className:"h-4 w-4"}),"Database"]}),!S&&d.jsx(cp,{children:"Manage your local database storage."})]}),!S&&d.jsxs("div",{className:"space-y-4 py-2",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-sm text-muted-foreground",children:"Database size"}),d.jsx("span",{className:"text-sm font-medium",children:i?d.jsx(Ya,{className:"h-3.5 w-3.5"}):n!=null?UA(n):"—"})]}),d.jsx("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:d.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."})})]}),S&&d.jsxs("div",{className:"space-y-3 py-2",children:[s$.map((M,T)=>{const A=M.key===o.status,N=b||x>T||_&&x>T,D=_&&M.key===o.status;return d.jsxs("div",{className:"flex items-center gap-2.5",children:[N?d.jsx(wde,{className:"h-4 w-4 text-green-500 shrink-0"}):D?d.jsx(Mde,{className:"h-4 w-4 text-destructive shrink-0"}):A?d.jsx(Ya,{className:"h-4 w-4 text-primary shrink-0"}):d.jsx("div",{className:"h-4 w-4 rounded-full border border-border shrink-0"}),d.jsxs("span",{className:vt("text-sm",N&&"text-muted-foreground",A&&!_&&"text-foreground font-medium",D&&"text-destructive font-medium",!N&&!A&&!D&&"text-muted-foreground/60"),children:[M.label,A&&!b&&!_&&"…"]})]},M.key)}),c&&d.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&&d.jsx("div",{className:"rounded-md border border-green-500/20 bg-green-500/5 p-3 mt-2",children:d.jsxs("p",{className:"text-sm text-foreground",children:[d.jsx("span",{className:"font-medium",children:UA(o.size_before)})," → ",d.jsx("span",{className:"font-medium text-green-600 dark:text-green-400",children:UA(o.size_after)}),d.jsxs("span",{className:"text-muted-foreground ml-1.5",children:["(",Math.round((1-o.size_after/o.size_before)*100),"% reduction)"]})]})}),_&&o.error&&d.jsxs("div",{className:"rounded-md border border-destructive/20 bg-destructive/5 p-3 mt-2",children:[d.jsx("p",{className:"text-sm text-destructive",children:o.error}),d.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"The original database has been restored."})]})]}),d.jsxs(Km,{children:[!S&&d.jsx(Sn,{onClick:h,disabled:i||n==null,children:"Compress Database"}),(b||_)&&d.jsx(Sn,{onClick:()=>e(!1),children:"Close"})]})]})})}function I4({name:t,className:e,maxChars:n=j1,tooltipExtra:r}){const i=e??"text-xs font-sans",{isTruncated:s,prefix:o,suffix:a}=t$(t,n),l=d.jsxs(d.Fragment,{children:[t,r]});return!s&&!r?d.jsx("span",{className:vt("truncate",i),children:o}):s?d.jsxs(Np,{delayDuration:300,children:[d.jsx(kp,{asChild:!0,children:d.jsxs("span",{className:vt("flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",i),children:[d.jsx("span",{className:"shrink-0",children:o}),d.jsxs("span",{className:"relative shrink-0 inline-flex items-center px-0.5 text-muted-foreground/50",style:{backgroundColor:"var(--run-item-bg)"},children:[d.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"}),"..."]}),d.jsx("span",{className:"shrink-0",children:a})]})}),d.jsx(Rp,{side:"top",className:"max-w-56 break-all text-xs font-sans",children:l})]}):d.jsxs(Np,{delayDuration:300,children:[d.jsx(kp,{asChild:!0,children:d.jsx("span",{className:vt("truncate",i),children:o})}),d.jsx(Rp,{side:"top",className:"max-w-56 break-all text-xs font-sans",children:l})]})}function che(){const{pathname:t}=bh(),e=Fp(),[n,r]=cn(wl),[i,s]=cn(XT),[o,a]=cn(NW),[l,c]=cn(kW),[f,h]=cn(us),{data:m}=ci({queryKey:["version-check"],queryFn:async()=>(await fetch(`${Gn}/version-check`)).json(),staleTime:3600*1e3,refetchOnWindowFocus:!1}),x=(m==null?void 0:m.update_available)??!1,b=m==null?void 0:m.latest,_=m==null?void 0:m.current,[S,M]=w.useState(!1),T=Ute({mutationFn:async()=>(await fetch(`${Gn}/update`,{method:"POST"})).json()}),{data:A}=ci({queryKey:["sync-queue-progress"],queryFn:async()=>(await fetch(`${Gn}/sync-queue-progress`)).json(),refetchInterval:2e3}),N=(A==null?void 0:A.active)&&((A==null?void 0:A.total)??0)>1,D=ad(ZT),k=ad(DW),O=ad(OW),[R,L]=w.useState(!1),[B,H]=cn(RW),[$,G]=cn(Zue),[Z,V]=w.useState(""),[W,J]=w.useState(!1),[ne,ie]=w.useState(null),[z,j]=w.useState(null),[X,F]=w.useState(!1),[ce,oe]=w.useState(""),[Q,se]=w.useState(!1),[re,K]=w.useState(!1),[fe,he]=w.useState(null),[ae,Se]=w.useState(null),[de,Me]=w.useState(null),[Ce,Re]=w.useState("removed_at"),[le,He]=w.useState("desc"),[Le,ze]=w.useState(null),[Ve,ue]=w.useState(null),[Y,xe]=w.useState(null),[we,Te]=w.useState(null),[ge,Ue]=w.useState(!1),[be,ke]=w.useState(""),[qe,Qe]=w.useState(null),[nt,st]=w.useState(!1),[Pe,Ke]=w.useState(null),[rt,ye]=w.useState({}),[$e,Ze]=w.useState(null),[ft,lt]=w.useState(""),[Je,Ae]=w.useState(!1),We=ad(IW),De=ad(PW),{data:Ne,isLoading:ot}=G0(),{data:dt,isLoading:Pt}=_fe(R),{data:kt,refetch:wt}=wfe(B),Vt=w.useRef(new Map);w.useEffect(()=>{if(!(Ne!=null&&Ne.runs))return;const Fe=Vt.current,bt=[];for(const Tt of Ne.runs){const Yt=Fe.get(Tt.run_id);Yt!=null&&Yt.is_syncing&&!Tt.is_syncing&&bt.push(Tt.run_id),Yt!=null&&Yt.is_tracking&&!Tt.is_tracking&&bt.push(Tt.run_id),Fe.set(Tt.run_id,{is_syncing:Tt.is_syncing,is_tracking:Tt.is_tracking})}if(bt.length>0){const Tt=[...new Set(bt)];for(const Yt of Tt)e.invalidateQueries({predicate:Ht=>{const Cn=Ht.queryKey;return Array.isArray(Cn)?Cn.some(zn=>!!(zn===Yt||Array.isArray(zn)&&zn.includes(Yt))):!1}});e.invalidateQueries({queryKey:["runs"]})}},[Ne==null?void 0:Ne.runs,e]),w.useEffect(()=>{if(!(Ne!=null&&Ne.runs)||!n)return;const Fe=Ne.runs.find(bt=>bt.run_id===n);Fe&&(We(Fe.is_syncing),De(Fe.is_tracking))},[Ne==null?void 0:Ne.runs,n,We,De]),w.useEffect(()=>{t!=="/"&&(k(!1),O(!1))},[t,k,O]),w.useEffect(()=>{if(!(Ne!=null&&Ne.runs))return;const Fe=new Set(Ne.runs.map(bt=>bt.run_id));s(bt=>{const Tt=bt.filter(Yt=>Fe.has(Yt));return Tt.length===bt.length?bt:Tt}),n&&!Fe.has(n)&&(r(null),We(!1),De(!1))},[Ne==null?void 0:Ne.runs,n,r,s,We,De]);const rn=w.useMemo(()=>{const Fe=(dt==null?void 0:dt.runs)??[];return Fe.length===0?Fe:[...Fe].sort((bt,Tt)=>{const Yt=Ce;let Ht,Cn;if(Yt==="run_id"?(Ht=bt.run_id.split("/").pop()??bt.run_id,Cn=Tt.run_id.split("/").pop()??Tt.run_id):(Ht=bt[Yt],Cn=Tt[Yt]),Ht==null&&Cn==null)return 0;if(Ht==null)return 1;if(Cn==null)return-1;const zn=Ht.localeCompare(Cn);return le==="asc"?zn:-zn})},[dt==null?void 0:dt.runs,Ce,le]),Bt=Fe=>{Ce===Fe?He(bt=>bt==="asc"?"desc":"asc"):(Re(Fe),He("asc"))},Gt=async Fe=>{Fe.preventDefault();const bt=Q?{use_netrc:!0}:{api_key:ce.trim(),use_netrc:!1};if(!(!Q&&!ce.trim())){K(!0);try{const Tt=await fetch(`${Gn}/wandb-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(bt)});if(!Tt.ok){const Yt=await Tt.json();throw new Error(Yt.detail||"Failed to configure W&B")}a(!0),e.invalidateQueries({queryKey:["runs"]}),c(!1),oe("")}catch(Tt){console.error("Failed to configure W&B:",Tt)}finally{K(!1)}}},Dt=Fe=>{L(!1),r(Fe),fetch(`${Gn}/add-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Fe})}).then(bt=>{if(!bt.ok)return bt.json().then(Tt=>{throw new Error(Tt.detail||"Failed to add run")})}).then(()=>{e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}).catch(bt=>{console.error("Failed to add run:",bt)})},Qt=async()=>{const Fe=Z.trim();if(Fe){J(!0),ie(null);try{const bt=await fetch(`${Gn}/add-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:Fe})});if(!bt.ok){const Tt=await bt.json();ie(Tt.detail||"Failed to add project");return}V(""),H(!1),wt(),e.invalidateQueries({queryKey:["runs"]})}catch{ie("Failed to add project")}finally{J(!1)}}},hn=async Fe=>{j(Fe);try{const bt=await fetch(`${Gn}/remove-project`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:Fe})});if(!bt.ok){const Tt=await bt.json();throw new Error(Tt.detail||"Failed to remove project")}wt()}catch(bt){console.error("Failed to remove project:",bt)}finally{j(null)}},It=async Fe=>{if(Fe){he(Fe);try{const bt=await fetch(`${Gn}/remove-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Fe})});if(!bt.ok){const Tt=await bt.json();throw new Error(Tt.detail||"Failed to remove run")}s(Tt=>Tt.filter(Yt=>Yt!==Fe)),n===Fe&&r(null),e.invalidateQueries({queryKey:["runs"]}),e.invalidateQueries({queryKey:["removed-runs"]})}catch(bt){console.error("Failed to remove run:",bt)}finally{he(null),Me(null)}}},Lt=async Fe=>{if(Fe){Se(Fe);try{const bt=await fetch(`${Gn}/drain-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Fe})});if(!bt.ok){const Tt=await bt.json();throw new Error(Tt.detail||"Failed to drain run")}s(Tt=>Tt.filter(Yt=>Yt!==Fe)),n===Fe&&r(null),e.invalidateQueries({queryKey:["runs"]})}catch(bt){console.error("Failed to drain run:",bt)}finally{Se(null)}}},zt=async Fe=>{if(Fe)try{const bt=await fetch(`${Gn}/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Fe})});if(!bt.ok){const Tt=await bt.json();throw new Error(Tt.detail||"Failed to restore run")}e.invalidateQueries({queryKey:["runs"]})}catch(bt){console.error("Failed to restore drained run:",bt)}},pn=Fe=>{s(bt=>bt.includes(Fe)?bt.filter(Tt=>Tt!==Fe):[...bt,Fe])},Ot=w.useCallback((Fe,bt)=>{e.setQueryData(["runs"],Tt=>Tt&&{...Tt,runs:Tt.runs.map(Yt=>Yt.run_id===Fe?{...Yt,color:bt}:Yt)})},[e]),Ct=w.useCallback(async(Fe,bt,Tt)=>{const Yt=iw(bt,Tt);if(Yt.toLowerCase()!==Tt.toLowerCase()){Ot(Fe,Yt);try{const Ht=await fetch(`${Gn}/set-run-color`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Fe,color:Yt})});if(!Ht.ok){let Cn="Failed to update run color";try{Cn=(await Ht.json()).detail??Cn}catch{}throw new Error(Cn)}}catch(Ht){console.error("Failed to update run color:",Ht),Ot(Fe,Tt)}finally{e.invalidateQueries({queryKey:["runs"]})}}},[e,Ot]),tn=w.useCallback((Fe,bt,Tt)=>{if(bt){Ke(Fe),ye(Ht=>Ht[Fe]===Tt?Ht:{...Ht,[Fe]:Tt});return}Ke(Ht=>Ht===Fe?null:Ht);const Yt=rt[Fe];Yt&&Ct(Fe,Yt,Tt),ye(Ht=>{if(!(Fe in Ht))return Ht;const Cn={...Ht};return delete Cn[Fe],Cn})},[Ct,rt]),en=w.useCallback(async Fe=>{xe(Fe);try{const bt=Ne==null?void 0:Ne.runs.find(Yt=>Yt.run_id===Fe);bt!=null&&bt.is_tracking&&await fetch(`${Gn}/stop-tracking`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Fe})});const Tt=await fetch(`${Gn}/delete-run-data`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Fe})});if(!Tt.ok){const Yt=await Tt.json();throw new Error(Yt.detail||"Failed to delete run data")}await fetch(`${Gn}/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Fe})}),e.invalidateQueries({queryKey:["run-summary",Fe]}),e.invalidateQueries({queryKey:["runs"]})}catch(bt){console.error("Failed to force full resync:",bt)}finally{xe(null),ue(null)}},[Ne==null?void 0:Ne.runs,e]),bn=w.useCallback(async Fe=>{Te(Fe);try{const bt=await fetch(`${Gn}/sync-evals-after-training`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:Fe})});if(!bt.ok){const Tt=await bt.json();throw new Error(Tt.detail||"Failed to start evals sync")}e.invalidateQueries({queryKey:["run-summary",Fe]}),e.invalidateQueries({queryKey:["runs"]})}catch(bt){console.error("Failed to sync evals after training:",bt)}finally{Te(null)}},[e]),On=be.trimStart().toLowerCase().startsWith("config:"),_e=w.useCallback(async()=>{const bt=be.trimStart().slice(7).trim();if(bt){st(!0);try{const Tt=await fetch(`${Gn}/search-runs-by-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filters:bt})});if(!Tt.ok){Qe([]);return}const Yt=await Tt.json();Qe(Yt.run_ids??[])}catch{Qe([])}finally{st(!1)}}},[be]);w.useEffect(()=>{On||Qe(null)},[On]);const tt=(Ne==null?void 0:Ne.runs)||[],gt=w.useMemo(()=>{const Fe=new Set;for(const bt of tt)bt.project&&Fe.add(bt.project);return[...Fe].sort((bt,Tt)=>bt.localeCompare(Tt))},[tt]),pt=Ne==null?void 0:Ne.discovery,xt=(Ne==null?void 0:Ne.has_wandb_key)??o,$t=(Ne==null?void 0:Ne.has_netrc_wandb_key)??!1,sn=(Ne==null?void 0:Ne.wandb_key_source)??"unconfigured";w.useEffect(()=>{l&&se(sn==="netrc")},[l,sn]);const Zt=[{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 d.jsxs(d.Fragment,{children:[d.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:[d.jsxs("div",{className:"py-2.5 px-4 border-b border-sidebar-border shrink-0 flex items-center justify-between",children:[d.jsx(N2,{to:"/about",className:"flex items-center h-7 hover:opacity-80 transition-opacity",children:d.jsx("img",{src:f?"/logo-full-dark.svg":"/logo-full.svg",alt:"Telescope",className:"h-5"})}),d.jsxs("div",{className:"flex items-center gap-1",children:[x&&b&&d.jsx("button",{onClick:()=>{T.reset(),M(!0)},className:"text-[11px] font-medium text-amber-500 hover:text-amber-400 transition-colors",children:"Update"}),d.jsx("button",{onClick:()=>h(Fe=>!Fe),className:"text-sidebar-foreground/60 hover:text-sidebar-foreground transition-colors","aria-label":"Toggle dark mode",children:f?d.jsx(Vde,{className:"h-4 w-4"}):d.jsx(ife,{className:"h-4 w-4"})})]})]}),d.jsx("nav",{className:"flex flex-col gap-1 p-2 border-b border-sidebar-border shrink-0",children:Zt.map(Fe=>d.jsx(N2,{to:Fe.href,onClick:()=>{Fe.href==="/"&&(k(!1),O(!1))},className:vt("rounded-md px-2 py-1.5 text-sm transition-colors","hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",Fe.isActive&&"bg-sidebar-accent text-sidebar-accent-foreground font-medium"),children:Fe.title},Fe.href))}),d.jsxs("div",{className:"flex flex-col flex-1 min-h-0 overflow-hidden",children:[d.jsxs("div",{className:"px-2 py-2 shrink-0 flex items-center gap-1",children:[d.jsxs("div",{className:"relative flex-1 min-w-0",children:[d.jsx(tf,{type:"text",placeholder:"Search runs…",value:be,onChange:Fe=>ke(Fe.target.value),onKeyDown:Fe=>{Fe.key==="Enter"&&On&&(Fe.preventDefault(),_e())},className:vt("h-6 text-[11px] w-full placeholder:text-muted-foreground/60 placeholder:text-[10px]",On&&"pr-10")}),On&&d.jsx(Sn,{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:_e,disabled:nt,children:nt?d.jsx(Ya,{className:"h-2.5 w-2.5"}):"Go"})]}),gt.length>1&&d.jsxs(gy,{value:$??"__all__",onValueChange:Fe=>G(Fe==="__all__"?null:Fe),children:[d.jsx(vy,{size:"sm",className:"h-6 text-[11px] min-w-0 max-w-[100px] rounded-md border-input px-1.5 py-0 gap-0.5 [&_svg]:size-3",children:d.jsx(xy,{})}),d.jsxs(yy,{children:[d.jsx(Ox,{value:"__all__",className:"text-xs",children:"All"}),gt.map(Fe=>d.jsx(Ox,{value:Fe,className:"text-xs",children:Fe},Fe))]})]}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-6 w-6 text-muted-foreground hover:text-foreground",children:d.jsx(Fk,{className:"h-3.5 w-3.5"})})}),d.jsxs($s,{align:"end",className:"w-48",children:[d.jsx(Mo,{className:"text-xs",onClick:()=>H(!0),children:"Add Project"}),d.jsx(Mo,{className:"text-xs",onClick:()=>L(!0),children:"Add Run"}),d.jsxs(Mo,{className:"text-xs",onClick:()=>c(!0),children:["W&B Key"," ",xt?d.jsx("span",{className:"!text-green-500 ml-1",children:"added"}):d.jsx("span",{className:"!text-red-500 ml-1",children:"missing"})]}),d.jsx(ys,{}),d.jsx(Mo,{className:"text-xs",onClick:()=>{s([]),r(null)},children:"Unselect All"}),d.jsxs(Mo,{className:"text-xs flex items-center justify-between",onClick:()=>Ue(Fe=>!Fe),children:["Only Show Selected",d.jsx(H0,{className:vt("h-3.5 w-3.5",ge?"opacity-100":"opacity-0")})]}),d.jsx(ys,{}),d.jsx(Mo,{className:"text-xs flex items-center gap-1.5",onClick:()=>F(!0),children:"Database"}),N&&A&&d.jsxs(d.Fragment,{children:[d.jsx(ys,{}),d.jsxs(Mo,{className:"text-xs flex items-center justify-between text-red-500",onClick:async()=>{await fetch(`${Gn}/stop-all-syncs`,{method:"POST"}),e.invalidateQueries({queryKey:["sync-queue-progress"]})},children:[d.jsxs("span",{className:"flex items-center gap-1.5",children:[d.jsx(nfe,{className:"h-3 w-3 fill-current"}),"Stop Sync"]}),d.jsxs("span",{className:"text-muted-foreground font-mono",children:[A.completed,"/",A.total]})]})]})]})]})]}),(pt==null?void 0:pt.status)==="discovering"?d.jsx("div",{className:"px-4 pb-2 shrink-0",children:d.jsxs("div",{className:"flex flex-col gap-1 rounded-md bg-muted/50 px-2.5 py-2",children:[d.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Fetching runs from W&B…"}),d.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[d.jsx(Ya,{className:"h-3 w-3 shrink-0"}),(pt==null?void 0:pt.runs_found)??0," found"]}),d.jsx("span",{className:"text-[10px] text-muted-foreground/70 leading-tight",children:"Looking for telescope-tagged runs…"})]})}):null,d.jsx($x,{className:"flex-1 min-h-0 overflow-hidden",children:d.jsx("div",{className:"px-2 pb-2",children:ot?d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx(Ya,{className:"h-4 w-4"})}):d.jsxs("div",{className:"flex flex-col",children:[tt.filter(Fe=>{if($&&Fe.project!==$||ge&&n!==Fe.run_id&&!i.includes(Fe.run_id))return!1;if(On){if(qe!==null&&!qe.includes(Fe.run_id))return!1}else if(be.trim()){const bt=be.trim().toLowerCase(),Tt=(Fe.name||"").toLowerCase(),Yt=Fe.run_id.toLowerCase();if(!Tt.includes(bt)&&!Yt.includes(bt))return!1}return!0}).map(Fe=>{const bt=n===Fe.run_id,Tt=bt||i.includes(Fe.run_id),Yt=rt[Fe.run_id],Ht=iw(Yt??Fe.color,Fe.color),Cn=ae===Fe.run_id,zn=Fe.is_drained&&!Cn,Zn=Fe.needs_update,Xn=Fe.last_rollout_step===-1&&!Fe.is_syncing&&!Fe.is_tracking&&!zn&&!Zn,ir=Zn?1:Number(Fe.is_tracking)+Number(Fe.is_syncing)+Number(Cn),dn=ir>=2?j1-4:ir===1?j1-2:j1-1,Wi=Fe.name||Fe.run_id.split("/").pop()||Fe.run_id;return d.jsxs("div",{className:vt("group flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors w-full",zn?"cursor-default [--run-item-bg:var(--sidebar)]":"cursor-pointer",!bt&&!zn&&"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground [--run-item-bg:var(--sidebar)] hover:[--run-item-bg:var(--sidebar-accent)]",bt&&"bg-[var(--sidebar-selected)] text-sidebar-accent-foreground [--run-item-bg:var(--sidebar-selected)]"),onClick:()=>{zn||r(Fe.run_id)},onMouseEnter:()=>{Tt&&!zn&&D(Fe.run_id)},onMouseLeave:()=>D(null),children:[d.jsx("button",{onClick:vn=>{vn.stopPropagation(),!bt&&!zn&&pn(Fe.run_id)},disabled:bt||zn,className:vt("w-3 h-3 rounded-sm border shrink-0 flex items-center justify-center transition-colors",Tt&&!zn?"bg-foreground border-foreground":"border-muted-foreground/50",(bt||zn)&&"opacity-50 cursor-not-allowed"),children:Tt&&d.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"none",className:"text-background",children:d.jsx("path",{d:"M1 4L3 6L7 2",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),d.jsxs(oC,{open:Pe===Fe.run_id,onOpenChange:vn=>tn(Fe.run_id,vn,Fe.color),children:[d.jsx(aC,{asChild:!0,children:d.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:Ht},onClick:vn=>vn.stopPropagation(),"aria-label":`Change color for ${Wi}`})}),d.jsx(lC,{side:"right",align:"start",className:"w-auto p-1.5",onClick:vn=>vn.stopPropagation(),onOpenAutoFocus:vn=>vn.preventDefault(),children:d.jsx(rhe,{value:Ht,onChange:vn=>{ye(ts=>({...ts,[Fe.run_id]:iw(vn,Fe.color)}))}})})]}),d.jsx("div",{className:vt("flex-1 min-w-0 text-left",zn?"text-muted-foreground":Xn&&"text-muted-foreground/60"),children:d.jsx(I4,{name:Wi,maxChars:dn,tooltipExtra:zn?d.jsx("div",{className:"opacity-60 mt-0.5",children:"Drained"}):void 0})}),Zn?d.jsxs(Np,{children:[d.jsx(kp,{asChild:!0,children:d.jsx("button",{onClick:vn=>{vn.stopPropagation(),T.reset(),M(!0)},className:"text-amber-500 hover:text-amber-400 transition-colors shrink-0 text-xs font-bold leading-none",children:"!"})}),d.jsx(Rp,{side:"right",children:d.jsx("p",{className:"text-xs",children:"Update telescope-ui to sync this run"})})]}):d.jsxs(d.Fragment,{children:[Fe.is_tracking&&d.jsx("span",{className:"w-2 h-2 rounded-full bg-green-500 shrink-0",title:"Live"}),Fe.is_syncing&&d.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),Cn&&d.jsx("span",{className:"w-2 h-2 rounded-full bg-orange-500 shrink-0",title:"Draining"})]}),d.jsxs("div",{className:"ml-auto relative h-6 w-6 flex items-center justify-center",children:[d.jsx("span",{className:"absolute text-[10px] text-muted-foreground transition-opacity group-hover:opacity-0",children:my(Fe.created_at)}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsx(Sn,{variant:"ghost",size:"icon",className:"absolute h-6 w-6 opacity-0 transition-opacity group-hover:opacity-100 hover:bg-transparent",disabled:fe===Fe.run_id,onClick:vn=>vn.stopPropagation(),children:d.jsx(Fk,{className:"h-3.5 w-3.5"})})}),d.jsxs($s,{align:"end",className:"w-auto",children:[d.jsx(y0,{className:"text-xs font-normal",children:d.jsx("span",{className:"font-sans",children:Fe.run_id})}),d.jsx(ys,{}),d.jsx(Mo,{onClick:vn=>{vn.stopPropagation(),lt(Fe.name||Fe.run_id.split("/").pop()||""),Ze(Fe.run_id)},children:"Rename"}),d.jsx(Mo,{disabled:Y===Fe.run_id,onClick:vn=>{vn.stopPropagation(),ue(Fe.run_id)},children:Y===Fe.run_id?"Resyncing...":"Force Full Resync"}),d.jsx(Mo,{disabled:we===Fe.run_id,onClick:vn=>{vn.stopPropagation(),bn(Fe.run_id)},children:we===Fe.run_id?"Syncing evals...":"Sync Evals After Training"}),d.jsx(Mo,{disabled:Cn,onClick:vn=>{vn.stopPropagation(),zn?zt(Fe.run_id):Lt(Fe.run_id)},children:Cn?"Draining...":zn?"Restore Data":"Drain"}),d.jsx(Mo,{className:"text-destructive",disabled:fe===Fe.run_id,onClick:vn=>{vn.stopPropagation(),Me(Fe.run_id)},children:"Remove"})]})]})]})]},Fe.run_id)}),tt.length===0&&d.jsx("div",{className:"text-center py-4 px-2",children:xt?d.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs yet"}):d.jsxs("div",{className:"space-y-2",children:[d.jsx("div",{className:"text-xs text-muted-foreground",children:"No wandb key added yet"}),d.jsx(Sn,{size:"sm",className:"h-6 px-2 text-[11px] bg-green-600 hover:bg-green-700",onClick:()=>c(!0),children:"Add wandb key"})]})})]})})})]})]}),d.jsx(Lc,{open:l,onOpenChange:c,children:d.jsxs(jc,{className:"sm:max-w-md",children:[d.jsxs(Wl,{children:[d.jsx($l,{children:"Configure W&B"}),d.jsx(cp,{children:Q?d.jsxs(d.Fragment,{children:["Use the API key saved by"," ",d.jsx("span",{className:"font-sans",children:"wandb login"})," to fetch all runs tagged ",d.jsx("span",{className:"font-sans",children:"telescope"}),"."]}):d.jsxs(d.Fragment,{children:["Paste your W&B API key to fetch all runs tagged"," ",d.jsx("span",{className:"font-sans",children:"telescope"}),"."]})})]}),d.jsxs("form",{onSubmit:Gt,children:[d.jsxs("div",{className:"space-y-4 py-4",children:[d.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[d.jsx("input",{type:"checkbox",checked:Q,onChange:Fe=>se(Fe.target.checked),className:"accent-primary h-3.5 w-3.5"}),d.jsxs("span",{className:"text-sm",children:["Use key from"," ",d.jsx("span",{className:"font-sans text-xs",children:"wandb login"})]}),Q&&!$t&&d.jsxs("span",{className:"text-[11px] text-red-500 font-medium",children:["Not found — run"," ",d.jsx("code",{className:"text-[10px]",children:"wandb login"})]}),Q&&$t&&d.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Found"})]}),!Q&&d.jsxs("div",{className:"space-y-2",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(gfe,{htmlFor:"config-api-key",children:"W&B API Key"}),xt&&sn==="custom"?d.jsx("span",{className:"text-[11px] text-green-500 font-medium",children:"Key added"}):d.jsx("span",{className:"text-[11px] text-red-500 font-medium",children:"No key configured"})]}),d.jsx(tf,{id:"config-api-key",type:"password",placeholder:"Enter API key",value:ce,onChange:Fe=>oe(Fe.target.value),required:!0})]})]}),d.jsxs(Km,{children:[d.jsx(Sn,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),d.jsx(Sn,{type:"submit",disabled:re||(Q?!$t:!ce.trim()),children:re?d.jsxs(d.Fragment,{children:[d.jsx(Ya,{className:"mr-2 h-4 w-4"}),"Saving..."]}):"Ok"})]})]})]})}),d.jsx(Lc,{open:R,onOpenChange:L,children:d.jsxs(jc,{className:"sm:max-w-3xl !grid-rows-[auto_1fr] !gap-0 max-h-[80vh] overflow-hidden",onOpenAutoFocus:Fe=>{Fe.preventDefault();const bt=Fe.currentTarget;bt==null||bt.focus()},children:[d.jsxs(Wl,{className:"pb-3",children:[d.jsx($l,{children:"Add Run"}),d.jsx(cp,{children:"Select a removed run to add it back. Uses the stored W&B API key."})]}),d.jsxs("div",{className:"overflow-y-auto -mx-6 px-6",children:[d.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:[d.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(Fe=>d.jsxs("button",{className:vt("flex items-center gap-0.5 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors whitespace-nowrap select-none",Fe.cls),onClick:()=>Bt(Fe.key),children:[Fe.label,Ce===Fe.key&&(le==="asc"?d.jsx(dde,{className:"h-2.5 w-2.5"}):d.jsx(ode,{className:"h-2.5 w-2.5"}))]},Fe.key)),d.jsx("span",{className:"text-[10px] font-medium text-muted-foreground text-center",children:"Config"})]}),d.jsx("div",{className:"py-1",children:Pt?d.jsx("div",{className:"flex items-center justify-center py-6",children:d.jsx(Ya,{className:"h-4 w-4"})}):d.jsxs(d.Fragment,{children:[rn.map(Fe=>{const bt=Fe.run_id.split("/").pop()??Fe.run_id;return d.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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-full cursor-pointer",style:{backgroundColor:Fe.color??"#888"},onClick:()=>Dt(Fe.run_id)}),d.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Dt(Fe.run_id),children:d.jsx(I4,{name:Fe.name??"Unnamed"})}),d.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Dt(Fe.run_id),children:d.jsx(I4,{name:Fe.entity??"—",className:"text-xs font-sans text-muted-foreground"})}),d.jsx("span",{className:"min-w-0 cursor-pointer",onClick:()=>Dt(Fe.run_id),children:d.jsx(I4,{name:Fe.project??"—",className:"text-xs font-sans text-muted-foreground"})}),d.jsx("span",{className:"text-xs font-sans text-muted-foreground truncate cursor-pointer",onClick:()=>Dt(Fe.run_id),children:bt}),d.jsx("span",{className:"text-[10px] text-muted-foreground whitespace-nowrap cursor-pointer",onClick:()=>Dt(Fe.run_id),children:Fe.created_at?new Date(Fe.created_at).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"}):"—"}),d.jsx("span",{className:"text-[10px] text-red-400 whitespace-nowrap text-center cursor-pointer",onClick:()=>Dt(Fe.run_id),children:Fe.removed_at?my(Fe.removed_at):"—"}),d.jsx(Sn,{variant:"ghost",size:"sm",className:"h-5 px-1.5 text-[10px] text-muted-foreground hover:text-foreground",onClick:Tt=>{Tt.stopPropagation(),ze(Fe)},disabled:!Fe.config,children:"View"})]},Fe.run_id)}),rn.length===0&&d.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"No removed runs"})]})})]})]})}),d.jsx(Lc,{open:B,onOpenChange:H,children:d.jsxs(jc,{className:"sm:max-w-lg max-h-[70vh] !grid-rows-[auto_1fr] !gap-0 overflow-hidden",children:[d.jsxs(Wl,{className:"pb-3",children:[d.jsx($l,{children:"Known Projects"}),d.jsx(cp,{children:"Projects polled for new telescope-tagged runs. Add an entity/project pair to start discovering runs from it."})]}),d.jsxs("div",{className:"overflow-y-auto -mx-6 px-6",children:[d.jsxs("div",{className:"flex flex-col gap-1 mb-3",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsx(tf,{className:"h-7 text-xs flex-1",placeholder:"entity/project",value:Z,onChange:Fe=>{V(Fe.target.value),ne&&ie(null)},onKeyDown:Fe=>{Fe.key==="Enter"&&Qt()}}),d.jsx(Sn,{variant:"default",size:"sm",className:"h-7 px-3 text-xs",onClick:Qt,disabled:W||!Z.trim(),children:W?d.jsx(Ya,{className:"h-3 w-3"}):"Ok"})]}),ne&&d.jsx("span",{className:"text-[11px] text-red-500",children:ne})]}),d.jsxs("div",{className:"space-y-1",children:[kt==null?void 0:kt.projects.map(Fe=>d.jsxs("div",{className:"flex items-center justify-between rounded-md px-3 py-1.5 hover:bg-muted transition-colors group",children:[d.jsxs("div",{className:"flex flex-col min-w-0",children:[d.jsx("span",{className:"text-xs font-mono truncate",children:Fe.project}),d.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[Fe.source==="user"?"User-added":"From existing runs",Fe.added_at&&` · ${new Date(Fe.added_at).toLocaleDateString()}`]})]}),Fe.source==="user"&&d.jsx(Sn,{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:()=>hn(Fe.project),disabled:z===Fe.project,children:z===Fe.project?d.jsx(Ya,{className:"h-3 w-3"}):d.jsx(ofe,{className:"h-3 w-3"})})]},Fe.project)),(kt==null?void 0:kt.projects.length)===0&&d.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."})]})]})]})}),d.jsx(Lc,{open:!!Le,onOpenChange:Fe=>{Fe||ze(null)},children:d.jsxs(jc,{className:"sm:max-w-2xl max-h-[85vh] !grid-rows-[auto_1fr] overflow-hidden",children:[d.jsxs(Wl,{children:[d.jsxs($l,{className:"flex items-center gap-2",children:[(Le==null?void 0:Le.color)&&d.jsx("div",{className:"w-3 h-3 rounded-full shrink-0",style:{backgroundColor:Le.color}}),"Configuration —"," ",(Le==null?void 0:Le.name)??(Le==null?void 0:Le.run_id.split("/").pop())]}),d.jsx(cp,{children:Le==null?void 0:Le.run_id})]}),d.jsx("div",{className:"overflow-y-auto -mx-6 px-6",children:Le!=null&&Le.config?d.jsx(r$,{config:Le.config}):d.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"No configuration data available"})})]})}),d.jsx(W2,{open:!!de,onOpenChange:Fe=>{Fe||Me(null)},children:d.jsxs($2,{children:[d.jsxs(q2,{children:[d.jsx(Y2,{children:"Remove run locally?"}),d.jsx(K2,{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."})]}),d.jsxs(X2,{children:[d.jsx(Q2,{children:"Cancel"}),d.jsx(Z2,{onClick:()=>{de&&It(de)},children:"Remove"})]})]})}),d.jsx(W2,{open:!!Ve,onOpenChange:Fe=>{Fe||ue(null)},children:d.jsxs($2,{children:[d.jsxs(q2,{children:[d.jsx(bfe,{className:"bg-destructive/10",children:d.jsx(lfe,{className:"text-destructive"})}),d.jsx(Y2,{children:"Force Full Resync"}),d.jsx(K2,{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."})]}),d.jsxs(X2,{children:[d.jsx(Q2,{children:"Cancel"}),d.jsx(Z2,{variant:"destructive",onClick:()=>{Ve&&en(Ve)},children:"Yes, Delete & Resync"})]})]})}),d.jsx(Lc,{open:!!$e,onOpenChange:Fe=>{Fe||(Ze(null),lt(""))},children:d.jsxs(jc,{className:"sm:max-w-md",children:[d.jsxs(Wl,{children:[d.jsx($l,{children:"Rename Run"}),d.jsx(cp,{children:"This will update the run name locally and on W&B."})]}),d.jsxs("form",{onSubmit:async Fe=>{Fe.preventDefault();const bt=ft.trim();if(!(!bt||!$e)){Ae(!0),e.setQueryData(["runs"],Tt=>Tt&&{...Tt,runs:Tt.runs.map(Yt=>Yt.run_id===$e?{...Yt,name:bt}:Yt)});try{if(!(await fetch(`${Gn}/rename-run`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:$e,name:bt})})).ok)throw new Error("Failed to rename run")}catch(Tt){console.error("Failed to rename run:",Tt)}finally{e.invalidateQueries({queryKey:["runs"]}),Ae(!1),Ze(null),lt("")}}},children:[d.jsx("div",{className:"py-2",children:d.jsx(tf,{value:ft,onChange:Fe=>lt(Fe.target.value),placeholder:"Run name",autoFocus:!0})}),d.jsxs(Km,{children:[d.jsx(Sn,{type:"button",variant:"outline",onClick:()=>{Ze(null),lt("")},children:"Cancel"}),d.jsx(Sn,{type:"submit",disabled:!ft.trim()||Je,children:Je?"Renaming...":"Rename"})]})]})]})}),d.jsx(Lc,{open:S,onOpenChange:M,children:d.jsxs(jc,{className:"sm:max-w-md",children:[d.jsxs(Wl,{children:[d.jsx($l,{children:"Update Available"}),d.jsx(cp,{children:"A new version of telescope-ui is available."})]}),T.isIdle&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"text-sm space-y-2 py-2",children:[d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Installed"}),d.jsx("span",{className:"font-mono",children:_})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:"Latest"}),d.jsx("span",{className:"font-mono",children:b})]})]}),d.jsxs(Km,{children:[d.jsx(Sn,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),d.jsx(Sn,{onClick:()=>T.mutate(),children:"Update"})]})]}),T.isPending&&d.jsxs("div",{className:"flex items-center gap-3 py-4",children:[d.jsx(Ya,{className:"h-4 w-4"}),d.jsx("span",{className:"text-sm",children:"Updating telescope-ui..."})]}),T.isSuccess&&T.data.success&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"text-sm space-y-2 py-2",children:[d.jsx("p",{className:"text-green-500 font-medium",children:"Updated successfully."}),d.jsx("p",{className:"text-muted-foreground",children:"Restart the server to apply the new version."})]}),d.jsxs(Km,{children:[d.jsx(Sn,{variant:"outline",onClick:()=>M(!1),children:"OK"}),d.jsx(Sn,{onClick:async()=>{await fetch(`${Gn}/restart`,{method:"POST"}),setTimeout(()=>window.location.reload(),3e3)},children:"Restart Server"})]})]}),(T.isSuccess&&!T.data.success||T.isError)&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"text-sm space-y-2 py-2",children:[d.jsx("p",{className:"text-red-500 font-medium",children:"Update failed"}),d.jsx("pre",{className:"text-xs text-muted-foreground bg-muted p-2 rounded whitespace-pre-wrap break-all max-h-40 overflow-auto",children:T.isSuccess?T.data.error:"Could not reach the server."})]}),d.jsxs(Km,{children:[d.jsx(Sn,{variant:"outline",onClick:()=>M(!1),children:"Close"}),d.jsx(Sn,{onClick:()=>T.mutate(),children:"Retry"})]})]})]})}),d.jsx(lhe,{open:X,onOpenChange:F})]})}function uhe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return w.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const pC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Qy(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function w8(t){return"nodeType"in t}function Vc(t){var e,n;return t?Qy(t)?t:w8(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function S8(t){const{Document:e}=Vc(t);return t instanceof e}function FS(t){return Qy(t)?!1:t instanceof Vc(t).HTMLElement}function o$(t){return t instanceof Vc(t).SVGElement}function Jy(t){return t?Qy(t)?t.document:w8(t)?S8(t)?t:FS(t)||o$(t)?t.ownerDocument:document:document:document}const ph=pC?w.useLayoutEffect:w.useEffect;function M8(t){const e=w.useRef(t);return ph(()=>{e.current=t}),w.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 dhe(){const t=w.useRef(null),e=w.useCallback((r,i)=>{t.current=setInterval(r,i)},[]),n=w.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function zw(t,e){e===void 0&&(e=[t]);const n=w.useRef(t);return ph(()=>{n.current!==t&&(n.current=t)},e),n}function US(t,e){const n=w.useRef();return w.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function n5(t){const e=M8(t),n=w.useRef(null),r=w.useCallback(i=>{i!==n.current&&(e==null||e(i,n.current)),n.current=i},[]);return[n,r]}function Bk(t){const e=w.useRef();return w.useEffect(()=>{e.current=t},[t]),e.current}let BA={};function BS(t,e){return w.useMemo(()=>{if(e)return e;const n=BA[t]==null?0:BA[t]+1;return BA[t]=n,t+"-"+n},[t,e])}function a$(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 f=s[l];f!=null&&(s[l]=f+t*c)}return s},{...e})}}const F1=a$(1),Fw=a$(-1);function fhe(t){return"clientX"in t&&"clientY"in t}function T8(t){if(!t)return!1;const{KeyboardEvent:e}=Vc(t.target);return e&&t instanceof e}function hhe(t){if(!t)return!1;const{TouchEvent:e}=Vc(t.target);return e&&t instanceof e}function Hk(t){if(hhe(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 fhe(t)?{x:t.clientX,y:t.clientY}:null}const by=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[by.Translate.toString(t),by.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),K9="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function phe(t){return t.matches(K9)?t:t.querySelector(K9)}const mhe={display:"none"};function ghe(t){let{id:e,value:n}=t;return ri.createElement("div",{id:e,style:mhe},n)}function xhe(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 ri.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function vhe(){const[t,e]=w.useState("");return{announce:w.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const l$=w.createContext(null);function yhe(t){const e=w.useContext(l$);w.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function bhe(){const[t]=w.useState(()=>new Set),e=w.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[w.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 _he={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.
  `},whe={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 She(t){let{announcements:e=whe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=_he}=t;const{announce:s,announcement:o}=vhe(),a=BS("DndLiveRegion"),[l,c]=w.useState(!1);if(w.useEffect(()=>{c(!0)},[]),yhe(w.useMemo(()=>({onDragStart(h){let{active:m}=h;s(e.onDragStart({active:m}))},onDragMove(h){let{active:m,over:x}=h;e.onDragMove&&s(e.onDragMove({active:m,over:x}))},onDragOver(h){let{active:m,over:x}=h;s(e.onDragOver({active:m,over:x}))},onDragEnd(h){let{active:m,over:x}=h;s(e.onDragEnd({active:m,over:x}))},onDragCancel(h){let{active:m,over:x}=h;s(e.onDragCancel({active:m,over:x}))}}),[s,e])),!l)return null;const f=ri.createElement(ri.Fragment,null,ri.createElement(ghe,{id:r,value:i.draggable}),ri.createElement(xhe,{id:a,announcement:o}));return n?Yl.createPortal(f,n):f}var ha;(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"})(ha||(ha={}));function r5(){}function ld(t,e){return w.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function _y(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return w.useMemo(()=>[...e].filter(r=>r!=null),[...e])}const cf=Object.freeze({x:0,y:0});function c$(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function u$(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function Mhe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function Z9(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 d$(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function Q9(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 wy=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=Q9(e,e.left,e.top),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=c$(Q9(l),i);s.push({id:a,data:{droppableContainer:o,value:c}})}}return s.sort(u$)},The=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=Z9(e),s=[];for(const o of r){const{id:a}=o,l=n.get(a);if(l){const c=Z9(l),f=i.reduce((m,x,b)=>m+c$(c[b],x),0),h=Number((f/4).toFixed(4));s.push({id:a,data:{droppableContainer:o,value:h}})}}return s.sort(u$)};function Che(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,f=o*a,h=f/(l+c-f);return Number(h.toFixed(4))}return 0}const Ehe=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=Che(a,e);l>0&&i.push({id:o,data:{droppableContainer:s,value:l}})}}return i.sort(Mhe)};function Ahe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function f$(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:cf}function Nhe(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 khe=Nhe(1);function Rhe(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 Phe(t,e,n){const r=Rhe(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)),f=i?t.width/i:t.width,h=s?t.height/s:t.height;return{width:f,height:h,top:c,right:l+f,bottom:c+h,left:l}}const Ihe={ignoreTransform:!1};function eb(t,e){e===void 0&&(e=Ihe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:c,transformOrigin:f}=Vc(t).getComputedStyle(t);c&&(n=Phe(n,c,f))}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 J9(t){return eb(t,{ignoreTransform:!0})}function Dhe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Ohe(t,e){return e===void 0&&(e=Vc(t).getComputedStyle(t)),e.position==="fixed"}function Lhe(t,e){e===void 0&&(e=Vc(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 mC(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(S8(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!FS(i)||o$(i)||n.includes(i))return n;const s=Vc(t).getComputedStyle(i);return i!==t&&Lhe(i,s)&&n.push(i),Ohe(i,s)?n:r(i.parentNode)}return t?r(t):n}function h$(t){const[e]=mC(t,1);return e??null}function HA(t){return!pC||!t?null:Qy(t)?t:w8(t)?S8(t)||t===Jy(t).scrollingElement?window:FS(t)?t:null:null}function p$(t){return Qy(t)?t.scrollX:t.scrollLeft}function m$(t){return Qy(t)?t.scrollY:t.scrollTop}function Gk(t){return{x:p$(t),y:m$(t)}}var Na;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Na||(Na={}));function g$(t){return!pC||!t?!1:t===document.scrollingElement}function x$(t){const e={x:0,y:0},n=g$(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 jhe={x:.2,y:.2};function zhe(t,e,n,r,i){let{top:s,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=jhe);const{isTop:c,isBottom:f,isLeft:h,isRight:m}=x$(t),x={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?(x.y=Na.Backward,b.y=r*Math.abs((e.top+_.height-s)/_.height)):!f&&l>=e.bottom-_.height&&(x.y=Na.Forward,b.y=r*Math.abs((e.bottom-_.height-l)/_.height)),!m&&a>=e.right-_.width?(x.x=Na.Forward,b.x=r*Math.abs((e.right-_.width-a)/_.width)):!h&&o<=e.left+_.width&&(x.x=Na.Backward,b.x=r*Math.abs((e.left+_.width-o)/_.width)),{direction:x,speed:b}}function Fhe(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 v$(t){return t.reduce((e,n)=>F1(e,Gk(n)),cf)}function Uhe(t){return t.reduce((e,n)=>e+p$(n),0)}function Bhe(t){return t.reduce((e,n)=>e+m$(n),0)}function Hhe(t,e){if(e===void 0&&(e=eb),!t)return;const{top:n,left:r,bottom:i,right:s}=e(t);h$(t)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const Ghe=[["x",["left","right"],Uhe],["y",["top","bottom"],Bhe]];class C8{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=mC(n),i=v$(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[s,o,a]of Ghe)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(r),f=i[s]-c;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class sw{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 Vhe(t){const{EventTarget:e}=Vc(t);return t instanceof e?t:Jy(t)}function GA(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 id;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(id||(id={}));function eO(t){t.preventDefault()}function Whe(t){t.stopPropagation()}var hi;(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"})(hi||(hi={}));const y$={start:[hi.Space,hi.Enter],cancel:[hi.Esc],end:[hi.Space,hi.Enter,hi.Tab]},$he=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case hi.Right:return{...n,x:n.x+25};case hi.Left:return{...n,x:n.x-25};case hi.Down:return{...n,y:n.y+25};case hi.Up:return{...n,y:n.y-25}}};class _0{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 sw(Jy(n)),this.windowListeners=new sw(Vc(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(id.Resize,this.handleCancel),this.windowListeners.add(id.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(id.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Hhe(r),n(cf)}handleKeyDown(e){if(T8(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=y$,coordinateGetter:o=$he,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,f=c?{x:c.left,y:c.top}:cf;this.referenceCoordinates||(this.referenceCoordinates=f);const h=o(e,{active:n,context:r.current,currentCoordinates:f});if(h){const m=Fw(h,f),x={x:0,y:0},{scrollableAncestors:b}=r.current;for(const _ of b){const S=e.code,{isTop:M,isRight:T,isLeft:A,isBottom:N,maxScroll:D,minScroll:k}=x$(_),O=Fhe(_),R={x:Math.min(S===hi.Right?O.right-O.width/2:O.right,Math.max(S===hi.Right?O.left:O.left+O.width/2,h.x)),y:Math.min(S===hi.Down?O.bottom-O.height/2:O.bottom,Math.max(S===hi.Down?O.top:O.top+O.height/2,h.y))},L=S===hi.Right&&!T||S===hi.Left&&!A,B=S===hi.Down&&!N||S===hi.Up&&!M;if(L&&R.x!==h.x){const H=_.scrollLeft+m.x,$=S===hi.Right&&H<=D.x||S===hi.Left&&H>=k.x;if($&&!m.y){_.scrollTo({left:H,behavior:a});return}$?x.x=_.scrollLeft-H:x.x=S===hi.Right?_.scrollLeft-D.x:_.scrollLeft-k.x,x.x&&_.scrollBy({left:-x.x,behavior:a});break}else if(B&&R.y!==h.y){const H=_.scrollTop+m.y,$=S===hi.Down&&H<=D.y||S===hi.Up&&H>=k.y;if($&&!m.x){_.scrollTo({top:H,behavior:a});return}$?x.y=_.scrollTop-H:x.y=S===hi.Down?_.scrollTop-D.y:_.scrollTop-k.y,x.y&&_.scrollBy({top:-x.y,behavior:a});break}}this.handleMove(e,F1(Fw(h,this.referenceCoordinates),x))}}}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()}}_0.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=y$,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 tO(t){return!!(t&&"distance"in t)}function nO(t){return!!(t&&"delay"in t)}class E8{constructor(e,n,r){var i;r===void 0&&(r=Vhe(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=Jy(o),this.documentListeners=new sw(this.document),this.listeners=new sw(r),this.windowListeners=new sw(Vc(o)),this.initialCoordinates=(i=Hk(s))!=null?i:cf,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(id.Resize,this.handleCancel),this.windowListeners.add(id.DragStart,eO),this.windowListeners.add(id.VisibilityChange,this.handleCancel),this.windowListeners.add(id.ContextMenu,eO),this.documentListeners.add(id.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(nO(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(tO(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(id.Click,Whe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(id.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=Hk(e))!=null?n:cf,c=Fw(i,l);if(!r&&a){if(tO(a)){if(a.tolerance!=null&&GA(c,a.tolerance))return this.handleCancel();if(GA(c,a.distance))return this.handleStart()}if(nO(a)&&GA(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===hi.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const qhe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class w0 extends E8{constructor(e){const{event:n}=e,r=Jy(n.target);super(e,qhe,r)}}w0.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 Xhe={move:{name:"mousemove"},end:{name:"mouseup"}};var Vk;(function(t){t[t.RightClick=2]="RightClick"})(Vk||(Vk={}));class Yhe extends E8{constructor(e){super(e,Xhe,Jy(e.event.target))}}Yhe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===Vk.RightClick?!1:(r==null||r({event:n}),!0)}}];const VA={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Khe extends E8{constructor(e){super(e,VA)}static setup(){return window.addEventListener(VA.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(VA.move.name,e)};function e(){}}}Khe.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 ow;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(ow||(ow={}));var i5;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(i5||(i5={}));function Zhe(t){let{acceleration:e,activator:n=ow.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:a=i5.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:f,delta:h,threshold:m}=t;const x=Jhe({delta:h,disabled:!s}),[b,_]=dhe(),S=w.useRef({x:0,y:0}),M=w.useRef({x:0,y:0}),T=w.useMemo(()=>{switch(n){case ow.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case ow.DraggableRect:return i}},[n,i,l]),A=w.useRef(null),N=w.useCallback(()=>{const k=A.current;if(!k)return;const O=S.current.x*M.current.x,R=S.current.y*M.current.y;k.scrollBy(O,R)},[]),D=w.useMemo(()=>a===i5.TreeOrder?[...c].reverse():c,[a,c]);w.useEffect(()=>{if(!s||!c.length||!T){_();return}for(const k of D){if((r==null?void 0:r(k))===!1)continue;const O=c.indexOf(k),R=f[O];if(!R)continue;const{direction:L,speed:B}=zhe(k,R,T,e,m);for(const H of["x","y"])x[H][L[H]]||(B[H]=0,L[H]=0);if(B.x>0||B.y>0){_(),A.current=k,b(N,o),S.current=B,M.current=L;return}}S.current={x:0,y:0},M.current={x:0,y:0},_()},[e,N,r,_,s,o,JSON.stringify(T),JSON.stringify(x),b,c,D,f,JSON.stringify(m)])}const Qhe={x:{[Na.Backward]:!1,[Na.Forward]:!1},y:{[Na.Backward]:!1,[Na.Forward]:!1}};function Jhe(t){let{delta:e,disabled:n}=t;const r=Bk(e);return US(i=>{if(n||!r||!i)return Qhe;const s={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Na.Backward]:i.x[Na.Backward]||s.x===-1,[Na.Forward]:i.x[Na.Forward]||s.x===1},y:{[Na.Backward]:i.y[Na.Backward]||s.y===-1,[Na.Forward]:i.y[Na.Forward]||s.y===1}}},[n,e,r])}function epe(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return US(i=>{var s;return e==null?null:(s=r??i)!=null?s:null},[r,e])}function tpe(t,e){return w.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 Uw;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(Uw||(Uw={}));var Wk;(function(t){t.Optimized="optimized"})(Wk||(Wk={}));const rO=new Map;function npe(t,e){let{dragging:n,dependencies:r,config:i}=e;const[s,o]=w.useState(null),{frequency:a,measure:l,strategy:c}=i,f=w.useRef(t),h=S(),m=zw(h),x=w.useCallback(function(M){M===void 0&&(M=[]),!m.current&&o(T=>T===null?M:T.concat(M.filter(A=>!T.includes(A))))},[m]),b=w.useRef(null),_=US(M=>{if(h&&!n)return rO;if(!M||M===rO||f.current!==t||s!=null){const T=new Map;for(let A of t){if(!A)continue;if(s&&s.length>0&&!s.includes(A.id)&&A.rect.current){T.set(A.id,A.rect.current);continue}const N=A.node.current,D=N?new C8(l(N),N):null;A.rect.current=D,D&&T.set(A.id,D)}return T}return M},[t,s,n,h,l]);return w.useEffect(()=>{f.current=t},[t]),w.useEffect(()=>{h||x()},[n,h]),w.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),w.useEffect(()=>{h||typeof a!="number"||b.current!==null||(b.current=setTimeout(()=>{x(),b.current=null},a))},[a,h,x,...r]),{droppableRects:_,measureDroppableContainers:x,measuringScheduled:s!=null};function S(){switch(c){case Uw.Always:return!1;case Uw.BeforeDragging:return n;default:return!n}}}function b$(t,e){return US(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function rpe(t,e){return b$(t,e)}function ipe(t){let{callback:e,disabled:n}=t;const r=M8(e),i=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return w.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function gC(t){let{callback:e,disabled:n}=t;const r=M8(e),i=w.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return w.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function spe(t){return new C8(eb(t),t)}function iO(t,e,n){e===void 0&&(e=spe);const[r,i]=w.useState(null);function s(){i(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}const f=e(t);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const o=ipe({callback(l){if(t)for(const c of l){const{type:f,target:h}=c;if(f==="childList"&&h instanceof HTMLElement&&h.contains(t)){s();break}}}}),a=gC({callback:s});return ph(()=>{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 ope(t){const e=b$(t);return f$(t,e)}const sO=[];function ape(t){const e=w.useRef(t),n=US(r=>t?r&&r!==sO&&t&&e.current&&t.parentNode===e.current.parentNode?r:mC(t):sO,[t]);return w.useEffect(()=>{e.current=t},[t]),n}function lpe(t){const[e,n]=w.useState(null),r=w.useRef(t),i=w.useCallback(s=>{const o=HA(s.target);o&&n(a=>a?(a.set(o,Gk(o)),new Map(a)):null)},[]);return w.useEffect(()=>{const s=r.current;if(t!==s){o(s);const a=t.map(l=>{const c=HA(l);return c?(c.addEventListener("scroll",i,{passive:!0}),[c,Gk(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=HA(l);c==null||c.removeEventListener("scroll",i)})}},[i,t]),w.useMemo(()=>t.length?e?Array.from(e.values()).reduce((s,o)=>F1(s,o),cf):v$(t):cf,[t,e])}function oO(t,e){e===void 0&&(e=[]);const n=w.useRef(null);return w.useEffect(()=>{n.current=null},e),w.useEffect(()=>{const r=t!==cf;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?Fw(t,n.current):cf}function cpe(t){w.useEffect(()=>{if(!pC)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 upe(t,e){return w.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,e)},n},{}),[t,e])}function _$(t){return w.useMemo(()=>t?Dhe(t):null,[t])}const aO=[];function dpe(t,e){e===void 0&&(e=eb);const[n]=t,r=_$(n?Vc(n):null),[i,s]=w.useState(aO);function o(){s(()=>t.length?t.map(l=>g$(l)?r:new C8(e(l),l)):aO)}const a=gC({callback:o});return ph(()=>{a==null||a.disconnect(),o(),t.forEach(l=>a==null?void 0:a.observe(l))},[t]),i}function fpe(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return FS(e)?e:t}function hpe(t){let{measure:e}=t;const[n,r]=w.useState(null),i=w.useCallback(c=>{for(const{target:f}of c)if(FS(f)){r(h=>{const m=e(f);return h?{...h,width:m.width,height:m.height}:m});break}},[e]),s=gC({callback:i}),o=w.useCallback(c=>{const f=fpe(c);s==null||s.disconnect(),f&&(s==null||s.observe(f)),r(f?e(f):null)},[e,s]),[a,l]=n5(o);return w.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const ppe=[{sensor:w0,options:{}},{sensor:_0,options:{}}],mpe={current:{}},g2={draggable:{measure:J9},droppable:{measure:J9,strategy:Uw.WhileDragging,frequency:Wk.Optimized},dragOverlay:{measure:eb}};class aw 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 gpe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new aw,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:r5},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:g2,measureDroppableContainers:r5,windowRect:null,measuringScheduled:!1},xpe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:r5,draggableNodes:new Map,over:null,measureDroppableContainers:r5},xC=w.createContext(xpe),w$=w.createContext(gpe);function vpe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new aw}}}function ype(t,e){switch(e.type){case ha.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ha.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 ha.DragEnd:case ha.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ha.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new aw(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case ha.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 aw(t.droppable.containers);return o.set(n,{...s,disabled:i}),{...t,droppable:{...t.droppable,containers:o}}}case ha.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const s=new aw(t.droppable.containers);return s.delete(n),{...t,droppable:{...t.droppable,containers:s}}}default:return t}}function bpe(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=w.useContext(xC),s=Bk(r),o=Bk(n==null?void 0:n.id);return w.useEffect(()=>{if(!e&&!r&&s&&o!=null){if(!T8(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 f of[l.current,c.current]){if(!f)continue;const h=phe(f);if(h){h.focus();break}}})}},[r,e,i,o,s]),null}function _pe(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,s)=>s({transform:i,...r}),n):n}function wpe(t){return w.useMemo(()=>({draggable:{...g2.draggable,...t==null?void 0:t.draggable},droppable:{...g2.droppable,...t==null?void 0:t.droppable},dragOverlay:{...g2.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 Spe(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const s=w.useRef(!1),{x:o,y:a}=typeof i=="boolean"?{x:i,y:i}:i;ph(()=>{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 f=n(c),h=f$(f,r);if(o||(h.x=0),a||(h.y=0),s.current=!0,Math.abs(h.x)>0||Math.abs(h.y)>0){const m=h$(c);m&&m.scrollBy({top:h.y,left:h.x})}},[e,o,a,r,n])}const S$=w.createContext({...cf,scaleX:1,scaleY:1});var qm;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(qm||(qm={}));const Sy=w.memo(function(e){var n,r,i,s;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:f=ppe,collisionDetection:h=Ehe,measuring:m,modifiers:x,...b}=e;const _=w.useReducer(ype,void 0,vpe),[S,M]=_,[T,A]=bhe(),[N,D]=w.useState(qm.Uninitialized),k=N===qm.Initialized,{draggable:{active:O,nodes:R,translate:L},droppable:{containers:B}}=S,H=O!=null?R.get(O):null,$=w.useRef({initial:null,translated:null}),G=w.useMemo(()=>{var ft;return O!=null?{id:O,data:(ft=H==null?void 0:H.data)!=null?ft:mpe,rect:$}:null},[O,H]),Z=w.useRef(null),[V,W]=w.useState(null),[J,ne]=w.useState(null),ie=zw(b,Object.values(b)),z=BS("DndDescribedBy",o),j=w.useMemo(()=>B.getEnabled(),[B]),X=wpe(m),{droppableRects:F,measureDroppableContainers:ce,measuringScheduled:oe}=npe(j,{dragging:k,dependencies:[L.x,L.y],config:X.droppable}),Q=epe(R,O),se=w.useMemo(()=>J?Hk(J):null,[J]),re=Ze(),K=rpe(Q,X.draggable.measure);Spe({activeNode:O!=null?R.get(O):null,config:re.layoutShiftCompensation,initialRect:K,measure:X.draggable.measure});const fe=iO(Q,X.draggable.measure,K),he=iO(Q?Q.parentElement:null),ae=w.useRef({activatorEvent:null,active:null,activeNode:Q,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:R,draggingNode:null,draggingNodeRect:null,droppableContainers:B,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Se=B.getNodeFor((n=ae.current.over)==null?void 0:n.id),de=hpe({measure:X.dragOverlay.measure}),Me=(r=de.nodeRef.current)!=null?r:Q,Ce=k?(i=de.rect)!=null?i:fe:null,Re=!!(de.nodeRef.current&&de.rect),le=ope(Re?null:fe),He=_$(Me?Vc(Me):null),Le=ape(k?Se??Q:null),ze=dpe(Le),Ve=_pe(x,{transform:{x:L.x-le.x,y:L.y-le.y,scaleX:1,scaleY:1},activatorEvent:J,active:G,activeNodeRect:fe,containerNodeRect:he,draggingNodeRect:Ce,over:ae.current.over,overlayNodeRect:de.rect,scrollableAncestors:Le,scrollableAncestorRects:ze,windowRect:He}),ue=se?F1(se,L):null,Y=lpe(Le),xe=oO(Y),we=oO(Y,[fe]),Te=F1(Ve,xe),ge=Ce?khe(Ce,Ve):null,Ue=G&&ge?h({active:G,collisionRect:ge,droppableRects:F,droppableContainers:j,pointerCoordinates:ue}):null,be=d$(Ue,"id"),[ke,qe]=w.useState(null),Qe=Re?Ve:F1(Ve,we),nt=Ahe(Qe,(s=ke==null?void 0:ke.rect)!=null?s:null,fe),st=w.useRef(null),Pe=w.useCallback((ft,lt)=>{let{sensor:Je,options:Ae}=lt;if(Z.current==null)return;const We=R.get(Z.current);if(!We)return;const De=ft.nativeEvent,Ne=new Je({active:Z.current,activeNode:We,event:De,options:Ae,context:ae,onAbort(dt){if(!R.get(dt))return;const{onDragAbort:kt}=ie.current,wt={id:dt};kt==null||kt(wt),T({type:"onDragAbort",event:wt})},onPending(dt,Pt,kt,wt){if(!R.get(dt))return;const{onDragPending:rn}=ie.current,Bt={id:dt,constraint:Pt,initialCoordinates:kt,offset:wt};rn==null||rn(Bt),T({type:"onDragPending",event:Bt})},onStart(dt){const Pt=Z.current;if(Pt==null)return;const kt=R.get(Pt);if(!kt)return;const{onDragStart:wt}=ie.current,Vt={activatorEvent:De,active:{id:Pt,data:kt.data,rect:$}};Yl.unstable_batchedUpdates(()=>{wt==null||wt(Vt),D(qm.Initializing),M({type:ha.DragStart,initialCoordinates:dt,active:Pt}),T({type:"onDragStart",event:Vt}),W(st.current),ne(De)})},onMove(dt){M({type:ha.DragMove,coordinates:dt})},onEnd:ot(ha.DragEnd),onCancel:ot(ha.DragCancel)});st.current=Ne;function ot(dt){return async function(){const{active:kt,collisions:wt,over:Vt,scrollAdjustedTranslate:rn}=ae.current;let Bt=null;if(kt&&rn){const{cancelDrop:Gt}=ie.current;Bt={activatorEvent:De,active:kt,collisions:wt,delta:rn,over:Vt},dt===ha.DragEnd&&typeof Gt=="function"&&await Promise.resolve(Gt(Bt))&&(dt=ha.DragCancel)}Z.current=null,Yl.unstable_batchedUpdates(()=>{M({type:dt}),D(qm.Uninitialized),qe(null),W(null),ne(null),st.current=null;const Gt=dt===ha.DragEnd?"onDragEnd":"onDragCancel";if(Bt){const Dt=ie.current[Gt];Dt==null||Dt(Bt),T({type:Gt,event:Bt})}})}}},[R]),Ke=w.useCallback((ft,lt)=>(Je,Ae)=>{const We=Je.nativeEvent,De=R.get(Ae);if(Z.current!==null||!De||We.dndKit||We.defaultPrevented)return;const Ne={active:De};ft(Je,lt.options,Ne)===!0&&(We.dndKit={capturedBy:lt.sensor},Z.current=Ae,Pe(Je,lt))},[R,Pe]),rt=tpe(f,Ke);cpe(f),ph(()=>{fe&&N===qm.Initializing&&D(qm.Initialized)},[fe,N]),w.useEffect(()=>{const{onDragMove:ft}=ie.current,{active:lt,activatorEvent:Je,collisions:Ae,over:We}=ae.current;if(!lt||!Je)return;const De={active:lt,activatorEvent:Je,collisions:Ae,delta:{x:Te.x,y:Te.y},over:We};Yl.unstable_batchedUpdates(()=>{ft==null||ft(De),T({type:"onDragMove",event:De})})},[Te.x,Te.y]),w.useEffect(()=>{const{active:ft,activatorEvent:lt,collisions:Je,droppableContainers:Ae,scrollAdjustedTranslate:We}=ae.current;if(!ft||Z.current==null||!lt||!We)return;const{onDragOver:De}=ie.current,Ne=Ae.get(be),ot=Ne&&Ne.rect.current?{id:Ne.id,rect:Ne.rect.current,data:Ne.data,disabled:Ne.disabled}:null,dt={active:ft,activatorEvent:lt,collisions:Je,delta:{x:We.x,y:We.y},over:ot};Yl.unstable_batchedUpdates(()=>{qe(ot),De==null||De(dt),T({type:"onDragOver",event:dt})})},[be]),ph(()=>{ae.current={activatorEvent:J,active:G,activeNode:Q,collisionRect:ge,collisions:Ue,droppableRects:F,draggableNodes:R,draggingNode:Me,draggingNodeRect:Ce,droppableContainers:B,over:ke,scrollableAncestors:Le,scrollAdjustedTranslate:Te},$.current={initial:Ce,translated:ge}},[G,Q,Ue,ge,R,Me,Ce,F,B,ke,Le,Te]),Zhe({...re,delta:L,draggingRect:ge,pointerCoordinates:ue,scrollableAncestors:Le,scrollableAncestorRects:ze});const ye=w.useMemo(()=>({active:G,activeNode:Q,activeNodeRect:fe,activatorEvent:J,collisions:Ue,containerNodeRect:he,dragOverlay:de,draggableNodes:R,droppableContainers:B,droppableRects:F,over:ke,measureDroppableContainers:ce,scrollableAncestors:Le,scrollableAncestorRects:ze,measuringConfiguration:X,measuringScheduled:oe,windowRect:He}),[G,Q,fe,J,Ue,he,de,R,B,F,ke,ce,Le,ze,X,oe,He]),$e=w.useMemo(()=>({activatorEvent:J,activators:rt,active:G,activeNodeRect:fe,ariaDescribedById:{draggable:z},dispatch:M,draggableNodes:R,over:ke,measureDroppableContainers:ce}),[J,rt,G,fe,M,z,R,ke,ce]);return ri.createElement(l$.Provider,{value:A},ri.createElement(xC.Provider,{value:$e},ri.createElement(w$.Provider,{value:ye},ri.createElement(S$.Provider,{value:nt},c)),ri.createElement(bpe,{disabled:(a==null?void 0:a.restoreFocus)===!1})),ri.createElement(She,{...a,hiddenTextDescribedById:z}));function Ze(){const ft=(V==null?void 0:V.autoScrollEnabled)===!1,lt=typeof l=="object"?l.enabled===!1:l===!1,Je=k&&!ft&&!lt;return typeof l=="object"?{...l,enabled:Je}:{enabled:Je}}}),Mpe=w.createContext(null),lO="button",Tpe="Draggable";function Cpe(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const s=BS(Tpe),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:f,draggableNodes:h,over:m}=w.useContext(xC),{role:x=lO,roleDescription:b="draggable",tabIndex:_=0}=i??{},S=(l==null?void 0:l.id)===e,M=w.useContext(S?S$:Mpe),[T,A]=n5(),[N,D]=n5(),k=upe(o,e),O=zw(n);ph(()=>(h.set(e,{id:e,key:s,node:T,activatorNode:N,data:O}),()=>{const L=h.get(e);L&&L.key===s&&h.delete(e)}),[h,e]);const R=w.useMemo(()=>({role:x,tabIndex:_,"aria-disabled":r,"aria-pressed":S&&x===lO?!0:void 0,"aria-roledescription":b,"aria-describedby":f.draggable}),[r,x,_,S,b,f.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:R,isDragging:S,listeners:r?void 0:k,node:T,over:m,setNodeRef:A,setActivatorNodeRef:D,transform:M}}function Epe(){return w.useContext(w$)}const Ape="Droppable",Npe={timeout:25};function kpe(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const s=BS(Ape),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=w.useContext(xC),f=w.useRef({disabled:n}),h=w.useRef(!1),m=w.useRef(null),x=w.useRef(null),{disabled:b,updateMeasurementsFor:_,timeout:S}={...Npe,...i},M=zw(_??r),T=w.useCallback(()=>{if(!h.current){h.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{c(Array.isArray(M.current)?M.current:[M.current]),x.current=null},S)},[S]),A=gC({callback:T,disabled:b||!o}),N=w.useCallback((R,L)=>{A&&(L&&(A.unobserve(L),h.current=!1),R&&A.observe(R))},[A]),[D,k]=n5(N),O=zw(e);return w.useEffect(()=>{!A||!D.current||(A.disconnect(),h.current=!1,A.observe(D.current))},[D,A]),w.useEffect(()=>(a({type:ha.RegisterDroppable,element:{id:r,key:s,disabled:n,node:D,rect:m,data:O}}),()=>a({type:ha.UnregisterDroppable,key:s,id:r})),[r]),w.useEffect(()=>{n!==f.current.disabled&&(a({type:ha.SetDroppableDisabled,id:r,key:s,disabled:n}),f.current.disabled=n)},[r,s,n,a]),{active:o,rect:m,isOver:(l==null?void 0:l.id)===r,node:D,over:l,setNodeRef:k}}function S0(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Rpe(t,e){return t.reduce((n,r,i)=>{const s=e.get(r);return s&&(n[i]=s),n},Array(t.length))}function D4(t){return t!==null&&t>=0}function Ppe(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 Ipe(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const HS=t=>{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const s=S0(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}},O4={scaleX:1,scaleY:1},A8=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,...O4}:null}const l=Dpe(s,i,n);return i>n&&i<=o?{x:0,y:-a.height-l,...O4}:i<n&&i>=o?{x:0,y:a.height+l,...O4}:{x:0,y:0,...O4}};function Dpe(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 M$="Sortable",T$=ri.createContext({activeIndex:-1,containerId:M$,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:HS,disabled:{draggable:!1,droppable:!1}});function My(t){let{children:e,id:n,items:r,strategy:i=HS,disabled:s=!1}=t;const{active:o,dragOverlay:a,droppableRects:l,over:c,measureDroppableContainers:f}=Epe(),h=BS(M$,n),m=a.rect!==null,x=w.useMemo(()=>r.map(k=>typeof k=="object"&&"id"in k?k.id:k),[r]),b=o!=null,_=o?x.indexOf(o.id):-1,S=c?x.indexOf(c.id):-1,M=w.useRef(x),T=!Ppe(x,M.current),A=S!==-1&&_===-1||T,N=Ipe(s);ph(()=>{T&&b&&f(x)},[T,x,b,f]),w.useEffect(()=>{M.current=x},[x]);const D=w.useMemo(()=>({activeIndex:_,containerId:h,disabled:N,disableTransforms:A,items:x,overIndex:S,useDragOverlay:m,sortedRects:Rpe(x,l),strategy:i}),[_,h,N.draggable,N.droppable,A,x,S,l,m,i]);return ri.createElement(T$.Provider,{value:D},e)}const Ope=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return S0(n,r,i).indexOf(e)},Lpe=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},jpe={duration:200,easing:"ease"},C$="transform",zpe=by.Transition.toString({property:C$,duration:0,easing:"linear"}),Fpe={roleDescription:"sortable"};function Upe(t){let{disabled:e,index:n,node:r,rect:i}=t;const[s,o]=w.useState(null),a=w.useRef(n);return ph(()=>{if(!e&&n!==a.current&&r.current){const l=i.current;if(l){const c=eb(r.current,{ignoreTransform:!0}),f={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(f.x||f.y)&&o(f)}}n!==a.current&&(a.current=n)},[e,n,r,i]),w.useEffect(()=>{s&&o(null)},[s]),s}function vC(t){let{animateLayoutChanges:e=Lpe,attributes:n,disabled:r,data:i,getNewIndex:s=Ope,id:o,strategy:a,resizeObserverConfig:l,transition:c=jpe}=t;const{items:f,containerId:h,activeIndex:m,disabled:x,disableTransforms:b,sortedRects:_,overIndex:S,useDragOverlay:M,strategy:T}=w.useContext(T$),A=Bpe(r,x),N=f.indexOf(o),D=w.useMemo(()=>({sortable:{containerId:h,index:N,items:f},...i}),[h,i,N,f]),k=w.useMemo(()=>f.slice(f.indexOf(o)),[f,o]),{rect:O,node:R,isOver:L,setNodeRef:B}=kpe({id:o,data:D,disabled:A.droppable,resizeObserverConfig:{updateMeasurementsFor:k,...l}}),{active:H,activatorEvent:$,activeNodeRect:G,attributes:Z,setNodeRef:V,listeners:W,isDragging:J,over:ne,setActivatorNodeRef:ie,transform:z}=Cpe({id:o,data:D,attributes:{...Fpe,...n},disabled:A.draggable}),j=uhe(B,V),X=!!H,F=X&&!b&&D4(m)&&D4(S),ce=!M&&J,oe=ce&&F?z:null,se=F?oe??(a??T)({rects:_,activeNodeRect:G,activeIndex:m,overIndex:S,index:N}):null,re=D4(m)&&D4(S)?s({id:o,items:f,activeIndex:m,overIndex:S}):N,K=H==null?void 0:H.id,fe=w.useRef({activeId:K,items:f,newIndex:re,containerId:h}),he=f!==fe.current.items,ae=e({active:H,containerId:h,isDragging:J,isSorting:X,id:o,index:N,items:f,newIndex:fe.current.newIndex,previousItems:fe.current.items,previousContainerId:fe.current.containerId,transition:c,wasDragging:fe.current.activeId!=null}),Se=Upe({disabled:!ae,index:N,node:R,rect:O});return w.useEffect(()=>{X&&fe.current.newIndex!==re&&(fe.current.newIndex=re),h!==fe.current.containerId&&(fe.current.containerId=h),f!==fe.current.items&&(fe.current.items=f)},[X,re,h,f]),w.useEffect(()=>{if(K===fe.current.activeId)return;if(K!=null&&fe.current.activeId==null){fe.current.activeId=K;return}const Me=setTimeout(()=>{fe.current.activeId=K},50);return()=>clearTimeout(Me)},[K]),{active:H,activeIndex:m,attributes:Z,data:D,rect:O,index:N,newIndex:re,items:f,isOver:L,isSorting:X,isDragging:J,listeners:W,node:R,overIndex:S,over:ne,setNodeRef:j,setActivatorNodeRef:ie,setDroppableNodeRef:B,setDraggableNodeRef:V,transform:Se??se,transition:de()};function de(){if(Se||he&&fe.current.newIndex===N)return zpe;if(!(ce&&!T8($)||!c)&&(X||ae))return by.Transition.toString({...c,property:C$})}}function Bpe(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 s5(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 Hpe=[hi.Down,hi.Right,hi.Up,hi.Left],Ty=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:s,over:o,scrollableAncestors:a}}=e;if(Hpe.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];s.getEnabled().forEach(h=>{if(!h||h!=null&&h.disabled)return;const m=i.get(h.id);if(m)switch(t.code){case hi.Down:r.top<m.top&&l.push(h);break;case hi.Up:r.top>m.top&&l.push(h);break;case hi.Left:r.left>m.left&&l.push(h);break;case hi.Right:r.left<m.left&&l.push(h);break}});const c=The({collisionRect:r,droppableRects:i,droppableContainers:l});let f=d$(c,"id");if(f===(o==null?void 0:o.id)&&c.length>1&&(f=c[1].id),f!=null){const h=s.get(n.id),m=s.get(f),x=m?i.get(m.id):null,b=m==null?void 0:m.node.current;if(b&&x&&h&&m){const S=mC(b).some((k,O)=>a[O]!==k),M=E$(h,m),T=Gpe(h,m),A=S||!M?{x:0,y:0}:{x:T?r.width-x.width:0,y:T?r.height-x.height:0},N={x:x.left,y:x.top};return A.x&&A.y?N:Fw(N,A)}}}};function E$(t,e){return!s5(t)||!s5(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Gpe(t,e){return!s5(t)||!s5(e)||!E$(t,e)?!1:t.data.current.sortable.index<e.data.current.sortable.index}function hd({className:t,size:e="default",...n}){return d.jsx("div",{"data-slot":"card","data-size":e,className:vt("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 cO({className:t,...e}){return d.jsx("div",{"data-slot":"card-header",className:vt("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 L4({className:t,...e}){return d.jsx("div",{"data-slot":"card-title",className:vt("text-base leading-snug font-medium group-data-[size=sm]/card:text-sm",t),...e})}function j4({className:t,...e}){return d.jsx("div",{"data-slot":"card-description",className:vt("text-muted-foreground text-sm",t),...e})}function dh({className:t,...e}){return d.jsx("div",{"data-slot":"card-content",className:vt("px-4 group-data-[size=sm]/card:px-3",t),...e})}function up({className:t,...e}){return d.jsx("div",{"data-slot":"skeleton",className:vt("bg-muted rounded-md animate-pulse",t),...e})}const A$=g8("hover:text-foreground aria-pressed:bg-muted focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[state=on]:bg-muted gap-1 rounded-lg text-sm font-medium transition-all [&_svg:not([class*='size-'])]:size-4 group/toggle hover:bg-muted inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border-input hover:bg-muted border bg-transparent",selecting:"bg-accent text-muted-foreground data-[state=on]:bg-primary data-[state=on]:text-secondary hover:text-accent-foreground"},size:{default:"h-8 min-w-8 px-2",sm:"h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-1.5 text-[0.8rem]",lg:"h-9 min-w-9 px-2.5"}},defaultVariants:{variant:"default",size:"default"}});function U1({className:t,variant:e="default",size:n="default",...r}){return d.jsx(zle,{"data-slot":"toggle",className:vt(A$({variant:e,size:n,className:t})),...r})}const N$=w.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function M0({className:t,variant:e,size:n,spacing:r=0,orientation:i="horizontal",children:s,...o}){return d.jsx(Gle,{"data-slot":"toggle-group","data-variant":e,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:vt("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:d.jsx(N$.Provider,{value:{variant:e,size:n,spacing:r,orientation:i},children:s})})}function Ka({className:t,children:e,variant:n="default",size:r="default",...i}){const s=w.useContext(N$);return d.jsx(Vle,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:vt("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",A$({variant:s.variant||n,size:s.size||r}),t),...i,children:e})}function Bw({label:t,enabled:e,onEnabledChange:n,value:r,onValueChange:i,onValueCommit:s,inputType:o="number",inputMin:a,inputMax:l,inputWidth:c="w-12",icon:f,variant:h="default",size:m="default",className:x}){const b=M=>{M.key==="Enter"&&(e||n(!0),s(r),M.currentTarget.blur())},_=()=>{s(r)},S=h==="selecting";return d.jsxs("div",{className:vt("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",S&&"bg-accent",S&&e&&"bg-primary",x),children:[d.jsxs(U1,{variant:h,size:m,pressed:e,onPressedChange:n,className:vt("gap-1.5 border-0 rounded-r-none pr-1",m==="sm"&&"text-xs px-2"),children:[f,d.jsx("span",{children:t})]}),d.jsx("input",{type:o,min:a,max:l,value:r,onChange:M=>i(M.target.value),onKeyDown:b,onBlur:_,className:vt("bg-transparent text-center font-medium outline-none rounded-r-lg transition-colors",c,m==="default"&&"h-8 text-sm",m==="sm"&&"h-7 text-xs",S?e?"text-secondary":"text-muted-foreground/50":e?"text-foreground":"text-muted-foreground/50")})]})}const Vpe=g8("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Cy({className:t,variant:e="default",asChild:n=!1,...r}){const i=n?gB:"span";return d.jsx(i,{"data-slot":"badge","data-variant":e,className:vt(Vpe({variant:e}),t),...r})}const k$="...";function Wpe(t,e){if(!t||e<=0||t.length<=e)return{prefix:t,suffix:"",isTruncated:!1};const n=e-k$.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 A1({text:t,className:e,tooltipClassName:n,ellipsisClassName:r,ellipsisFadeClassName:i,tooltipDelay:s=300}){const o=w.useRef(null),a=w.useRef(null),[l,c]=w.useState({prefix:t,suffix:"",isTruncated:!1}),f=w.useCallback(()=>{const m=o.current,x=a.current;if(!m||!x)return;const b=m.getBoundingClientRect().width,_=x.getBoundingClientRect().width;if(!b||!_)return;if(_<=b){c(A=>A.isTruncated||A.prefix!==t?{prefix:t,suffix:"",isTruncated:!1}:A);return}const S=_/Math.max(1,t.length),M=Math.max(1,Math.floor(b/S)),T=Wpe(t,M);c(A=>A.prefix===T.prefix&&A.suffix===T.suffix&&A.isTruncated===T.isTruncated?A:T)},[t]);w.useLayoutEffect(()=>{f();const m=o.current;if(!m||typeof ResizeObserver>"u")return;const x=new ResizeObserver(()=>{f()});return x.observe(m),()=>x.disconnect()},[f]);const h=d.jsxs("span",{ref:o,className:vt("relative flex w-full min-w-0 items-center overflow-hidden whitespace-nowrap",e),children:[d.jsx("span",{ref:a,className:"pointer-events-none absolute -z-10 opacity-0","aria-hidden":"true",children:t||"M"}),l.isTruncated?d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"shrink-0",children:l.prefix}),d.jsx("span",{className:vt("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:k$}),d.jsx("span",{className:"shrink-0",children:l.suffix})]}):d.jsx("span",{className:"truncate",children:t})]});return l.isTruncated?d.jsxs(Np,{delayDuration:s,children:[d.jsx(kp,{asChild:!0,children:h}),d.jsx(Rp,{side:"top",className:vt("max-w-xs break-all text-[11px]",n),children:t})]}):h}function $k(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 R$(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 uO(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"?$k(t):String(t)}function dO(t){const e=t.split("/");return e[e.length-1].replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function N8(t,e){return t===e?!0:t==null?e==null:e==null?!1:typeof t=="object"||typeof e=="object"?$k(t)===$k(e):String(t)===String(e)}function $pe(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 f=R$(c);if(f===null)continue;let h=!1;for(const m of e)if(m.match(l)){n.get(m.key).items.push({key:l,displayKey:dO(l),value:f}),h=!0;break}h||(n.has("other")||n.set("other",{key:"other",label:"Other",items:[]}),n.get("other").items.push({key:l,displayKey:dO(l),value:f}))}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 f=new Map(c.order.map((h,m)=>[h,m]));l.items.sort((h,m)=>{const x=f.get(h.key)??1/0,b=f.get(m.key)??1/0;return x!==b?x-b:h.key.localeCompare(m.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 fO(t){const e=new Map;for(const[n,r]of Object.entries(t)){if(n==="_wandb")continue;const i=R$(r);i!==null&&e.set(n,i)}return e}function k8(t,e,n){return t.subcategories?t.subcategories.some(r=>k8(r,e,n)):t.items.some(r=>{const i=e.get(r.key),s=n.get(r.key);return!N8(i,s)})}function qpe({runs:t,currentRunId:e,onSelect:n}){return d.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 d.jsxs("button",{onClick:()=>!i&&n(r.run_id),disabled:i,className:vt("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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-full shrink-0",style:{backgroundColor:r.color}}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"min-w-0",children:d.jsx(A1,{text:s,className:"text-sm font-medium"})}),d.jsx("div",{className:"truncate text-xs text-muted-foreground",children:r.run_id})]}),i&&d.jsx(Cy,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),r.is_tracking&&d.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0",title:"Live"}),r.is_syncing&&d.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),r.created_at&&d.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:my(r.created_at)})]},r.run_id)}),t.length===0&&d.jsx("div",{className:"text-sm text-muted-foreground text-center py-4",children:"No other runs available"})]})}function hO({value:t,formatted:e,isDifferent:n}){const r=e.length>20,i=d.jsx("span",{className:vt("text-sm font-sans truncate block max-w-full overflow-hidden text-ellipsis",n?"font-medium":"text-muted-foreground"),children:e});return r?d.jsxs(Np,{children:[d.jsx(kp,{asChild:!0,children:i}),d.jsx(Rp,{side:"top",className:"max-w-xs break-all font-sans text-xs",children:e})]}):i}function Xpe({displayKey:t,value1:e,value2:n,showOnlyDifferences:r}){const i=uO(e),s=uO(n),o=!N8(e,n);return r&&!o?null:d.jsxs("div",{className:vt("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:[d.jsxs(Np,{children:[d.jsx(kp,{asChild:!0,children:d.jsx("span",{className:vt("text-sm truncate min-w-0",o?"text-foreground":"text-muted-foreground"),children:t})}),d.jsx(Rp,{side:"left",className:"text-xs",children:t})]}),d.jsx("div",{className:"min-w-0 overflow-hidden",children:d.jsx(hO,{value:e,formatted:i,isDifferent:o})}),d.jsx("div",{className:"min-w-0 overflow-hidden",children:d.jsx(hO,{value:n,formatted:s,isDifferent:o})})]})}const Ype="ml-[22px]",Kpe="ml-[38px]";function P$({category:t,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:i=!1,defaultOpen:s}){const o=k8(t,e,n),[a,l]=w.useState(s??o);if(r&&!o)return null;const c=t.subcategories&&t.subcategories.length>0;return d.jsxs(Pi,{open:a,onOpenChange:l,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:vt("py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",i&&"ml-4",!o&&"opacity-40"),children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!a&&"-rotate-90")}),d.jsx("span",{className:"text-sm font-semibold",children:t.label})]})})}),d.jsx(Di,{children:c?d.jsx("div",{className:"mt-1",children:t.subcategories.map(f=>d.jsx(P$,{category:f,config1Map:e,config2Map:n,showOnlyDifferences:r,nested:!0},f.key))}):d.jsx("div",{className:vt("mt-1",i?Kpe:Ype),children:t.items.map(f=>d.jsx(Xpe,{displayKey:f.displayKey,value1:e.get(f.key),value2:n.get(f.key),showOnlyDifferences:r},f.key))})})]})}function Zpe({config1:t,config2:e,run1Name:n,run2Name:r,run1Path:i,run2Path:s,run1Color:o,run2Color:a}){const[l,c]=w.useState(!0),f=w.useMemo(()=>fO(t),[t]),h=w.useMemo(()=>fO(e),[e]),m=w.useMemo(()=>{const _={...t};for(const[S,M]of Object.entries(e))S in _||(_[S]=M);return _},[t,e]),x=w.useMemo(()=>$pe(m),[m]),b=w.useMemo(()=>{let _=0;for(const[S,M]of f){const T=h.get(S);N8(M,T)||_++}for(const[S]of h)f.has(S)||_++;return _},[f,h]);return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between gap-4 pb-2 border-b",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsxs(Cy,{variant:"secondary",className:"text-xs",children:[b," difference",b!==1?"s":""]})}),d.jsxs(M0,{type:"single",value:l?"differences":"everything",onValueChange:_=>{_&&c(_==="differences")},variant:"outline",size:"sm",children:[d.jsx(Ka,{value:"everything",className:"text-xs px-3",children:"Everything"}),d.jsx(Ka,{value:"differences",className:"text-xs px-3",children:"Only differences"})]})]}),d.jsxs("div",{className:"grid grid-cols-[1fr_2fr_2fr] gap-3 pb-2 border-b text-sm font-medium",children:[d.jsx("span",{className:"text-muted-foreground",children:"Config"}),d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:o}}),d.jsx(A1,{text:n,className:"text-sm font-medium min-w-0"})]}),d.jsx("div",{className:"ml-4",children:d.jsx(A1,{text:i,className:"text-xs font-normal text-muted-foreground min-w-0"})})]}),d.jsxs("div",{className:"min-w-0",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:a}}),d.jsx(A1,{text:r,className:"text-sm font-medium min-w-0"})]}),d.jsx("div",{className:"ml-4",children:d.jsx(A1,{text:s,className:"text-xs font-normal text-muted-foreground min-w-0"})})]})]}),d.jsx($x,{className:"h-[72vh]",children:d.jsx("div",{className:"space-y-1 pr-4",children:x.map(_=>{let S;return _.key==="hardware"&&(S=x.filter(T=>T.key!=="hardware"&&k8(T,f,h)).length===0),d.jsx(P$,{category:_,config1Map:f,config2Map:h,showOnlyDifferences:l,defaultOpen:S},_.key)})})})]})}function Qpe({currentRunId:t,currentConfig:e}){const[n,r]=w.useState(!1),[i,s]=w.useState(null),{data:o,isLoading:a}=G0(),l=(o==null?void 0:o.runs)||[],{data:c,isLoading:f}=Sh(i||"",!!i,!1),h=l.find(N=>N.run_id===t),m=l.find(N=>N.run_id===i),x=(h==null?void 0:h.color)??"",b=(m==null?void 0:m.color)??"",_=N=>{s(N)},S=()=>{s(null)},M=()=>{r(!1),setTimeout(()=>s(null),200)},T=(h==null?void 0:h.name)||t.split("/").pop()||t,A=(m==null?void 0:m.name)||(i==null?void 0:i.split("/").pop())||"";return d.jsxs(Lc,{open:n,onOpenChange:N=>{N?r(!0):M()},children:[d.jsx(sC,{asChild:!0,children:d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Compare"})}),d.jsx(jc,{className:"sm:max-w-7xl max-h-[95vh]",children:i?d.jsxs(d.Fragment,{children:[d.jsx(Wl,{children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Sn,{variant:"ghost",size:"sm",onClick:S,className:"h-7 px-2",children:"← Back"}),d.jsx("div",{children:d.jsx($l,{children:"Configuration Comparison"})})]})}),f?d.jsxs("div",{className:"flex items-center justify-center py-16",children:[d.jsx(Ya,{className:"h-6 w-6"}),d.jsx("span",{className:"ml-3 text-muted-foreground",children:"Loading configuration..."})]}):c!=null&&c.config?d.jsx(Zpe,{config1:c.config,config2:e,run1Name:A,run2Name:T,run1Path:i||"",run2Path:t,run1Color:b,run2Color:x}):d.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No configuration data available for the selected run."})]}):d.jsxs(d.Fragment,{children:[d.jsxs(Wl,{children:[d.jsx($l,{children:"Compare Configuration"}),d.jsxs(cp,{children:["Select another run to compare its configuration with"," ",d.jsx("span",{className:"font-sans text-foreground",children:T})]})]}),d.jsx($x,{className:"h-[500px] pr-4",children:a?d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx(Ya,{className:"h-5 w-5"})}):d.jsx(qpe,{runs:l,currentRunId:t,onSelect:_})})]})})]})}class Jpe{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=T=>{if(T=this.postProcess(T,r),i){setTimeout(function(){i(T)},0);return}else return T},a=n.length,l=e.length;let c=1,f=a+l;r.maxEditLength!=null&&(f=Math.min(f,r.maxEditLength));const h=(s=r.timeout)!==null&&s!==void 0?s:1/0,m=Date.now()+h,x=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(x[0],n,e,0,r);if(x[0].oldPos+1>=l&&b+1>=a)return o(this.buildValues(x[0].lastComponent,n,e));let _=-1/0,S=1/0;const M=()=>{for(let T=Math.max(_,-c);T<=Math.min(S,c);T+=2){let A;const N=x[T-1],D=x[T+1];N&&(x[T-1]=void 0);let k=!1;if(D){const R=D.oldPos-T;k=D&&0<=R&&R<a}const O=N&&N.oldPos+1<l;if(!k&&!O){x[T]=void 0;continue}if(!O||k&&N.oldPos<D.oldPos?A=this.addToPath(D,!0,!1,0,r):A=this.addToPath(N,!1,!0,1,r),b=this.extractCommon(A,n,e,T,r),A.oldPos+1>=l&&b+1>=a)return o(this.buildValues(A.lastComponent,n,e))||!0;x[T]=A,A.oldPos+1>=l&&(S=Math.min(S,T-1)),b+1>=a&&(_=Math.max(_,T+1))}c++};if(i)(function T(){setTimeout(function(){if(c>f||Date.now()>m)return i(void 0);M()||T()},0)})();else for(;c<=f&&Date.now()<=m;){const T=M();if(T)return T}}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,f=0;for(;c+1<o&&l+1<a&&this.equals(r[l+1],n[c+1],s);)c++,l++,f++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return f&&!s.oneChangePerToken&&(e.lastComponent={count:f,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 f=i[a];if(f.removed)f.value=this.join(r.slice(c,c+f.count)),c+=f.count;else{if(!f.added&&this.useLongestToken){let h=n.slice(l,l+f.count);h=h.map(function(m,x){const b=r[c+x];return b.length>m.length?b:m}),f.value=this.join(h)}else f.value=this.join(n.slice(l,l+f.count));l+=f.count,f.added||(c+=f.count)}}return i}}class eme extends Jpe{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const tme=new eme;function nme(t,e,n){return tme.diff(t,e,n)}function rme({runs:t,currentRunId:e,selectedCompareRunId:n,onSelect:r}){return d.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 d.jsxs("button",{onClick:()=>!s&&r(i.run_id),disabled:s,className:vt("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left transition-colors",s?"cursor-not-allowed opacity-40":vt("cursor-pointer hover:bg-muted",o&&"bg-muted")),children:[d.jsx("div",{className:"h-2.5 w-2.5 shrink-0 rounded-full",style:{backgroundColor:i.color}}),d.jsxs("div",{className:"min-w-0 flex-1",children:[d.jsx("div",{className:"min-w-0",children:d.jsx(A1,{text:a,className:"text-sm font-medium"})}),d.jsx("div",{className:"truncate text-xs text-muted-foreground",children:i.run_id})]}),s&&d.jsx(Cy,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Current"}),!s&&o&&d.jsx(Cy,{variant:"secondary",className:"h-4 px-1.5 text-[10px] shrink-0",children:"Comparing"}),i.is_tracking&&d.jsx("span",{className:"h-2 w-2 rounded-full bg-green-500 shrink-0",title:"Live"}),i.is_syncing&&d.jsx("span",{className:"h-2 w-2 rounded-full bg-blue-500 shrink-0",title:"Syncing"}),i.created_at&&d.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:my(i.created_at)})]},i.run_id)}),t.length===0&&d.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"No other runs available."})]})}function pO({currentRunId:t,selectedCompareRunId:e,onSelectCompareRun:n,disabled:r=!1}){const[i,s]=w.useState(!1),{data:o,isLoading:a}=G0(),l=(o==null?void 0:o.runs)??[],c=l.find(x=>x.run_id===t)??null,f=(c==null?void 0:c.name)||t.split("/").pop()||t,h=l.find(x=>x.run_id===e)??null,m=(h==null?void 0:h.name)||(h==null?void 0:h.run_id.split("/").pop())||null;return d.jsxs(Lc,{open:i,onOpenChange:x=>{s(x)},children:[d.jsx(sC,{asChild:!0,children:d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:r,children:"Compare"})}),d.jsxs(jc,{className:"sm:max-w-7xl max-h-[90vh]",children:[d.jsxs(Wl,{children:[d.jsx($l,{children:"Select Run To Compare"}),d.jsxs(cp,{children:["Choose another run to compare against"," ",d.jsx("span",{className:"font-sans text-foreground",children:f}),"."]})]}),e&&d.jsxs("div",{className:"flex items-center justify-between rounded-md border px-3 py-2 text-xs",children:[d.jsxs("span",{className:"text-muted-foreground",children:["Currently comparing with"," ",d.jsx("span",{className:"font-medium text-foreground",children:m||e})]}),d.jsx(Sn,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{n(null),s(!1)},children:"Stop comparing"})]}),d.jsx($x,{className:"h-[480px] pr-4",children:a?d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx(Ya,{className:"h-5 w-5"})}):d.jsx(rme,{runs:l,currentRunId:t,selectedCompareRunId:e,onSelect:x=>{n(x),s(!1)}})})]})]})}const ime={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"]},sme=new Set(["python","bash","yaml","toml"]),ome=new Set(["sql"]);function ame(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lme(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 cme(t){return sme.has(t)?"#.*$":ome.has(t)?"--.*$":t==="json"?null:"//.*$"}function Xm(t,e){if(t.length===0)return[{text:" "}];const n=ime[e]??[],r=new Set(n),i="\"(?:\\\\.|[^\"\\\\])*\"|'(?:\\\\.|[^'\\\\])*'|`(?:\\\\.|[^`\\\\])*`",s=cme(e),o=n.length>0?`\\b(?:${n.map(m=>ame(m)).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"),f=[];let h=0;for(const m of t.matchAll(c)){const x=m[0]??"",b=m.index;if(b===void 0||x.length===0)continue;b>h&&f.push({text:t.slice(h,b)});let _;x.startsWith('"')||x.startsWith("'")||x.startsWith("`")?_="text-emerald-600 dark:text-emerald-400":x.startsWith("#")||x.startsWith("//")||x.startsWith("--")?_="text-muted-foreground":r.has(x)?_="text-violet-600 dark:text-violet-400":/^\d/.test(x)&&(_="text-amber-600 dark:text-amber-400"),f.push({text:x,className:_}),h=b+x.length}return h<t.length&&f.push({text:t.slice(h)}),f}function ume(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 WA(t,e){const n=t.split(/\r?\n/);if(e!=="python")return n.map(s=>Xm(s,e));let r=null;const i=[];for(const s of n){if(s.length===0){i.push([{text:" "}]);continue}if(r){const m=s.indexOf(r);if(m===-1){i.push([{text:s,className:"text-muted-foreground"}]);continue}const x=s.slice(0,m+3),b=s.slice(m+3),_=[{text:x,className:"text-muted-foreground"}];r=null,b.length>0&&_.push(...Xm(b,e)),i.push(_);continue}const o=ume(s);if(!o){i.push(Xm(s,e));continue}const a=s.indexOf(o.quote,o.index+3),l=s.slice(0,o.index);if(a===-1){const m=[];l.length>0&&m.push(...Xm(l,e)),m.push({text:s.slice(o.index),className:"text-muted-foreground"}),i.push(m),r=o.quote;continue}const c=[],f=s.slice(o.index,a+3),h=s.slice(a+3);l.length>0&&c.push(...Xm(l,e)),c.push({text:f,className:"text-muted-foreground"}),h.length>0&&c.push(...Xm(h,e)),i.push(c)}return i}function mO(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 dme(t,e){const n=mO(t),r=mO(e),i=nme(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 I$(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)?I$(e.children):void 0}})}function D$(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 f=a?l?"common":"removed":"added";if(c.type==="directory"){const h=D$((a==null?void 0:a.children)??[],(l==null?void 0:l.children)??[]),m=f==="common"&&h.some(x=>x.status!=="common")?"modified":f;s.push({name:c.name,path:c.path,type:"directory",status:m,children:h})}else{const h=f==="common"&&(a==null?void 0:a.hash)!=null&&(l==null?void 0:l.hash)!=null&&a.hash!==l.hash?"modified":f;s.push({name:c.name,path:c.path,type:"file",status:h})}}return s}function fme(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 $A(t){const e=t.split("/"),n=[];for(let r=1;r<e.length;r++)n.push(e.slice(0,r).join("/"));return n}function hme(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 O$(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=O$(n.children);if(r)return r}}return null}function qk(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)&&qk(r.children,e))return!0;return!1}function L$(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)&&L$(r.children,e))return!0;return!1}function gO(t){const e=new Set;for(const n of t)n.type==="directory"&&e.add(n.path);return e}function pme({runPath:t,onBack:e}){const[n,r]=w.useState(null),[i,s]=w.useState(null),[o,a]=w.useState(null),[l,c]=w.useState(null),[f,h]=w.useState(0),[m,x]=w.useState(null),b=w.useRef({}),_=w.useRef({}),S=w.useRef(!1),M=w.useRef(null),T=w.useRef(null),{data:A}=G0(),N=(A==null?void 0:A.runs.find(It=>It.run_id===t))??null,D=(N==null?void 0:N.name)||t.split("/").pop()||t,k=(A==null?void 0:A.runs.find(It=>It.run_id===o))??null,O=(k==null?void 0:k.name)||(o==null?void 0:o.split("/").pop())||o,{data:R,isLoading:L,error:B}=$9(t,!!t),{data:H,isLoading:$,error:G}=$9(o||"",!!o),{data:Z,isFetching:V}=Afe(o||"",t,!!o&&!!(R!=null&&R.available)&&!!(H!=null&&H.available)&&!$),W=w.useMemo(()=>R!=null&&R.available?R.tree:[],[R]),J=w.useMemo(()=>H!=null&&H.available?H.tree:[],[H]),ne=o!==null,ie=ne&&!$&&(H==null?void 0:H.available)===!0,z=w.useMemo(()=>ie?D$(J,W):I$(W),[ie,W,J]),j=gO(z),X=n??j,F=z.length===0?null:i&&L$(z,i)?i:O$(z),ce=lme(F),oe=!!F&&qk(W,F),Q=!!F&&qk(J,F),{data:se,isLoading:re,isFetching:K,error:fe}=q9(t,F??"",!!t&&!!F&&!!(R!=null&&R.available)&&oe),{data:he,isLoading:ae,isFetching:Se,error:de}=q9(o??"",F??"",!!o&&!!F&&!!(H!=null&&H.available)&&Q),Me=oe?se:null,Ce=Q?he:null,Re=F&&(Me==null?void 0:Me.file_path)===F?Me:null,le=F&&(Ce==null?void 0:Ce.file_path)===F?Ce:null,He=(Me==null?void 0:Me.content)??null,Le=(Re==null?void 0:Re.content)??null,ze=(le==null?void 0:le.content)??null,Ve=oe?Le:"",ue=Q?ze:"",Y=F&&(m==null?void 0:m.targetPath)===F?m:null,we=ne&&!(Ve!==null&&ue!==null)&&Y!==null,Te=we?Y.rightContent:Ve,ge=we?Y.leftContent:ue,Ue=It=>{r(Lt=>{const zt=new Set(Lt??j);return zt.has(It)?zt.delete(It):zt.add(It),zt})},be=(It,Lt)=>It.map(zt=>{var tn;const pn=zt.status==="added"?"text-emerald-700 dark:text-emerald-400":zt.status==="removed"?"text-[#f27c7e] line-through":zt.status==="modified"?"text-[#ab6100]":"",Ot=zt.status==="added"?"text-emerald-700 dark:text-emerald-400":zt.status==="removed"?"text-[#f27c7e]":zt.status==="modified"?"text-[#ab6100]":"text-muted-foreground";if(zt.type==="directory"){const en=X.has(zt.path);return d.jsxs("div",{children:[d.jsxs("button",{type:"button",onClick:()=>Ue(zt.path),className:"flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",style:{paddingLeft:`${Lt*14+6}px`},children:[d.jsx("span",{className:vt("inline-flex h-4 w-4 items-center justify-center",Ot),children:en?d.jsx(Rr,{className:"h-3 w-3"}):d.jsx(p0,{className:"h-3 w-3"})}),en?d.jsx(Rde,{className:vt("h-3.5 w-3.5",Ot)}):d.jsx(Ide,{className:vt("h-3.5 w-3.5",Ot)}),d.jsx("span",{className:vt("truncate",pn),children:zt.name})]}),en&&((tn=zt.children)!=null&&tn.length)?be(zt.children,Lt+1):null]},zt.path)}const Ct=F===zt.path;return d.jsxs("button",{type:"button",ref:en=>{_.current[zt.path]=en},onClick:()=>{Gt(zt.path),s(zt.path),ne&&(h(0),S.current=!0,M.current=zt.path)},className:vt("flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-xs hover:bg-muted",Ct&&"bg-muted font-medium"),style:{paddingLeft:`${Lt*14+26}px`},children:[d.jsx(Nde,{className:vt("h-3.5 w-3.5",Ot)}),d.jsx("span",{className:vt("truncate",pn),children:zt.name})]},zt.path)}),ke=w.useMemo(()=>WA(He??"",ce),[He,ce]),qe=w.useMemo(()=>WA(ge??"",ce),[ge,ce]),Qe=w.useMemo(()=>WA(Te??"",ce),[Te,ce]),nt=w.useMemo(()=>!ne||!F?[]:dme(ge??"",Te??""),[ne,F,ge,Te]),st=!!F&&ne&&!we&&(oe&&Ve===null&&!fe||Q&&ue===null&&!de),Pe=!!F&&ne&&(oe&&K||Q&&Se),Ke=!oe||Re!==null&&!re&&!K,rt=!Q||le!==null&&!ae&&!Se,ye=!!(le!=null&&le.is_binary),$e=!!(Me!=null&&Me.is_binary),Ze=!!(Re!=null&&Re.is_binary),ft=ne?oe?Te:Q?ge:null:He,Je=!!F&&ft!==null&&!(ne?oe?Ze:Q?ye:!1:$e),Ae=w.useMemo(()=>hme(nt),[nt]),We=w.useMemo(()=>fme(z),[z]),De=F?We.indexOf(F):-1,Ne=Ae.length>0?(f%Ae.length+Ae.length)%Ae.length:0,ot=Ae.length>0?Ne+1:0,dt=We.length>0&&De>=0?De+1:0,Pt=w.useMemo(()=>nt.reduce((It,Lt)=>It+(Lt.kind==="add"?1:0),0),[nt]),kt=w.useMemo(()=>nt.reduce((It,Lt)=>It+(Lt.kind==="remove"?1:0),0),[nt]),wt=(Z==null?void 0:Z.added_lines)??0,Vt=(Z==null?void 0:Z.removed_lines)??0,rn=l!==null&&l===F,Bt=async()=>{!Je||ft===null||(await navigator.clipboard.writeText(ft),c(F),setTimeout(()=>c(null),2e3))},Gt=It=>{ne&&x({targetPath:It,leftContent:ge??"",rightContent:Te??""})},Dt=It=>{var pn;if(Ae.length===0)return;const Lt=(Ne+It+Ae.length)%Ae.length;h(Lt);const zt=Ae[Lt].startRowIndex;(pn=b.current[zt])==null||pn.scrollIntoView({behavior:"smooth",block:"center"})},Qt=It=>{if(We.length===0)return;const Lt=De<0?It===1?0:We.length-1:(De+It+We.length)%We.length;if(Lt===De)return;const zt=We[Lt];Gt(zt),s(zt),r(pn=>{const Ot=new Set(pn??j);for(const Ct of $A(zt))Ot.add(Ct);return Ot}),h(0),S.current=!0,M.current=zt,setTimeout(()=>{var pn;(pn=_.current[zt])==null||pn.scrollIntoView({behavior:"smooth",block:"center"})},0)},hn=()=>{if(We.length===0)return;const It=We[0];Gt(It),s(It),r(Lt=>{const zt=new Set(Lt??j);for(const pn of $A(It))zt.add(pn);return zt}),h(0),S.current=!0,M.current=It,setTimeout(()=>{var Lt;(Lt=_.current[It])==null||Lt.scrollIntoView({behavior:"smooth",block:"center"})},0)};return w.useEffect(()=>{T.current=o,o===null&&(S.current=!1,M.current=null)},[o]),w.useEffect(()=>{if(!ne||!o||!ie||T.current!==o||(T.current=null,We.length===0))return;const It=We[0];S.current=!0,M.current=It;const Lt=window.setTimeout(()=>{var zt;F!==It&&(x({targetPath:It,leftContent:ge??"",rightContent:Te??""}),s(It),r(pn=>{const Ot=new Set(pn??gO(z));for(const Ct of $A(It))Ot.add(Ct);return Ot})),h(0),(zt=_.current[It])==null||zt.scrollIntoView({behavior:"smooth",block:"center"})},0);return()=>window.clearTimeout(Lt)},[ne,o,ie,We,F,ge,Te,z]),w.useEffect(()=>{if(!ne||!F||!S.current||M.current!==null&&M.current!==F||!Ke||!rt)return;const It=Ae.length>0?Ae[0].startRowIndex:null,Lt=requestAnimationFrame(()=>{var zt;It!==null&&((zt=b.current[It])==null||zt.scrollIntoView({behavior:"smooth",block:"center"})),S.current=!1,M.current=null});return()=>cancelAnimationFrame(Lt)},[ne,F,Ae,Ke,rt]),d.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[ne&&O&&d.jsxs("div",{className:"flex h-9 items-center gap-2 border-b px-3 text-xs",children:[d.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 overflow-hidden",children:[d.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[d.jsx("span",{className:"truncate font-medium",children:O}),(k==null?void 0:k.created_at)&&d.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:my(k.created_at)})]}),d.jsx(cde,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),d.jsxs("div",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[d.jsx("span",{className:"truncate font-medium",children:D}),(N==null?void 0:N.created_at)&&d.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:my(N.created_at)})]})]}),d.jsxs("div",{className:"ml-2 flex shrink-0 items-center gap-2 tabular-nums",children:[d.jsxs("span",{className:vt("text-emerald-700 transition-opacity dark:text-emerald-400",V&&"opacity-70"),children:["+",wt]}),d.jsxs("span",{className:vt("text-red-500 transition-opacity dark:text-red-300",V&&"opacity-70"),children:["-",Vt]})]}),d.jsx(Sn,{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),x(null),h(0),S.current=!1,M.current=null},children:d.jsx(ka,{className:"h-3.5 w-3.5"})})]}),d.jsx("div",{className:"min-h-0 flex-1",children:L&&!R?d.jsx("div",{className:"h-full min-h-0"}):B?d.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d.jsx("div",{className:"flex h-10 items-center border-b px-2",children:d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[d.jsx(m2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]})}),d.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load code tree."})]}):R!=null&&R.available?d.jsxs("div",{className:"grid h-full min-h-0 overflow-hidden grid-cols-1 lg:grid-cols-[320px_minmax(0,1fr)]",children:[d.jsxs("div",{className:"flex min-h-0 flex-col border-b lg:border-b-0 lg:border-r",children:[d.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[d.jsx(m2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),d.jsx(pO,{currentRunId:t,selectedCompareRunId:o,onSelectCompareRun:a,disabled:!F})]}),d.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-2",children:be(z,0)})]}),d.jsxs("div",{className:"flex min-h-0 min-w-0 flex-col",children:[d.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-3",children:[d.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:F??"Select a file"}),F&&d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:Bt,disabled:!Je,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:rn?"Copied!":"Copy code",children:rn?d.jsx(H0,{className:"h-3.5 w-3.5"}):d.jsx(tC,{className:"h-3.5 w-3.5"})}),d.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:ce})]}),ne&&F&&d.jsxs("div",{className:"ml-1 flex shrink-0 items-center gap-2 text-[11px] tabular-nums",children:[d.jsxs("span",{className:"text-emerald-700 dark:text-emerald-400",children:["+",Pt]}),d.jsxs("span",{className:"text-red-500 dark:text-red-300",children:["-",kt]})]})]}),d.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[d.jsx("div",{className:vt("h-full overflow-auto",ne&&"pb-14"),children:F?ne?$&&!H?d.jsx("div",{className:"h-full"}):G?d.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load compared run code."}):o&&!$&&H&&!H.available?d.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Compared run has no downloaded code snapshot."}):st?d.jsx("div",{className:"h-full"}):oe&&fe&&!Re||Q&&de&&!le?d.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load one side of the comparison."}):Ze||ye?d.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Binary file comparison is not supported."}):d.jsx("div",{className:vt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",Pe&&"opacity-50"),children:nt.map((It,Lt)=>{const zt=It.kind==="add"?Qe[(It.rightLine??1)-1]??Xm(It.text.length>0?It.text:" ",ce):qe[(It.leftLine??1)-1]??Xm(It.text.length>0?It.text:" ",ce);return d.jsxs("div",{ref:pn=>{It.kind!=="context"&&(b.current[Lt]=pn)},className:vt("flex",It.kind==="add"&&"bg-emerald-500/18",It.kind==="remove"&&"bg-red-400/10"),children:[d.jsxs("div",{className:vt("sticky left-0 z-10 flex shrink-0 bg-background",It.kind==="add"&&"border-l-2 border-emerald-500/60",It.kind==="remove"&&"border-l-2 border-red-400/35"),children:[d.jsx("span",{className:vt("select-none w-6 px-1.5 py-0.5 text-right text-[11px]",It.kind==="add"&&"bg-emerald-500/18 text-emerald-700 dark:text-emerald-400",It.kind==="remove"&&"bg-red-400/10 text-red-500 dark:text-red-300",It.kind==="context"&&"text-muted-foreground"),children:It.kind==="add"?"+":It.kind==="remove"?"-":" "}),d.jsx("span",{className:vt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",It.kind==="add"&&"bg-emerald-500/18",It.kind==="remove"&&"bg-red-400/10"),children:It.leftLine??""}),d.jsx("span",{className:vt("select-none w-[3.25rem] border-r px-1.5 py-0.5 text-right text-[11px] text-muted-foreground",It.kind==="add"&&"bg-emerald-500/18",It.kind==="remove"&&"bg-red-400/10"),children:It.rightLine??""})]}),d.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:zt.map((pn,Ot)=>d.jsx("span",{className:vt(pn.className),children:pn.text},`diff-line-${Lt}-token-${Ot}`))})]},`diff-line-${Lt}`)})}):re&&!Me?d.jsx("div",{className:"h-full"}):fe&&!Me?d.jsx("div",{className:"p-4 text-sm text-destructive",children:"Failed to load file content."}):$e?d.jsx("div",{className:vt("p-4 text-sm text-muted-foreground transition-opacity",K&&"opacity-50"),children:"Binary file preview is not supported."}):d.jsxs("div",{className:vt("min-h-full min-w-max font-sans text-xs leading-5 transition-opacity",K&&"opacity-50"),children:[(Me==null?void 0:Me.truncated)&&d.jsx("div",{className:"border-b px-3 py-1 text-[11px] text-muted-foreground",children:"Showing first 2MB of this file."}),ke.map((It,Lt)=>d.jsxs("div",{className:"flex",children:[d.jsx("div",{className:"sticky left-0 z-10 flex shrink-0 bg-background",children:d.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:Lt+1})}),d.jsx("span",{className:"whitespace-pre px-3 py-0.5",children:It.map((zt,pn)=>d.jsx("span",{className:vt(zt.className),children:zt.text},`line-${Lt}-token-${pn}`))})]},`line-${Lt}`))]}):d.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Select a file on the left to view its source."})}),ne&&F&&d.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-3 flex justify-center",children:Ae.length===0?d.jsx("div",{className:"pointer-events-auto rounded-full border border-border/75 bg-background/90 px-2 py-1 backdrop-blur-sm",children:d.jsx(Sn,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:hn,disabled:We.length===0,children:d.jsxs("span",{className:"inline-flex items-center gap-1",children:[d.jsx("span",{children:"See Changes"}),d.jsx(p0,{className:"h-3.5 w-3.5"})]})})}):d.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:[d.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[d.jsx(Sn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Dt(-1),disabled:Ae.length===0,children:d.jsx(m8,{className:"h-3.5 w-3.5"})}),d.jsxs("span",{className:"min-w-[4rem] text-center tabular-nums",children:[ot," / ",Ae.length]}),d.jsx(Sn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Dt(1),disabled:Ae.length===0,children:d.jsx(Rr,{className:"h-3.5 w-3.5"})})]}),d.jsx("div",{className:"h-4 w-px bg-border"}),d.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[d.jsx(Sn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Qt(-1),disabled:We.length===0,children:d.jsx(eC,{className:"h-3.5 w-3.5"})}),d.jsxs("span",{className:"min-w-[6rem] text-center tabular-nums",children:[dt," / ",We.length," files"]}),d.jsx(Sn,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>Qt(1),disabled:We.length===0,children:d.jsx(p0,{className:"h-3.5 w-3.5"})})]})]})})]})]})]}):d.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[d.jsx(m2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),d.jsx(pO,{currentRunId:t,selectedCompareRunId:o,onSelectCompareRun:a,disabled:!F})]}),d.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"This run does not have a local `code/source.zip` extracted yet."})]})})]})}const xO={DEBUG:"text-muted-foreground",INFO:"text-blue-600 dark:text-blue-400",WARNING:"text-yellow-600 dark:text-yellow-400",ERROR:"text-red-600 dark:text-red-400",CRITICAL:"text-red-700 dark:text-red-500 font-bold"};function mme({runPath:t,onBack:e}){const[n,r]=w.useState(0),[i,s]=w.useState(null),[o,a]=w.useState(null),[l,c]=w.useState([]),[f,h]=w.useState(""),[m,x]=w.useState(""),b=w.useRef(null),_=w.useRef(null),{data:S}=Efe(t);w.useEffect(()=>{S&&(i===null&&S.components.length>0&&s(S.components[0]),o===null&&S.sources.length>0&&a(S.sources[0]))},[S,i,o]);const M=w.useMemo(()=>({components:i?[i]:void 0,levels:l.length>0?l:void 0,sources:o?[o]:void 0,search:m||void 0}),[i,l,o,m]),{data:T,isFetching:A}=Cfe(t,n,M);w.useEffect(()=>{r(0)},[i,l,o,m]);const N=w.useCallback(B=>{h(B),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>x(B),300)},[]),D=B=>{c(H=>H.includes(B)?H.filter($=>$!==B):[...H,B])},k=B=>new Date(B*1e3).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3}),O=(T==null?void 0:T.logs)??[],R=(T==null?void 0:T.total_pages)??1,L=(T==null?void 0:T.total)??0;return d.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[d.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:e,children:[d.jsx(m2,{className:"mr-1 h-3.5 w-3.5"}),"Back"]}),d.jsx("span",{className:"text-xs font-medium",children:"Logs"}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:[L.toLocaleString()," records"]}),A&&d.jsx("span",{className:"text-xs text-muted-foreground animate-pulse",children:"loading..."})]}),d.jsxs("div",{className:"flex h-10 items-center gap-2 border-b px-2",children:[((S==null?void 0:S.components.length)??0)>0&&d.jsxs(gy,{value:i??"",onValueChange:s,children:[d.jsx(vy,{size:"sm",className:"text-xs h-7 gap-1",children:d.jsx(xy,{placeholder:"Component"})}),d.jsx(yy,{children:((S==null?void 0:S.components)??[]).map(B=>d.jsx(Ox,{value:B,className:"text-xs",children:B},B))})]}),((S==null?void 0:S.sources.length)??0)>0&&d.jsxs(gy,{value:o??"",onValueChange:a,children:[d.jsx(vy,{size:"sm",className:"text-xs h-7 gap-1",children:d.jsx(xy,{placeholder:"Source"})}),d.jsx(yy,{children:((S==null?void 0:S.sources)??[]).map(B=>d.jsx(Ox,{value:B,className:"text-xs",children:B},B))})]}),d.jsx("div",{className:"flex items-center gap-1",children:((S==null?void 0:S.levels)??[]).map(B=>d.jsx("button",{onClick:()=>D(B),className:vt("px-1.5 py-0.5 text-[10px] rounded border transition-colors",l.includes(B)?"border-blue-600 bg-blue-600/10":l.length===0?"border-border hover:border-ring":"border-border text-muted-foreground/50 hover:border-ring",xO[B]??"text-muted-foreground"),children:B},B))}),d.jsxs("div",{className:"relative flex-1 max-w-xs",children:[d.jsx(Qde,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),d.jsx(tf,{type:"text",placeholder:"Search messages...",value:f,onChange:B=>N(B.target.value),className:"h-7 pl-7 pr-7 text-xs"}),f&&d.jsx("button",{onClick:()=>{h(""),x("")},className:"absolute right-2 top-1/2 -translate-y-1/2",children:d.jsx(ka,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-foreground"})})]})]}),d.jsx("div",{ref:b,className:"min-h-0 flex-1 overflow-auto font-mono text-[11px] leading-[18px]",children:O.length===0?d.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:L===0?"No logs available":"No logs match filters"}):d.jsx("table",{className:"w-full",children:d.jsx("tbody",{children:O.map((B,H)=>d.jsxs("tr",{className:"hover:bg-muted/50 align-top",children:[d.jsx("td",{className:"px-2 py-px text-muted-foreground whitespace-nowrap select-none",children:k(B.timestamp)}),d.jsx("td",{className:vt("px-1 py-px whitespace-nowrap w-[60px] select-none",xO[B.level]??"text-muted-foreground"),children:B.level.substring(0,5).padEnd(5)}),d.jsx("td",{className:"px-2 py-px text-foreground whitespace-pre-wrap break-all",children:B.message})]},`${n}-${H}`))})})}),R>1&&d.jsxs("div",{className:"flex items-center justify-between px-2 border-t h-10",children:[d.jsxs("span",{className:"text-xs text-muted-foreground",children:["Page ",n+1," of ",R]}),d.jsxs("div",{className:"flex items-center gap-0.5",children:[d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:n===0,onClick:()=>r(B=>Math.max(0,B-1)),children:d.jsx(eC,{className:"h-3.5 w-3.5"})}),d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:n>=R-1,onClick:()=>r(B=>B+1),children:d.jsx(p0,{className:"h-3.5 w-3.5"})})]})]})]})}function V0({description:t}){const e=Kn(NW),n=ad(kW),r=ad(RW),{data:i,isLoading:s}=G0(),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,f=(i==null?void 0:i.has_known_projects)??!1,h=(a==null?void 0:a.status)==="discovering",m=!s&&!h&&!l&&!c,x=!s&&!h&&!m&&l&&!c&&!f,b=!m&&!x&&!c;return h?d.jsx("div",{className:"flex h-full items-center justify-center p-8",children:d.jsx(hd,{className:"max-w-md w-full border-dashed",children:d.jsxs(cO,{className:"items-center text-center",children:[d.jsx(L4,{children:"Fetching runs from W&B…"}),d.jsxs(j4,{className:"flex items-center gap-1.5 font-medium",children:[d.jsx(Ya,{className:"h-3 w-3 shrink-0"}),(a==null?void 0:a.runs_found)??0," found"]})]})})}):b?d.jsx("div",{className:"flex h-full items-center justify-center p-8",children:d.jsx("div",{className:"text-xs text-muted-foreground",children:"No runs yet"})}):d.jsx("div",{className:"flex h-full items-center justify-center p-8",children:d.jsx(hd,{className:"max-w-md w-full border-dashed",children:d.jsx(cO,{className:"text-center items-center",children:m?d.jsxs(d.Fragment,{children:[d.jsx(L4,{children:"No wandb key added yet"}),d.jsx(j4,{children:"Add your W&B API key to discover and sync runs."}),d.jsx(Sn,{className:"mt-4 bg-green-600 hover:bg-green-700",onClick:()=>n(!0),children:"Add wandb key"})]}):x?d.jsxs(d.Fragment,{children:[d.jsx(L4,{children:"Add a project"}),d.jsx(j4,{children:"Add a W&B project to start discovering telescope-tagged runs."}),d.jsx(Sn,{className:"mt-4",onClick:()=>r(!0),children:"Add project"})]}):d.jsxs(d.Fragment,{children:[d.jsx(L4,{children:"No Run Selected"}),d.jsx(j4,{children:t})]})})})})}const gme=!0,ya="u-",xme="uplot",vme=ya+"hz",yme=ya+"vt",bme=ya+"title",_me=ya+"wrap",wme=ya+"under",Sme=ya+"over",Mme=ya+"axis",ox=ya+"off",Tme=ya+"select",Cme=ya+"cursor-x",Eme=ya+"cursor-y",Ame=ya+"cursor-pt",Nme=ya+"legend",kme=ya+"live",Rme=ya+"inline",Pme=ya+"series",Ime=ya+"marker",vO=ya+"label",Dme=ya+"value",q_="width",X_="height",__="top",yO="bottom",Kv="left",qA="right",R8="#000",bO=R8+"0",XA="mousemove",_O="mousedown",YA="mouseup",wO="mouseenter",SO="mouseleave",MO="dblclick",Ome="resize",Lme="scroll",TO="change",o5="dppxchange",P8="--",tb=typeof window<"u",Xk=tb?document:null,B1=tb?window:null,jme=tb?navigator:null;let Ri,z4;function Yk(){let t=devicePixelRatio;Ri!=t&&(Ri=t,z4&&Zk(TO,z4,Yk),z4=matchMedia(`(min-resolution: ${Ri-.001}dppx) and (max-resolution: ${Ri+.001}dppx)`),Sx(TO,z4,Yk),B1.dispatchEvent(new CustomEvent(o5)))}function au(t,e){if(e!=null){let n=t.classList;!n.contains(e)&&n.add(e)}}function Kk(t,e){let n=t.classList;n.contains(e)&&n.remove(e)}function Is(t,e,n){t.style[e]=n+"px"}function Xd(t,e,n,r){let i=Xk.createElement(t);return e!=null&&au(i,e),n!=null&&n.insertBefore(i,r),i}function Qu(t,e){return Xd("div",t,e)}const CO=new WeakMap;function Uf(t,e,n,r,i){let s="translate("+e+"px,"+n+"px)",o=CO.get(t);s!=o&&(t.style.transform=s,CO.set(t,s),e<0||n<0||e>r||n>i?au(t,ox):Kk(t,ox))}const EO=new WeakMap;function AO(t,e,n){let r=e+n,i=EO.get(t);r!=i&&(EO.set(t,r),t.style.background=e,t.style.borderColor=n)}const NO=new WeakMap;function kO(t,e,n,r){let i=e+""+n,s=NO.get(t);i!=s&&(NO.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 I8={passive:!0},zme={...I8,capture:!0};function Sx(t,e,n,r){e.addEventListener(t,n,r?zme:I8)}function Zk(t,e,n,r){e.removeEventListener(t,n,I8)}tb&&Yk();function Qd(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:gu((n+r)/2),e[i]<t?n=i:r=i;return t-e[n]<=e[r]-t?n:r}function j$(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 z$=t=>t!=null,F$=t=>t!=null&&t>0,yC=j$(z$),Fme=j$(F$);function Ume(t,e,n,r=0,i=!1){let s=i?Fme:yC,o=i?F$:z$;[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 f=t[c];o(f)&&(f<a?a=f:f>l&&(l=f))}return[a??is,l??-is]}function bC(t,e,n,r){let i=IO(t),s=IO(e);t==e&&(i==-1?(t*=n,e/=n):(t/=n,e*=n));let o=n==10?_p:U$,a=i==1?gu:sd,l=s==1?sd:gu,c=a(o(fa(t))),f=l(o(fa(e))),h=Ey(n,c),m=Ey(n,f);return n==10&&(c<0&&(h=ss(h,-c)),f<0&&(m=ss(m,-f))),r||n==2?(t=h*i,e=m*s):(t=V$(t,h),e=_C(e,m)),[t,e]}function D8(t,e,n,r){let i=bC(t,e,n,r);return t==0&&(i[0]=0),e==0&&(i[1]=0),i}const O8=.1,RO={mode:3,pad:O8},lw={pad:0,soft:null,mode:0},Bme={min:lw,max:lw};function a5(t,e,n,r){return wC(n)?PO(t,e,n):(lw.pad=n,lw.soft=r?0:null,lw.mode=r?3:0,PO(t,e,Bme))}function Ci(t,e){return t??e}function Hme(t,e,n){for(e=Ci(e,0),n=Ci(n,t.length-1);e<=n;){if(t[e]!=null)return!0;e++}return!1}function PO(t,e,n){let r=n.min,i=n.max,s=Ci(r.pad,0),o=Ci(i.pad,0),a=Ci(r.hard,-is),l=Ci(i.hard,is),c=Ci(r.soft,is),f=Ci(i.soft,-is),h=Ci(r.mode,0),m=Ci(i.mode,0),x=e-t,b=_p(x),_=Kl(fa(t),fa(e)),S=_p(_),M=fa(S-b);(x<1e-24||M>10)&&(x=0,(t==0||e==0)&&(x=1e-24,h==2&&c!=is&&(s=0),m==2&&f!=-is&&(o=0)));let T=x||_||1e3,A=_p(T),N=Ey(10,gu(A)),D=T*(x==0?t==0?.1:1:s),k=ss(V$(t-D,N/10),24),O=t>=c&&(h==1||h==3&&k<=c||h==2&&k>=c)?c:is,R=Kl(a,k<O&&t>=O?O:ef(O,k)),L=T*(x==0?e==0?.1:1:o),B=ss(_C(e+L,N/10),24),H=e<=f&&(m==1||m==3&&B>=f||m==2&&B<=f)?f:-is,$=ef(l,B>H&&e<=H?H:Kl(H,B));return R==$&&R==0&&($=100),[R,$]}const Gme=new Intl.NumberFormat(tb?jme.language:"en-US"),L8=t=>Gme.format(t),Tu=Math,x2=Tu.PI,fa=Tu.abs,gu=Tu.floor,da=Tu.round,sd=Tu.ceil,ef=Tu.min,Kl=Tu.max,Ey=Tu.pow,IO=Tu.sign,_p=Tu.log10,U$=Tu.log2,Vme=(t,e=1)=>Tu.sinh(t)*e,KA=(t,e=1)=>Tu.asinh(t/e),is=1/0;function DO(t){return(_p((t^t>>31)-(t>>31))|0)+1}function Qk(t,e,n){return ef(Kl(t,e),n)}function B$(t){return typeof t=="function"}function ai(t){return B$(t)?t:()=>t}const Wme=()=>{},H$=t=>t,G$=(t,e)=>e,$me=t=>null,OO=t=>!0,LO=(t,e)=>t==e,qme=/\.\d*?(?=9{6,}|0{6,})/gm,Lx=t=>{if($$(t)||T0.has(t))return t;const e=`${t}`,n=e.match(qme);if(n==null)return t;let r=n[0].length-1;if(e.indexOf("e-")!=-1){let[i,s]=e.split("e");return+`${Lx(i)}e${s}`}return ss(t,r)};function tx(t,e){return Lx(ss(Lx(t/e))*e)}function _C(t,e){return Lx(sd(Lx(t/e))*e)}function V$(t,e){return Lx(gu(Lx(t/e))*e)}function ss(t,e=0){if($$(t))return t;let n=10**e,r=t*n*(1+Number.EPSILON);return da(r)/n}const T0=new Map;function W$(t){return((""+t).split(".")[1]||"").length}function Hw(t,e,n,r){let i=[],s=r.map(W$);for(let o=e;o<n;o++){let a=fa(o),l=ss(Ey(t,o),a);for(let c=0;c<r.length;c++){let f=t==10?+`${r[c]}e${o}`:r[c]*l,h=(o>=0?0:a)+(o>=s[c]?0:s[c]),m=t==10?f:ss(f,h);i.push(m),T0.set(m,h)}}return i}const cw={},j8=[],Ay=[null,null],Ym=Array.isArray,$$=Number.isInteger,Xme=t=>t===void 0;function jO(t){return typeof t=="string"}function wC(t){let e=!1;if(t!=null){let n=t.constructor;e=n==null||n==Object}return e}function Yme(t){return t!=null&&typeof t=="object"}const Kme=Object.getPrototypeOf(Uint8Array),q$="__proto__";function Ny(t,e=wC){let n;if(Ym(t)){let r=t.find(i=>i!=null);if(Ym(r)||e(r)){n=Array(t.length);for(let i=0;i<t.length;i++)n[i]=Ny(t[i],e)}else n=t.slice()}else if(t instanceof Kme)n=t.slice();else if(e(t)){n={};for(let r in t)r!=q$&&(n[r]=Ny(t[r],e))}else n=t;return n}function Qo(t){let e=arguments;for(let n=1;n<e.length;n++){let r=e[n];for(let i in r)i!=q$&&(wC(t[i])?Qo(t[i],Ny(r[i])):t[i]=Ny(r[i]))}return t}const Zme=0,Qme=1,Jme=2;function e0e(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 t0e(t,e){if(i0e(t)){let o=t[0].slice();for(let a=1;a<t.length;a++)o.push(...t[a].slice(1));return s0e(o[0])||(o=r0e(o)),o}let n=new Set;for(let o=0;o<t.length;o++){let l=t[o][0],c=l.length;for(let f=0;f<c;f++)n.add(l[f])}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 f=a[c],h=Array(i).fill(void 0),m=e?e[o][c]:Qme,x=[];for(let b=0;b<f.length;b++){let _=f[b],S=s.get(l[b]);_===null?m!=Zme&&(h[S]=_,m==Jme&&x.push(S)):h[S]=_}e0e(h,x,i),r.push(h)}}return r}const n0e=typeof queueMicrotask>"u"?t=>Promise.resolve().then(t):queueMicrotask;function r0e(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 i0e(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 s0e(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=Kl(1,gu((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 X$=["January","February","March","April","May","June","July","August","September","October","November","December"],Y$=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function K$(t){return t.slice(0,3)}const o0e=Y$.map(K$),a0e=X$.map(K$),l0e={MMMM:X$,MMM:a0e,WWWW:Y$,WWW:o0e};function w_(t){return(t<10?"0":"")+t}function c0e(t){return(t<10?"00":t<100?"0":"")+t}const u0e={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=>w_(t.getMonth()+1),M:t=>t.getMonth()+1,DD:t=>w_(t.getDate()),D:t=>t.getDate(),WWWW:(t,e)=>e.WWWW[t.getDay()],WWW:(t,e)=>e.WWW[t.getDay()],HH:t=>w_(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=>w_(t.getMinutes()),m:t=>t.getMinutes(),ss:t=>w_(t.getSeconds()),s:t=>t.getSeconds(),fff:t=>c0e(t.getMilliseconds())};function z8(t,e){e=e||l0e;let n=[],r=/\{([a-z]+)\}|[^{]+/gi,i;for(;i=r.exec(t);)n.push(i[0][0]=="{"?u0e[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 d0e=new Intl.DateTimeFormat().resolvedOptions().timeZone;function f0e(t,e){let n;return e=="UTC"||e=="Etc/UTC"?n=new Date(+t+t.getTimezoneOffset()*6e4):e==d0e?n=t:(n=new Date(t.toLocaleString("en-US",{timeZone:e})),n.setMilliseconds(t.getMilliseconds())),n}const Z$=t=>t%1==0,l5=[1,2,2.5,5],h0e=Hw(10,-32,0,l5),Q$=Hw(10,0,32,l5),p0e=Q$.filter(Z$),nx=h0e.concat(Q$),F8=`
`,J$="{YYYY}",zO=F8+J$,eq="{M}/{D}",Y_=F8+eq,F4=Y_+"/{YY}",tq="{aa}",m0e="{h}:{mm}",T1=m0e+tq,FO=F8+T1,UO=":{ss}",Bi=null;function nq(t){let e=t*1e3,n=e*60,r=n*60,i=r*24,s=i*30,o=i*365,l=(t==1?Hw(10,0,3,l5).filter(Z$):Hw(10,-3,0,l5)).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,J$,Bi,Bi,Bi,Bi,Bi,Bi,1],[i*28,"{MMM}",zO,Bi,Bi,Bi,Bi,Bi,1],[i,eq,zO,Bi,Bi,Bi,Bi,Bi,1],[r,"{h}"+tq,F4,Bi,Y_,Bi,Bi,Bi,1],[n,T1,F4,Bi,Y_,Bi,Bi,Bi,1],[e,UO,F4+" "+T1,Bi,Y_+" "+T1,Bi,FO,Bi,1],[t,UO+".{fff}",F4+" "+T1,Bi,Y_+" "+T1,Bi,FO,Bi,1]];function f(h){return(m,x,b,_,S,M)=>{let T=[],A=S>=o,N=S>=s&&S<o,D=h(b),k=ss(D*t,3),O=ZA(D.getFullYear(),A?0:D.getMonth(),N||A?1:D.getDate()),R=ss(O*t,3);if(N||A){let L=N?S/s:0,B=A?S/o:0,H=k==R?k:ss(ZA(O.getFullYear()+B,O.getMonth()+L,1)*t,3),$=new Date(da(H/t)),G=$.getFullYear(),Z=$.getMonth();for(let V=0;H<=_;V++){let W=ZA(G+B*V,Z+L*V,1),J=W-h(ss(W*t,3));H=ss((+W+J)*t,3),H<=_&&T.push(H)}}else{let L=S>=i?i:S,B=gu(b)-gu(k),H=R+B+_C(k-R,L);T.push(H);let $=h(H),G=$.getHours()+$.getMinutes()/n+$.getSeconds()/r,Z=S/r,V=m.axes[x]._space,W=M/V;for(;H=ss(H+S,t==1?0:3),!(H>_);)if(Z>1){let J=gu(ss(G+Z,6))%24,z=h(H).getHours()-J;z>1&&(z=-1),H-=z*r,G=(G+Z)%24;let j=T[T.length-1];ss((H-j)/S,3)*W>=.7&&T.push(H)}else T.push(H)}return T}}return[l,c,f]}const[g0e,x0e,v0e]=nq(1),[y0e,b0e,_0e]=nq(.001);Hw(2,-53,53,[1]);function BO(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 HO(t,e){return(n,r,i,s,o)=>{let a=e.find(b=>o>=b[0])||e[e.length-1],l,c,f,h,m,x;return r.map(b=>{let _=t(b),S=_.getFullYear(),M=_.getMonth(),T=_.getDate(),A=_.getHours(),N=_.getMinutes(),D=_.getSeconds(),k=S!=l&&a[2]||M!=c&&a[3]||T!=f&&a[4]||A!=h&&a[5]||N!=m&&a[6]||D!=x&&a[7]||a[1];return l=S,c=M,f=T,h=A,m=N,x=D,k(_)})}}function w0e(t,e){let n=z8(e);return(r,i,s,o,a)=>i.map(l=>n(t(l)))}function ZA(t,e,n){return new Date(t,e,n)}function GO(t,e){return e(t)}const S0e="{YYYY}-{MM}-{DD} {h}:{mm}{aa}";function VO(t,e){return(n,r,i,s)=>s==null?P8:e(t(r))}function M0e(t,e){let n=t.series[e];return n.width?n.stroke(t,e):n.points.width?n.points.stroke(t,e):null}function T0e(t,e){return t.series[e].fill(t,e)}const C0e={show:!0,live:!0,isolate:!1,mount:Wme,markers:{show:!0,width:2,stroke:M0e,fill:T0e,dash:"solid"},idx:null,idxs:null,values:[]};function E0e(t,e){let n=t.cursor.points,r=Qu(),i=n.size(t,e);Is(r,q_,i),Is(r,X_,i);let s=i/-2;Is(r,"marginLeft",s),Is(r,"marginTop",s);let o=n.width(t,e,i);return o&&Is(r,"borderWidth",o),r}function A0e(t,e){let n=t.series[e].points;return n._fill||n._stroke}function N0e(t,e){let n=t.series[e].points;return n._stroke||n._fill}function k0e(t,e){return t.series[e].points.size}const QA=[0,0];function R0e(t,e,n){return QA[0]=e,QA[1]=n,QA}function U4(t,e,n,r=!0){return i=>{i.button==0&&(!r||i.target==e)&&n(i)}}function JA(t,e,n,r=!0){return i=>{(!r||i.target==e)&&n(i)}}const P0e={show:!0,x:!0,y:!0,lock:!1,move:R0e,points:{one:!1,show:E0e,size:k0e,width:0,stroke:N0e,fill:A0e},bind:{mousedown:U4,mouseup:U4,click:U4,dblclick:U4,mousemove:JA,mouseleave:JA,mouseenter:JA},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},rq={show:!0,stroke:"rgba(0,0,0,0.07)",width:2},U8=Qo({},rq,{filter:G$}),iq=Qo({},U8,{size:10}),sq=Qo({},rq,{show:!1}),B8='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"',oq="bold "+B8,aq=1.5,WO={show:!0,scale:"x",stroke:R8,space:50,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:oq,side:2,grid:U8,ticks:iq,border:sq,font:B8,lineGap:aq,rotate:0},I0e="Value",D0e="Time",$O={show:!0,scale:"x",auto:!1,sorted:1,min:is,max:-is,idxs:[]};function O0e(t,e,n,r,i){return e.map(s=>s==null?"":L8(s))}function L0e(t,e,n,r,i,s,o){let a=[],l=T0.get(i)||0;n=o?n:ss(_C(n,i),l);for(let c=n;c<=r;c=ss(c+i,l))a.push(Object.is(c,-0)?0:c);return a}function Jk(t,e,n,r,i,s,o){const a=[],l=t.scales[t.axes[e].scale].log,c=l==10?_p:U$,f=gu(c(n));i=Ey(l,f),l==10&&(i=nx[Qd(i,nx)]);let h=n,m=i*l;l==10&&(m=nx[Qd(m,nx)]);do a.push(h),h=h+i,l==10&&!T0.has(h)&&(h=ss(h,T0.get(i))),h>=m&&(i=h,m=i*l,l==10&&(m=nx[Qd(m,nx)]));while(h<=r);return a}function j0e(t,e,n,r,i,s,o){let l=t.scales[t.axes[e].scale].asinh,c=r>l?Jk(t,e,Kl(l,n),r,i):[l],f=r>=0&&n<=0?[0]:[];return(n<-l?Jk(t,e,Kl(l,-r),-n,i):[l]).reverse().map(m=>-m).concat(f,c)}const lq=/./,z0e=/[12357]/,F0e=/[125]/,qO=/1/,eR=(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 U0e(t,e,n,r,i){let s=t.axes[n],o=s.scale,a=t.scales[o],l=t.valToPos,c=s._space,f=l(10,o),h=l(9,o)-f>=c?lq:l(7,o)-f>=c?z0e:l(5,o)-f>=c?F0e:qO;if(h==qO){let m=fa(l(1,o)-f);if(m<c)return eR(e.slice().reverse(),a.distr,h,sd(c/m)).reverse()}return eR(e,a.distr,h,1)}function B0e(t,e,n,r,i){let s=t.axes[n],o=s.scale,a=s._space,l=t.valToPos,c=fa(l(1,o)-l(2,o));return c<a?eR(e.slice().reverse(),3,lq,sd(a/c)).reverse():e}function H0e(t,e,n,r){return r==null?P8:e==null?"":L8(e)}const XO={show:!0,scale:"y",stroke:R8,space:30,gap:5,alignTo:1,size:50,labelGap:0,labelSize:30,labelFont:oq,side:3,grid:U8,ticks:iq,border:sq,font:B8,lineGap:aq,rotate:0};function G0e(t,e){let n=3+(t||1)*2;return ss(n*e,3)}function V0e(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=fa(o-s),l=t.series[e],c=a/(l.points.space*Ri);return r[1]-r[0]<=c}const YO={scale:null,auto:!0,sorted:0,min:is,max:-is},cq=(t,e,n,r,i)=>i,KO={show:!0,auto:!0,sorted:0,gaps:cq,alpha:1,facets:[Qo({},YO,{scale:"x"}),Qo({},YO,{scale:"y"})]},ZO={scale:"y",auto:!0,sorted:0,show:!0,spanGaps:!1,gaps:cq,alpha:1,points:{show:V0e,filter:null},values:null,min:is,max:-is,idxs:[],path:null,clip:null};function W0e(t,e,n,r,i){return n/10}const uq={time:gme,auto:!0,distr:1,log:10,asinh:1,min:null,max:null,dir:1,ori:0},$0e=Qo({},uq,{time:!1,ori:1}),QO={};function dq(t,e){let n=QO[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 f=0;f<n.plots.length;f++)n.plots[f]!=i&&n.plots[f].pub(r,i,s,o,a,l,c)}},t!=null&&(QO[t]=n)),n}const ky=1,tR=2;function qx(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],f=r==2?o[i.facets[0].scale]:o[t.series[0].scale],h=r==2?o[i.facets[1].scale]:o[i.scale],m=a.left,x=a.top,b=a.width,_=a.height,S=t.valToPosH,M=t.valToPosV;return f.ori==0?n(i,l,c,f,h,S,M,m,x,b,_,MC,nb,CC,hq,mq):n(i,l,c,f,h,M,S,x,m,_,b,TC,rb,V8,pq,gq)}function H8(t,e){let n=0,r=0,i=Ci(t.bands,j8);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 q0e(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 wp(t,e,n,r,i,s){return qx(t,e,(o,a,l,c,f,h,m,x,b,_,S)=>{let M=o.pxRound;const T=c.dir*(c.ori==0?1:-1),A=c.ori==0?nb:rb;let N,D;T==1?(N=n,D=r):(N=r,D=n);let k=M(h(a[N],c,_,x)),O=M(m(l[N],f,S,b)),R=M(h(a[D],c,_,x)),L=M(m(s==1?f.max:f.min,f,S,b)),B=new Path2D(i);return A(B,R,L),A(B,k,L),A(B,k,O),B})}function SC(t,e,n,r,i,s){let o=null;if(t.length>0){o=new Path2D;const a=e==0?CC:V8;let l=n;for(let h=0;h<t.length;h++){let m=t[h];if(m[1]>m[0]){let x=m[0]-l;x>0&&a(o,l,r,x,r+s),l=m[1]}}let c=n+i-l,f=10;c>0&&a(o,l,r-f/2,c,r+s+f)}return o}function X0e(t,e,n){let r=t[t.length-1];r&&r[0]==e?r[1]=n:t.push([e,n])}function G8(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,m=c;if(i==1)for(;++c<=r&&e[c]===null;)m=c;else for(;--c>=n&&e[c]===null;)m=c;let x=s(t[h]),b=m==h?x:s(t[m]),_=h-i;x=o<=0&&_>=0&&_<l?s(t[_]):x;let M=m+i;b=o>=0&&M>=0&&M<l?s(t[M]):b,b>=x&&a.push([x,b])}return a}function JO(t){return t==0?H$:t==1?da:e=>tx(e,t)}function fq(t){let e=t==0?MC:TC,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,f=0)=>{c==0&&f==0?r(i,s,o,a,l):(c=ef(c,a/2,l/2),f=ef(f,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,f),n(i,s,o+l,s,o,f),n(i,s,o,s+a,o,c),i.closePath())}}const MC=(t,e,n)=>{t.moveTo(e,n)},TC=(t,e,n)=>{t.moveTo(n,e)},nb=(t,e,n)=>{t.lineTo(e,n)},rb=(t,e,n)=>{t.lineTo(n,e)},CC=fq(0),V8=fq(1),hq=(t,e,n,r,i,s)=>{t.arc(e,n,r,i,s)},pq=(t,e,n,r,i,s)=>{t.arc(n,e,r,i,s)},mq=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(e,n,r,i,s,o)},gq=(t,e,n,r,i,s,o)=>{t.bezierCurveTo(n,e,i,r,o,s)};function xq(t){return(e,n,r,i,s)=>qx(e,n,(o,a,l,c,f,h,m,x,b,_,S)=>{let{pxRound:M,points:T}=o,A,N;c.ori==0?(A=MC,N=hq):(A=TC,N=pq);const D=ss(T.width*Ri,3);let k=(T.size-T.width)/2*Ri,O=ss(k*2,3),R=new Path2D,L=new Path2D,{left:B,top:H,width:$,height:G}=e.bbox;CC(L,B-O,H-O,$+O*2,G+O*2);const Z=V=>{if(l[V]!=null){let W=M(h(a[V],c,_,x)),J=M(m(l[V],f,S,b));A(R,W+k,J),N(R,W,J,k,0,x2*2)}};if(s)s.forEach(Z);else for(let V=r;V<=i;V++)Z(V);return{stroke:D>0?R:null,fill:R,clip:L,flags:ky|tR}})}function vq(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 Y0e=vq(nb),K0e=vq(rb);function yq(t){const e=Ci(t==null?void 0:t.alignGaps,0);return(n,r,i,s)=>qx(n,r,(o,a,l,c,f,h,m,x,b,_,S)=>{[i,s]=yC(l,i,s);let M=o.pxRound,T=G=>M(h(G,c,_,x)),A=G=>M(m(G,f,S,b)),N,D;c.ori==0?(N=nb,D=Y0e):(N=rb,D=K0e);const k=c.dir*(c.ori==0?1:-1),O={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:ky},R=O.stroke;let L=!1;if(s-i>=_*4){let G=F=>n.posToVal(F,c.key,!0),Z=null,V=null,W,J,ne,ie=T(a[k==1?i:s]),z=T(a[i]),j=T(a[s]),X=G(k==1?z+1:j-1);for(let F=k==1?i:s;F>=i&&F<=s;F+=k){let ce=a[F],Q=(k==1?ce<X:ce>X)?ie:T(ce),se=l[F];Q==ie?se!=null?(J=se,Z==null?(N(R,Q,A(J)),W=Z=V=J):J<Z?Z=J:J>V&&(V=J)):se===null&&(L=!0):(Z!=null&&D(R,ie,A(Z),A(V),A(W),A(J)),se!=null?(J=se,N(R,Q,A(J)),Z=V=W=J):(Z=V=null,se===null&&(L=!0)),ie=Q,X=G(ie+k))}Z!=null&&Z!=V&&ne!=ie&&D(R,ie,A(Z),A(V),A(W),A(J))}else for(let G=k==1?i:s;G>=i&&G<=s;G+=k){let Z=l[G];Z===null?L=!0:Z!=null&&N(R,T(a[G]),A(Z))}let[H,$]=H8(n,r);if(o.fill!=null||H!=0){let G=O.fill=new Path2D(R),Z=o.fillTo(n,r,o.min,o.max,H),V=A(Z),W=T(a[i]),J=T(a[s]);k==-1&&([J,W]=[W,J]),N(G,J,V),N(G,W,V)}if(!o.spanGaps){let G=[];L&&G.push(...G8(a,l,i,s,k,T,e)),O.gaps=G=o.gaps(n,r,i,s,G),O.clip=SC(G,c.ori,x,b,_,S)}return $!=0&&(O.band=$==2?[wp(n,r,i,s,R,-1),wp(n,r,i,s,R,1)]:wp(n,r,i,s,R,$)),O})}function Z0e(t){const e=Ci(t.align,1),n=Ci(t.ascDesc,!1),r=Ci(t.alignGaps,0),i=Ci(t.extend,!1);return(s,o,a,l)=>qx(s,o,(c,f,h,m,x,b,_,S,M,T,A)=>{[a,l]=yC(h,a,l);let N=c.pxRound,{left:D,width:k}=s.bbox,O=z=>N(b(z,m,T,S)),R=z=>N(_(z,x,A,M)),L=m.ori==0?nb:rb;const B={stroke:new Path2D,fill:null,clip:null,band:null,gaps:null,flags:ky},H=B.stroke,$=m.dir*(m.ori==0?1:-1);let G=R(h[$==1?a:l]),Z=O(f[$==1?a:l]),V=Z,W=Z;i&&e==-1&&(W=D,L(H,W,G)),L(H,Z,G);for(let z=$==1?a:l;z>=a&&z<=l;z+=$){let j=h[z];if(j==null)continue;let X=O(f[z]),F=R(j);e==1?L(H,X,G):L(H,V,F),L(H,X,F),G=F,V=X}let J=V;i&&e==1&&(J=D+k,L(H,J,G));let[ne,ie]=H8(s,o);if(c.fill!=null||ne!=0){let z=B.fill=new Path2D(H),j=c.fillTo(s,o,c.min,c.max,ne),X=R(j);L(z,J,X),L(z,W,X)}if(!c.spanGaps){let z=[];z.push(...G8(f,h,a,l,$,O,r));let j=c.width*Ri/2,X=n||e==1?j:-j,F=n||e==-1?-j:j;z.forEach(ce=>{ce[0]+=X,ce[1]+=F}),B.gaps=z=c.gaps(s,o,a,l,z),B.clip=SC(z,m.ori,S,M,T,A)}return ie!=0&&(B.band=ie==2?[wp(s,o,a,l,H,-1),wp(s,o,a,l,H,1)]:wp(s,o,a,l,H,ie)),B})}function eL(t,e,n,r,i,s,o=is){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 f=fa(t[l]-t[a]);f<c&&(c=f,o=fa(n(t[l],r,i,s)-n(t[a],r,i,s)))}a=l}}return o}function Q0e(t){t=t||cw;const e=Ci(t.size,[.6,is,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=ai(i),o=1-e[0],a=Ci(e[1],is),l=Ci(e[2],1),c=Ci(t.disp,cw),f=Ci(t.each,x=>{}),{fill:h,stroke:m}=c;return(x,b,_,S)=>qx(x,b,(M,T,A,N,D,k,O,R,L,B,H)=>{let $=M.pxRound,G=n,Z=r*Ri,V=a*Ri,W=l*Ri,J,ne;N.ori==0?[J,ne]=s(x,b):[ne,J]=s(x,b);const ie=N.dir*(N.ori==0?1:-1);let z=N.ori==0?CC:V8,j=N.ori==0?f:(xe,we,Te,ge,Ue,be,ke)=>{f(xe,we,Te,Ue,ge,ke,be)},X=Ci(x.bands,j8).find(xe=>xe.series[0]==b),F=X!=null?X.dir:0,ce=M.fillTo(x,b,M.min,M.max,F),oe=$(O(ce,D,H,L)),Q,se,re,K=B,fe=$(M.width*Ri),he=!1,ae=null,Se=null,de=null,Me=null;h!=null&&(fe==0||m!=null)&&(he=!0,ae=h.values(x,b,_,S),Se=new Map,new Set(ae).forEach(xe=>{xe!=null&&Se.set(xe,new Path2D)}),fe>0&&(de=m.values(x,b,_,S),Me=new Map,new Set(de).forEach(xe=>{xe!=null&&Me.set(xe,new Path2D)})));let{x0:Ce,size:Re}=c;if(Ce!=null&&Re!=null){G=1,T=Ce.values(x,b,_,S),Ce.unit==2&&(T=T.map(Te=>x.posToVal(R+Te*B,N.key,!0)));let xe=Re.values(x,b,_,S);Re.unit==2?se=xe[0]*B:se=k(xe[0],N,B,R)-k(0,N,B,R),K=eL(T,A,k,N,B,R,K),re=K-se+Z}else K=eL(T,A,k,N,B,R,K),re=K*o+Z,se=K-re;re<1&&(re=0),fe>=se/2&&(fe=0),re<5&&($=H$);let le=re>0,He=K-re-(le?fe:0);se=$(Qk(He,W,V)),Q=(G==0?se/2:G==ie?0:se)-G*ie*((G==0?Z/2:0)+(le?fe/2:0));const Le={stroke:null,fill:null,clip:null,band:null,gaps:null,flags:0},ze=he?null:new Path2D;let Ve=null;if(X!=null)Ve=x.data[X.series[1]];else{let{y0:xe,y1:we}=c;xe!=null&&we!=null&&(A=we.values(x,b,_,S),Ve=xe.values(x,b,_,S))}let ue=J*se,Y=ne*se;for(let xe=ie==1?_:S;xe>=_&&xe<=S;xe+=ie){let we=A[xe];if(we==null)continue;if(Ve!=null){let nt=Ve[xe]??0;if(we-nt==0)continue;oe=O(nt,D,H,L)}let Te=N.distr!=2||c!=null?T[xe]:xe,ge=k(Te,N,B,R),Ue=O(Ci(we,ce),D,H,L),be=$(ge-Q),ke=$(Kl(Ue,oe)),qe=$(ef(Ue,oe)),Qe=ke-qe;if(we!=null){let nt=we<0?Y:ue,st=we<0?ue:Y;he?(fe>0&&de[xe]!=null&&z(Me.get(de[xe]),be,qe+gu(fe/2),se,Kl(0,Qe-fe),nt,st),ae[xe]!=null&&z(Se.get(ae[xe]),be,qe+gu(fe/2),se,Kl(0,Qe-fe),nt,st)):z(ze,be,qe+gu(fe/2),se,Kl(0,Qe-fe),nt,st),j(x,b,xe,be-fe/2,qe,se+fe,Qe)}}return fe>0?Le.stroke=he?Me:ze:he||(Le._fill=M.width==0?M._fill:M._stroke??M._fill,Le.width=0),Le.fill=he?Se:ze,Le})}function J0e(t,e){const n=Ci(e==null?void 0:e.alignGaps,0);return(r,i,s,o)=>qx(r,i,(a,l,c,f,h,m,x,b,_,S,M)=>{[s,o]=yC(c,s,o);let T=a.pxRound,A=J=>T(m(J,f,S,b)),N=J=>T(x(J,h,M,_)),D,k,O;f.ori==0?(D=MC,O=nb,k=mq):(D=TC,O=rb,k=gq);const R=f.dir*(f.ori==0?1:-1);let L=A(l[R==1?s:o]),B=L,H=[],$=[];for(let J=R==1?s:o;J>=s&&J<=o;J+=R)if(c[J]!=null){let ie=l[J],z=A(ie);H.push(B=z),$.push(N(c[J]))}const G={stroke:t(H,$,D,O,k,T),fill:null,clip:null,band:null,gaps:null,flags:ky},Z=G.stroke;let[V,W]=H8(r,i);if(a.fill!=null||V!=0){let J=G.fill=new Path2D(Z),ne=a.fillTo(r,i,a.min,a.max,V),ie=N(ne);O(J,B,ie),O(J,L,ie)}if(!a.spanGaps){let J=[];J.push(...G8(l,c,s,o,R,A,n)),G.gaps=J=a.gaps(r,i,s,o,J),G.clip=SC(J,f.ori,b,_,S,M)}return W!=0&&(G.band=W==2?[wp(r,i,s,o,Z,-1),wp(r,i,s,o,Z,1)]:wp(r,i,s,o,Z,W)),G})}function ege(t){return J0e(tge,t)}function tge(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),f=Array(o-1),h=Array(o-1);for(let m=0;m<o-1;m++)f[m]=e[m+1]-e[m],h[m]=t[m+1]-t[m],c[m]=f[m]/h[m];l[0]=c[0];for(let m=1;m<o-1;m++)c[m]===0||c[m-1]===0||c[m-1]>0!=c[m]>0?l[m]=0:(l[m]=3*(h[m-1]+h[m])/((2*h[m]+h[m-1])/c[m-1]+(h[m]+2*h[m-1])/c[m]),isFinite(l[m])||(l[m]=0));l[o-1]=c[o-2];for(let m=0;m<o-1;m++)i(a,t[m]+h[m]/3,e[m]+l[m]*h[m]/3,t[m+1]-h[m]/3,e[m+1]-l[m+1]*h[m]/3,t[m+1],e[m+1])}return a}const nR=new Set;function tL(){for(let t of nR)t.syncRect(!0)}tb&&(Sx(Ome,B1,tL),Sx(Lme,B1,tL,!0),Sx(o5,B1,()=>{ls.pxRatio=Ri}));const nge=yq(),rge=xq();function nL(t,e,n,r){return(r?[t[0],t[1]].concat(t.slice(2)):[t[0]].concat(t.slice(1))).map((s,o)=>rR(s,o,e,n))}function ige(t,e){return t.map((n,r)=>r==0?{}:Qo({},e,n))}function rR(t,e,n,r){return Qo({},e==0?n:r,t)}function bq(t,e,n){return e==null?Ay:[e,n]}const sge=bq;function oge(t,e,n){return e==null?Ay:a5(e,n,O8,!0)}function _q(t,e,n,r){return e==null?Ay:bC(e,n,t.scales[r].log,!1)}const age=_q;function wq(t,e,n,r){return e==null?Ay:D8(e,n,t.scales[r].log,!1)}const lge=wq;function cge(t,e,n,r,i){let s=Kl(DO(t),DO(e)),o=e-t,a=Qd(i/r*o,n);do{let l=n[a],c=r*l/o;if(c>=i&&s+(l<5?T0.get(l):0)<=17)return[l,c]}while(++a<n.length);return[0,0]}function rL(t){let e,n;return t=t.replace(/(\d+)px/,(r,i)=>(e=da((n=+i)*Ri))+"px"),[t,e,n]}function uge(t){t.show&&[t.font,t.labelFont].forEach(e=>{let n=ss(e[2]*Ri,1);e[0]=e[0].replace(/[0-9.]+px/,n+"px"),e[1]=n})}function ls(t,e,n){const r={mode:Ci(t.mode,1)},i=r.mode;function s(ve,Ie,Xe,Ye){let ht=Ie.valToPct(ve);return Ye+Xe*(Ie.dir==-1?1-ht:ht)}function o(ve,Ie,Xe,Ye){let ht=Ie.valToPct(ve);return Ye+Xe*(Ie.dir==-1?ht:1-ht)}function a(ve,Ie,Xe,Ye){return Ie.ori==0?s(ve,Ie,Xe,Ye):o(ve,Ie,Xe,Ye)}r.valToPosH=s,r.valToPosV=o;let l=!1;r.status=0;const c=r.root=Qu(xme);if(t.id!=null&&(c.id=t.id),au(c,t.class),t.title){let ve=Qu(bme,c);ve.textContent=t.title}const f=Xd("canvas"),h=r.ctx=f.getContext("2d"),m=Qu(_me,c);Sx("click",m,ve=>{ve.target===b&&(ii!=Ss||Wr!=tl)&&Sr.click(r,ve)},!0);const x=r.under=Qu(wme,m);m.appendChild(f);const b=r.over=Qu(Sme,m);t=Ny(t);const _=+Ci(t.pxAlign,1),S=JO(_);(t.plugins||[]).forEach(ve=>{ve.opts&&(t=ve.opts(r,t)||t)});const M=t.ms||.001,T=r.series=i==1?nL(t.series||[],$O,ZO,!1):ige(t.series||[null],KO),A=r.axes=nL(t.axes||[],WO,XO,!0),N=r.scales={},D=r.bands=t.bands||[];D.forEach(ve=>{ve.fill=ai(ve.fill||null),ve.dir=Ci(ve.dir,-1)});const k=i==2?T[1].facets[0].scale:T[0].scale,O={axes:Pa,series:Wi},R=(t.drawOrder||["axes","series"]).map(ve=>O[ve]);function L(ve){const Ie=ve.distr==3?Xe=>_p(Xe>0?Xe:ve.clamp(r,Xe,ve.min,ve.max,ve.key)):ve.distr==4?Xe=>KA(Xe,ve.asinh):ve.distr==100?Xe=>ve.fwd(Xe):Xe=>Xe;return Xe=>{let Ye=Ie(Xe),{_min:ht,_max:Mt}=ve,Xt=Mt-ht;return(Ye-ht)/Xt}}function B(ve){let Ie=N[ve];if(Ie==null){let Xe=(t.scales||cw)[ve]||cw;if(Xe.from!=null){B(Xe.from);let Ye=Qo({},N[Xe.from],Xe,{key:ve});Ye.valToPct=L(Ye),N[ve]=Ye}else{Ie=N[ve]=Qo({},ve==k?uq:$0e,Xe),Ie.key=ve;let Ye=Ie.time,ht=Ie.range,Mt=Ym(ht);if((ve!=k||i==2&&!Ye)&&(Mt&&(ht[0]==null||ht[1]==null)&&(ht={min:ht[0]==null?RO:{mode:1,hard:ht[0],soft:ht[0]},max:ht[1]==null?RO:{mode:1,hard:ht[1],soft:ht[1]}},Mt=!1),!Mt&&wC(ht))){let Xt=ht;ht=(nn,fn,Nn)=>fn==null?Ay:a5(fn,Nn,Xt)}Ie.range=ai(ht||(Ye?sge:ve==k?Ie.distr==3?age:Ie.distr==4?lge:bq:Ie.distr==3?_q:Ie.distr==4?wq:oge)),Ie.auto=ai(Mt?!1:Ie.auto),Ie.clamp=ai(Ie.clamp||W0e),Ie._min=Ie._max=null,Ie.valToPct=L(Ie)}}}B("x"),B("y"),i==1&&T.forEach(ve=>{B(ve.scale)}),A.forEach(ve=>{B(ve.scale)});for(let ve in t.scales)B(ve);const H=N[k],$=H.distr;let G,Z;H.ori==0?(au(c,vme),G=s,Z=o):(au(c,yme),G=o,Z=s);const V={};for(let ve in N){let Ie=N[ve];(Ie.min!=null||Ie.max!=null)&&(V[ve]={min:Ie.min,max:Ie.max},Ie.min=Ie.max=null)}const W=t.tzDate||(ve=>new Date(da(ve/M))),J=t.fmtDate||z8,ne=M==1?v0e(W):_0e(W),ie=HO(W,BO(M==1?x0e:b0e,J)),z=VO(W,GO(S0e,J)),j=[],X=r.legend=Qo({},C0e,t.legend),F=r.cursor=Qo({},P0e,{drag:{y:i==2}},t.cursor),ce=X.show,oe=F.show,Q=X.markers;X.idxs=j,Q.width=ai(Q.width),Q.dash=ai(Q.dash),Q.stroke=ai(Q.stroke),Q.fill=ai(Q.fill);let se,re,K,fe=[],he=[],ae,Se=!1,de={};if(X.live){const ve=T[1]?T[1].values:null;Se=ve!=null,ae=Se?ve(r,1,0):{_:0};for(let Ie in ae)de[Ie]=P8}if(ce)if(se=Xd("table",Nme,c),K=Xd("tbody",null,se),X.mount(r,se),Se){re=Xd("thead",null,se,K);let ve=Xd("tr",null,re);Xd("th",null,ve);for(var Me in ae)Xd("th",vO,ve).textContent=Me}else au(se,Rme),X.live&&au(se,kme);const Ce={show:!0},Re={show:!1};function le(ve,Ie){if(Ie==0&&(Se||!X.live||i==2))return Ay;let Xe=[],Ye=Xd("tr",Pme,K,K.childNodes[Ie]);au(Ye,ve.class),ve.show||au(Ye,ox);let ht=Xd("th",null,Ye);if(Q.show){let nn=Qu(Ime,ht);if(Ie>0){let fn=Q.width(r,Ie);fn&&(nn.style.border=fn+"px "+Q.dash(r,Ie)+" "+Q.stroke(r,Ie)),nn.style.background=Q.fill(r,Ie)}}let Mt=Qu(vO,ht);ve.label instanceof HTMLElement?Mt.appendChild(ve.label):Mt.textContent=ve.label,Ie>0&&(Q.show||(Mt.style.color=ve.width>0?Q.stroke(r,Ie):Q.fill(r,Ie)),Le("click",ht,nn=>{if(F._lock)return;ot(nn);let fn=T.indexOf(ve);if((nn.ctrlKey||nn.metaKey)!=X.isolate){let Nn=T.some((kn,Dn)=>Dn>0&&Dn!=fn&&kn.show);T.forEach((kn,Dn)=>{Dn>0&&xi(Dn,Nn?Dn==fn?Ce:Re:Ce,!0,Ts.setSeries)})}else xi(fn,{show:!ve.show},!0,Ts.setSeries)},!1),kt&&Le(wO,ht,nn=>{F._lock||(ot(nn),xi(T.indexOf(ve),Ms,!0,Ts.setSeries))},!1));for(var Xt in ae){let nn=Xd("td",Dme,Ye);nn.textContent="--",Xe.push(nn)}return[Ye,Xe]}const He=new Map;function Le(ve,Ie,Xe,Ye=!0){const ht=He.get(Ie)||{},Mt=F.bind[ve](r,Ie,Xe,Ye);Mt&&(Sx(ve,Ie,ht[ve]=Mt),He.set(Ie,ht))}function ze(ve,Ie,Xe){const Ye=He.get(Ie)||{};for(let ht in Ye)(ve==null||ht==ve)&&(Zk(ht,Ie,Ye[ht]),delete Ye[ht]);ve==null&&He.delete(Ie)}let Ve=0,ue=0,Y=0,xe=0,we=0,Te=0,ge=we,Ue=Te,be=Y,ke=xe,qe=0,Qe=0,nt=0,st=0;r.bbox={};let Pe=!1,Ke=!1,rt=!1,ye=!1,$e=!1,Ze=!1;function ft(ve,Ie,Xe){(Xe||ve!=r.width||Ie!=r.height)&&lt(ve,Ie),ic(!1),rt=!0,Ke=!0,el()}function lt(ve,Ie){r.width=Ve=Y=ve,r.height=ue=xe=Ie,we=Te=0,De(),Ne();let Xe=r.bbox;qe=Xe.left=tx(we*Ri,.5),Qe=Xe.top=tx(Te*Ri,.5),nt=Xe.width=tx(Y*Ri,.5),st=Xe.height=tx(xe*Ri,.5)}const Je=3;function Ae(){let ve=!1,Ie=0;for(;!ve;){Ie++;let Xe=na(Ie),Ye=ba(Ie);ve=Ie==Je||Xe&&Ye,ve||(lt(r.width,r.height),Ke=!0)}}function We({width:ve,height:Ie}){ft(ve,Ie)}r.setSize=We;function De(){let ve=!1,Ie=!1,Xe=!1,Ye=!1;A.forEach((ht,Mt)=>{if(ht.show&&ht._show){let{side:Xt,_size:nn}=ht,fn=Xt%2,Nn=ht.label!=null?ht.labelSize:0,kn=nn+Nn;kn>0&&(fn?(Y-=kn,Xt==3?(we+=kn,Ye=!0):Xe=!0):(xe-=kn,Xt==0?(Te+=kn,ve=!0):Ie=!0))}}),It[0]=ve,It[1]=Xe,It[2]=Ie,It[3]=Ye,Y-=Ot[1]+Ot[3],we+=Ot[3],xe-=Ot[2]+Ot[0],Te+=Ot[0]}function Ne(){let ve=we+Y,Ie=Te+xe,Xe=we,Ye=Te;function ht(Mt,Xt){switch(Mt){case 1:return ve+=Xt,ve-Xt;case 2:return Ie+=Xt,Ie-Xt;case 3:return Xe-=Xt,Xe+Xt;case 0:return Ye-=Xt,Ye+Xt}}A.forEach((Mt,Xt)=>{if(Mt.show&&Mt._show){let nn=Mt.side;Mt._pos=ht(nn,Mt._size),Mt.label!=null&&(Mt._lpos=ht(nn,Mt.labelSize))}})}if(F.dataIdx==null){let ve=F.hover,Ie=ve.skip=new Set(ve.skip??[]);Ie.add(void 0);let Xe=ve.prox=ai(ve.prox),Ye=ve.bias??(ve.bias=0);F.dataIdx=(ht,Mt,Xt,nn)=>{if(Mt==0)return Xt;let fn=Xt,Nn=Xe(ht,Mt,Xt,nn)??is,kn=Nn>=0&&Nn<is,Dn=H.ori==0?Y:xe,cr=F.left,ei=e[0],ur=e[Mt];if(Ie.has(ur[Xt])){fn=null;let yr=null,Yn=null,Un;if(Ye==0||Ye==-1)for(Un=Xt;yr==null&&Un-- >0;)Ie.has(ur[Un])||(yr=Un);if(Ye==0||Ye==1)for(Un=Xt;Yn==null&&Un++<ur.length;)Ie.has(ur[Un])||(Yn=Un);if(yr!=null||Yn!=null)if(kn){let er=yr==null?-1/0:G(ei[yr],H,Dn,0),ns=Yn==null?1/0:G(ei[Yn],H,Dn,0),zs=cr-er,vi=ns-cr;zs<=vi?zs<=Nn&&(fn=yr):vi<=Nn&&(fn=Yn)}else fn=Yn==null?yr:yr==null?Yn:Xt-yr<=Yn-Xt?yr:Yn}else kn&&fa(cr-G(ei[Xt],H,Dn,0))>Nn&&(fn=null);return fn}}const ot=ve=>{F.event=ve};F.idxs=j,F._lock=!1;let dt=F.points;dt.show=ai(dt.show),dt.size=ai(dt.size),dt.stroke=ai(dt.stroke),dt.width=ai(dt.width),dt.fill=ai(dt.fill);const Pt=r.focus=Qo({},t.focus||{alpha:.3},F.focus),kt=Pt.prox>=0,wt=kt&&dt.one;let Vt=[],rn=[],Bt=[];function Gt(ve,Ie){let Xe=dt.show(r,Ie);if(Xe instanceof HTMLElement)return au(Xe,Ame),au(Xe,ve.class),Uf(Xe,-10,-10,Y,xe),b.insertBefore(Xe,Vt[Ie]),Xe}function Dt(ve,Ie){if(i==1||Ie>0){let Xe=i==1&&N[ve.scale].time,Ye=ve.value;ve.value=Xe?jO(Ye)?VO(W,GO(Ye,J)):Ye||z:Ye||H0e,ve.label=ve.label||(Xe?D0e:I0e)}if(wt||Ie>0){ve.width=ve.width==null?1:ve.width,ve.paths=ve.paths||nge||$me,ve.fillTo=ai(ve.fillTo||q0e),ve.pxAlign=+Ci(ve.pxAlign,_),ve.pxRound=JO(ve.pxAlign),ve.stroke=ai(ve.stroke||null),ve.fill=ai(ve.fill||null),ve._stroke=ve._fill=ve._paths=ve._focus=null;let Xe=G0e(Kl(1,ve.width),1),Ye=ve.points=Qo({},{size:Xe,width:Kl(1,Xe*.2),stroke:ve.stroke,space:Xe*2,paths:rge,_stroke:null,_fill:null},ve.points);Ye.show=ai(Ye.show),Ye.filter=ai(Ye.filter),Ye.fill=ai(Ye.fill),Ye.stroke=ai(Ye.stroke),Ye.paths=ai(Ye.paths),Ye.pxAlign=ve.pxAlign}if(ce){let Xe=le(ve,Ie);fe.splice(Ie,0,Xe[0]),he.splice(Ie,0,Xe[1]),X.values.push(null)}if(oe){j.splice(Ie,0,null);let Xe=null;wt?Ie==0&&(Xe=Gt(ve,Ie)):Ie>0&&(Xe=Gt(ve,Ie)),Vt.splice(Ie,0,Xe),rn.splice(Ie,0,0),Bt.splice(Ie,0,0)}js("addSeries",Ie)}function Qt(ve,Ie){Ie=Ie??T.length,ve=i==1?rR(ve,Ie,$O,ZO):rR(ve,Ie,{},KO),T.splice(Ie,0,ve),Dt(T[Ie],Ie)}r.addSeries=Qt;function hn(ve){if(T.splice(ve,1),ce){X.values.splice(ve,1),he.splice(ve,1);let Ie=fe.splice(ve,1)[0];ze(null,Ie.firstChild),Ie.remove()}oe&&(j.splice(ve,1),Vt.splice(ve,1)[0].remove(),rn.splice(ve,1),Bt.splice(ve,1)),js("delSeries",ve)}r.delSeries=hn;const It=[!1,!1,!1,!1];function Lt(ve,Ie){if(ve._show=ve.show,ve.show){let Xe=ve.side%2,Ye=N[ve.scale];Ye==null&&(ve.scale=Xe?T[1].scale:k,Ye=N[ve.scale]);let ht=Ye.time;ve.size=ai(ve.size),ve.space=ai(ve.space),ve.rotate=ai(ve.rotate),Ym(ve.incrs)&&ve.incrs.forEach(Xt=>{!T0.has(Xt)&&T0.set(Xt,W$(Xt))}),ve.incrs=ai(ve.incrs||(Ye.distr==2?p0e:ht?M==1?g0e:y0e:nx)),ve.splits=ai(ve.splits||(ht&&Ye.distr==1?ne:Ye.distr==3?Jk:Ye.distr==4?j0e:L0e)),ve.stroke=ai(ve.stroke),ve.grid.stroke=ai(ve.grid.stroke),ve.ticks.stroke=ai(ve.ticks.stroke),ve.border.stroke=ai(ve.border.stroke);let Mt=ve.values;ve.values=Ym(Mt)&&!Ym(Mt[0])?ai(Mt):ht?Ym(Mt)?HO(W,BO(Mt,J)):jO(Mt)?w0e(W,Mt):Mt||ie:Mt||O0e,ve.filter=ai(ve.filter||(Ye.distr>=3&&Ye.log==10?U0e:Ye.distr==3&&Ye.log==2?B0e:G$)),ve.font=rL(ve.font),ve.labelFont=rL(ve.labelFont),ve._size=ve.size(r,null,Ie,0),ve._space=ve._rotate=ve._incrs=ve._found=ve._splits=ve._values=null,ve._size>0&&(It[Ie]=!0,ve._el=Qu(Mme,m))}}function zt(ve,Ie,Xe,Ye){let[ht,Mt,Xt,nn]=Xe,fn=Ie%2,Nn=0;return fn==0&&(nn||Mt)&&(Nn=Ie==0&&!ht||Ie==2&&!Xt?da(WO.size/3):0),fn==1&&(ht||Xt)&&(Nn=Ie==1&&!Mt||Ie==3&&!nn?da(XO.size/2):0),Nn}const pn=r.padding=(t.padding||[zt,zt,zt,zt]).map(ve=>ai(Ci(ve,zt))),Ot=r._padding=pn.map((ve,Ie)=>ve(r,Ie,It,0));let Ct,tn=null,en=null;const bn=i==1?T[0].idxs:null;let On=null,_e=!1;function tt(ve,Ie){if(e=ve??[],r.data=r._data=e,i==2){Ct=0;for(let Xe=1;Xe<T.length;Xe++)Ct+=e[Xe][0].length}else{e.length==0&&(r.data=r._data=e=[[]]),On=e[0],Ct=On.length;let Xe=e;if($==2){Xe=e.slice();let Ye=Xe[0]=Array(Ct);for(let ht=0;ht<Ct;ht++)Ye[ht]=ht}r._data=e=Xe}if(ic(!0),js("setData"),$==2&&(rt=!0),Ie!==!1){let Xe=H;Xe.auto(r,_e)?gt():Ao(k,Xe.min,Xe.max),ye=ye||F.left>=0,Ze=!0,el()}}r.setData=tt;function gt(){_e=!0;let ve,Ie;i==1&&(Ct>0?(tn=bn[0]=0,en=bn[1]=Ct-1,ve=e[0][tn],Ie=e[0][en],$==2?(ve=tn,Ie=en):ve==Ie&&($==3?[ve,Ie]=bC(ve,ve,H.log,!1):$==4?[ve,Ie]=D8(ve,ve,H.log,!1):H.time?Ie=ve+da(86400/M):[ve,Ie]=a5(ve,Ie,O8,!0))):(tn=bn[0]=ve=null,en=bn[1]=Ie=null)),Ao(k,ve,Ie)}let pt,xt,$t,sn,Zt,Fe,bt,Tt,Yt,Ht;function Cn(ve,Ie,Xe,Ye,ht,Mt){ve??(ve=bO),Xe??(Xe=j8),Ye??(Ye="butt"),ht??(ht=bO),Mt??(Mt="round"),ve!=pt&&(h.strokeStyle=pt=ve),ht!=xt&&(h.fillStyle=xt=ht),Ie!=$t&&(h.lineWidth=$t=Ie),Mt!=Zt&&(h.lineJoin=Zt=Mt),Ye!=Fe&&(h.lineCap=Fe=Ye),Xe!=sn&&h.setLineDash(sn=Xe)}function zn(ve,Ie,Xe,Ye){Ie!=xt&&(h.fillStyle=xt=Ie),ve!=bt&&(h.font=bt=ve),Xe!=Tt&&(h.textAlign=Tt=Xe),Ye!=Yt&&(h.textBaseline=Yt=Ye)}function Zn(ve,Ie,Xe,Ye,ht=0){if(Ye.length>0&&ve.auto(r,_e)&&(Ie==null||Ie.min==null)){let Mt=Ci(tn,0),Xt=Ci(en,Ye.length-1),nn=Xe.min==null?Ume(Ye,Mt,Xt,ht,ve.distr==3):[Xe.min,Xe.max];ve.min=ef(ve.min,Xe.min=nn[0]),ve.max=Kl(ve.max,Xe.max=nn[1])}}const Xn={min:null,max:null};function ir(){for(let Ye in N){let ht=N[Ye];V[Ye]==null&&(ht.min==null||V[k]!=null&&ht.auto(r,_e))&&(V[Ye]=Xn)}for(let Ye in N){let ht=N[Ye];V[Ye]==null&&ht.from!=null&&V[ht.from]!=null&&(V[Ye]=Xn)}V[k]!=null&&ic(!0);let ve={};for(let Ye in V){let ht=V[Ye];if(ht!=null){let Mt=ve[Ye]=Ny(N[Ye],Yme);if(ht.min!=null)Qo(Mt,ht);else if(Ye!=k||i==2)if(Ct==0&&Mt.from==null){let Xt=Mt.range(r,null,null,Ye);Mt.min=Xt[0],Mt.max=Xt[1]}else Mt.min=is,Mt.max=-is}}if(Ct>0){T.forEach((Ye,ht)=>{if(i==1){let Mt=Ye.scale,Xt=V[Mt];if(Xt==null)return;let nn=ve[Mt];if(ht==0){let fn=nn.range(r,nn.min,nn.max,Mt);nn.min=fn[0],nn.max=fn[1],tn=Qd(nn.min,e[0]),en=Qd(nn.max,e[0]),en-tn>1&&(e[0][tn]<nn.min&&tn++,e[0][en]>nn.max&&en--),Ye.min=On[tn],Ye.max=On[en]}else Ye.show&&Ye.auto&&Zn(nn,Xt,Ye,e[ht],Ye.sorted);Ye.idxs[0]=tn,Ye.idxs[1]=en}else if(ht>0&&Ye.show&&Ye.auto){let[Mt,Xt]=Ye.facets,nn=Mt.scale,fn=Xt.scale,[Nn,kn]=e[ht],Dn=ve[nn],cr=ve[fn];Dn!=null&&Zn(Dn,V[nn],Mt,Nn,Mt.sorted),cr!=null&&Zn(cr,V[fn],Xt,kn,Xt.sorted),Ye.min=Xt.min,Ye.max=Xt.max}});for(let Ye in ve){let ht=ve[Ye],Mt=V[Ye];if(ht.from==null&&(Mt==null||Mt.min==null)){let Xt=ht.range(r,ht.min==is?null:ht.min,ht.max==-is?null:ht.max,Ye);ht.min=Xt[0],ht.max=Xt[1]}}}for(let Ye in ve){let ht=ve[Ye];if(ht.from!=null){let Mt=ve[ht.from];if(Mt.min==null)ht.min=ht.max=null;else{let Xt=ht.range(r,Mt.min,Mt.max,Ye);ht.min=Xt[0],ht.max=Xt[1]}}}let Ie={},Xe=!1;for(let Ye in ve){let ht=ve[Ye],Mt=N[Ye];if(Mt.min!=ht.min||Mt.max!=ht.max){Mt.min=ht.min,Mt.max=ht.max;let Xt=Mt.distr;Mt._min=Xt==3?_p(Mt.min):Xt==4?KA(Mt.min,Mt.asinh):Xt==100?Mt.fwd(Mt.min):Mt.min,Mt._max=Xt==3?_p(Mt.max):Xt==4?KA(Mt.max,Mt.asinh):Xt==100?Mt.fwd(Mt.max):Mt.max,Ie[Ye]=Xe=!0}}if(Xe){T.forEach((Ye,ht)=>{i==2?ht>0&&Ie.y&&(Ye._paths=null):Ie[Ye.scale]&&(Ye._paths=null)});for(let Ye in Ie)rt=!0,js("setScale",Ye);oe&&F.left>=0&&(ye=Ze=!0)}for(let Ye in V)V[Ye]=null}function dn(ve){let Ie=Qk(tn-1,0,Ct-1),Xe=Qk(en+1,0,Ct-1);for(;ve[Ie]==null&&Ie>0;)Ie--;for(;ve[Xe]==null&&Xe<Ct-1;)Xe++;return[Ie,Xe]}function Wi(){if(Ct>0){let ve=T.some(Ie=>Ie._focus)&&Ht!=Pt.alpha;ve&&(h.globalAlpha=Ht=Pt.alpha),T.forEach((Ie,Xe)=>{if(Xe>0&&Ie.show&&(vn(Xe,!1),vn(Xe,!0),Ie._paths==null)){let Ye=Ht;Ht!=Ie.alpha&&(h.globalAlpha=Ht=Ie.alpha);let ht=i==2?[0,e[Xe][0].length-1]:dn(e[Xe]);Ie._paths=Ie.paths(r,Xe,ht[0],ht[1]),Ht!=Ye&&(h.globalAlpha=Ht=Ye)}}),T.forEach((Ie,Xe)=>{if(Xe>0&&Ie.show){let Ye=Ht;Ht!=Ie.alpha&&(h.globalAlpha=Ht=Ie.alpha),Ie._paths!=null&&ts(Xe,!1);{let ht=Ie._paths!=null?Ie._paths.gaps:null,Mt=Ie.points.show(r,Xe,tn,en,ht),Xt=Ie.points.filter(r,Xe,Mt,ht);(Mt||Xt)&&(Ie.points._paths=Ie.points.paths(r,Xe,tn,en,Xt),ts(Xe,!0))}Ht!=Ye&&(h.globalAlpha=Ht=Ye),js("drawSeries",Xe)}}),ve&&(h.globalAlpha=Ht=1)}}function vn(ve,Ie){let Xe=Ie?T[ve].points:T[ve];Xe._stroke=Xe.stroke(r,ve),Xe._fill=Xe.fill(r,ve)}function ts(ve,Ie){let Xe=Ie?T[ve].points:T[ve],{stroke:Ye,fill:ht,clip:Mt,flags:Xt,_stroke:nn=Xe._stroke,_fill:fn=Xe._fill,_width:Nn=Xe.width}=Xe._paths;Nn=ss(Nn*Ri,3);let kn=null,Dn=Nn%2/2;Ie&&fn==null&&(fn=Nn>0?"#fff":nn);let cr=Xe.pxAlign==1&&Dn>0;if(cr&&h.translate(Dn,Dn),!Ie){let ei=qe-Nn/2,ur=Qe-Nn/2,yr=nt+Nn,Yn=st+Nn;kn=new Path2D,kn.rect(ei,ur,yr,Yn)}Ie?ws(nn,Nn,Xe.dash,Xe.cap,fn,Ye,ht,Xt,Mt):Ds(ve,nn,Nn,Xe.dash,Xe.cap,fn,Ye,ht,Xt,kn,Mt),cr&&h.translate(-Dn,-Dn)}function Ds(ve,Ie,Xe,Ye,ht,Mt,Xt,nn,fn,Nn,kn){let Dn=!1;fn!=0&&D.forEach((cr,ei)=>{if(cr.series[0]==ve){let ur=T[cr.series[1]],yr=e[cr.series[1]],Yn=(ur._paths||cw).band;Ym(Yn)&&(Yn=cr.dir==1?Yn[0]:Yn[1]);let Un,er=null;ur.show&&Yn&&Hme(yr,tn,en)?(er=cr.fill(r,ei)||Mt,Un=ur._paths.clip):Yn=null,ws(Ie,Xe,Ye,ht,er,Xt,nn,fn,Nn,kn,Un,Yn),Dn=!0}}),Dn||ws(Ie,Xe,Ye,ht,Mt,Xt,nn,fn,Nn,kn)}const Li=ky|tR;function ws(ve,Ie,Xe,Ye,ht,Mt,Xt,nn,fn,Nn,kn,Dn){Cn(ve,Ie,Xe,Ye,ht),(fn||Nn||Dn)&&(h.save(),fn&&h.clip(fn),Nn&&h.clip(Nn)),Dn?(nn&Li)==Li?(h.clip(Dn),kn&&h.clip(kn),mi(ht,Xt),wr(ve,Mt,Ie)):nn&tR?(mi(ht,Xt),h.clip(Dn),wr(ve,Mt,Ie)):nn&ky&&(h.save(),h.clip(Dn),kn&&h.clip(kn),mi(ht,Xt),h.restore(),wr(ve,Mt,Ie)):(mi(ht,Xt),wr(ve,Mt,Ie)),(fn||Nn||Dn)&&h.restore()}function wr(ve,Ie,Xe){Xe>0&&(Ie instanceof Map?Ie.forEach((Ye,ht)=>{h.strokeStyle=pt=ht,h.stroke(Ye)}):Ie!=null&&ve&&h.stroke(Ie))}function mi(ve,Ie){Ie instanceof Map?Ie.forEach((Xe,Ye)=>{h.fillStyle=xt=Ye,h.fill(Xe)}):Ie!=null&&ve&&h.fill(Ie)}function Os(ve,Ie,Xe,Ye){let ht=A[ve],Mt;if(Ye<=0)Mt=[0,0];else{let Xt=ht._space=ht.space(r,ve,Ie,Xe,Ye),nn=ht._incrs=ht.incrs(r,ve,Ie,Xe,Ye,Xt);Mt=cge(Ie,Xe,nn,Ye,Xt)}return ht._found=Mt}function ji(ve,Ie,Xe,Ye,ht,Mt,Xt,nn,fn,Nn){let kn=Xt%2/2;_==1&&h.translate(kn,kn),Cn(nn,Xt,fn,Nn,nn),h.beginPath();let Dn,cr,ei,ur,yr=ht+(Ye==0||Ye==3?-Mt:Mt);Xe==0?(cr=ht,ur=yr):(Dn=ht,ei=yr);for(let Yn=0;Yn<ve.length;Yn++)Ie[Yn]!=null&&(Xe==0?Dn=ei=ve[Yn]:cr=ur=ve[Yn],h.moveTo(Dn,cr),h.lineTo(ei,ur));h.stroke(),_==1&&h.translate(-kn,-kn)}function na(ve){let Ie=!0;return A.forEach((Xe,Ye)=>{if(!Xe.show)return;let ht=N[Xe.scale];if(ht.min==null){Xe._show&&(Ie=!1,Xe._show=!1,ic(!1));return}else Xe._show||(Ie=!1,Xe._show=!0,ic(!1));let Mt=Xe.side,Xt=Mt%2,{min:nn,max:fn}=ht,[Nn,kn]=Os(Ye,nn,fn,Xt==0?Y:xe);if(kn==0)return;let Dn=ht.distr==2,cr=Xe._splits=Xe.splits(r,Ye,nn,fn,Nn,kn,Dn),ei=ht.distr==2?cr.map(Un=>On[Un]):cr,ur=ht.distr==2?On[cr[1]]-On[cr[0]]:Nn,yr=Xe._values=Xe.values(r,Xe.filter(r,ei,Ye,kn,ur),Ye,kn,ur);Xe._rotate=Mt==2?Xe.rotate(r,yr,Ye,kn):0;let Yn=Xe._size;Xe._size=sd(Xe.size(r,yr,Ye,ve)),Yn!=null&&Xe._size!=Yn&&(Ie=!1)}),Ie}function ba(ve){let Ie=!0;return pn.forEach((Xe,Ye)=>{let ht=Xe(r,Ye,It,ve);ht!=Ot[Ye]&&(Ie=!1),Ot[Ye]=ht}),Ie}function Pa(){for(let ve=0;ve<A.length;ve++){let Ie=A[ve];if(!Ie.show||!Ie._show)continue;let Xe=Ie.side,Ye=Xe%2,ht,Mt,Xt=Ie.stroke(r,ve),nn=Xe==0||Xe==3?-1:1,[fn,Nn]=Ie._found;if(Ie.label!=null){let mo=Ie.labelGap*nn,ko=da((Ie._lpos+mo)*Ri);zn(Ie.labelFont[0],Xt,"center",Xe==2?__:yO),h.save(),Ye==1?(ht=Mt=0,h.translate(ko,da(Qe+st/2)),h.rotate((Xe==3?-x2:x2)/2)):(ht=da(qe+nt/2),Mt=ko);let Qc=B$(Ie.label)?Ie.label(r,ve,fn,Nn):Ie.label;h.fillText(Qc,ht,Mt),h.restore()}if(Nn==0)continue;let kn=N[Ie.scale],Dn=Ye==0?nt:st,cr=Ye==0?qe:Qe,ei=Ie._splits,ur=kn.distr==2?ei.map(mo=>On[mo]):ei,yr=kn.distr==2?On[ei[1]]-On[ei[0]]:fn,Yn=Ie.ticks,Un=Ie.border,er=Yn.show?Yn.size:0,ns=da(er*Ri),zs=da((Ie.alignTo==2?Ie._size-er-Ie.gap:Ie.gap)*Ri),vi=Ie._rotate*-x2/180,ui=S(Ie._pos*Ri),ds=(ns+zs)*nn,Fs=ui+ds;Mt=Ye==0?Fs:0,ht=Ye==1?Fs:0;let sa=Ie.font[0],Bo=Ie.align==1?Kv:Ie.align==2?qA:vi>0?Kv:vi<0?qA:Ye==0?"center":Xe==3?qA:Kv,$i=vi||Ye==1?"middle":Xe==2?__:yO;zn(sa,Xt,Bo,$i);let Qs=Ie.font[1]*Ie.lineGap,Ho=ei.map(mo=>S(a(mo,kn,Dn,cr))),La=Ie._values;for(let mo=0;mo<La.length;mo++){let ko=La[mo];if(ko!=null){Ye==0?ht=Ho[mo]:Mt=Ho[mo],ko=""+ko;let Qc=ko.indexOf(`
`)==-1?[ko]:ko.split(/\n/gm);for(let Go=0;Go<Qc.length;Go++){let tv=Qc[Go];vi?(h.save(),h.translate(ht,Mt+Go*Qs),h.rotate(vi),h.fillText(tv,0,0),h.restore()):h.fillText(tv,ht,Mt+Go*Qs)}}}Yn.show&&ji(Ho,Yn.filter(r,ur,ve,Nn,yr),Ye,Xe,ui,ns,ss(Yn.width*Ri,3),Yn.stroke(r,ve),Yn.dash,Yn.cap);let po=Ie.grid;po.show&&ji(Ho,po.filter(r,ur,ve,Nn,yr),Ye,Ye==0?2:1,Ye==0?Qe:qe,Ye==0?st:nt,ss(po.width*Ri,3),po.stroke(r,ve),po.dash,po.cap),Un.show&&ji([ui],[1],Ye==0?1:0,Ye==0?1:2,Ye==1?Qe:qe,Ye==1?st:nt,ss(Un.width*Ri,3),Un.stroke(r,ve),Un.dash,Un.cap)}js("drawAxes")}function ic(ve){T.forEach((Ie,Xe)=>{Xe>0&&(Ie._paths=null,ve&&(i==1?(Ie.min=null,Ie.max=null):Ie.facets.forEach(Ye=>{Ye.min=null,Ye.max=null})))})}let El=!1,_a=!1,Ls=[];function sc(){_a=!1;for(let ve=0;ve<Ls.length;ve++)js(...Ls[ve]);Ls.length=0}function el(){El||(n0e(Da),El=!0)}function Ia(ve,Ie=!1){El=!0,_a=Ie,ve(r),Da(),Ie&&Ls.length>0&&queueMicrotask(sc)}r.batch=Ia;function Da(){if(Pe&&(ir(),Pe=!1),rt&&(Ae(),rt=!1),Ke){if(Is(x,Kv,we),Is(x,__,Te),Is(x,q_,Y),Is(x,X_,xe),Is(b,Kv,we),Is(b,__,Te),Is(b,q_,Y),Is(b,X_,xe),Is(m,q_,Ve),Is(m,X_,ue),f.width=da(Ve*Ri),f.height=da(ue*Ri),A.forEach(({_el:ve,_show:Ie,_size:Xe,_pos:Ye,side:ht})=>{if(ve!=null)if(Ie){let Mt=ht===3||ht===0?Xe:0,Xt=ht%2==1;Is(ve,Xt?"left":"top",Ye-Mt),Is(ve,Xt?"width":"height",Xe),Is(ve,Xt?"top":"left",Xt?Te:we),Is(ve,Xt?"height":"width",Xt?xe:Y),Kk(ve,ox)}else au(ve,ox)}),pt=xt=$t=Zt=Fe=bt=Tt=Yt=sn=null,Ht=1,Td(!0),we!=ge||Te!=Ue||Y!=be||xe!=ke){ic(!1);let ve=Y/be,Ie=xe/ke;if(oe&&!ye&&F.left>=0){F.left*=ve,F.top*=Ie,ra&&Uf(ra,da(F.left),0,Y,xe),ho&&Uf(ho,0,da(F.top),Y,xe);for(let Xe=0;Xe<Vt.length;Xe++){let Ye=Vt[Xe];Ye!=null&&(rn[Xe]*=ve,Bt[Xe]*=Ie,Uf(Ye,sd(rn[Xe]),sd(Bt[Xe]),Y,xe))}}if(Kr.show&&!$e&&Kr.left>=0&&Kr.width>0){Kr.left*=ve,Kr.width*=ve,Kr.top*=Ie,Kr.height*=Ie;for(let Xe in tg)Is(Oa,Xe,Kr[Xe])}ge=we,Ue=Te,be=Y,ke=xe}js("setSize"),Ke=!1}Ve>0&&ue>0&&(h.clearRect(0,0,f.width,f.height),js("drawClear"),R.forEach(ve=>ve()),js("draw")),Kr.show&&$e&&(Nl(Kr),$e=!1),oe&&ye&&(lc(null,!0,!1),ye=!1),X.show&&X.live&&Ze&&(Xp(),Ze=!1),l||(l=!0,r.status=1,js("ready")),_e=!1,El=!1}r.redraw=(ve,Ie)=>{rt=Ie||!1,ve!==!1?Ao(k,H.min,H.max):el()};function Xc(ve,Ie){let Xe=N[ve];if(Xe.from==null){if(Ct==0){let Ye=Xe.range(r,Ie.min,Ie.max,ve);Ie.min=Ye[0],Ie.max=Ye[1]}if(Ie.min>Ie.max){let Ye=Ie.min;Ie.min=Ie.max,Ie.max=Ye}if(Ct>1&&Ie.min!=null&&Ie.max!=null&&Ie.max-Ie.min<1e-16)return;ve==k&&Xe.distr==2&&Ct>0&&(Ie.min=Qd(Ie.min,e[0]),Ie.max=Qd(Ie.max,e[0]),Ie.min==Ie.max&&Ie.max++),V[ve]=Ie,Pe=!0,el()}}r.setScale=Xc;let Yc,oc,ra,ho,Uo,Al,Ss,tl,nl,Kc,ii,Wr,ia=!1;const Sr=F.drag;let Si=Sr.x,zi=Sr.y;oe&&(F.x&&(Yc=Qu(Cme,b)),F.y&&(oc=Qu(Eme,b)),H.ori==0?(ra=Yc,ho=oc):(ra=oc,ho=Yc),ii=F.left,Wr=F.top);const Kr=r.select=Qo({show:!0,over:!0,left:0,width:0,top:0,height:0},t.select),Oa=Kr.show?Qu(Tme,Kr.over?b:x):null;function Nl(ve,Ie){if(Kr.show){for(let Xe in ve)Kr[Xe]=ve[Xe],Xe in tg&&Is(Oa,Xe,ve[Xe]);Ie!==!1&&js("setSelect")}}r.setSelect=Nl;function ac(ve){if(T[ve].show)ce&&Kk(fe[ve],ox);else if(ce&&au(fe[ve],ox),oe){let Xe=wt?Vt[0]:Vt[ve];Xe!=null&&Uf(Xe,-10,-10,Y,xe)}}function Ao(ve,Ie,Xe){Xc(ve,{min:Ie,max:Xe})}function xi(ve,Ie,Xe,Ye){Ie.focus!=null&&kl(ve),Ie.show!=null&&T.forEach((ht,Mt)=>{Mt>0&&(ve==Mt||ve==null)&&(ht.show=Ie.show,ac(Mt),i==2?(Ao(ht.facets[0].scale,null,null),Ao(ht.facets[1].scale,null,null)):Ao(ht.scale,null,null),el())}),Xe!==!1&&js("setSeries",ve,Ie),Ye&&Ad("setSeries",r,ve,Ie)}r.setSeries=xi;function Nh(ve,Ie){Qo(D[ve],Ie)}function _d(ve,Ie){ve.fill=ai(ve.fill||null),ve.dir=Ci(ve.dir,-1),Ie=Ie??D.length,D.splice(Ie,0,ve)}function wd(ve){ve==null?D.length=0:D.splice(ve,1)}r.addBand=_d,r.setBand=Nh,r.delBand=wd;function hf(ve,Ie){T[ve].alpha=Ie,oe&&Vt[ve]!=null&&(Vt[ve].style.opacity=Ie),ce&&fe[ve]&&(fe[ve].style.opacity=Ie)}let wa,Yi,Ks;const Ms={focus:!0};function kl(ve){if(ve!=Ks){let Ie=ve==null,Xe=Pt.alpha!=1;T.forEach((Ye,ht)=>{if(i==1||ht>0){let Mt=Ie||ht==0||ht==ve;Ye._focus=Ie?null:Mt,Xe&&hf(ht,Mt?1:Pt.alpha)}}),Ks=ve,Xe&&el()}}ce&&kt&&Le(SO,se,ve=>{F._lock||(ot(ve),Ks!=null&&xi(null,Ms,!0,Ts.setSeries))});function No(ve,Ie,Xe){let Ye=N[Ie];Xe&&(ve=ve/Ri-(Ye.ori==1?Te:we));let ht=Y;Ye.ori==1&&(ht=xe,ve=ht-ve),Ye.dir==-1&&(ve=ht-ve);let Mt=Ye._min,Xt=Ye._max,nn=ve/ht,fn=Mt+(Xt-Mt)*nn,Nn=Ye.distr;return Nn==3?Ey(10,fn):Nn==4?Vme(fn,Ye.asinh):Nn==100?Ye.bwd(fn):fn}function $p(ve,Ie){let Xe=No(ve,k,Ie);return Qd(Xe,e[0],tn,en)}r.valToIdx=ve=>Qd(ve,e[0]),r.posToIdx=$p,r.posToVal=No,r.valToPos=(ve,Ie,Xe)=>N[Ie].ori==0?s(ve,N[Ie],Xe?nt:Y,Xe?qe:0):o(ve,N[Ie],Xe?st:xe,Xe?Qe:0),r.setCursor=(ve,Ie,Xe)=>{ii=ve.left,Wr=ve.top,lc(null,Ie,Xe)};function kh(ve,Ie){Is(Oa,Kv,Kr.left=ve),Is(Oa,q_,Kr.width=Ie)}function J0(ve,Ie){Is(Oa,__,Kr.top=ve),Is(Oa,X_,Kr.height=Ie)}let pf=H.ori==0?kh:J0,Sd=H.ori==1?kh:J0;function qp(){if(ce&&X.live)for(let ve=i==2?1:0;ve<T.length;ve++){if(ve==0&&Se)continue;let Ie=X.values[ve],Xe=0;for(let Ye in Ie)he[ve][Xe++].firstChild.nodeValue=Ie[Ye]}}function Xp(ve,Ie){if(ve!=null&&(ve.idxs?ve.idxs.forEach((Xe,Ye)=>{j[Ye]=Xe}):Xme(ve.idx)||j.fill(ve.idx),X.idx=j[0]),ce&&X.live){for(let Xe=0;Xe<T.length;Xe++)(Xe>0||i==1&&!Se)&&Md(Xe,j[Xe]);qp()}Ze=!1,Ie!==!1&&js("setLegend")}r.setLegend=Xp;function Md(ve,Ie){let Xe=T[ve],Ye=ve==0&&$==2?On:e[ve],ht;Se?ht=Xe.values(r,ve,Ie)??de:(ht=Xe.value(r,Ie==null?null:Ye[Ie],ve,Ie),ht=ht==null?de:{_:ht}),X.values[ve]=ht}function lc(ve,Ie,Xe){nl=ii,Kc=Wr,[ii,Wr]=F.move(r,ii,Wr),F.left=ii,F.top=Wr,oe&&(ra&&Uf(ra,da(ii),0,Y,xe),ho&&Uf(ho,0,da(Wr),Y,xe));let Ye,ht=tn>en;wa=is,Yi=null;let Mt=H.ori==0?Y:xe,Xt=H.ori==1?Y:xe;if(ii<0||Ct==0||ht){Ye=F.idx=null;for(let nn=0;nn<T.length;nn++){let fn=Vt[nn];fn!=null&&Uf(fn,-10,-10,Y,xe)}kt&&xi(null,Ms,!0,ve==null&&Ts.setSeries),X.live&&(j.fill(Ye),Ze=!0)}else{let nn,fn,Nn;i==1&&(nn=H.ori==0?ii:Wr,fn=No(nn,k),Ye=F.idx=Qd(fn,e[0],tn,en),Nn=G(e[0][Ye],H,Mt,0));let kn=-10,Dn=-10,cr=0,ei=0,ur=!0,yr="",Yn="";for(let Un=i==2?1:0;Un<T.length;Un++){let er=T[Un],ns=j[Un],zs=ns==null?null:i==1?e[Un][ns]:e[Un][1][ns],vi=F.dataIdx(r,Un,Ye,fn),ui=vi==null?null:i==1?e[Un][vi]:e[Un][1][vi];if(Ze=Ze||ui!=zs||vi!=ns,j[Un]=vi,Un>0&&er.show){let ds=vi==null?-10:vi==Ye?Nn:G(i==1?e[0][vi]:e[Un][0][vi],H,Mt,0),Fs=ui==null?-10:Z(ui,i==1?N[er.scale]:N[er.facets[1].scale],Xt,0);if(kt&&ui!=null){let sa=H.ori==1?ii:Wr,Bo=fa(Pt.dist(r,Un,vi,Fs,sa));if(Bo<wa){let $i=Pt.bias;if($i!=0){let Qs=No(sa,er.scale),Ho=ui>=0?1:-1,La=Qs>=0?1:-1;La==Ho&&(La==1?$i==1?ui>=Qs:ui<=Qs:$i==1?ui<=Qs:ui>=Qs)&&(wa=Bo,Yi=Un)}else wa=Bo,Yi=Un}}if(Ze||wt){let sa,Bo;H.ori==0?(sa=ds,Bo=Fs):(sa=Fs,Bo=ds);let $i,Qs,Ho,La,po,mo,ko=!0,Qc=dt.bbox;if(Qc!=null){ko=!1;let Go=Qc(r,Un);Ho=Go.left,La=Go.top,$i=Go.width,Qs=Go.height}else Ho=sa,La=Bo,$i=Qs=dt.size(r,Un);if(mo=dt.fill(r,Un),po=dt.stroke(r,Un),wt)Un==Yi&&wa<=Pt.prox&&(kn=Ho,Dn=La,cr=$i,ei=Qs,ur=ko,yr=mo,Yn=po);else{let Go=Vt[Un];Go!=null&&(rn[Un]=Ho,Bt[Un]=La,kO(Go,$i,Qs,ko),AO(Go,mo,po),Uf(Go,sd(Ho),sd(La),Y,xe))}}}}if(wt){let Un=Pt.prox,er=Ks==null?wa<=Un:wa>Un||Yi!=Ks;if(Ze||er){let ns=Vt[0];ns!=null&&(rn[0]=kn,Bt[0]=Dn,kO(ns,cr,ei,ur),AO(ns,yr,Yn),Uf(ns,sd(kn),sd(Dn),Y,xe))}}}if(Kr.show&&ia)if(ve!=null){let[nn,fn]=Ts.scales,[Nn,kn]=Ts.match,[Dn,cr]=ve.cursor.sync.scales,ei=ve.cursor.drag;if(Si=ei._x,zi=ei._y,Si||zi){let{left:ur,top:yr,width:Yn,height:Un}=ve.select,er=ve.scales[Dn].ori,ns=ve.posToVal,zs,vi,ui,ds,Fs,sa=nn!=null&&Nn(nn,Dn),Bo=fn!=null&&kn(fn,cr);sa&&Si?(er==0?(zs=ur,vi=Yn):(zs=yr,vi=Un),ui=N[nn],ds=G(ns(zs,Dn),ui,Mt,0),Fs=G(ns(zs+vi,Dn),ui,Mt,0),pf(ef(ds,Fs),fa(Fs-ds))):pf(0,Mt),Bo&&zi?(er==1?(zs=ur,vi=Yn):(zs=yr,vi=Un),ui=N[fn],ds=Z(ns(zs,cr),ui,Xt,0),Fs=Z(ns(zs+vi,cr),ui,Xt,0),Sd(ef(ds,Fs),fa(Fs-ds))):Sd(0,Xt)}else Zs()}else{let nn=fa(nl-Uo),fn=fa(Kc-Al);if(H.ori==1){let cr=nn;nn=fn,fn=cr}Si=Sr.x&&nn>=Sr.dist,zi=Sr.y&&fn>=Sr.dist;let Nn=Sr.uni;Nn!=null?Si&&zi&&(Si=nn>=Nn,zi=fn>=Nn,!Si&&!zi&&(fn>nn?zi=!0:Si=!0)):Sr.x&&Sr.y&&(Si||zi)&&(Si=zi=!0);let kn,Dn;Si&&(H.ori==0?(kn=Ss,Dn=ii):(kn=tl,Dn=Wr),pf(ef(kn,Dn),fa(Dn-kn)),zi||Sd(0,Xt)),zi&&(H.ori==1?(kn=Ss,Dn=ii):(kn=tl,Dn=Wr),Sd(ef(kn,Dn),fa(Dn-kn)),Si||pf(0,Mt)),!Si&&!zi&&(pf(0,0),Sd(0,0))}if(Sr._x=Si,Sr._y=zi,ve==null){if(Xe){if(Qp!=null){let[nn,fn]=Ts.scales;Ts.values[0]=nn!=null?No(H.ori==0?ii:Wr,nn):null,Ts.values[1]=fn!=null?No(H.ori==1?ii:Wr,fn):null}Ad(XA,r,ii,Wr,Y,xe,Ye)}if(kt){let nn=Xe&&Ts.setSeries,fn=Pt.prox;Ks==null?wa<=fn&&xi(Yi,Ms,!0,nn):wa>fn?xi(null,Ms,!0,nn):Yi!=Ks&&xi(Yi,Ms,!0,nn)}}Ze&&(X.idx=Ye,Xp()),Ie!==!1&&js("setCursor")}let cc=null;Object.defineProperty(r,"rect",{get(){return cc==null&&Td(!1),cc}});function Td(ve=!1){ve?cc=null:(cc=b.getBoundingClientRect(),js("syncRect",cc))}function eg(ve,Ie,Xe,Ye,ht,Mt,Xt){F._lock||ia&&ve!=null&&ve.movementX==0&&ve.movementY==0||(Yp(ve,Ie,Xe,Ye,ht,Mt,Xt,!1,ve!=null),ve!=null?lc(null,!0,!0):lc(Ie,!0,!1))}function Yp(ve,Ie,Xe,Ye,ht,Mt,Xt,nn,fn){if(cc==null&&Td(!1),ot(ve),ve!=null)Xe=ve.clientX-cc.left,Ye=ve.clientY-cc.top;else{if(Xe<0||Ye<0){ii=-10,Wr=-10;return}let[Nn,kn]=Ts.scales,Dn=Ie.cursor.sync,[cr,ei]=Dn.values,[ur,yr]=Dn.scales,[Yn,Un]=Ts.match,er=Ie.axes[0].side%2==1,ns=H.ori==0?Y:xe,zs=H.ori==1?Y:xe,vi=er?Mt:ht,ui=er?ht:Mt,ds=er?Ye:Xe,Fs=er?Xe:Ye;if(ur!=null?Xe=Yn(Nn,ur)?a(cr,N[Nn],ns,0):-10:Xe=ns*(ds/vi),yr!=null?Ye=Un(kn,yr)?a(ei,N[kn],zs,0):-10:Ye=zs*(Fs/ui),H.ori==1){let sa=Xe;Xe=Ye,Ye=sa}}fn&&(Ie==null||Ie.cursor.event.type==XA)&&((Xe<=1||Xe>=Y-1)&&(Xe=tx(Xe,Y)),(Ye<=1||Ye>=xe-1)&&(Ye=tx(Ye,xe))),nn?(Uo=Xe,Al=Ye,[Ss,tl]=F.move(r,Xe,Ye)):(ii=Xe,Wr=Ye)}const tg={width:0,height:0,left:0,top:0};function Zs(){Nl(tg,!1)}let ng,rg,ig,sg;function Au(ve,Ie,Xe,Ye,ht,Mt,Xt){ia=!0,Si=zi=Sr._x=Sr._y=!1,Yp(ve,Ie,Xe,Ye,ht,Mt,Xt,!0,!1),ve!=null&&(Le(YA,Xk,Cd,!1),Ad(_O,r,Ss,tl,Y,xe,null));let{left:nn,top:fn,width:Nn,height:kn}=Kr;ng=nn,rg=fn,ig=Nn,sg=kn}function Cd(ve,Ie,Xe,Ye,ht,Mt,Xt){ia=Sr._x=Sr._y=!1,Yp(ve,Ie,Xe,Ye,ht,Mt,Xt,!1,!0);let{left:nn,top:fn,width:Nn,height:kn}=Kr,Dn=Nn>0||kn>0,cr=ng!=nn||rg!=fn||ig!=Nn||sg!=kn;if(Dn&&cr&&Nl(Kr),Sr.setScale&&Dn&&cr){let ei=nn,ur=Nn,yr=fn,Yn=kn;if(H.ori==1&&(ei=fn,ur=kn,yr=nn,Yn=Nn),Si&&Ao(k,No(ei,k),No(ei+ur,k)),zi)for(let Un in N){let er=N[Un];Un!=k&&er.from==null&&er.min!=is&&Ao(Un,No(yr+Yn,Un),No(yr,Un))}Zs()}else F.lock&&(F._lock=!F._lock,lc(Ie,!0,ve!=null));ve!=null&&(ze(YA,Xk),Ad(YA,r,ii,Wr,Y,xe,null))}function Kp(ve,Ie,Xe,Ye,ht,Mt,Xt){if(F._lock)return;ot(ve);let nn=ia;if(ia){let fn=!0,Nn=!0,kn=10,Dn,cr;H.ori==0?(Dn=Si,cr=zi):(Dn=zi,cr=Si),Dn&&cr&&(fn=ii<=kn||ii>=Y-kn,Nn=Wr<=kn||Wr>=xe-kn),Dn&&fn&&(ii=ii<Ss?0:Y),cr&&Nn&&(Wr=Wr<tl?0:xe),lc(null,!0,!0),ia=!1}ii=-10,Wr=-10,j.fill(null),lc(null,!0,!0),nn&&(ia=nn)}function Zp(ve,Ie,Xe,Ye,ht,Mt,Xt){F._lock||(ot(ve),gt(),Zs(),ve!=null&&Ad(MO,r,ii,Wr,Y,xe,null))}function og(){A.forEach(uge),ft(r.width,r.height,!0)}Sx(o5,B1,og);const uc={};uc.mousedown=Au,uc.mousemove=eg,uc.mouseup=Cd,uc.dblclick=Zp,uc.setSeries=(ve,Ie,Xe,Ye)=>{let ht=Ts.match[2];Xe=ht(r,Ie,Xe),Xe!=-1&&xi(Xe,Ye,!0,!1)},oe&&(Le(_O,b,Au),Le(XA,b,eg),Le(wO,b,ve=>{ot(ve),Td(!1)}),Le(SO,b,Kp),Le(MO,b,Zp),nR.add(r),r.syncRect=Td);const Ed=r.hooks=t.hooks||{};function js(ve,Ie,Xe){_a?Ls.push([ve,Ie,Xe]):ve in Ed&&Ed[ve].forEach(Ye=>{Ye.call(null,r,Ie,Xe)})}(t.plugins||[]).forEach(ve=>{for(let Ie in ve.hooks)Ed[Ie]=(Ed[Ie]||[]).concat(ve.hooks[Ie])});const Nu=(ve,Ie,Xe)=>Xe,Ts=Qo({key:null,setSeries:!1,filters:{pub:OO,sub:OO},scales:[k,T[1]?T[1].scale:null],match:[LO,LO,Nu],values:[null,null]},F.sync);Ts.match.length==2&&Ts.match.push(Nu),F.sync=Ts;const Qp=Ts.key,Rh=dq(Qp);function Ad(ve,Ie,Xe,Ye,ht,Mt,Xt){Ts.filters.pub(ve,Ie,Xe,Ye,ht,Mt,Xt)&&Rh.pub(ve,Ie,Xe,Ye,ht,Mt,Xt)}Rh.sub(r);function Jp(ve,Ie,Xe,Ye,ht,Mt,Xt){Ts.filters.sub(ve,Ie,Xe,Ye,ht,Mt,Xt)&&uc[ve](null,Ie,Xe,Ye,ht,Mt,Xt)}r.pub=Jp;function ku(){Rh.unsub(r),nR.delete(r),He.clear(),Zk(o5,B1,og),c.remove(),se==null||se.remove(),js("destroy")}r.destroy=ku;function Zc(){js("init",t,e),tt(e||t.data,!1),V[k]?Xc(k,V[k]):gt(),$e=Kr.show&&(Kr.width>0||Kr.height>0),ye=Ze=!0,ft(t.width,t.height)}return T.forEach(Dt),A.forEach(Lt),n?n instanceof HTMLElement?(n.appendChild(c),Zc()):n(r,Zc):Zc(),r}ls.assign=Qo;ls.fmtNum=L8;ls.rangeNum=a5;ls.rangeLog=bC;ls.rangeAsinh=D8;ls.orient=qx;ls.pxRatio=Ri;ls.join=t0e;ls.fmtDate=z8,ls.tzDate=f0e;ls.sync=dq;{ls.addGap=X0e,ls.clipGaps=SC;let t=ls.paths={points:xq};t.linear=yq,t.stepped=Z0e,t.bars=Q0e,t.spline=ege}const dge=new Set(["timing_save_batch_total","timing_avg_inference_time","timing_avg_compute_reward_time","timing_compute_reward_normal_pct","timing_compute_reward_discarded_pct","timing_compute_reward_canceled_pct","timing_compute_reward_all_pct"]),W8=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_avg_inference_time","timing_avg_compute_reward_time","timing_generation_normal_pct","timing_generation_discarded_pct","timing_generation_canceled_pct","timing_generation_all_pct","timing_compute_reward_normal_pct","timing_compute_reward_discarded_pct","timing_compute_reward_canceled_pct","timing_compute_reward_all_pct","timing_idle_pct","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 os({label:t,onRemove:e}){return d.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[9px] bg-background border border-border text-muted-foreground rounded-full cursor-pointer hover:bg-muted transition-colors whitespace-nowrap shrink-0",onClick:n=>{n.stopPropagation(),e()},children:[t,d.jsx(ka,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function W0(){const[t,e]=w.useState(!1);w.useEffect(()=>{if(!t)return;const i=s=>{s.key==="Escape"&&e(!1)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]);const n=w.useCallback(()=>e(i=>!i),[]),r=w.useCallback(i=>t?Yl.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function $0({isFullscreen:t,onClick:e}){return d.jsx("button",{onClick:e,className:vt("h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all",t?"opacity-100":"opacity-0 group-hover/chart:opacity-100"),title:t?"Exit fullscreen":"Fullscreen",children:t?d.jsx(iC,{className:"h-3 w-3"}):d.jsx(rC,{className:"h-3 w-3"})})}function EC(t){if(t.length<4)return null;const e=[...t].sort((c,f)=>c-f),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 Sq(t){return t.split("/").pop()||t}function Pp(t){var n;return((n=t.runName)==null?void 0:n.trim())||Sq(t.runPath)}const fge=j1-1,iL="max-w-[190px]";function K_(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function hge(t){const e=K_(t),{isTruncated:n,prefix:r,suffix:i}=t$(t,fge);return n?`<span class="inline-flex ${iL} min-w-0 items-center align-bottom" title="${e}"><span class="shrink-0">${K_(r)}</span><span class="shrink-0 px-0.5 text-muted-foreground/70">...</span><span class="shrink-0">${K_(i)}</span></span>`:`<span class="inline-block ${iL} truncate align-bottom" title="${e}">${K_(r)}</span>`}function GS(t){const e=hge(Pp(t)),n=K_(Sq(t.runPath));return`${e} <span class="text-muted-foreground/70">(${n})</span>`}function Mq(t){const e=Math.abs(t);if(e>=60)return hC(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 wu(t)}const pge=28;function mge(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,f=l<t.length?t[l]:void 0,h=c!=null,m=f!=null;if(h&&m){const x=Math.abs(Number(e[a])-i),_=Math.abs(Number(e[l])-i)<x?l:a;return s(_)?_:null}if(h)return s(a)?a:null;if(m)return s(l)?l:null;a-=1,l+=1}return null}function B4(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const gge={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 xge(t){const e={...gge};if(t.length>0){const n=t.map(r=>({prefix:`reward_${r}`,label:vge(r)}));e.samples_metrics={title:"Samples Metrics",prefixes:n}}return e}function vge(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}const Tq=["mean","std","min","max"],Cq={mean:"Mean",std:"Std",min:"Min",max:"Max"};function q0(t,e){const n=typeof IntersectionObserver>"u",[r,i]=w.useState(n),[s,o]=w.useState(n),a=w.useRef(null),l=(e==null?void 0:e.root)??null,c=(e==null?void 0:e.rootMargin)??"0px",f=(e==null?void 0:e.threshold)??0;return w.useEffect(()=>{const h=t.current;if(!h||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(([x])=>{const b=x.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:f});return m.observe(h),()=>{m.disconnect(),a.current&&clearTimeout(a.current)}},[t,l,c,f]),r||s}function yge({runs:t,shouldPoll:e,maxStep:n,maxTime:r,showEma:i=!1,emaSpan:s=10,hoveredRunId:o=null,availableRewardNames:a=[],availableSampleTags:l,availableEnvs:c,customMetricSections:f={},xAxisMode:h="step",scrollRoot:m=null,evalsList:x=[]}){var Qe,nt,st,Pe,Ke,rt,ye,$e,Ze,ft,lt,Je,Ae,We,De,Ne,ot,dt,Pt,kt;const[b,_]=w.useState({}),[S,M]=w.useState(!0),[T,A]=w.useState(!0),[N,D]=w.useState(!0),[k,O]=w.useState(!0),[R,L]=w.useState({}),[B,H]=w.useState(!0),[$,G]=w.useState(!0),[Z,V]=w.useState(!0),[W,J]=w.useState(!0),[ne,ie]=w.useState(!0),[z,j]=w.useState(!0),X=w.useMemo(()=>xge(a),[a]),F=h==="time",ce=Gr(((Qe=t[0])==null?void 0:Qe.runPath)||"",F&&!!t[0],e),oe=Gr(((nt=t[1])==null?void 0:nt.runPath)||"",F&&!!t[1],e),Q=Gr(((st=t[2])==null?void 0:st.runPath)||"",F&&!!t[2],e),se=Gr(((Pe=t[3])==null?void 0:Pe.runPath)||"",F&&!!t[3],e),re=Gr(((Ke=t[4])==null?void 0:Ke.runPath)||"",F&&!!t[4],e),K=Gr(((rt=t[5])==null?void 0:rt.runPath)||"",F&&!!t[5],e),fe=Gr(((ye=t[6])==null?void 0:ye.runPath)||"",F&&!!t[6],e),he=Gr((($e=t[7])==null?void 0:$e.runPath)||"",F&&!!t[7],e),ae=Gr(((Ze=t[8])==null?void 0:Ze.runPath)||"",F&&!!t[8],e),Se=Gr(((ft=t[9])==null?void 0:ft.runPath)||"",F&&!!t[9],e),de=Gr(((lt=t[10])==null?void 0:lt.runPath)||"",F&&!!t[10],e),Me=Gr(((Je=t[11])==null?void 0:Je.runPath)||"",F&&!!t[11],e),Ce=Gr(((Ae=t[12])==null?void 0:Ae.runPath)||"",F&&!!t[12],e),Re=Gr(((We=t[13])==null?void 0:We.runPath)||"",F&&!!t[13],e),le=Gr(((De=t[14])==null?void 0:De.runPath)||"",F&&!!t[14],e),He=Gr(((Ne=t[15])==null?void 0:Ne.runPath)||"",F&&!!t[15],e),Le=Gr(((ot=t[16])==null?void 0:ot.runPath)||"",F&&!!t[16],e),ze=Gr(((dt=t[17])==null?void 0:dt.runPath)||"",F&&!!t[17],e),Ve=Gr(((Pt=t[18])==null?void 0:Pt.runPath)||"",F&&!!t[18],e),ue=Gr(((kt=t[19])==null?void 0:kt.runPath)||"",F&&!!t[19],e),{isStepTimesFetching:Y,isStepTimesRefetching:xe}=w.useMemo(()=>{if(!F)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const wt=[ce,oe,Q,se,re,K,fe,he,ae,Se,de,Me,Ce,Re,le,He,Le,ze,Ve,ue],Vt=wt.some(Gt=>Gt.isFetching),rn=wt.filter(Gt=>Gt.isFetching),Bt=Vt&&rn.length>0&&rn.every(Gt=>!!Gt.data);return{isStepTimesFetching:Vt,isStepTimesRefetching:Bt}},[F,ce,oe,Q,se,re,K,fe,he,ae,Se,de,Me,Ce,Re,le,He,Le,ze,Ve,ue]),{stepTimesByRun:we,firstStepTimesByRun:Te}=w.useMemo(()=>{if(!F)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const wt=[ce,oe,Q,se,re,K,fe,he,ae,Se,de,Me,Ce,Re,le,He,Le,ze,Ve,ue],Vt=new Map,rn=new Map;return t.forEach((Bt,Gt)=>{if(Gt>=20)return;const Qt=wt[Gt].data;if(!Qt||Qt.first_step_time===null||Qt.first_step_time===void 0||!Qt.step_times||Qt.step_times.length===0)return;const hn=new Map;Qt.step_times.forEach(It=>{typeof It.time=="number"&&hn.set(It.step,It.time)}),hn.size>0&&(Vt.set(Bt.runPath,hn),rn.set(Bt.runPath,Qt.first_step_time))}),{stepTimesByRun:Vt,firstStepTimesByRun:rn}},[t,F,ce,oe,Q,se,re,K,fe,he,ae,Se,de,Me,Ce,Re,le,He,Le,ze,Ve,ue]),ge={xAxisMode:h,stepTimesByRun:we,firstStepTimesByRun:Te,isStepTimesFetching:Y,isStepTimesRefetching:xe,scrollRoot:m,maxStepLimit:n,maxTimeLimit:r},Ue=w.useMemo(()=>Object.keys(f),[f]),be=w.useCallback(wt=>{_(Vt=>({...Vt,[wt]:!(Vt[wt]??!0)}))},[]),ke=w.useCallback(wt=>{L(Vt=>({...Vt,[wt]:!(Vt[wt]??!0)}))},[]),qe=x.length>0;return d.jsxs("div",{className:"-mt-3",children:[Ue.map((wt,Vt)=>{const rn=b[wt]??!0,Bt=f[wt]??{},Gt=Object.entries(Bt);return d.jsxs("div",{children:[Vt>0&&d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:rn,onOpenChange:()=>be(wt),children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!rn&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:B4(wt)})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"space-y-4 mt-3 mb-4",children:Gt.map(([Dt,Qt])=>d.jsxs("div",{children:[Dt&&d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:B4(Dt)}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Qt.map(hn=>d.jsx(nr,{runs:t,shouldPoll:e,metricName:hn,label:B4(hn),showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ge},hn))})]},Dt))})})]})]},wt)}),Ue.length>0&&d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:S,onOpenChange:M,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!S&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:X.reward.title})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"space-y-6 mt-3 mb-4",children:X.reward.prefixes.map(wt=>d.jsx(Og,{runs:t,shouldPoll:e,prefix:wt.prefix,label:wt.label,hideGroupLabel:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ge,extraCharts:wt.prefix==="reward_sum"?d.jsx(nr,{runs:t,shouldPoll:e,metricName:"reward_gini_mean",label:`${wt.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ge}):void 0},wt.prefix))})})]}),X.samples_metrics&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:T,onOpenChange:A,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!T&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:X.samples_metrics.title})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"space-y-6 mt-3 mb-4",children:X.samples_metrics.prefixes.map(wt=>d.jsx(Og,{runs:t,shouldPoll:e,prefix:wt.prefix,label:wt.label,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ge,extraCharts:d.jsx(nr,{runs:t,shouldPoll:e,metricName:`${wt.prefix}_gini_mean`,label:`${wt.label} Sparsity (Gini avg across groups)`,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ge})},wt.prefix))})})]})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:N,onOpenChange:D,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!N&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:X.advantage.title})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"space-y-6 mt-3 mb-4",children:X.advantage.prefixes.map(wt=>d.jsx(Og,{runs:t,shouldPoll:e,prefix:wt.prefix,label:wt.label,hideGroupLabel:!0,showZeroLine:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ge},wt.prefix))})})]}),qe&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:k,onOpenChange:O,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!k&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Evals"})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"mt-3 mb-4 space-y-4",children:x.map((wt,Vt)=>{const rn=wt.eval_name,Bt=wt.available_rollout_metric_names,Gt=R[rn]??!0;return d.jsxs("div",{children:[Vt>0&&d.jsx("div",{className:"border-t border-gray-100 my-3"}),d.jsxs(Pi,{open:Gt,onOpenChange:()=>ke(rn),children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-3.5 w-3.5 text-muted-foreground transition-transform",!Gt&&"-rotate-90")}),d.jsx("h4",{className:"text-sm font-medium text-muted-foreground",children:rn})]})})}),d.jsx(Di,{children:d.jsxs("div",{className:"space-y-6 mt-3",children:[Bt.map(Dt=>d.jsx(H4,{runs:t,shouldPoll:e,evalName:rn,prefix:`reward_${Dt}`,label:B4(Dt),showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:m,xAxisMode:h,stepTimesByRun:ge.stepTimesByRun,firstStepTimesByRun:ge.firstStepTimesByRun,isStepTimesFetching:ge.isStepTimesFetching,isStepTimesRefetching:ge.isStepTimesRefetching,maxStepLimit:ge.maxStepLimit,maxTimeLimit:ge.maxTimeLimit,availableEnvs:c},`${rn}-reward_${Dt}`)),d.jsx(H4,{runs:t,shouldPoll:e,evalName:rn,prefix:"length_completion",label:"Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:m,xAxisMode:h,stepTimesByRun:ge.stepTimesByRun,firstStepTimesByRun:ge.firstStepTimesByRun,isStepTimesFetching:ge.isStepTimesFetching,isStepTimesRefetching:ge.isStepTimesRefetching,maxStepLimit:ge.maxStepLimit,maxTimeLimit:ge.maxTimeLimit}),d.jsx(H4,{runs:t,shouldPoll:e,evalName:rn,prefix:"length_prompt",label:"Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:m,xAxisMode:h,stepTimesByRun:ge.stepTimesByRun,firstStepTimesByRun:ge.firstStepTimesByRun,isStepTimesFetching:ge.isStepTimesFetching,isStepTimesRefetching:ge.isStepTimesRefetching,maxStepLimit:ge.maxStepLimit,maxTimeLimit:ge.maxTimeLimit}),d.jsx(H4,{runs:t,shouldPoll:e,evalName:rn,prefix:"length_sum",label:"Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,scrollRoot:m,xAxisMode:h,stepTimesByRun:ge.stepTimesByRun,firstStepTimesByRun:ge.firstStepTimesByRun,isStepTimesFetching:ge.isStepTimesFetching,isStepTimesRefetching:ge.isStepTimesRefetching,maxStepLimit:ge.maxStepLimit,maxTimeLimit:ge.maxTimeLimit})]})})]})]},rn)})})})]})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:B,onOpenChange:H,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!B&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:X.rollouts.title})]})})}),d.jsx(Di,{children:d.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[X.rollouts.prefixes.map(wt=>d.jsx(Og,{runs:t,shouldPoll:e,prefix:wt.prefix,label:wt.label,unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ge},wt.prefix)),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"General"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(nr,{runs:t,shouldPoll:e,metricName:"stop_reason_length_pct",label:"% Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"group_length_gini_mean",label:"Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:o,availableSampleTags:l,availableEnvs:c,...ge}),d.jsx(nr,{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,availableEnvs:c,...ge})]})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Off-Policy Steps"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(nr,{runs:t,shouldPoll:e,metricName:"off_policy_steps_mean",label:"Off-Policy Steps (Mean)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"off_policy_steps_std",label:"Off-Policy Steps (Std)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),(()=>{const wt=t.find(Vt=>Vt.isSelected)??t[0];return wt?d.jsx(u5,{runPath:wt.runPath,metricType:"off_policy_steps",label:"Off-Policy Steps (Dist. Over Time)",shouldPoll:e,scrollRoot:m}):null})()]})]})]})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:$,onOpenChange:G,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!$&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Discarded Rollouts"})]})})}),d.jsx(Di,{children:d.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Discarded Rollouts General"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_count",label:"Discarded Count",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_pct",label:"Discarded Zero Advantage %",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_max_async_pct",label:"Discarded Max Async %",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_stop_reason_length_pct",label:"Discarded % Stop Reason = Length",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_group_length_gini_mean",label:"Discarded Group Completion Length Gini",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_group_length_max_median_ratio_mean",label:"Discarded Group Completion Length Max/Median",showEma:i,emaSpan:s,hoveredRunId:o,...ge})]})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Zero Advantage Breakdown"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_zero_pct",label:"Discarded Zero Advantage (All Reward = 0) %",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_all_positive_pct",label:"Discarded Zero Advantage (All Reward > 0) %",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_zero_advantage_mean_reward",label:"Discarded Zero Advantage Mean Reward",showEma:i,emaSpan:s,hoveredRunId:o,...ge})]})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Canceled"}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:d.jsx(nr,{runs:t,shouldPoll:e,metricName:"canceled_count",label:"Canceled Count",showEma:i,emaSpan:s,hoveredRunId:o,...ge})})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Off-Policy Steps"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_off_policy_steps_mean",label:"Discarded Off-Policy Steps (Mean)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"discarded_off_policy_steps_std",label:"Discarded Off-Policy Steps (Std)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),(()=>{const wt=t.find(Vt=>Vt.isSelected)??t[0];return wt?d.jsx(u5,{runPath:wt.runPath,metricType:"discarded_off_policy_steps",label:"Discarded Off-Policy Steps (Dist. Over Time)",shouldPoll:e,scrollRoot:m}):null})()]})]}),d.jsx(Og,{runs:t,shouldPoll:e,prefix:"discarded_length_prompt",label:"Discarded Tokens (Prompt)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(Og,{runs:t,shouldPoll:e,prefix:"discarded_length_completion",label:"Discarded Tokens (Completion)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(Og,{runs:t,shouldPoll:e,prefix:"discarded_length_sum",label:"Discarded Tokens (Total)",unit:"tokens",isTokenMetric:!0,showEma:i,emaSpan:s,hoveredRunId:o,...ge})]})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:Z,onOpenChange:V,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!Z&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Timeline Trainer"})]})})}),d.jsx(Di,{children:d.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Full Step (Total Time)"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_step_total",label:"Time per Step",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_step_active",label:"Time per Step Active (Excl. Wait)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_microbatch_count",label:"Microbatches per Step",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_forward_total",label:"Timing Forward",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_backward_total",label:"Timing Backward",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_total",label:"Timing Loss Computation",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_total",label:"Timing Compute KL",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_total",label:"Timing Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_total",label:"Timing Data to Device",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_total",label:"Timing Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_waiting_for_data",label:"Timing Waiting for Data",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_trainer_total",label:"Timing Weight Broadcast (Trainer)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_weight_sync_inference_total",label:"Timing Weight Broadcast (Inference)",showEma:i,emaSpan:s,hoveredRunId:o,...ge})]})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Microbatch (Mean Time per Microbatch)"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_forward_microbatch_mean",label:"Microbatch Timing Forward",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_backward_microbatch_mean",label:"Microbatch Timing Backward",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_loss_computation_microbatch_mean",label:"Microbatch Timing Loss Computation",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_compute_kl_microbatch_mean",label:"Microbatch Timing Compute KL",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_compute_entropy_microbatch_mean",label:"Microbatch Timing Compute Entropy",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_data_to_device_microbatch_mean",label:"Microbatch Timing Data to Device",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_prepare_tensors_microbatch_mean",label:"Microbatch Timing Prepare Tensors",showEma:i,emaSpan:s,hoveredRunId:o,...ge})]})]})]})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:W,onOpenChange:J,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!W&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Timeline Inference"})]})})}),d.jsx(Di,{children:d.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Batch & Averages"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_save_batch_total",label:"Batch Completion (Save Batch)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_avg_inference_time",label:"Avg Generation Time",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_avg_compute_reward_time",label:"Avg Compute Reward Time",showEma:i,emaSpan:s,hoveredRunId:o,...ge})]})]}),d.jsxs("div",{children:[d.jsx("h4",{className:"text-sm font-semibold text-muted-foreground mb-3",children:"Time Breakdown (% of Step Time)"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_generation_normal_pct",label:"Inference % Generation (Normal)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_generation_discarded_pct",label:"Inference % Generation (Discarded)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_generation_canceled_pct",label:"Inference % Generation (Canceled)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_generation_all_pct",label:"Inference % Generation (All)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_normal_pct",label:"Inference % Compute Reward (Normal)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_discarded_pct",label:"Inference % Compute Reward (Discarded)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_canceled_pct",label:"Inference % Compute Reward (Canceled)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_compute_reward_all_pct",label:"Inference % Compute Reward (All)",showEma:i,emaSpan:s,hoveredRunId:o,...ge}),d.jsx(nr,{runs:t,shouldPoll:e,metricName:"timing_idle_pct",label:"Inference % Idle Time",showEma:i,emaSpan:s,hoveredRunId:o,...ge})]})]})]})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:ne,onOpenChange:ie,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!ne&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Inference Performance"})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"mt-3 mb-4",children:t[0]&&d.jsx(Tge,{runs:t,shouldPoll:e,hoveredRunId:o,scrollRoot:m})})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:z,onOpenChange:j,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!z&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"Trainer Performance"})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"mt-3 mb-4",children:t[0]&&d.jsx(Nge,{runs:t,shouldPoll:e,hoveredRunId:o,scrollRoot:m})})})]})]})}const c5=100;function bge(t,e,n){const r=t.length;if(r<=c5)return{steps:t,counts:e};const i=Math.ceil(r/c5),s=[],o=[],a=n.length-1;for(let l=0;l<r;l+=i){const c=Math.min(l+i,r),f=Math.floor((l+c-1)/2);s.push(t[f]);const h=new Array(a).fill(0);for(let m=l;m<c;m++){const x=e[m];for(let b=0;b<a;b++)h[b]+=x[b]||0}o.push(h)}return{steps:s,counts:o}}function u5({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,shouldPoll:s,scrollRoot:o=null,headerPrefix:a,headerSuffix:l}){const c=Kn(us),{isFullscreen:f,toggleFullscreen:h,fullscreenPortal:m}=W0(),x=w.useRef(null),b=w.useRef(null),_=w.useRef(null),S=w.useRef(null),M=w.useRef(null),[T,A]=w.useState(0),D=q0(x,{root:o,threshold:0})||f,{data:k,isFetching:O,isRefetching:R}=QW(t,e,D&&!!t&&!!e,s),L=k&&k.steps.length>0&&k.bin_edges.length>0,B=L&&k.steps.length>c5,H=w.useMemo(()=>!L||!k?null:B?bge(k.steps,k.counts,k.bin_edges):{steps:k.steps,counts:k.counts},[L,k,B]),$=w.useCallback(ne=>ne==null?"N/A":i?Math.round(ne).toLocaleString():_u(ne),[i]),G=w.useCallback(ne=>Math.abs(ne)>=1e3?`${parseFloat((ne/1e3).toFixed(1))}k`:i?Math.round(ne).toString():Number.isInteger(ne)?ne.toLocaleString():Math.abs(ne)<.01&&ne!==0?ne.toExponential(1):String(parseFloat(ne.toFixed(2))),[i]),Z=w.useCallback(()=>{const ne={top:8,right:8,bottom:24,left:40};if(!_.current||!k)return ne;const ie=_.current.getContext("2d");if(!ie)return ne;const z="10px system-ui, sans-serif",j=5;let X=0;ie.save(),ie.setTransform(1,0,0,1,0,0),ie.font=z;for(let F=0;F<j;F++){const ce=(k.global_min??0)+F/(j-1)*((k.global_max??0)-(k.global_min??0)),oe=G(ce);X=Math.max(X,ie.measureText(oe).width)}return ie.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(X)+12)}},[k,G]);w.useEffect(()=>{if(!b.current||!_.current||!L||!k||!H)return;const ne=b.current,ie=_.current,z=ie.getContext("2d");if(!z)return;const j=ne.clientWidth,X=ne.clientHeight||200,F=c?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",ce=c?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",oe="10px system-ui, sans-serif",Q=window.devicePixelRatio||1;ie.width=j*Q,ie.height=X*Q,ie.style.width=`${j}px`,ie.style.height=`${X}px`,z.scale(Q,Q),z.font=oe,z.clearRect(0,0,j,X);const se=Z(),re=j-se.left-se.right,K=X-se.top-se.bottom,fe=H.steps,he=k.bin_edges,ae=H.counts,Se=fe.length,de=he.length-1;if(Se===0||de===0)return;let Me=0;for(const ue of ae)for(const Y of ue)Y>Me&&(Me=Y);const Ce=Math.min(5,Se),Re=5,le=re/Math.max(Se,1),He=ue=>se.left+(ue+.5)*le,Le=ue=>{const Y=(k.global_max??1)-(k.global_min??0),xe=(ue-(k.global_min??0))/(Y||1);return se.top+K-xe*K},ze=ue=>ue===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(ue/Me)*.75})`;z.strokeStyle=ce,z.lineWidth=1;for(let ue=0;ue<Ce;ue++){const Y=Math.floor(ue/Math.max(Ce-1,1)*(Se-1)),xe=He(Y);z.beginPath(),z.moveTo(xe,se.top),z.lineTo(xe,X-se.bottom),z.stroke()}for(let ue=0;ue<Re;ue++){const Y=(k.global_min??0)+ue/(Re-1)*((k.global_max??0)-(k.global_min??0)),xe=Le(Y);z.beginPath(),z.moveTo(se.left,xe),z.lineTo(j-se.right,xe),z.stroke()}const Ve=le;for(let ue=0;ue<Se;ue++){const Y=se.left+ue*le,xe=ae[ue];for(let we=0;we<de;we++){const Te=xe[we];if(Te===0)continue;const ge=he[we+1],Ue=he[we],be=Le(ge),ke=Le(Ue),qe=Math.max(1,ke-be);z.fillStyle=ze(Te),z.fillRect(Y,be,Ve,qe)}}if(r&&(k.global_min??0)<0&&(k.global_max??0)>0){const ue=Le(0);z.strokeStyle=c?"rgba(255, 255, 255, 0.3)":"rgba(128, 128, 128, 0.5)",z.lineWidth=1,z.setLineDash([5,5]),z.beginPath(),z.moveTo(se.left,ue),z.lineTo(j-se.right,ue),z.stroke(),z.setLineDash([])}z.strokeStyle=F,z.lineWidth=1,z.beginPath(),z.moveTo(se.left,X-se.bottom),z.lineTo(j-se.right,X-se.bottom),z.stroke(),z.beginPath(),z.moveTo(se.left,se.top),z.lineTo(se.left,X-se.bottom),z.stroke(),z.fillStyle=F,z.font=oe,z.textAlign="center";for(let ue=0;ue<Ce;ue++){const Y=Math.floor(ue/Math.max(Ce-1,1)*(Se-1)),xe=fe[Y],we=He(Y),Te=xe>=1e3?`${(xe/1e3).toFixed(0)}k`:xe.toString();z.fillText(Te,we,X-6)}z.textAlign="right",z.textBaseline="middle";for(let ue=0;ue<Re;ue++){const Y=(k.global_min??0)+ue/(Re-1)*((k.global_max??0)-(k.global_min??0)),xe=Le(Y);z.fillText(G(Y),se.left-4,xe)}},[k,H,L,r,G,Z,c,T,f]),w.useEffect(()=>{if(!b.current)return;const ne=b.current,ie=new ResizeObserver(()=>{A(z=>z+1)});return ie.observe(ne),()=>{ie.disconnect()}},[]);const V=w.useCallback(ne=>{var Te;if(!k||!H||!S.current||!_.current||!b.current)return;const ie=_.current.getBoundingClientRect(),z=ne.clientX-ie.left,j=ne.clientY-ie.top,X=b.current.clientWidth,F=b.current.clientHeight||200,ce=Z(),oe=X-ce.left-ce.right,Q=F-ce.top-ce.bottom;if(oe<=0||Q<=0){M.current&&(M.current.style.display="none");return}if(z<ce.left||z>X-ce.right||j<ce.top||j>F-ce.bottom){S.current.style.display="none",M.current&&(M.current.style.display="none");return}const se=(z-ce.left)/oe,re=Math.min(H.steps.length-1,Math.max(0,Math.round(se*(H.steps.length-1)))),K=H.steps[re];if(M.current){const ge=oe/Math.max(H.steps.length,1),Ue=ce.left+(re+.5)*ge;M.current.style.display="block",M.current.style.left=`${Ue}px`,M.current.style.top=`${ce.top}px`,M.current.style.bottom=`${ce.bottom}px`}const fe=1-(j-ce.top)/Q,he=k.bin_edges.length-1,ae=Math.min(he-1,Math.max(0,Math.floor(fe*he))),Se=k.bin_edges[ae],de=k.bin_edges[ae+1],Me=((Te=H.counts[re])==null?void 0:Te[ae])??0,Re=(H.counts[re]??[]).reduce((ge,Ue)=>ge+Ue,0),le=Re>0?(Me/Re*100).toFixed(1):"0.0",Le=B&&k.steps.length>c5?" (aggregated)":"";S.current.innerHTML=`
        <div class="font-medium mb-1">Step ${K.toLocaleString()}${Le}</div>
        <div class="text-muted-foreground">Range: ${$(Se)} to ${$(de)}</div>
        <div class="text-muted-foreground">Count: ${Me.toLocaleString()} (${le}%)</div>
      `,S.current.style.display="block",S.current.style.left="0px",S.current.style.top="0px";const ze=S.current.getBoundingClientRect(),Ve=ne.clientX;let ue=Ve;ue+ze.width+20>window.innerWidth&&(ue=Ve-ze.width);const Y=Math.max(4,window.innerWidth-ze.width-4);ue=Math.min(Math.max(4,ue),Y);const xe=b.current.getBoundingClientRect();let we=xe.top-ze.height+20;we<4&&(we=xe.top+8),S.current.style.left=`${ue-ze.left}px`,S.current.style.top=`${we-ze.top}px`},[k,H,$,Z,B]),W=w.useCallback(()=>{S.current&&(S.current.style.display="none"),M.current&&(M.current.style.display="none")},[]),J=O&&!R;return m(d.jsxs("div",{ref:x,className:vt("group/chart bg-background",f?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!f&&J&&"opacity-50"),children:[d.jsxs("div",{className:"flex items-center justify-between mb-3 shrink-0",children:[!f&&a,d.jsx("div",{className:"flex-1 min-w-0",children:d.jsx("h4",{className:vt("font-medium leading-snug line-clamp-2 break-words",f?"text-sm":"text-xs"),title:n,children:n})}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsx($0,{isFullscreen:f,onClick:h}),!f&&l]})]}),L?d.jsxs("div",{className:vt("relative bg-background rounded",f?"flex-1 min-h-0":"h-[200px]"),ref:b,children:[d.jsx("canvas",{className:"block w-full h-full max-w-full",ref:_,onMouseMove:V,onMouseLeave:W}),d.jsx("div",{ref:M,className:"absolute z-[2] border-l border-dashed border-gray-500/70 pointer-events-none",style:{display:"none"}}),d.jsx("div",{ref:S,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"}}),R&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:vt("flex items-center justify-center text-muted-foreground text-xs rounded",f?"flex-1 min-h-0":"h-[200px]"),children:O?"Loading...":"No data"})]}))}function _ge(t,e,n,r,i,s){const o=w.useMemo(()=>t.slice(0,20).map(c=>c.runPath).filter(Boolean),[t]),a=zfe(o,e,n?[n]:[],i&&o.length>0&&!!n,r,s);return{metricsByRunPath:w.useMemo(()=>{var f,h;const c=new Map;return(h=(f=a.data)==null?void 0:f.runs)==null||h.forEach(m=>{c.set(m.run_path,m.metrics??[])}),c},[a.data]),isFetching:a.isFetching,isRefetching:a.isFetching&&!!a.data}}function Eq({runs:t,shouldPoll:e,evalName:n,metricName:r,label:i,unit:s,showZeroLine:o,statType:a,isTokenMetric:l,showEma:c=!1,emaSpan:f=10,hoveredRunId:h=null,xAxisMode:m="step",stepTimesByRun:x,firstStepTimesByRun:b,isStepTimesFetching:_=!1,isStepTimesRefetching:S=!1,scrollRoot:M=null,maxStepLimit:T,maxTimeLimit:A,headerPrefix:N,headerSuffix:D,availableEnvs:k,filterKey:O}){const R=Kn(us),{isFullscreen:L,toggleFullscreen:B,fullscreenPortal:H}=W0(),$=w.useRef(null),G=w.useRef(null),Z=w.useRef(null),V=w.useRef(null),[W,J]=cn(GW),ne=w.useMemo(()=>`eval-metric-${n}-${r}`,[n,r]),ie=w.useRef(!1),z=w.useRef(!1);w.useEffect(()=>{const Ae=De=>{(De.key==="Control"||De.key==="Meta")&&(z.current=!0)},We=De=>{(De.key==="Control"||De.key==="Meta")&&(z.current=!1,J(null))};return window.addEventListener("keydown",Ae),window.addEventListener("keyup",We),()=>{window.removeEventListener("keydown",Ae),window.removeEventListener("keyup",We)}},[J]);const j=O??`eval/${n}/${r}`,[X,F]=cn(f8),oe=W8.has(r),Q=X[j],se=(Q==null?void 0:Q.ignoreOutliers)??!1,re=(Q==null?void 0:Q.ignoreFirstStep)??oe,K=(Q==null?void 0:Q.minY)??null,fe=(Q==null?void 0:Q.maxY)??null,he=(Q==null?void 0:Q.tagFilters)??{},ae=(Q==null?void 0:Q.envFilters)??[],Se=Object.keys(he).length>0,de=ae.length>0,Me=w.useCallback(Ae=>{F(We=>{const De={ignoreOutliers:!1,ignoreFirstStep:oe,minY:null,maxY:null,tagFilters:{},envFilters:[]},Ne=We[j]??De,ot=Ae(Ne);if(ot.ignoreOutliers===De.ignoreOutliers&&ot.ignoreFirstStep===De.ignoreFirstStep&&ot.minY===De.minY&&ot.maxY===De.maxY&&Object.keys(ot.tagFilters??{}).length===0&&(ot.envFilters??[]).length===0){if(!Object.prototype.hasOwnProperty.call(We,j))return We;const Pt={...We};return delete Pt[j],Pt}return{...We,[j]:ot}})},[j,F,oe]),Ce=w.useCallback(Ae=>{Me(We=>({...We,ignoreOutliers:Ae}))},[Me]),Re=w.useCallback(Ae=>{Me(We=>({...We,ignoreFirstStep:Ae}))},[Me]),le=w.useCallback(Ae=>{Me(We=>({...We,minY:Ae}))},[Me]),He=w.useCallback(Ae=>{Me(We=>({...We,maxY:Ae}))},[Me]),Le=w.useCallback((Ae,We)=>{Me(De=>{const Ne={...De.tagFilters??{}},ot=Ne[Ae]??[];if(ot.includes(We)){const dt=ot.filter(Pt=>Pt!==We);dt.length===0?delete Ne[Ae]:Ne[Ae]=dt}else Ne[Ae]=[...ot,We];return{...De,tagFilters:Ne}})},[Me]),ze=w.useCallback(Ae=>{Me(We=>{const De=[...We.envFilters??[]],Ne=De.indexOf(Ae);return Ne>=0?De.splice(Ne,1):De.push(Ae),{...We,envFilters:De}})},[Me]),ue=q0($,{root:M,threshold:0})||L,Y=w.useMemo(()=>{const Ae=t.filter(De=>!De.isSelected),We=t.filter(De=>De.isSelected);return[...Ae,...We]},[t]),xe=w.useMemo(()=>Y.slice(0,20),[Y]),we=w.useMemo(()=>{const Ae=new Map;return xe.forEach((We,De)=>{Ae.set(We.runPath,De)}),Ae},[xe]),{metricsByRunPath:Te,isFetching:ge,isRefetching:Ue}=_ge(t,n,r,e,ue,ae),{uplotData:be,seriesConfig:ke,isFetching:qe,isRefetching:Qe,hasData:nt,timeToStepByRun:st,outlierBounds:Pe}=w.useMemo(()=>{const Ae=new Set,We=new Map,De=new Map,Ne=new Map,ot=m==="time"&&!!x&&!!b,dt=ge;Y.forEach((Dt,Qt)=>{if(Qt>=20)return;const hn=Te.get(Dt.runPath)??[],It=new Map;if(hn.forEach(Lt=>{Ae.add(Lt.step),It.set(Lt.step,Lt.value)}),We.set(Qt,It),ot){const Lt=x==null?void 0:x.get(Dt.runPath),zt=b==null?void 0:b.get(Dt.runPath);if(Lt&&zt!==void 0){const pn=new Map,Ot=new Map;Lt.forEach((Ct,tn)=>{const en=Ct-zt;pn.set(tn,en),Ot.set(en,tn)}),De.set(Qt,pn),Ne.set(Qt,Ot)}}});const Pt=()=>!(!dt&&!_||dt&&!Ue||_&&!S);if(Ae.size===0)return{uplotData:null,seriesConfig:[],isFetching:dt||_,isRefetching:Pt(),hasData:!1,timeToStepByRun:Ne,outlierBounds:null};let kt=Array.from(Ae).sort((Dt,Qt)=>Dt-Qt);T!=null&&!ot&&(kt=kt.filter(Dt=>Dt<=T));let wt=kt;if(ot){const Dt=new Set;if(We.forEach((hn,It)=>{const Lt=De.get(It);Lt&&hn.forEach((zt,pn)=>{const Ot=Lt.get(pn);Ot!==void 0&&Dt.add(Ot)})}),Dt.size===0)return{uplotData:null,seriesConfig:[],isFetching:dt||_,isRefetching:Pt(),hasData:!1,timeToStepByRun:Ne,outlierBounds:null};let Qt=Array.from(Dt).sort((hn,It)=>hn-It);A!=null&&(Qt=Qt.filter(hn=>hn<=A)),wt=Qt}let Vt=null;if(se){const Dt=[];We.forEach(Qt=>{Qt.forEach(hn=>{Dt.push(hn)})}),Vt=EC(Dt)}const rn=new Float64Array(wt),Bt=[{label:ot?"Time (s)":"Step"}],Gt=[rn];return Y.forEach((Dt,Qt)=>{if(Qt>=20)return;const hn=We.get(Qt)||new Map;let It;if(ot){const Ot=De.get(Qt),Ct=new Map;Ot&&hn.forEach((tn,en)=>{const bn=Ot.get(en);bn!==void 0&&Ct.set(bn,tn)}),It=wt.map(tn=>Ct.get(tn)??null)}else It=kt.map(Ot=>hn.get(Ot)??null);const Lt=h===Dt.runPath,pn=h!==null&&!Lt?.1:c?.3:1;Gt.push(It),Bt.push({label:Pp(Dt),stroke:Dt.color,width:1,alpha:pn,spanGaps:!0,points:{show:!1}})}),c&&Y.forEach((Dt,Qt)=>{if(Qt>=20)return;const hn=We.get(Qt)||new Map,It=2/(f+1);let Lt=null,zt;if(ot){const tn=De.get(Qt),en=new Map;kt.forEach(bn=>{const On=hn.get(bn);if(On!==void 0){Lt=Lt===null?On:It*On+(1-It)*Lt;const _e=tn==null?void 0:tn.get(bn);_e!==void 0&&Lt!==null&&en.set(_e,Lt)}}),zt=wt.map(bn=>en.get(bn)??null)}else{const tn=[];kt.forEach(en=>{const bn=hn.get(en);bn!==void 0?(Lt=Lt===null?bn:It*bn+(1-It)*Lt,tn.push(Lt)):tn.push(null)}),zt=tn}const pn=h===Dt.runPath,Ct=h!==null&&!pn?.1:1;Gt.push(zt),Bt.push({label:`${Pp(Dt)} (EMA)`,stroke:Dt.color,width:1.5,alpha:Ct,spanGaps:!0,points:{show:!1}})}),{uplotData:Gt,seriesConfig:Bt,isFetching:dt||_,isRefetching:Pt(),hasData:!0,timeToStepByRun:Ne,outlierBounds:Vt}},[Y,Te,ge,Ue,c,f,h,m,x,b,_,S,T,A,se]),Ke=a||r.split("_").pop()||"",rt=m==="time",ye=w.useCallback(Ae=>Ae==null?"N/A":l&&(Ke==="min"||Ke==="max")?Math.round(Ae).toLocaleString():_u(Ae),[l,Ke]),$e=w.useCallback(Ae=>Math.abs(Ae)>=1e3?`${parseFloat((Ae/1e3).toFixed(1))}k`:l?Ke==="min"||Ke==="max"?Math.round(Ae).toString():String(parseFloat(Ae.toFixed(1))):Number.isInteger(Ae)?Ae.toLocaleString():Math.abs(Ae)<.01&&Ae!==0?Ae.toExponential(1):String(parseFloat(Ae.toFixed(2))),[l,Ke]),Ze=w.useCallback(Ae=>rt?wu(Ae):Ae>=1e3?`${(Ae/1e3).toFixed(0)}k`:Ae.toString(),[rt]);w.useEffect(()=>{if(!G.current||!be||!nt)return;const Ae=G.current,We=Ae.clientWidth,De=Ae.clientHeight||200;let Ne=1/0,ot=-1/0;for(let Lt=1;Lt<be.length;Lt++){const zt=be[Lt];for(let pn=0;pn<zt.length;pn++){if(re&&pn===0)continue;const Ot=zt[pn];Ot!=null&&(se&&Pe?Ot>=Pe.lower&&Ot<=Pe.upper&&(Ot<Ne&&(Ne=Ot),Ot>ot&&(ot=Ot)):(Ot<Ne&&(Ne=Ot),Ot>ot&&(ot=Ot)))}}Ne===1/0&&Pe&&(Ne=Pe.lower,ot=Pe.upper);const dt=ot-Ne,Pt=Math.max(Math.abs(ot),Math.abs(Ne)),kt=Math.max(Pt*.05,1e-10),wt=Math.max(dt*.1,kt);let Vt,rn;o?(Vt=Math.min(Ne-wt,0),rn=Math.max(ot+wt,0)):(Vt=Ne-wt,rn=ot+wt),K!==null&&(Vt=K),fe!==null&&(rn=fe);const Bt=R?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Gt=R?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Qt={width:We,height:De,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[Vt,rn]}},axes:[{stroke:Gt,grid:{stroke:Bt,width:1},ticks:{stroke:Bt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Lt,zt)=>zt.map(Ze)},{stroke:Gt,grid:{stroke:Bt,width:1},ticks:{stroke:Bt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Lt,zt)=>{if(!zt||zt.length===0)return 40;const pn=Math.max(...zt.map(Ot=>Ot.length));return Math.max(40,pn*7+14)},values:(Lt,zt)=>zt.map($e)}],series:ke,hooks:{draw:[Lt=>{var tn,en;if(!be)return;const zt=be[0],pn=Math.min(Y.length,20),Ot=Lt.series.length,Ct=Lt.ctx;Ct.save();for(let bn=1;bn<Ot;bn++){const On=be[bn];if(!On)continue;let _e=-1;for(let Fe=On.length-1;Fe>=0;Fe--)if(On[Fe]!==null&&On[Fe]!==void 0){_e=Fe;break}if(_e===-1)continue;const tt=zt[_e],gt=On[_e];if(tt===void 0||gt===void 0||gt===null)continue;const pt=Lt.valToPos(Number(tt),"x",!0),xt=Lt.valToPos(Number(gt),"y",!0);if(!Number.isFinite(pt)||!Number.isFinite(xt))continue;const $t=Lt.series[bn],sn=typeof($t==null?void 0:$t.alpha)=="number"?$t.alpha:1;let Zt=typeof($t==null?void 0:$t.stroke)=="string"?$t.stroke:void 0;if(!Zt){const Fe=bn-1;if(Fe<pn)Zt=(tn=Y[Fe])==null?void 0:tn.color;else if(c){const bt=Fe-pn;bt>=0&&bt<pn&&(Zt=(en=Y[bt])==null?void 0:en.color)}}Zt&&(Ct.globalAlpha=sn,Ct.fillStyle=Zt,Ct.beginPath(),Ct.arc(pt,xt,4,0,Math.PI*2),Ct.fill())}Ct.restore()}],setCursor:[Lt=>{if(!V.current)return;const{left:zt,top:pn,idx:Ot}=Lt.cursor;if(Ot==null||zt===void 0||pn===void 0||zt<0){V.current.style.display="none";return}const Ct=be[0][Ot];if(Ct===void 0){V.current.style.display="none";return}z.current&&!ie.current&&J({xValue:Number(Ct),sourceChartId:ne});let en=`<div class="font-medium mb-1">${rt?`Time ${Mq(Number(Ct))}`:`Step ${Number(Ct).toLocaleString()}`}</div>`;const bn=xe.length;t.forEach(pt=>{var bt;const xt=we.get(pt.runPath);if(xt===void 0)return;const $t=xt+1,sn=be[$t];if(!sn)return;const Zt=sn[Ot];let Fe;if(c){const Tt=bn+xt+1;Fe=(bt=be[Tt])==null?void 0:bt[Ot]}Zt!=null&&(en+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${pt.color}"></div>
                    <span>${GS(pt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${c?.7:1}">${ye(Zt)}${s?` ${s}`:""}</span>
                    ${c&&Fe!==void 0&&Fe!==null?`<span class="text-muted-foreground">(EMA: ${ye(Fe)})</span>`:""}
                  </div>
                </div>
              `)}),V.current.innerHTML=en,V.current.style.display="block";const On=G.current.getBoundingClientRect(),_e=V.current.getBoundingClientRect();let tt=On.left+zt+15;tt+_e.width+20>window.innerWidth&&(tt=On.left+zt-_e.width-15+Lt.bbox.left),tt=Math.max(4,tt);let gt=On.top-_e.height+20;gt<4&&(gt=On.top+8),V.current.style.left=`${tt}px`,V.current.style.top=`${gt}px`}]}};Z.current&&Z.current.destroy();const hn=new ls(Qt,be,Ae);Z.current=hn;const It=new ResizeObserver(Lt=>{for(const zt of Lt){const{width:pn,height:Ot}=zt.contentRect;hn&&pn>0&&Ot>0&&hn.setSize({width:pn,height:Ot})}});return It.observe(Ae),()=>{It.disconnect(),hn.destroy(),Z.current=null}},[be,ke,nt,Ze,$e,ye,rt,st,Y,h,c,o,s,t,xe,we,ne,J,se,re,Pe,K,fe,R,L]),w.useEffect(()=>{if(!W){V.current&&(V.current.style.display="none");return}if(W.sourceChartId===ne||!Z.current||!be)return;const Ae=Z.current,We=be[0];if(!We||We.length===0)return;const De=W.xValue;let Ne=0,ot=1/0;for(let Pt=0;Pt<We.length;Pt++){const kt=Math.abs(Number(We[Pt])-De);kt<ot&&(ot=kt,Ne=Pt)}const dt=Ae.valToPos(Number(We[Ne]),"x");dt>=0&&dt<=Ae.width&&(ie.current=!0,Ae.setCursor({left:dt,top:0}),ie.current=!1)},[W,ne,be]);const ft=w.useCallback(()=>{V.current&&(V.current.style.display="none"),(W==null?void 0:W.sourceChartId)===ne&&J(null)},[W,ne,J]),lt=qe&&!Qe,Je=i||(Ke?`${Ke.charAt(0).toUpperCase()}${Ke.slice(1)}`:r);return H(d.jsxs("div",{ref:$,className:vt("group/chart flex flex-col bg-background",L?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!L&&lt&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!L&&N,d.jsx("h4",{className:vt("font-medium leading-snug line-clamp-2 break-words",L?"text-sm":"text-xs"),title:r,children:Je})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:se,onCheckedChange:Ce,children:"Ignore Outliers"}),d.jsx(hr,{checked:re,onCheckedChange:Re,children:"Ignore First Step"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:K??"",onChange:Ae=>{const We=Ae.target.value;le(We===""?null:Number(We))},onClick:Ae=>Ae.stopPropagation(),onKeyDown:Ae=>Ae.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:fe??"",onChange:Ae=>{const We=Ae.target.value;He(We===""?null:Number(We))},onClick:Ae=>Ae.stopPropagation(),onKeyDown:Ae=>Ae.stopPropagation()})]}),k&&k.length>1&&d.jsxs(d.Fragment,{children:[d.jsx(ys,{}),d.jsx(y0,{className:"text-[10px] text-muted-foreground",children:"Filter by Environment"}),k.map(Ae=>d.jsx(hr,{checked:ae.includes(Ae),onCheckedChange:()=>ze(Ae),children:Ae},Ae))]})]})]}),d.jsx($0,{isFullscreen:L,onClick:B}),!L&&D]})]}),(se||re||K!==null||fe!==null||Se||de)&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[se&&d.jsx(os,{label:"Ignore Outliers",onRemove:()=>Ce(!1)}),re&&d.jsx(os,{label:"Ignore First Step",onRemove:()=>Re(!1)}),K!==null&&d.jsx(os,{label:`Min Y: ${K}`,onRemove:()=>le(null)}),fe!==null&&d.jsx(os,{label:`Max Y: ${fe}`,onRemove:()=>He(null)}),ae.map(Ae=>d.jsx(os,{label:`env: ${Ae}`,onRemove:()=>ze(Ae)},`env:${Ae}`)),Object.entries(he).map(([Ae,We])=>We.map(De=>d.jsx(os,{label:`${Ae}: ${De}`,onRemove:()=>Le(Ae,De)},`${Ae}:${De}`)))]})]}),nt?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:G,onMouseLeave:ft,children:[d.jsx("div",{ref:V,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"}}),Qe&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:qe?"Loading...":"No data"})]}))}function H4({runs:t,shouldPoll:e,evalName:n,prefix:r,label:i,unit:s,showZeroLine:o,isTokenMetric:a,showEma:l,emaSpan:c,hoveredRunId:f,xAxisMode:h,stepTimesByRun:m,firstStepTimesByRun:x,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:S,maxStepLimit:M,maxTimeLimit:T,availableEnvs:A}){return d.jsxs("div",{children:[d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:i}),d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Tq.map(N=>d.jsx(Eq,{runs:t,shouldPoll:e,evalName:n,metricName:`${r}_${N}`,label:`${i} ${Cq[N]}`,unit:s,showZeroLine:o,statType:N,isTokenMetric:a,showEma:l,emaSpan:c,hoveredRunId:f,xAxisMode:h,stepTimesByRun:m,firstStepTimesByRun:x,isStepTimesFetching:b,isStepTimesRefetching:_,scrollRoot:S,maxStepLimit:M,maxTimeLimit:T,availableEnvs:A},`${n}-${r}_${N}`))})]})}function Og({runs:t,shouldPoll:e,prefix:n,label:r,unit:i,showZeroLine:s,isTokenMetric:o,showEma:a,emaSpan:l,hoveredRunId:c,xAxisMode:f,stepTimesByRun:h,firstStepTimesByRun:m,isStepTimesFetching:x,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:S,maxTimeLimit:M,extraCharts:T,hideGroupLabel:A,availableSampleTags:N,availableEnvs:D}){const k=t.find(O=>O.isSelected)??t[0];return d.jsxs("div",{children:[!A&&d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground mb-3",children:r}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[Tq.map(O=>d.jsx(nr,{runs:t,shouldPoll:e,metricName:`${n}_${O}`,label:`${r} ${Cq[O]}`,unit:i,showZeroLine:s,statType:O,isTokenMetric:o,showEma:a,emaSpan:l,hoveredRunId:c,xAxisMode:f,stepTimesByRun:h,firstStepTimesByRun:m,isStepTimesFetching:x,isStepTimesRefetching:b,scrollRoot:_,maxStepLimit:S,maxTimeLimit:M,availableSampleTags:N,availableEnvs:D},`${n}_${O}`)),T,k&&d.jsx(u5,{runPath:k.runPath,metricType:n,label:`${r} (Dist. Over Time)`,showZeroLine:s,isTokenMetric:o,shouldPoll:e,scrollRoot:_})]})]})}function wge(t,e,n,r,i,s){const o=w.useMemo(()=>t.slice(0,20).map(f=>f.runPath).filter(Boolean),[t]),a=w.useMemo(()=>e?[e]:[],[e]),l=Lfe(o,a,r&&o.length>0&&a.length>0,n,i,s);return{metricsByRunPath:w.useMemo(()=>{var h,m;const f=new Map;return(m=(h=l.data)==null?void 0:h.runs)==null||m.forEach(x=>{f.set(x.run_path,x.metrics??[])}),f},[l.data]),isFetching:l.isFetching,isRefetching:l.isFetching&&!!l.data}}function nr({runs:t,shouldPoll:e,metricName:n,label:r,unit:i,showZeroLine:s,statType:o,isTokenMetric:a,showEma:l=!1,emaSpan:c=10,hoveredRunId:f=null,xAxisMode:h="step",stepTimesByRun:m,firstStepTimesByRun:x,isStepTimesFetching:b=!1,isStepTimesRefetching:_=!1,scrollRoot:S=null,defaultIgnoreOutliers:M,maxStepLimit:T,maxTimeLimit:A,headerPrefix:N,headerSuffix:D,availableSampleTags:k,availableEnvs:O,filterKey:R}){const L=Kn(us),{isFullscreen:B,toggleFullscreen:H,fullscreenPortal:$}=W0(),G=w.useRef(null),Z=w.useRef(null),V=w.useRef(null),W=w.useRef(null),[J,ne]=cn(GW),[ie,z]=cn(f8),j=w.useMemo(()=>`metric-${n}`,[n]),X=w.useRef(!1),F=w.useRef(!1);w.useEffect(()=>{const Ne=dt=>{(dt.key==="Control"||dt.key==="Meta")&&(F.current=!0)},ot=dt=>{(dt.key==="Control"||dt.key==="Meta")&&(F.current=!1,ne(null))};return window.addEventListener("keydown",Ne),window.addEventListener("keyup",ot),()=>{window.removeEventListener("keydown",Ne),window.removeEventListener("keyup",ot)}},[ne]);const ce=R??n,oe=M??!1,se=W8.has(n),re=ie[ce],K=(re==null?void 0:re.ignoreOutliers)??oe,fe=(re==null?void 0:re.ignoreFirstStep)??se,he=(re==null?void 0:re.minY)??null,ae=(re==null?void 0:re.maxY)??null,Se=(re==null?void 0:re.tagFilters)??{},de=(re==null?void 0:re.envFilters)??[],Me=w.useCallback(Ne=>{z(ot=>{const dt={ignoreOutliers:oe,ignoreFirstStep:se,minY:null,maxY:null,tagFilters:{},envFilters:[]},Pt=ot[ce]??dt,kt=Ne(Pt);if(kt.ignoreOutliers===dt.ignoreOutliers&&kt.ignoreFirstStep===dt.ignoreFirstStep&&kt.minY===dt.minY&&kt.maxY===dt.maxY&&Object.keys(kt.tagFilters??{}).length===0&&(kt.envFilters??[]).length===0){if(!Object.prototype.hasOwnProperty.call(ot,ce))return ot;const Vt={...ot};return delete Vt[ce],Vt}return{...ot,[ce]:kt}})},[ce,z,oe,se]),Ce=w.useCallback(Ne=>{Me(ot=>({...ot,ignoreOutliers:Ne}))},[Me]),Re=w.useCallback(Ne=>{Me(ot=>({...ot,ignoreFirstStep:Ne}))},[Me]),le=w.useCallback(Ne=>{Me(ot=>({...ot,minY:Ne}))},[Me]),He=w.useCallback(Ne=>{Me(ot=>({...ot,maxY:Ne}))},[Me]),Le=w.useCallback((Ne,ot)=>{Me(dt=>{const Pt={...dt.tagFilters??{}},kt=Pt[Ne]??[];if(kt.includes(ot)){const wt=kt.filter(Vt=>Vt!==ot);wt.length===0?delete Pt[Ne]:Pt[Ne]=wt}else Pt[Ne]=[...kt,ot];return{...dt,tagFilters:Pt}})},[Me]),ze=w.useCallback(Ne=>{Me(ot=>{const dt=[...ot.envFilters??[]],Pt=dt.indexOf(Ne);return Pt>=0?dt.splice(Pt,1):dt.push(Ne),{...ot,envFilters:dt}})},[Me]),Ve=Object.keys(Se).length>0,ue=de.length>0,xe=q0(G,{root:S,threshold:0})||B,we=w.useMemo(()=>{const Ne=t.filter(dt=>!dt.isSelected),ot=t.filter(dt=>dt.isSelected);return[...Ne,...ot]},[t]),Te=w.useMemo(()=>we.slice(0,20),[we]),ge=w.useMemo(()=>{const Ne=new Map;return Te.forEach((ot,dt)=>{Ne.set(ot.runPath,dt)}),Ne},[Te]),{metricsByRunPath:Ue,isFetching:be,isRefetching:ke}=wge(t,n,e,xe,Se,de),{uplotData:qe,seriesConfig:Qe,isFetching:nt,isRefetching:st,hasData:Pe,timeToStepByRun:Ke,outlierBounds:rt}=w.useMemo(()=>{const Ne=new Set,ot=new Map,dt=new Map,Pt=new Map,kt=h==="time"&&!!m&&!!x,wt=be;we.forEach((Lt,zt)=>{if(zt>=20)return;const pn=Ue.get(Lt.runPath)??[],Ot=new Map,Ct=dge.has(n);if(pn.forEach(tn=>{Ct&&tn.value===0||(Ne.add(tn.step),Ot.set(tn.step,tn.value))}),ot.set(zt,Ot),kt){const tn=m==null?void 0:m.get(Lt.runPath),en=x==null?void 0:x.get(Lt.runPath);if(tn&&en!==void 0){const bn=new Map,On=new Map;tn.forEach((_e,tt)=>{const gt=_e-en;bn.set(tt,gt),On.set(gt,tt)}),dt.set(zt,bn),Pt.set(zt,On)}}});const Vt=()=>!(!wt&&!b||wt&&!ke||b&&!_);if(Ne.size===0)return{uplotData:null,seriesConfig:[],isFetching:wt||b,isRefetching:Vt(),hasData:!1,timeToStepByRun:Pt,outlierBounds:null,minStep:null};const rn=Math.min(...Array.from(Ne));let Bt=Array.from(Ne).sort((Lt,zt)=>Lt-zt);T!=null&&!kt&&(Bt=Bt.filter(Lt=>Lt<=T));let Gt=Bt;if(kt){const Lt=new Set;if(ot.forEach((pn,Ot)=>{const Ct=dt.get(Ot);Ct&&pn.forEach((tn,en)=>{const bn=Ct.get(en);bn!==void 0&&Lt.add(bn)})}),Lt.size===0)return{uplotData:null,seriesConfig:[],isFetching:wt||b,isRefetching:Vt(),hasData:!1,timeToStepByRun:Pt,outlierBounds:null,minStep:null};let zt=Array.from(Lt).sort((pn,Ot)=>pn-Ot);A!=null&&(zt=zt.filter(pn=>pn<=A)),Gt=zt}let Dt=null;if(K){const Lt=[];ot.forEach(zt=>{zt.forEach(pn=>{Lt.push(pn)})}),Dt=EC(Lt)}const Qt=new Float64Array(Gt),hn=[{label:kt?"Time (s)":"Step"}],It=[Qt];return we.forEach((Lt,zt)=>{if(zt>=20)return;const pn=ot.get(zt)||new Map;let Ot;if(kt){const bn=dt.get(zt),On=new Map;bn&&pn.forEach((_e,tt)=>{const gt=bn.get(tt);gt!==void 0&&On.set(gt,_e)}),Ot=Gt.map(_e=>On.get(_e)??null)}else Ot=Bt.map(bn=>pn.get(bn)??null);const Ct=f===Lt.runPath,tn=f!==null;let en;tn&&!Ct?en=.1:en=l?.3:1,It.push(Ot),hn.push({label:Pp(Lt),stroke:Lt.color,width:1,alpha:en,spanGaps:!0,points:{show:!1}})}),l&&we.forEach((Lt,zt)=>{if(zt>=20)return;const pn=ot.get(zt)||new Map,Ot=2/(c+1);let Ct=null,tn;if(kt){const _e=dt.get(zt),tt=new Map;Bt.forEach(gt=>{const pt=pn.get(gt);if(pt!==void 0){!(Dt&&(pt<Dt.lower||pt>Dt.upper))&&!(fe&&gt===rn)&&(Ct=Ct===null?pt:Ot*pt+(1-Ot)*Ct);const sn=_e==null?void 0:_e.get(gt);sn!==void 0&&Ct!==null&&tt.set(sn,Ct)}}),tn=Gt.map(gt=>tt.get(gt)??null)}else{const _e=[];Bt.forEach(tt=>{const gt=pn.get(tt);gt!==void 0?(!(Dt&&(gt<Dt.lower||gt>Dt.upper))&&!(fe&&tt===rn)&&(Ct===null?Ct=gt:Ct=Ot*gt+(1-Ot)*Ct),_e.push(Ct)):_e.push(null)}),tn=_e}const en=f===Lt.runPath,bn=f!==null;let On;bn&&!en?On=.1:On=1,It.push(tn),hn.push({label:`${Pp(Lt)} (EMA)`,stroke:Lt.color,width:1.5,alpha:On,spanGaps:!0,points:{show:!1}})}),{uplotData:It,seriesConfig:hn,isFetching:wt||b,isRefetching:Vt(),hasData:!0,timeToStepByRun:Pt,outlierBounds:Dt,minStep:rn}},[we,Ue,be,ke,l,c,f,h,m,x,b,_,K,fe,T,A]),ye=o||n.split("_").pop()||"",$e=h==="time",Ze=n.startsWith("timing_")&&n!=="timing_microbatch_count"&&!n.endsWith("_pct"),ft=w.useCallback(Ne=>Ne==null?"N/A":a&&(ye==="min"||ye==="max")?Math.round(Ne).toLocaleString():_u(Ne),[a,ye]),lt=w.useCallback(Ne=>Ze?wu(Ne):Math.abs(Ne)>=1e3?`${parseFloat((Ne/1e3).toFixed(1))}k`:a?ye==="min"||ye==="max"?Math.round(Ne).toString():String(parseFloat(Ne.toFixed(1))):Number.isInteger(Ne)?Ne.toLocaleString():Math.abs(Ne)<.01&&Ne!==0?Ne.toExponential(1):String(parseFloat(Ne.toFixed(2))),[a,Ze,ye]),Je=w.useCallback(Ne=>$e?wu(Ne):Ne>=1e3?`${(Ne/1e3).toFixed(0)}k`:Ne.toString(),[$e]);w.useEffect(()=>{if(!Z.current||!qe||!Pe)return;const Ne=Z.current,ot=Ne.clientWidth,dt=Ne.clientHeight||200;let Pt=1/0,kt=-1/0;for(let Ot=1;Ot<qe.length;Ot++){const Ct=qe[Ot];for(let tn=0;tn<Ct.length;tn++){if(fe&&tn===0)continue;const en=Ct[tn];en!=null&&(K&&rt?en>=rt.lower&&en<=rt.upper&&(en<Pt&&(Pt=en),en>kt&&(kt=en)):(en<Pt&&(Pt=en),en>kt&&(kt=en)))}}Pt===1/0&&rt&&(Pt=rt.lower,kt=rt.upper);const wt=kt-Pt,Vt=Math.max(Math.abs(kt),Math.abs(Pt)),rn=Math.max(Vt*.05,1e-10),Bt=Math.max(wt*.1,rn);let Gt,Dt;s?(Gt=Math.min(Pt-Bt,0),Dt=Math.max(kt+Bt,0)):(Gt=Pt-Bt,Dt=kt+Bt),he!==null&&(Gt=he),ae!==null&&(Dt=ae);const Qt=L?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",hn=L?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Lt={width:ot,height:dt,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[Gt,Dt]}},axes:[{stroke:hn,grid:{stroke:Qt,width:1},ticks:{stroke:Qt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Ot,Ct)=>Ct.map(Je)},{stroke:hn,grid:{stroke:Qt,width:1},ticks:{stroke:Qt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Ot,Ct)=>{if(!Ct||Ct.length===0)return 40;const tn=Math.max(...Ct.map(en=>en.length));return Math.max(40,tn*7+14)},values:(Ot,Ct)=>Ct.map(lt)}],series:Qe,hooks:{draw:[Ot=>{var On,_e;if(!qe)return;const Ct=qe[0],tn=Math.min(we.length,20),en=Ot.series.length,bn=Ot.ctx;bn.save();for(let tt=1;tt<en;tt++){const gt=qe[tt];if(!gt)continue;let pt=-1;for(let Yt=gt.length-1;Yt>=0;Yt--){const Ht=gt[Yt];if(Ht!=null){pt=Yt;break}}if(pt===-1)continue;const xt=Ct[pt],$t=gt[pt];if(xt===void 0||$t===void 0||$t===null)continue;const sn=Ot.valToPos(Number(xt),"x",!0),Zt=Ot.valToPos(Number($t),"y",!0);if(!Number.isFinite(sn)||!Number.isFinite(Zt))continue;const Fe=Ot.series[tt],bt=typeof(Fe==null?void 0:Fe.alpha)=="number"?Fe.alpha:1;let Tt=typeof(Fe==null?void 0:Fe.stroke)=="string"?Fe.stroke:void 0;if(!Tt){const Yt=tt-1;if(Yt<tn)Tt=(On=we[Yt])==null?void 0:On.color;else if(l){const Ht=Yt-tn;Ht>=0&&Ht<tn&&(Tt=(_e=we[Ht])==null?void 0:_e.color)}}Tt&&(bn.globalAlpha=bt,bn.fillStyle=Tt,bn.beginPath(),bn.arc(sn,Zt,4,0,Math.PI*2),bn.fill())}bn.restore()}],setCursor:[Ot=>{if(!W.current)return;const{left:Ct,top:tn,idx:en}=Ot.cursor;if(en==null||Ct===void 0||tn===void 0||Ct<0){W.current.style.display="none";return}const bn=qe[0][en];if(bn===void 0){W.current.style.display="none";return}F.current&&!X.current&&ne({xValue:Number(bn),sourceChartId:j});const On=(()=>{var Cn,zn;if(!$e||!Ke)return null;const bt=Number(bn);if(f){const Zn=we.findIndex(Xn=>Xn.runPath===f);if(Zn>=0){const Xn=(Cn=Ke.get(Zn))==null?void 0:Cn.get(bt);if(Xn!==void 0)return Xn}}const Tt=we.findIndex(Zn=>Zn.isSelected);if(Tt>=0){const Zn=(zn=Ke.get(Tt))==null?void 0:zn.get(bt);if(Zn!==void 0)return Zn}let Yt=null;const Ht=new Set;return we.forEach((Zn,Xn)=>{var dn;const ir=(dn=Ke.get(Xn))==null?void 0:dn.get(bt);ir!==void 0&&(Ht.add(ir),Yt===null&&(Yt=ir))}),Ht.size===1,Yt})();let tt=`<div class="font-medium mb-1">${$e?`Time ${Mq(Number(bn))}${On!==null?` <span class="text-muted-foreground">(Step ${Number(On).toLocaleString()})</span>`:""}`:`Step ${Number(bn).toLocaleString()}`}</div>`;const gt=Te.length,pt=qe[0],xt=(()=>{if(!$e)return null;const bt=Ot.scales.x,Tt=Number(bt.min),Yt=Number(bt.max);if(!Number.isFinite(Tt)||!Number.isFinite(Yt))return null;const Ht=Math.abs(Yt-Tt);if(Ht<=0)return null;const Cn=Math.max(1,Ot.bbox.width);return Ht*pge/Cn})();t.forEach(bt=>{const Tt=ge.get(bt.runPath);if(Tt===void 0)return;const Yt=Tt+1,Ht=qe[Yt];if(!Ht)return;const Cn=$e?mge(Ht,pt,en,xt):en;if(Cn===null)return;const zn=Ht[Cn];let Zn;if(l){const Xn=gt+Tt+1,ir=qe[Xn];Zn=ir==null?void 0:ir[Cn]}zn!=null&&(tt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${bt.color}"></div>
                    <span>${GS(bt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${l?.7:1}">${Ze?Uk(zn):`${ft(zn)}${i?` ${i}`:""}`}</span>
                    ${l&&Zn!==void 0&&Zn!==null?`<span class="text-muted-foreground">(EMA: ${Ze?Uk(Zn):ft(Zn)})</span>`:""}
                  </div>
                </div>
              `)}),W.current.innerHTML=tt,W.current.style.display="block";const $t=Z.current.getBoundingClientRect(),sn=W.current.getBoundingClientRect();let Zt=$t.left+Ct+15;Zt+sn.width+20>window.innerWidth&&(Zt=$t.left+Ct-sn.width-15+Ot.bbox.left),Zt=Math.max(4,Zt);let Fe=$t.top-sn.height+20;Fe<4&&(Fe=$t.top+8),W.current.style.left=`${Zt}px`,W.current.style.top=`${Fe}px`}]}};V.current&&V.current.destroy();const zt=new ls(Lt,qe,Ne);V.current=zt;const pn=new ResizeObserver(Ot=>{for(const Ct of Ot){const{width:tn,height:en}=Ct.contentRect;zt&&tn>0&&en>0&&zt.setSize({width:tn,height:en})}});return pn.observe(Ne),()=>{pn.disconnect(),zt.destroy(),V.current=null}},[qe,Qe,Pe,Je,lt,ft,$e,Ke,we,f,l,s,i,K,rt,fe,he,ae,t,Te,ge,j,Ze,ne,L,B]),w.useEffect(()=>{if(!J){W.current&&(W.current.style.display="none");return}if(J.sourceChartId===j||!V.current||!qe)return;const Ne=V.current,ot=qe[0];if(!ot||ot.length===0)return;const dt=J.xValue;let Pt=0,kt=1/0;for(let Vt=0;Vt<ot.length;Vt++){const rn=Math.abs(Number(ot[Vt])-dt);rn<kt&&(kt=rn,Pt=Vt)}const wt=Ne.valToPos(Number(ot[Pt]),"x");wt>=0&&wt<=Ne.width&&(X.current=!0,Ne.setCursor({left:wt,top:0}),X.current=!1)},[J,j,qe]);const Ae=w.useCallback(()=>{W.current&&(W.current.style.display="none"),(J==null?void 0:J.sourceChartId)===j&&ne(null)},[J,j,ne]),We=nt&&!st,De=r||(ye?`${ye.charAt(0).toUpperCase()}${ye.slice(1)}`:n);return $(d.jsxs("div",{ref:G,className:vt("group/chart flex flex-col bg-background",B?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!B&&We&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!B&&N,d.jsx("h4",{className:vt("font-medium leading-snug line-clamp-2 break-words",B?"text-sm":"text-xs"),title:n,children:De})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:K,onCheckedChange:Ce,children:"Ignore Outliers"}),d.jsx(hr,{checked:fe,onCheckedChange:Re,children:"Ignore First Step"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:he??"",onChange:Ne=>{const ot=Ne.target.value;le(ot===""?null:Number(ot))},onClick:Ne=>Ne.stopPropagation(),onKeyDown:Ne=>Ne.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:Ne=>{const ot=Ne.target.value;He(ot===""?null:Number(ot))},onClick:Ne=>Ne.stopPropagation(),onKeyDown:Ne=>Ne.stopPropagation()})]}),O&&O.length>1&&d.jsxs(d.Fragment,{children:[d.jsx(ys,{}),d.jsx(y0,{className:"text-[10px] text-muted-foreground",children:"Filter by Environment"}),O.map(Ne=>d.jsx(hr,{checked:de.includes(Ne),onCheckedChange:()=>ze(Ne),children:Ne},Ne))]}),k&&Object.keys(k).length>0&&d.jsxs(d.Fragment,{children:[d.jsx(ys,{}),d.jsx(y0,{className:"text-[10px] text-muted-foreground",children:"Filter by Tag"}),Object.entries(k).map(([Ne,ot])=>{var dt;return d.jsxs(ffe,{children:[d.jsxs(hfe,{className:"text-xs",children:[Ne,(dt=Se[Ne])!=null&&dt.length?d.jsxs("span",{className:"ml-1 text-[10px] text-muted-foreground",children:["(",Se[Ne].length,")"]}):null]}),d.jsx(pfe,{className:"max-h-[300px] overflow-y-auto",children:ot.map(Pt=>d.jsx(hr,{checked:(Se[Ne]??[]).includes(Pt),onCheckedChange:()=>Le(Ne,Pt),children:Pt},Pt))})]},Ne)})]})]})]}),d.jsx($0,{isFullscreen:B,onClick:H}),!B&&D]})]}),(K||fe||he!==null||ae!==null||Ve||ue)&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[K&&d.jsx(os,{label:"Ignore Outliers",onRemove:()=>Ce(!1)}),fe&&d.jsx(os,{label:"Ignore First Step",onRemove:()=>Re(!1)}),he!==null&&d.jsx(os,{label:`Min Y: ${he}`,onRemove:()=>le(null)}),ae!==null&&d.jsx(os,{label:`Max Y: ${ae}`,onRemove:()=>He(null)}),de.map(Ne=>d.jsx(os,{label:`env: ${Ne}`,onRemove:()=>ze(Ne)},`env:${Ne}`)),Object.entries(Se).map(([Ne,ot])=>ot.map(dt=>d.jsx(os,{label:`${Ne}: ${dt}`,onRemove:()=>Le(Ne,dt)},`${Ne}:${dt}`)))]})]}),Pe?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:Z,onMouseLeave:Ae,children:[d.jsx("div",{ref:W,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"}}),st&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:nt?"Loading...":"No data"})]}))}function VS(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}const Sge=new Set(["avg_time_prefill","avg_time_decode","avg_time_compute_reward","avg_time_queue","avg_time_ttft","avg_time_inference","avg_time_e2e","avg_time_generation","avg_tokens_per_second_generation","tokens_per_second_throughput","vllm_requests_running_avg","vllm_requests_waiting_avg","vllm_preemptions","vllm_preemptions_per_request","vllm_ttft_avg"]),Mge=new Set(["avg_time_prefill","avg_time_decode","avg_time_compute_reward","avg_time_queue","avg_time_ttft","avg_time_inference","avg_time_e2e","avg_time_generation","vllm_ttft_avg"]);function wo({runs:t,shouldPoll:e,inferenceMetricType:n,label:r,hoveredRunId:i=null,scrollRoot:s=null,headerPrefix:o,headerSuffix:a}){var le,He,Le,ze,Ve,ue,Y,xe,we,Te;const l=Kn(us),{isFullscreen:c,toggleFullscreen:f,fullscreenPortal:h}=W0(),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),_=w.useRef(null),[S,M]=w.useState(!1),[T,A]=w.useState(!0),[N,D]=w.useState(!1),[k,O]=cn(zS),[R,L]=w.useState(()=>qi(k));w.useEffect(()=>{L(qi(k))},[k]);const B=w.useCallback(ge=>{const Ue=VS(ge);Ue!==null&&Ue>=1?(O(Ue),L(qi(Ue))):L(qi(k))},[k,O]),$=q0(m,{root:s,threshold:0})||c,G=Sge.has(n),Z=Mge.has(n),V=w.useMemo(()=>{const ge=t.filter(be=>!be.isSelected),Ue=t.filter(be=>be.isSelected);return[...ge,...Ue]},[t]),W=w.useMemo(()=>V.slice(0,20),[V]),J=Ju(((le=W[0])==null?void 0:le.runPath)??"",$&&!!W[0],e,k),ne=Ju(((He=W[1])==null?void 0:He.runPath)??"",$&&!!W[1],e,k),ie=Ju(((Le=W[2])==null?void 0:Le.runPath)??"",$&&!!W[2],e,k),z=Ju(((ze=W[3])==null?void 0:ze.runPath)??"",$&&!!W[3],e,k),j=Ju(((Ve=W[4])==null?void 0:Ve.runPath)??"",$&&!!W[4],e,k),X=Ju(((ue=W[5])==null?void 0:ue.runPath)??"",$&&!!W[5],e,k),F=Ju(((Y=W[6])==null?void 0:Y.runPath)??"",$&&!!W[6],e,k),ce=Ju(((xe=W[7])==null?void 0:xe.runPath)??"",$&&!!W[7],e,k),oe=Ju(((we=W[8])==null?void 0:we.runPath)??"",$&&!!W[8],e,k),Q=Ju(((Te=W[9])==null?void 0:Te.runPath)??"",$&&!!W[9],e,k),se=w.useMemo(()=>[J,ne,ie,z,j,X,F,ce,oe,Q],[J,ne,ie,z,j,X,F,ce,oe,Q]),re=se.some((ge,Ue)=>Ue<W.length&&ge.isFetching),K=re&&se.filter((ge,Ue)=>Ue<W.length&&ge.isFetching).every(ge=>!!ge.data),{uplotData:fe,seriesConfig:he,hasData:ae,outlierBounds:Se}=w.useMemo(()=>{const ge=new Map,Ue=new Set;let be=!1;if(W.forEach((Pe,Ke)=>{if(Ke>=10)return;const rt=se[Ke].data;if(!rt||rt.first_time===null)return;const ye=rt.first_time,$e=rt[n];if(!$e||$e.length===0)return;let Ze=null;if(T){const lt=rt.step_times??[];lt.length>0&&(Ze=lt[0].time-ye)}be=!0;const ft=new Map;if($e.forEach(lt=>{const Je=G?lt.value:lt.count;if(Je!=null){if(Z&&Je===0)return;const Ae=lt.time-ye;if(T&&Ze!==null&&Ae<Ze)return;ft.set(Ae,Je),Ue.add(Ae)}}),!N&&$e.length>0){const lt=rt.last_time;if(lt!=null){const Je=$e[$e.length-1].time;if(Je+k>lt){const Ae=Je-ye;ft.delete(Ae),Ue.delete(Ae)}}}if(!G&&ft.size>0){const lt=Array.from(ft.keys()),Je=Math.min(...lt),Ae=Math.max(...lt);for(let We=Je+k;We<Ae;We+=k)ft.has(We)||(ft.set(We,0),Ue.add(We))}ge.set(Ke,ft)}),!be||Ue.size===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};let ke=null;if(S){const Pe=[];ge.forEach(Ke=>{Ke.forEach(rt=>Pe.push(rt))}),ke=EC(Pe)}const qe=Array.from(Ue).sort((Pe,Ke)=>Pe-Ke),Qe=new Float64Array(qe),nt=[{label:"Time (s)"}],st=[Qe];return W.forEach((Pe,Ke)=>{if(Ke>=10)return;const rt=ge.get(Ke),ye=qe.map(lt=>(rt==null?void 0:rt.get(lt))??null),$e=i===Pe.runPath,ft=i!==null&&!$e?.1:1;st.push(ye),nt.push({label:Pp(Pe),stroke:Pe.color,width:1,alpha:ft,spanGaps:!0,points:{show:!1}})}),{uplotData:st,seriesConfig:nt,hasData:!0,outlierBounds:ke}},[W,se,n,i,G,S,T,N,k]),de=w.useCallback(ge=>ge==null?"N/A":Z?Uk(ge):G?Math.round(ge).toLocaleString():_u(ge),[Z,G]),Me=w.useCallback(ge=>Z?wu(ge):Math.abs(ge)>=1e3?`${parseFloat((ge/1e3).toFixed(1))}k`:Number.isInteger(ge)?ge.toLocaleString():String(parseFloat(ge.toFixed(2))),[Z]);w.useEffect(()=>{if(!x.current||!fe||!ae)return;const ge=x.current,Ue=ge.clientWidth,be=ge.clientHeight||200;let ke=1/0,qe=-1/0;for(let Ae=1;Ae<fe.length;Ae++){const We=fe[Ae];for(let De=0;De<We.length;De++){const Ne=We[De];Ne!=null&&Number.isFinite(Ne)&&(S&&Se?Ne>=Se.lower&&Ne<=Se.upper&&(Ne<ke&&(ke=Ne),Ne>qe&&(qe=Ne)):(Ne<ke&&(ke=Ne),Ne>qe&&(qe=Ne)))}}ke===1/0&&Se&&(ke=Se.lower,qe=Se.upper),ke===1/0&&(ke=0,qe=1);const Qe=qe-ke,nt=Math.max(Math.abs(qe),Math.abs(ke)),st=Math.max(nt*.05,1e-10),Pe=Math.max(Qe*.1,st),Ke=ke-Pe,rt=qe+Pe,ye=l?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",$e=l?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",ft={width:Ue,height:be,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[Ke,rt]}},axes:[{stroke:$e,grid:{stroke:ye,width:1},ticks:{stroke:ye,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Ae,We)=>We.map(De=>wu(De))},{stroke:$e,grid:{stroke:ye,width:1},ticks:{stroke:ye,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Ae,We)=>{if(!We||We.length===0)return 40;const De=Math.max(...We.map(Ne=>Ne.length));return Math.max(40,De*7+14)},values:(Ae,We)=>We.map(Me)}],series:he,hooks:{draw:[Ae=>{var De;if(!fe)return;const We=Ae.ctx;We.save();for(let Ne=1;Ne<Ae.series.length;Ne++){const ot=fe[Ne];if(!ot)continue;let dt=-1;for(let Dt=ot.length-1;Dt>=0;Dt--)if(ot[Dt]!==null&&ot[Dt]!==void 0){dt=Dt;break}if(dt===-1)continue;const Pt=fe[0][dt],kt=ot[dt];if(Pt===void 0||kt===void 0||kt===null)continue;const wt=Ae.valToPos(Number(Pt),"x",!0),Vt=Ae.valToPos(Number(kt),"y",!0);if(!Number.isFinite(wt)||!Number.isFinite(Vt))continue;const rn=Ae.series[Ne],Bt=typeof(rn==null?void 0:rn.alpha)=="number"?rn.alpha:1,Gt=typeof(rn==null?void 0:rn.stroke)=="string"?rn.stroke:(De=V[Ne-1])==null?void 0:De.color;Gt&&(We.globalAlpha=Bt,We.fillStyle=Gt,We.beginPath(),We.arc(wt,Vt,4,0,Math.PI*2),We.fill())}We.restore()}],setCursor:[Ae=>{if(!_.current||!fe)return;const{left:We,top:De,idx:Ne}=Ae.cursor;if(Ne==null||We===void 0||De===void 0||We<0){_.current.style.display="none";return}const ot=fe[0][Ne];if(ot===void 0){_.current.style.display="none";return}let Pt=`<div class="font-medium mb-1">${`Time ${qi(Number(ot))}`}</div>`;t.forEach(Bt=>{const Gt=W.findIndex(It=>It.runPath===Bt.runPath);if(Gt===-1)return;const Dt=Gt+1,Qt=fe[Dt];if(!Qt)return;const hn=Qt[Ne];hn!=null&&(Pt+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Bt.color}"></div>
                    <span>${GS(Bt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium">${de(hn)}</span>
                  </div>
                </div>
              `)}),_.current.innerHTML=Pt,_.current.style.display="block";const kt=x.current.getBoundingClientRect(),wt=_.current.getBoundingClientRect();let Vt=kt.left+We+15;Vt+wt.width+20>window.innerWidth&&(Vt=kt.left+We-wt.width-15+Ae.bbox.left),Vt=Math.max(4,Vt);let rn=kt.top-wt.height+20;rn<4&&(rn=kt.top+8),_.current.style.left=`${Vt}px`,_.current.style.top=`${rn}px`}]}};b.current&&b.current.destroy();const lt=new ls(ft,fe,ge);b.current=lt;const Je=new ResizeObserver(Ae=>{for(const We of Ae){const{width:De,height:Ne}=We.contentRect;lt&&De>0&&Ne>0&&lt.setSize({width:De,height:Ne})}});return Je.observe(ge),()=>{Je.disconnect(),lt.destroy(),b.current=null}},[fe,he,ae,S,Se,l,V,t,W,i,de,Me,k,c]);const Ce=w.useCallback(()=>{_.current&&(_.current.style.display="none")},[]),Re=re&&!K;return h(d.jsxs("div",{ref:m,className:vt("group/chart flex flex-col bg-background",c?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!c&&Re&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!c&&o,d.jsx("h4",{className:vt("font-medium leading-snug line-clamp-2 break-words",c?"text-sm":"text-xs"),title:r,children:r})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:S,onCheckedChange:M,children:"Ignore Outliers"}),d.jsx(hr,{checked:T,onCheckedChange:A,children:"Ignore First Step"}),d.jsx(hr,{checked:N,onCheckedChange:D,children:"Show Unfinished Intervals"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),d.jsx("input",{type:"text",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:"1m",value:R,onChange:ge=>L(ge.target.value),onBlur:ge=>B(ge.target.value),onKeyDown:ge=>{ge.stopPropagation(),ge.key==="Enter"&&B(ge.currentTarget.value)},onClick:ge=>ge.stopPropagation()})]})]})]}),d.jsx($0,{isFullscreen:c,onClick:f}),!c&&a]})]}),d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[d.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 text-[9px] bg-background border border-border text-muted-foreground rounded-full whitespace-nowrap shrink-0",children:R}),S&&d.jsx(os,{label:"Ignoring Outliers",onRemove:()=>M(!1)}),T&&d.jsx(os,{label:"Ignoring First Step",onRemove:()=>A(!1)}),N&&d.jsx(os,{label:"Showing Unfinished Intervals",onRemove:()=>D(!1)})]})]}),ae?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:x,onMouseLeave:Ce,children:[d.jsx("div",{ref:_,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"}}),K&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:re?"Loading...":"No data"})]}))}function Tge({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null}){const i={runs:t,shouldPoll:e,hoveredRunId:n,scrollRoot:r};return d.jsxs("div",{children:[d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-1",children:"Breakdown (Area)"}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[d.jsx(iR,{runs:t,shouldPoll:e,scrollRoot:r,label:"Inference Idle vs Working",categories:["idle","working"]}),d.jsx(iR,{runs:t,shouldPoll:e,scrollRoot:r,label:"Inference Idle vs Generating vs Weight Sync",categories:["idle","generating","weight_broadcast"]}),d.jsx(Iq,{runs:t,shouldPoll:e,scrollRoot:r,label:"Inference Kept vs Discarded vs Canceled",categories:["kept","discarded","canceled"]})]}),d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"Requests Count"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(wo,{inferenceMetricType:"inference_calls",label:"Inference Calls",...i}),d.jsx(wo,{inferenceMetricType:"requests_done",label:"Requests Done",...i}),d.jsx(wo,{inferenceMetricType:"rollouts_group_done",label:"Rollouts Group Done",...i}),d.jsx(wo,{inferenceMetricType:"rollouts_group_done_kept",label:"Rollouts Group Done Kept",...i}),d.jsx(wo,{inferenceMetricType:"rollouts_group_done_discarded",label:"Rollouts Group Done Discarded",...i}),d.jsx(wo,{inferenceMetricType:"rollouts_group_done_canceled",label:"Rollouts Group Done Canceled",...i})]}),d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"Throughput"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(wo,{inferenceMetricType:"avg_tokens_per_second_generation",label:"Tokens/s per Generation",...i}),d.jsx(wo,{inferenceMetricType:"tokens_per_second_throughput",label:"Tokens/s Throughput",...i})]}),d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"Latency"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(wo,{inferenceMetricType:"avg_time_queue",label:"Avg Queue Time",...i}),d.jsx(wo,{inferenceMetricType:"avg_time_ttft",label:"Avg Time to First Token",...i}),d.jsx(wo,{inferenceMetricType:"avg_time_prefill",label:"Avg Prefill Time",...i}),d.jsx(wo,{inferenceMetricType:"avg_time_decode",label:"Avg Decode Time",...i}),d.jsx(wo,{inferenceMetricType:"avg_time_inference",label:"Avg Inference Time",...i}),d.jsx(wo,{inferenceMetricType:"avg_time_e2e",label:"Avg E2E Latency",...i}),d.jsx(wo,{inferenceMetricType:"avg_time_generation",label:"Avg Generation Duration",...i}),d.jsx(wo,{inferenceMetricType:"avg_time_compute_reward",label:"Avg Compute Reward Time",...i})]}),d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"vLLM"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(wo,{inferenceMetricType:"vllm_requests_running_avg",label:"vLLM Requests Running Average",...i}),d.jsx(wo,{inferenceMetricType:"vllm_requests_waiting_avg",label:"vLLM Requests Waiting Average",...i}),d.jsx(wo,{inferenceMetricType:"vllm_preemptions",label:"vLLM Preemptions",...i}),d.jsx(wo,{inferenceMetricType:"vllm_preemptions_per_request",label:"vLLM Preemptions per Request",...i}),d.jsx(wo,{inferenceMetricType:"vllm_ttft_avg",label:"vLLM TTFT Average",...i})]})]})}function Aq({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null,inferenceMetricType:i,label:s,headerPrefix:o,headerSuffix:a}){return d.jsx(wo,{runs:t,shouldPoll:e,hoveredRunId:n,scrollRoot:r,inferenceMetricType:i,label:s,headerPrefix:o,headerSuffix:a})}const Nq=[{key:"inference_area_kept_vs_discarded_vs_canceled",label:"Inference Kept vs Discarded vs Canceled",categories:["kept","discarded","canceled"]}];function kq({runs:t,shouldPoll:e,scrollRoot:n=null,label:r,categories:i,headerPrefix:s,headerSuffix:o}){return d.jsx(Iq,{runs:t,shouldPoll:e,scrollRoot:n,label:r,categories:i,headerPrefix:s,headerSuffix:o})}const Rq=[{key:"inference_util_idle_vs_working",label:"Inference Idle vs Working",categories:["idle","working"]},{key:"inference_util_idle_vs_generating_vs_weight_sync",label:"Inference Idle vs Generating vs Weight Sync",categories:["idle","generating","weight_broadcast"]}];function iR({runs:t,shouldPoll:e,label:n,categories:r,scrollRoot:i=null,headerPrefix:s,headerSuffix:o}){const a=Kn(us),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:f}=W0(),h=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),[_,S]=w.useState(!0),[M,T]=w.useState(!1),[A,N]=cn(zS),[D,k]=w.useState(()=>qi(A));w.useEffect(()=>{k(qi(A))},[A]);const[O,R]=w.useState(null),[L,B]=w.useState([]),H=w.useCallback(K=>{B(fe=>fe.includes(K)?fe.filter(ae=>ae!==K):[...fe,K])},[]),$=w.useCallback(K=>{const fe=VS(K);fe!==null&&fe>=1?(N(fe),k(qi(fe))):k(qi(A))},[A,N]),Z=q0(h,{root:i,threshold:0})||l,V=t.find(K=>K.isSelected)??t[0],W=Ju((V==null?void 0:V.runPath)??"",Z&&!!V,e,A),J=W.isFetching,ne=J&&!!W.data,{filteredBuckets:ie,activeCategories:z,runFirstTime:j}=w.useMemo(()=>{const K=W.data;if(!K||K.first_time===null||!K.utilization_buckets||K.utilization_buckets.length===0)return{filteredBuckets:[],activeCategories:[],runFirstTime:0};const fe=K.first_time;let he=K.utilization_buckets;if(_){const Se=K.step_times??[];if(Se.length>0){const de=Se[0].time-fe;he=he.filter(Me=>Me.time-fe>=de)}}!M&&he.length>0&&K.last_time!==null&&K.last_time!==void 0&&he[he.length-1].time+A>K.last_time&&(he=he.slice(0,-1));const ae=r.filter(Se=>he.some(de=>{const Me=de[Se];return Me!==void 0&&Me>0}));return{filteredBuckets:he,activeCategories:ae,runFirstTime:fe}},[W.data,r,_,M,A]),X=w.useMemo(()=>{const K=L.filter(fe=>z.includes(fe));return K.length>0&&K.length<z.length?new Set(K):O&&z.includes(O)?new Set([O]):null},[L,O,z]),{uplotData:F,seriesConfig:ce,bandsConfig:oe,hasData:Q}=w.useMemo(()=>{if(ie.length===0||z.length===0)return{uplotData:null,seriesConfig:[],bandsConfig:[],hasData:!1};const K=new Float64Array(ie.map(de=>de.time-j)),fe=[{label:"Time (s)"}],he=[K],ae=[],Se=new Array(ie.length).fill(0);return z.forEach((de,Me)=>{const Ce=ie.map((ze,Ve)=>{const ue=ze[de]??0;return Se[Ve]+=ue,Se[Ve]}),Re=X!==null&&!X.has(de),le=H1(de,a),He=Re?cd(le,.15):cd(le,.6),Le=Re?cd(le,.25):le;he.push(Ce),fe.push({label:Mx(de),stroke:Le,width:0,fill:Me===0?He:void 0,points:{show:!1}}),Me>0&&ae.push({series:[Me+1,Me],fill:He})}),{uplotData:he,seriesConfig:fe,bandsConfig:ae,hasData:!0}},[ie,z,j,X,a]);w.useEffect(()=>{if(!m.current||!F||!Q)return;const K=m.current,fe=K.clientWidth,he=K.clientHeight||200,ae=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Se=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",de={width:fe,height:he,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{auto:!1,range:[0,100]}},axes:[{stroke:Se,grid:{stroke:ae,width:1},ticks:{stroke:ae,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Re,le)=>le.map(He=>wu(He))},{stroke:Se,grid:{stroke:ae,width:1},ticks:{stroke:ae,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(Re,le)=>le.map(He=>`${parseFloat(He.toFixed(0))}%`)}],series:ce,bands:oe,hooks:{setCursor:[Re=>{if(!b.current||!F)return;const{left:le,top:He,idx:Le}=Re.cursor;if(Le==null||le===void 0||He===void 0||le<0){b.current.style.display="none";return}const ze=F[0][Le];if(ze===void 0){b.current.style.display="none";return}let ue=`<div class="font-medium mb-1">${`Time ${qi(Number(ze))}`}</div>`,Y=0;z.forEach((Ue,be)=>{const ke=F[be+1][Le],qe=ke-Y;if(Y=ke,qe<=0)return;const Qe=H1(Ue,a);ue+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Qe}"></div>
                  <span>${Mx(Ue)}</span>
                  <span class="font-medium ml-auto">${parseFloat(qe.toFixed(2))}%</span>
                </div>
              `}),b.current.innerHTML=ue,b.current.style.display="block";const xe=m.current.getBoundingClientRect(),we=b.current.getBoundingClientRect();let Te=xe.left+le+15;Te+we.width+20>window.innerWidth&&(Te=xe.left+le-we.width-15+Re.bbox.left),Te=Math.max(4,Te);let ge=xe.top-we.height+20;ge<4&&(ge=xe.top+8),b.current.style.left=`${Te}px`,b.current.style.top=`${ge}px`}]}};x.current&&x.current.destroy();const Me=new ls(de,F,K);x.current=Me;const Ce=new ResizeObserver(Re=>{for(const le of Re){const{width:He,height:Le}=le.contentRect;Me&&He>0&&Le>0&&Me.setSize({width:He,height:Le})}});return Ce.observe(K),()=>{Ce.disconnect(),Me.destroy(),x.current=null}},[F,ce,oe,Q,a,z,A,l]);const se=w.useCallback(()=>{b.current&&(b.current.style.display="none")},[]),re=J&&!ne;return f(d.jsxs("div",{ref:h,className:vt("group/chart flex flex-col bg-background",l?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!l&&re&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!l&&s,d.jsx("h4",{className:vt("font-medium leading-snug line-clamp-2 break-words",l?"text-sm":"text-xs"),title:n,children:n})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:_,onCheckedChange:S,children:"Ignore First Step"}),d.jsx(hr,{checked:M,onCheckedChange:T,children:"Show Unfinished Intervals"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),d.jsx("input",{type:"text",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:"1m",value:D,onChange:K=>k(K.target.value),onBlur:K=>$(K.target.value),onKeyDown:K=>{K.stopPropagation(),K.key==="Enter"&&$(K.currentTarget.value)},onClick:K=>K.stopPropagation()})]})]})]}),d.jsx($0,{isFullscreen:l,onClick:c}),!l&&o]})]}),d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[d.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 text-[9px] bg-background border border-border text-muted-foreground rounded-full whitespace-nowrap shrink-0",children:D}),_&&d.jsx(os,{label:"Ignoring First Step",onRemove:()=>S(!1)}),M&&d.jsx(os,{label:"Showing Unfinished Intervals",onRemove:()=>T(!1)})]}),Q&&z.length>0&&d.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-1.5",children:z.map(K=>{const fe=!!(X!=null&&X.has(K)),he=!!X&&X.size>0&&!fe,ae=H1(K,a);return d.jsxs("div",{className:vt("flex items-center gap-1 select-none transition-opacity duration-150 cursor-pointer",fe&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:he?.3:1},onPointerEnter:()=>R(K),onPointerLeave:()=>R(null),onClick:()=>H(K),children:[d.jsx("div",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:he?cd(ae,.25):ae}}),d.jsx("span",{className:"text-[10px] text-muted-foreground",children:Mx(K)})]},K)})})]}),Q?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:m,onMouseLeave:se,children:[d.jsx("div",{ref:b,className:"fixed z-[9999] max-w-[400px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),ne&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:J?"Loading...":"No data"})]}))}function Pq({runs:t,shouldPoll:e,scrollRoot:n=null,label:r,categories:i,headerPrefix:s,headerSuffix:o}){return d.jsx(iR,{runs:t,shouldPoll:e,scrollRoot:n,label:r,categories:i,headerPrefix:s,headerSuffix:o})}const Cge={idle:"Idle",working:"Working",generating:"Generating",working_except_weight_sync:"Working (excl. Weight Sync)",training:"Training",forward:"Forward",forward_backward:"Forward+Backward",backward:"Backward",optimizer:"Optimizer",loss:"Loss",loss_computation:"Loss Computation",weight_broadcast:"Weight Sync",data_wait:"Data Wait",grad_clip:"Grad Clip",grad_norm:"Grad Norm",data_to_device:"Data to Device",prepare_tensors:"Prepare Tensors",compute_entropy:"Compute Entropy",compute_kl:"Compute KL",finalize_model_grads:"Finalize Model Grads",checkpoint:"Checkpoint"};function Mx(t){return Cge[t]||t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function Z_({runs:t,shouldPoll:e,trainerMetricType:n,label:r,hoveredRunId:i=null,scrollRoot:s=null,headerPrefix:o,headerSuffix:a}){var he,ae,Se,de,Me,Ce,Re,le,He,Le;const l=Kn(us),{isFullscreen:c,toggleFullscreen:f,fullscreenPortal:h}=W0(),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),_=w.useRef(null),[S,M]=w.useState(!0),[T,A]=w.useState(!1),[N,D]=cn(zS),[k,O]=w.useState(()=>qi(N));w.useEffect(()=>{O(qi(N))},[N]);const R=w.useCallback(ze=>{const Ve=VS(ze);Ve!==null&&Ve>=1?(D(Ve),O(qi(Ve))):O(qi(N))},[N,D]),B=q0(m,{root:s,threshold:0})||c,H=w.useMemo(()=>{const ze=t.filter(ue=>!ue.isSelected),Ve=t.filter(ue=>ue.isSelected);return[...ze,...Ve]},[t]),$=w.useMemo(()=>H.slice(0,20),[H]),G=ed(((he=$[0])==null?void 0:he.runPath)??"",B&&!!$[0],e,N),Z=ed(((ae=$[1])==null?void 0:ae.runPath)??"",B&&!!$[1],e,N),V=ed(((Se=$[2])==null?void 0:Se.runPath)??"",B&&!!$[2],e,N),W=ed(((de=$[3])==null?void 0:de.runPath)??"",B&&!!$[3],e,N),J=ed(((Me=$[4])==null?void 0:Me.runPath)??"",B&&!!$[4],e,N),ne=ed(((Ce=$[5])==null?void 0:Ce.runPath)??"",B&&!!$[5],e,N),ie=ed(((Re=$[6])==null?void 0:Re.runPath)??"",B&&!!$[6],e,N),z=ed(((le=$[7])==null?void 0:le.runPath)??"",B&&!!$[7],e,N),j=ed(((He=$[8])==null?void 0:He.runPath)??"",B&&!!$[8],e,N),X=ed(((Le=$[9])==null?void 0:Le.runPath)??"",B&&!!$[9],e,N),F=w.useMemo(()=>[G,Z,V,W,J,ne,ie,z,j,X],[G,Z,V,W,J,ne,ie,z,j,X]),ce=F.some((ze,Ve)=>Ve<$.length&&ze.isFetching),oe=ce&&F.filter((ze,Ve)=>Ve<$.length&&ze.isFetching).every(ze=>!!ze.data),{uplotData:Q,seriesConfig:se,hasData:re}=w.useMemo(()=>{const ze=new Map,Ve=new Set;let ue=!1;if($.forEach((ge,Ue)=>{if(Ue>=10)return;const be=F[Ue].data;if(!be||be.first_time===null)return;const ke=be.first_time,qe=be.buckets;if(!qe||qe.length===0)return;let Qe=null;if(S){const st=be.step_times??[];st.length>0&&(Qe=st[0].time-ke)}ue=!0;const nt=new Map;if(qe.forEach(st=>{const Pe=st[n];if(Pe!=null){const Ke=st.time-ke;if(S&&Qe!==null&&Ke<Qe)return;nt.set(Ke,Pe),Ve.add(Ke)}}),!T&&qe.length>0){const st=be.last_time;if(st!=null){const Pe=qe[qe.length-1].time;if(Pe+N>st){const Ke=Pe-ke;nt.delete(Ke),Ve.delete(Ke)}}}ze.set(Ue,nt)}),!ue||Ve.size===0)return{uplotData:null,seriesConfig:[],hasData:!1};const Y=Array.from(Ve).sort((ge,Ue)=>ge-Ue),xe=new Float64Array(Y),we=[{label:"Time (s)"}],Te=[xe];return $.forEach((ge,Ue)=>{if(Ue>=10)return;const be=ze.get(Ue),ke=Y.map(st=>(be==null?void 0:be.get(st))??null),qe=i===ge.runPath,nt=i!==null&&!qe?.1:1;Te.push(ke),we.push({label:Pp(ge),stroke:ge.color,width:1,alpha:nt,spanGaps:!0,points:{show:!1}})}),{uplotData:Te,seriesConfig:we,hasData:!0}},[$,F,n,i,S,T,N]);w.useEffect(()=>{if(!x.current||!Q||!re)return;const ze=x.current,Ve=ze.clientWidth,ue=ze.clientHeight||200,Y=l?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",xe=l?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",we={width:Ve,height:ue,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{auto:!0}},axes:[{stroke:xe,grid:{stroke:Y,width:1},ticks:{stroke:Y,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Ue,be)=>be.map(ke=>wu(ke))},{stroke:xe,grid:{stroke:Y,width:1},ticks:{stroke:Y,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(Ue,be)=>be.map(ke=>`${parseFloat(ke.toFixed(1))}%`)}],series:se,hooks:{draw:[Ue=>{var ke;if(!Q)return;const be=Ue.ctx;be.save();for(let qe=1;qe<Ue.series.length;qe++){const Qe=Q[qe];if(!Qe)continue;let nt=-1;for(let ft=Qe.length-1;ft>=0;ft--)if(Qe[ft]!==null&&Qe[ft]!==void 0){nt=ft;break}if(nt===-1)continue;const st=Q[0][nt],Pe=Qe[nt];if(st===void 0||Pe===void 0||Pe===null)continue;const Ke=Ue.valToPos(Number(st),"x",!0),rt=Ue.valToPos(Number(Pe),"y",!0);if(!Number.isFinite(Ke)||!Number.isFinite(rt))continue;const ye=Ue.series[qe],$e=typeof(ye==null?void 0:ye.alpha)=="number"?ye.alpha:1,Ze=typeof(ye==null?void 0:ye.stroke)=="string"?ye.stroke:(ke=H[qe-1])==null?void 0:ke.color;Ze&&(be.globalAlpha=$e,be.fillStyle=Ze,be.beginPath(),be.arc(Ke,rt,4,0,Math.PI*2),be.fill())}be.restore()}],setCursor:[Ue=>{if(!_.current||!Q)return;const{left:be,top:ke,idx:qe}=Ue.cursor;if(qe==null||be===void 0||ke===void 0||be<0){_.current.style.display="none";return}const Qe=Q[0][qe];if(Qe===void 0){_.current.style.display="none";return}let st=`<div class="font-medium mb-1">${`Time ${qi(Number(Qe))}`}</div>`;t.forEach($e=>{const Ze=$.findIndex(Ae=>Ae.runPath===$e.runPath);if(Ze===-1)return;const ft=Ze+1,lt=Q[ft];if(!lt)return;const Je=lt[qe];Je!=null&&(st+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${$e.color}"></div>
                    <span>${GS($e)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium">${parseFloat(Je.toFixed(2))}%</span>
                  </div>
                </div>
              `)}),_.current.innerHTML=st,_.current.style.display="block";const Pe=x.current.getBoundingClientRect(),Ke=_.current.getBoundingClientRect();let rt=Pe.left+be+15;rt+Ke.width+20>window.innerWidth&&(rt=Pe.left+be-Ke.width-15+Ue.bbox.left),rt=Math.max(4,rt);let ye=Pe.top-Ke.height+20;ye<4&&(ye=Pe.top+8),_.current.style.left=`${rt}px`,_.current.style.top=`${ye}px`}]}};b.current&&b.current.destroy();const Te=new ls(we,Q,ze);b.current=Te;const ge=new ResizeObserver(Ue=>{for(const be of Ue){const{width:ke,height:qe}=be.contentRect;Te&&ke>0&&qe>0&&Te.setSize({width:ke,height:qe})}});return ge.observe(ze),()=>{ge.disconnect(),Te.destroy(),b.current=null}},[Q,se,re,l,H,t,$,i,N,c]);const K=w.useCallback(()=>{_.current&&(_.current.style.display="none")},[]),fe=ce&&!oe;return h(d.jsxs("div",{ref:m,className:vt("group/chart flex flex-col bg-background",c?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!c&&fe&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!c&&o,d.jsx("h4",{className:vt("font-medium leading-snug line-clamp-2 break-words",c?"text-sm":"text-xs"),title:r,children:r})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:S,onCheckedChange:M,children:"Ignore First Step"}),d.jsx(hr,{checked:T,onCheckedChange:A,children:"Show Unfinished Intervals"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),d.jsx("input",{type:"text",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:"1m",value:k,onChange:ze=>O(ze.target.value),onBlur:ze=>R(ze.target.value),onKeyDown:ze=>{ze.stopPropagation(),ze.key==="Enter"&&R(ze.currentTarget.value)},onClick:ze=>ze.stopPropagation()})]})]})]}),d.jsx($0,{isFullscreen:c,onClick:f}),!c&&a]})]}),d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[d.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 text-[9px] bg-background border border-border text-muted-foreground rounded-full whitespace-nowrap shrink-0",children:k}),S&&d.jsx(os,{label:"Ignoring First Step",onRemove:()=>M(!1)}),T&&d.jsx(os,{label:"Showing Unfinished Intervals",onRemove:()=>A(!1)})]})]}),re?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:x,onMouseLeave:K,children:[d.jsx("div",{ref:_,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"}}),oe&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:ce?"Loading...":"No data"})]}))}const sR=["idle","data_wait","forward","forward_backward","loss","loss_computation","backward","optimizer","grad_clip","grad_norm","weight_broadcast","data_to_device","prepare_tensors","compute_entropy","compute_kl","finalize_model_grads","checkpoint"];function H1(t,e){return t==="idle"?e?x8:jw:t==="working"?"#3b82f6":t==="working_except_weight_sync"||t==="training"||t==="generating"?"#6366f1":$_[t]||"#6b7280"}function cd(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}const Ege={kept:"Kept",discarded:"Discarded",canceled:"Canceled"};function e6(t){return Ege[t]||t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function t6(t,e){return t==="kept"?rw:t==="discarded"?e?uC:cC:t==="canceled"?e?Lw:dC:fC}const Age={kept:"rollouts_group_done_kept",discarded:"rollouts_group_done_discarded",canceled:"rollouts_group_done_canceled"};function Iq({runs:t,shouldPoll:e,label:n,categories:r,scrollRoot:i=null,headerPrefix:s,headerSuffix:o}){const a=Kn(us),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:f}=W0(),h=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),[_,S]=w.useState(!0),[M,T]=w.useState(!1),[A,N]=cn(zS),[D,k]=w.useState(()=>qi(A));w.useEffect(()=>{k(qi(A))},[A]);const[O,R]=w.useState(null),[L,B]=w.useState([]),H=w.useCallback(K=>{B(fe=>fe.includes(K)?fe.filter(ae=>ae!==K):[...fe,K])},[]),$=w.useCallback(K=>{const fe=VS(K);fe!==null&&fe>=1?(N(fe),k(qi(fe))):k(qi(A))},[A,N]),Z=q0(h,{root:i,threshold:0})||l,V=t.find(K=>K.isSelected)??t[0],W=Ju((V==null?void 0:V.runPath)??"",Z&&!!V,e,A),J=W.isFetching,ne=J&&!!W.data,{filteredBuckets:ie,activeCategories:z,runFirstTime:j}=w.useMemo(()=>{const K=W.data;if(!K||K.first_time===null)return{filteredBuckets:[],activeCategories:[],runFirstTime:0};const fe=K.first_time,he=new Map;for(const de of r){const Me=Age[de];if(!Me)continue;const Ce=K[Me];if(Ce)for(const Re of Ce)he.has(Re.time)||he.set(Re.time,{time:Re.time}),he.get(Re.time)[de]=Re.count}let ae=[...he.values()].sort((de,Me)=>de.time-Me.time).map(de=>{const Me=r.reduce((Re,le)=>Re+(de[le]??0),0),Ce={time:de.time};for(const Re of r)Ce[Re]=Me>0?(de[Re]??0)/Me*100:0;return Ce});if(_){const de=K.step_times??[];if(de.length>0){const Me=de[0].time-fe;ae=ae.filter(Ce=>Ce.time-fe>=Me)}}!M&&ae.length>0&&K.last_time!==null&&K.last_time!==void 0&&ae[ae.length-1].time+A>K.last_time&&(ae=ae.slice(0,-1));const Se=r.filter(de=>ae.some(Me=>Me[de]!==void 0&&Me[de]>0));return{filteredBuckets:ae,activeCategories:Se,runFirstTime:fe}},[W.data,r,_,M,A]),X=w.useMemo(()=>{const K=L.filter(fe=>z.includes(fe));return K.length>0&&K.length<z.length?new Set(K):O&&z.includes(O)?new Set([O]):null},[L,O,z]),{uplotData:F,seriesConfig:ce,bandsConfig:oe,hasData:Q}=w.useMemo(()=>{if(ie.length===0||z.length===0)return{uplotData:null,seriesConfig:[],bandsConfig:[],hasData:!1};const K=new Float64Array(ie.map(de=>de.time-j)),fe=[{label:"Time (s)"}],he=[K],ae=[],Se=new Array(ie.length).fill(0);return z.forEach((de,Me)=>{const Ce=ie.map((ze,Ve)=>{const ue=ze[de]??0;return Se[Ve]+=ue,Se[Ve]}),Re=X!==null&&!X.has(de),le=t6(de,a),He=Re?cd(le,.15):cd(le,.6),Le=Re?cd(le,.25):le;he.push(Ce),fe.push({label:e6(de),stroke:Le,width:0,fill:Me===0?He:void 0,points:{show:!1}}),Me>0&&ae.push({series:[Me+1,Me],fill:He})}),{uplotData:he,seriesConfig:fe,bandsConfig:ae,hasData:!0}},[ie,z,j,X,a]);w.useEffect(()=>{if(!m.current||!F||!Q)return;const K=m.current,fe=K.clientWidth,he=K.clientHeight||200,ae=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Se=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",de={width:fe,height:he,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{auto:!1,range:[0,100]}},axes:[{stroke:Se,grid:{stroke:ae,width:1},ticks:{stroke:ae,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Re,le)=>le.map(He=>wu(He))},{stroke:Se,grid:{stroke:ae,width:1},ticks:{stroke:ae,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(Re,le)=>le.map(He=>`${parseFloat(He.toFixed(0))}%`)}],series:ce,bands:oe,hooks:{setCursor:[Re=>{if(!b.current||!F)return;const{left:le,top:He,idx:Le}=Re.cursor;if(Le==null||le===void 0||He===void 0||le<0){b.current.style.display="none";return}const ze=F[0][Le];if(ze===void 0){b.current.style.display="none";return}let ue=`<div class="font-medium mb-1">${`Time ${qi(Number(ze))}`}</div>`,Y=0;z.forEach((Ue,be)=>{const ke=F[be+1][Le],qe=ke-Y;if(Y=ke,qe<=0)return;const Qe=t6(Ue,a);ue+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Qe}"></div>
                  <span>${e6(Ue)}</span>
                  <span class="font-medium ml-auto">${parseFloat(qe.toFixed(2))}%</span>
                </div>
              `}),b.current.innerHTML=ue,b.current.style.display="block";const xe=m.current.getBoundingClientRect(),we=b.current.getBoundingClientRect();let Te=xe.left+le+15;Te+we.width+20>window.innerWidth&&(Te=xe.left+le-we.width-15+Re.bbox.left),Te=Math.max(4,Te);let ge=xe.top-we.height+20;ge<4&&(ge=xe.top+8),b.current.style.left=`${Te}px`,b.current.style.top=`${ge}px`}]}};x.current&&x.current.destroy();const Me=new ls(de,F,K);x.current=Me;const Ce=new ResizeObserver(Re=>{for(const le of Re){const{width:He,height:Le}=le.contentRect;Me&&He>0&&Le>0&&Me.setSize({width:He,height:Le})}});return Ce.observe(K),()=>{Ce.disconnect(),Me.destroy(),x.current=null}},[F,ce,oe,Q,a,z,A,l]);const se=w.useCallback(()=>{b.current&&(b.current.style.display="none")},[]),re=J&&!ne;return f(d.jsxs("div",{ref:h,className:vt("group/chart flex flex-col bg-background",l?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!l&&re&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!l&&s,d.jsx("h4",{className:vt("font-medium leading-snug line-clamp-2 break-words",l?"text-sm":"text-xs"),title:n,children:n})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:_,onCheckedChange:S,children:"Ignore First Step"}),d.jsx(hr,{checked:M,onCheckedChange:T,children:"Show Unfinished Intervals"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),d.jsx("input",{type:"text",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:"1m",value:D,onChange:K=>k(K.target.value),onBlur:K=>$(K.target.value),onKeyDown:K=>{K.stopPropagation(),K.key==="Enter"&&$(K.currentTarget.value)},onClick:K=>K.stopPropagation()})]})]})]}),d.jsx($0,{isFullscreen:l,onClick:c}),!l&&o]})]}),d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[d.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 text-[9px] bg-background border border-border text-muted-foreground rounded-full whitespace-nowrap shrink-0",children:D}),_&&d.jsx(os,{label:"Ignoring First Step",onRemove:()=>S(!1)}),M&&d.jsx(os,{label:"Showing Unfinished Intervals",onRemove:()=>T(!1)})]}),Q&&z.length>0&&d.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-1.5",children:z.map(K=>{const fe=!!(X!=null&&X.has(K)),he=!!X&&X.size>0&&!fe,ae=t6(K,a);return d.jsxs("div",{className:vt("flex items-center gap-1 select-none transition-opacity duration-150 cursor-pointer",fe&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:he?.3:1},onPointerEnter:()=>R(K),onPointerLeave:()=>R(null),onClick:()=>H(K),children:[d.jsx("div",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:he?cd(ae,.25):ae}}),d.jsx("span",{className:"text-[10px] text-muted-foreground",children:e6(K)})]},K)})})]}),Q?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:m,onMouseLeave:se,children:[d.jsx("div",{ref:b,className:"fixed z-[9999] max-w-[400px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),ne&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:J?"Loading...":"No data"})]}))}function v2({runs:t,shouldPoll:e,label:n,categories:r,scrollRoot:i=null,headerPrefix:s,headerSuffix:o}){const a=Kn(us),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:f}=W0(),h=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=w.useRef(null),[_,S]=w.useState(!0),[M,T]=w.useState(!1),[A,N]=cn(zS),[D,k]=w.useState(()=>qi(A));w.useEffect(()=>{k(qi(A))},[A]);const[O,R]=w.useState(null),[L,B]=w.useState([]),H=w.useCallback(K=>{B(fe=>fe.includes(K)?fe.filter(Se=>Se!==K):[...fe,K])},[]),$=w.useCallback(K=>{const fe=VS(K);fe!==null&&fe>=1?(N(fe),k(qi(fe))):k(qi(A))},[A,N]),Z=q0(h,{root:i,threshold:0})||l,V=t.find(K=>K.isSelected)??t[0],W=ed((V==null?void 0:V.runPath)??"",Z&&!!V,e,A),J=W.isFetching,ne=J&&!!W.data,{filteredBuckets:ie,activeCategories:z,runFirstTime:j}=w.useMemo(()=>{const K=W.data;if(!K||K.first_time===null||!K.buckets||K.buckets.length===0)return{filteredBuckets:[],activeCategories:[],runFirstTime:0};const fe=K.first_time;let he=K.buckets;if(_){const Se=K.step_times??[];if(Se.length>0){const de=Se[0].time-fe;he=he.filter(Me=>Me.time-fe>=de)}}!M&&he.length>0&&K.last_time!==null&&K.last_time!==void 0&&he[he.length-1].time+A>K.last_time&&(he=he.slice(0,-1));const ae=r.filter(Se=>he.some(de=>{const Me=de[Se];return Me!==void 0&&Me>0}));return{filteredBuckets:he,activeCategories:ae,runFirstTime:fe}},[W.data,r,_,M,A]),X=w.useMemo(()=>{const K=L.filter(fe=>z.includes(fe));return K.length>0&&K.length<z.length?new Set(K):O&&z.includes(O)?new Set([O]):null},[L,O,z]),{uplotData:F,seriesConfig:ce,bandsConfig:oe,hasData:Q}=w.useMemo(()=>{if(ie.length===0||z.length===0)return{uplotData:null,seriesConfig:[],bandsConfig:[],hasData:!1};const K=new Float64Array(ie.map(de=>de.time-j)),fe=[{label:"Time (s)"}],he=[K],ae=[],Se=new Array(ie.length).fill(0);return z.forEach((de,Me)=>{const Ce=ie.map((ze,Ve)=>{const ue=ze[de]??0;return Se[Ve]+=ue,Se[Ve]}),Re=X!==null&&!X.has(de),le=H1(de,a),He=Re?cd(le,.15):cd(le,.6),Le=Re?cd(le,.25):le;he.push(Ce),fe.push({label:Mx(de),stroke:Le,width:0,fill:Me===0?He:void 0,points:{show:!1}}),Me>0&&ae.push({series:[Me+1,Me],fill:He})}),{uplotData:he,seriesConfig:fe,bandsConfig:ae,hasData:!0}},[ie,z,j,X,a]);w.useEffect(()=>{if(!m.current||!F||!Q)return;const K=m.current,fe=K.clientWidth,he=K.clientHeight||200,ae=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Se=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",de={width:fe,height:he,padding:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{auto:!1,range:[0,100]}},axes:[{stroke:Se,grid:{stroke:ae,width:1},ticks:{stroke:ae,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Re,le)=>le.map(He=>wu(He))},{stroke:Se,grid:{stroke:ae,width:1},ticks:{stroke:ae,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:44,values:(Re,le)=>le.map(He=>`${parseFloat(He.toFixed(0))}%`)}],series:ce,bands:oe,hooks:{setCursor:[Re=>{if(!b.current||!F)return;const{left:le,top:He,idx:Le}=Re.cursor;if(Le==null||le===void 0||He===void 0||le<0){b.current.style.display="none";return}const ze=F[0][Le];if(ze===void 0){b.current.style.display="none";return}let ue=`<div class="font-medium mb-1">${`Time ${qi(Number(ze))}`}</div>`,Y=0;z.forEach((Ue,be)=>{const ke=F[be+1][Le],qe=ke-Y;if(Y=ke,qe<=0)return;const Qe=H1(Ue,a);ue+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${Qe}"></div>
                  <span>${Mx(Ue)}</span>
                  <span class="font-medium ml-auto">${parseFloat(qe.toFixed(2))}%</span>
                </div>
              `}),b.current.innerHTML=ue,b.current.style.display="block";const xe=m.current.getBoundingClientRect(),we=b.current.getBoundingClientRect();let Te=xe.left+le+15;Te+we.width+20>window.innerWidth&&(Te=xe.left+le-we.width-15+Re.bbox.left),Te=Math.max(4,Te);let ge=xe.top-we.height+20;ge<4&&(ge=xe.top+8),b.current.style.left=`${Te}px`,b.current.style.top=`${ge}px`}]}};x.current&&x.current.destroy();const Me=new ls(de,F,K);x.current=Me;const Ce=new ResizeObserver(Re=>{for(const le of Re){const{width:He,height:Le}=le.contentRect;Me&&He>0&&Le>0&&Me.setSize({width:He,height:Le})}});return Ce.observe(K),()=>{Ce.disconnect(),Me.destroy(),x.current=null}},[F,ce,oe,Q,a,z,A,l]);const se=w.useCallback(()=>{b.current&&(b.current.style.display="none")},[]),re=J&&!ne;return f(d.jsxs("div",{ref:h,className:vt("group/chart flex flex-col bg-background",l?"fixed inset-0 left-56 z-50 p-6":"rounded-lg border border-border p-3 transition-opacity h-[254px]",!l&&re&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex items-center gap-0.5 min-w-0",children:[!l&&s,d.jsx("h4",{className:vt("font-medium leading-snug line-clamp-2 break-words",l?"text-sm":"text-xs"),title:n,children:n})]}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:_,onCheckedChange:S,children:"Ignore First Step"}),d.jsx(hr,{checked:M,onCheckedChange:T,children:"Show Unfinished Intervals"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-14",children:"Interval"}),d.jsx("input",{type:"text",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:"1m",value:D,onChange:K=>k(K.target.value),onBlur:K=>$(K.target.value),onKeyDown:K=>{K.stopPropagation(),K.key==="Enter"&&$(K.currentTarget.value)},onClick:K=>K.stopPropagation()})]})]})]}),d.jsx($0,{isFullscreen:l,onClick:c}),!l&&o]})]}),d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[d.jsx("span",{className:"inline-flex items-center px-1.5 py-0.5 text-[9px] bg-background border border-border text-muted-foreground rounded-full whitespace-nowrap shrink-0",children:D}),_&&d.jsx(os,{label:"Ignoring First Step",onRemove:()=>S(!1)}),M&&d.jsx(os,{label:"Showing Unfinished Intervals",onRemove:()=>T(!1)})]}),Q&&z.length>0&&d.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1 mt-1.5",children:z.map(K=>{const fe=!!(X!=null&&X.has(K)),he=!!X&&X.size>0&&!fe,ae=H1(K,a);return d.jsxs("div",{className:vt("flex items-center gap-1 select-none transition-opacity duration-150 cursor-pointer",fe&&"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5"),style:{opacity:he?.3:1},onPointerEnter:()=>R(K),onPointerLeave:()=>R(null),onClick:()=>H(K),children:[d.jsx("div",{className:"w-2 h-2 rounded-sm shrink-0",style:{backgroundColor:he?cd(ae,.25):ae}}),d.jsx("span",{className:"text-[10px] text-muted-foreground",children:Mx(K)})]},K)})})]}),Q?d.jsxs("div",{className:"flex-1 min-h-0 relative bg-background rounded",ref:m,onMouseLeave:se,children:[d.jsx("div",{ref:b,className:"fixed z-[9999] max-w-[400px] bg-popover text-popover-foreground text-xs py-2 px-3 rounded-lg shadow-xl border border-border pointer-events-none",style:{display:"none"}}),ne&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"flex-1 min-h-0 flex items-center justify-center text-muted-foreground text-xs rounded",children:J?"Loading...":"No data"})]}))}function Nge({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null}){var c;const i={runs:t,shouldPoll:e,hoveredRunId:n,scrollRoot:r},s=t.find(f=>f.isSelected)??t[0],a=((c=ed((s==null?void 0:s.runPath)??"",!!s,e).data)==null?void 0:c.event_types)??[],l=w.useMemo(()=>{const f=sR.filter(m=>a.includes(m)||m==="idle"),h=a.filter(m=>!sR.includes(m));return[...f,...h]},[a]);return d.jsxs("div",{children:[d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-1",children:"Time Breakdown (Area)"}),d.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[d.jsx(v2,{runs:t,shouldPoll:e,scrollRoot:r,label:"Trainer Idle vs Working",categories:["idle","working"]}),d.jsx(v2,{runs:t,shouldPoll:e,scrollRoot:r,label:"Trainer Idle vs Training vs Weight Sync",categories:["idle","training","weight_broadcast"]}),d.jsx(v2,{runs:t,shouldPoll:e,scrollRoot:r,label:"Trainer Time Detailed Breakdown",categories:l})]}),d.jsx("h4",{className:"text-xs font-medium text-muted-foreground mb-2 mt-4",children:"% Time per Category"}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[d.jsx(Z_,{trainerMetricType:"idle",label:"Trainer % Idle",...i}),d.jsx(Z_,{trainerMetricType:"working",label:"Trainer % Working",...i}),d.jsx(Z_,{trainerMetricType:"working_except_weight_sync",label:"Trainer % Working (excl. Weight Sync)",...i}),a.map(f=>d.jsx(Z_,{trainerMetricType:f,label:`Trainer % ${Mx(f)}`,...i},f))]})]})}function Dq({runs:t,shouldPoll:e,hoveredRunId:n=null,scrollRoot:r=null,trainerMetricType:i,label:s,headerPrefix:o,headerSuffix:a}){return d.jsx(Z_,{runs:t,shouldPoll:e,hoveredRunId:n,scrollRoot:r,trainerMetricType:i,label:s,headerPrefix:o,headerSuffix:a})}const Oq=[{key:"trainer_area_idle_vs_working",label:"Trainer Idle vs Working",categories:["idle","working"]},{key:"trainer_area_idle_vs_training_vs_weight_sync",label:"Trainer Idle vs Training vs Weight Sync",categories:["idle","training","weight_broadcast"]},{key:"trainer_area_detailed",label:"Trainer Time Detailed Breakdown",categories:[...sR]}];function Lq({runs:t,shouldPoll:e,scrollRoot:n=null,label:r,categories:i,headerPrefix:s,headerSuffix:o}){return d.jsx(v2,{runs:t,shouldPoll:e,scrollRoot:n,label:r,categories:i,headerPrefix:s,headerSuffix:o})}const Lg=["mean","std","min","max"],jg={mean:"Mean",std:"Std",min:"Min",max:"Max"};function d5(){return Math.random().toString(36).slice(2,10)}function C1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function jq(t,e,n){const r=[];for(const[i,s]of Object.entries(t)){const o=C1(i);for(const[a,l]of Object.entries(s)){const c=a?C1(a):void 0;for(const f of l)r.push({section:o,group:c,metricKey:f,label:C1(f),plotType:"step_metric",simple:!0})}}for(const i of Lg)r.push({section:"Reward",metricKey:`reward_sum_${i}`,label:`Reward ${jg[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=C1(i);for(const o of Lg)r.push({section:"Samples Metrics",group:s,metricKey:`reward_${i}_${o}`,label:`${s} ${jg[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 Lg)r.push({section:"Advantage",metricKey:`advantage_${i}`,label:`Advantage ${jg[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=C1(o);for(const l of Lg)r.push({section:"Evals",group:`${s} / ${a}`,metricKey:`reward_${o}_${l}`,label:`${s} ${a} ${jg[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 Lg)r.push({section:"Evals",group:`${s} / ${a}`,metricKey:`${o}_${l}`,label:`${s} ${a} ${jg[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 Lg)r.push({section:"Rollouts",group:s,metricKey:`${i}_${o}`,label:`${s} ${jg[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});r.push({section:"Rollouts",group:"Off-Policy Steps",metricKey:"off_policy_steps_mean",label:"Off-Policy Steps (Mean)",plotType:"step_metric",simple:!0}),r.push({section:"Rollouts",group:"Off-Policy Steps",metricKey:"off_policy_steps_std",label:"Off-Policy Steps (Std)",plotType:"step_metric",simple:!0}),r.push({section:"Rollouts",group:"Off-Policy Steps",metricKey:"off_policy_steps_distribution_over_time",label:"Off-Policy Steps Dist. Over Time",plotType:"distribution_over_time",distMetricType:"off_policy_steps"});for(const i of[{key:"discarded_count",label:"Discarded Count"},{key:"discarded_zero_advantage_pct",label:"Discarded Zero Advantage %"},{key:"discarded_max_async_pct",label:"Discarded Max Async %"},{key:"discarded_stop_reason_length_pct",label:"Discarded % Stop Reason = Length"},{key:"discarded_group_length_gini_mean",label:"Discarded Group Completion Length Gini"},{key:"discarded_group_length_max_median_ratio_mean",label:"Discarded Group Completion Length Max/Median"},{key:"discarded_zero_advantage_all_zero_pct",label:"Discarded Zero Adv (All Reward = 0) %"},{key:"discarded_zero_advantage_all_positive_pct",label:"Discarded Zero Adv (All Reward > 0) %"},{key:"discarded_zero_advantage_mean_reward",label:"Discarded 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:"Off-Policy Steps",metricKey:"discarded_off_policy_steps_mean",label:"Discarded Off-Policy Steps (Mean)",plotType:"step_metric",simple:!0}),r.push({section:"Discarded Rollouts",group:"Off-Policy Steps",metricKey:"discarded_off_policy_steps_std",label:"Discarded Off-Policy Steps (Std)",plotType:"step_metric",simple:!0}),r.push({section:"Discarded Rollouts",group:"Off-Policy Steps",metricKey:"discarded_off_policy_steps_distribution_over_time",label:"Discarded Off-Policy Steps Dist. Over Time",plotType:"distribution_over_time",distMetricType:"discarded_off_policy_steps"}),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 Lg)r.push({section:"Discarded Rollouts",group:s,metricKey:`${i}_${o}`,label:`${s} ${jg[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_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 Trainer",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 Trainer",group:"Microbatch (Mean Time)",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"timing_save_batch_total",label:"Batch Completion (Save Batch)"},{key:"timing_avg_inference_time",label:"Avg Generation Time"},{key:"timing_avg_compute_reward_time",label:"Avg Compute Reward Time"}])r.push({section:"Timeline Inference",group:"Batch & Averages",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"timing_generation_normal_pct",label:"Inference % Generation (Normal)"},{key:"timing_generation_discarded_pct",label:"Inference % Generation (Discarded)"},{key:"timing_generation_canceled_pct",label:"Inference % Generation (Canceled)"},{key:"timing_generation_all_pct",label:"Inference % Generation (All)"},{key:"timing_compute_reward_normal_pct",label:"Inference % Compute Reward (Normal)"},{key:"timing_compute_reward_discarded_pct",label:"Inference % Compute Reward (Discarded)"},{key:"timing_compute_reward_canceled_pct",label:"Inference % Compute Reward (Canceled)"},{key:"timing_compute_reward_all_pct",label:"Inference % Compute Reward (All)"},{key:"timing_idle_pct",label:"Inference % Idle Time"}])r.push({section:"Timeline Inference",group:"Time Breakdown (% of Step Time)",metricKey:i.key,label:i.label,plotType:"step_metric",simple:!0});for(const i of[{key:"inference_calls",label:"Inference Calls",inferenceMetricType:"inference_calls"},{key:"requests_done",label:"Requests Done",inferenceMetricType:"requests_done"},{key:"rollouts_group_done",label:"Rollouts Group Done",inferenceMetricType:"rollouts_group_done"},{key:"rollouts_group_done_kept",label:"Rollouts Group Done Kept",inferenceMetricType:"rollouts_group_done_kept"},{key:"rollouts_group_done_discarded",label:"Rollouts Group Done Discarded",inferenceMetricType:"rollouts_group_done_discarded"},{key:"rollouts_group_done_canceled",label:"Rollouts Group Done Canceled",inferenceMetricType:"rollouts_group_done_canceled"}])r.push({section:"Inference Performance",group:"Requests Count",metricKey:i.key,label:i.label,plotType:"inference_performance",inferenceMetricType:i.inferenceMetricType});for(const i of[{key:"avg_tokens_per_second_generation",label:"Tokens/s per Generation",inferenceMetricType:"avg_tokens_per_second_generation"},{key:"tokens_per_second_throughput",label:"Tokens/s Throughput",inferenceMetricType:"tokens_per_second_throughput"}])r.push({section:"Inference Performance",group:"Throughput",metricKey:i.key,label:i.label,plotType:"inference_performance",inferenceMetricType:i.inferenceMetricType});for(const i of[{key:"avg_time_queue",label:"Avg Queue Time",inferenceMetricType:"avg_time_queue"},{key:"avg_time_ttft",label:"Avg Time to First Token",inferenceMetricType:"avg_time_ttft"},{key:"avg_time_prefill",label:"Avg Prefill Time",inferenceMetricType:"avg_time_prefill"},{key:"avg_time_decode",label:"Avg Decode Time",inferenceMetricType:"avg_time_decode"},{key:"avg_time_inference",label:"Avg Inference Time",inferenceMetricType:"avg_time_inference"},{key:"avg_time_e2e",label:"Avg E2E Latency",inferenceMetricType:"avg_time_e2e"},{key:"avg_time_generation",label:"Avg Generation Duration",inferenceMetricType:"avg_time_generation"},{key:"avg_time_compute_reward",label:"Avg Compute Reward Time",inferenceMetricType:"avg_time_compute_reward"}])r.push({section:"Inference Performance",group:"Latency",metricKey:i.key,label:i.label,plotType:"inference_performance",inferenceMetricType:i.inferenceMetricType});for(const i of[{key:"vllm_requests_running_avg",label:"vLLM Requests Running Average",inferenceMetricType:"vllm_requests_running_avg"},{key:"vllm_requests_waiting_avg",label:"vLLM Requests Waiting Average",inferenceMetricType:"vllm_requests_waiting_avg"},{key:"vllm_preemptions",label:"vLLM Preemptions",inferenceMetricType:"vllm_preemptions"},{key:"vllm_preemptions_per_request",label:"vLLM Preemptions per Request",inferenceMetricType:"vllm_preemptions_per_request"},{key:"vllm_ttft_avg",label:"vLLM TTFT Average",inferenceMetricType:"vllm_ttft_avg"}])r.push({section:"Inference Performance",group:"vLLM",metricKey:i.key,label:i.label,plotType:"inference_performance",inferenceMetricType:i.inferenceMetricType});for(const i of Rq)r.push({section:"Inference Performance",group:"Breakdown (Area)",metricKey:i.key,label:i.label,plotType:"inference_utilization_area",inferenceAreaCategories:[...i.categories]});for(const i of Nq)r.push({section:"Inference Performance",group:"Breakdown (Area)",metricKey:i.key,label:i.label,plotType:"inference_performance_area",inferenceAreaCategories:[...i.categories]});for(const i of Oq)r.push({section:"Trainer Performance",group:"Time Breakdown (Area)",metricKey:i.key,label:i.label,plotType:"trainer_performance_area",trainerAreaCategories:[...i.categories]});for(const i of[{key:"trainer_perf_idle",label:"Trainer % Idle",trainerMetricType:"idle"},{key:"trainer_perf_working",label:"Trainer % Working",trainerMetricType:"working"},{key:"trainer_perf_working_except_weight_sync",label:"Trainer % Working (excl. Weight Sync)",trainerMetricType:"working_except_weight_sync"}])r.push({section:"Trainer Performance",group:"% Time per Category",metricKey:i.key,label:i.label,plotType:"trainer_performance",trainerMetricType:i.trainerMetricType});for(const i of[{key:"trainer_perf_forward",label:"Trainer % Forward",trainerMetricType:"forward"},{key:"trainer_perf_backward",label:"Trainer % Backward",trainerMetricType:"backward"},{key:"trainer_perf_optimizer",label:"Trainer % Optimizer",trainerMetricType:"optimizer"},{key:"trainer_perf_loss_computation",label:"Trainer % Loss Computation",trainerMetricType:"loss_computation"},{key:"trainer_perf_weight_broadcast",label:"Trainer % Weight Sync",trainerMetricType:"weight_broadcast"},{key:"trainer_perf_data_wait",label:"Trainer % Data Wait",trainerMetricType:"data_wait"},{key:"trainer_perf_grad_clip",label:"Trainer % Grad Clip",trainerMetricType:"grad_clip"},{key:"trainer_perf_grad_norm",label:"Trainer % Grad Norm",trainerMetricType:"grad_norm"},{key:"trainer_perf_data_to_device",label:"Trainer % Data to Device",trainerMetricType:"data_to_device"},{key:"trainer_perf_prepare_tensors",label:"Trainer % Prepare Tensors",trainerMetricType:"prepare_tensors"},{key:"trainer_perf_compute_entropy",label:"Trainer % Compute Entropy",trainerMetricType:"compute_entropy"},{key:"trainer_perf_compute_kl",label:"Trainer % Compute KL",trainerMetricType:"compute_kl"},{key:"trainer_perf_checkpoint",label:"Trainer % Checkpoint",trainerMetricType:"checkpoint"}])r.push({section:"Trainer Performance",group:"% Time per Category",metricKey:i.key,label:i.label,plotType:"trainer_performance",trainerMetricType:i.trainerMetricType});return r}async function sL(t){await fetch(`${Gn}/custom-metrics-layout`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:t})})}async function oL(t,e){await fetch(`${Gn}/custom-metrics-templates/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({layout:e})})}function f5({open:t,onOpenChange:e,title:n,existingNames:r,initialValue:i="",onSubmit:s}){const[o,a]=w.useState(i),[l,c]=w.useState(""),f=w.useRef(null),h=x=>{x&&(a(i),c(""),setTimeout(()=>{var b;return(b=f.current)==null?void 0:b.focus()},50)),e(x)},m=()=>{const x=o.trim();if(!x){c("Name cannot be empty");return}if(r.some(b=>b.toLowerCase()===x.toLowerCase())&&x.toLowerCase()!==i.toLowerCase()){c("Name already exists");return}s(x),e(!1)};return d.jsx(Lc,{open:t,onOpenChange:h,children:d.jsxs(jc,{className:"sm:max-w-[340px]",children:[d.jsx(Wl,{children:d.jsx($l,{children:n})}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(tf,{ref:f,value:o,onChange:x=>{a(x.target.value),c("")},onKeyDown:x=>{x.key==="Enter"&&m()},placeholder:"Name..."}),l&&d.jsx("p",{className:"text-xs text-destructive",children:l})]}),d.jsx(Km,{children:d.jsx(Sn,{size:"sm",onClick:m,children:i?"Rename":"Create"})})]})})}function aL(t){return`${t.plotType}|${t.evalName||""}|${t.metricKey}`}function Ry({catalog:t,onSelect:e,onDeselect:n,existingPlots:r,children:i,allowDuplicates:s=!1}){const o=w.useMemo(()=>{const m=new Map;for(const x of r??[]){const b=aL(x);m.set(b,(m.get(b)??0)+1)}return m},[r]),[a,l]=w.useState(!1),[c,f]=w.useState(""),h=w.useMemo(()=>{const m=c.toLowerCase(),x=m?t.filter(_=>{var S;return _.label.toLowerCase().includes(m)||_.metricKey.toLowerCase().includes(m)||_.section.toLowerCase().includes(m)||(((S=_.group)==null?void 0:S.toLowerCase().includes(m))??!1)}):t,b=[];for(const _ of x){let S=b.find(A=>A.section===_.section);S||(S={section:_.section,groups:[]},b.push(S));const M=_.group||"";let T=S.groups.find(A=>A.group===M);T||(T={group:M,items:[]},S.groups.push(T)),T.items.push(_)}return b},[t,c]);return d.jsxs(oC,{open:a,onOpenChange:l,children:[d.jsx(aC,{asChild:!0,children:i}),d.jsxs(lC,{align:"start",className:"w-[320px] p-0",onClick:m=>m.stopPropagation(),children:[d.jsx("div",{className:"p-2 border-b",children:d.jsx(tf,{value:c,onChange:m=>f(m.target.value),placeholder:"Search metrics...",className:"h-7 text-xs"})}),d.jsxs("div",{className:"max-h-[50vh] overflow-y-auto p-1.5",children:[h.length===0&&d.jsx("p",{className:"text-xs text-muted-foreground text-center py-4",children:"No metrics found"}),h.map(m=>d.jsxs("div",{className:"mb-2",children:[d.jsx("div",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wider px-1.5 py-1",children:m.section}),m.groups.map(x=>d.jsxs("div",{children:[x.group&&d.jsx("div",{className:"text-[10px] font-medium text-muted-foreground/70 px-3 py-0.5",children:x.group}),x.items.map(b=>{const _=o.get(aL(b))??0,S=_>0;return d.jsxs("button",{type:"button",className:vt("flex w-full items-center gap-1.5 rounded px-3 py-0.5 text-xs text-left transition-colors hover:bg-accent hover:text-accent-foreground",!s&&S&&"text-accent-foreground"),onClick:()=>{!s&&S&&n?n(b):e(b),s&&(l(!1),f(""))},children:[d.jsx("span",{className:"flex-1",children:b.label}),s?_>0&&d.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums",children:_}):S&&d.jsx(H0,{className:"h-3 w-3 text-muted-foreground shrink-0"})]},`${b.plotType}-${b.evalName||""}-${b.metricKey}`)})]},`${m.section}-${x.group}`))]},m.section))]})]})]})}function zq({open:t,onOpenChange:e,title:n,description:r,onConfirm:i}){return d.jsx(W2,{open:t,onOpenChange:e,children:d.jsxs($2,{children:[d.jsxs(q2,{children:[d.jsx(Y2,{children:n}),d.jsx(K2,{children:r})]}),d.jsxs(X2,{children:[d.jsx(Q2,{children:"Cancel"}),d.jsx(Z2,{variant:"destructive",onClick:i,children:"Delete"})]})]})})}function $8({plot:t,onRemove:e,chartProps:n}){const{attributes:r,listeners:i,setNodeRef:s,transform:o,transition:a,isDragging:l}=vC({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},f=t.label||C1(t.metricKey),h=d.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:d.jsx(nC,{className:"h-3 w-3 text-muted-foreground"})}),m=d.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:d.jsx(ka,{className:"h-3 w-3"})});return d.jsx("div",{ref:s,style:c,children:t.plotType==="distribution_over_time"&&t.distMetricType?(()=>{const x=n.runs.find(b=>b.isSelected)??n.runs[0];return x?d.jsx(u5,{runPath:x.runPath,metricType:t.distMetricType,label:f,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,headerPrefix:h,headerSuffix:m}):null})():t.plotType==="inference_performance"&&t.inferenceMetricType?d.jsx(Aq,{runs:n.runs,shouldPoll:n.shouldPoll,hoveredRunId:n.hoveredRunId,scrollRoot:n.scrollRoot,inferenceMetricType:t.inferenceMetricType,label:f,headerPrefix:h,headerSuffix:m}):t.plotType==="inference_performance_area"&&t.inferenceAreaCategories?d.jsx(kq,{runs:n.runs,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,label:f,categories:t.inferenceAreaCategories,headerPrefix:h,headerSuffix:m}):t.plotType==="inference_utilization_area"&&t.inferenceAreaCategories?d.jsx(Pq,{runs:n.runs,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,label:f,categories:t.inferenceAreaCategories,headerPrefix:h,headerSuffix:m}):t.plotType==="trainer_performance"&&t.trainerMetricType?d.jsx(Dq,{runs:n.runs,shouldPoll:n.shouldPoll,hoveredRunId:n.hoveredRunId,scrollRoot:n.scrollRoot,trainerMetricType:t.trainerMetricType,label:f,headerPrefix:h,headerSuffix:m}):t.plotType==="trainer_performance_area"&&t.trainerAreaCategories?d.jsx(Lq,{runs:n.runs,shouldPoll:n.shouldPoll,scrollRoot:n.scrollRoot,label:f,categories:t.trainerAreaCategories,headerPrefix:h,headerSuffix:m}):t.plotType==="eval_metric"&&t.evalName?d.jsx(Eq,{runs:n.runs,shouldPoll:n.shouldPoll,evalName:t.evalName,metricName:t.metricKey,label:f,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,availableEnvs:n.availableEnvs,headerPrefix:h,headerSuffix:m,filterKey:t.id}):d.jsx(nr,{runs:n.runs,shouldPoll:n.shouldPoll,metricName:t.metricKey,label:f,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,availableEnvs:n.availableEnvs,headerPrefix:h,headerSuffix:m,filterKey:t.id})})}function kge({group:t,catalog:e,groupNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[o,a]=w.useState(!0),[l,c]=w.useState(!1),[f,h]=w.useState(!1),[m,x]=w.useState(!1),{attributes:b,listeners:_,setNodeRef:S,transform:M,transition:T,isDragging:A}=vC({id:t.id}),N={transform:by.Transform.toString(M),transition:T,opacity:A?.4:1},D=B=>{const H={id:d5(),metricKey:B.metricKey,label:B.label,plotType:B.plotType,evalName:B.evalName,distMetricType:B.distMetricType,inferenceMetricType:B.inferenceMetricType,inferenceAreaCategories:B.inferenceAreaCategories,trainerMetricType:B.trainerMetricType,trainerAreaCategories:B.trainerAreaCategories};r({...t,plots:[...t.plots,H]})},k=B=>{r({...t,plots:t.plots.filter(H=>H.id!==B)})},O=B=>{r({...t,name:B})},R=_y(ld(w0,{activationConstraint:{distance:5}}),ld(_0,{coordinateGetter:Ty})),L=B=>{const{active:H,over:$}=B;if(!$||H.id===$.id)return;const G=t.plots.findIndex(V=>V.id===H.id),Z=t.plots.findIndex(V=>V.id===$.id);G===-1||Z===-1||r({...t,plots:S0(t.plots,G,Z)})};return d.jsxs("div",{ref:S,style:N,children:[d.jsxs(Pi,{open:o,onOpenChange:a,children:[d.jsxs("div",{className:"flex items-center gap-1 h-8",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[d.jsx(Ii,{asChild:!0,children:d.jsxs("div",{className:"flex items-center gap-1.5 py-1 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors shrink-0",children:[d.jsx(Rr,{className:vt("h-3.5 w-3.5 text-muted-foreground transition-transform shrink-0",!o&&"-rotate-90")}),d.jsx("h4",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:t.name})]})}),d.jsx("button",{...b,..._,className:vt("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:d.jsx(nC,{className:"h-3.5 w-3.5 text-muted-foreground"})}),d.jsxs("div",{className:vt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[d.jsx(Ry,{catalog:e,onSelect:D,existingPlots:t.plots,allowDuplicates:!0,children:d.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:[d.jsx(yp,{className:"h-3 w-3"}),"New Plot"]})}),d.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:d.jsx(WW,{className:"h-3 w-3 text-muted-foreground"})}),d.jsx("button",{onClick:()=>x(!0),className:"h-6 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",children:d.jsx(ka,{className:"h-3 w-3 text-muted-foreground"})})]})]}),d.jsx(Di,{children:d.jsx(Sy,{sensors:R,collisionDetection:wy,onDragEnd:L,children:d.jsx(My,{items:t.plots.map(B=>B.id),strategy:HS,children:d.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(B=>d.jsx($8,{plot:B,onRemove:()=>k(B.id),chartProps:s},B.id)),t.plots.length===0&&d.jsx(Ry,{catalog:e,onSelect:D,existingPlots:t.plots,allowDuplicates:!0,children:d.jsxs("button",{className:"h-32 rounded-lg border-2 border-dashed border-gray-200 hover:border-gray-300 hover:bg-muted/50 transition-colors flex items-center justify-center text-xs text-muted-foreground gap-1",children:[d.jsx(yp,{className:"h-3.5 w-3.5"}),"Add a plot"]})})]})})})})]}),d.jsx(f5,{open:f,onOpenChange:h,title:"Rename Group",existingNames:n.filter(B=>B!==t.name),onSubmit:O,initialValue:t.name}),d.jsx(zq,{open:m,onOpenChange:x,title:"Delete Group",description:`Delete "${t.name}" and all its plots?`,onConfirm:i})]})}function Rge({section:t,catalog:e,allSectionNames:n,onUpdate:r,onRemove:i,chartProps:s}){const[o,a]=w.useState(!0),[l,c]=w.useState(!1),[f,h]=w.useState(!1),[m,x]=w.useState(!1),[b,_]=w.useState(!1),{attributes:S,listeners:M,setNodeRef:T,transform:A,transition:N,isDragging:D}=vC({id:t.id}),k={transform:by.Transform.toString(A),transition:N,opacity:D?.4:1},O=t.groups.map(ne=>ne.name),R=ne=>{const ie={id:d5(),name:ne,plots:[]};r({...t,groups:[...t.groups,ie]})},L=(ne,ie)=>{r({...t,groups:t.groups.map(z=>z.id===ne?ie:z)})},B=ne=>{r({...t,groups:t.groups.filter(ie=>ie.id!==ne)})},H=ne=>{const ie={id:d5(),metricKey:ne.metricKey,label:ne.label,plotType:ne.plotType,evalName:ne.evalName,distMetricType:ne.distMetricType,inferenceMetricType:ne.inferenceMetricType,inferenceAreaCategories:ne.inferenceAreaCategories,trainerMetricType:ne.trainerMetricType,trainerAreaCategories:ne.trainerAreaCategories};r({...t,plots:[...t.plots,ie]})},$=ne=>{r({...t,plots:t.plots.filter(ie=>ie.id!==ne)})},G=ne=>{r({...t,name:ne})},Z=_y(ld(w0,{activationConstraint:{distance:5}}),ld(_0,{coordinateGetter:Ty})),V=ne=>{const{active:ie,over:z}=ne;if(!z||ie.id===z.id)return;const j=t.groups.findIndex(F=>F.id===ie.id),X=t.groups.findIndex(F=>F.id===z.id);j===-1||X===-1||r({...t,groups:S0(t.groups,j,X)})},W=_y(ld(w0,{activationConstraint:{distance:5}}),ld(_0,{coordinateGetter:Ty})),J=ne=>{const{active:ie,over:z}=ne;if(!z||ie.id===z.id)return;const j=t.plots.findIndex(F=>F.id===ie.id),X=t.plots.findIndex(F=>F.id===z.id);j===-1||X===-1||r({...t,plots:S0(t.plots,j,X)})};return d.jsxs("div",{ref:T,style:k,children:[d.jsxs(Pi,{open:o,onOpenChange:a,children:[d.jsxs("div",{className:"flex items-center gap-1.5 h-9",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[d.jsx(Ii,{asChild:!0,children:d.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform shrink-0",!o&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:t.name})]})}),d.jsx("button",{...S,...M,className:vt("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:d.jsx(nC,{className:"h-4 w-4 text-muted-foreground"})}),d.jsxs("div",{className:vt("flex items-center gap-1 shrink-0 transition-opacity",l?"opacity-100":"opacity-0 pointer-events-none"),children:[d.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:[d.jsx(yp,{className:"h-3 w-3"}),"New Group"]}),d.jsx(Ry,{catalog:e,onSelect:H,existingPlots:t.plots,allowDuplicates:!0,children:d.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:[d.jsx(yp,{className:"h-3 w-3"}),"New Plot"]})}),d.jsx("button",{onClick:()=>x(!0),className:"h-7 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",title:"Rename section",children:d.jsx(WW,{className:"h-3.5 w-3.5 text-muted-foreground"})}),d.jsx("button",{onClick:()=>_(!0),className:"h-7 px-1.5 rounded-md border border-input hover:bg-accent flex items-center transition-colors",children:d.jsx(ka,{className:"h-3.5 w-3.5 text-muted-foreground"})})]})]}),d.jsxs(Di,{children:[t.plots.length>0&&d.jsx(Sy,{sensors:W,collisionDetection:wy,onDragEnd:J,children:d.jsx(My,{items:t.plots.map(ne=>ne.id),strategy:HS,children:d.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(ne=>d.jsx($8,{plot:ne,onRemove:()=>$(ne.id),chartProps:s},ne.id))})})}),d.jsx(Sy,{sensors:Z,collisionDetection:wy,onDragEnd:V,children:d.jsx(My,{items:t.groups.map(ne=>ne.id),strategy:A8,children:d.jsx("div",{className:"space-y-2",children:t.groups.map(ne=>d.jsx(kge,{group:ne,catalog:e,groupNames:O,onUpdate:ie=>L(ne.id,ie),onRemove:()=>B(ne.id),chartProps:s},ne.id))})})}),t.plots.length===0&&t.groups.length===0&&d.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[d.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"No plots yet. Add a group or a plot."}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Sn,{size:"sm",variant:"outline",onClick:()=>h(!0),children:[d.jsx(yp,{className:"h-3.5 w-3.5 mr-1"}),"New Group"]}),d.jsx(Ry,{catalog:e,onSelect:H,existingPlots:t.plots,allowDuplicates:!0,children:d.jsxs(Sn,{size:"sm",variant:"outline",children:[d.jsx(yp,{className:"h-3.5 w-3.5 mr-1"}),"New Plot"]})})]})]})]})]}),d.jsx(f5,{open:f,onOpenChange:h,title:"New Group",existingNames:O,onSubmit:R}),d.jsx(f5,{open:m,onOpenChange:x,title:"Rename Section",existingNames:n.filter(ne=>ne!==t.name),onSubmit:G,initialValue:t.name}),d.jsx(zq,{open:b,onOpenChange:_,title:"Delete Section",description:`Delete "${t.name}" and all its groups and plots?`,onConfirm:i})]})}function Pge({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,availableRewardNames:s,customMetricSections:o,xAxisMode:a,scrollRoot:l,maxStep:c,maxTime:f,evalsList:h,newSectionTrigger:m,availableSampleTags:x,availableEnvs:b,activeTemplateId:_,layoutSnapshotTrigger:S,onLayoutSnapshot:M}){var Pe,Ke,rt,ye,$e,Ze,ft,lt,Je,Ae,We,De,Ne,ot,dt,Pt,kt,wt,Vt,rn;const T=Fp(),{data:A,isLoading:N}=JW(),{data:D}=Bfe(_),[k,O]=w.useState({sections:[]}),[R,L]=w.useState(!1),[B,H]=w.useState(!1),[$,G]=w.useState(void 0);_!==$?_===null?A&&(G(null),O(A.layout??{sections:[]})):D&&D.id===_&&(G(_),O(D.layout??{sections:[]})):!B&&_===null&&A&&(H(!0),G(null),A.layout&&O(A.layout));const[Z,V]=w.useState(m);m!==Z&&(V(m),L(!0));const[W,J]=w.useState(S);S!==W&&(J(S),M(k));const ne=w.useRef(null),ie=w.useRef(null),z=w.useRef(_);z.current=_;const j=w.useCallback(Bt=>{O(Bt);const Gt=z.current;Gt===null?T.setQueryData(["custom-metrics-layout"],{layout:Bt}):T.setQueryData(["custom-metrics-template",Gt],Dt=>Dt&&{...Dt,layout:Bt}),ie.current=Bt,ne.current&&clearTimeout(ne.current),ne.current=setTimeout(async()=>{if(ie.current){const Dt=ie.current;ie.current=null;const Qt=z.current;Qt===null?await sL(Dt):await oL(Qt,Dt)}},500)},[T]);w.useEffect(()=>()=>{if(ne.current&&clearTimeout(ne.current),ie.current){const Bt=ie.current;ie.current=null;const Gt=z.current;Gt===null?sL(Bt):oL(Gt,Bt)}},[]);const X=w.useMemo(()=>jq(o,s,h),[o,s,h]),F=a==="time",ce=Gr(((Pe=t[0])==null?void 0:Pe.runPath)||"",F&&!!t[0],e),oe=Gr(((Ke=t[1])==null?void 0:Ke.runPath)||"",F&&!!t[1],e),Q=Gr(((rt=t[2])==null?void 0:rt.runPath)||"",F&&!!t[2],e),se=Gr(((ye=t[3])==null?void 0:ye.runPath)||"",F&&!!t[3],e),re=Gr((($e=t[4])==null?void 0:$e.runPath)||"",F&&!!t[4],e),K=Gr(((Ze=t[5])==null?void 0:Ze.runPath)||"",F&&!!t[5],e),fe=Gr(((ft=t[6])==null?void 0:ft.runPath)||"",F&&!!t[6],e),he=Gr(((lt=t[7])==null?void 0:lt.runPath)||"",F&&!!t[7],e),ae=Gr(((Je=t[8])==null?void 0:Je.runPath)||"",F&&!!t[8],e),Se=Gr(((Ae=t[9])==null?void 0:Ae.runPath)||"",F&&!!t[9],e),de=Gr(((We=t[10])==null?void 0:We.runPath)||"",F&&!!t[10],e),Me=Gr(((De=t[11])==null?void 0:De.runPath)||"",F&&!!t[11],e),Ce=Gr(((Ne=t[12])==null?void 0:Ne.runPath)||"",F&&!!t[12],e),Re=Gr(((ot=t[13])==null?void 0:ot.runPath)||"",F&&!!t[13],e),le=Gr(((dt=t[14])==null?void 0:dt.runPath)||"",F&&!!t[14],e),He=Gr(((Pt=t[15])==null?void 0:Pt.runPath)||"",F&&!!t[15],e),Le=Gr(((kt=t[16])==null?void 0:kt.runPath)||"",F&&!!t[16],e),ze=Gr(((wt=t[17])==null?void 0:wt.runPath)||"",F&&!!t[17],e),Ve=Gr(((Vt=t[18])==null?void 0:Vt.runPath)||"",F&&!!t[18],e),ue=Gr(((rn=t[19])==null?void 0:rn.runPath)||"",F&&!!t[19],e),Y=w.useMemo(()=>[ce,oe,Q,se,re,K,fe,he,ae,Se,de,Me,Ce,Re,le,He,Le,ze,Ve,ue],[ce,oe,Q,se,re,K,fe,he,ae,Se,de,Me,Ce,Re,le,He,Le,ze,Ve,ue]),{isStepTimesFetching:xe,isStepTimesRefetching:we}=w.useMemo(()=>{if(!F)return{isStepTimesFetching:!1,isStepTimesRefetching:!1};const Bt=Y.some(Qt=>Qt.isFetching),Gt=Y.filter(Qt=>Qt.isFetching),Dt=Bt&&Gt.length>0&&Gt.every(Qt=>!!Qt.data);return{isStepTimesFetching:Bt,isStepTimesRefetching:Dt}},[F,Y]),{stepTimesByRun:Te,firstStepTimesByRun:ge}=w.useMemo(()=>{if(!F)return{stepTimesByRun:new Map,firstStepTimesByRun:new Map};const Bt=new Map,Gt=new Map;return t.forEach((Dt,Qt)=>{if(Qt>=20)return;const It=Y[Qt].data;if(!It||It.first_step_time===null||It.first_step_time===void 0||!It.step_times||It.step_times.length===0)return;const Lt=new Map;It.step_times.forEach(zt=>{typeof zt.time=="number"&&Lt.set(zt.step,zt.time)}),Lt.size>0&&(Bt.set(Dt.runPath,Lt),Gt.set(Dt.runPath,It.first_step_time))}),{stepTimesByRun:Bt,firstStepTimesByRun:Gt}},[t,F,Y]),Ue=w.useMemo(()=>({runs:t,shouldPoll:e,showEma:n,emaSpan:r,hoveredRunId:i,xAxisMode:a,scrollRoot:l,maxStep:c,maxTime:f,stepTimesByRun:Te,firstStepTimesByRun:ge,isStepTimesFetching:xe,isStepTimesRefetching:we,availableSampleTags:x,availableEnvs:b}),[t,e,n,r,i,a,l,c,f,Te,ge,xe,we,x,b]),be=k.sections.map(Bt=>Bt.name),ke=Bt=>{const Gt={id:d5(),name:Bt,groups:[],plots:[]};j({sections:[...k.sections,Gt]})},qe=(Bt,Gt)=>{j({sections:k.sections.map(Dt=>Dt.id===Bt?Gt:Dt)})},Qe=Bt=>{j({sections:k.sections.filter(Gt=>Gt.id!==Bt)})},nt=_y(ld(w0,{activationConstraint:{distance:8}}),ld(_0,{coordinateGetter:Ty})),st=Bt=>{const{active:Gt,over:Dt}=Bt;if(!Dt||Gt.id===Dt.id)return;const Qt=k.sections.findIndex(It=>It.id===Gt.id),hn=k.sections.findIndex(It=>It.id===Dt.id);Qt===-1||hn===-1||j({sections:S0(k.sections,Qt,hn)})};return d.jsxs("div",{className:"-mt-3",children:[d.jsx(Sy,{sensors:nt,collisionDetection:wy,onDragEnd:st,children:d.jsx(My,{items:k.sections.map(Bt=>Bt.id),strategy:A8,children:k.sections.map((Bt,Gt)=>d.jsxs("div",{children:[Gt>0&&d.jsx("div",{className:"border-t border-gray-200 my-3"}),d.jsx(Rge,{section:Bt,catalog:X,allSectionNames:be,onUpdate:Dt=>qe(Bt.id,Dt),onRemove:()=>Qe(Bt.id),chartProps:Ue})]},Bt.id))})}),k.sections.length===0&&N&&d.jsxs("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:[d.jsx(Ml,{className:"h-4 w-4 animate-spin mr-2"}),d.jsx("span",{className:"text-sm",children:"Loading..."})]}),k.sections.length===0&&!N&&d.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[d.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No custom sections yet. Create one to start building your dashboard."}),d.jsxs(Sn,{size:"sm",variant:"outline",onClick:()=>L(!0),children:[d.jsx(yp,{className:"h-3.5 w-3.5 mr-1"}),"New Section"]})]}),d.jsx(f5,{open:R,onOpenChange:L,title:"New Section",existingNames:be,onSubmit:ke})]})}const lL=100;function Fq({current:t,total:e,fillClassName:n,activeBorderClassName:r}){const i=e/lL;return d.jsx("div",{className:"flex gap-[2px]",children:Array.from({length:lL}).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 f=c>0&&r?r:"border-muted-foreground/50";return d.jsx("div",{className:`relative flex-1 h-8 border ${f} rounded-[2px] overflow-hidden bg-background`,children:c>0&&d.jsx("div",{className:`absolute top-0 left-0 bottom-0 transition-all duration-200 ${n}`,style:{width:`${c*100}%`}})},o)})})}function cL(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 Ige(t,e){const[n,r]=w.useState(null);if(w.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 Dge(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 Oge(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 S_(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 Lge(t,e,n){if(t.length===0||e>=n)return null;const i=[...t].sort((m,x)=>m.step-x.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 m=0;m<a;m++){const x=Math.pow(o,a-1-m);l+=i[m].value*x,c+=x}const f=l/c,h=n-e;return f*h}function jge({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 d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Training Progress"}),d.jsxs("div",{className:"flex items-baseline gap-1.5 flex-wrap",children:[d.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[o.toFixed(2),"%"]}),d.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[i," / ",e," Steps"]}),n!==null&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),d.jsx("span",{className:"text-sm text-muted-foreground tabular-nums",children:cL(n)})]}),r!==null&&r>0&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),d.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:["ETA: ",cL(r)]})]})]}),d.jsx(Fq,{current:i,total:e,fillClassName:"bg-foreground",activeBorderClassName:"border-foreground"})]})}function zge({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 d.jsxs("div",{className:"space-y-1.5",children:[d.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["Trainer Bucket",n!==null?` (Step ${n})`:"",o>0&&d.jsxs("span",{className:"ml-2 font-normal",children:["· ",o," batch",o!==1?"es":""," waiting for trainer"," · ",d.jsxs("span",{className:"tabular-nums",children:["steps ",r.join(", ")]})]})]}),d.jsxs("div",{className:"flex items-baseline gap-1.5",children:[d.jsxs("span",{className:"text-sm font-bold tabular-nums",children:[s.toFixed(2),"%"]}),d.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[t," / ",e," Groups"]})]}),d.jsx(Fq,{current:t,total:e,fillClassName:"bg-muted-foreground/40"})]})}function Fge(){var be,ke,qe,Qe,nt,st,Pe,Ke;const t=Kn(wl),e=Kn(XT),n=Kn(ZT),r=ad(PW),i=ad(IW),[s,o]=w.useState(!0),[a,l]=w.useState(!0),[c,f]=w.useState("custom"),[h,m]=w.useState(0),[x,b]=w.useState(0),[_,S]=cn(sue),[M,T]=cn(oue),[A,N]=w.useState(String(M)),[D,k]=cn(aue),[O,R]=cn(DW),[L,B]=cn(OW),[H,$]=cn(cue),[G,Z]=w.useState(!1),[V,W]=w.useState(""),[J,ne]=w.useState(!1),ie=Fp(),z=D?n:null,{data:j,isLoading:X,error:F}=Sh(t||"",!!t,!0),{data:ce}=G0(),oe=w.useMemo(()=>{const rt=new Set(e);return t&&rt.add(t),Array.from(rt)},[t,e]),Q=w.useMemo(()=>{const rt=(ce==null?void 0:ce.runs)||[],ye=new Set(oe);return rt.filter($e=>ye.has($e.run_id)).map($e=>({runPath:$e.run_id,runName:$e.name,color:$e.color,isSelected:$e.run_id===t}))},[t,oe,ce==null?void 0:ce.runs]);w.useEffect(()=>{j&&(r(j.is_tracking),i(j.is_syncing))},[j,r,i]);const se=typeof((be=j==null?void 0:j.config)==null?void 0:be.number_of_steps)=="number"?j.config.number_of_steps:null,re=typeof((ke=j==null?void 0:j.config)==null?void 0:ke.prompts_batch_size_for_trainer)=="number"?j.config.prompts_batch_size_for_trainer:typeof((qe=j==null?void 0:j.config)==null?void 0:qe.batch_size_for_trainer)=="number"?j.config.batch_size_for_trainer:null,K=(Qe=j==null?void 0:j.summary)!=null&&Qe.steps&&typeof j.summary.steps=="object"?j.summary.steps:null,fe=S_((nt=j==null?void 0:j.summary)==null?void 0:nt["steps/last_training_step"])??S_(K==null?void 0:K.last_training_step)??S_((st=j==null?void 0:j.trainer_info)==null?void 0:st.last_training_step)??S_((Pe=j==null?void 0:j.rollout_info)==null?void 0:Pe.last_training_step)??S_(j==null?void 0:j.last_rollout_step)??-1,he=j==null?void 0:j.trainer_bucket_info,{customMetricSections:ae,availableRewardNames:Se,evalsList:de,availableSampleTags:Me,availableEnvs:Ce,totalSteps:Re}=b8(oe),le=w.useMemo(()=>jq(ae,Se,de),[ae,Se,de]),He=w.useMemo(()=>{if(D)return Q;const rt=Q.find(ye=>ye.isSelected);return rt?[rt]:Q.slice(0,1)},[D,Q]),Le=_y(ld(w0,{activationConstraint:{distance:5}}),ld(_0,{coordinateGetter:Ty})),ze=w.useCallback(rt=>{const{active:ye,over:$e}=rt;!$e||ye.id===$e.id||$(Ze=>{const ft=Ze.findIndex(Je=>Je.id===ye.id),lt=Ze.findIndex(Je=>Je.id===$e.id);return ft===-1||lt===-1?Ze:S0(Ze,ft,lt)})},[$]),Ve=w.useMemo(()=>({runs:He,shouldPoll:!0,showEma:_,emaSpan:M,hoveredRunId:z,xAxisMode:"step",scrollRoot:null,availableSampleTags:Me,availableEnvs:Ce}),[He,_,M,z,Me,Ce]),ue=w.useMemo(()=>!t||!(ce!=null&&ce.runs)?null:ce.runs.find(rt=>rt.run_id===t)??null,[t,ce]);w.useEffect(()=>{Z(!1)},[t]);const Y=((Ke=ue==null?void 0:ue.state)==null?void 0:Ke.toLowerCase())==="running",xe=Ige((ue==null?void 0:ue.created_at)??null,Y),we=w.useMemo(()=>{var $e,Ze,ft;if(Y)return null;const rt=($e=j==null?void 0:j.summary)==null?void 0:$e._runtime;if(typeof rt=="number")return rt;const ye=(ft=(Ze=j==null?void 0:j.summary)==null?void 0:Ze._wandb)==null?void 0:ft.runtime;return typeof ye=="number"?ye:null},[Y,j==null?void 0:j.summary]),Te=Y?xe:we,{data:ge}=ZW(t||"","timing_step_total",!!t&&!!se&&fe>0,!0),Ue=w.useMemo(()=>{if(!(ge!=null&&ge.metrics)||!se||fe<=0)return null;const rt=ge.metrics.filter(Ze=>Ze.metric_name==="timing_step_total").map(Ze=>({step:Ze.step,value:Ze.value}));if(rt.length===0)return null;const ye=Math.min(...rt.map(Ze=>Ze.step)),$e=rt.filter(Ze=>Ze.step!==ye);return Lge($e,fe,se)},[ge,se,fe]);return t?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:d.jsx("div",{className:"py-2.5 px-6",children:d.jsx("div",{className:"max-w-7xl mx-auto flex items-center gap-2.5 h-7",children:ue&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0",style:{backgroundColor:ue.color}}),d.jsx("span",{className:"text-sm font-semibold truncate",children:ue.name||ue.run_id.split("/").pop()}),d.jsx("span",{className:"text-sm text-muted-foreground truncate",children:ue.run_id}),ue.created_at&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-sm text-muted-foreground",children:"·"}),d.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums whitespace-nowrap",children:["Created at ",Dge(ue.created_at)]})]})]})})})}),d.jsx("div",{className:O||L?"flex-1 min-h-0 overflow-hidden":"flex-1 overflow-auto p-6",children:O?d.jsx(pme,{runPath:t,onBack:()=>R(!1)},t):L?d.jsx(mme,{runPath:t,onBack:()=>B(!1)},`logs-${t}`):d.jsxs("div",{className:"max-w-7xl mx-auto space-y-6",children:[X?d.jsxs("div",{className:"space-y-3",children:[d.jsx(up,{className:"h-4 w-32"}),d.jsx(up,{className:"h-8 w-64"}),d.jsx(up,{className:"h-8 w-full"})]}):F?d.jsx(hd,{className:"border-destructive",children:d.jsx(dh,{className:"pt-6",children:d.jsx("p",{className:"text-destructive",children:"Failed to load run summary. Make sure the run has been synced."})})}):d.jsxs("div",{className:"space-y-5",children:[se!==null?d.jsx(jge,{currentStep:fe,totalSteps:se,runtimeSeconds:Te??null,estimatedSecondsToFinish:Ue}):d.jsxs("div",{className:"space-y-1.5",children:[d.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Training Progress"}),d.jsx("div",{className:"flex items-baseline gap-1.5",children:d.jsx("span",{className:"text-sm text-muted-foreground",children:"Waiting for data…"})})]}),re!==null&&he&&d.jsx(zge,{groupsDone:he.groups_done,totalGroups:re,step:he.step,waitingBuckets:j==null?void 0:j.waiting_buckets})]}),Re>0&&Q.length>0&&d.jsx("div",{children:s?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>o(!1),children:"Hide Plots"}),d.jsx(Bw,{label:"EMA",variant:"selecting",size:"sm",enabled:_,onEnabledChange:S,value:A,onValueChange:N,onValueCommit:rt=>{const ye=parseInt(rt,10);!isNaN(ye)&&ye>=2&&ye<=100?(T(ye),N(ye.toString())):N(M.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),d.jsx(U1,{variant:"selecting",size:"sm",pressed:D,onPressedChange:k,className:"text-xs px-2",children:"All selected runs"}),d.jsx(Ry,{catalog:le,existingPlots:H,allowDuplicates:!0,onSelect:rt=>{const ye=Math.random().toString(36).slice(2,10);$($e=>[...$e,{id:ye,metricKey:rt.metricKey,label:rt.label,plotType:rt.plotType,evalName:rt.evalName,distMetricType:rt.distMetricType,inferenceMetricType:rt.inferenceMetricType,inferenceAreaCategories:rt.inferenceAreaCategories,trainerMetricType:rt.trainerMetricType,trainerAreaCategories:rt.trainerAreaCategories}])},children:d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Plots"})})]}),d.jsx(Sy,{sensors:Le,collisionDetection:wy,onDragEnd:ze,children:d.jsx(My,{items:H.map(rt=>rt.id),strategy:HS,children:d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:H.map(rt=>d.jsx($8,{plot:rt,onRemove:()=>$(ye=>ye.filter($e=>$e.id!==rt.id)),chartProps:Ve},rt.id))})})})]}):d.jsxs("button",{onClick:()=>o(!0),className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors flex items-center gap-1.5",children:[d.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:d.jsx("path",{d:"m6 9 6 6 6-6"})}),d.jsx("span",{className:"text-sm font-semibold",children:"Plots"})]})}),(j==null?void 0:j.config)&&(()=>{const{model:rt,envNames:ye}=Oge(j.config);return!rt&&ye.length===0?null:d.jsxs("div",{className:"flex items-center gap-3 text-sm mb-4",children:[rt&&d.jsx("span",{className:"font-semibold",children:rt}),ye.map($e=>d.jsx("span",{className:"text-muted-foreground",children:$e},$e))]})})(),(j==null?void 0:j.config)&&Object.keys(j.config).length>0&&d.jsx("div",{children:a?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-sm font-semibold",children:"Run Configuration"}),j.custom_config&&d.jsxs(M0,{type:"single",value:c,onValueChange:rt=>{rt&&f(rt)},variant:"outline",size:"sm",children:[d.jsx(Ka,{value:"custom",className:"text-xs px-3 h-7",children:"Custom"}),d.jsx(Ka,{value:"all",className:"text-xs px-3 h-7",children:"All"})]}),d.jsx(Qpe,{currentRunId:t,currentConfig:j.config}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{m(rt=>rt+1)},children:"Collapse All"}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{b(rt=>rt+1)},children:"Expand All"}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>R(!0),children:"Code"}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>B(!0),children:"Logs"}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>l(!1),children:"Hide Configs"})]}),d.jsx(r$,{config:c==="custom"&&j.custom_config?j.custom_config:j.config,collapseAllSignal:h,expandAllSignal:x})]}):d.jsxs("button",{onClick:()=>l(!0),className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors flex items-center gap-1.5",children:[d.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:d.jsx("path",{d:"m6 9 6 6 6-6"})}),d.jsx("span",{className:"text-sm font-semibold",children:"Run Configuration"})]})}),ue&&d.jsxs("div",{className:"mt-4",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[d.jsx("span",{className:"text-sm font-semibold",children:"Notes"}),!G&&d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{W(ue.notes||""),Z(!0)},children:ue.notes?"Edit":"Add Notes"})]}),G?d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsx("textarea",{className:"w-full h-[200px] rounded-md border border-input bg-transparent px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring resize-none",value:V,onChange:rt=>W(rt.target.value),placeholder:"Add notes for this run…",autoFocus:!0}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(Sn,{size:"sm",className:"h-7 px-3 text-xs",disabled:J,onClick:async()=>{ne(!0);try{(await fetch(`${Gn}/update-notes`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_path:ue.run_id,notes:V})})).ok&&(await ie.invalidateQueries({queryKey:["runs"]}),Z(!1))}finally{ne(!1)}},children:J?"Saving…":"Save"}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs",disabled:J,onClick:()=>Z(!1),children:"Cancel"})]})]}):ue.notes?d.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:ue.notes}):null]})]})})]}):d.jsx(V0,{description:"Select a run from the sidebar or add a new one to get started."})}const G4=qi;function Uge(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 Bge(){const[t,e]=w.useState(null),n=w.useRef(0),[r,i]=cn(gue),s=Kn(wl),o=Kn(XT),a=Kn(ZT),[l,c]=cn(xue),[f,h]=w.useState(0),m=Fp(),[x,b]=cn(vue),[_,S]=cn(yue),{data:M}=Ufe(),T=(M==null?void 0:M.templates)??[],[A,N]=w.useState(!1),[D,k]=w.useState(!1),[O,R]=w.useState("new"),[L,B]=w.useState(""),[H,$]=w.useState(!1),[G,Z]=w.useState(0),V=w.useRef(null),W=w.useRef(null),J=w.useCallback(be=>{R(be),B(be==="rename"?_??"":""),be==="new"?(W.current={sections:[]},k(!0)):be==="duplicate"?(V.current=ke=>{V.current=null,W.current=ke,k(!0)},Z(ke=>ke+1)):k(!0)},[_]),ne=w.useCallback(async()=>{const be=L.trim();if(be){if(O==="new"||O==="duplicate"){const ke=W.current??{sections:[]},qe=await fetch(`${Gn}/custom-metrics-templates`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:be,layout:ke})});if(qe.ok){const Qe=await qe.json();b(Qe.id),S(Qe.name),m.invalidateQueries({queryKey:["custom-metrics-templates"]})}W.current=null}else O==="rename"&&x&&(await fetch(`${Gn}/custom-metrics-templates/${x}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:be})})).ok&&(S(be),m.invalidateQueries({queryKey:["custom-metrics-templates"]}));k(!1)}},[L,O,x,b,S,m]),ie=w.useCallback(be=>{be===null?(b(null),S(null)):(b(be.id),S(be.name)),N(!1)},[b,S]),z=w.useCallback(async()=>{x&&(await fetch(`${Gn}/custom-metrics-templates/${x}`,{method:"DELETE"}),b(null),S(null),m.invalidateQueries({queryKey:["custom-metrics-templates"]}),$(!1))},[x,b,S,m]),[j,X]=cn(uue),[F,ce]=cn(due),[oe,Q]=w.useState(F.toString()),[se,re]=cn(fue),[K,fe]=cn(hue),[he,ae]=cn(pue),[Se,de]=cn(mue),[Me,Ce]=w.useState(he.toString()),[Re,le]=w.useState(G4(Se));w.useEffect(()=>{Ce(he.toString())},[he]),w.useEffect(()=>{le(G4(Se))},[Se]),JW();const He=!0;w.useEffect(()=>{t&&(t.scrollTop=r,n.current=r)},[t]),w.useEffect(()=>{if(!t)return;const be=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",be,{passive:!0}),()=>{t.removeEventListener("scroll",be),i(n.current)}},[t]);const{data:Le}=G0(),ze=w.useMemo(()=>{const be=(Le==null?void 0:Le.runs)||[],ke=new Set(o);return s&&ke.add(s),be.filter(qe=>ke.has(qe.run_id)).map(qe=>({runPath:qe.run_id,runName:qe.name,color:qe.color,isSelected:qe.run_id===s}))},[s,o,Le==null?void 0:Le.runs]),Ve=w.useMemo(()=>{const be=new Set(o);return s&&be.add(s),Array.from(be)},[s,o]),{customMetricSections:ue,availableRewardNames:Y,evalsList:xe,availableSampleTags:we,availableEnvs:Te,totalSteps:ge,error:Ue}=b8(Ve);return s?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center justify-start gap-2 h-7",children:[d.jsxs(M0,{type:"single",variant:"outline",size:"sm",value:l,onValueChange:be=>{be&&c(be)},children:[d.jsx(Ka,{value:"all",className:"text-xs px-2 py-1 h-7",children:"All"}),d.jsx(Ka,{value:"custom",className:"text-xs px-2 py-1 h-7",children:"Custom"})]}),l==="custom"&&d.jsxs(d.Fragment,{children:[d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>h(be=>be+1),children:[d.jsx(yp,{className:"h-3 w-3 mr-1"}),"New Section"]}),d.jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",children:["Templates",_&&d.jsxs("span",{className:"ml-1 text-muted-foreground",children:["(",_,")"]})]})}),d.jsxs($s,{align:"start",children:[d.jsx(Mo,{onClick:()=>N(!0),children:"Load"}),d.jsx(Mo,{onClick:()=>J("new"),children:"New"}),d.jsx(Mo,{onClick:()=>J("duplicate"),children:"Duplicate"}),d.jsx(ys,{}),d.jsx(Mo,{onClick:()=>J("rename"),disabled:!x,children:"Rename"}),d.jsx(Mo,{onClick:()=>$(!0),disabled:!x,className:"text-destructive focus:text-destructive",children:"Delete"})]})]})]}),d.jsx("div",{className:"w-px h-4 bg-border mx-0.5"}),d.jsxs(M0,{type:"single",variant:"outline",size:"sm",value:se,onValueChange:be=>{be&&re(be)},children:[d.jsx(Ka,{value:"step",className:"text-xs px-2 py-1 h-7",children:"Step"}),d.jsx(Ka,{value:"time",className:"text-xs px-2 py-1 h-7",children:"Time"})]}),d.jsx(Bw,{label:"EMA",variant:"selecting",size:"sm",enabled:j,onEnabledChange:X,value:oe,onValueChange:Q,onValueCommit:be=>{const ke=parseInt(be,10);!isNaN(ke)&&ke>=2&&ke<=100?(ce(ke),Q(ke.toString())):Q(F.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"}),d.jsx(Bw,{label:se==="step"?"Max Step":"Max Time",variant:"selecting",size:"sm",enabled:K,onEnabledChange:fe,value:se==="step"?Me:Re,inputType:se==="step"?"number":"text",onValueChange:be=>{se==="step"?Ce(be):le(be)},onValueCommit:be=>{if(se==="step"){const ke=parseInt(be,10);!isNaN(ke)&&ke>=1?(ae(ke),Ce(ke.toString())):Ce(he.toString())}else{const ke=Uge(be);ke!==null?(de(ke),le(G4(ke))):le(G4(Se))}},inputMin:1,inputWidth:"w-16"})]})})}),d.jsx("div",{className:"flex-1 overflow-auto p-6",ref:e,children:d.jsxs("div",{className:"max-w-7xl mx-auto",children:[Ue&&d.jsx(hd,{className:"border-destructive mb-6",children:d.jsx(dh,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error:"," ",Ue instanceof Error?Ue.message:"Unknown error"]})})}),l==="all"?d.jsx(yge,{runs:ze,shouldPoll:He,totalSteps:ge,showEma:j,emaSpan:F,hoveredRunId:a,availableRewardNames:Y,customMetricSections:ue,xAxisMode:se,scrollRoot:t,maxStep:K&&se==="step"?he:void 0,maxTime:K&&se==="time"?Se:void 0,evalsList:xe,availableSampleTags:we,availableEnvs:Te}):d.jsx(Pge,{runs:ze,shouldPoll:He,showEma:j,emaSpan:F,hoveredRunId:a,availableRewardNames:Y,customMetricSections:ue,xAxisMode:se,scrollRoot:t,maxStep:K&&se==="step"?he:void 0,maxTime:K&&se==="time"?Se:void 0,evalsList:xe,availableSampleTags:we,availableEnvs:Te,newSectionTrigger:f,activeTemplateId:x,layoutSnapshotTrigger:G,onLayoutSnapshot:be=>{V.current&&V.current(be)}})]})}),d.jsx(Lc,{open:A,onOpenChange:N,children:d.jsxs(jc,{className:"sm:max-w-[400px]",children:[d.jsx(Wl,{children:d.jsx($l,{children:"Load Template"})}),d.jsxs("div",{className:"flex flex-col gap-1 max-h-[300px] overflow-y-auto",children:[d.jsx("button",{className:vt("text-left px-3 py-2 rounded-md text-sm hover:bg-accent transition-colors",x===null&&"bg-accent font-medium"),onClick:()=>ie(null),children:"Default"}),T.map(be=>d.jsx("button",{className:vt("text-left px-3 py-2 rounded-md text-sm hover:bg-accent transition-colors",x===be.id&&"bg-accent font-medium"),onClick:()=>ie(be),children:be.name},be.id)),T.length===0&&d.jsx("p",{className:"text-xs text-muted-foreground px-3 py-2",children:"No saved templates yet."})]})]})}),d.jsx(Lc,{open:D,onOpenChange:k,children:d.jsxs(jc,{className:"sm:max-w-[400px]",children:[d.jsx(Wl,{children:d.jsx($l,{children:O==="new"?"New Template":O==="duplicate"?"Duplicate Template":"Rename Template"})}),d.jsx(tf,{placeholder:"Template name",value:L,onChange:be=>B(be.target.value),onKeyDown:be=>{be.key==="Enter"&&L.trim()&&ne()},autoFocus:!0}),d.jsxs(Km,{children:[d.jsx(Sn,{variant:"outline",size:"sm",onClick:()=>k(!1),children:"Cancel"}),d.jsx(Sn,{size:"sm",onClick:ne,disabled:!L.trim(),children:O==="rename"?"Rename":"Create"})]})]})}),d.jsx(W2,{open:H,onOpenChange:$,children:d.jsxs($2,{children:[d.jsxs(q2,{children:[d.jsx(Y2,{children:"Delete Template"}),d.jsxs(K2,{children:["Are you sure you want to delete “",_,"”? This action cannot be undone."]})]}),d.jsxs(X2,{children:[d.jsx(Q2,{children:"Cancel"}),d.jsx(Z2,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]}):d.jsx(V0,{description:"Select a run from the sidebar to view training metrics."})}function Hge({...t}){return d.jsx(Woe,{"data-slot":"context-menu",...t})}function Gge({className:t,...e}){return d.jsx($oe,{"data-slot":"context-menu-trigger",className:vt("select-none",t),...e})}function Vge({className:t,...e}){return d.jsx(qoe,{children:d.jsx(Xoe,{"data-slot":"context-menu-content",className:vt("z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",t),...e})})}function Wge({className:t,inset:e,variant:n="default",...r}){return d.jsx(Yoe,{"data-slot":"context-menu-item","data-inset":e,"data-variant":n,className:vt("group/context-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive",t),...r})}const V4=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],AC={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:"%"},requests_total:{label:"Requests Total",unit:""},prompt_tokens_total:{label:"Prompt Tokens Total",unit:""},generation_tokens_total:{label:"Generation 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"},queue_time_mean:{label:"Queue Time (Mean)",unit:"s"},inference_time_mean:{label:"Inference Time (Mean)",unit:"s"},prefill_time_mean:{label:"Prefill Time (Mean)",unit:"s"},decode_time_mean:{label:"Decode Time (Mean)",unit:"s"},iteration_tokens_mean:{label:"Iteration Tokens (Mean)",unit:""},generation_tokens_per_request_mean:{label:"Generation Tokens/Request (Mean)",unit:""},prompt_tokens_per_request_mean:{label:"Prompt Tokens/Request (Mean)",unit:""}};function $ge(t){const e=Math.abs(t);if(e>=60)return hC(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 wu(t)}const qge=28;function Xge(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,f=l<t.length?t[l]:void 0,h=c!=null,m=f!=null;if(h&&m){const x=Math.abs(Number(e[a])-i),_=Math.abs(Number(e[l])-i)<x?l:a;return s(_)?_:null}if(h)return s(a)?a:null;if(m)return s(l)?l:null;a-=1,l+=1}return null}function Yge(t){if(t.length<4)return null;const e=[...t].sort((c,f)=>c-f),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 n6({label:t,onRemove:e}){return d.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] bg-background border border-border text-muted-foreground rounded-full cursor-pointer hover:bg-muted transition-colors",onClick:n=>{n.stopPropagation(),e()},children:[t,d.jsx(ka,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Kge(){const[t,e]=w.useState(!1);w.useEffect(()=>{if(!t)return;const i=s=>{s.key==="Escape"&&e(!1)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]);const n=w.useCallback(()=>e(i=>!i),[]),r=w.useCallback(i=>t?Yl.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function Zge({isFullscreen:t,onClick:e}){return d.jsx("button",{onClick:e,className:vt("h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all",t?"opacity-100":"opacity-0 group-hover/chart:opacity-100"),title:t?"Exit fullscreen":"Fullscreen",children:t?d.jsx(iC,{className:"h-3 w-3"}):d.jsx(rC,{className:"h-3 w-3"})})}function W4(t){return typeof t=="number"&&Number.isFinite(t)}function Qge(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 Uq({metricName:t,data:e,gpuIndices:n,intervalStart:r,intervalEnd:i,variant:s="default",strokeColor:o,gpuDisplayNames:a,isLoading:l,seriesMode:c="gpu",showLegend:f,seriesRoles:h,activeSeriesKeys:m=null,xOffset:x=0,xAxisMode:b="elapsed",xAxisTicks:_="auto",isRefetching:S=!1}){const M=Kn(us),{isFullscreen:T,toggleFullscreen:A,fullscreenPortal:N}=Kge(),D=w.useRef(null),k=w.useRef(null),O=w.useRef(null),[R,L]=w.useState(!1),[B,H]=w.useState(null),[$,G]=w.useState(null),Z=AC[t]||{label:t.replace(/_/g," "),unit:""},V=s==="timeline",W=b==="clock"&&_==="bounds",J=w.useMemo(()=>{if(c==="node_gpu"){const se=new Map,re=[...e].sort((K,fe)=>{const he=W4(K.node_id)?K.node_id:Number.MAX_SAFE_INTEGER,ae=W4(fe.node_id)?fe.node_id:Number.MAX_SAFE_INTEGER;return he!==ae?he-ae:K.gpu_index-fe.gpu_index});for(const K of re){const fe=W4(K.node_id)?K.node_id:null,he=`${fe??"?"}:${K.gpu_index}`;if(se.has(he))continue;const ae=fe===null?"Node ?":`Node ${fe}`,Se=se.size;se.set(he,{key:he,label:`${ae} GPU ${K.gpu_index}`,stroke:o||V4[Se%V4.length],gpuIndex:K.gpu_index,nodeId:fe})}return Array.from(se.values())}return(n.length>0?Array.from(new Set(n)).sort((se,re)=>se-re):Array.from(new Set(e.map(se=>se.gpu_index))).sort((se,re)=>se-re)).map(se=>({key:`gpu:${se}`,label:(a==null?void 0:a[se])??`GPU ${se}`,stroke:o||V4[se%V4.length],gpuIndex:se,nodeId:null}))},[c,e,n,a,o]),ne=w.useMemo(()=>new Set(J.map(Q=>Q.key)),[J]),{uplotData:ie,seriesConfig:z,hasData:j,outlierBounds:X}=w.useMemo(()=>{if(e.length===0||J.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const Q={},se=new Set,re=[];for(const Se of e){const de=c==="node_gpu"?`${W4(Se.node_id)?Se.node_id:"?"}:${Se.gpu_index}`:`gpu:${Se.gpu_index}`;ne.has(de)&&(se.add(Se.timestamp),Q[Se.timestamp]||(Q[Se.timestamp]={}),Q[Se.timestamp][de]=Se.value,re.push(Se.value))}const K=Array.from(se).sort((Se,de)=>Se-de);if(K.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,outlierBounds:null};const fe=K.map(Se=>Se-r),he=[{label:"Time"}],ae=[fe];for(const Se of J){const de=K.map(Ce=>{var Re;return((Re=Q[Ce])==null?void 0:Re[Se.key])??null}),Me=m!==null&&m.size>0&&!m.has(Se.key);ae.push(de),he.push({label:Se.label,stroke:Me?Qge(Se.stroke,.25):Se.stroke,width:Me?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:ae,seriesConfig:he,hasData:!0,outlierBounds:Yge(re)}},[e,r,J,c,ne,m]),F=f??(!V&&J.length>1),ce=w.useCallback(Q=>Math.abs(Q)>=1e3?`${parseFloat((Q/1e3).toFixed(1))}k`:Number.isInteger(Q)?Q.toLocaleString():Math.abs(Q)<.01&&Q!==0?Q.toExponential(1):String(parseFloat(Q.toFixed(2))),[]);w.useEffect(()=>{if(!D.current||!ie||!j)return;const Q=D.current,se=Q.clientWidth,re=200;let K=Number.POSITIVE_INFINITY,fe=Number.NEGATIVE_INFINITY;for(let Ve=1;Ve<ie.length;Ve+=1){const ue=ie[Ve];for(let Y=0;Y<ue.length;Y+=1){const xe=ue[Y];xe!=null&&(R&&X?xe>=X.lower&&xe<=X.upper&&(xe<K&&(K=xe),xe>fe&&(fe=xe)):(xe<K&&(K=xe),xe>fe&&(fe=xe)))}}K===Number.POSITIVE_INFINITY&&X&&(K=X.lower,fe=X.upper);const he=fe-K,ae=Math.max(Math.abs(fe),Math.abs(K)),Se=Math.max(ae*.05,1e-10),de=Math.max(he*.1,Se),Me=[B!==null?B:Math.max(0,K-de),$!==null?$:fe+de],Ce=M?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Re=M?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",He={width:se,height:re,padding:V?[0,0,0,0]:W?[4,24,0,4]:[4,8,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!V,y:!1}},legend:{show:F},...V?{}:{select:{show:!0,left:0,top:0,width:0,height:0}},scales:{x:{time:!1,range:(Ve,ue,Y)=>{const xe=i-r;return xe>0?[0,xe]:[ue,Y]}},y:{range:Me}},axes:V?[{show:!1,size:0},{show:!1,size:0}]:[{stroke:Re,grid:{stroke:Ce,width:1},ticks:{stroke:Ce,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:_==="bounds"?(Ve,ue,Y,xe)=>[Y,xe]:void 0,values:(Ve,ue)=>ue.map(Y=>b==="clock"?b0(r+Number(Y),i-r):wu(Number(Y)+x))},{stroke:Re,grid:{stroke:Ce,width:1},ticks:{stroke:Ce,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(Ve,ue)=>{if(!ue||ue.length===0)return 40;const Y=Math.max(...ue.map(xe=>xe.length));return Math.max(40,Y*7+14)},values:(Ve,ue)=>ue.map(ce)}],series:z,hooks:{setCursor:[Ve=>{if(!O.current||!D.current)return;const{left:ue,idx:Y}=Ve.cursor;if(Y==null||ue===void 0||ue<0){O.current.style.display="none";return}const xe=ie[0][Y];if(xe===void 0){O.current.style.display="none";return}const we=ie[0],Te=(()=>{const ye=Ve.scales.x,$e=Number(ye.min),Ze=Number(ye.max);if(!Number.isFinite($e)||!Number.isFinite(Ze))return null;const ft=Math.abs(Ze-$e);if(ft<=0)return null;const lt=Math.max(1,Ve.bbox.width);return ft*qge/lt})(),ge=$ge(Number(xe)+x),Ue=r+Number(xe),be=b0(Ue,i-r);let ke="";V||(ke+=`<div class="font-medium mb-1">${be}</div>`,ke+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${ge}</div>`,ke+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Ue.toFixed(3)}</div>`);const qe=[];for(let ye=0;ye<J.length;ye+=1){const $e=J[ye],Ze=ie[ye+1],ft=Xge(Ze,we,Y,Te);if(ft===null)continue;const lt=Ze==null?void 0:Ze[ft];lt!=null&&qe.push({entry:$e,formatted:_u(lt),role:(h==null?void 0:h[$e.key])??null})}const Qe=qe.length>0;if(qe.some(ye=>ye.role!==null)&&!V){const ye={Trainer:0,Inference:1},$e=[];for(const Ze of qe){const ft=Ze.role??"Other";$e.includes(ft)||$e.push(ft)}$e.sort((Ze,ft)=>(ye[Ze]??99)-(ye[ft]??99));for(const Ze of $e){ke+=`<div class="text-[10px] font-medium text-muted-foreground mt-1 mb-0.5">${Ze}</div>`;for(const ft of qe)(ft.role??"Other")===Ze&&(ke+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${ft.entry.stroke}"></div>
                      <span class="text-muted-foreground">${ft.entry.label}:</span>
                      <span class="font-medium">${ft.formatted} ${Z.unit}</span>
                    </div>
                  `)}}else for(const ye of qe)V?ke+=`
                    <div class="flex items-center gap-2">
                      <span class="text-muted-foreground">${ye.entry.label}:</span>
                      <span class="font-medium">${ye.formatted} ${Z.unit}</span>
                    </div>
                  `:ke+=`
                    <div class="flex items-center gap-2 mt-0.5">
                      <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${ye.entry.stroke}"></div>
                      <span class="text-muted-foreground">${ye.entry.label}:</span>
                      <span class="font-medium">${ye.formatted} ${Z.unit}</span>
                    </div>
                  `;if(!Qe){O.current.style.display="none";return}V&&(ke+=`<div class="text-muted-foreground mt-1">Time: ${ge}</div>`),O.current.innerHTML=ke,O.current.style.display="block";const st=D.current.getBoundingClientRect(),Pe=O.current.getBoundingClientRect();let Ke=st.left+ue+15;Ke+Pe.width+20>window.innerWidth&&(Ke=st.left+ue-Pe.width-15+Ve.bbox.left),Ke=Math.max(4,Ke);let rt=st.top-Pe.height+20;rt<4&&(rt=st.top+8),O.current.style.left=`${Ke}px`,O.current.style.top=`${rt}px`}]}};k.current&&k.current.destroy();const Le=new ls(He,ie,Q);k.current=Le;const ze=new ResizeObserver(Ve=>{for(const ue of Ve){const{width:Y,height:xe}=ue.contentRect;Le&&Y>0&&xe>0&&Le.setSize({width:Y,height:xe})}});return ze.observe(Q),()=>{ze.disconnect(),Le.destroy(),k.current=null}},[ie,j,z,t,r,i,x,b,_,W,V,Z.unit,F,J,h,ce,R,X,B,$,M,T]);const oe=w.useCallback(()=>{O.current&&(O.current.style.display="none")},[]);return!j&&V?d.jsx("div",{className:"h-[200px] bg-muted/30 rounded-lg border border-border/50 opacity-50 transition-opacity duration-200"}):N(d.jsxs("div",{className:vt("rounded-lg border transition-opacity",V?"overflow-hidden":T?"group/chart fixed inset-0 left-56 z-50 p-6 bg-background flex flex-col":"group/chart border-border p-3 bg-background",!T&&l&&"opacity-60"),children:[!V&&d.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2 shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h4",{className:vt("font-medium truncate",T?"text-sm":"text-xs"),title:t,children:Z.label}),R&&d.jsx(n6,{label:"Ignore Outliers",onRemove:()=>L(!1)}),B!==null&&d.jsx(n6,{label:`Min Y: ${B}`,onRemove:()=>H(null)}),$!==null&&d.jsx(n6,{label:`Max Y: ${$}`,onRemove:()=>G(null)})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:R,onCheckedChange:L,children:"Ignore Outliers"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:Q=>{const se=Q.target.value;H(se===""?null:Number(se))},onClick:Q=>Q.stopPropagation(),onKeyDown:Q=>Q.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:$??"",onChange:Q=>{const se=Q.target.value;G(se===""?null:Number(se))},onClick:Q=>Q.stopPropagation(),onKeyDown:Q=>Q.stopPropagation()})]})]})]}),d.jsx(Zge,{isFullscreen:T,onClick:A})]})]}),j?d.jsxs("div",{className:vt("relative bg-background rounded",T?"flex-1 min-h-0":"h-[200px]"),ref:D,onMouseLeave:oe,children:[!V&&S&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),d.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"}})]}):d.jsx("div",{className:vt("flex items-center justify-center text-muted-foreground text-xs rounded",T?"flex-1 min-h-0":"h-[200px]"),children:l?"Loading...":`No data for ${Z.label}`})]}))}function uL(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 Jge(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const exe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,txe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nxe={};function dL(t,e){return(nxe.jsx?txe:exe).test(t)}const rxe=/[ \t\n\f\r]/g;function ixe(t){return typeof t=="object"?t.type==="text"?fL(t.value):!1:fL(t)}function fL(t){return t.replace(rxe,"")===""}class WS{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}WS.prototype.normal={};WS.prototype.property={};WS.prototype.space=void 0;function Bq(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new WS(n,r,e)}function Gw(t){return t.toLowerCase()}class Wc{constructor(e,n){this.attribute=n,this.property=e}}Wc.prototype.attribute="";Wc.prototype.booleanish=!1;Wc.prototype.boolean=!1;Wc.prototype.commaOrSpaceSeparated=!1;Wc.prototype.commaSeparated=!1;Wc.prototype.defined=!1;Wc.prototype.mustUseProperty=!1;Wc.prototype.number=!1;Wc.prototype.overloadedBoolean=!1;Wc.prototype.property="";Wc.prototype.spaceSeparated=!1;Wc.prototype.space=void 0;let sxe=0;const Fr=Xx(),Zo=Xx(),oR=Xx(),yn=Xx(),gs=Xx(),G1=Xx(),ou=Xx();function Xx(){return 2**++sxe}const aR=Object.freeze(Object.defineProperty({__proto__:null,boolean:Fr,booleanish:Zo,commaOrSpaceSeparated:ou,commaSeparated:G1,number:yn,overloadedBoolean:oR,spaceSeparated:gs},Symbol.toStringTag,{value:"Module"})),r6=Object.keys(aR);class q8 extends Wc{constructor(e,n,r,i){let s=-1;if(super(e,n),hL(this,"space",i),typeof r=="number")for(;++s<r6.length;){const o=r6[s];hL(this,r6[s],(r&aR[o])===aR[o])}}}q8.prototype.defined=!0;function hL(t,e,n){n&&(t[e]=n)}function ib(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new q8(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[Gw(r)]=r,n[Gw(s.attribute)]=r}return new WS(e,n,t.space)}const Hq=ib({properties:{ariaActiveDescendant:null,ariaAtomic:Zo,ariaAutoComplete:null,ariaBusy:Zo,ariaChecked:Zo,ariaColCount:yn,ariaColIndex:yn,ariaColSpan:yn,ariaControls:gs,ariaCurrent:null,ariaDescribedBy:gs,ariaDetails:null,ariaDisabled:Zo,ariaDropEffect:gs,ariaErrorMessage:null,ariaExpanded:Zo,ariaFlowTo:gs,ariaGrabbed:Zo,ariaHasPopup:null,ariaHidden:Zo,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gs,ariaLevel:yn,ariaLive:null,ariaModal:Zo,ariaMultiLine:Zo,ariaMultiSelectable:Zo,ariaOrientation:null,ariaOwns:gs,ariaPlaceholder:null,ariaPosInSet:yn,ariaPressed:Zo,ariaReadOnly:Zo,ariaRelevant:null,ariaRequired:Zo,ariaRoleDescription:gs,ariaRowCount:yn,ariaRowIndex:yn,ariaRowSpan:yn,ariaSelected:Zo,ariaSetSize:yn,ariaSort:null,ariaValueMax:yn,ariaValueMin:yn,ariaValueNow:yn,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Gq(t,e){return e in t?t[e]:e}function Vq(t,e){return Gq(t,e.toLowerCase())}const oxe=ib({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:G1,acceptCharset:gs,accessKey:gs,action:null,allow:null,allowFullScreen:Fr,allowPaymentRequest:Fr,allowUserMedia:Fr,alt:null,as:null,async:Fr,autoCapitalize:null,autoComplete:gs,autoFocus:Fr,autoPlay:Fr,blocking:gs,capture:null,charSet:null,checked:Fr,cite:null,className:gs,cols:yn,colSpan:null,content:null,contentEditable:Zo,controls:Fr,controlsList:gs,coords:yn|G1,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Fr,defer:Fr,dir:null,dirName:null,disabled:Fr,download:oR,draggable:Zo,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Fr,formTarget:null,headers:gs,height:yn,hidden:oR,high:yn,href:null,hrefLang:null,htmlFor:gs,httpEquiv:gs,id:null,imageSizes:null,imageSrcSet:null,inert:Fr,inputMode:null,integrity:null,is:null,isMap:Fr,itemId:null,itemProp:gs,itemRef:gs,itemScope:Fr,itemType:gs,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Fr,low:yn,manifest:null,max:null,maxLength:yn,media:null,method:null,min:null,minLength:yn,multiple:Fr,muted:Fr,name:null,nonce:null,noModule:Fr,noValidate:Fr,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:Fr,optimum:yn,pattern:null,ping:gs,placeholder:null,playsInline:Fr,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Fr,referrerPolicy:null,rel:gs,required:Fr,reversed:Fr,rows:yn,rowSpan:yn,sandbox:gs,scope:null,scoped:Fr,seamless:Fr,selected:Fr,shadowRootClonable:Fr,shadowRootDelegatesFocus:Fr,shadowRootMode:null,shape:null,size:yn,sizes:null,slot:null,span:yn,spellCheck:Zo,src:null,srcDoc:null,srcLang:null,srcSet:null,start:yn,step:null,style:null,tabIndex:yn,target:null,title:null,translate:null,type:null,typeMustMatch:Fr,useMap:null,value:Zo,width:yn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gs,axis:null,background:null,bgColor:null,border:yn,borderColor:null,bottomMargin:yn,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Fr,declare:Fr,event:null,face:null,frame:null,frameBorder:null,hSpace:yn,leftMargin:yn,link:null,longDesc:null,lowSrc:null,marginHeight:yn,marginWidth:yn,noResize:Fr,noHref:Fr,noShade:Fr,noWrap:Fr,object:null,profile:null,prompt:null,rev:null,rightMargin:yn,rules:null,scheme:null,scrolling:Zo,standby:null,summary:null,text:null,topMargin:yn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:yn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Fr,disableRemotePlayback:Fr,prefix:null,property:null,results:yn,security:null,unselectable:null},space:"html",transform:Vq}),axe=ib({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:ou,accentHeight:yn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:yn,amplitude:yn,arabicForm:null,ascent:yn,attributeName:null,attributeType:null,azimuth:yn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:yn,by:null,calcMode:null,capHeight:yn,className:gs,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:yn,diffuseConstant:yn,direction:null,display:null,dur:null,divisor:yn,dominantBaseline:null,download:Fr,dx:null,dy:null,edgeMode:null,editable:null,elevation:yn,enableBackground:null,end:null,event:null,exponent:yn,externalResourcesRequired:null,fill:null,fillOpacity:yn,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:G1,g2:G1,glyphName:G1,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:yn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:yn,horizOriginX:yn,horizOriginY:yn,id:null,ideographic:yn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:yn,k:yn,k1:yn,k2:yn,k3:yn,k4:yn,kernelMatrix:ou,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:yn,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:yn,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:yn,overlineThickness:yn,paintOrder:null,panose1:null,path:null,pathLength:yn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gs,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:yn,pointsAtY:yn,pointsAtZ:yn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ou,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ou,rev:ou,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ou,requiredFeatures:ou,requiredFonts:ou,requiredFormats:ou,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:yn,specularExponent:yn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:yn,strikethroughThickness:yn,string:null,stroke:null,strokeDashArray:ou,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:yn,strokeOpacity:yn,strokeWidth:null,style:null,surfaceScale:yn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ou,tabIndex:yn,tableValues:null,target:null,targetX:yn,targetY:yn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ou,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:yn,underlineThickness:yn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:yn,values:null,vAlphabetic:yn,vMathematical:yn,vectorEffect:null,vHanging:yn,vIdeographic:yn,version:null,vertAdvY:yn,vertOriginX:yn,vertOriginY:yn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:yn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Gq}),Wq=ib({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()}}),$q=ib({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Vq}),qq=ib({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),lxe={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"},cxe=/[A-Z]/g,pL=/-[a-z]/g,uxe=/^data[-\w.:]+$/i;function Xq(t,e){const n=Gw(e);let r=e,i=Wc;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&uxe.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(pL,fxe);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!pL.test(s)){let o=s.replace(cxe,dxe);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=q8}return new i(r,e)}function dxe(t){return"-"+t.toLowerCase()}function fxe(t){return t.charAt(1).toUpperCase()}const Yq=Bq([Hq,oxe,Wq,$q,qq],"html"),NC=Bq([Hq,axe,Wq,$q,qq],"svg");function mL(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function hxe(t){return t.join(" ").trim()}var Zv={},i6,gL;function pxe(){if(gL)return i6;gL=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="/",f="*",h="",m="comment",x="declaration";function b(S,M){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];M=M||{};var T=1,A=1;function N(Z){var V=Z.match(e);V&&(T+=V.length);var W=Z.lastIndexOf(l);A=~W?Z.length-W:A+Z.length}function D(){var Z={line:T,column:A};return function(V){return V.position=new k(Z),L(),V}}function k(Z){this.start=Z,this.end={line:T,column:A},this.source=M.source}k.prototype.content=S;function O(Z){var V=new Error(M.source+":"+T+":"+A+": "+Z);if(V.reason=Z,V.filename=M.source,V.line=T,V.column=A,V.source=S,!M.silent)throw V}function R(Z){var V=Z.exec(S);if(V){var W=V[0];return N(W),S=S.slice(W.length),V}}function L(){R(n)}function B(Z){var V;for(Z=Z||[];V=H();)V!==!1&&Z.push(V);return Z}function H(){var Z=D();if(!(c!=S.charAt(0)||f!=S.charAt(1))){for(var V=2;h!=S.charAt(V)&&(f!=S.charAt(V)||c!=S.charAt(V+1));)++V;if(V+=2,h===S.charAt(V-1))return O("End of comment missing");var W=S.slice(2,V-2);return A+=2,N(W),S=S.slice(V),A+=2,Z({type:m,comment:W})}}function $(){var Z=D(),V=R(r);if(V){if(H(),!R(i))return O("property missing ':'");var W=R(s),J=Z({type:x,property:_(V[0].replace(t,h)),value:W?_(W[0].replace(t,h)):h});return R(o),J}}function G(){var Z=[];B(Z);for(var V;V=$();)V!==!1&&(Z.push(V),B(Z));return Z}return L(),G()}function _(S){return S?S.replace(a,h):h}return i6=b,i6}var xL;function mxe(){if(xL)return Zv;xL=1;var t=Zv&&Zv.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Zv,"__esModule",{value:!0}),Zv.default=n;const e=t(pxe());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:f}=l;a?i(c,f,l):f&&(s=s||{},s[c]=f)}),s}return Zv}var M_={},vL;function gxe(){if(vL)return M_;vL=1,Object.defineProperty(M_,"__esModule",{value:!0}),M_.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,f){return f.toUpperCase()},a=function(c,f){return"".concat(f,"-")},l=function(c,f){return f===void 0&&(f={}),s(c)?c:(c=c.toLowerCase(),f.reactCompat?c=c.replace(i,a):c=c.replace(r,a),c.replace(e,o))};return M_.camelCase=l,M_}var T_,yL;function xxe(){if(yL)return T_;yL=1;var t=T_&&T_.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},e=t(mxe()),n=gxe();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,T_=r,T_}var vxe=xxe();const yxe=Vy(vxe),Kq=Zq("end"),X8=Zq("start");function Zq(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 bxe(t){const e=X8(t),n=Kq(t);if(e&&n)return{start:e,end:n}}function uw(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?bL(t.position):"start"in t||"end"in t?bL(t):"line"in t||"column"in t?lR(t):""}function lR(t){return _L(t&&t.line)+":"+_L(t&&t.column)}function bL(t){return lR(t&&t.start)+"-"+lR(t&&t.end)}function _L(t){return t&&typeof t=="number"?t:1}class Tl 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=uw(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}}Tl.prototype.file="";Tl.prototype.name="";Tl.prototype.reason="";Tl.prototype.message="";Tl.prototype.stack="";Tl.prototype.column=void 0;Tl.prototype.line=void 0;Tl.prototype.ancestors=void 0;Tl.prototype.cause=void 0;Tl.prototype.fatal=void 0;Tl.prototype.place=void 0;Tl.prototype.ruleId=void 0;Tl.prototype.source=void 0;const Y8={}.hasOwnProperty,_xe=new Map,wxe=/[A-Z]/g,Sxe=new Set(["table","tbody","thead","tfoot","tr"]),Mxe=new Set(["td","th"]),Qq="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Txe(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=Ixe(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=Pxe(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"?NC:Yq,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=Jq(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function Jq(t,e,n){if(e.type==="element")return Cxe(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return Exe(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return Nxe(t,e,n);if(e.type==="mdxjsEsm")return Axe(t,e);if(e.type==="root")return kxe(t,e,n);if(e.type==="text")return Rxe(t,e)}function Cxe(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=NC,t.schema=i),t.ancestors.push(e);const s=tX(t,e.tagName,!1),o=Dxe(t,e);let a=Z8(t,e);return Sxe.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!ixe(l):!0})),eX(t,o,s,e),K8(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function Exe(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)}Vw(t,e.position)}function Axe(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Vw(t,e.position)}function Nxe(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=NC,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:tX(t,e.name,!0),o=Oxe(t,e),a=Z8(t,e);return eX(t,o,s,e),K8(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function kxe(t,e,n){const r={};return K8(r,Z8(t,e)),t.create(e,t.Fragment,r,n)}function Rxe(t,e){return e.value}function eX(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function K8(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function Pxe(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 Ixe(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=X8(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 Dxe(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Y8.call(e.properties,i)){const s=Lxe(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Mxe.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 Oxe(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 Vw(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 Vw(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Z8(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:_xe;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=Jq(t,s,o);a!==void 0&&n.push(a)}return n}function Lxe(t,e,n){const r=Xq(t.schema,e);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Jge(n):hxe(n)),r.property==="style"){let i=typeof n=="object"?n:jxe(t,String(n));return t.stylePropertyNameCase==="css"&&(i=zxe(i)),["style",i]}return[t.elementAttributeNameCase==="react"&&r.space?lxe[r.property]||r.property:r.attribute,n]}}function jxe(t,e){try{return yxe(e,{reactCompat:!0})}catch(n){if(t.ignoreInvalidStyle)return{};const r=n,i=new Tl("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=Qq+"#cannot-parse-style-attribute",i}}function tX(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=dL(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=dL(e)&&!/^[a-z]/.test(e)?{type:"Identifier",name:e}:{type:"Literal",value:e};if(r.type==="Literal"){const i=r.value;return Y8.call(t.components,i)?t.components[i]:i}if(t.evaluater)return t.evaluater.evaluateExpression(r);Vw(t)}function Vw(t,e){const n=new Tl("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=Qq+"#cannot-handle-mdx-estrees-without-createevaluater",n}function zxe(t){const e={};let n;for(n in t)Y8.call(t,n)&&(e[Fxe(n)]=t[n]);return e}function Fxe(t){let e=t.replace(wxe,Uxe);return e.slice(0,3)==="ms-"&&(e="-"+e),e}function Uxe(t){return"-"+t.toLowerCase()}const s6={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"]},Bxe={};function Hxe(t,e){const n=Bxe,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return nX(t,r,i)}function nX(t,e,n){if(Gxe(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 wL(t.children,e,n)}return Array.isArray(t)?wL(t,e,n):""}function wL(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=nX(t[i],e,n);return r.join("")}function Gxe(t){return!!(t&&typeof t=="object")}const SL=document.createElement("i");function Q8(t){const e="&"+t+";";SL.innerHTML=e;const n=SL.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function mh(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 od(t,e){return t.length>0?(mh(t,t.length,0,e),t):e}const ML={}.hasOwnProperty;function Vxe(t){const e={};let n=-1;for(;++n<t.length;)Wxe(e,t[n]);return e}function Wxe(t,e){let n;for(n in e){const i=(ML.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){ML.call(i,o)||(i[o]=[]);const a=s[o];$xe(i[o],Array.isArray(a)?a:a?[a]:[])}}}function $xe(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);mh(t,0,0,r)}function rX(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 rh=X0(/[A-Za-z]/),du=X0(/[\dA-Za-z]/),qxe=X0(/[#-'*+\--9=?A-Z^-~]/);function cR(t){return t!==null&&(t<32||t===127)}const uR=X0(/\d/),Xxe=X0(/[\dA-Fa-f]/),Yxe=X0(/[!-/:-@[-`{-~]/);function rr(t){return t!==null&&t<-2}function Hc(t){return t!==null&&(t<0||t===32)}function Oi(t){return t===-2||t===-1||t===32}const Kxe=X0(new RegExp("\\p{P}|\\p{S}","u")),Zxe=X0(/\s/);function X0(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function sb(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";if(s===37&&du(t.charCodeAt(n+1))&&du(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 Gi(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Oi(l)?(t.enter(n),a(l)):e(l)}function a(l){return Oi(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}const Qxe={tokenize:Jxe};function Jxe(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"),Gi(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 rr(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const eve={tokenize:tve},TL={tokenize:nve};function tve(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&&T();const N=e.events.length;let D=N,k;for(;D--;)if(e.events[D][0]==="exit"&&e.events[D][1].type==="chunkFlow"){k=e.events[D][1].end;break}M(r);let O=N;for(;O<e.events.length;)e.events[O][1].end={...k},O++;return mh(e.events,D+1,0,e.events.slice(N)),e.events.length=O,c(A)}return a(A)}function c(A){if(r===n.length){if(!i)return m(A);if(i.currentConstruct&&i.currentConstruct.concrete)return b(A);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(TL,f,h)(A)}function f(A){return i&&T(),M(r),m(A)}function h(A){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,b(A)}function m(A){return e.containerState={},t.attempt(TL,x,b)(A)}function x(A){return r++,n.push([e.currentConstruct,e.containerState]),m(A)}function b(A){if(A===null){i&&T(),M(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){S(t.exit("chunkFlow"),!0),M(0),t.consume(A);return}return rr(A)?(t.consume(A),S(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(A),_)}function S(A,N){const D=e.sliceStream(A);if(N&&D.push(null),A.previous=s,s&&(s.next=A),s=A,i.defineSkip(A.start),i.write(D),e.parser.lazy[A.start.line]){let k=i.events.length;for(;k--;)if(i.events[k][1].start.offset<o&&(!i.events[k][1].end||i.events[k][1].end.offset>o))return;const O=e.events.length;let R=O,L,B;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){if(L){B=e.events[R][1].end;break}L=!0}for(M(r),k=O;k<e.events.length;)e.events[k][1].end={...B},k++;mh(e.events,R+1,0,e.events.slice(O)),e.events.length=k}}function M(A){let N=n.length;for(;N-- >A;){const D=n[N];e.containerState=D[1],D[0].exit.call(e,t)}n.length=A}function T(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function nve(t,e,n){return Gi(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function CL(t){if(t===null||Hc(t)||Zxe(t))return 1;if(Kxe(t))return 2}function J8(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 dR={name:"attention",resolveAll:rve,tokenize:ive};function rve(t,e){let n=-1,r,i,s,o,a,l,c,f;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},m={...t[n][1].start};EL(h,-l),EL(m,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:m},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=od(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=od(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=od(c,J8(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=od(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,c=od(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,mh(t,r-1,n-r+3,c),n=r+c.length-f-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function ive(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=CL(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"),f=CL(l),h=!f||f===2&&i||n.includes(l),m=!i||i===2&&f||n.includes(r);return c._open=!!(s===42?h:h&&(i||!m)),c._close=!!(s===42?m:m&&(f||!h)),e(l)}}function EL(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const sve={name:"autolink",tokenize:ove};function ove(t,e,n){let r=0;return i;function i(x){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(x){return rh(x)?(t.consume(x),o):x===64?n(x):c(x)}function o(x){return x===43||x===45||x===46||du(x)?(r=1,a(x)):c(x)}function a(x){return x===58?(t.consume(x),r=0,l):(x===43||x===45||x===46||du(x))&&r++<32?(t.consume(x),a):(r=0,c(x))}function l(x){return x===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),e):x===null||x===32||x===60||cR(x)?n(x):(t.consume(x),l)}function c(x){return x===64?(t.consume(x),f):qxe(x)?(t.consume(x),c):n(x)}function f(x){return du(x)?h(x):n(x)}function h(x){return x===46?(t.consume(x),r=0,f):x===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(x),t.exit("autolinkMarker"),t.exit("autolink"),e):m(x)}function m(x){if((x===45||du(x))&&r++<63){const b=x===45?m:h;return t.consume(x),b}return n(x)}}const kC={partial:!0,tokenize:ave};function ave(t,e,n){return r;function r(s){return Oi(s)?Gi(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||rr(s)?e(s):n(s)}}const iX={continuation:{tokenize:cve},exit:uve,name:"blockQuote",tokenize:lve};function lve(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 Oi(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function cve(t,e,n){const r=this;return i;function i(o){return Oi(o)?Gi(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(iX,e,n)(o)}}function uve(t){t.exit("blockQuote")}const sX={name:"characterEscape",tokenize:dve};function dve(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 Yxe(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const oX={name:"characterReference",tokenize:fve};function fve(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=du,f(h))}function c(h){return h===88||h===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(h),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=Xxe,f):(t.enter("characterReferenceValue"),s=7,o=uR,f(h))}function f(h){if(h===59&&i){const m=t.exit("characterReferenceValue");return o===du&&!Q8(r.sliceSerialize(m))?n(h):(t.enter("characterReferenceMarker"),t.consume(h),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(h)&&i++<s?(t.consume(h),f):n(h)}}const AL={partial:!0,tokenize:pve},NL={concrete:!0,name:"codeFenced",tokenize:hve};function hve(t,e,n){const r=this,i={partial:!0,tokenize:D};let s=0,o=0,a;return l;function l(k){return c(k)}function c(k){const O=r.events[r.events.length-1];return s=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,a=k,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),f(k)}function f(k){return k===a?(o++,t.consume(k),f):o<3?n(k):(t.exit("codeFencedFenceSequence"),Oi(k)?Gi(t,h,"whitespace")(k):h(k))}function h(k){return k===null||rr(k)?(t.exit("codeFencedFence"),r.interrupt?e(k):t.check(AL,_,N)(k)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||rr(k)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),h(k)):Oi(k)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Gi(t,x,"whitespace")(k)):k===96&&k===a?n(k):(t.consume(k),m)}function x(k){return k===null||rr(k)?h(k):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===null||rr(k)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),h(k)):k===96&&k===a?n(k):(t.consume(k),b)}function _(k){return t.attempt(i,N,S)(k)}function S(k){return t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),M}function M(k){return s>0&&Oi(k)?Gi(t,T,"linePrefix",s+1)(k):T(k)}function T(k){return k===null||rr(k)?t.check(AL,_,N)(k):(t.enter("codeFlowValue"),A(k))}function A(k){return k===null||rr(k)?(t.exit("codeFlowValue"),T(k)):(t.consume(k),A)}function N(k){return t.exit("codeFenced"),e(k)}function D(k,O,R){let L=0;return B;function B(V){return k.enter("lineEnding"),k.consume(V),k.exit("lineEnding"),H}function H(V){return k.enter("codeFencedFence"),Oi(V)?Gi(k,$,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):$(V)}function $(V){return V===a?(k.enter("codeFencedFenceSequence"),G(V)):R(V)}function G(V){return V===a?(L++,k.consume(V),G):L>=o?(k.exit("codeFencedFenceSequence"),Oi(V)?Gi(k,Z,"whitespace")(V):Z(V)):R(V)}function Z(V){return V===null||rr(V)?(k.exit("codeFencedFence"),O(V)):R(V)}}}function pve(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 o6={name:"codeIndented",tokenize:gve},mve={partial:!0,tokenize:xve};function gve(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),Gi(t,s,"linePrefix",5)(c)}function s(c){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):rr(c)?t.attempt(mve,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||rr(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function xve(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):rr(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Gi(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):rr(o)?i(o):n(o)}}const vve={name:"codeText",previous:bve,resolve:yve,tokenize:_ve};function yve(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 bve(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function _ve(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,f(h)):rr(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||rr(h)?(t.exit("codeTextData"),l(h)):(t.consume(h),c)}function f(h){return h===96?(t.consume(h),i++,f):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(h)):(s.type="codeTextData",c(h))}}class wve{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&&C_(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),C_(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),C_(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);C_(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);C_(this.left,n.reverse())}}}function C_(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 aX(t){const e={};let n=-1,r,i,s,o,a,l,c;const f=new wve(t);for(;++n<f.length;){for(;n in e;)n=e[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.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,Sve(f,n)),n=e[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=f.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(f.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={...f.get(i)[1].start},a=f.slice(i,n),a.unshift(r),f.splice(i,n-i+1,a))}}return mh(t,0,Number.POSITIVE_INFINITY,f.slice(0)),!c}function Sve(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 f,h,m=-1,x=n,b=0,_=0;const S=[_];for(;x;){for(;t.get(++i)[1]!==x;);s.push(i),x._tokenizer||(f=r.sliceStream(x),x.next||f.push(null),h&&o.defineSkip(x.start),x._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(f),x._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),h=x,x=x.next}for(x=n;++m<a.length;)a[m][0]==="exit"&&a[m-1][0]==="enter"&&a[m][1].type===a[m-1][1].type&&a[m][1].start.line!==a[m][1].end.line&&(_=m+1,S.push(_),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(o.events=[],x?(x._tokenizer=void 0,x.previous=void 0):S.pop(),m=S.length;m--;){const M=a.slice(S[m],S[m+1]),T=s.pop();l.push([T,T+M.length-1]),t.splice(T,2,M)}for(l.reverse(),m=-1;++m<l.length;)c[b+l[m][0]]=b+l[m][1],b+=l[m][1]-l[m][0]-1;return c}const Mve={resolve:Cve,tokenize:Eve},Tve={partial:!0,tokenize:Ave};function Cve(t){return aX(t),t}function Eve(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):rr(a)?t.check(Tve,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 Ave(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Gi(t,s,"linePrefix")}function s(o){if(o===null||rr(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 lX(t,e,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let f=0;return h;function h(M){return M===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(M),t.exit(s),m):M===null||M===32||M===41||cR(M)?n(M):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),_(M))}function m(M){return M===62?(t.enter(s),t.consume(M),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),x(M))}function x(M){return M===62?(t.exit("chunkString"),t.exit(a),m(M)):M===null||M===60||rr(M)?n(M):(t.consume(M),M===92?b:x)}function b(M){return M===60||M===62||M===92?(t.consume(M),x):x(M)}function _(M){return!f&&(M===null||M===41||Hc(M))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(M)):f<c&&M===40?(t.consume(M),f++,_):M===41?(t.consume(M),f--,_):M===null||M===32||M===40||cR(M)?n(M):(t.consume(M),M===92?S:_)}function S(M){return M===40||M===41||M===92?(t.consume(M),_):_(M)}}function cX(t,e,n,r,i,s){const o=this;let a=0,l;return c;function c(x){return t.enter(r),t.enter(i),t.consume(x),t.exit(i),t.enter(s),f}function f(x){return a>999||x===null||x===91||x===93&&!l||x===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(x):x===93?(t.exit(s),t.enter(i),t.consume(x),t.exit(i),t.exit(r),e):rr(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===null||x===91||x===93||rr(x)||a++>999?(t.exit("chunkString"),f(x)):(t.consume(x),l||(l=!Oi(x)),x===92?m:h)}function m(x){return x===91||x===92||x===93?(t.consume(x),a++,h):h(x)}}function uX(t,e,n,r,i,s){let o;return a;function a(m){return m===34||m===39||m===40?(t.enter(r),t.enter(i),t.consume(m),t.exit(i),o=m===40?41:m,l):n(m)}function l(m){return m===o?(t.enter(i),t.consume(m),t.exit(i),t.exit(r),e):(t.enter(s),c(m))}function c(m){return m===o?(t.exit(s),l(o)):m===null?n(m):rr(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),Gi(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===o||m===null||rr(m)?(t.exit("chunkString"),c(m)):(t.consume(m),m===92?h:f)}function h(m){return m===o||m===92?(t.consume(m),f):f(m)}}function dw(t,e){let n;return r;function r(i){return rr(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Oi(i)?Gi(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const Nve={name:"definition",tokenize:Rve},kve={partial:!0,tokenize:Pve};function Rve(t,e,n){const r=this;let i;return s;function s(x){return t.enter("definition"),o(x)}function o(x){return cX.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function a(x){return i=V1(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),l):n(x)}function l(x){return Hc(x)?dw(t,c)(x):c(x)}function c(x){return lX(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function f(x){return t.attempt(kve,h,h)(x)}function h(x){return Oi(x)?Gi(t,m,"whitespace")(x):m(x)}function m(x){return x===null||rr(x)?(t.exit("definition"),r.parser.defined.push(i),e(x)):n(x)}}function Pve(t,e,n){return r;function r(a){return Hc(a)?dw(t,i)(a):n(a)}function i(a){return uX(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Oi(a)?Gi(t,o,"whitespace")(a):o(a)}function o(a){return a===null||rr(a)?e(a):n(a)}}const Ive={name:"hardBreakEscape",tokenize:Dve};function Dve(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return rr(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const Ove={name:"headingAtx",resolve:Lve,tokenize:jve};function Lve(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"},mh(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function jve(t,e,n){let r=0;return i;function i(f){return t.enter("atxHeading"),s(f)}function s(f){return t.enter("atxHeadingSequence"),o(f)}function o(f){return f===35&&r++<6?(t.consume(f),o):f===null||Hc(f)?(t.exit("atxHeadingSequence"),a(f)):n(f)}function a(f){return f===35?(t.enter("atxHeadingSequence"),l(f)):f===null||rr(f)?(t.exit("atxHeading"),e(f)):Oi(f)?Gi(t,a,"whitespace")(f):(t.enter("atxHeadingText"),c(f))}function l(f){return f===35?(t.consume(f),l):(t.exit("atxHeadingSequence"),a(f))}function c(f){return f===null||f===35||Hc(f)?(t.exit("atxHeadingText"),a(f)):(t.consume(f),c)}}const zve=["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"],kL=["pre","script","style","textarea"],Fve={concrete:!0,name:"htmlFlow",resolveTo:Hve,tokenize:Gve},Uve={partial:!0,tokenize:Wve},Bve={partial:!0,tokenize:Vve};function Hve(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 Gve(t,e,n){const r=this;let i,s,o,a,l;return c;function c(F){return f(F)}function f(F){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(F),h}function h(F){return F===33?(t.consume(F),m):F===47?(t.consume(F),s=!0,_):F===63?(t.consume(F),i=3,r.interrupt?e:z):rh(F)?(t.consume(F),o=String.fromCharCode(F),S):n(F)}function m(F){return F===45?(t.consume(F),i=2,x):F===91?(t.consume(F),i=5,a=0,b):rh(F)?(t.consume(F),i=4,r.interrupt?e:z):n(F)}function x(F){return F===45?(t.consume(F),r.interrupt?e:z):n(F)}function b(F){const ce="CDATA[";return F===ce.charCodeAt(a++)?(t.consume(F),a===ce.length?r.interrupt?e:$:b):n(F)}function _(F){return rh(F)?(t.consume(F),o=String.fromCharCode(F),S):n(F)}function S(F){if(F===null||F===47||F===62||Hc(F)){const ce=F===47,oe=o.toLowerCase();return!ce&&!s&&kL.includes(oe)?(i=1,r.interrupt?e(F):$(F)):zve.includes(o.toLowerCase())?(i=6,ce?(t.consume(F),M):r.interrupt?e(F):$(F)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):s?T(F):A(F))}return F===45||du(F)?(t.consume(F),o+=String.fromCharCode(F),S):n(F)}function M(F){return F===62?(t.consume(F),r.interrupt?e:$):n(F)}function T(F){return Oi(F)?(t.consume(F),T):B(F)}function A(F){return F===47?(t.consume(F),B):F===58||F===95||rh(F)?(t.consume(F),N):Oi(F)?(t.consume(F),A):B(F)}function N(F){return F===45||F===46||F===58||F===95||du(F)?(t.consume(F),N):D(F)}function D(F){return F===61?(t.consume(F),k):Oi(F)?(t.consume(F),D):A(F)}function k(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(t.consume(F),l=F,O):Oi(F)?(t.consume(F),k):R(F)}function O(F){return F===l?(t.consume(F),l=null,L):F===null||rr(F)?n(F):(t.consume(F),O)}function R(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||Hc(F)?D(F):(t.consume(F),R)}function L(F){return F===47||F===62||Oi(F)?A(F):n(F)}function B(F){return F===62?(t.consume(F),H):n(F)}function H(F){return F===null||rr(F)?$(F):Oi(F)?(t.consume(F),H):n(F)}function $(F){return F===45&&i===2?(t.consume(F),W):F===60&&i===1?(t.consume(F),J):F===62&&i===4?(t.consume(F),j):F===63&&i===3?(t.consume(F),z):F===93&&i===5?(t.consume(F),ie):rr(F)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(Uve,X,G)(F)):F===null||rr(F)?(t.exit("htmlFlowData"),G(F)):(t.consume(F),$)}function G(F){return t.check(Bve,Z,X)(F)}function Z(F){return t.enter("lineEnding"),t.consume(F),t.exit("lineEnding"),V}function V(F){return F===null||rr(F)?G(F):(t.enter("htmlFlowData"),$(F))}function W(F){return F===45?(t.consume(F),z):$(F)}function J(F){return F===47?(t.consume(F),o="",ne):$(F)}function ne(F){if(F===62){const ce=o.toLowerCase();return kL.includes(ce)?(t.consume(F),j):$(F)}return rh(F)&&o.length<8?(t.consume(F),o+=String.fromCharCode(F),ne):$(F)}function ie(F){return F===93?(t.consume(F),z):$(F)}function z(F){return F===62?(t.consume(F),j):F===45&&i===2?(t.consume(F),z):$(F)}function j(F){return F===null||rr(F)?(t.exit("htmlFlowData"),X(F)):(t.consume(F),j)}function X(F){return t.exit("htmlFlow"),e(F)}}function Vve(t,e,n){const r=this;return i;function i(o){return rr(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 Wve(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(kC,e,n)}}const $ve={name:"htmlText",tokenize:qve};function qve(t,e,n){const r=this;let i,s,o;return a;function a(z){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(z),l}function l(z){return z===33?(t.consume(z),c):z===47?(t.consume(z),D):z===63?(t.consume(z),A):rh(z)?(t.consume(z),R):n(z)}function c(z){return z===45?(t.consume(z),f):z===91?(t.consume(z),s=0,b):rh(z)?(t.consume(z),T):n(z)}function f(z){return z===45?(t.consume(z),x):n(z)}function h(z){return z===null?n(z):z===45?(t.consume(z),m):rr(z)?(o=h,J(z)):(t.consume(z),h)}function m(z){return z===45?(t.consume(z),x):h(z)}function x(z){return z===62?W(z):z===45?m(z):h(z)}function b(z){const j="CDATA[";return z===j.charCodeAt(s++)?(t.consume(z),s===j.length?_:b):n(z)}function _(z){return z===null?n(z):z===93?(t.consume(z),S):rr(z)?(o=_,J(z)):(t.consume(z),_)}function S(z){return z===93?(t.consume(z),M):_(z)}function M(z){return z===62?W(z):z===93?(t.consume(z),M):_(z)}function T(z){return z===null||z===62?W(z):rr(z)?(o=T,J(z)):(t.consume(z),T)}function A(z){return z===null?n(z):z===63?(t.consume(z),N):rr(z)?(o=A,J(z)):(t.consume(z),A)}function N(z){return z===62?W(z):A(z)}function D(z){return rh(z)?(t.consume(z),k):n(z)}function k(z){return z===45||du(z)?(t.consume(z),k):O(z)}function O(z){return rr(z)?(o=O,J(z)):Oi(z)?(t.consume(z),O):W(z)}function R(z){return z===45||du(z)?(t.consume(z),R):z===47||z===62||Hc(z)?L(z):n(z)}function L(z){return z===47?(t.consume(z),W):z===58||z===95||rh(z)?(t.consume(z),B):rr(z)?(o=L,J(z)):Oi(z)?(t.consume(z),L):W(z)}function B(z){return z===45||z===46||z===58||z===95||du(z)?(t.consume(z),B):H(z)}function H(z){return z===61?(t.consume(z),$):rr(z)?(o=H,J(z)):Oi(z)?(t.consume(z),H):L(z)}function $(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(t.consume(z),i=z,G):rr(z)?(o=$,J(z)):Oi(z)?(t.consume(z),$):(t.consume(z),Z)}function G(z){return z===i?(t.consume(z),i=void 0,V):z===null?n(z):rr(z)?(o=G,J(z)):(t.consume(z),G)}function Z(z){return z===null||z===34||z===39||z===60||z===61||z===96?n(z):z===47||z===62||Hc(z)?L(z):(t.consume(z),Z)}function V(z){return z===47||z===62||Hc(z)?L(z):n(z)}function W(z){return z===62?(t.consume(z),t.exit("htmlTextData"),t.exit("htmlText"),e):n(z)}function J(z){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(z),t.exit("lineEnding"),ne}function ne(z){return Oi(z)?Gi(t,ie,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):ie(z)}function ie(z){return t.enter("htmlTextData"),o(z)}}const eP={name:"labelEnd",resolveAll:Zve,resolveTo:Qve,tokenize:Jve},Xve={tokenize:e1e},Yve={tokenize:t1e},Kve={tokenize:n1e};function Zve(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&&mh(t,0,t.length,n),t}function Qve(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}},f={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",c,e]],a=od(a,t.slice(s+1,s+r+3)),a=od(a,[["enter",f,e]]),a=od(a,J8(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=od(a,[["exit",f,e],t[o-2],t[o-1],["exit",c,e]]),a=od(a,t.slice(o+1)),a=od(a,[["exit",l,e]]),mh(t,s,t.length,a),t}function Jve(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(m){return s?s._inactive?h(m):(o=r.parser.defined.includes(V1(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(m),t.exit("labelMarker"),t.exit("labelEnd"),l):n(m)}function l(m){return m===40?t.attempt(Xve,f,o?f:h)(m):m===91?t.attempt(Yve,f,o?c:h)(m):o?f(m):h(m)}function c(m){return t.attempt(Kve,f,h)(m)}function f(m){return e(m)}function h(m){return s._balanced=!0,n(m)}}function e1e(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 Hc(h)?dw(t,s)(h):s(h)}function s(h){return h===41?f(h):lX(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function o(h){return Hc(h)?dw(t,l)(h):f(h)}function a(h){return n(h)}function l(h){return h===34||h===39||h===40?uX(t,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):f(h)}function c(h){return Hc(h)?dw(t,f)(h):f(h)}function f(h){return h===41?(t.enter("resourceMarker"),t.consume(h),t.exit("resourceMarker"),t.exit("resource"),e):n(h)}}function t1e(t,e,n){const r=this;return i;function i(a){return cX.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 n1e(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 r1e={name:"labelStartImage",resolveAll:eP.resolveAll,tokenize:i1e};function i1e(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 s1e={name:"labelStartLink",resolveAll:eP.resolveAll,tokenize:o1e};function o1e(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 a6={name:"lineEnding",tokenize:a1e};function a1e(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Gi(t,e,"linePrefix")}}const y2={name:"thematicBreak",tokenize:l1e};function l1e(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||rr(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===i?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Oi(c)?Gi(t,a,"whitespace")(c):a(c))}}const Nc={continuation:{tokenize:f1e},exit:p1e,name:"list",tokenize:d1e},c1e={partial:!0,tokenize:m1e},u1e={partial:!0,tokenize:h1e};function d1e(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(x){const b=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:uR(x)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(y2,n,c)(x):c(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(x)}return n(x)}function l(x){return uR(x)&&++o<10?(t.consume(x),l):(!r.interrupt||o<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),c(x)):n(x)}function c(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check(kC,r.interrupt?n:f,t.attempt(c1e,m,h))}function f(x){return r.containerState.initialBlankLine=!0,s++,m(x)}function h(x){return Oi(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),m):n(x)}function m(x){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(x)}}function f1e(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(kC,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Gi(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Oi(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(u1e,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Gi(t,t.attempt(Nc,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function h1e(t,e,n){const r=this;return Gi(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 p1e(t){t.exit(this.containerState.type)}function m1e(t,e,n){const r=this;return Gi(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!Oi(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const RL={name:"setextUnderline",resolveTo:g1e,tokenize:x1e};function g1e(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 x1e(t,e,n){const r=this;let i;return s;function s(c){let f=r.events.length,h;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){h=r.events[f][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"),Oi(c)?Gi(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||rr(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const v1e={tokenize:y1e};function y1e(t){const e=this,n=t.attempt(kC,r,t.attempt(this.parser.constructs.flowInitial,i,Gi(t,t.attempt(this.parser.constructs.flow,i,t.attempt(Mve,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 b1e={resolveAll:fX()},_1e=dX("string"),w1e=dX("text");function dX(t){return{resolveAll:fX(t==="text"?S1e: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(f){return c(f)?s(f):a(f)}function a(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),l}function l(f){return c(f)?(n.exit("data"),s(f)):(n.consume(f),l)}function c(f){if(f===null)return!0;const h=i[f];let m=-1;if(h)for(;++m<h.length;){const x=h[m];if(!x.previous||x.previous.call(r,r.previous))return!0}return!1}}}function fX(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 S1e(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 M1e={42:Nc,43:Nc,45:Nc,48:Nc,49:Nc,50:Nc,51:Nc,52:Nc,53:Nc,54:Nc,55:Nc,56:Nc,57:Nc,62:iX},T1e={91:Nve},C1e={[-2]:o6,[-1]:o6,32:o6},E1e={35:Ove,42:y2,45:[RL,y2],60:Fve,61:RL,95:y2,96:NL,126:NL},A1e={38:oX,92:sX},N1e={[-5]:a6,[-4]:a6,[-3]:a6,33:r1e,38:oX,42:dR,60:[sve,$ve],91:s1e,92:[Ive,sX],93:eP,95:dR,96:vve},k1e={null:[dR,b1e]},R1e={null:[42,95]},P1e={null:[]},I1e=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:R1e,contentInitial:T1e,disable:P1e,document:M1e,flow:E1e,flowInitial:C1e,insideSpan:k1e,string:A1e,text:N1e},Symbol.toStringTag,{value:"Module"}));function D1e(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:O(D),check:O(k),consume:T,enter:A,exit:N,interrupt:O(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:_,events:[],now:b,parser:t,previous:null,sliceSerialize:m,sliceStream:x,write:h};let f=e.tokenize.call(c,l);return e.resolveAll&&s.push(e),c;function h(H){return o=od(o,H),S(),o[o.length-1]!==null?[]:(R(e,0),c.events=J8(s,c.events,c),c.events)}function m(H,$){return L1e(x(H),$)}function x(H){return O1e(o,H)}function b(){const{_bufferIndex:H,_index:$,line:G,column:Z,offset:V}=r;return{_bufferIndex:H,_index:$,line:G,column:Z,offset:V}}function _(H){i[H.line]=H.column,B()}function S(){let H;for(;r._index<o.length;){const $=o[r._index];if(typeof $=="string")for(H=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===H&&r._bufferIndex<$.length;)M($.charCodeAt(r._bufferIndex));else M($)}}function M(H){f=f(H)}function T(H){rr(H)?(r.line++,r.column=1,r.offset+=H===-3?2:1,B()):H!==-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=H}function A(H,$){const G=$||{};return G.type=H,G.start=b(),c.events.push(["enter",G,c]),a.push(G),G}function N(H){const $=a.pop();return $.end=b(),c.events.push(["exit",$,c]),$}function D(H,$){R(H,$.from)}function k(H,$){$.restore()}function O(H,$){return G;function G(Z,V,W){let J,ne,ie,z;return Array.isArray(Z)?X(Z):"tokenize"in Z?X([Z]):j(Z);function j(Q){return se;function se(re){const K=re!==null&&Q[re],fe=re!==null&&Q.null,he=[...Array.isArray(K)?K:K?[K]:[],...Array.isArray(fe)?fe:fe?[fe]:[]];return X(he)(re)}}function X(Q){return J=Q,ne=0,Q.length===0?W:F(Q[ne])}function F(Q){return se;function se(re){return z=L(),ie=Q,Q.partial||(c.currentConstruct=Q),Q.name&&c.parser.constructs.disable.null.includes(Q.name)?oe():Q.tokenize.call($?Object.assign(Object.create(c),$):c,l,ce,oe)(re)}}function ce(Q){return H(ie,z),V}function oe(Q){return z.restore(),++ne<J.length?F(J[ne]):W}}}function R(H,$){H.resolveAll&&!s.includes(H)&&s.push(H),H.resolve&&mh(c.events,$,c.events.length-$,H.resolve(c.events.slice($),c)),H.resolveTo&&(c.events=H.resolveTo(c.events,c))}function L(){const H=b(),$=c.previous,G=c.currentConstruct,Z=c.events.length,V=Array.from(a);return{from:Z,restore:W};function W(){r=H,c.previous=$,c.currentConstruct=G,c.events.length=Z,a=V,B()}}function B(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function O1e(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 L1e(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 j1e(t){const r={constructs:Vxe([I1e,...(t||{}).extensions||[]]),content:i(Qxe),defined:[],document:i(eve),flow:i(v1e),lazy:{},string:i(_1e),text:i(w1e)};return r;function i(s){return o;function o(a){return D1e(r,s,a)}}}function z1e(t){for(;!aX(t););return t}const PL=/[\0\t\n\r]/g;function F1e(){let t=1,e="",n=!0,r;return i;function i(s,o,a){const l=[];let c,f,h,m,x;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(PL.lastIndex=h,c=PL.exec(s),m=c&&c.index!==void 0?c.index:s.length,x=s.charCodeAt(m),!c){e=s.slice(h);break}if(x===10&&h===m&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),h<m&&(l.push(s.slice(h,m)),t+=m-h),x){case 0:{l.push(65533),t++;break}case 9:{for(f=Math.ceil(t/4)*4,l.push(-2);t++<f;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}h=m+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const U1e=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function B1e(t){return t.replace(U1e,H1e)}function H1e(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return rX(n.slice(s?2:1),s?16:10)}return Q8(n)||t}const hX={}.hasOwnProperty;function G1e(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),V1e(n)(z1e(j1e(n).document().write(F1e()(t,e,!0))))}function V1e(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(He),autolinkProtocol:L,autolinkEmail:L,atxHeading:s(Me),blockQuote:s(fe),characterEscape:L,characterReference:L,codeFenced:s(he),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(he,o),codeText:s(ae,o),codeTextData:L,data:L,codeFlowValue:L,definition:s(Se),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(de),hardBreakEscape:s(Ce),hardBreakTrailing:s(Ce),htmlFlow:s(Re,o),htmlFlowData:L,htmlText:s(Re,o),htmlTextData:L,image:s(le),label:o,link:s(He),listItem:s(ze),listItemValue:m,listOrdered:s(Le,h),listUnordered:s(Le),paragraph:s(Ve),reference:F,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Me),strong:s(ue),thematicBreak:s(xe)},exit:{atxHeading:l(),atxHeadingSequence:D,autolink:l(),autolinkEmail:K,autolinkProtocol:re,blockQuote:l(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:oe,characterReferenceMarkerNumeric:oe,characterReferenceValue:Q,characterReference:se,codeFenced:l(S),codeFencedFence:_,codeFencedFenceInfo:x,codeFencedFenceMeta:b,codeFlowValue:B,codeIndented:l(M),codeText:l(V),codeTextData:B,data:B,definition:l(),definitionDestinationString:N,definitionLabelString:T,definitionTitleString:A,emphasis:l(),hardBreakEscape:l($),hardBreakTrailing:l($),htmlFlow:l(G),htmlFlowData:B,htmlText:l(Z),htmlTextData:B,image:l(J),label:ie,labelText:ne,lineEnding:H,link:l(W),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:ce,resourceDestinationString:z,resourceTitleString:j,resource:X,setextHeading:l(R),setextHeadingLineSequence:O,setextHeadingText:k,strong:l(),thematicBreak:l()}};pX(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(we){let Te={type:"root",children:[]};const ge={stack:[Te],tokenStack:[],config:e,enter:a,exit:c,buffer:o,resume:f,data:n},Ue=[];let be=-1;for(;++be<we.length;)if(we[be][1].type==="listOrdered"||we[be][1].type==="listUnordered")if(we[be][0]==="enter")Ue.push(be);else{const ke=Ue.pop();be=i(we,ke,be)}for(be=-1;++be<we.length;){const ke=e[we[be][0]];hX.call(ke,we[be][1].type)&&ke[we[be][1].type].call(Object.assign({sliceSerialize:we[be][2].sliceSerialize},ge),we[be][1])}if(ge.tokenStack.length>0){const ke=ge.tokenStack[ge.tokenStack.length-1];(ke[1]||IL).call(ge,void 0,ke[0])}for(Te.position={start:Im(we.length>0?we[0][1].start:{line:1,column:1,offset:0}),end:Im(we.length>0?we[we.length-2][1].end:{line:1,column:1,offset:0})},be=-1;++be<e.transforms.length;)Te=e.transforms[be](Te)||Te;return Te}function i(we,Te,ge){let Ue=Te-1,be=-1,ke=!1,qe,Qe,nt,st;for(;++Ue<=ge;){const Pe=we[Ue];switch(Pe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Pe[0]==="enter"?be++:be--,st=void 0;break}case"lineEndingBlank":{Pe[0]==="enter"&&(qe&&!st&&!be&&!nt&&(nt=Ue),st=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:st=void 0}if(!be&&Pe[0]==="enter"&&Pe[1].type==="listItemPrefix"||be===-1&&Pe[0]==="exit"&&(Pe[1].type==="listUnordered"||Pe[1].type==="listOrdered")){if(qe){let Ke=Ue;for(Qe=void 0;Ke--;){const rt=we[Ke];if(rt[1].type==="lineEnding"||rt[1].type==="lineEndingBlank"){if(rt[0]==="exit")continue;Qe&&(we[Qe][1].type="lineEndingBlank",ke=!0),rt[1].type="lineEnding",Qe=Ke}else if(!(rt[1].type==="linePrefix"||rt[1].type==="blockQuotePrefix"||rt[1].type==="blockQuotePrefixWhitespace"||rt[1].type==="blockQuoteMarker"||rt[1].type==="listItemIndent"))break}nt&&(!Qe||nt<Qe)&&(qe._spread=!0),qe.end=Object.assign({},Qe?we[Qe][1].start:Pe[1].end),we.splice(Qe||Ue,0,["exit",qe,Pe[2]]),Ue++,ge++}if(Pe[1].type==="listItemPrefix"){const Ke={type:"listItem",_spread:!1,start:Object.assign({},Pe[1].start),end:void 0};qe=Ke,we.splice(Ue,0,["enter",Ke,Pe[2]]),Ue++,ge++,nt=void 0,st=!0}}}return we[Te][1]._spread=ke,ge}function s(we,Te){return ge;function ge(Ue){a.call(this,we(Ue),Ue),Te&&Te.call(this,Ue)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(we,Te,ge){this.stack[this.stack.length-1].children.push(we),this.stack.push(we),this.tokenStack.push([Te,ge||void 0]),we.position={start:Im(Te.start),end:void 0}}function l(we){return Te;function Te(ge){we&&we.call(this,ge),c.call(this,ge)}}function c(we,Te){const ge=this.stack.pop(),Ue=this.tokenStack.pop();if(Ue)Ue[0].type!==we.type&&(Te?Te.call(this,we,Ue[0]):(Ue[1]||IL).call(this,we,Ue[0]));else throw new Error("Cannot close `"+we.type+"` ("+uw({start:we.start,end:we.end})+"): it’s not open");ge.position.end=Im(we.end)}function f(){return Hxe(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function m(we){if(this.data.expectingFirstListItemValue){const Te=this.stack[this.stack.length-2];Te.start=Number.parseInt(this.sliceSerialize(we),10),this.data.expectingFirstListItemValue=void 0}}function x(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.lang=we}function b(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.meta=we}function _(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.value=we.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.value=we.replace(/(\r?\n|\r)$/g,"")}function T(we){const Te=this.resume(),ge=this.stack[this.stack.length-1];ge.label=Te,ge.identifier=V1(this.sliceSerialize(we)).toLowerCase()}function A(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.title=we}function N(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.url=we}function D(we){const Te=this.stack[this.stack.length-1];if(!Te.depth){const ge=this.sliceSerialize(we).length;Te.depth=ge}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function O(we){const Te=this.stack[this.stack.length-1];Te.depth=this.sliceSerialize(we).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function L(we){const ge=this.stack[this.stack.length-1].children;let Ue=ge[ge.length-1];(!Ue||Ue.type!=="text")&&(Ue=Y(),Ue.position={start:Im(we.start),end:void 0},ge.push(Ue)),this.stack.push(Ue)}function B(we){const Te=this.stack.pop();Te.value+=this.sliceSerialize(we),Te.position.end=Im(we.end)}function H(we){const Te=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ge=Te.children[Te.children.length-1];ge.position.end=Im(we.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(Te.type)&&(L.call(this,we),B.call(this,we))}function $(){this.data.atHardBreak=!0}function G(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.value=we}function Z(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.value=we}function V(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.value=we}function W(){const we=this.stack[this.stack.length-1];if(this.data.inReference){const Te=this.data.referenceType||"shortcut";we.type+="Reference",we.referenceType=Te,delete we.url,delete we.title}else delete we.identifier,delete we.label;this.data.referenceType=void 0}function J(){const we=this.stack[this.stack.length-1];if(this.data.inReference){const Te=this.data.referenceType||"shortcut";we.type+="Reference",we.referenceType=Te,delete we.url,delete we.title}else delete we.identifier,delete we.label;this.data.referenceType=void 0}function ne(we){const Te=this.sliceSerialize(we),ge=this.stack[this.stack.length-2];ge.label=B1e(Te),ge.identifier=V1(Te).toLowerCase()}function ie(){const we=this.stack[this.stack.length-1],Te=this.resume(),ge=this.stack[this.stack.length-1];if(this.data.inReference=!0,ge.type==="link"){const Ue=we.children;ge.children=Ue}else ge.alt=Te}function z(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.url=we}function j(){const we=this.resume(),Te=this.stack[this.stack.length-1];Te.title=we}function X(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function ce(we){const Te=this.resume(),ge=this.stack[this.stack.length-1];ge.label=Te,ge.identifier=V1(this.sliceSerialize(we)).toLowerCase(),this.data.referenceType="full"}function oe(we){this.data.characterReferenceType=we.type}function Q(we){const Te=this.sliceSerialize(we),ge=this.data.characterReferenceType;let Ue;ge?(Ue=rX(Te,ge==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ue=Q8(Te);const be=this.stack[this.stack.length-1];be.value+=Ue}function se(we){const Te=this.stack.pop();Te.position.end=Im(we.end)}function re(we){B.call(this,we);const Te=this.stack[this.stack.length-1];Te.url=this.sliceSerialize(we)}function K(we){B.call(this,we);const Te=this.stack[this.stack.length-1];Te.url="mailto:"+this.sliceSerialize(we)}function fe(){return{type:"blockquote",children:[]}}function he(){return{type:"code",lang:null,meta:null,value:""}}function ae(){return{type:"inlineCode",value:""}}function Se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function de(){return{type:"emphasis",children:[]}}function Me(){return{type:"heading",depth:0,children:[]}}function Ce(){return{type:"break"}}function Re(){return{type:"html",value:""}}function le(){return{type:"image",title:null,url:"",alt:null}}function He(){return{type:"link",title:null,url:"",children:[]}}function Le(we){return{type:"list",ordered:we.type==="listOrdered",start:null,spread:we._spread,children:[]}}function ze(we){return{type:"listItem",spread:we._spread,checked:null,children:[]}}function Ve(){return{type:"paragraph",children:[]}}function ue(){return{type:"strong",children:[]}}function Y(){return{type:"text",value:""}}function xe(){return{type:"thematicBreak"}}}function Im(t){return{line:t.line,column:t.column,offset:t.offset}}function pX(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?pX(t,r):W1e(t,r)}}function W1e(t,e){let n;for(n in e)if(hX.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 IL(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+uw({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+uw({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+uw({start:e.start,end:e.end})+") is still open")}function $1e(t){const e=this;e.parser=n;function n(r){return G1e(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function q1e(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 X1e(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
`}]}function Y1e(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 K1e(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Z1e(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Q1e(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=sb(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 J1e(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 eye(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function mX(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 tye(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return mX(t,e);const i={src:sb(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 nye(t,e){const n={src:sb(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 rye(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 iye(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return mX(t,e);const i={href:sb(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 sye(t,e){const n={href:sb(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 oye(t,e,n){const r=t.all(e),i=n?aye(n):gX(e),s={},o=[];if(typeof e.checked=="boolean"){const f=r[0];let h;f&&f.type==="element"&&f.tagName==="p"?h=f:(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 f=r[a];(i||a!==0||f.type!=="element"||f.tagName!=="p")&&o.push({type:"text",value:`
`}),f.type==="element"&&f.tagName==="p"&&!i?o.push(...f.children):o.push(f)}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 aye(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=gX(n[r])}return e}function gX(t){const e=t.spread;return e??t.children.length>1}function lye(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 cye(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function uye(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function dye(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function fye(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=X8(e.children[1]),l=Kq(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 hye(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],m={},x=o?o[l]:void 0;x&&(m.align=x);let b={type:"element",tagName:s,properties:m,children:[]};h&&(b.children=t.all(h),t.patch(h,b),b=t.applyData(h,b)),c.push(b)}const f={type:"element",tagName:"tr",properties:{},children:t.wrap(c,!0)};return t.patch(e,f),t.applyData(e,f)}function pye(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const DL=9,OL=32;function mye(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(LL(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(LL(e.slice(i),i>0,!1)),s.join("")}function LL(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===DL||s===OL;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===DL||s===OL;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function gye(t,e){const n={type:"text",value:mye(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function xye(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const vye={blockquote:q1e,break:X1e,code:Y1e,delete:K1e,emphasis:Z1e,footnoteReference:Q1e,heading:J1e,html:eye,imageReference:tye,image:nye,inlineCode:rye,linkReference:iye,link:sye,listItem:oye,list:lye,paragraph:cye,root:uye,strong:dye,table:fye,tableCell:pye,tableRow:hye,text:gye,thematicBreak:xye,toml:$4,yaml:$4,definition:$4,footnoteDefinition:$4};function $4(){}const xX=-1,RC=0,fw=1,h5=2,tP=3,nP=4,rP=5,iP=6,vX=7,yX=8,jL=typeof self=="object"?self:globalThis,yye=(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 RC:case xX:return n(o,i);case fw:{const a=n([],i);for(const l of o)a.push(r(l));return a}case h5:{const a=n({},i);for(const[l,c]of o)a[r(l)]=r(c);return a}case tP:return n(new Date(o),i);case nP:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case rP:{const a=n(new Map,i);for(const[l,c]of o)a.set(r(l),r(c));return a}case iP:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case vX:{const{name:a,message:l}=o;return n(new jL[a](l),i)}case yX: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 jL[s](o),i)};return r},zL=t=>yye(new Map,t)(0),Qv="",{toString:bye}={},{keys:_ye}=Object,E_=t=>{const e=typeof t;if(e!=="object"||!t)return[RC,e];const n=bye.call(t).slice(8,-1);switch(n){case"Array":return[fw,Qv];case"Object":return[h5,Qv];case"Date":return[tP,Qv];case"RegExp":return[nP,Qv];case"Map":return[rP,Qv];case"Set":return[iP,Qv];case"DataView":return[fw,n]}return n.includes("Array")?[fw,n]:n.includes("Error")?[vX,n]:[h5,n]},q4=([t,e])=>t===RC&&(e==="function"||e==="symbol"),wye=(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]=E_(o);switch(a){case RC:{let f=o;switch(l){case"bigint":a=yX,f=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);f=null;break;case"undefined":return i([xX],o)}return i([a,f],o)}case fw:{if(l){let m=o;return l==="DataView"?m=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(m=new Uint8Array(o)),i([l,[...m]],o)}const f=[],h=i([a,f],o);for(const m of o)f.push(s(m));return h}case h5:{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 f=[],h=i([a,f],o);for(const m of _ye(o))(t||!q4(E_(o[m])))&&f.push([s(m),s(o[m])]);return h}case tP:return i([a,o.toISOString()],o);case nP:{const{source:f,flags:h}=o;return i([a,{source:f,flags:h}],o)}case rP:{const f=[],h=i([a,f],o);for(const[m,x]of o)(t||!(q4(E_(m))||q4(E_(x))))&&f.push([s(m),s(x)]);return h}case iP:{const f=[],h=i([a,f],o);for(const m of o)(t||!q4(E_(m)))&&f.push(s(m));return h}}const{message:c}=o;return i([a,{name:l,message:c}],o)};return s},FL=(t,{json:e,lossy:n}={})=>{const r=[];return wye(!(e||n),!!e,new Map,r)(t),r},p5=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?zL(FL(t,e)):structuredClone(t):(t,e)=>zL(FL(t,e));function Sye(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 Mye(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Tye(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Sye,r=t.options.footnoteBackLabel||Mye,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 f=t.all(c),h=String(c.identifier).toUpperCase(),m=sb(h.toLowerCase());let x=0;const b=[],_=t.footnoteCounts.get(h);for(;_!==void 0&&++x<=_;){b.length>0&&b.push({type:"text",value:" "});let T=typeof n=="string"?n:n(l,x);typeof T=="string"&&(T={type:"text",value:T}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+m+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,x),className:["data-footnote-backref"]},children:Array.isArray(T)?T:[T]})}const S=f[f.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const T=S.children[S.children.length-1];T&&T.type==="text"?T.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...b)}else f.push(...b);const M={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:t.wrap(f,!0)};t.patch(c,M),a.push(M)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...p5(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 sP=(function(t){if(t==null)return Nye;if(typeof t=="function")return PC(t);if(typeof t=="object")return Array.isArray(t)?Cye(t):Eye(t);if(typeof t=="string")return Aye(t);throw new Error("Expected function, string, or object as test")});function Cye(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=sP(t[n]);return PC(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function Eye(t){const e=t;return PC(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function Aye(t){return PC(e);function e(n){return n&&n.type===t}}function PC(t){return e;function e(n,r,i){return!!(kye(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Nye(){return!0}function kye(t){return t!==null&&typeof t=="object"&&"type"in t}const bX=[],Rye=!0,UL=!1,_X="skip";function wX(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=sP(i),o=r?-1:1;a(t,void 0,[])();function a(l,c,f){const h=l&&typeof l=="object"?l:{};if(typeof h.type=="string"){const x=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(m,"name",{value:"node ("+(l.type+(x?"<"+x+">":""))+")"})}return m;function m(){let x=bX,b,_,S;if((!e||s(l,c,f[f.length-1]||void 0))&&(x=Pye(n(l,f)),x[0]===UL))return x;if("children"in l&&l.children){const M=l;if(M.children&&x[0]!==_X)for(_=(r?M.children.length:-1)+o,S=f.concat(M);_>-1&&_<M.children.length;){const T=M.children[_];if(b=a(T,_,S)(),b[0]===UL)return b;_=typeof b[1]=="number"?b[1]:_+o}}return x}}}function Pye(t){return Array.isArray(t)?t:typeof t=="number"?[Rye,t]:t==null?bX:[t]}function SX(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),wX(t,s,a,i);function a(l,c){const f=c[c.length-1],h=f?f.children.indexOf(l):void 0;return o(l,h,f)}}const fR={}.hasOwnProperty,Iye={};function Dye(t,e){const n=e||Iye,r=new Map,i=new Map,s=new Map,o={...vye,...n.handlers},a={all:c,applyData:Lye,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:Oye,wrap:zye};return SX(t,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const h=f.type==="definition"?r:i,m=String(f.identifier).toUpperCase();h.has(m)||h.set(m,f)}}),a;function l(f,h){const m=f.type,x=a.handlers[m];if(fR.call(a.handlers,m)&&x)return x(a,f,h);if(a.options.passThrough&&a.options.passThrough.includes(m)){if("children"in f){const{children:_,...S}=f,M=p5(S);return M.children=a.all(f),M}return p5(f)}return(a.options.unknownHandler||jye)(a,f,h)}function c(f){const h=[];if("children"in f){const m=f.children;let x=-1;for(;++x<m.length;){const b=a.one(m[x],f);if(b){if(x&&m[x-1].type==="break"&&(!Array.isArray(b)&&b.type==="text"&&(b.value=BL(b.value)),!Array.isArray(b)&&b.type==="element")){const _=b.children[0];_&&_.type==="text"&&(_.value=BL(_.value))}Array.isArray(b)?h.push(...b):h.push(b)}}}return h}}function Oye(t,e){t.position&&(e.position=bxe(t))}function Lye(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,p5(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function jye(t,e){const n=e.data||{},r="value"in e&&!(fR.call(n,"hProperties")||fR.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 zye(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 BL(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function HL(t,e){const n=Dye(t,e),r=n.one(t,void 0),i=Tye(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
`},i),s}function Fye(t,e){return t&&"run"in t?async function(n,r){const i=HL(n,{file:r,...e});await t.run(i,r)}:function(n,r){return HL(n,{file:r,...t||e})}}function GL(t){if(t)throw t}var l6,VL;function Uye(){if(VL)return l6;VL=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 f=t.call(c,"constructor"),h=c.constructor&&c.constructor.prototype&&t.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!f&&!h)return!1;var m;for(m in c);return typeof m>"u"||t.call(c,m)},o=function(c,f){n&&f.name==="__proto__"?n(c,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):c[f.name]=f.newValue},a=function(c,f){if(f==="__proto__")if(t.call(c,f)){if(r)return r(c,f).value}else return;return c[f]};return l6=function l(){var c,f,h,m,x,b,_=arguments[0],S=1,M=arguments.length,T=!1;for(typeof _=="boolean"&&(T=_,_=arguments[1]||{},S=2),(_==null||typeof _!="object"&&typeof _!="function")&&(_={});S<M;++S)if(c=arguments[S],c!=null)for(f in c)h=a(_,f),m=a(c,f),_!==m&&(T&&m&&(s(m)||(x=i(m)))?(x?(x=!1,b=h&&i(h)?h:[]):b=h&&s(h)?h:{},o(_,{name:f,newValue:l(T,b,m)})):typeof m<"u"&&o(_,{name:f,newValue:m}));return _},l6}var Bye=Uye();const c6=Vy(Bye);function hR(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 Hye(){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 f=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,f?Gye(f,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 Gye(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 f=c;if(a&&n)throw f;return i(f)}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 Kf={basename:Vye,dirname:Wye,extname:$ye,join:qye,sep:"/"};function Vye(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');$S(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 Wye(t){if($S(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 $ye(t){$S(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 qye(...t){let e=-1,n;for(;++e<t.length;)$S(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":Xye(n)}function Xye(t){$S(t);const e=t.codePointAt(0)===47;let n=Yye(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Yye(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 $S(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Kye={cwd:Zye};function Zye(){return"/"}function pR(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Qye(t){if(typeof t=="string")t=new URL(t);else if(!pR(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 Jye(t)}function Jye(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 u6=["history","path","basename","stem","extname","dirname"];class MX{constructor(e){let n;e?pR(e)?n={path:e}:typeof e=="string"||ebe(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":Kye.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<u6.length;){const s=u6[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)u6.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?Kf.basename(this.path):void 0}set basename(e){f6(e,"basename"),d6(e,"basename"),this.path=Kf.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?Kf.dirname(this.path):void 0}set dirname(e){WL(this.basename,"dirname"),this.path=Kf.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?Kf.extname(this.path):void 0}set extname(e){if(d6(e,"extname"),WL(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=Kf.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){pR(e)&&(e=Qye(e)),f6(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?Kf.basename(this.path,this.extname):void 0}set stem(e){f6(e,"stem"),d6(e,"stem"),this.path=Kf.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 Tl(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 d6(t,e){if(t&&t.includes(Kf.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+Kf.sep+"`")}function f6(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function WL(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function ebe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const tbe=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),nbe={}.hasOwnProperty;class oP extends tbe{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=Hye()}copy(){const e=new oP;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(c6(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(m6("data",this.frozen),this.namespace[e]=n,this):nbe.call(this.namespace,e)&&this.namespace[e]||void 0:e?(m6("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=X4(e),r=this.parser||this.Parser;return h6("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),h6("process",this.parser||this.Parser),p6("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=X4(e),l=r.parse(a);r.run(l,a,function(f,h,m){if(f||!h||!m)return c(f);const x=h,b=r.stringify(x,m);sbe(b)?m.value=b:m.result=b,c(f,m)});function c(f,h){f||!h?o(f):s?s(h):n(void 0,h)}}}processSync(e){let n=!1,r;return this.freeze(),h6("processSync",this.parser||this.Parser),p6("processSync",this.compiler||this.Compiler),this.process(e,i),qL("processSync","process",n),r;function i(s,o){n=!0,GL(s),r=o}}run(e,n,r){$L(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=X4(n);i.run(e,l,c);function c(f,h,m){const x=h||e;f?a(f):o?o(x):r(void 0,x,m)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),qL("runSync","run",r),i;function s(o,a){GL(o),i=a,r=!0}}stringify(e,n){this.freeze();const r=X4(n),i=this.compiler||this.Compiler;return p6("stringify",i),$L(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(m6("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[f,...h]=c;l(f,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=c6(!0,i.settings,c.settings))}function a(c){let f=-1;if(c!=null)if(Array.isArray(c))for(;++f<c.length;){const h=c[f];s(h)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,f){let h=-1,m=-1;for(;++h<r.length;)if(r[h][0]===c){m=h;break}if(m===-1)r.push([c,...f]);else if(f.length>0){let[x,...b]=f;const _=r[m][1];hR(_)&&hR(x)&&(x=c6(!0,_,x)),r[m]=[c,x,...b]}}}}const rbe=new oP().freeze();function h6(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function p6(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function m6(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 $L(t){if(!hR(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function qL(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function X4(t){return ibe(t)?t:new MX(t)}function ibe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function sbe(t){return typeof t=="string"||obe(t)}function obe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const abe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",XL=[],YL={allowDangerousHtml:!0},lbe=/^(https?|ircs?|mailto|xmpp)$/i,cbe=[{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 ube(t){const e=dbe(t),n=fbe(t);return hbe(e.runSync(e.parse(n),n),t)}function dbe(t){const e=t.rehypePlugins||XL,n=t.remarkPlugins||XL,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...YL}:YL;return rbe().use($1e).use(n).use(Fye,r).use(e)}function fbe(t){const e=t.children||"",n=new MX;return typeof e=="string"&&(n.value=e),n}function hbe(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||pbe;for(const f of cbe)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+abe+f.id,void 0);return SX(t,c),Txe(t,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(f,h,m){if(f.type==="raw"&&m&&typeof h=="number")return o?m.children.splice(h,1):m.children[h]={type:"text",value:f.value},h;if(f.type==="element"){let x;for(x in s6)if(Object.hasOwn(s6,x)&&Object.hasOwn(f.properties,x)){const b=f.properties[x],_=s6[x];(_===null||_.includes(f.tagName))&&(f.properties[x]=l(String(b||""),x,f))}}if(f.type==="element"){let x=n?!n.includes(f.tagName):s?s.includes(f.tagName):!1;if(!x&&r&&typeof h=="number"&&(x=!r(f,h,m)),x&&m&&typeof h=="number")return a&&f.children?m.children.splice(h,1,...f.children):m.children.splice(h,1),h}}}function pbe(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||lbe.test(t.slice(0,e))?t:""}function mbe(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 gbe(){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,""),f=this.stack[this.stack.length-1];f.type,this.exit(l),f.value=c;const h=f.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(),f=this.stack[this.stack.length-1];f.type,this.exit(l),f.value=c,f.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 xbe(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||"",f=a.createTracker(l),h="$".repeat(Math.max(mbe(c,"$")+1,2)),m=a.enter("mathFlow");let x=f.move(h);if(s.meta){const b=a.enter("mathFlowMeta");x+=f.move(a.safe(s.meta,{after:`
`,before:x,encode:["$"],...f.current()})),b()}return x+=f.move(`
`),c&&(x+=f.move(c+`
`)),x+=f.move(h),m(),x}function r(s,o,a){let l=s.value||"",c=1;for(e||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const f="$".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 m=a.unsafe[h];if(!m.atBreak)continue;const x=a.compilePattern(m);let b;for(;b=x.exec(l);){let _=b.index;l.codePointAt(_)===10&&l.codePointAt(_-1)===13&&_--,l=l.slice(0,_)+" "+l.slice(b.index+1)}}return f+l+f}function i(){return"$"}}const vbe={tokenize:ybe,concrete:!0,name:"mathFlow"},KL={tokenize:bbe,partial:!0};function ybe(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(T){return t.enter("mathFlow"),t.enter("mathFlowFence"),t.enter("mathFlowFenceSequence"),l(T)}function l(T){return T===36?(t.consume(T),o++,l):o<2?n(T):(t.exit("mathFlowFenceSequence"),Gi(t,c,"whitespace")(T))}function c(T){return T===null||rr(T)?h(T):(t.enter("mathFlowFenceMeta"),t.enter("chunkString",{contentType:"string"}),f(T))}function f(T){return T===null||rr(T)?(t.exit("chunkString"),t.exit("mathFlowFenceMeta"),h(T)):T===36?n(T):(t.consume(T),f)}function h(T){return t.exit("mathFlowFence"),r.interrupt?e(T):t.attempt(KL,m,S)(T)}function m(T){return t.attempt({tokenize:M,partial:!0},S,x)(T)}function x(T){return(s?Gi(t,b,"linePrefix",s+1):b)(T)}function b(T){return T===null?S(T):rr(T)?t.attempt(KL,m,S)(T):(t.enter("mathFlowValue"),_(T))}function _(T){return T===null||rr(T)?(t.exit("mathFlowValue"),b(T)):(t.consume(T),_)}function S(T){return t.exit("mathFlow"),e(T)}function M(T,A,N){let D=0;return Gi(T,k,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function k(L){return T.enter("mathFlowFence"),T.enter("mathFlowFenceSequence"),O(L)}function O(L){return L===36?(D++,T.consume(L),O):D<o?N(L):(T.exit("mathFlowFenceSequence"),Gi(T,R,"whitespace")(L))}function R(L){return L===null||rr(L)?(T.exit("mathFlowFence"),A(L)):N(L)}}}function bbe(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 _be(t){let n=(t||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:wbe,previous:Sbe,name:"mathText"};function r(i,s,o){let a=0,l,c;return f;function f(_){return i.enter("mathText"),i.enter("mathTextSequence"),h(_)}function h(_){return _===36?(i.consume(_),a++,h):a<2&&!n?o(_):(i.exit("mathTextSequence"),m(_))}function m(_){return _===null?o(_):_===36?(c=i.enter("mathTextSequence"),l=0,b(_)):_===32?(i.enter("space"),i.consume(_),i.exit("space"),m):rr(_)?(i.enter("lineEnding"),i.consume(_),i.exit("lineEnding"),m):(i.enter("mathTextData"),x(_))}function x(_){return _===null||_===32||_===36||rr(_)?(i.exit("mathTextData"),m(_)):(i.consume(_),x)}function b(_){return _===36?(i.consume(_),l++,b):l===a?(i.exit("mathTextSequence"),i.exit("mathText"),s(_)):(c.type="mathTextData",x(_))}}}function wbe(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 Sbe(t){return t!==36||this.events[this.events.length-1][1].type==="characterEscape"}function Mbe(t){return{flow:{36:vbe},text:{36:_be(t)}}}class Oc{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 Oc(e.loc.lexer,e.loc.start,n.loc.end):e&&e.loc}}class xu{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 xu(n,Oc.range(this,e))}}class mn{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 f;s+15<a.length?f=a.slice(s,s+15)+"…":f=a.slice(s),r+=c+l+f}var h=new Error(r);return h.name="ParseError",h.__proto__=mn.prototype,h.position=i,i!=null&&s!=null&&(h.length=s-i),h.rawMessage=e,h}}mn.prototype.__proto__=Error.prototype;var Tbe=/([A-Z])/g,aP=t=>t.replace(Tbe,"-$1").toLowerCase(),Cbe={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},Ebe=/[&><"']/g,_l=t=>String(t).replace(Ebe,e=>Cbe[e]),hw=t=>t.type==="ordgroup"||t.type==="color"?t.body.length===1?hw(t.body[0]):t:t.type==="font"?hw(t.body):t,Abe=new Set(["mathord","textord","atom"]),Bp=t=>Abe.has(hw(t).type),Nbe=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"},b2={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 kbe(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 lP{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 b2)if(b2.hasOwnProperty(n)){var r=b2[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:kbe(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 mn("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=Nbe(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Dm{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 eh[Rbe[this.id]]}sub(){return eh[Pbe[this.id]]}fracNum(){return eh[Ibe[this.id]]}fracDen(){return eh[Dbe[this.id]]}cramp(){return eh[Obe[this.id]]}text(){return eh[Lbe[this.id]]}isTight(){return this.size>=2}}var cP=0,m5=1,W1=2,Sp=3,Ww=4,ud=5,Py=6,Zl=7,eh=[new Dm(cP,0,!1),new Dm(m5,0,!0),new Dm(W1,1,!1),new Dm(Sp,1,!0),new Dm(Ww,2,!1),new Dm(ud,2,!0),new Dm(Py,3,!1),new Dm(Zl,3,!0)],Rbe=[Ww,ud,Ww,ud,Py,Zl,Py,Zl],Pbe=[ud,ud,ud,ud,Zl,Zl,Zl,Zl],Ibe=[W1,Sp,Ww,ud,Py,Zl,Py,Zl],Dbe=[Sp,Sp,ud,ud,Zl,Zl,Zl,Zl],Obe=[m5,m5,Sp,Sp,ud,ud,Zl,Zl],Lbe=[cP,m5,W1,Sp,W1,Sp,W1,Sp],_r={DISPLAY:eh[cP],TEXT:eh[W1],SCRIPT:eh[Ww],SCRIPTSCRIPT:eh[Py]},mR=[{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 jbe(t){for(var e=0;e<mR.length;e++)for(var n=mR[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 _2=[];mR.forEach(t=>t.blocks.forEach(e=>_2.push(...e)));function TX(t){for(var e=0;e<_2.length;e+=2)if(t>=_2[e]&&t<=_2[e+1])return!0;return!1}var Jv=80,zbe=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"},Fbe=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"},Ube=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"},Bbe=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"},Hbe=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"},Gbe=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},Vbe=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"},Wbe=function(e,n,r){n=1e3*n;var i="";switch(e){case"sqrtMain":i=zbe(n,Jv);break;case"sqrtSize1":i=Fbe(n,Jv);break;case"sqrtSize2":i=Ube(n,Jv);break;case"sqrtSize3":i=Bbe(n,Jv);break;case"sqrtSize4":i=Hbe(n,Jv);break;case"sqrtTall":i=Vbe(n,Jv,r)}return i},$be=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""}},ZL={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`},qbe=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 qS=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 oh={"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]}},Y4={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]},QL={Å:"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 Xbe(t,e){oh[t]=e}function uP(t,e,n){if(!oh[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),i=oh[e][r];if(!i&&t[0]in QL&&(r=QL[t[0]].charCodeAt(0),i=oh[e][r]),!i&&n==="text"&&TX(r)&&(i=oh[e][77]),i)return{depth:i[0],height:i[1],italic:i[2],skew:i[3],width:i[4]}}var g6={};function Ybe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!g6[e]){var n=g6[e]={cssEmPerMu:Y4.quad[e]/18};for(var r in Y4)Y4.hasOwnProperty(r)&&(n[r]=Y4[r][e])}return g6[e]}var Kbe=[[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]],JL=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],ej=function(e,n){return n.size<2?e:Kbe[e-1][n.size-1]};class dp{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||dp.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=JL[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 dp(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:ej(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:JL[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=ej(dp.BASESIZE,e);return this.size===n&&this.textSize===dp.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!==dp.BASESIZE?["sizing","reset-size"+this.size,"size"+dp.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Ybe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}dp.BASESIZE=6;var gR={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},Zbe={ex:!0,em:!0,mu:!0},CX=function(e){return typeof e!="string"&&(e=e.unit),e in gR||e in Zbe||e==="ex"},ao=function(e,n){var r;if(e.unit in gR)r=gR[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 mn("Invalid unit: '"+e.unit+"'");i!==n&&(r*=i.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Mn=function(e){return+e.toFixed(4)+"em"},C0=function(e){return e.filter(n=>n).join(" ")},EX=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)}},AX=function(e){var n=document.createElement(e);n.className=C0(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},Qbe=/[\s"'>/=\x00-\x1f]/,NX=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+_l(C0(this.classes))+'"');var r="";for(var i in this.style)this.style.hasOwnProperty(i)&&(r+=aP(i)+":"+this.style[i]+";");r&&(n+=' style="'+_l(r)+'"');for(var s in this.attributes)if(this.attributes.hasOwnProperty(s)){if(Qbe.test(s))throw new mn("Invalid attribute name '"+s+"'");n+=" "+s+'="'+_l(this.attributes[s])+'"'}n+=">";for(var o=0;o<this.children.length;o++)n+=this.children[o].toMarkup();return n+="</"+e+">",n};class XS{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,EX.call(this,e,r,i),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return AX.call(this,"span")}toMarkup(){return NX.call(this,"span")}}class dP{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,EX.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 AX.call(this,"a")}toMarkup(){return NX.call(this,"a")}}class Jbe{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="'+_l(this.src)+'"'+(' alt="'+_l(this.alt)+'"'),n="";for(var r in this.style)this.style.hasOwnProperty(r)&&(n+=aP(r)+":"+this.style[r]+";");return n&&(e+=' style="'+_l(n)+'"'),e+="'/>",e}}var e_e={î:"ı̂",ï:"ı̈",í:"ı́",ì:"ı̀"};class md{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=jbe(this.text.charCodeAt(0));c&&this.classes.push(c+"_fallback"),/[îïíì]/.test(this.text)&&(this.text=e_e[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=Mn(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=C0(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+=_l(C0(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+=aP(i)+":"+this.style[i]+";");r&&(e=!0,n+=' style="'+_l(r)+'"');var s=_l(this.text);return e?(n+=">",n+=s,n+="</span>",n):s}}class Ip{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+'="'+_l(this.attributes[n])+'"');e+=">";for(var r=0;r<this.children.length;r++)e+=this.children[r].toMarkup();return e+="</svg>",e}}class E0{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",ZL[this.pathName]),n}toMarkup(){return this.alternate?'<path d="'+_l(this.alternate)+'"/>':'<path d="'+_l(ZL[this.pathName])+'"/>'}}class xR{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+'="'+_l(this.attributes[n])+'"');return e+="/>",e}}function tj(t){if(t instanceof md)return t;throw new Error("Expected symbolNode but got "+String(t)+".")}function t_e(t){if(t instanceof XS)return t;throw new Error("Expected span<HtmlDomNode> but got "+String(t)+".")}var n_e={bin:1,close:1,inner:1,open:1,punct:1,rel:1},r_e={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},bs={math:{},text:{}};function ee(t,e,n,r,i,s){bs[t][i]={font:e,group:n,replace:r},s&&r&&(bs[t][r]=bs[t][i])}var pe="math",an="text",Ee="main",it="ams",Ys="accent-token",Ln="bin",nc="close",ob="inner",ar="mathord",ta="op-token",Cu="open",IC="punct",at="rel",Hp="spacing",yt="textord";ee(pe,Ee,at,"≡","\\equiv",!0);ee(pe,Ee,at,"≺","\\prec",!0);ee(pe,Ee,at,"≻","\\succ",!0);ee(pe,Ee,at,"∼","\\sim",!0);ee(pe,Ee,at,"⊥","\\perp");ee(pe,Ee,at,"⪯","\\preceq",!0);ee(pe,Ee,at,"⪰","\\succeq",!0);ee(pe,Ee,at,"≃","\\simeq",!0);ee(pe,Ee,at,"∣","\\mid",!0);ee(pe,Ee,at,"≪","\\ll",!0);ee(pe,Ee,at,"≫","\\gg",!0);ee(pe,Ee,at,"≍","\\asymp",!0);ee(pe,Ee,at,"∥","\\parallel");ee(pe,Ee,at,"⋈","\\bowtie",!0);ee(pe,Ee,at,"⌣","\\smile",!0);ee(pe,Ee,at,"⊑","\\sqsubseteq",!0);ee(pe,Ee,at,"⊒","\\sqsupseteq",!0);ee(pe,Ee,at,"≐","\\doteq",!0);ee(pe,Ee,at,"⌢","\\frown",!0);ee(pe,Ee,at,"∋","\\ni",!0);ee(pe,Ee,at,"∝","\\propto",!0);ee(pe,Ee,at,"⊢","\\vdash",!0);ee(pe,Ee,at,"⊣","\\dashv",!0);ee(pe,Ee,at,"∋","\\owns");ee(pe,Ee,IC,".","\\ldotp");ee(pe,Ee,IC,"⋅","\\cdotp");ee(pe,Ee,yt,"#","\\#");ee(an,Ee,yt,"#","\\#");ee(pe,Ee,yt,"&","\\&");ee(an,Ee,yt,"&","\\&");ee(pe,Ee,yt,"ℵ","\\aleph",!0);ee(pe,Ee,yt,"∀","\\forall",!0);ee(pe,Ee,yt,"ℏ","\\hbar",!0);ee(pe,Ee,yt,"∃","\\exists",!0);ee(pe,Ee,yt,"∇","\\nabla",!0);ee(pe,Ee,yt,"♭","\\flat",!0);ee(pe,Ee,yt,"ℓ","\\ell",!0);ee(pe,Ee,yt,"♮","\\natural",!0);ee(pe,Ee,yt,"♣","\\clubsuit",!0);ee(pe,Ee,yt,"℘","\\wp",!0);ee(pe,Ee,yt,"♯","\\sharp",!0);ee(pe,Ee,yt,"♢","\\diamondsuit",!0);ee(pe,Ee,yt,"ℜ","\\Re",!0);ee(pe,Ee,yt,"♡","\\heartsuit",!0);ee(pe,Ee,yt,"ℑ","\\Im",!0);ee(pe,Ee,yt,"♠","\\spadesuit",!0);ee(pe,Ee,yt,"§","\\S",!0);ee(an,Ee,yt,"§","\\S");ee(pe,Ee,yt,"¶","\\P",!0);ee(an,Ee,yt,"¶","\\P");ee(pe,Ee,yt,"†","\\dag");ee(an,Ee,yt,"†","\\dag");ee(an,Ee,yt,"†","\\textdagger");ee(pe,Ee,yt,"‡","\\ddag");ee(an,Ee,yt,"‡","\\ddag");ee(an,Ee,yt,"‡","\\textdaggerdbl");ee(pe,Ee,nc,"⎱","\\rmoustache",!0);ee(pe,Ee,Cu,"⎰","\\lmoustache",!0);ee(pe,Ee,nc,"⟯","\\rgroup",!0);ee(pe,Ee,Cu,"⟮","\\lgroup",!0);ee(pe,Ee,Ln,"∓","\\mp",!0);ee(pe,Ee,Ln,"⊖","\\ominus",!0);ee(pe,Ee,Ln,"⊎","\\uplus",!0);ee(pe,Ee,Ln,"⊓","\\sqcap",!0);ee(pe,Ee,Ln,"∗","\\ast");ee(pe,Ee,Ln,"⊔","\\sqcup",!0);ee(pe,Ee,Ln,"◯","\\bigcirc",!0);ee(pe,Ee,Ln,"∙","\\bullet",!0);ee(pe,Ee,Ln,"‡","\\ddagger");ee(pe,Ee,Ln,"≀","\\wr",!0);ee(pe,Ee,Ln,"⨿","\\amalg");ee(pe,Ee,Ln,"&","\\And");ee(pe,Ee,at,"⟵","\\longleftarrow",!0);ee(pe,Ee,at,"⇐","\\Leftarrow",!0);ee(pe,Ee,at,"⟸","\\Longleftarrow",!0);ee(pe,Ee,at,"⟶","\\longrightarrow",!0);ee(pe,Ee,at,"⇒","\\Rightarrow",!0);ee(pe,Ee,at,"⟹","\\Longrightarrow",!0);ee(pe,Ee,at,"↔","\\leftrightarrow",!0);ee(pe,Ee,at,"⟷","\\longleftrightarrow",!0);ee(pe,Ee,at,"⇔","\\Leftrightarrow",!0);ee(pe,Ee,at,"⟺","\\Longleftrightarrow",!0);ee(pe,Ee,at,"↦","\\mapsto",!0);ee(pe,Ee,at,"⟼","\\longmapsto",!0);ee(pe,Ee,at,"↗","\\nearrow",!0);ee(pe,Ee,at,"↩","\\hookleftarrow",!0);ee(pe,Ee,at,"↪","\\hookrightarrow",!0);ee(pe,Ee,at,"↘","\\searrow",!0);ee(pe,Ee,at,"↼","\\leftharpoonup",!0);ee(pe,Ee,at,"⇀","\\rightharpoonup",!0);ee(pe,Ee,at,"↙","\\swarrow",!0);ee(pe,Ee,at,"↽","\\leftharpoondown",!0);ee(pe,Ee,at,"⇁","\\rightharpoondown",!0);ee(pe,Ee,at,"↖","\\nwarrow",!0);ee(pe,Ee,at,"⇌","\\rightleftharpoons",!0);ee(pe,it,at,"≮","\\nless",!0);ee(pe,it,at,"","\\@nleqslant");ee(pe,it,at,"","\\@nleqq");ee(pe,it,at,"⪇","\\lneq",!0);ee(pe,it,at,"≨","\\lneqq",!0);ee(pe,it,at,"","\\@lvertneqq");ee(pe,it,at,"⋦","\\lnsim",!0);ee(pe,it,at,"⪉","\\lnapprox",!0);ee(pe,it,at,"⊀","\\nprec",!0);ee(pe,it,at,"⋠","\\npreceq",!0);ee(pe,it,at,"⋨","\\precnsim",!0);ee(pe,it,at,"⪹","\\precnapprox",!0);ee(pe,it,at,"≁","\\nsim",!0);ee(pe,it,at,"","\\@nshortmid");ee(pe,it,at,"∤","\\nmid",!0);ee(pe,it,at,"⊬","\\nvdash",!0);ee(pe,it,at,"⊭","\\nvDash",!0);ee(pe,it,at,"⋪","\\ntriangleleft");ee(pe,it,at,"⋬","\\ntrianglelefteq",!0);ee(pe,it,at,"⊊","\\subsetneq",!0);ee(pe,it,at,"","\\@varsubsetneq");ee(pe,it,at,"⫋","\\subsetneqq",!0);ee(pe,it,at,"","\\@varsubsetneqq");ee(pe,it,at,"≯","\\ngtr",!0);ee(pe,it,at,"","\\@ngeqslant");ee(pe,it,at,"","\\@ngeqq");ee(pe,it,at,"⪈","\\gneq",!0);ee(pe,it,at,"≩","\\gneqq",!0);ee(pe,it,at,"","\\@gvertneqq");ee(pe,it,at,"⋧","\\gnsim",!0);ee(pe,it,at,"⪊","\\gnapprox",!0);ee(pe,it,at,"⊁","\\nsucc",!0);ee(pe,it,at,"⋡","\\nsucceq",!0);ee(pe,it,at,"⋩","\\succnsim",!0);ee(pe,it,at,"⪺","\\succnapprox",!0);ee(pe,it,at,"≆","\\ncong",!0);ee(pe,it,at,"","\\@nshortparallel");ee(pe,it,at,"∦","\\nparallel",!0);ee(pe,it,at,"⊯","\\nVDash",!0);ee(pe,it,at,"⋫","\\ntriangleright");ee(pe,it,at,"⋭","\\ntrianglerighteq",!0);ee(pe,it,at,"","\\@nsupseteqq");ee(pe,it,at,"⊋","\\supsetneq",!0);ee(pe,it,at,"","\\@varsupsetneq");ee(pe,it,at,"⫌","\\supsetneqq",!0);ee(pe,it,at,"","\\@varsupsetneqq");ee(pe,it,at,"⊮","\\nVdash",!0);ee(pe,it,at,"⪵","\\precneqq",!0);ee(pe,it,at,"⪶","\\succneqq",!0);ee(pe,it,at,"","\\@nsubseteqq");ee(pe,it,Ln,"⊴","\\unlhd");ee(pe,it,Ln,"⊵","\\unrhd");ee(pe,it,at,"↚","\\nleftarrow",!0);ee(pe,it,at,"↛","\\nrightarrow",!0);ee(pe,it,at,"⇍","\\nLeftarrow",!0);ee(pe,it,at,"⇏","\\nRightarrow",!0);ee(pe,it,at,"↮","\\nleftrightarrow",!0);ee(pe,it,at,"⇎","\\nLeftrightarrow",!0);ee(pe,it,at,"△","\\vartriangle");ee(pe,it,yt,"ℏ","\\hslash");ee(pe,it,yt,"▽","\\triangledown");ee(pe,it,yt,"◊","\\lozenge");ee(pe,it,yt,"Ⓢ","\\circledS");ee(pe,it,yt,"®","\\circledR");ee(an,it,yt,"®","\\circledR");ee(pe,it,yt,"∡","\\measuredangle",!0);ee(pe,it,yt,"∄","\\nexists");ee(pe,it,yt,"℧","\\mho");ee(pe,it,yt,"Ⅎ","\\Finv",!0);ee(pe,it,yt,"⅁","\\Game",!0);ee(pe,it,yt,"‵","\\backprime");ee(pe,it,yt,"▲","\\blacktriangle");ee(pe,it,yt,"▼","\\blacktriangledown");ee(pe,it,yt,"■","\\blacksquare");ee(pe,it,yt,"⧫","\\blacklozenge");ee(pe,it,yt,"★","\\bigstar");ee(pe,it,yt,"∢","\\sphericalangle",!0);ee(pe,it,yt,"∁","\\complement",!0);ee(pe,it,yt,"ð","\\eth",!0);ee(an,Ee,yt,"ð","ð");ee(pe,it,yt,"╱","\\diagup");ee(pe,it,yt,"╲","\\diagdown");ee(pe,it,yt,"□","\\square");ee(pe,it,yt,"□","\\Box");ee(pe,it,yt,"◊","\\Diamond");ee(pe,it,yt,"¥","\\yen",!0);ee(an,it,yt,"¥","\\yen",!0);ee(pe,it,yt,"✓","\\checkmark",!0);ee(an,it,yt,"✓","\\checkmark");ee(pe,it,yt,"ℶ","\\beth",!0);ee(pe,it,yt,"ℸ","\\daleth",!0);ee(pe,it,yt,"ℷ","\\gimel",!0);ee(pe,it,yt,"ϝ","\\digamma",!0);ee(pe,it,yt,"ϰ","\\varkappa");ee(pe,it,Cu,"┌","\\@ulcorner",!0);ee(pe,it,nc,"┐","\\@urcorner",!0);ee(pe,it,Cu,"└","\\@llcorner",!0);ee(pe,it,nc,"┘","\\@lrcorner",!0);ee(pe,it,at,"≦","\\leqq",!0);ee(pe,it,at,"⩽","\\leqslant",!0);ee(pe,it,at,"⪕","\\eqslantless",!0);ee(pe,it,at,"≲","\\lesssim",!0);ee(pe,it,at,"⪅","\\lessapprox",!0);ee(pe,it,at,"≊","\\approxeq",!0);ee(pe,it,Ln,"⋖","\\lessdot");ee(pe,it,at,"⋘","\\lll",!0);ee(pe,it,at,"≶","\\lessgtr",!0);ee(pe,it,at,"⋚","\\lesseqgtr",!0);ee(pe,it,at,"⪋","\\lesseqqgtr",!0);ee(pe,it,at,"≑","\\doteqdot");ee(pe,it,at,"≓","\\risingdotseq",!0);ee(pe,it,at,"≒","\\fallingdotseq",!0);ee(pe,it,at,"∽","\\backsim",!0);ee(pe,it,at,"⋍","\\backsimeq",!0);ee(pe,it,at,"⫅","\\subseteqq",!0);ee(pe,it,at,"⋐","\\Subset",!0);ee(pe,it,at,"⊏","\\sqsubset",!0);ee(pe,it,at,"≼","\\preccurlyeq",!0);ee(pe,it,at,"⋞","\\curlyeqprec",!0);ee(pe,it,at,"≾","\\precsim",!0);ee(pe,it,at,"⪷","\\precapprox",!0);ee(pe,it,at,"⊲","\\vartriangleleft");ee(pe,it,at,"⊴","\\trianglelefteq");ee(pe,it,at,"⊨","\\vDash",!0);ee(pe,it,at,"⊪","\\Vvdash",!0);ee(pe,it,at,"⌣","\\smallsmile");ee(pe,it,at,"⌢","\\smallfrown");ee(pe,it,at,"≏","\\bumpeq",!0);ee(pe,it,at,"≎","\\Bumpeq",!0);ee(pe,it,at,"≧","\\geqq",!0);ee(pe,it,at,"⩾","\\geqslant",!0);ee(pe,it,at,"⪖","\\eqslantgtr",!0);ee(pe,it,at,"≳","\\gtrsim",!0);ee(pe,it,at,"⪆","\\gtrapprox",!0);ee(pe,it,Ln,"⋗","\\gtrdot");ee(pe,it,at,"⋙","\\ggg",!0);ee(pe,it,at,"≷","\\gtrless",!0);ee(pe,it,at,"⋛","\\gtreqless",!0);ee(pe,it,at,"⪌","\\gtreqqless",!0);ee(pe,it,at,"≖","\\eqcirc",!0);ee(pe,it,at,"≗","\\circeq",!0);ee(pe,it,at,"≜","\\triangleq",!0);ee(pe,it,at,"∼","\\thicksim");ee(pe,it,at,"≈","\\thickapprox");ee(pe,it,at,"⫆","\\supseteqq",!0);ee(pe,it,at,"⋑","\\Supset",!0);ee(pe,it,at,"⊐","\\sqsupset",!0);ee(pe,it,at,"≽","\\succcurlyeq",!0);ee(pe,it,at,"⋟","\\curlyeqsucc",!0);ee(pe,it,at,"≿","\\succsim",!0);ee(pe,it,at,"⪸","\\succapprox",!0);ee(pe,it,at,"⊳","\\vartriangleright");ee(pe,it,at,"⊵","\\trianglerighteq");ee(pe,it,at,"⊩","\\Vdash",!0);ee(pe,it,at,"∣","\\shortmid");ee(pe,it,at,"∥","\\shortparallel");ee(pe,it,at,"≬","\\between",!0);ee(pe,it,at,"⋔","\\pitchfork",!0);ee(pe,it,at,"∝","\\varpropto");ee(pe,it,at,"◀","\\blacktriangleleft");ee(pe,it,at,"∴","\\therefore",!0);ee(pe,it,at,"∍","\\backepsilon");ee(pe,it,at,"▶","\\blacktriangleright");ee(pe,it,at,"∵","\\because",!0);ee(pe,it,at,"⋘","\\llless");ee(pe,it,at,"⋙","\\gggtr");ee(pe,it,Ln,"⊲","\\lhd");ee(pe,it,Ln,"⊳","\\rhd");ee(pe,it,at,"≂","\\eqsim",!0);ee(pe,Ee,at,"⋈","\\Join");ee(pe,it,at,"≑","\\Doteq",!0);ee(pe,it,Ln,"∔","\\dotplus",!0);ee(pe,it,Ln,"∖","\\smallsetminus");ee(pe,it,Ln,"⋒","\\Cap",!0);ee(pe,it,Ln,"⋓","\\Cup",!0);ee(pe,it,Ln,"⩞","\\doublebarwedge",!0);ee(pe,it,Ln,"⊟","\\boxminus",!0);ee(pe,it,Ln,"⊞","\\boxplus",!0);ee(pe,it,Ln,"⋇","\\divideontimes",!0);ee(pe,it,Ln,"⋉","\\ltimes",!0);ee(pe,it,Ln,"⋊","\\rtimes",!0);ee(pe,it,Ln,"⋋","\\leftthreetimes",!0);ee(pe,it,Ln,"⋌","\\rightthreetimes",!0);ee(pe,it,Ln,"⋏","\\curlywedge",!0);ee(pe,it,Ln,"⋎","\\curlyvee",!0);ee(pe,it,Ln,"⊝","\\circleddash",!0);ee(pe,it,Ln,"⊛","\\circledast",!0);ee(pe,it,Ln,"⋅","\\centerdot");ee(pe,it,Ln,"⊺","\\intercal",!0);ee(pe,it,Ln,"⋒","\\doublecap");ee(pe,it,Ln,"⋓","\\doublecup");ee(pe,it,Ln,"⊠","\\boxtimes",!0);ee(pe,it,at,"⇢","\\dashrightarrow",!0);ee(pe,it,at,"⇠","\\dashleftarrow",!0);ee(pe,it,at,"⇇","\\leftleftarrows",!0);ee(pe,it,at,"⇆","\\leftrightarrows",!0);ee(pe,it,at,"⇚","\\Lleftarrow",!0);ee(pe,it,at,"↞","\\twoheadleftarrow",!0);ee(pe,it,at,"↢","\\leftarrowtail",!0);ee(pe,it,at,"↫","\\looparrowleft",!0);ee(pe,it,at,"⇋","\\leftrightharpoons",!0);ee(pe,it,at,"↶","\\curvearrowleft",!0);ee(pe,it,at,"↺","\\circlearrowleft",!0);ee(pe,it,at,"↰","\\Lsh",!0);ee(pe,it,at,"⇈","\\upuparrows",!0);ee(pe,it,at,"↿","\\upharpoonleft",!0);ee(pe,it,at,"⇃","\\downharpoonleft",!0);ee(pe,Ee,at,"⊶","\\origof",!0);ee(pe,Ee,at,"⊷","\\imageof",!0);ee(pe,it,at,"⊸","\\multimap",!0);ee(pe,it,at,"↭","\\leftrightsquigarrow",!0);ee(pe,it,at,"⇉","\\rightrightarrows",!0);ee(pe,it,at,"⇄","\\rightleftarrows",!0);ee(pe,it,at,"↠","\\twoheadrightarrow",!0);ee(pe,it,at,"↣","\\rightarrowtail",!0);ee(pe,it,at,"↬","\\looparrowright",!0);ee(pe,it,at,"↷","\\curvearrowright",!0);ee(pe,it,at,"↻","\\circlearrowright",!0);ee(pe,it,at,"↱","\\Rsh",!0);ee(pe,it,at,"⇊","\\downdownarrows",!0);ee(pe,it,at,"↾","\\upharpoonright",!0);ee(pe,it,at,"⇂","\\downharpoonright",!0);ee(pe,it,at,"⇝","\\rightsquigarrow",!0);ee(pe,it,at,"⇝","\\leadsto");ee(pe,it,at,"⇛","\\Rrightarrow",!0);ee(pe,it,at,"↾","\\restriction");ee(pe,Ee,yt,"‘","`");ee(pe,Ee,yt,"$","\\$");ee(an,Ee,yt,"$","\\$");ee(an,Ee,yt,"$","\\textdollar");ee(pe,Ee,yt,"%","\\%");ee(an,Ee,yt,"%","\\%");ee(pe,Ee,yt,"_","\\_");ee(an,Ee,yt,"_","\\_");ee(an,Ee,yt,"_","\\textunderscore");ee(pe,Ee,yt,"∠","\\angle",!0);ee(pe,Ee,yt,"∞","\\infty",!0);ee(pe,Ee,yt,"′","\\prime");ee(pe,Ee,yt,"△","\\triangle");ee(pe,Ee,yt,"Γ","\\Gamma",!0);ee(pe,Ee,yt,"Δ","\\Delta",!0);ee(pe,Ee,yt,"Θ","\\Theta",!0);ee(pe,Ee,yt,"Λ","\\Lambda",!0);ee(pe,Ee,yt,"Ξ","\\Xi",!0);ee(pe,Ee,yt,"Π","\\Pi",!0);ee(pe,Ee,yt,"Σ","\\Sigma",!0);ee(pe,Ee,yt,"Υ","\\Upsilon",!0);ee(pe,Ee,yt,"Φ","\\Phi",!0);ee(pe,Ee,yt,"Ψ","\\Psi",!0);ee(pe,Ee,yt,"Ω","\\Omega",!0);ee(pe,Ee,yt,"A","Α");ee(pe,Ee,yt,"B","Β");ee(pe,Ee,yt,"E","Ε");ee(pe,Ee,yt,"Z","Ζ");ee(pe,Ee,yt,"H","Η");ee(pe,Ee,yt,"I","Ι");ee(pe,Ee,yt,"K","Κ");ee(pe,Ee,yt,"M","Μ");ee(pe,Ee,yt,"N","Ν");ee(pe,Ee,yt,"O","Ο");ee(pe,Ee,yt,"P","Ρ");ee(pe,Ee,yt,"T","Τ");ee(pe,Ee,yt,"X","Χ");ee(pe,Ee,yt,"¬","\\neg",!0);ee(pe,Ee,yt,"¬","\\lnot");ee(pe,Ee,yt,"⊤","\\top");ee(pe,Ee,yt,"⊥","\\bot");ee(pe,Ee,yt,"∅","\\emptyset");ee(pe,it,yt,"∅","\\varnothing");ee(pe,Ee,ar,"α","\\alpha",!0);ee(pe,Ee,ar,"β","\\beta",!0);ee(pe,Ee,ar,"γ","\\gamma",!0);ee(pe,Ee,ar,"δ","\\delta",!0);ee(pe,Ee,ar,"ϵ","\\epsilon",!0);ee(pe,Ee,ar,"ζ","\\zeta",!0);ee(pe,Ee,ar,"η","\\eta",!0);ee(pe,Ee,ar,"θ","\\theta",!0);ee(pe,Ee,ar,"ι","\\iota",!0);ee(pe,Ee,ar,"κ","\\kappa",!0);ee(pe,Ee,ar,"λ","\\lambda",!0);ee(pe,Ee,ar,"μ","\\mu",!0);ee(pe,Ee,ar,"ν","\\nu",!0);ee(pe,Ee,ar,"ξ","\\xi",!0);ee(pe,Ee,ar,"ο","\\omicron",!0);ee(pe,Ee,ar,"π","\\pi",!0);ee(pe,Ee,ar,"ρ","\\rho",!0);ee(pe,Ee,ar,"σ","\\sigma",!0);ee(pe,Ee,ar,"τ","\\tau",!0);ee(pe,Ee,ar,"υ","\\upsilon",!0);ee(pe,Ee,ar,"ϕ","\\phi",!0);ee(pe,Ee,ar,"χ","\\chi",!0);ee(pe,Ee,ar,"ψ","\\psi",!0);ee(pe,Ee,ar,"ω","\\omega",!0);ee(pe,Ee,ar,"ε","\\varepsilon",!0);ee(pe,Ee,ar,"ϑ","\\vartheta",!0);ee(pe,Ee,ar,"ϖ","\\varpi",!0);ee(pe,Ee,ar,"ϱ","\\varrho",!0);ee(pe,Ee,ar,"ς","\\varsigma",!0);ee(pe,Ee,ar,"φ","\\varphi",!0);ee(pe,Ee,Ln,"∗","*",!0);ee(pe,Ee,Ln,"+","+");ee(pe,Ee,Ln,"−","-",!0);ee(pe,Ee,Ln,"⋅","\\cdot",!0);ee(pe,Ee,Ln,"∘","\\circ",!0);ee(pe,Ee,Ln,"÷","\\div",!0);ee(pe,Ee,Ln,"±","\\pm",!0);ee(pe,Ee,Ln,"×","\\times",!0);ee(pe,Ee,Ln,"∩","\\cap",!0);ee(pe,Ee,Ln,"∪","\\cup",!0);ee(pe,Ee,Ln,"∖","\\setminus",!0);ee(pe,Ee,Ln,"∧","\\land");ee(pe,Ee,Ln,"∨","\\lor");ee(pe,Ee,Ln,"∧","\\wedge",!0);ee(pe,Ee,Ln,"∨","\\vee",!0);ee(pe,Ee,yt,"√","\\surd");ee(pe,Ee,Cu,"⟨","\\langle",!0);ee(pe,Ee,Cu,"∣","\\lvert");ee(pe,Ee,Cu,"∥","\\lVert");ee(pe,Ee,nc,"?","?");ee(pe,Ee,nc,"!","!");ee(pe,Ee,nc,"⟩","\\rangle",!0);ee(pe,Ee,nc,"∣","\\rvert");ee(pe,Ee,nc,"∥","\\rVert");ee(pe,Ee,at,"=","=");ee(pe,Ee,at,":",":");ee(pe,Ee,at,"≈","\\approx",!0);ee(pe,Ee,at,"≅","\\cong",!0);ee(pe,Ee,at,"≥","\\ge");ee(pe,Ee,at,"≥","\\geq",!0);ee(pe,Ee,at,"←","\\gets");ee(pe,Ee,at,">","\\gt",!0);ee(pe,Ee,at,"∈","\\in",!0);ee(pe,Ee,at,"","\\@not");ee(pe,Ee,at,"⊂","\\subset",!0);ee(pe,Ee,at,"⊃","\\supset",!0);ee(pe,Ee,at,"⊆","\\subseteq",!0);ee(pe,Ee,at,"⊇","\\supseteq",!0);ee(pe,it,at,"⊈","\\nsubseteq",!0);ee(pe,it,at,"⊉","\\nsupseteq",!0);ee(pe,Ee,at,"⊨","\\models");ee(pe,Ee,at,"←","\\leftarrow",!0);ee(pe,Ee,at,"≤","\\le");ee(pe,Ee,at,"≤","\\leq",!0);ee(pe,Ee,at,"<","\\lt",!0);ee(pe,Ee,at,"→","\\rightarrow",!0);ee(pe,Ee,at,"→","\\to");ee(pe,it,at,"≱","\\ngeq",!0);ee(pe,it,at,"≰","\\nleq",!0);ee(pe,Ee,Hp," ","\\ ");ee(pe,Ee,Hp," ","\\space");ee(pe,Ee,Hp," ","\\nobreakspace");ee(an,Ee,Hp," ","\\ ");ee(an,Ee,Hp," "," ");ee(an,Ee,Hp," ","\\space");ee(an,Ee,Hp," ","\\nobreakspace");ee(pe,Ee,Hp,null,"\\nobreak");ee(pe,Ee,Hp,null,"\\allowbreak");ee(pe,Ee,IC,",",",");ee(pe,Ee,IC,";",";");ee(pe,it,Ln,"⊼","\\barwedge",!0);ee(pe,it,Ln,"⊻","\\veebar",!0);ee(pe,Ee,Ln,"⊙","\\odot",!0);ee(pe,Ee,Ln,"⊕","\\oplus",!0);ee(pe,Ee,Ln,"⊗","\\otimes",!0);ee(pe,Ee,yt,"∂","\\partial",!0);ee(pe,Ee,Ln,"⊘","\\oslash",!0);ee(pe,it,Ln,"⊚","\\circledcirc",!0);ee(pe,it,Ln,"⊡","\\boxdot",!0);ee(pe,Ee,Ln,"△","\\bigtriangleup");ee(pe,Ee,Ln,"▽","\\bigtriangledown");ee(pe,Ee,Ln,"†","\\dagger");ee(pe,Ee,Ln,"⋄","\\diamond");ee(pe,Ee,Ln,"⋆","\\star");ee(pe,Ee,Ln,"◃","\\triangleleft");ee(pe,Ee,Ln,"▹","\\triangleright");ee(pe,Ee,Cu,"{","\\{");ee(an,Ee,yt,"{","\\{");ee(an,Ee,yt,"{","\\textbraceleft");ee(pe,Ee,nc,"}","\\}");ee(an,Ee,yt,"}","\\}");ee(an,Ee,yt,"}","\\textbraceright");ee(pe,Ee,Cu,"{","\\lbrace");ee(pe,Ee,nc,"}","\\rbrace");ee(pe,Ee,Cu,"[","\\lbrack",!0);ee(an,Ee,yt,"[","\\lbrack",!0);ee(pe,Ee,nc,"]","\\rbrack",!0);ee(an,Ee,yt,"]","\\rbrack",!0);ee(pe,Ee,Cu,"(","\\lparen",!0);ee(pe,Ee,nc,")","\\rparen",!0);ee(an,Ee,yt,"<","\\textless",!0);ee(an,Ee,yt,">","\\textgreater",!0);ee(pe,Ee,Cu,"⌊","\\lfloor",!0);ee(pe,Ee,nc,"⌋","\\rfloor",!0);ee(pe,Ee,Cu,"⌈","\\lceil",!0);ee(pe,Ee,nc,"⌉","\\rceil",!0);ee(pe,Ee,yt,"\\","\\backslash");ee(pe,Ee,yt,"∣","|");ee(pe,Ee,yt,"∣","\\vert");ee(an,Ee,yt,"|","\\textbar",!0);ee(pe,Ee,yt,"∥","\\|");ee(pe,Ee,yt,"∥","\\Vert");ee(an,Ee,yt,"∥","\\textbardbl");ee(an,Ee,yt,"~","\\textasciitilde");ee(an,Ee,yt,"\\","\\textbackslash");ee(an,Ee,yt,"^","\\textasciicircum");ee(pe,Ee,at,"↑","\\uparrow",!0);ee(pe,Ee,at,"⇑","\\Uparrow",!0);ee(pe,Ee,at,"↓","\\downarrow",!0);ee(pe,Ee,at,"⇓","\\Downarrow",!0);ee(pe,Ee,at,"↕","\\updownarrow",!0);ee(pe,Ee,at,"⇕","\\Updownarrow",!0);ee(pe,Ee,ta,"∐","\\coprod");ee(pe,Ee,ta,"⋁","\\bigvee");ee(pe,Ee,ta,"⋀","\\bigwedge");ee(pe,Ee,ta,"⨄","\\biguplus");ee(pe,Ee,ta,"⋂","\\bigcap");ee(pe,Ee,ta,"⋃","\\bigcup");ee(pe,Ee,ta,"∫","\\int");ee(pe,Ee,ta,"∫","\\intop");ee(pe,Ee,ta,"∬","\\iint");ee(pe,Ee,ta,"∭","\\iiint");ee(pe,Ee,ta,"∏","\\prod");ee(pe,Ee,ta,"∑","\\sum");ee(pe,Ee,ta,"⨂","\\bigotimes");ee(pe,Ee,ta,"⨁","\\bigoplus");ee(pe,Ee,ta,"⨀","\\bigodot");ee(pe,Ee,ta,"∮","\\oint");ee(pe,Ee,ta,"∯","\\oiint");ee(pe,Ee,ta,"∰","\\oiiint");ee(pe,Ee,ta,"⨆","\\bigsqcup");ee(pe,Ee,ta,"∫","\\smallint");ee(an,Ee,ob,"…","\\textellipsis");ee(pe,Ee,ob,"…","\\mathellipsis");ee(an,Ee,ob,"…","\\ldots",!0);ee(pe,Ee,ob,"…","\\ldots",!0);ee(pe,Ee,ob,"⋯","\\@cdots",!0);ee(pe,Ee,ob,"⋱","\\ddots",!0);ee(pe,Ee,yt,"⋮","\\varvdots");ee(an,Ee,yt,"⋮","\\varvdots");ee(pe,Ee,Ys,"ˊ","\\acute");ee(pe,Ee,Ys,"ˋ","\\grave");ee(pe,Ee,Ys,"¨","\\ddot");ee(pe,Ee,Ys,"~","\\tilde");ee(pe,Ee,Ys,"ˉ","\\bar");ee(pe,Ee,Ys,"˘","\\breve");ee(pe,Ee,Ys,"ˇ","\\check");ee(pe,Ee,Ys,"^","\\hat");ee(pe,Ee,Ys,"⃗","\\vec");ee(pe,Ee,Ys,"˙","\\dot");ee(pe,Ee,Ys,"˚","\\mathring");ee(pe,Ee,ar,"","\\@imath");ee(pe,Ee,ar,"","\\@jmath");ee(pe,Ee,yt,"ı","ı");ee(pe,Ee,yt,"ȷ","ȷ");ee(an,Ee,yt,"ı","\\i",!0);ee(an,Ee,yt,"ȷ","\\j",!0);ee(an,Ee,yt,"ß","\\ss",!0);ee(an,Ee,yt,"æ","\\ae",!0);ee(an,Ee,yt,"œ","\\oe",!0);ee(an,Ee,yt,"ø","\\o",!0);ee(an,Ee,yt,"Æ","\\AE",!0);ee(an,Ee,yt,"Œ","\\OE",!0);ee(an,Ee,yt,"Ø","\\O",!0);ee(an,Ee,Ys,"ˊ","\\'");ee(an,Ee,Ys,"ˋ","\\`");ee(an,Ee,Ys,"ˆ","\\^");ee(an,Ee,Ys,"˜","\\~");ee(an,Ee,Ys,"ˉ","\\=");ee(an,Ee,Ys,"˘","\\u");ee(an,Ee,Ys,"˙","\\.");ee(an,Ee,Ys,"¸","\\c");ee(an,Ee,Ys,"˚","\\r");ee(an,Ee,Ys,"ˇ","\\v");ee(an,Ee,Ys,"¨",'\\"');ee(an,Ee,Ys,"˝","\\H");ee(an,Ee,Ys,"◯","\\textcircled");var kX={"--":!0,"---":!0,"``":!0,"''":!0};ee(an,Ee,yt,"–","--",!0);ee(an,Ee,yt,"–","\\textendash");ee(an,Ee,yt,"—","---",!0);ee(an,Ee,yt,"—","\\textemdash");ee(an,Ee,yt,"‘","`",!0);ee(an,Ee,yt,"‘","\\textquoteleft");ee(an,Ee,yt,"’","'",!0);ee(an,Ee,yt,"’","\\textquoteright");ee(an,Ee,yt,"“","``",!0);ee(an,Ee,yt,"“","\\textquotedblleft");ee(an,Ee,yt,"”","''",!0);ee(an,Ee,yt,"”","\\textquotedblright");ee(pe,Ee,yt,"°","\\degree",!0);ee(an,Ee,yt,"°","\\degree");ee(an,Ee,yt,"°","\\textdegree",!0);ee(pe,Ee,yt,"£","\\pounds");ee(pe,Ee,yt,"£","\\mathsterling",!0);ee(an,Ee,yt,"£","\\pounds");ee(an,Ee,yt,"£","\\textsterling",!0);ee(pe,it,yt,"✠","\\maltese");ee(an,it,yt,"✠","\\maltese");var nj='0123456789/@."';for(var x6=0;x6<nj.length;x6++){var rj=nj.charAt(x6);ee(pe,Ee,yt,rj,rj)}var ij='0123456789!@*()-=+";:?/.,';for(var v6=0;v6<ij.length;v6++){var sj=ij.charAt(v6);ee(an,Ee,yt,sj,sj)}var g5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(var y6=0;y6<g5.length;y6++){var K4=g5.charAt(y6);ee(pe,Ee,ar,K4,K4),ee(an,Ee,yt,K4,K4)}ee(pe,it,yt,"C","ℂ");ee(an,it,yt,"C","ℂ");ee(pe,it,yt,"H","ℍ");ee(an,it,yt,"H","ℍ");ee(pe,it,yt,"N","ℕ");ee(an,it,yt,"N","ℕ");ee(pe,it,yt,"P","ℙ");ee(an,it,yt,"P","ℙ");ee(pe,it,yt,"Q","ℚ");ee(an,it,yt,"Q","ℚ");ee(pe,it,yt,"R","ℝ");ee(an,it,yt,"R","ℝ");ee(pe,it,yt,"Z","ℤ");ee(an,it,yt,"Z","ℤ");ee(pe,Ee,ar,"h","ℎ");ee(an,Ee,ar,"h","ℎ");var vr="";for(var Ul=0;Ul<g5.length;Ul++){var bo=g5.charAt(Ul);vr=String.fromCharCode(55349,56320+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr),vr=String.fromCharCode(55349,56372+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr),vr=String.fromCharCode(55349,56424+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr),vr=String.fromCharCode(55349,56580+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr),vr=String.fromCharCode(55349,56684+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr),vr=String.fromCharCode(55349,56736+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr),vr=String.fromCharCode(55349,56788+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr),vr=String.fromCharCode(55349,56840+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr),vr=String.fromCharCode(55349,56944+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr),Ul<26&&(vr=String.fromCharCode(55349,56632+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr),vr=String.fromCharCode(55349,56476+Ul),ee(pe,Ee,ar,bo,vr),ee(an,Ee,yt,bo,vr))}vr="𝕜";ee(pe,Ee,ar,"k",vr);ee(an,Ee,yt,"k",vr);for(var zg=0;zg<10;zg++){var Om=zg.toString();vr=String.fromCharCode(55349,57294+zg),ee(pe,Ee,ar,Om,vr),ee(an,Ee,yt,Om,vr),vr=String.fromCharCode(55349,57314+zg),ee(pe,Ee,ar,Om,vr),ee(an,Ee,yt,Om,vr),vr=String.fromCharCode(55349,57324+zg),ee(pe,Ee,ar,Om,vr),ee(an,Ee,yt,Om,vr),vr=String.fromCharCode(55349,57334+zg),ee(pe,Ee,ar,Om,vr),ee(an,Ee,yt,Om,vr)}var vR="ÐÞþ";for(var b6=0;b6<vR.length;b6++){var Z4=vR.charAt(b6);ee(pe,Ee,ar,Z4,Z4),ee(an,Ee,yt,Z4,Z4)}var Q4=[["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"]],oj=[["mathbf","textbf","Main-Bold"],["","",""],["mathsf","textsf","SansSerif-Regular"],["mathboldsf","textboldsf","SansSerif-Bold"],["mathtt","texttt","Typewriter-Regular"]],i_e=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[Q4[a][2],Q4[a][o]]}else if(120782<=s&&s<=120831){var l=Math.floor((s-120782)/10);return[oj[l][2],oj[l][o]]}else{if(s===120485||s===120486)return[Q4[0][2],Q4[0][o]];if(120486<s&&s<120782)return["",""];throw new mn("Unsupported character: "+e)}},DC=function(e,n,r){return bs[r][e]&&bs[r][e].replace&&(e=bs[r][e].replace),{value:e,metrics:uP(e,n,r)}},Vl=function(e,n,r,i,s){var o=DC(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 md(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 md(e,0,0,0,0,0,s);if(i){l.maxFontSize=i.sizeMultiplier,i.style.isTight()&&l.classes.push("mtight");var f=i.getColor();f&&(l.style.color=f)}return l},fP=function(e,n,r,i){return i===void 0&&(i=[]),r.font==="boldsymbol"&&DC(e,"Main-Bold",n).metrics?Vl(e,"Main-Bold",n,r,i.concat(["mathbf"])):e==="\\"||bs[n][e].font==="main"?Vl(e,"Main-Regular",n,r,i):Vl(e,"AMS-Regular",n,r,i.concat(["amsrm"]))},s_e=function(e,n,r,i,s){return s!=="textord"&&DC(e,"Math-BoldItalic",n).metrics?{fontName:"Math-BoldItalic",fontClass:"boldsymbol"}:{fontName:"Main-Bold",fontClass:"mathbf"}},OC=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="",f="";if(s.charCodeAt(0)===55349&&([c,f]=i_e(s,i)),c.length>0)return Vl(s,c,i,n,o.concat(f));if(l){var h,m;if(l==="boldsymbol"){var x=s_e(s,i,n,o,r);h=x.fontName,m=[x.fontClass]}else a?(h=yR[l].fontName,m=[l]):(h=J4(l,n.fontWeight,n.fontShape),m=[l,n.fontWeight,n.fontShape]);if(DC(s,h,i).metrics)return Vl(s,h,i,n,o.concat(m));if(kX.hasOwnProperty(s)&&h.slice(0,10)==="Typewriter"){for(var b=[],_=0;_<s.length;_++)b.push(Vl(s[_],h,i,n,o.concat(m)));return Gp(b)}}if(r==="mathord")return Vl(s,"Math-Italic",i,n,o.concat(["mathnormal"]));if(r==="textord"){var S=bs[i][s]&&bs[i][s].font;if(S==="ams"){var M=J4("amsrm",n.fontWeight,n.fontShape);return Vl(s,M,i,n,o.concat("amsrm",n.fontWeight,n.fontShape))}else if(S==="main"||!S){var T=J4("textrm",n.fontWeight,n.fontShape);return Vl(s,T,i,n,o.concat(n.fontWeight,n.fontShape))}else{var A=J4(S,n.fontWeight,n.fontShape);return Vl(s,A,i,n,o.concat(A,n.fontWeight,n.fontShape))}}else throw new Error("unexpected type: "+r+" in makeOrd")},o_e=(t,e)=>{if(C0(t.classes)!==C0(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},RX=t=>{for(var e=0;e<t.length-1;e++){var n=t[e],r=t[e+1];n instanceof md&&r instanceof md&&o_e(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},hP=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},un=function(e,n,r,i){var s=new XS(e,n,r,i);return hP(s),s},A0=(t,e,n,r)=>new XS(t,e,n,r),Iy=function(e,n,r){var i=un([e],[],n);return i.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),i.style.borderBottomWidth=Mn(i.height),i.maxFontSize=1,i},a_e=function(e,n,r,i){var s=new dP(e,n,r,i);return hP(s),s},Gp=function(e){var n=new qS(e);return hP(n),n},Dy=function(e,n){return e instanceof qS?un([],[e],n):e},l_e=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 f=e.positionData,h=0;h<e.children.length;h++){var m=e.children[h];f-=m.type==="kern"?m.size:m.elem.height+m.elem.depth}c=f}else if(e.positionType==="bottom")c=-e.positionData;else{var x=e.children[0];if(x.type!=="elem")throw new Error('First child must have type "elem".');if(e.positionType==="shift")c=-x.elem.depth-e.positionData;else if(e.positionType==="firstBaseline")c=-x.elem.depth;else throw new Error("Invalid positionType "+e.positionType+".")}return{children:e.children,depth:c}},Ei=function(e,n){for(var{children:r,depth:i}=l_e(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=un(["pstrut"],[]);c.style.height=Mn(s);for(var f=[],h=i,m=i,x=i,b=0;b<r.length;b++){var _=r[b];if(_.type==="kern")x+=_.size;else{var S=_.elem,M=_.wrapperClasses||[],T=_.wrapperStyle||{},A=un(M,[c,S],void 0,T);A.style.top=Mn(-s-x-S.depth),_.marginLeft&&(A.style.marginLeft=_.marginLeft),_.marginRight&&(A.style.marginRight=_.marginRight),f.push(A),x+=S.height+S.depth}h=Math.min(h,x),m=Math.max(m,x)}var N=un(["vlist"],f);N.style.height=Mn(m);var D;if(h<0){var k=un([],[]),O=un(["vlist"],[k]);O.style.height=Mn(-h);var R=un(["vlist-s"],[new md("​")]);D=[un(["vlist-r"],[N,R]),un(["vlist-r"],[O])]}else D=[un(["vlist-r"],[N])];var L=un(["vlist-t"],D);return D.length===2&&L.classes.push("vlist-t2"),L.height=m,L.depth=-h,L},PX=(t,e)=>{var n=un(["mspace"],[],e),r=ao(t,e);return n.style.marginRight=Mn(r),n},J4=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},yR={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"}},IX={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},DX=function(e,n){var[r,i,s]=IX[e],o=new E0(r),a=new Ip([o],{width:Mn(i),height:Mn(s),style:"width:"+Mn(i),viewBox:"0 0 "+1e3*i+" "+1e3*s,preserveAspectRatio:"xMinYMin"}),l=A0(["overlay"],[a],n);return l.height=s,l.style.height=Mn(s),l.style.width=Mn(i),l},so={number:3,unit:"mu"},Fg={number:4,unit:"mu"},tp={number:5,unit:"mu"},c_e={mord:{mop:so,mbin:Fg,mrel:tp,minner:so},mop:{mord:so,mop:so,mrel:tp,minner:so},mbin:{mord:Fg,mop:Fg,mopen:Fg,minner:Fg},mrel:{mord:tp,mop:tp,mopen:tp,minner:tp},mopen:{},mclose:{mop:so,mbin:Fg,mrel:tp,minner:so},mpunct:{mord:so,mop:so,mrel:tp,mopen:so,mclose:so,mpunct:so,minner:so},minner:{mord:so,mop:so,mbin:Fg,mrel:tp,mopen:so,mpunct:so,minner:so}},u_e={mord:{mop:so},mop:{mord:so,mop:so},mbin:{},mrel:{},mopen:{},mclose:{mop:so},mpunct:{},minner:{mop:so}},OX={},x5={},v5={};function In(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)OX[n[l]]=a;e&&(s&&(x5[e]=s),o&&(v5[e]=o))}function Yx(t){var{type:e,htmlBuilder:n,mathmlBuilder:r}=t;In({type:e,names:[],props:{numArgs:0},handler(){throw new Error("Should never be called.")},htmlBuilder:n,mathmlBuilder:r})}var y5=function(e){return e.type==="ordgroup"&&e.body.length===1?e.body[0]:e},jo=function(e){return e.type==="ordgroup"?e.body:[e]},d_e=new Set(["leftmost","mbin","mopen","mrel","mop","mpunct"]),f_e=new Set(["rightmost","mrel","mclose","mpunct"]),h_e={display:_r.DISPLAY,text:_r.TEXT,script:_r.SCRIPT,scriptscript:_r.SCRIPTSCRIPT},p_e={mord:"mord",mop:"mop",mbin:"mbin",mrel:"mrel",mopen:"mopen",mclose:"mclose",mpunct:"mpunct",minner:"minner"},ga=function(e,n,r,i){i===void 0&&(i=[null,null]);for(var s=[],o=0;o<e.length;o++){var a=_i(e[o],n);if(a instanceof qS){var l=a.children;s.push(...l)}else s.push(a)}if(RX(s),!r)return s;var c=n;if(e.length===1){var f=e[0];f.type==="sizing"?c=n.havingSize(f.size):f.type==="styling"&&(c=n.havingStyle(h_e[f.style]))}var h=un([i[0]||"leftmost"],[],n),m=un([i[1]||"rightmost"],[],n),x=r==="root";return aj(s,(b,_)=>{var S=_.classes[0],M=b.classes[0];S==="mbin"&&f_e.has(M)?_.classes[0]="mord":M==="mbin"&&d_e.has(S)&&(b.classes[0]="mord")},{node:h},m,x),aj(s,(b,_)=>{var S=bR(_),M=bR(b),T=S&&M?b.hasClass("mtight")?u_e[S][M]:c_e[S][M]:null;if(T)return PX(T,c)},{node:h},m,x),s},aj=function t(e,n,r,i,s){i&&e.push(i);for(var o=0;o<e.length;o++){var a=e[o],l=LX(a);if(l){t(l.children,n,r,null,s);continue}var c=!a.hasClass("mspace");if(c){var f=n(a,r.node);f&&(r.insertAfter?r.insertAfter(f):(e.unshift(f),o++))}c?r.node=a:s&&a.hasClass("newline")&&(r.node=un(["leftmost"])),r.insertAfter=(h=>m=>{e.splice(h+1,0,m),o++})(o)}i&&e.pop()},LX=function(e){return e instanceof qS||e instanceof dP||e instanceof XS&&e.hasClass("enclosing")?e:null},m_e=function t(e,n){var r=LX(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},bR=function(e,n){return e?(n&&(e=m_e(e,n)),p_e[e.classes[0]]||null):null},$w=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return un(n.concat(r))},_i=function(e,n,r){if(!e)return un();if(x5[e.type]){var i=x5[e.type](e,n);if(r&&n.size!==r.size){i=un(n.sizingClasses(r),[i],n);var s=n.sizeMultiplier/r.sizeMultiplier;i.height*=s,i.depth*=s}return i}else throw new mn("Got group of unknown type: '"+e.type+"'")};function eM(t,e){var n=un(["base"],t,e),r=un(["strut"]);return r.style.height=Mn(n.height+n.depth),n.depth&&(r.style.verticalAlign=Mn(-n.depth)),n.children.unshift(r),n}function _R(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=ga(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(eM(o,e)),o=[])}else r[a].hasClass("newline")&&(o.pop(),o.length>0&&(s.push(eM(o,e)),o=[]),s.push(r[a]));o.length>0&&s.push(eM(o,e));var c;n?(c=eM(ga(n,e,!0)),c.classes=["tag"],s.push(c)):i&&s.push(i);var f=un(["katex-html"],s);if(f.setAttribute("aria-hidden","true"),c){var h=c.children[0];h.style.height=Mn(f.height+f.depth),f.depth&&(h.style.verticalAlign=Mn(-f.depth))}return f}function jX(t){return new qS(t)}class gn{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=C0(this.classes));for(var r=0;r<this.children.length;r++)if(this.children[r]instanceof Jo&&this.children[r+1]instanceof Jo){for(var i=this.children[r].toText()+this.children[++r].toText();this.children[r+1]instanceof Jo;)i+=this.children[++r].toText();e.appendChild(new Jo(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+=_l(this.attributes[n]),e+='"');this.classes.length>0&&(e+=' class ="'+_l(C0(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 Jo{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return _l(this.toText())}toText(){return this.text}}class zX{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",Mn(this.width)),e}toMarkup(){return this.character?"<mtext>"+this.character+"</mtext>":'<mspace width="'+Mn(this.width)+'"/>'}toText(){return this.character?this.character:" "}}var g_e=new Set(["\\imath","\\jmath"]),x_e=new Set(["mrow","mtable"]),gd=function(e,n,r){return bs[n][e]&&bs[n][e].replace&&e.charCodeAt(0)!==55349&&!(kX.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=bs[n][e].replace),new Jo(e)},pP=function(e){return e.length===1?e[0]:new gn("mrow",e)},mP=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(g_e.has(s))return null;bs[i][s]&&bs[i][s].replace&&(s=bs[i][s].replace);var o=yR[r].fontName;return uP(s,o,i)?yR[r].variant:null};function _6(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof Jo&&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 Jo&&n.text===","}else return!1}var $c=function(e,n,r){if(e.length===1){var i=cs(e[0],n);return r&&i instanceof gn&&i.type==="mo"&&(i.setAttribute("lspace","0em"),i.setAttribute("rspace","0em")),[i]}for(var s=[],o,a=0;a<e.length;a++){var l=cs(e[a],n);if(l instanceof gn&&o instanceof gn){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(_6(l)&&o.type==="mn"){o.children.push(...l.children);continue}else if(l.type==="mn"&&_6(o))l.children=[...o.children,...l.children],s.pop();else if((l.type==="msup"||l.type==="msub")&&l.children.length>=1&&(o.type==="mn"||_6(o))){var c=l.children[0];c instanceof gn&&c.type==="mn"&&(c.children=[...o.children,...c.children],s.pop())}else if(o.type==="mi"&&o.children.length===1){var f=o.children[0];if(f instanceof Jo&&f.text==="̸"&&(l.type==="mo"||l.type==="mi"||l.type==="mn")){var h=l.children[0];h instanceof Jo&&h.text.length>0&&(h.text=h.text.slice(0,1)+"̸"+h.text.slice(1),s.pop())}}}s.push(l),o=l}return s},N0=function(e,n,r){return pP($c(e,n,r))},cs=function(e,n){if(!e)return new gn("mrow");if(v5[e.type]){var r=v5[e.type](e,n);return r}else throw new mn("Got group of unknown type: '"+e.type+"'")};function lj(t,e,n,r,i){var s=$c(t,n),o;s.length===1&&s[0]instanceof gn&&x_e.has(s[0].type)?o=s[0]:o=new gn("mrow",s);var a=new gn("annotation",[new Jo(e)]);a.setAttribute("encoding","application/x-tex");var l=new gn("semantics",[o,a]),c=new gn("math",[l]);c.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&c.setAttribute("display","block");var f=i?"katex":"katex-mathml";return un([f],[c])}var FX=function(e){return new dp({style:e.displayMode?_r.DISPLAY:_r.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},UX=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=un(r,[e])}return e},v_e=function(e,n,r){var i=FX(r),s;if(r.output==="mathml")return lj(e,n,i,r.displayMode,!0);if(r.output==="html"){var o=_R(e,i);s=un(["katex"],[o])}else{var a=lj(e,n,i,r.displayMode,!1),l=_R(e,i);s=un(["katex"],[a,l])}return UX(s,r)},y_e=function(e,n,r){var i=FX(r),s=_R(e,i),o=un(["katex"],[s]);return UX(o,r)},b_e={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":"="},LC=function(e){var n=new gn("mo",[new Jo(b_e[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},__e={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]},w_e=new Set(["widehat","widecheck","widetilde","utilde"]),jC=function(e,n){function r(){var a=4e5,l=e.label.slice(1);if(w_e.has(l)){var c=e,f=c.base.type==="ordgroup"?c.base.body.length:1,h,m,x;if(f>5)l==="widehat"||l==="widecheck"?(h=420,a=2364,x=.42,m=l+"4"):(h=312,a=2340,x=.34,m="tilde4");else{var b=[1,1,2,2,3,3][f];l==="widehat"||l==="widecheck"?(a=[0,1062,2364,2364,2364][b],h=[0,239,300,360,420][b],x=[0,.24,.3,.3,.36,.42][b],m=l+b):(a=[0,600,1033,2339,2340][b],h=[0,260,286,306,312][b],x=[0,.26,.286,.3,.306,.34][b],m="tilde"+b)}var _=new E0(m),S=new Ip([_],{width:"100%",height:Mn(x),viewBox:"0 0 "+a+" "+h,preserveAspectRatio:"none"});return{span:A0([],[S],n),minWidth:0,height:x}}else{var M=[],T=__e[l],[A,N,D]=T,k=D/1e3,O=A.length,R,L;if(O===1){var B=T[3];R=["hide-tail"],L=[B]}else if(O===2)R=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(O===3)R=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support
                    `+O+" children.");for(var H=0;H<O;H++){var $=new E0(A[H]),G=new Ip([$],{width:"400em",height:Mn(k),viewBox:"0 0 "+a+" "+D,preserveAspectRatio:L[H]+" slice"}),Z=A0([R[H]],[G],n);if(O===1)return{span:Z,minWidth:N,height:k};Z.style.height=Mn(k),M.push(Z)}return{span:un(["stretchy"],M,n),minWidth:N,height:k}}}var{span:i,minWidth:s,height:o}=r();return i.height=o,i.style.height=Mn(o),s>0&&(i.style.minWidth=Mn(s)),i},S_e=function(e,n,r,i,s){var o,a=e.height+e.depth+r+i;if(/fbox|color|angl/.test(n)){if(o=un(["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 xR({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&c.push(new xR({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var f=new Ip(c,{width:"100%",height:Mn(a)});o=A0([],[f],s)}return o.height=a,o.style.height=Mn(a),o};function Ur(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 gP(t){var e=zC(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 zC(t){return t&&(t.type==="atom"||r_e.hasOwnProperty(t.type))?t:null}var xP=(t,e)=>{var n,r,i;t&&t.type==="supsub"?(r=Ur(t.base,"accent"),n=r.base,t.base=n,i=t_e(_i(t,e)),t.base=r):(r=Ur(t,"accent"),n=r.base);var s=_i(n,e.havingCrampedStyle()),o=r.isShifty&&Bp(n),a=0;if(o){var l=hw(n),c=_i(l,e.havingCrampedStyle());a=tj(c).skew}var f=r.label==="\\c",h=f?s.height+s.depth:Math.min(s.height,e.fontMetrics().xHeight),m;if(r.isStretchy)m=jC(r,e),m=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"elem",elem:m,wrapperClasses:["svg-align"],wrapperStyle:a>0?{width:"calc(100% - "+Mn(2*a)+")",marginLeft:Mn(2*a)}:void 0}]});else{var x,b;r.label==="\\vec"?(x=DX("vec",e),b=IX.vec[1]):(x=OC({mode:r.mode,text:r.label},e,"textord"),x=tj(x),x.italic=0,b=x.width,f&&(h+=x.depth)),m=un(["accent-body"],[x]);var _=r.label==="\\textcircled";_&&(m.classes.push("accent-full"),h=s.height);var S=a;_||(S-=b/2),m.style.left=Mn(S),r.label==="\\textcircled"&&(m.style.top=".2em"),m=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:s},{type:"kern",size:-h},{type:"elem",elem:m}]})}var M=un(["mord","accent"],[m],e);return i?(i.children[0]=M,i.height=Math.max(M.height,i.height),i.classes[0]="mord",i):M},BX=(t,e)=>{var n=t.isStretchy?LC(t.label):new gn("mo",[gd(t.label,t.mode)]),r=new gn("mover",[cs(t.base,e),n]);return r.setAttribute("accent","true"),r},M_e=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));In({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=y5(e[0]),r=!M_e.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:xP,mathmlBuilder:BX});In({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:xP,mathmlBuilder:BX});In({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=_i(t.base,e),r=jC(t,e),i=t.label==="\\utilde"?.12:0,s=Ei({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:i},{type:"elem",elem:n}]});return un(["mord","accentunder"],[s],e)},mathmlBuilder:(t,e)=>{var n=LC(t.label),r=new gn("munder",[cs(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var tM=t=>{var e=new gn("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};In({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=Dy(_i(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=Dy(_i(t.below,r,e),e),o.classes.push(s+"-arrow-pad"));var a=jC(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 f;if(o){var h=-e.fontMetrics().axisHeight+o.height+.5*a.height+.111;f=Ei({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l},{type:"elem",elem:o,shift:h}]})}else f=Ei({positionType:"individualShift",children:[{type:"elem",elem:i,shift:c},{type:"elem",elem:a,shift:l}]});return f.children[0].children[0].children[1].classes.push("svg-align"),un(["mrel","x-arrow"],[f],e)},mathmlBuilder(t,e){var n=LC(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var i=tM(cs(t.body,e));if(t.below){var s=tM(cs(t.below,e));r=new gn("munderover",[n,s,i])}else r=new gn("mover",[n,i])}else if(t.below){var o=tM(cs(t.below,e));r=new gn("munder",[n,o])}else r=tM(),r=new gn("mover",[n,r]);return r}});function HX(t,e){var n=ga(t.body,e,!0);return un([t.mclass],n,e)}function GX(t,e){var n,r=$c(t.body,e);return t.mclass==="minner"?n=new gn("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new gn("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new gn("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}In({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:jo(i),isCharacterBox:Bp(i)}},htmlBuilder:HX,mathmlBuilder:GX});var FC=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"};In({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:FC(e[0]),body:jo(e[1]),isCharacterBox:Bp(e[1])}}});In({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=FC(i):o="mrel";var a={type:"op",mode:i.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:jo(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:Bp(l)}},htmlBuilder:HX,mathmlBuilder:GX});In({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:FC(e[0]),body:jo(e[0])}},htmlBuilder(t,e){var n=ga(t.body,e,!0),r=un([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=$c(t.body,e),r=new gn("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var T_e={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},cj=()=>({type:"styling",body:[],mode:"math",style:"display"}),uj=t=>t.type==="textord"&&t.text==="@",C_e=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function E_e(t,e,n){var r=T_e[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 A_e(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 mn("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],i=[r],s=0;s<e.length;s++){for(var o=e[s],a=cj(),l=0;l<o.length;l++)if(!uj(o[l]))a.body.push(o[l]);else{r.push(a),l+=1;var c=gP(o[l]).text,f=new Array(2);if(f[0]={type:"ordgroup",mode:"math",body:[]},f[1]={type:"ordgroup",mode:"math",body:[]},!"=|.".includes(c))if("<>AV".includes(c))for(var h=0;h<2;h++){for(var m=!0,x=l+1;x<o.length;x++){if(C_e(o[x],c)){m=!1,l=x;break}if(uj(o[x]))throw new mn("Missing a "+c+" character to complete a CD arrow.",o[x]);f[h].body.push(o[x])}if(m)throw new mn("Missing a "+c+" character to complete a CD arrow.",o[l])}else throw new mn('Expected one of "<>AV=|." after @',o[l]);var b=E_e(c,f,t),_={type:"styling",body:[b],mode:"math",style:"display"};r.push(_),a=cj()}s%2===0?r.push(a):r.shift(),r=[],i.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var S=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:S,colSeparationType:"CD",hLinesBeforeRow:new Array(i.length+1).fill([])}}In({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=Dy(_i(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Mn(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new gn("mrow",[cs(t.label,e)]);return n=new gn("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new gn("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});In({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=Dy(_i(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new gn("mrow",[cs(t.fragment,e)])}});In({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Ur(e[0],"ordgroup"),i=r.body,s="",o=0;o<i.length;o++){var a=Ur(i[o],"textord");s+=a.text}var l=parseInt(s),c;if(isNaN(l))throw new mn("\\@char has non-numeric argument "+s);if(l<0||l>=1114111)throw new mn("\\@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 VX=(t,e)=>{var n=ga(t.body,e.withColor(t.color),!1);return Gp(n)},WX=(t,e)=>{var n=$c(t.body,e.withColor(t.color)),r=new gn("mstyle",n);return r.setAttribute("mathcolor",t.color),r};In({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Ur(e[0],"color-token").color,i=e[1];return{type:"color",mode:n.mode,color:r,body:jo(i)}},htmlBuilder:VX,mathmlBuilder:WX});In({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,i=Ur(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:VX,mathmlBuilder:WX});In({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&&Ur(i,"size").value}},htmlBuilder(t,e){var n=un(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Mn(ao(t.size,e)))),n},mathmlBuilder(t,e){var n=new gn("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Mn(ao(t.size,e)))),n}});var wR={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},$X=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new mn("Expected a control sequence",t);return e},N_e=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},qX=(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)};In({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(wR[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=wR[r.text]),Ur(e.parseFunction(),"internal");throw new mn("Invalid token after macro prefix",r)}});In({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 mn("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 mn('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==s+1)throw new mn('Argument number "'+r.text+'" out of order');s++,a.push([])}else{if(r.text==="EOF")throw new mn("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===wR[n]),{type:"internal",mode:e.mode}}});In({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=$X(e.gullet.popToken());e.gullet.consumeSpaces();var i=N_e(e);return qX(e,r,i,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});In({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=$X(e.gullet.popToken()),i=e.gullet.popToken(),s=e.gullet.popToken();return qX(e,r,s,n==="\\\\globalfuture"),e.gullet.pushToken(s),e.gullet.pushToken(i),{type:"internal",mode:e.mode}}});var Q_=function(e,n,r){var i=bs.math[e]&&bs.math[e].replace,s=uP(i||e,n,r);if(!s)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return s},vP=function(e,n,r,i){var s=r.havingBaseStyle(n),o=un(i.concat(s.sizingClasses(r)),[e],r),a=s.sizeMultiplier/r.sizeMultiplier;return o.height*=a,o.depth*=a,o.maxFontSize=s.sizeMultiplier,o},XX=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=Mn(s),e.height-=s,e.depth+=s},k_e=function(e,n,r,i,s,o){var a=Vl(e,"Main-Regular",s,i),l=vP(a,n,i,o);return XX(l,i,n),l},R_e=function(e,n,r,i){return Vl(e,"Size"+n+"-Regular",r,i)},YX=function(e,n,r,i,s,o){var a=R_e(e,n,s,i),l=vP(un(["delimsizing","size"+n],[a],i),_r.TEXT,i,o);return r&&XX(l,i,_r.TEXT),l},w6=function(e,n,r){var i;n==="Size1-Regular"?i="delim-size1":i="delim-size4";var s=un(["delimsizinginner",i],[un([],[Vl(e,n,r)])]);return{type:"elem",elem:s}},S6=function(e,n,r){var i=oh["Size4-Regular"][e.charCodeAt(0)]?oh["Size4-Regular"][e.charCodeAt(0)][4]:oh["Size1-Regular"][e.charCodeAt(0)][4],s=new E0("inner",$be(e,Math.round(1e3*n))),o=new Ip([s],{width:Mn(i),height:Mn(n),style:"width:"+Mn(i),viewBox:"0 0 "+1e3*i+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),a=A0([],[o],r);return a.height=n,a.style.height=Mn(n),a.style.width=Mn(i),{type:"elem",elem:a}},SR=.008,nM={type:"kern",size:-1*SR},P_e=new Set(["|","\\lvert","\\rvert","\\vert"]),I_e=new Set(["\\|","\\lVert","\\rVert","\\Vert"]),KX=function(e,n,r,i,s,o){var a,l,c,f,h="",m=0;a=c=f=e,l=null;var x="Size1-Regular";e==="\\uparrow"?c=f="⏐":e==="\\Uparrow"?c=f="‖":e==="\\downarrow"?a=c="⏐":e==="\\Downarrow"?a=c="‖":e==="\\updownarrow"?(a="\\uparrow",c="⏐",f="\\downarrow"):e==="\\Updownarrow"?(a="\\Uparrow",c="‖",f="\\Downarrow"):P_e.has(e)?(c="∣",h="vert",m=333):I_e.has(e)?(c="∥",h="doublevert",m=556):e==="["||e==="\\lbrack"?(a="⎡",c="⎢",f="⎣",x="Size4-Regular",h="lbrack",m=667):e==="]"||e==="\\rbrack"?(a="⎤",c="⎥",f="⎦",x="Size4-Regular",h="rbrack",m=667):e==="\\lfloor"||e==="⌊"?(c=a="⎢",f="⎣",x="Size4-Regular",h="lfloor",m=667):e==="\\lceil"||e==="⌈"?(a="⎡",c=f="⎢",x="Size4-Regular",h="lceil",m=667):e==="\\rfloor"||e==="⌋"?(c=a="⎥",f="⎦",x="Size4-Regular",h="rfloor",m=667):e==="\\rceil"||e==="⌉"?(a="⎤",c=f="⎥",x="Size4-Regular",h="rceil",m=667):e==="("||e==="\\lparen"?(a="⎛",c="⎜",f="⎝",x="Size4-Regular",h="lparen",m=875):e===")"||e==="\\rparen"?(a="⎞",c="⎟",f="⎠",x="Size4-Regular",h="rparen",m=875):e==="\\{"||e==="\\lbrace"?(a="⎧",l="⎨",f="⎩",c="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(a="⎫",l="⎬",f="⎭",c="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(a="⎧",f="⎩",c="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(a="⎫",f="⎭",c="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(a="⎧",f="⎭",c="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(a="⎫",f="⎩",c="⎪",x="Size4-Regular");var b=Q_(a,x,s),_=b.height+b.depth,S=Q_(c,x,s),M=S.height+S.depth,T=Q_(f,x,s),A=T.height+T.depth,N=0,D=1;if(l!==null){var k=Q_(l,x,s);N=k.height+k.depth,D=2}var O=_+A+N,R=Math.max(0,Math.ceil((n-O)/(D*M))),L=O+R*D*M,B=i.fontMetrics().axisHeight;r&&(B*=i.sizeMultiplier);var H=L/2-B,$=[];if(h.length>0){var G=L-_-A,Z=Math.round(L*1e3),V=qbe(h,Math.round(G*1e3)),W=new E0(h,V),J=(m/1e3).toFixed(3)+"em",ne=(Z/1e3).toFixed(3)+"em",ie=new Ip([W],{width:J,height:ne,viewBox:"0 0 "+m+" "+Z}),z=A0([],[ie],i);z.height=Z/1e3,z.style.width=J,z.style.height=ne,$.push({type:"elem",elem:z})}else{if($.push(w6(f,x,s)),$.push(nM),l===null){var j=L-_-A+2*SR;$.push(S6(c,j,i))}else{var X=(L-_-A-N)/2+2*SR;$.push(S6(c,X,i)),$.push(nM),$.push(w6(l,x,s)),$.push(nM),$.push(S6(c,X,i))}$.push(nM),$.push(w6(a,x,s))}var F=i.havingBaseStyle(_r.TEXT),ce=Ei({positionType:"bottom",positionData:H,children:$});return vP(un(["delimsizing","mult"],[ce],F),_r.TEXT,i,o)},M6=80,T6=.08,C6=function(e,n,r,i,s){var o=Wbe(e,i,r),a=new E0(e,o),l=new Ip([a],{width:"400em",height:Mn(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return A0(["hide-tail"],[l],s)},D_e=function(e,n){var r=n.havingBaseSizing(),i=tY("\\surd",e*r.sizeMultiplier,eY,r),s=r.sizeMultiplier,o=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),a,l=0,c=0,f=0,h;return i.type==="small"?(f=1e3+1e3*o+M6,e<1?s=1:e<1.4&&(s=.7),l=(1+o+T6)/s,c=(1+o)/s,a=C6("sqrtMain",l,f,o,n),a.style.minWidth="0.853em",h=.833/s):i.type==="large"?(f=(1e3+M6)*pw[i.size],c=(pw[i.size]+o)/s,l=(pw[i.size]+o+T6)/s,a=C6("sqrtSize"+i.size,l,f,o,n),a.style.minWidth="1.02em",h=1/s):(l=e+o+T6,c=e+o,f=Math.floor(1e3*e+o)+M6,a=C6("sqrtTall",l,f,o,n),a.style.minWidth="0.742em",h=1.056),a.height=c,a.style.height=Mn(l),{span:a,advanceWidth:h,ruleWidth:(n.fontMetrics().sqrtRuleThickness+o)*s}},ZX=new Set(["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"]),O_e=new Set(["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"]),QX=new Set(["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"]),pw=[0,1.2,1.8,2.4,3],JX=function(e,n,r,i,s){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),ZX.has(e)||QX.has(e))return YX(e,n,!1,r,i,s);if(O_e.has(e))return KX(e,pw[n],!1,r,i,s);throw new mn("Illegal delimiter: '"+e+"'")},L_e=[{type:"small",style:_r.SCRIPTSCRIPT},{type:"small",style:_r.SCRIPT},{type:"small",style:_r.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],j_e=[{type:"small",style:_r.SCRIPTSCRIPT},{type:"small",style:_r.SCRIPT},{type:"small",style:_r.TEXT},{type:"stack"}],eY=[{type:"small",style:_r.SCRIPTSCRIPT},{type:"small",style:_r.SCRIPT},{type:"small",style:_r.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],z_e=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.")},tY=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=Q_(e,z_e(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]},MR=function(e,n,r,i,s,o){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var a;QX.has(e)?a=L_e:ZX.has(e)?a=eY:a=j_e;var l=tY(e,n,a,i);return l.type==="small"?k_e(e,l.style,r,i,s,o):l.type==="large"?YX(e,l.size,r,i,s,o):KX(e,n,r,i,s,o)},E6=function(e,n,r,i,s,o){var a=i.fontMetrics().axisHeight*i.sizeMultiplier,l=901,c=5/i.fontMetrics().ptPerEm,f=Math.max(n-a,r+a),h=Math.max(f/500*l,2*f-c);return MR(e,h,!0,i,s,o)},dj={"\\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}},F_e=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 UC(t,e){var n=zC(t);if(n&&F_e.has(n.text))return n;throw n?new mn("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new mn("Invalid delimiter type '"+t.type+"'",t)}In({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=UC(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:dj[t.funcName].size,mclass:dj[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?un([t.mclass]):JX(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(gd(t.delim,t.mode));var n=new gn("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Mn(pw[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function fj(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}In({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 mn("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:UC(e[0],t).text,color:n}}});In({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=UC(e[0],t),r=t.parser;++r.leftrightDepth;var i=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var s=Ur(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:i,left:n.text,right:s.delim,rightColor:s.color}},htmlBuilder:(t,e)=>{fj(t);for(var n=ga(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=$w(e,["mopen"]):a=E6(t.left,r,i,e,t.mode,["mopen"]),n.unshift(a),s)for(var l=1;l<n.length;l++){var c=n[l],f=c.isMiddle;f&&(n[l]=E6(f.delim,r,i,f.options,t.mode,[]))}var h;if(t.right===".")h=$w(e,["mclose"]);else{var m=t.rightColor?e.withColor(t.rightColor):e;h=E6(t.right,r,i,m,t.mode,["mclose"])}return n.push(h),un(["minner"],n,e)},mathmlBuilder:(t,e)=>{fj(t);var n=$c(t.body,e);if(t.left!=="."){var r=new gn("mo",[gd(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var i=new gn("mo",[gd(t.right,t.mode)]);i.setAttribute("fence","true"),t.rightColor&&i.setAttribute("mathcolor",t.rightColor),n.push(i)}return pP(n)}});In({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=UC(e[0],t);if(!t.parser.leftrightDepth)throw new mn("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=$w(e,[]);else{n=JX(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==="|"?gd("|","text"):gd(t.delim,t.mode),r=new gn("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var yP=(t,e)=>{var n=Dy(_i(t.body,e),e),r=t.label.slice(1),i=e.sizeMultiplier,s,o=0,a=Bp(t.body);if(r==="sout")s=un(["stretchy","sout"]),s.height=e.fontMetrics().defaultRuleThickness/i,o=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var l=ao({number:.6,unit:"pt"},e),c=ao({number:.35,unit:"ex"},e),f=e.havingBaseSizing();i=i/f.sizeMultiplier;var h=n.height+n.depth+l+c;n.style.paddingLeft=Mn(h/2+l);var m=Math.floor(1e3*h*i),x=Gbe(m),b=new Ip([new E0("phase",x)],{width:"400em",height:Mn(m/1e3),viewBox:"0 0 400000 "+m,preserveAspectRatio:"xMinYMin slice"});s=A0(["hide-tail"],[b],e),s.style.height=Mn(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,S=0,M=0;/box/.test(r)?(M=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),_=e.fontMetrics().fboxsep+(r==="colorbox"?0:M),S=_):r==="angl"?(M=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),_=4*M,S=Math.max(0,.25-n.depth)):(_=a?.2:0,S=_),s=S_e(n,r,_,S,e),/fbox|boxed|fcolorbox/.test(r)?(s.style.borderStyle="solid",s.style.borderWidth=Mn(M)):r==="angl"&&M!==.049&&(s.style.borderTopWidth=Mn(M),s.style.borderRightWidth=Mn(M)),o=n.depth+S,t.backgroundColor&&(s.style.backgroundColor=t.backgroundColor,t.borderColor&&(s.style.borderColor=t.borderColor))}var T;if(t.backgroundColor)T=Ei({positionType:"individualShift",children:[{type:"elem",elem:s,shift:o},{type:"elem",elem:n,shift:0}]});else{var A=/cancel|phase/.test(r)?["svg-align"]:[];T=Ei({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:s,shift:o,wrapperClasses:A}]})}return/cancel/.test(r)&&(T.height=n.height,T.depth=n.depth),/cancel/.test(r)&&!a?un(["mord","cancel-lap"],[T],e):un(["mord"],[T],e)},bP=(t,e)=>{var n=0,r=new gn(t.label.includes("colorbox")?"mpadded":"menclose",[cs(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};In({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Ur(e[0],"color-token").color,o=e[1];return{type:"enclose",mode:r.mode,label:i,backgroundColor:s,body:o}},htmlBuilder:yP,mathmlBuilder:bP});In({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:i}=t,s=Ur(e[0],"color-token").color,o=Ur(e[1],"color-token").color,a=e[2];return{type:"enclose",mode:r.mode,label:i,backgroundColor:o,borderColor:s,body:a}},htmlBuilder:yP,mathmlBuilder:bP});In({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]}}});In({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:yP,mathmlBuilder:bP});In({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 nY={};function Mh(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)nY[n[l]]=a;s&&(x5[e]=s),o&&(v5[e]=o)}var rY={};function Be(t,e){rY[t]=e}function hj(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 BC=t=>{var e=t.parser.settings;if(!e.displayMode)throw new mn("{"+t.envName+"} can be used only in display mode.")},U_e=new Set(["gather","gather*"]);function _P(t){if(!t.includes("ed"))return!t.includes("*")}function Y0(t,e,n){var{hskipBeforeAndAfter:r,addJot:i,cols:s,arraystretch:o,colSeparationType:a,autoTag:l,singleRow:c,emptySingleRow:f,maxNumCols:h,leqno:m}=e;if(t.gullet.beginGroup(),c||t.gullet.macros.set("\\cr","\\\\\\relax"),!o){var x=t.gullet.expandMacroAsText("\\arraystretch");if(x==null)o=1;else if(o=parseFloat(x),!o||o<0)throw new mn("Invalid \\arraystretch: "+x)}t.gullet.beginGroup();var b=[],_=[b],S=[],M=[],T=l!=null?[]:void 0;function A(){l&&t.gullet.macros.set("\\@eqnsw","1",!0)}function N(){T&&(t.gullet.macros.get("\\df@tag")?(T.push(t.subparse([new xu("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):T.push(!!l&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(A(),M.push(hj(t));;){var D=t.parseExpression(!1,c?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),D={type:"ordgroup",mode:t.mode,body:D},n&&(D={type:"styling",mode:t.mode,style:n,body:[D]}),b.push(D);var k=t.fetch().text;if(k==="&"){if(h&&b.length===h){if(c||a)throw new mn("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(k==="\\end"){N(),b.length===1&&D.type==="styling"&&D.body[0].body.length===0&&(_.length>1||!f)&&_.pop(),M.length<_.length+1&&M.push([]);break}else if(k==="\\\\"){t.consume();var O=void 0;t.gullet.future().text!==" "&&(O=t.parseSizeGroup(!0)),S.push(O?O.value:null),N(),M.push(hj(t)),b=[],_.push(b),A()}else throw new mn("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:S,hskipBeforeAndAfter:r,hLinesBeforeRow:M,colSeparationType:a,tags:T,leqno:m}}function wP(t){return t.slice(0,1)==="d"?"display":"text"}var Th=function(e,n){var r,i,s=e.body.length,o=e.hLinesBeforeRow,a=0,l=new Array(s),c=[],f=Math.max(n.fontMetrics().arrayRuleWidth,n.minRuleThickness),h=1/n.fontMetrics().ptPerEm,m=5*h;if(e.colSeparationType&&e.colSeparationType==="small"){var x=n.havingStyle(_r.SCRIPT).sizeMultiplier;m=.2778*(x/n.sizeMultiplier)}var b=e.colSeparationType==="CD"?ao({number:3,unit:"ex"},n):12*h,_=3*h,S=e.arraystretch*b,M=.7*S,T=.3*S,A=0;function N(Le){for(var ze=0;ze<Le.length;++ze)ze>0&&(A+=.25),c.push({pos:A,isDashed:Le[ze]})}for(N(o[0]),r=0;r<e.body.length;++r){var D=e.body[r],k=M,O=T;a<D.length&&(a=D.length);var R=new Array(D.length);for(i=0;i<D.length;++i){var L=_i(D[i],n);O<L.depth&&(O=L.depth),k<L.height&&(k=L.height),R[i]=L}var B=e.rowGaps[r],H=0;B&&(H=ao(B,n),H>0&&(H+=T,O<H&&(O=H),H=0)),e.addJot&&(O+=_),R.height=k,R.depth=O,A+=k,R.pos=A,A+=O+H,l[r]=R,N(o[r+1])}var $=A/2+n.fontMetrics().axisHeight,G=e.cols||[],Z=[],V,W,J=[];if(e.tags&&e.tags.some(Le=>Le))for(r=0;r<s;++r){var ne=l[r],ie=ne.pos-$,z=e.tags[r],j=void 0;z===!0?j=un(["eqn-num"],[],n):z===!1?j=un([],[],n):j=un([],ga(z,n,!0),n),j.depth=ne.depth,j.height=ne.height,J.push({type:"elem",elem:j,shift:ie})}for(i=0,W=0;i<a||W<G.length;++i,++W){for(var X=G[W]||{},F=!0;X.type==="separator";){if(F||(V=un(["arraycolsep"],[]),V.style.width=Mn(n.fontMetrics().doubleRuleSep),Z.push(V)),X.separator==="|"||X.separator===":"){var ce=X.separator==="|"?"solid":"dashed",oe=un(["vertical-separator"],[],n);oe.style.height=Mn(A),oe.style.borderRightWidth=Mn(f),oe.style.borderRightStyle=ce,oe.style.margin="0 "+Mn(-f/2);var Q=A-$;Q&&(oe.style.verticalAlign=Mn(-Q)),Z.push(oe)}else throw new mn("Invalid separator type: "+X.separator);W++,X=G[W]||{},F=!1}if(!(i>=a)){var se=void 0;if(i>0||e.hskipBeforeAndAfter){var re;se=(re=X.pregap)!=null?re:m,se!==0&&(V=un(["arraycolsep"],[]),V.style.width=Mn(se),Z.push(V))}var K=[];for(r=0;r<s;++r){var fe=l[r],he=fe[i];if(he){var ae=fe.pos-$;he.depth=fe.depth,he.height=fe.height,K.push({type:"elem",elem:he,shift:ae})}}if(K=Ei({positionType:"individualShift",children:K}),K=un(["col-align-"+(X.align||"c")],[K]),Z.push(K),i<a-1||e.hskipBeforeAndAfter){var Se;se=(Se=X.postgap)!=null?Se:m,se!==0&&(V=un(["arraycolsep"],[]),V.style.width=Mn(se),Z.push(V))}}}if(l=un(["mtable"],Z),c.length>0){for(var de=Iy("hline",n,f),Me=Iy("hdashline",n,f),Ce=[{type:"elem",elem:l,shift:0}];c.length>0;){var Re=c.pop(),le=Re.pos-$;Re.isDashed?Ce.push({type:"elem",elem:Me,shift:le}):Ce.push({type:"elem",elem:de,shift:le})}l=Ei({positionType:"individualShift",children:Ce})}if(J.length===0)return un(["mord"],[l],n);var He=Ei({positionType:"individualShift",children:J});return He=un(["tag"],[He],n),Gp([l,He])},B_e={c:"center ",l:"left ",r:"right "},Ch=function(e,n){for(var r=[],i=new gn("mtd",[],["mtr-glue"]),s=new gn("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 gn("mtd",[cs(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 gn("mtr",l))}var f=new gn("mtable",r),h=e.arraystretch===.5?.1:.16+e.arraystretch-1+(e.addJot?.09:0);f.setAttribute("rowspacing",Mn(h));var m="",x="";if(e.cols&&e.cols.length>0){var b=e.cols,_="",S=!1,M=0,T=b.length;b[0].type==="separator"&&(m+="top ",M=1),b[b.length-1].type==="separator"&&(m+="bottom ",T-=1);for(var A=M;A<T;A++)b[A].type==="align"?(x+=B_e[b[A].align],S&&(_+="none "),S=!0):b[A].type==="separator"&&S&&(_+=b[A].separator==="|"?"solid ":"dashed ",S=!1);f.setAttribute("columnalign",x.trim()),/[sd]/.test(_)&&f.setAttribute("columnlines",_.trim())}if(e.colSeparationType==="align"){for(var N=e.cols||[],D="",k=1;k<N.length;k++)D+=k%2?"0em ":"1em ";f.setAttribute("columnspacing",D.trim())}else e.colSeparationType==="alignat"||e.colSeparationType==="gather"?f.setAttribute("columnspacing","0em"):e.colSeparationType==="small"?f.setAttribute("columnspacing","0.2778em"):e.colSeparationType==="CD"?f.setAttribute("columnspacing","0.5em"):f.setAttribute("columnspacing","1em");var O="",R=e.hLinesBeforeRow;m+=R[0].length>0?"left ":"",m+=R[R.length-1].length>0?"right ":"";for(var L=1;L<R.length-1;L++)O+=R[L].length===0?"none ":R[L][0]?"dashed ":"solid ";return/[sd]/.test(O)&&f.setAttribute("rowlines",O.trim()),m!==""&&(f=new gn("menclose",[f]),f.setAttribute("notation",m.trim())),e.arraystretch&&e.arraystretch<1&&(f=new gn("mstyle",[f]),f.setAttribute("scriptlevel","1")),f},iY=function(e,n){e.envName.includes("ed")||BC(e);var r=[],i=e.envName.includes("at")?"alignat":"align",s=e.envName==="split",o=Y0(e.parser,{cols:r,addJot:!0,autoTag:s?void 0:_P(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 f="",h=0;h<n[0].body.length;h++){var m=Ur(n[0].body[h],"textord");f+=m.text}a=Number(f),l=a*2}var x=!l;o.body.forEach(function(M){for(var T=1;T<M.length;T+=2){var A=Ur(M[T],"styling"),N=Ur(A.body[0],"ordgroup");N.body.unshift(c)}if(x)l<M.length&&(l=M.length);else{var D=M.length/2;if(a<D)throw new mn("Too many math in a row: "+("expected "+a+", but got "+D),M[0])}});for(var b=0;b<l;++b){var _="r",S=0;b%2===1?_="l":b>0&&x&&(S=1),r[b]={type:"align",align:_,pregap:S,postgap:0}}return o.colSeparationType=x?"align":"alignat",o};Mh({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=zC(e[0]),r=n?[e[0]]:Ur(e[0],"ordgroup").body,i=r.map(function(o){var a=gP(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 mn("Unknown column alignment: "+l,o)}),s={cols:i,hskipBeforeAndAfter:!0,maxNumCols:i.length};return Y0(t.parser,s,wP(t.envName))},htmlBuilder:Th,mathmlBuilder:Ch});Mh({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 mn("Expected l or c or r",i.nextToken);i.consume(),i.consumeSpaces(),i.expect("]"),i.consume(),r.cols=[{type:"align",align:n}]}}var s=Y0(t.parser,r,wP(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:Th,mathmlBuilder:Ch});Mh({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Y0(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:Th,mathmlBuilder:Ch});Mh({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=zC(e[0]),r=n?[e[0]]:Ur(e[0],"ordgroup").body,i=r.map(function(o){var a=gP(o),l=a.text;if("lc".includes(l))return{type:"align",align:l};throw new mn("Unknown column alignment: "+l,o)});if(i.length>1)throw new mn("{subarray} can contain only one column");var s={cols:i,hskipBeforeAndAfter:!1,arraystretch:.5};if(s=Y0(t.parser,s,"script"),s.body.length>0&&s.body[0].length>1)throw new mn("{subarray} can contain only one column");return s},htmlBuilder:Th,mathmlBuilder:Ch});Mh({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=Y0(t.parser,e,wP(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.includes("r")?".":"\\{",right:t.envName.includes("r")?"\\}":".",rightColor:void 0}},htmlBuilder:Th,mathmlBuilder:Ch});Mh({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:iY,htmlBuilder:Th,mathmlBuilder:Ch});Mh({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){U_e.has(t.envName)&&BC(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:_P(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Y0(t.parser,e,"display")},htmlBuilder:Th,mathmlBuilder:Ch});Mh({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:iY,htmlBuilder:Th,mathmlBuilder:Ch});Mh({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){BC(t);var e={autoTag:_P(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Y0(t.parser,e,"display")},htmlBuilder:Th,mathmlBuilder:Ch});Mh({type:"array",names:["CD"],props:{numArgs:0},handler(t){return BC(t),A_e(t.parser)},htmlBuilder:Th,mathmlBuilder:Ch});Be("\\nonumber","\\gdef\\@eqnsw{0}");Be("\\notag","\\nonumber");In({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new mn(t.funcName+" valid only within array environment")}});var pj=nY;In({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 mn("Invalid environment name",i);for(var s="",o=0;o<i.body.length;++o)s+=Ur(i.body[o],"textord").text;if(r==="\\begin"){if(!pj.hasOwnProperty(s))throw new mn("No such environment: "+s,i);var a=pj[s],{args:l,optArgs:c}=n.parseArguments("\\begin{"+s+"}",a),f={mode:n.mode,envName:s,parser:n},h=a.handler(f,l,c);n.expect("\\end",!1);var m=n.nextToken,x=Ur(n.parseFunction(),"environment");if(x.name!==s)throw new mn("Mismatch: \\begin{"+s+"} matched by \\end{"+x.name+"}",m);return h}return{type:"environment",mode:n.mode,name:s,nameGroup:i}}});var sY=(t,e)=>{var n=t.font,r=e.withFont(n);return _i(t.body,r)},oY=(t,e)=>{var n=t.font,r=e.withFont(n);return cs(t.body,r)},mj={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};In({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=y5(e[0]),s=r;return s in mj&&(s=mj[s]),{type:"font",mode:n.mode,font:s.slice(1),body:i}},htmlBuilder:sY,mathmlBuilder:oY});In({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:FC(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:Bp(r)}}});In({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:sY,mathmlBuilder:oY});var H_e=(t,e)=>{var n=e.style,r=n.fracNum(),i=n.fracDen(),s;s=e.havingStyle(r);var o=_i(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=_i(t.denom,s,e),f,h,m;t.hasBarLine?(t.barSize?(h=ao(t.barSize,e),f=Iy("frac-line",e,h)):f=Iy("frac-line",e),h=f.height,m=f.height):(f=null,h=0,m=e.fontMetrics().defaultRuleThickness);var x,b,_;n.size===_r.DISPLAY.size?(x=e.fontMetrics().num1,h>0?b=3*m:b=7*m,_=e.fontMetrics().denom1):(h>0?(x=e.fontMetrics().num2,b=m):(x=e.fontMetrics().num3,b=3*m),_=e.fontMetrics().denom2);var S;if(f){var T=e.fontMetrics().axisHeight;x-o.depth-(T+.5*h)<b&&(x+=b-(x-o.depth-(T+.5*h))),T-.5*h-(c.height-_)<b&&(_+=b-(T-.5*h-(c.height-_)));var A=-(T-.5*h);S=Ei({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:f,shift:A},{type:"elem",elem:o,shift:-x}]})}else{var M=x-o.depth-(c.height-_);M<b&&(x+=.5*(b-M),_+=.5*(b-M)),S=Ei({positionType:"individualShift",children:[{type:"elem",elem:c,shift:_},{type:"elem",elem:o,shift:-x}]})}s=e.havingStyle(n),S.height*=s.sizeMultiplier/e.sizeMultiplier,S.depth*=s.sizeMultiplier/e.sizeMultiplier;var N;n.size===_r.DISPLAY.size?N=e.fontMetrics().delim1:n.size===_r.SCRIPTSCRIPT.size?N=e.havingStyle(_r.SCRIPT).fontMetrics().delim2:N=e.fontMetrics().delim2;var D,k;return t.leftDelim==null?D=$w(e,["mopen"]):D=MR(t.leftDelim,N,!0,e.havingStyle(n),t.mode,["mopen"]),t.continued?k=un([]):t.rightDelim==null?k=$w(e,["mclose"]):k=MR(t.rightDelim,N,!0,e.havingStyle(n),t.mode,["mclose"]),un(["mord"].concat(s.sizingClasses(e)),[D,un(["mfrac"],[S]),k],e)},G_e=(t,e)=>{var n=new gn("mfrac",[cs(t.numer,e),cs(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=ao(t.barSize,e);n.setAttribute("linethickness",Mn(r))}if(t.leftDelim!=null||t.rightDelim!=null){var i=[];if(t.leftDelim!=null){var s=new gn("mo",[new Jo(t.leftDelim.replace("\\",""))]);s.setAttribute("fence","true"),i.push(s)}if(i.push(n),t.rightDelim!=null){var o=new gn("mo",[new Jo(t.rightDelim.replace("\\",""))]);o.setAttribute("fence","true"),i.push(o)}return pP(i)}return n},aY=(t,e)=>{if(!e)return t;var n={type:"styling",mode:t.mode,style:e,body:[t]};return n};In({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",f=null;return c||r.startsWith("\\d")?f="display":r.startsWith("\\t")&&(f="text"),aY({type:"genfrac",mode:n.mode,numer:i,denom:s,continued:c,hasBarLine:o,leftDelim:a,rightDelim:l,barSize:null},f)},htmlBuilder:H_e,mathmlBuilder:G_e});In({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 gj=["display","text","script","scriptscript"],xj=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};In({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=y5(e[0]),o=s.type==="atom"&&s.family==="open"?xj(s.text):null,a=y5(e[1]),l=a.type==="atom"&&a.family==="close"?xj(a.text):null,c=Ur(e[2],"size"),f,h=null;c.isBlank?f=!0:(h=c.value,f=h.number>0);var m=null,x=e[3];if(x.type==="ordgroup"){if(x.body.length>0){var b=Ur(x.body[0],"textord");m=gj[Number(b.text)]}}else x=Ur(x,"textord"),m=gj[Number(x.text)];return aY({type:"genfrac",mode:n.mode,numer:r,denom:i,continued:!1,hasBarLine:f,barSize:h,leftDelim:o,rightDelim:l},m)}});In({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:Ur(e[0],"size").value,token:i}}});In({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,i=e[0],s=Ur(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 lY=(t,e)=>{var n=e.style,r,i;t.type==="supsub"?(r=t.sup?_i(t.sup,e.havingStyle(n.sup()),e):_i(t.sub,e.havingStyle(n.sub()),e),i=Ur(t.base,"horizBrace")):i=Ur(t,"horizBrace");var s=_i(i.base,e.havingBaseStyle(_r.DISPLAY)),o=jC(i,e),a;if(i.isOver?(a=Ei({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=Ei({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=un(["mord",i.isOver?"mover":"munder"],[a],e);i.isOver?a=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:l},{type:"kern",size:.2},{type:"elem",elem:r}]}):a=Ei({positionType:"bottom",positionData:l.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:l}]})}return un(["mord",i.isOver?"mover":"munder"],[a],e)},V_e=(t,e)=>{var n=LC(t.label);return new gn(t.isOver?"mover":"munder",[cs(t.base,e),n])};In({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:lY,mathmlBuilder:V_e});In({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],i=Ur(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:i})?{type:"href",mode:n.mode,href:i,body:jo(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=ga(t.body,e,!1);return a_e(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=N0(t.body,e);return n instanceof gn||(n=new gn("mrow",[n])),n.setAttribute("href",t.href),n}});In({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Ur(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:jo(a)}}});In({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:jo(e[0])}},htmlBuilder(t,e){var n=ga(t.body,e,!1);return Gp(n)},mathmlBuilder(t,e){return new gn("mrow",$c(t.body,e))}});In({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=Ur(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(","),f=0;f<c.length;f++){var h=c[f],m=h.indexOf("=");if(m<0)throw new mn("\\htmlData key/value '"+h+"' missing equals sign");var x=h.slice(0,m),b=h.slice(m+1);l["data-"+x.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:jo(o)}:n.formatUnsupportedCmd(r)},htmlBuilder:(t,e)=>{var n=ga(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var i=un(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)=>N0(t.body,e)});In({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:jo(e[0]),mathml:jo(e[1])}},htmlBuilder:(t,e)=>{var n=ga(t.html,e,!1);return Gp(n)},mathmlBuilder:(t,e)=>N0(t.mathml,e)});var A6=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 mn("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!CX(r))throw new mn("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};In({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=Ur(n[0],"raw").string,c=l.split(","),f=0;f<c.length;f++){var h=c[f].split("=");if(h.length===2){var m=h[1].trim();switch(h[0].trim()){case"alt":a=m;break;case"width":i=A6(m);break;case"height":s=A6(m);break;case"totalheight":o=A6(m);break;default:throw new mn("Invalid key: '"+h[0]+"' in \\includegraphics.")}}}var x=Ur(e[0],"url").url;return a===""&&(a=x,a=a.replace(/^.*[\\/]/,""),a=a.substring(0,a.lastIndexOf("."))),r.settings.isTrusted({command:"\\includegraphics",url:x})?{type:"includegraphics",mode:r.mode,alt:a,width:i,height:s,totalheight:o,src:x}:r.formatUnsupportedCmd("\\includegraphics")},htmlBuilder:(t,e)=>{var n=ao(t.height,e),r=0;t.totalheight.number>0&&(r=ao(t.totalheight,e)-n);var i=0;t.width.number>0&&(i=ao(t.width,e));var s={height:Mn(n+r)};i>0&&(s.width=Mn(i)),r>0&&(s.verticalAlign=Mn(-r));var o=new Jbe(t.src,t.alt,s);return o.height=n,o.depth=r,o},mathmlBuilder:(t,e)=>{var n=new gn("mglyph",[]);n.setAttribute("alt",t.alt);var r=ao(t.height,e),i=0;if(t.totalheight.number>0&&(i=ao(t.totalheight,e)-r,n.setAttribute("valign",Mn(-i))),n.setAttribute("height",Mn(r+i)),t.width.number>0){var s=ao(t.width,e);n.setAttribute("width",Mn(s))}return n.setAttribute("src",t.src),n}});In({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=Ur(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 PX(t.dimension,e)},mathmlBuilder(t,e){var n=ao(t.dimension,e);return new zX(n)}});In({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=un([],[_i(t.body,e)]),n=un(["inner"],[n],e)):n=un(["inner"],[_i(t.body,e)]);var r=un(["fix"],[]),i=un([t.alignment],[n,r],e),s=un(["strut"]);return s.style.height=Mn(i.height+i.depth),i.depth&&(s.style.verticalAlign=Mn(-i.depth)),i.children.unshift(s),i=un(["thinbox"],[i],e),un(["mord","vbox"],[i],e)},mathmlBuilder:(t,e)=>{var n=new gn("mpadded",[cs(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}});In({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}}});In({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new mn("Mismatched "+t.funcName)}});var vj=(t,e)=>{switch(e.style.size){case _r.DISPLAY.size:return t.display;case _r.TEXT.size:return t.text;case _r.SCRIPT.size:return t.script;case _r.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};In({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:jo(e[0]),text:jo(e[1]),script:jo(e[2]),scriptscript:jo(e[3])}},htmlBuilder:(t,e)=>{var n=vj(t,e),r=ga(n,e,!1);return Gp(r)},mathmlBuilder:(t,e)=>{var n=vj(t,e);return N0(n,e)}});var cY=(t,e,n,r,i,s,o)=>{t=un([],[t]);var a=n&&Bp(n),l,c;if(e){var f=_i(e,r.havingStyle(i.sup()),r);c={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-f.depth)}}if(n){var h=_i(n,r.havingStyle(i.sub()),r);l={elem:h,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-h.height)}}var m;if(c&&l){var x=r.fontMetrics().bigOpSpacing5+l.elem.height+l.elem.depth+l.kern+t.depth+o;m=Ei({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Mn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Mn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else if(l){var b=t.height-o;m=Ei({positionType:"top",positionData:b,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:l.elem,marginLeft:Mn(-s)},{type:"kern",size:l.kern},{type:"elem",elem:t}]})}else if(c){var _=t.depth+o;m=Ei({positionType:"bottom",positionData:_,children:[{type:"elem",elem:t},{type:"kern",size:c.kern},{type:"elem",elem:c.elem,marginLeft:Mn(s)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]})}else return t;var S=[m];if(l&&s!==0&&!a){var M=un(["mspace"],[],r);M.style.marginRight=Mn(s),S.unshift(M)}return un(["mop","op-limits"],S,r)},uY=new Set(["\\smallint"]),ab=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Ur(t.base,"op"),i=!0):s=Ur(t,"op");var o=e.style,a=!1;o.size===_r.DISPLAY.size&&s.symbol&&!uY.has(s.name)&&(a=!0);var l;if(s.symbol){var c=a?"Size2-Regular":"Size1-Regular",f="";if((s.name==="\\oiint"||s.name==="\\oiiint")&&(f=s.name.slice(1),s.name=f==="oiint"?"\\iint":"\\iiint"),l=Vl(s.name,c,"math",e,["mop","op-symbol",a?"large-op":"small-op"]),f.length>0){var h=l.italic,m=DX(f+"Size"+(a?"2":"1"),e);l=Ei({positionType:"individualShift",children:[{type:"elem",elem:l,shift:0},{type:"elem",elem:m,shift:a?.08:0}]}),s.name="\\"+f,l.classes.unshift("mop"),l.italic=h}}else if(s.body){var x=ga(s.body,e,!0);x.length===1&&x[0]instanceof md?(l=x[0],l.classes[0]="mop"):l=un(["mop"],x,e)}else{for(var b=[],_=1;_<s.name.length;_++)b.push(fP(s.name[_],s.mode,e));l=un(["mop"],b,e)}var S=0,M=0;return(l instanceof md||s.name==="\\oiint"||s.name==="\\oiiint")&&!s.suppressBaseShift&&(S=(l.height-l.depth)/2-e.fontMetrics().axisHeight,M=l.italic),i?cY(l,n,r,e,o,M,S):(S&&(l.style.position="relative",l.style.top=Mn(S)),l)},YS=(t,e)=>{var n;if(t.symbol)n=new gn("mo",[gd(t.name,t.mode)]),uY.has(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new gn("mo",$c(t.body,e));else{n=new gn("mi",[new Jo(t.name.slice(1))]);var r=new gn("mo",[gd("⁡","text")]);t.parentIsSupSub?n=new gn("mrow",[n,r]):n=jX([n,r])}return n},W_e={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};In({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=W_e[i]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:i}},htmlBuilder:ab,mathmlBuilder:YS});In({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:jo(r)}},htmlBuilder:ab,mathmlBuilder:YS});var $_e={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};In({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:ab,mathmlBuilder:YS});In({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:ab,mathmlBuilder:YS});In({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=$_e[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:ab,mathmlBuilder:YS});var dY=(t,e)=>{var n,r,i=!1,s;t.type==="supsub"?(n=t.sup,r=t.sub,s=Ur(t.base,"operatorname"),i=!0):s=Ur(t,"operatorname");var o;if(s.body.length>0){for(var a=s.body.map(h=>{var m=h.text;return typeof m=="string"?{type:"textord",mode:h.mode,text:m}:h}),l=ga(a,e.withFont("mathrm"),!0),c=0;c<l.length;c++){var f=l[c];f instanceof md&&(f.text=f.text.replace(/\u2212/,"-").replace(/\u2217/,"*"))}o=un(["mop"],l,e)}else o=un(["mop"],[],e);return i?cY(o,n,r,e,e.style,0,0):o},q_e=(t,e)=>{for(var n=$c(t.body,e.withFont("mathrm")),r=!0,i=0;i<n.length;i++){var s=n[i];if(!(s instanceof zX))if(s instanceof gn)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 Jo?o.text=o.text.replace(/\u2212/,"-").replace(/\u2217/,"*"):r=!1;break}default:r=!1}else r=!1}if(r){var a=n.map(f=>f.toText()).join("");n=[new Jo(a)]}var l=new gn("mi",n);l.setAttribute("mathvariant","normal");var c=new gn("mo",[gd("⁡","text")]);return t.parentIsSupSub?new gn("mrow",[l,c]):jX([l,c])};In({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:jo(i),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:dY,mathmlBuilder:q_e});Be("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Yx({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?Gp(ga(t.body,e,!1)):un(["mord"],ga(t.body,e,!0),e)},mathmlBuilder(t,e){return N0(t.body,e,!0)}});In({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=_i(t.body,e.havingCrampedStyle()),r=Iy("overline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*i},{type:"elem",elem:r},{type:"kern",size:i}]});return un(["mord","overline"],[s],e)},mathmlBuilder(t,e){var n=new gn("mo",[new Jo("‾")]);n.setAttribute("stretchy","true");var r=new gn("mover",[cs(t.body,e),n]);return r.setAttribute("accent","true"),r}});In({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:jo(r)}},htmlBuilder:(t,e)=>{var n=ga(t.body,e.withPhantom(),!1);return Gp(n)},mathmlBuilder:(t,e)=>{var n=$c(t.body,e);return new gn("mphantom",n)}});In({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=un([],[_i(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=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:n}]}),un(["mord"],[n],e)},mathmlBuilder:(t,e)=>{var n=$c(jo(t.body),e),r=new gn("mphantom",n),i=new gn("mpadded",[r]);return i.setAttribute("height","0px"),i.setAttribute("depth","0px"),i}});In({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=un(["inner"],[_i(t.body,e.withPhantom())]),r=un(["fix"],[]);return un(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=$c(jo(t.body),e),r=new gn("mphantom",n),i=new gn("mpadded",[r]);return i.setAttribute("width","0px"),i}});In({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Ur(e[0],"size").value,i=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:i}},htmlBuilder(t,e){var n=_i(t.body,e),r=ao(t.dy,e);return Ei({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){var n=new gn("mpadded",[cs(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});In({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});In({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=Ur(e[0],"size"),o=Ur(e[1],"size");return{type:"rule",mode:r.mode,shift:i&&Ur(i,"size").value,width:s.value,height:o.value}},htmlBuilder(t,e){var n=un(["mord","rule"],[],e),r=ao(t.width,e),i=ao(t.height,e),s=t.shift?ao(t.shift,e):0;return n.style.borderRightWidth=Mn(r),n.style.borderTopWidth=Mn(i),n.style.bottom=Mn(s),n.width=r,n.height=i+s,n.depth=-s,n.maxFontSize=i*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=ao(t.width,e),r=ao(t.height,e),i=t.shift?ao(t.shift,e):0,s=e.color&&e.getColor()||"black",o=new gn("mspace");o.setAttribute("mathbackground",s),o.setAttribute("width",Mn(n)),o.setAttribute("height",Mn(r));var a=new gn("mpadded",[o]);return i>=0?a.setAttribute("height",Mn(i)):(a.setAttribute("height",Mn(i)),a.setAttribute("depth",Mn(-i))),a.setAttribute("voffset",Mn(i)),a}});function fY(t,e,n){for(var r=ga(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 Gp(r)}var yj=["\\tiny","\\sixptsize","\\scriptsize","\\footnotesize","\\small","\\normalsize","\\large","\\Large","\\LARGE","\\huge","\\Huge"],X_e=(t,e)=>{var n=e.havingSize(t.size);return fY(t.body,n,e)};In({type:"sizing",names:yj,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:yj.indexOf(r)+1,body:s}},htmlBuilder:X_e,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=$c(t.body,n),i=new gn("mstyle",r);return i.setAttribute("mathsize",Mn(n.sizeMultiplier)),i}});In({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]&&Ur(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 f=e[0];return{type:"smash",mode:r.mode,body:f,smashHeight:i,smashDepth:s}},htmlBuilder:(t,e)=>{var n=un([],[_i(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=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:n}]});return un(["mord"],[s],e)},mathmlBuilder:(t,e)=>{var n=new gn("mpadded",[cs(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});In({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=_i(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=Dy(n,e);var r=e.fontMetrics(),i=r.defaultRuleThickness,s=i;e.style.id<_r.TEXT.id&&(s=e.fontMetrics().xHeight);var o=i+s/4,a=n.height+n.depth+o+i,{span:l,ruleWidth:c,advanceWidth:f}=D_e(a,e),h=l.height-c;h>n.height+n.depth+o&&(o=(o+h-n.height-n.depth)/2);var m=l.height-n.height-o-c;n.style.paddingLeft=Mn(f);var x=Ei({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+m)},{type:"elem",elem:l},{type:"kern",size:c}]});if(t.index){var b=e.havingStyle(_r.SCRIPTSCRIPT),_=_i(t.index,b,e),S=.6*(x.height-x.depth),M=Ei({positionType:"shift",positionData:-S,children:[{type:"elem",elem:_}]}),T=un(["root"],[M]);return un(["mord","sqrt"],[T,x],e)}else return un(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new gn("mroot",[cs(n,e),cs(r,e)]):new gn("msqrt",[cs(n,e)])}});var bj={display:_r.DISPLAY,text:_r.TEXT,script:_r.SCRIPT,scriptscript:_r.SCRIPTSCRIPT};In({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=bj[t.style],r=e.havingStyle(n).withFont("");return fY(t.body,r,e)},mathmlBuilder(t,e){var n=bj[t.style],r=e.havingStyle(n),i=$c(t.body,r),s=new gn("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 Y_e=function(e,n){var r=e.base;if(r)if(r.type==="op"){var i=r.limits&&(n.style.size===_r.DISPLAY.size||r.alwaysHandleSupSub);return i?ab:null}else if(r.type==="operatorname"){var s=r.alwaysHandleSupSub&&(n.style.size===_r.DISPLAY.size||r.limits);return s?dY:null}else{if(r.type==="accent")return Bp(r.base)?xP:null;if(r.type==="horizBrace"){var o=!e.sub;return o===r.isOver?lY:null}else return null}else return null};Yx({type:"supsub",htmlBuilder(t,e){var n=Y_e(t,e);if(n)return n(t,e);var{base:r,sup:i,sub:s}=t,o=_i(r,e),a,l,c=e.fontMetrics(),f=0,h=0,m=r&&Bp(r);if(i){var x=e.havingStyle(e.style.sup());a=_i(i,x,e),m||(f=o.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(s){var b=e.havingStyle(e.style.sub());l=_i(s,b,e),m||(h=o.depth+b.fontMetrics().subDrop*b.sizeMultiplier/e.sizeMultiplier)}var _;e.style===_r.DISPLAY?_=c.sup1:e.style.cramped?_=c.sup3:_=c.sup2;var S=e.sizeMultiplier,M=Mn(.5/c.ptPerEm/S),T=null;if(l){var A=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(o instanceof md||A)&&(T=Mn(-o.italic))}var N;if(a&&l){f=Math.max(f,_,a.depth+.25*c.xHeight),h=Math.max(h,c.sub2);var D=c.defaultRuleThickness,k=4*D;if(f-a.depth-(l.height-h)<k){h=k-(f-a.depth)+l.height;var O=.8*c.xHeight-(f-a.depth);O>0&&(f+=O,h-=O)}var R=[{type:"elem",elem:l,shift:h,marginRight:M,marginLeft:T},{type:"elem",elem:a,shift:-f,marginRight:M}];N=Ei({positionType:"individualShift",children:R})}else if(l){h=Math.max(h,c.sub1,l.height-.8*c.xHeight);var L=[{type:"elem",elem:l,marginLeft:T,marginRight:M}];N=Ei({positionType:"shift",positionData:h,children:L})}else if(a)f=Math.max(f,_,a.depth+.25*c.xHeight),N=Ei({positionType:"shift",positionData:-f,children:[{type:"elem",elem:a,marginRight:M}]});else throw new Error("supsub must have either sup or sub.");var B=bR(o,"right")||"mord";return un([B],[o,un(["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=[cs(t.base,e)];t.sub&&s.push(cs(t.sub,e)),t.sup&&s.push(cs(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===_r.DISPLAY||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(e.style===_r.DISPLAY||c.limits)?o="munderover":o="msubsup"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===_r.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===_r.DISPLAY)?o="munder":o="msub"}else{var a=t.base;a&&a.type==="op"&&a.limits&&(e.style===_r.DISPLAY||a.alwaysHandleSupSub)||a&&a.type==="operatorname"&&a.alwaysHandleSupSub&&(a.limits||e.style===_r.DISPLAY)?o="mover":o="msup"}return new gn(o,s)}});Yx({type:"atom",htmlBuilder(t,e){return fP(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new gn("mo",[gd(t.text,t.mode)]);if(t.family==="bin"){var r=mP(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 hY={mi:"italic",mn:"normal",mtext:"normal"};Yx({type:"mathord",htmlBuilder(t,e){return OC(t,e,"mathord")},mathmlBuilder(t,e){var n=new gn("mi",[gd(t.text,t.mode,e)]),r=mP(t,e)||"italic";return r!==hY[n.type]&&n.setAttribute("mathvariant",r),n}});Yx({type:"textord",htmlBuilder(t,e){return OC(t,e,"textord")},mathmlBuilder(t,e){var n=gd(t.text,t.mode,e),r=mP(t,e)||"normal",i;return t.mode==="text"?i=new gn("mtext",[n]):/[0-9]/.test(t.text)?i=new gn("mn",[n]):t.text==="\\prime"?i=new gn("mo",[n]):i=new gn("mi",[n]),r!==hY[i.type]&&i.setAttribute("mathvariant",r),i}});var N6={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},k6={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Yx({type:"spacing",htmlBuilder(t,e){if(k6.hasOwnProperty(t.text)){var n=k6[t.text].className||"";if(t.mode==="text"){var r=OC(t,e,"textord");return r.classes.push(n),r}else return un(["mspace",n],[fP(t.text,t.mode,e)],e)}else{if(N6.hasOwnProperty(t.text))return un(["mspace",N6[t.text]],[],e);throw new mn('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(k6.hasOwnProperty(t.text))n=new gn("mtext",[new Jo(" ")]);else{if(N6.hasOwnProperty(t.text))return new gn("mspace");throw new mn('Unknown type of space "'+t.text+'"')}return n}});var _j=()=>{var t=new gn("mtd",[]);return t.setAttribute("width","50%"),t};Yx({type:"tag",mathmlBuilder(t,e){var n=new gn("mtable",[new gn("mtr",[_j(),new gn("mtd",[N0(t.body,e)]),_j(),new gn("mtd",[N0(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var wj={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},Sj={"\\textbf":"textbf","\\textmd":"textmd"},K_e={"\\textit":"textit","\\textup":"textup"},Mj=(t,e)=>{var n=t.font;if(n){if(wj[n])return e.withTextFontFamily(wj[n]);if(Sj[n])return e.withTextFontWeight(Sj[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(K_e[n])};In({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:jo(i),font:r}},htmlBuilder(t,e){var n=Mj(t,e),r=ga(t.body,n,!0);return un(["mord","text"],r,n)},mathmlBuilder(t,e){var n=Mj(t,e);return N0(t.body,n)}});In({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=_i(t.body,e),r=Iy("underline-line",e),i=e.fontMetrics().defaultRuleThickness,s=Ei({positionType:"top",positionData:n.height,children:[{type:"kern",size:i},{type:"elem",elem:r},{type:"kern",size:3*i},{type:"elem",elem:n}]});return un(["mord","underline"],[s],e)},mathmlBuilder(t,e){var n=new gn("mo",[new Jo("‾")]);n.setAttribute("stretchy","true");var r=new gn("munder",[cs(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});In({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=_i(t.body,e),r=e.fontMetrics().axisHeight,i=.5*(n.height-r-(n.depth+r));return Ei({positionType:"shift",positionData:i,children:[{type:"elem",elem:n}]})},mathmlBuilder(t,e){return new gn("mpadded",[cs(t.body,e)],["vcenter"])}});In({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new mn("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=Tj(t),r=[],i=e.havingStyle(e.style.text()),s=0;s<n.length;s++){var o=n[s];o==="~"&&(o="\\textasciitilde"),r.push(Vl(o,"Typewriter-Regular",t.mode,i,["mord","texttt"]))}return un(["mord","text"].concat(i.sizingClasses(e)),RX(r),i)},mathmlBuilder(t,e){var n=new Jo(Tj(t)),r=new gn("mtext",[n]);return r.setAttribute("mathvariant","monospace"),r}});var Tj=t=>t.body.replace(/ /g,t.star?"␣":" "),c0=OX,pY=`[ \r
	]`,Z_e="\\\\[a-zA-Z@]+",Q_e="\\\\[^\uD800-\uDFFF]",J_e="("+Z_e+")"+pY+"*",ewe=`\\\\(
|[ \r	]+
?)[ \r	]*`,TR="[̀-ͯ]",twe=new RegExp(TR+"+$"),nwe="("+pY+"+)|"+(ewe+"|")+"([!-\\[\\]-‧‪-퟿豈-]"+(TR+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(TR+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+J_e)+("|"+Q_e+")");class Cj{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(nwe,"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 xu("EOF",new Oc(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new mn("Unexpected character: '"+e[n]+"'",new xu(e[n],new Oc(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 xu(i,new Oc(this,n,this.tokenRegex.lastIndex))}}class rwe{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 mn("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 iwe=rY;Be("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});Be("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});Be("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});Be("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});Be("\\@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}});Be("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Be("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var Ej={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};Be("\\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 mn("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=Ej[e.text],r==null||r>=n)throw new mn("Invalid base-"+n+" digit "+e.text);for(var i;(i=Ej[t.future().text])!=null&&i<n;)r*=n,r+=i,t.popToken()}return"\\@char{"+r+"}"});var SP=(t,e,n,r)=>{var i=t.consumeArg().tokens;if(i.length!==1)throw new mn("\\newcommand's first argument must be a macro name");var s=i[0].text,o=t.isDefined(s);if(o&&!e)throw new mn("\\newcommand{"+s+"} attempting to redefine "+(s+"; use \\renewcommand"));if(!o&&!n)throw new mn("\\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 mn("Invalid number of arguments: "+l);a=parseInt(l),i=t.consumeArg().tokens}return o&&r||t.macros.set(s,{tokens:i,numArgs:a}),""};Be("\\newcommand",t=>SP(t,!1,!0,!1));Be("\\renewcommand",t=>SP(t,!0,!1,!1));Be("\\providecommand",t=>SP(t,!0,!0,!0));Be("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});Be("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});Be("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),c0[n],bs.math[n],bs.text[n]),""});Be("\\bgroup","{");Be("\\egroup","}");Be("~","\\nobreakspace");Be("\\lq","`");Be("\\rq","'");Be("\\aa","\\r a");Be("\\AA","\\r A");Be("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Be("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Be("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Be("ℬ","\\mathscr{B}");Be("ℰ","\\mathscr{E}");Be("ℱ","\\mathscr{F}");Be("ℋ","\\mathscr{H}");Be("ℐ","\\mathscr{I}");Be("ℒ","\\mathscr{L}");Be("ℳ","\\mathscr{M}");Be("ℛ","\\mathscr{R}");Be("ℭ","\\mathfrak{C}");Be("ℌ","\\mathfrak{H}");Be("ℨ","\\mathfrak{Z}");Be("\\Bbbk","\\Bbb{k}");Be("·","\\cdotp");Be("\\llap","\\mathllap{\\textrm{#1}}");Be("\\rlap","\\mathrlap{\\textrm{#1}}");Be("\\clap","\\mathclap{\\textrm{#1}}");Be("\\mathstrut","\\vphantom{(}");Be("\\underbar","\\underline{\\text{#1}}");Be("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}');Be("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Be("\\ne","\\neq");Be("≠","\\neq");Be("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Be("∉","\\notin");Be("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Be("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Be("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Be("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Be("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Be("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Be("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Be("⟂","\\perp");Be("‼","\\mathclose{!\\mkern-0.8mu!}");Be("∌","\\notni");Be("⌜","\\ulcorner");Be("⌝","\\urcorner");Be("⌞","\\llcorner");Be("⌟","\\lrcorner");Be("©","\\copyright");Be("®","\\textregistered");Be("️","\\textregistered");Be("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Be("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Be("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Be("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Be("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Be("⋮","\\vdots");Be("\\varGamma","\\mathit{\\Gamma}");Be("\\varDelta","\\mathit{\\Delta}");Be("\\varTheta","\\mathit{\\Theta}");Be("\\varLambda","\\mathit{\\Lambda}");Be("\\varXi","\\mathit{\\Xi}");Be("\\varPi","\\mathit{\\Pi}");Be("\\varSigma","\\mathit{\\Sigma}");Be("\\varUpsilon","\\mathit{\\Upsilon}");Be("\\varPhi","\\mathit{\\Phi}");Be("\\varPsi","\\mathit{\\Psi}");Be("\\varOmega","\\mathit{\\Omega}");Be("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Be("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Be("\\boxed","\\fbox{$\\displaystyle{#1}$}");Be("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Be("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Be("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Be("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Be("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var Aj={",":"\\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"},swe=new Set(["bin","rel"]);Be("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in Aj?e=Aj[n]:(n.slice(0,4)==="\\not"||n in bs.math&&swe.has(bs.math[n].group))&&(e="\\dotsb"),e});var MP={")":!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};Be("\\dotso",function(t){var e=t.future().text;return e in MP?"\\ldots\\,":"\\ldots"});Be("\\dotsc",function(t){var e=t.future().text;return e in MP&&e!==","?"\\ldots\\,":"\\ldots"});Be("\\cdots",function(t){var e=t.future().text;return e in MP?"\\@cdots\\,":"\\@cdots"});Be("\\dotsb","\\cdots");Be("\\dotsm","\\cdots");Be("\\dotsi","\\!\\cdots");Be("\\dotsx","\\ldots\\,");Be("\\DOTSI","\\relax");Be("\\DOTSB","\\relax");Be("\\DOTSX","\\relax");Be("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Be("\\,","\\tmspace+{3mu}{.1667em}");Be("\\thinspace","\\,");Be("\\>","\\mskip{4mu}");Be("\\:","\\tmspace+{4mu}{.2222em}");Be("\\medspace","\\:");Be("\\;","\\tmspace+{5mu}{.2777em}");Be("\\thickspace","\\;");Be("\\!","\\tmspace-{3mu}{.1667em}");Be("\\negthinspace","\\!");Be("\\negmedspace","\\tmspace-{4mu}{.2222em}");Be("\\negthickspace","\\tmspace-{5mu}{.277em}");Be("\\enspace","\\kern.5em ");Be("\\enskip","\\hskip.5em\\relax");Be("\\quad","\\hskip1em\\relax");Be("\\qquad","\\hskip2em\\relax");Be("\\tag","\\@ifstar\\tag@literal\\tag@paren");Be("\\tag@paren","\\tag@literal{({#1})}");Be("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new mn("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Be("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Be("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Be("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Be("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Be("\\newline","\\\\\\relax");Be("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var mY=Mn(oh["Main-Regular"][84][1]-.7*oh["Main-Regular"][65][1]);Be("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+mY+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Be("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+mY+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Be("\\hspace","\\@ifstar\\@hspacer\\@hspace");Be("\\@hspace","\\hskip #1\\relax");Be("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Be("\\ordinarycolon",":");Be("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Be("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Be("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Be("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Be("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Be("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Be("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Be("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Be("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Be("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Be("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Be("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Be("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Be("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Be("∷","\\dblcolon");Be("∹","\\eqcolon");Be("≔","\\coloneqq");Be("≕","\\eqqcolon");Be("⩴","\\Coloneqq");Be("\\ratio","\\vcentcolon");Be("\\coloncolon","\\dblcolon");Be("\\colonequals","\\coloneqq");Be("\\coloncolonequals","\\Coloneqq");Be("\\equalscolon","\\eqqcolon");Be("\\equalscoloncolon","\\Eqqcolon");Be("\\colonminus","\\coloneq");Be("\\coloncolonminus","\\Coloneq");Be("\\minuscolon","\\eqcolon");Be("\\minuscoloncolon","\\Eqcolon");Be("\\coloncolonapprox","\\Colonapprox");Be("\\coloncolonsim","\\Colonsim");Be("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Be("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Be("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Be("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Be("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Be("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Be("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Be("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Be("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Be("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Be("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Be("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Be("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Be("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Be("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Be("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Be("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Be("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Be("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Be("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Be("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Be("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Be("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Be("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Be("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Be("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Be("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Be("\\imath","\\html@mathml{\\@imath}{ı}");Be("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Be("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Be("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Be("⟦","\\llbracket");Be("⟧","\\rrbracket");Be("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Be("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Be("⦃","\\lBrace");Be("⦄","\\rBrace");Be("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Be("⦵","\\minuso");Be("\\darr","\\downarrow");Be("\\dArr","\\Downarrow");Be("\\Darr","\\Downarrow");Be("\\lang","\\langle");Be("\\rang","\\rangle");Be("\\uarr","\\uparrow");Be("\\uArr","\\Uparrow");Be("\\Uarr","\\Uparrow");Be("\\N","\\mathbb{N}");Be("\\R","\\mathbb{R}");Be("\\Z","\\mathbb{Z}");Be("\\alef","\\aleph");Be("\\alefsym","\\aleph");Be("\\Alpha","\\mathrm{A}");Be("\\Beta","\\mathrm{B}");Be("\\bull","\\bullet");Be("\\Chi","\\mathrm{X}");Be("\\clubs","\\clubsuit");Be("\\cnums","\\mathbb{C}");Be("\\Complex","\\mathbb{C}");Be("\\Dagger","\\ddagger");Be("\\diamonds","\\diamondsuit");Be("\\empty","\\emptyset");Be("\\Epsilon","\\mathrm{E}");Be("\\Eta","\\mathrm{H}");Be("\\exist","\\exists");Be("\\harr","\\leftrightarrow");Be("\\hArr","\\Leftrightarrow");Be("\\Harr","\\Leftrightarrow");Be("\\hearts","\\heartsuit");Be("\\image","\\Im");Be("\\infin","\\infty");Be("\\Iota","\\mathrm{I}");Be("\\isin","\\in");Be("\\Kappa","\\mathrm{K}");Be("\\larr","\\leftarrow");Be("\\lArr","\\Leftarrow");Be("\\Larr","\\Leftarrow");Be("\\lrarr","\\leftrightarrow");Be("\\lrArr","\\Leftrightarrow");Be("\\Lrarr","\\Leftrightarrow");Be("\\Mu","\\mathrm{M}");Be("\\natnums","\\mathbb{N}");Be("\\Nu","\\mathrm{N}");Be("\\Omicron","\\mathrm{O}");Be("\\plusmn","\\pm");Be("\\rarr","\\rightarrow");Be("\\rArr","\\Rightarrow");Be("\\Rarr","\\Rightarrow");Be("\\real","\\Re");Be("\\reals","\\mathbb{R}");Be("\\Reals","\\mathbb{R}");Be("\\Rho","\\mathrm{P}");Be("\\sdot","\\cdot");Be("\\sect","\\S");Be("\\spades","\\spadesuit");Be("\\sub","\\subset");Be("\\sube","\\subseteq");Be("\\supe","\\supseteq");Be("\\Tau","\\mathrm{T}");Be("\\thetasym","\\vartheta");Be("\\weierp","\\wp");Be("\\Zeta","\\mathrm{Z}");Be("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Be("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Be("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Be("\\bra","\\mathinner{\\langle{#1}|}");Be("\\ket","\\mathinner{|{#1}\\rangle}");Be("\\braket","\\mathinner{\\langle{#1}\\rangle}");Be("\\Bra","\\left\\langle#1\\right|");Be("\\Ket","\\left|#1\\right\\rangle");var gY=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=>m=>{t&&(m.macros.set("|",o),i.length&&m.macros.set("\\|",a));var x=h;if(!h&&i.length){var b=m.future();b.text==="|"&&(m.popToken(),x=!0)}return{tokens:x?i:r,numArgs:0}};e.macros.set("|",l(!1)),i.length&&e.macros.set("\\|",l(!0));var c=e.consumeArg().tokens,f=e.expandTokens([...s,...c,...n]);return e.macros.endGroup(),{tokens:f.reverse(),numArgs:0}};Be("\\bra@ket",gY(!1));Be("\\bra@set",gY(!0));Be("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Be("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Be("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Be("\\angln","{\\angl n}");Be("\\blue","\\textcolor{##6495ed}{#1}");Be("\\orange","\\textcolor{##ffa500}{#1}");Be("\\pink","\\textcolor{##ff00af}{#1}");Be("\\red","\\textcolor{##df0030}{#1}");Be("\\green","\\textcolor{##28ae7b}{#1}");Be("\\gray","\\textcolor{gray}{#1}");Be("\\purple","\\textcolor{##9d38bd}{#1}");Be("\\blueA","\\textcolor{##ccfaff}{#1}");Be("\\blueB","\\textcolor{##80f6ff}{#1}");Be("\\blueC","\\textcolor{##63d9ea}{#1}");Be("\\blueD","\\textcolor{##11accd}{#1}");Be("\\blueE","\\textcolor{##0c7f99}{#1}");Be("\\tealA","\\textcolor{##94fff5}{#1}");Be("\\tealB","\\textcolor{##26edd5}{#1}");Be("\\tealC","\\textcolor{##01d1c1}{#1}");Be("\\tealD","\\textcolor{##01a995}{#1}");Be("\\tealE","\\textcolor{##208170}{#1}");Be("\\greenA","\\textcolor{##b6ffb0}{#1}");Be("\\greenB","\\textcolor{##8af281}{#1}");Be("\\greenC","\\textcolor{##74cf70}{#1}");Be("\\greenD","\\textcolor{##1fab54}{#1}");Be("\\greenE","\\textcolor{##0d923f}{#1}");Be("\\goldA","\\textcolor{##ffd0a9}{#1}");Be("\\goldB","\\textcolor{##ffbb71}{#1}");Be("\\goldC","\\textcolor{##ff9c39}{#1}");Be("\\goldD","\\textcolor{##e07d10}{#1}");Be("\\goldE","\\textcolor{##a75a05}{#1}");Be("\\redA","\\textcolor{##fca9a9}{#1}");Be("\\redB","\\textcolor{##ff8482}{#1}");Be("\\redC","\\textcolor{##f9685d}{#1}");Be("\\redD","\\textcolor{##e84d39}{#1}");Be("\\redE","\\textcolor{##bc2612}{#1}");Be("\\maroonA","\\textcolor{##ffbde0}{#1}");Be("\\maroonB","\\textcolor{##ff92c6}{#1}");Be("\\maroonC","\\textcolor{##ed5fa6}{#1}");Be("\\maroonD","\\textcolor{##ca337c}{#1}");Be("\\maroonE","\\textcolor{##9e034e}{#1}");Be("\\purpleA","\\textcolor{##ddd7ff}{#1}");Be("\\purpleB","\\textcolor{##c6b9fc}{#1}");Be("\\purpleC","\\textcolor{##aa87ff}{#1}");Be("\\purpleD","\\textcolor{##7854ab}{#1}");Be("\\purpleE","\\textcolor{##543b78}{#1}");Be("\\mintA","\\textcolor{##f5f9e8}{#1}");Be("\\mintB","\\textcolor{##edf2df}{#1}");Be("\\mintC","\\textcolor{##e0e5cc}{#1}");Be("\\grayA","\\textcolor{##f6f7f7}{#1}");Be("\\grayB","\\textcolor{##f0f1f2}{#1}");Be("\\grayC","\\textcolor{##e3e5e6}{#1}");Be("\\grayD","\\textcolor{##d6d8da}{#1}");Be("\\grayE","\\textcolor{##babec2}{#1}");Be("\\grayF","\\textcolor{##888d93}{#1}");Be("\\grayG","\\textcolor{##626569}{#1}");Be("\\grayH","\\textcolor{##3b3e40}{#1}");Be("\\grayI","\\textcolor{##21242c}{#1}");Be("\\kaBlue","\\textcolor{##314453}{#1}");Be("\\kaGreen","\\textcolor{##71B307}{#1}");var xY={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class owe{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 rwe(iwe,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new Cj(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 xu("EOF",r.loc)),this.pushTokens(i),new xu("",Oc.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 mn("Extra }",s)}else if(s.text==="EOF")throw new mn("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 mn("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 mn("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 mn("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 mn("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 mn("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 mn("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 xu(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 Cj(i,this.settings),l=[],c=a.lex();c.text!=="EOF";)l.push(c),c=a.lex();l.reverse();var f={tokens:l,numArgs:s};return f}return i}isDefined(e){return this.macros.has(e)||c0.hasOwnProperty(e)||bs.math.hasOwnProperty(e)||bs.text.hasOwnProperty(e)||xY.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:c0.hasOwnProperty(e)&&!c0[e].primitive}}var Nj=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,rM=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),R6={"́":{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"}},kj={á:"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 HC{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 owe(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 mn("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 xu("}")),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(HC.endOfExpression.has(i.text)||n&&i.text===n||e&&c0[i.text]&&c0[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 mn("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 mn("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 mn("Limit controls must follow a math operator",s);this.consume()}else if(s.text==="^"){if(r)throw new mn("Double superscript",s);r=this.handleSupSubscript("superscript")}else if(s.text==="_"){if(i)throw new mn("Double subscript",s);i=this.handleSupSubscript("subscript")}else if(s.text==="'"){if(r)throw new mn("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(rM[s.text]){var c=Nj.test(s.text),f=[];for(f.push(new xu(rM[s.text])),this.consume();;){var h=this.fetch().text;if(!rM[h]||Nj.test(h)!==c)break;f.unshift(new xu(rM[h])),this.consume()}var m=this.subparse(f);c?i={type:"ordgroup",mode:"math",body:m}:r={type:"ordgroup",mode:"math",body:m}}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=c0[i];if(!s)return null;if(this.consume(),n&&n!=="atom"&&!s.allowedInArgument)throw new mn("Got function '"+i+"' with no arguments"+(n?" as "+n:""),r);if(this.mode==="text"&&!s.allowedInText)throw new mn("Can't use function '"+i+"' in text mode",r);if(this.mode==="math"&&s.allowedInMath===!1)throw new mn("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=c0[e];if(a&&a.handler)return a.handler(o,n,r);throw new mn("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 mn("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 mn("A primitive argument cannot be optional");var o=this.parseGroup(e);if(o==null)throw new mn("Expected group as "+e,this.fetch());return o}case"original":case null:case void 0:return this.parseArgumentGroup(r);default:throw new mn("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 mn("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 mn("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 mn("Invalid size: '"+n.text+"'",n);var s={number:+(i[1]+i[2]),unit:i[3]};if(!CX(s))throw new mn("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:Oc.range(r,l),body:a,semisimple:i==="\\begingroup"||void 0}}else if(s=this.parseFunction(n,e)||this.parseSymbol(),s==null&&i[0]==="\\"&&!xY.hasOwnProperty(i)){if(this.settings.throwOnError)throw new mn("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:Oc.range(i,e[r+2]),text:"---"}),n-=2):(e.splice(r,2,{type:"textord",mode:"text",loc:Oc.range(i,e[r+1]),text:"--"}),n-=1)),(s==="'"||s==="`")&&e[r+1].text===s&&(e.splice(r,2,{type:"textord",mode:"text",loc:Oc.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 mn(`\\verb assertion failed --
                    please report what input caused this bug`);return r=r.slice(1,-1),{type:"verb",mode:"text",body:r,star:i}}kj.hasOwnProperty(n[0])&&!bs[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=kj[n[0]]+n.slice(1));var s=twe.exec(n);s&&(n=n.substring(0,s.index),n==="i"?n="ı":n==="j"&&(n="ȷ"));var o;if(bs[this.mode][n]){this.settings.strict&&this.mode==="math"&&vR.includes(n)&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var a=bs[this.mode][n].group,l=Oc.range(e),c;if(n_e.hasOwnProperty(a)){var f=a;c={type:"atom",mode:this.mode,family:f,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&&(TX(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:Oc.range(e),text:n};else return null;if(this.consume(),s)for(var h=0;h<s[0].length;h++){var m=s[0][h];if(!R6[m])throw new mn("Unknown accent ' "+m+"'",e);var x=R6[m][this.mode]||R6[m].text;if(!x)throw new mn("Accent "+m+" unsupported in "+this.mode+" mode",e);o={type:"accent",mode:this.mode,loc:Oc.range(e),label:x,isStretchy:!1,isShifty:!0,base:o}}return o}}HC.endOfExpression=new Set(["}","\\endgroup","\\end","\\right","&"]);var TP=function(e,n){if(!(typeof e=="string"||e instanceof String))throw new TypeError("KaTeX can only parse string typed expression");var r=new HC(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 mn("\\tag works only in display equations");i=[{type:"tag",mode:"text",body:i,tag:r.subparse([new xu("\\df@tag")])}]}return i},vY=function(e,n,r){n.textContent="";var i=CP(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."),vY=function(){throw new mn("KaTeX doesn't work in quirks mode.")});var awe=function(e,n){var r=CP(e,n).toMarkup();return r},lwe=function(e,n){var r=new lP(n);return TP(e,r)},yY=function(e,n,r){if(r.throwOnError||!(e instanceof mn))throw e;var i=un(["katex-error"],[new md(n)]);return i.setAttribute("title",e.toString()),i.setAttribute("style","color:"+r.errorColor),i},CP=function(e,n){var r=new lP(n);try{var i=TP(e,r);return v_e(i,e,r)}catch(s){return yY(s,e,r)}},cwe=function(e,n){var r=new lP(n);try{var i=TP(e,r);return y_e(i,e,r)}catch(s){return yY(s,e,r)}},uwe="0.16.33",dwe={Span:XS,Anchor:dP,SymbolNode:md,SvgNode:Ip,PathNode:E0,LineNode:xR},CR={version:uwe,render:vY,renderToString:awe,ParseError:mn,SETTINGS_SCHEMA:b2,__parse:lwe,__renderToDomTree:CP,__renderToHTMLTree:cwe,__setFontMetrics:Xbe,__defineSymbol:ee,__defineFunction:In,__defineMacro:Be,__domTree:dwe};const fwe={};function hwe(t){const e=this,n=t||fwe,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Mbe(n)),s.push(gbe()),o.push(xbe(n))}const Rj=/[#.]/g;function pwe(t,e){const n=t||"",r={};let i=0,s,o;for(;i<n.length;){Rj.lastIndex=i;const a=Rj.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 bY(t,e,n){const r=n?vwe(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=pwe(s,e);const c=l.tagName.toLowerCase(),f=r?r.get(c):void 0;if(l.tagName=f||c,mwe(o))a.unshift(o);else for(const[h,m]of Object.entries(o))gwe(t,l.properties,h,m)}for(const c of a)ER(l.children,c);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function mwe(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 gwe(t,e,n,r){const i=Xq(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=mL(r):i.commaSeparated?s=uL(r):i.commaOrSpaceSeparated?s=mL(uL(r).join(" ")):s=Pj(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?xwe(r):String(r);if(Array.isArray(s)){const o=[];for(const a of s)o.push(Pj(i,i.property,a));s=o}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function ER(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)ER(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?ER(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function Pj(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||Gw(n)===Gw(e)))return!0}return n}function xwe(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function vwe(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const ywe=["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"],bwe=bY(Yq,"div"),_we=bY(NC,"g",ywe),P6={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function wwe(t,e){return _Y(t,{})||{type:"root",children:[]}}function _Y(t,e){const n=Swe(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function Swe(t,e){switch(t.nodeType){case 1:return Ewe(t,e);case 3:return Twe(t);case 8:return Cwe(t);case 9:return Ij(t,e);case 10:return Mwe();case 11:return Ij(t,e);default:return}}function Ij(t,e){return{type:"root",children:wY(t,e)}}function Mwe(){return{type:"doctype"}}function Twe(t){return{type:"text",value:t.nodeValue||""}}function Cwe(t){return{type:"comment",value:t.nodeValue||""}}function Ewe(t,e){const n=t.namespaceURI,r=n===P6.svg?_we:bwe,i=n===P6.html?t.tagName.toLowerCase():t.tagName,s=n===P6.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,wY(s,e))}function wY(t,e){const n=t.childNodes,r=[];let i=-1;for(;++i<n.length;){const s=_Y(n[i],e);s!==void 0&&r.push(s)}return r}new DOMParser;function Awe(t,e){const n=Nwe(t);return wwe(n)}function Nwe(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const Dj=(function(t,e,n){const r=sP(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]}),Kx=(function(t){if(t==null)return Pwe;if(typeof t=="string")return Rwe(t);if(typeof t=="object")return kwe(t);if(typeof t=="function")return EP(t);throw new Error("Expected function, string, or array as `test`")});function kwe(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Kx(t[n]);return EP(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function Rwe(t){return EP(e);function e(n){return n.tagName===t}}function EP(t){return e;function e(n,r,i){return!!(Iwe(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function Pwe(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function Iwe(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const Oj=/\n/g,Lj=/[\t ]+/g,AR=Kx("br"),jj=Kx(Bwe),Dwe=Kx("p"),zj=Kx("tr"),Owe=Kx(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",Uwe,Hwe]),SY=Kx(["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 Lwe(t,e){const n=e||{},r="children"in t?t.children:[],i=SY(t),s=CY(t,{whitespace:n.whitespace||"normal"}),o=[];(t.type==="text"||t.type==="comment")&&o.push(...TY(t,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...MY(r[a],t,{whitespace:s,breakBefore:a?void 0:i,breakAfter:a<r.length-1?AR(r[a+1]):i}));const l=[];let c;for(a=-1;++a<o.length;){const f=o[a];typeof f=="number"?c!==void 0&&f>c&&(c=f):f&&(c!==void 0&&c>-1&&l.push(`
`.repeat(c)||" "),c=-1,l.push(f))}return l.join("")}function MY(t,e,n){return t.type==="element"?jwe(t,e,n):t.type==="text"?n.whitespace==="normal"?TY(t,n):zwe(t):[]}function jwe(t,e,n){const r=CY(t,n),i=t.children||[];let s=-1,o=[];if(Owe(t))return o;let a,l;for(AR(t)||zj(t)&&Dj(e,t,zj)?l=`
`:Dwe(t)?(a=2,l=2):SY(t)&&(a=1,l=1);++s<i.length;)o=o.concat(MY(i[s],t,{whitespace:r,breakBefore:s?void 0:a,breakAfter:s<i.length-1?AR(i[s+1]):l}));return jj(t)&&Dj(e,t,jj)&&o.push("	"),a&&o.unshift(a),l&&o.push(l),o}function TY(t,e){const n=String(t.value),r=[],i=[];let s=0;for(;s<=n.length;){Oj.lastIndex=s;const l=Oj.exec(n),c=l&&"index"in l?l.index:n.length;r.push(Fwe(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 zwe(t){return[String(t.value)]}function Fwe(t,e,n){const r=[];let i=0,s;for(;i<t.length;){Lj.lastIndex=i;const o=Lj.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 CY(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 Uwe(t){return!!(t.properties||{}).hidden}function Bwe(t){return t.tagName==="td"||t.tagName==="th"}function Hwe(t){return t.tagName==="dialog"&&!(t.properties||{}).open}const Gwe={},Vwe=[];function Wwe(t){const e=t||Gwe;return function(n,r){wX(n,"element",function(i,s){const o=Array.isArray(i.properties.className)?i.properties.className:Vwe,a=o.includes("language-math"),l=o.includes("math-display"),c=o.includes("math-inline");let f=l;if(!a&&!l&&!c)return;let h=s[s.length-1],m=i;if(i.tagName==="code"&&a&&h&&h.type==="element"&&h.tagName==="pre"&&(m=h,h=s[s.length-2],f=!0),!h)return;const x=Lwe(m,{whitespace:"pre"});let b;try{b=CR.renderToString(x,{...e,displayMode:f,throwOnError:!0})}catch(S){const M=S,T=M.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...s,i],cause:M,place:i.position,ruleId:T,source:"rehype-katex"});try{b=CR.renderToString(x,{...e,displayMode:f,strict:"ignore",throwOnError:!1})}catch{b=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(e.errorColor||"#cc0000"),title:String(S)},children:[{type:"text",value:x}]}]}}typeof b=="string"&&(b=Awe(b).children);const _=h.children.indexOf(m);return h.children.splice(_,1,...b),_X})}}function AP(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 KS(t){const e=new Map,n=AP(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 Dp(t){const e=new Map,n=AP(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;if(typeof(c==null?void 0:c.min)=="number"&&typeof(c==null?void 0:c.max)=="number"){const f={min:c.min,max:c.max};c.invert===!0&&(f.invert=!0),o.set(a,f)}}o.size>0&&e.set(i.name,o)}}return e}function ZS(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))if(typeof(o==null?void 0:o.min)=="number"&&typeof(o==null?void 0:o.max)=="number"){const a={min:o.min,max:o.max};o.invert===!0&&(a.invert=!0),i.set(s,a)}i.size>0&&e.set(n,i)}return e}function Op(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 $1({prompts:t,data:e,samplesData:n,rolloutMetrics:r,goldenAnswers:i,infoTurns:s,isLoading:o,step:a,scrollToSampleId:l=null,showGoTo:c=!1,goToBasePath:f="/rollouts",goToStepParam:h="step",filterGroupId:m=null,filterSampleIdx:x=null,lastValidSampleAtom:b=BW,collapseAllSignal:_=0,expandAllSignal:S=0,defaultSectionsOpen:M=!0,envRewardRanges:T,envMetricRanges:A,advantageRange:N,renderOptions:D=[],formatThinkBlocks:k=!0}){var re;const O=w.useMemo(()=>{if(!r)return new Map;const K=new Map;for(const fe of r){const he=K.get(fe.sample_idx)||[];he.push(fe),K.set(fe.sample_idx,he)}return K},[r]),R=w.useMemo(()=>{if(!r)return[];const K=new Set;for(const fe of r)K.add(fe.metric_name);return[...K].sort()},[r]),L=w.useMemo(()=>{if(!i)return new Map;const K=new Map;for(const fe of i){const he=K.get(fe.sample_idx)||[];he.push(fe),K.set(fe.sample_idx,he)}return K},[i]),B=w.useMemo(()=>{if(!s)return new Map;const K=new Map;for(const fe of s){const he=K.get(fe.sample_idx)||[];he.push(fe),K.set(fe.sample_idx,he)}return K},[s]),H=w.useMemo(()=>{if(!t)return new Map;const K=new Map;for(const fe of t)K.set(fe.group_id,fe);return K},[t]),$=w.useMemo(()=>{if(!n)return new Map;const K=new Map;for(const fe of n)K.set(fe.sample_idx,fe);return K},[n]),G=w.useMemo(()=>{if(!e)return[];const K=new Map,fe=new Map;for(const Se of e){const de=K.get(Se.sample_idx)||[];de.push(Se),K.set(Se.sample_idx,de),fe.set(Se.sample_idx,Se.group_id)}const he=[];for(const[Se,de]of K){const Me=[...de].sort((He,Le)=>He.turn_order-Le.turn_order),Ce=fe.get(Se)??-1,Re=H.get(Ce)??null,le=$.get(Se);he.push({sample_idx:Se,group_id:Ce,prompt:Re,turns:Me,reward:(le==null?void 0:le.reward)??null,advantage:(le==null?void 0:le.advantage)??null,total_tokens:(le==null?void 0:le.total_tokens)??null,raw_string:(le==null?void 0:le.raw_string)??null})}let ae=he.sort((Se,de)=>Se.sample_idx-de.sample_idx);return m!==null&&(ae=ae.filter(Se=>Se.group_id===m)),x!==null&&(ae=ae.filter(Se=>Se.sample_idx===x)),ae},[e,H,$,m,x]),[Z,V]=cn(b),W=G[0],J=(W==null?void 0:W.sample_idx)??null,ne=w.useMemo(()=>J!==null?O.get(J)??[]:[],[O,J]),ie=w.useMemo(()=>J!==null?L.get(J)??[]:[],[L,J]),z=w.useMemo(()=>J!==null?B.get(J)??[]:[],[B,J]);w.useEffect(()=>{!W||x===null||V({sample:W,rolloutMetrics:ne,goldenAnswers:ie})},[W,ne,ie,x,V]);const j=x!==null&&(Z==null?void 0:Z.sample.sample_idx)===x?Z:null,X=W||(j==null?void 0:j.sample),F=W?ne:(j==null?void 0:j.rolloutMetrics)||[],ce=W?ie:(j==null?void 0:j.goldenAnswers)||[],oe=W?z:[],Q=w.useRef(null);w.useEffect(()=>{if(l==null||Q.current===l)return;const K=document.getElementById(`sample-${l}`);K&&(K.scrollIntoView({behavior:"smooth",block:"start"}),Q.current=l)},[l,G]);const se=a!==void 0?a:(re=e==null?void 0:e[0])==null?void 0:re.step;return x===null?d.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground text-sm",children:d.jsx("p",{children:"Select a sample from the sidebar to view"})}):!X&&!o?d.jsx("div",{className:"flex items-center justify-center h-64 text-muted-foreground",children:d.jsx("p",{children:"No rollouts data available"})}):X?d.jsx("div",{className:"space-y-4 min-w-0",children:d.jsx($we,{sample:X,rolloutMetrics:F,goldenAnswers:ce,infoTurns:oe,availableMetricNames:R,showGoTo:c,goToStep:se,goToBasePath:f,goToStepParam:h,collapseAllSignal:_,expandAllSignal:S,defaultSectionsOpen:M,envRewardRanges:T,envMetricRanges:A,advantageRange:N,renderOptions:D,formatThinkBlocks:k},X.sample_idx)}):null}function $we({sample:t,rolloutMetrics:e,goldenAnswers:n,infoTurns:r,availableMetricNames:i,showGoTo:s,goToStep:o,goToBasePath:a="/rollouts",goToStepParam:l="step",collapseAllSignal:c=0,expandAllSignal:f=0,defaultSectionsOpen:h=!0,envRewardRanges:m,envMetricRanges:x,advantageRange:b,renderOptions:_=[],formatThinkBlocks:S=!0}){var ae,Se;const[M,T]=cn(Iue),A=M.length===0,N=M.length===1&&M[0]==="__none__",D=de=>A?!0:N?!1:M.includes(de),k=de=>{T(Me=>{if(Me.length===0)return i.filter(le=>le!==de);const Ce=Me.filter(le=>le!=="__none__");if(Ce.length===0)return[de];if(Ce.includes(de)){const le=Ce.filter(He=>He!==de);return le.length===0?["__none__"]:le}const Re=[...Ce,de];return i.length>0&&Re.length>=i.length?[]:Re})},O=w.useMemo(()=>[...e].sort((de,Me)=>de.metric_name.localeCompare(Me.metric_name)),[e]),R=w.useMemo(()=>M.length===0?O:O.filter(de=>M.includes(de.metric_name)),[O,M]),L=w.useMemo(()=>n.filter(de=>de.value!=null&&de.value!==""),[n]),B=((ae=t.prompt)==null?void 0:ae.env)??null,H=wT(),$=()=>{o!=null&&H(`${a}?${l}=${o}&group=${t.group_id}&sample=${t.sample_idx}`)},G=w.useMemo(()=>{if(!r||r.length===0)return new Map;const de=new Map;for(const Me of r){const Ce=de.get(Me.turn_order)||[];Ce.push(Me),de.set(Me.turn_order,Ce)}return de},[r]),[Z,V]=w.useState(!1),[W,J]=w.useState(!1),[ne,ie]=w.useState(h),[z,j]=w.useState({}),[X,F]=w.useState(c),[ce,oe]=w.useState(f),Q=t.turns.length;if(c!==X){F(c),V(!1),J(!1),ie(!1);const de={};for(let Me=0;Me<Q;Me++)de[Me]=!1;j(de)}if(f!==ce){oe(f),V(!0),J(!0),ie(!0);const de={};for(let Me=0;Me<Q;Me++)de[Me]=!0;j(de)}const se=de=>{j(Me=>({...Me,[de]:!Me[de]}))},re=B?m==null?void 0:m.get(B):void 0,K=[];B&&K.push({label:"Env",value:B});const fe=t.turns.filter(de=>de.turn_type==="model").length;if(fe>1&&K.push({label:"Turns",value:String(fe)}),t.reward!==null){const de=L6(t.reward,(re==null?void 0:re.min)??null,(re==null?void 0:re.max)??null);K.push({label:"Reward",value:t.reward.toFixed(2),rangeColor:de})}if(t.advantage!==null){const de=L6(t.advantage,(b==null?void 0:b.min)??null,(b==null?void 0:b.max)??null);K.push({label:"Advantage",value:t.advantage.toFixed(2),rangeColor:de})}const he=[];for(const de of R){const Me=de.env??B,Ce=rSe(x,Me,de.metric_name),Re=L6(de.value,(Ce==null?void 0:Ce.min)??null,(Ce==null?void 0:Ce.max)??null,Ce==null?void 0:Ce.invert);he.push({label:iM(de.metric_name),value:nSe(de.value),highlight:Re?void 0:de.value===1?"positive":de.value===0?"negative":void 0,rangeColor:Re})}return d.jsxs("div",{id:`sample-${t.sample_idx}`,children:[(K.length>0||he.length>0||s)&&d.jsxs("div",{className:"mb-2 space-y-0.5",children:[(K.length>0||s||i.length>0)&&d.jsxs("div",{className:"flex items-center gap-2 text-sm min-w-0 flex-wrap",children:[s&&d.jsx(Sn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs mr-1",onClick:$,disabled:o==null,children:"Go to"}),K.map((de,Me)=>d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[Me>0&&d.jsx("span",{className:"text-foreground/20",children:"·"}),d.jsx("span",{className:"text-muted-foreground",children:de.label}),d.jsx("span",{className:"font-medium tabular-nums text-foreground/80",style:de.rangeColor?{color:de.rangeColor}:void 0,children:de.value})]},de.label)),i.length>0&&d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs("button",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:underline cursor-pointer",children:["Sample Metrics",d.jsx(Rr,{className:"h-3 w-3"})]})}),d.jsxs($s,{align:"start",className:"w-max max-w-[400px]",children:[d.jsx(Mo,{onSelect:de=>{de.preventDefault(),T([])},children:"Select All"}),d.jsx(Mo,{onSelect:de=>{de.preventDefault(),T(["__none__"])},children:"Unselect All"}),d.jsx(ys,{}),i.map(de=>d.jsx(hr,{checked:D(de),onCheckedChange:()=>k(de),onSelect:Me=>Me.preventDefault(),children:iM(de)},de))]})]})]}),he.length>0&&d.jsx("div",{className:"flex items-center gap-1.5 text-xs min-w-0 flex-wrap",children:he.map((de,Me)=>d.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[d.jsx("span",{className:"text-muted-foreground",children:de.label}),d.jsx("span",{className:vt("font-medium tabular-nums",!de.rangeColor&&de.highlight==="positive"&&"text-emerald-600 dark:text-emerald-400",!de.rangeColor&&de.highlight==="negative"&&"text-red-500 dark:text-red-400",!de.rangeColor&&!de.highlight&&"text-foreground/80"),style:de.rangeColor?{color:de.rangeColor}:void 0,children:de.value}),Me<he.length-1&&d.jsx("span",{className:"text-foreground/20",children:"·"})]},de.label))})]}),L.length>0&&d.jsxs(Pi,{open:Z,onOpenChange:V,className:"mb-2",children:[d.jsx(Ii,{asChild:!0,children:d.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:d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("span",{className:"text-amber-600/80 dark:text-amber-400/70 font-medium text-[11px] uppercase tracking-wide shrink-0",children:"Golden"}),!Z&&d.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:L.map(de=>`${iM(de.key)}: ${de.value}`).join(" · ")}),d.jsx("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!Z&&"-rotate-90")})})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"py-2 px-2 -mx-2 bg-amber-500/[0.03] rounded-b",children:d.jsx("div",{className:"flex items-baseline gap-2 text-xs min-w-0 flex-wrap",children:L.map((de,Me)=>d.jsxs("span",{className:"inline-flex items-baseline gap-1.5",children:[Me>0&&d.jsx("span",{className:"text-foreground/20",children:"·"}),d.jsx("span",{className:"text-muted-foreground",children:iM(de.key)}),d.jsx("span",{className:"font-medium text-foreground/80 whitespace-pre-wrap break-words",children:_.length>0&&de.value?d.jsx(b5,{content:de.value,renderOptions:_}):de.value})]},de.key))})})})]}),((Se=t.prompt)==null?void 0:Se.system_prompt)&&d.jsxs(Pi,{open:W,onOpenChange:J,className:"mb-2",children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:"System"}),!W&&d.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:I6(t.prompt.system_prompt,60,S)}),d.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[t.prompt.tokens_system_prompt!=null&&d.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[t.prompt.tokens_system_prompt.toLocaleString()," ","tokens"]}),d.jsx(O6,{text:t.prompt.system_prompt}),d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!W&&"-rotate-90")})]})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"py-2",children:d.jsx(D6,{content:t.prompt.system_prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.prompt&&d.jsxs(Pi,{open:ne,onOpenChange:ie,className:"mb-2",children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:"User"}),!ne&&d.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:I6(t.prompt.prompt,60,S)}),d.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[t.prompt.tokens_prompt!=null&&d.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[t.prompt.tokens_prompt.toLocaleString()," tokens"]}),d.jsx(O6,{text:t.prompt.prompt}),d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!ne&&"-rotate-90")})]})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"py-2",children:d.jsx(D6,{content:t.prompt.prompt,renderOptions:_,enableThinkBlocks:!1})})})]}),t.turns.map((de,Me)=>{const Ce=z[Me]??h,Re=de.turn_type==="model"?t.turns.slice(0,Me).filter(le=>le.turn_type==="model").length:null;return d.jsxs(Pi,{open:Ce,onOpenChange:()=>se(Me),className:"mb-2",children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer bg-muted/50 hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h3",{className:"text-sm font-semibold shrink-0 w-[4.5rem]",children:Xwe(de.turn_type)}),!Ce&&d.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0",children:I6(de.content,60,de.turn_type==="model"&&S)}),d.jsxs("div",{className:"flex items-center gap-1.5 ml-auto shrink-0",children:[de.tokens!=null&&d.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:[de.tokens.toLocaleString()," tokens"]}),Re!==null&&d.jsxs("span",{className:"text-xs text-foreground/40 font-normal",children:["Turn ",Re]}),d.jsx(O6,{text:de.content}),d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!Ce&&"-rotate-90")})]})]})})}),d.jsx(Di,{children:d.jsxs("div",{className:"py-2",children:[d.jsx(D6,{content:de.content,renderOptions:_,enableThinkBlocks:de.turn_type==="model"&&S}),(()=>{const le=G.get(de.turn_order);return!le||le.length===0?null:d.jsx("div",{className:"mt-2 space-y-1",children:le.map((He,Le)=>d.jsx(qwe,{info:He,renderOptions:_},`${He.info_key}-${Le}`))})})()]})})]},`${de.sample_idx}-${de.turn_order}`)})]})}function qwe({info:t,renderOptions:e=[]}){const[n,r]=w.useState(!1);return d.jsxs(Pi,{open:n,onOpenChange:r,children:[d.jsx(Ii,{asChild:!0,children:d.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:[d.jsx(Rr,{className:vt("h-3 w-3 text-muted-foreground transition-transform shrink-0",!n&&"-rotate-90")}),d.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:t.info_key}),!n&&t.info_value&&d.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?"…":""]})]})}),d.jsx(Di,{children:d.jsx("div",{className:"py-1.5 px-2 text-xs bg-accent/20 rounded mt-0.5",children:e.length>0&&t.info_value?d.jsx(b5,{content:t.info_value,renderOptions:e}):d.jsx("pre",{className:"whitespace-pre-wrap font-sans",children:t.info_value})})})]})}function Xwe(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Ywe(t){return t.replace(/<think>[\s\S]*?<\/think>\s*/g,"").trimStart()}function I6(t,e=60,n=!0){if(!t)return"";const i=(n?Ywe(t):t).replace(/\s+/g," ").trim();return i.length<=e?i:i.slice(0,e)+"…"}function Kwe(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 Zwe(t,e=80){const n=t.replace(/\s+/g," ").trim();return n.length<=e?n:n.slice(0,e)+"…"}function Fj({content:t}){const[e,n]=w.useState(!0);return d.jsxs("span",{className:"block",children:[d.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&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-foreground/40 italic text-xs ml-1",children:Zwe(t)}),d.jsx("span",{children:"</think>"}),d.jsx(p0,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&d.jsx(Rr,{className:"h-3.5 w-3.5 inline-block shrink-0"})]}),e&&d.jsxs("span",{className:"block text-foreground/70",children:[t,d.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 Qwe(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 Jwe(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 eSe({code:t,language:e}){const[n,r]=w.useState(!1),i=async s=>{s.stopPropagation(),await navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)};return d.jsxs("div",{className:"my-2 rounded-md border bg-muted/50 overflow-hidden",children:[e&&d.jsxs("div",{className:"flex items-center justify-between px-3 py-1 text-xs text-muted-foreground border-b bg-muted/30",children:[d.jsx("span",{children:e}),d.jsx("button",{onClick:i,className:"hover:text-foreground transition-colors",title:"Copy code",children:n?d.jsx(H0,{className:"h-3 w-3"}):d.jsx(tC,{className:"h-3 w-3"})})]}),d.jsx("pre",{className:"p-3 text-sm font-sans whitespace-pre-wrap break-words overflow-x-auto",children:d.jsx("code",{children:t})})]})}function tSe({content:t}){const e="katex-scroll",n=Qwe(t);return d.jsx("div",{className:vt("whitespace-pre-wrap break-words [&_.katex]:text-sm",e),children:n.map((r,i)=>{if(r.type==="text")return d.jsx("span",{children:r.value},i);try{const s=CR.renderToString(r.value,{displayMode:r.type==="display",throwOnError:!1});return d.jsx("span",{dangerouslySetInnerHTML:{__html:s}},i)}catch{return d.jsx("span",{children:r.type==="display"?`$$${r.value}$$`:`$${r.value}$`},i)}})})}function Uj({content:t,renderMarkdown:e,renderLatex:n}){const r="katex-scroll";if(e){const i=[],s=[];return n&&(i.push(hwe),s.push(Wwe)),d.jsx("div",{className:vt("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:d.jsx(ube,{remarkPlugins:i,rehypePlugins:s,children:t})})}return n?d.jsx(tSe,{content:t}):d.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})}function b5({content:t,renderOptions:e=[]}){const n=e.includes("markdown"),r=e.includes("latex"),i=e.includes("code");if(!n&&!r&&!i)return d.jsx(d.Fragment,{children:t});if(i){const s=Jwe(t);if(s.some(o=>o.type==="code"))return d.jsx(d.Fragment,{children:s.map((o,a)=>o.type==="code"?d.jsx(eSe,{code:o.value,language:o.language},a):d.jsx(Uj,{content:o.value,renderMarkdown:n,renderLatex:r},a))})}return d.jsx(Uj,{content:t,renderMarkdown:n,renderLatex:r})}function D6({content:t,renderOptions:e=[],enableThinkBlocks:n=!0}){const r=w.useMemo(()=>n?Kwe(t):[{type:"text",value:t}],[t,n]),i=e.length>0;return r.length===1&&r[0].type==="text"?i?d.jsx("div",{className:"text-sm text-foreground/90",children:d.jsx(b5,{content:t,renderOptions:e})}):d.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:t}):i?d.jsx("div",{className:"text-sm text-foreground/90",children:r.map((s,o)=>s.type==="text"?d.jsx(b5,{content:s.value,renderOptions:e},o):d.jsx(Fj,{content:s.value},o))}):d.jsx("div",{className:"text-sm whitespace-pre-wrap break-words text-foreground/90",children:r.map((s,o)=>s.type==="text"?d.jsx("span",{children:s.value},o):d.jsx(Fj,{content:s.value},o))})}function O6({text:t}){const[e,n]=w.useState(!1),r=async i=>{i.stopPropagation(),await navigator.clipboard.writeText(t),n(!0),setTimeout(()=>n(!1),2e3)};return d.jsx("button",{onClick:r,className:"p-0.5 rounded hover:bg-muted-foreground/10 transition-colors",title:e?"Copied!":"Copy to clipboard",children:e?d.jsx(H0,{className:"h-3.5 w-3.5 text-foreground/30"}):d.jsx(tC,{className:"h-3.5 w-3.5 text-foreground/30"})})}function iM(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function nSe(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function rSe(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 L6(t,e,n,r){if(e==null||n==null||e>=n)return;let i=Math.max(0,Math.min(1,(t-e)/(n-e)));return r&&(i=1-i),`hsl(${(i*120).toFixed(0)} 80% 38%)`}function GC({rawString:t,totalTokens:e,turns:n}){const[r,i]=w.useState(!1),[s,o]=w.useState(!1),a=async()=>{await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),2e3)},l=c=>{const f=c.split(`
`);return f.map((h,m)=>d.jsxs("span",{children:[h,m<f.length-1&&d.jsxs(d.Fragment,{children:[d.jsx("span",{className:"text-muted-foreground/50",children:"\\n"}),`
`]})]},m))};return d.jsxs(Lc,{children:[d.jsx(sC,{asChild:!0,children:d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",children:"Raw Text"})}),d.jsxs(jc,{className:"sm:max-w-[75vw] max-h-[80vh]",children:[d.jsx(Wl,{children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx($l,{children:"Raw Text"}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:[e!=null&&d.jsxs(d.Fragment,{children:[e.toLocaleString()," tokens"]}),e!=null&&n!=null&&n>0&&" • ",n!=null&&n>0&&d.jsxs(d.Fragment,{children:[n," ",n===1?"turn":"turns"]})]}),d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:a,children:[r?d.jsx(H0,{className:"size-3"}):d.jsx(tC,{className:"size-3"}),r?"Copied":"Copy"]}),d.jsx(U1,{variant:"outline",size:"sm",pressed:s,onPressedChange:o,className:"text-xs",children:"Line breaks"})]})}),d.jsx($x,{className:"h-[60vh] w-full rounded-md border bg-background p-4",children:d.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words font-sans",children:s?l(t):t})})]})]})}function iSe(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 sSe(t){switch(t){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}}function oSe(t){const e=w.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=w.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=w.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=w.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=w.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=w.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 aSe({runPath:t,groupId:e,sampleId:n,isEval:r,isCanceled:i,children:s}){var se,re,K,fe,he;const[o,a]=w.useState(!1),{data:l,isLoading:c,error:f}=YW(t,e,n,o,r),{data:h}=Sh(t,o&&!!t,!1),m=r?((se=h==null?void 0:h.summary)==null?void 0:se.eval_env_details)??((re=h==null?void 0:h.config)==null?void 0:re.eval_env_details):(K=h==null?void 0:h.config)==null?void 0:K.environments,x=r||(fe=h==null?void 0:h.summary)==null?void 0:fe.env_details,b=w.useMemo(()=>KS(m),[m]),_=w.useMemo(()=>{const ae=Dp(m),Se=Dp(x),de=ZS(h==null?void 0:h.data_metric_ranges);return Op(Op(ae,Se),de)},[m,x,h==null?void 0:h.data_metric_ranges]),S=w.useMemo(()=>{var Me;const ae=(Me=h==null?void 0:h.config)==null?void 0:Me.group_size,Se=typeof ae=="object"&&ae!==null&&"value"in ae?Number(ae.value):Number(ae);if(!Se||isNaN(Se)||Se<=1)return null;const de=Math.sqrt(Se-1);return{min:-de,max:de}},[(he=h==null?void 0:h.config)==null?void 0:he.group_size]),M=(l==null?void 0:l.kind)==="rollouts_discarded"?l:null,{mappedPrompts:T,mappedRollouts:A,mappedSamplesData:N,mappedRolloutMetrics:D,mappedGoldenAnswers:k,mappedInfoTurns:O}=oSe(M),R=w.useMemo(()=>{var Se;if(!l||l.kind!=="eval")return null;const ae=(Se=l.samples_data)==null?void 0:Se[0];return ae?{groupId:ae.group_id,sampleIdx:ae.sample_idx}:null},[l]),L=(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,B=wT(),H=w.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]),$=()=>{H&&(a(!1),B(H))},[G,Z]=w.useState(0),[V,W]=w.useState(0),[J,ne]=w.useState(!0),[ie,z]=cn(QT),[j,X]=cn(JT),F=ie.length+(j?1:0),ce=ae=>{z(Se=>Se.includes(ae)?Se.filter(de=>de!==ae):[...Se,ae])},oe=w.useMemo(()=>{if(!l)return null;const ae=l.kind==="rollouts"?l.samples_data:l.kind==="rollouts_discarded"?N:l.kind==="eval"?l.samples_data:null;if(!ae)return null;const Se=l.kind==="eval"?(R==null?void 0:R.sampleIdx)??n:n;return ae.find(de=>de.sample_idx===Se)??null},[l,N,n,R]),Q=!c&&!f&&l&&l.kind!==null;return d.jsxs(Lc,{open:o,onOpenChange:a,children:[d.jsx(sC,{asChild:!0,children:s??d.jsx(Sn,{variant:"outline",size:"sm",className:"h-6 px-2 text-[10px]",children:"Check"})}),d.jsxs(jc,{className:"sm:max-w-[85vw] max-h-[85vh] overflow-auto",children:[d.jsx(Wl,{children:d.jsxs($l,{className:"flex items-center gap-2 flex-wrap",children:[d.jsx("span",{children:(l==null?void 0:l.kind)==="eval"?`Completion ${n} / Sample ${e}`:`Sample ${n} / Group ${e}`}),L&&d.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[L,(l==null?void 0:l.kind)==="eval"&&l.eval_name&&` — ${l.eval_name}`]}),(M==null?void 0:M.discard_reason)&&d.jsx(Cy,{variant:sSe(M.discard_reason),className:"text-xs",children:iSe(M.discard_reason)}),H&&d.jsx(Sn,{variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:$,children:"Go to"}),Q&&d.jsxs(d.Fragment,{children:[(oe==null?void 0:oe.raw_string)&&d.jsx(GC,{rawString:oe.raw_string,totalTokens:oe.total_tokens,turns:oe.turns??void 0}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{Z(ae=>ae+1),ne(!1)},children:"Collapse All"}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{W(ae=>ae+1),ne(!0)},children:"Expand All"}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",F>0&&` (${F})`]})}),d.jsxs($s,{align:"start",className:"w-auto",children:[d.jsx(hr,{checked:j,onCheckedChange:ae=>X(!!ae),onSelect:ae=>ae.preventDefault(),children:"Format Think"}),d.jsx(hr,{checked:ie.includes("markdown"),onCheckedChange:()=>ce("markdown"),onSelect:ae=>ae.preventDefault(),children:"Markdown"}),d.jsx(hr,{checked:ie.includes("latex"),onCheckedChange:()=>ce("latex"),onSelect:ae=>ae.preventDefault(),children:"LaTeX"}),d.jsx(hr,{checked:ie.includes("code"),onCheckedChange:()=>ce("code"),onSelect:ae=>ae.preventDefault(),children:"Code"})]})]})]})]})}),f&&d.jsx(hd,{className:"border-destructive",children:d.jsx(dh,{className:"pt-6",children:d.jsxs("p",{className:"text-sm text-destructive",children:["Error: ",f instanceof Error?f.message:"Unknown error"]})})}),c&&!f&&d.jsx(hd,{children:d.jsxs(dh,{className:"pt-6 space-y-3",children:[d.jsx(up,{className:"h-5 w-40"}),d.jsx(up,{className:"h-32 w-full"}),d.jsx(up,{className:"h-24 w-full"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx(up,{className:"h-6 w-20"}),d.jsx(up,{className:"h-6 w-20"}),d.jsx(up,{className:"h-6 w-20"})]})]})}),!c&&!f&&(l==null?void 0:l.kind)==="rollouts"&&d.jsx($1,{prompts:l.prompts,data:l.rollouts,samplesData:l.samples_data,rolloutMetrics:l.rollout_metrics,goldenAnswers:l.golden_answers,infoTurns:l.info_turns,step:l.step,filterGroupId:e,filterSampleIdx:n,envRewardRanges:b,envMetricRanges:_,advantageRange:S,collapseAllSignal:G,expandAllSignal:V,defaultSectionsOpen:J,renderOptions:ie,formatThinkBlocks:j}),!c&&!f&&(l==null?void 0:l.kind)==="rollouts_discarded"&&d.jsx($1,{prompts:T,data:A,samplesData:N,rolloutMetrics:D,goldenAnswers:k,infoTurns:O,step:l.trainer_step,goToBasePath:"/rollouts-discarded",goToStepParam:"trainer_step",filterGroupId:e,filterSampleIdx:n,envRewardRanges:b,envMetricRanges:_,advantageRange:S,collapseAllSignal:G,expandAllSignal:V,defaultSectionsOpen:J,renderOptions:ie,formatThinkBlocks:j}),!c&&!f&&(l==null?void 0:l.kind)==="eval"&&d.jsx($1,{prompts:l.prompts,data:l.rollouts,samplesData:l.samples_data,rolloutMetrics:l.rollout_metrics,goldenAnswers:l.golden_answers,infoTurns:l.info_turns,step:l.step,filterGroupId:(R==null?void 0:R.groupId)??e,filterSampleIdx:(R==null?void 0:R.sampleIdx)??n,envRewardRanges:b,envMetricRanges:_,advantageRange:S,collapseAllSignal:G,expandAllSignal:V,defaultSectionsOpen:J,renderOptions:ie,formatThinkBlocks:j}),!c&&!f&&(l==null?void 0:l.kind)===null&&d.jsx(hd,{children:d.jsx(dh,{className:"pt-6",children:d.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 lSe=.005;function cSe(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 xs(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 j6(t){return t.toLocaleString("en-US")}function EY(t,e,n=[]){return[{label:"Duration",value:xs(e)},...t.prompt_tokens!==void 0?[{label:"Prompt tokens",value:j6(t.prompt_tokens)}]:[],...t.rollout_tokens!==void 0?[{label:"Rollout tokens",value:j6(t.rollout_tokens)}]:[],...t.max_tokens!==void 0&&t.max_tokens!==null?[{label:"Max tokens",value:j6(t.max_tokens)}]:[],...n,...t.queue_time!==void 0&&t.queue_time!==null?[{label:"Queue time",value:xs(t.queue_time*1e3)}]:[],...t.time_to_first_token!==void 0&&t.time_to_first_token!==null?[{label:"TTFT",value:xs(t.time_to_first_token*1e3)}]:[],...t.prefill_time!==void 0&&t.prefill_time!==null?[{label:"Prefill time",value:xs(t.prefill_time*1e3)}]:[],...t.decode_time!==void 0&&t.decode_time!==null?[{label:"Decode time",value:xs(t.decode_time*1e3)}]:[],...t.inference_time!==void 0&&t.inference_time!==null?[{label:"Inference time",value:xs(t.inference_time*1e3)}]:[],...t.e2e_latency!==void 0&&t.e2e_latency!==null?[{label:"E2E latency",value:xs(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 uSe(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")}`}function dSe(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*(1-e)),a=Math.round(i*(1-e)),l=Math.round(s*(1-e));return`#${o.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}`}function fSe(t,e,n){return n?dSe(t,e):uSe(t,e)}const hSe=new Set;function AY(t){var n;const e=(n=AC[t])==null?void 0:n.label;return e||t.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function pSe(t,e=lSe){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 mSe({orchestratorData:t,trainerData:e,inferenceData:n,inflightSnapshot:r,isLoading:i,intervalStart:s,intervalEnd:o,trainerGpuMetricsByGpuIndex:a,trainerGpuMetricsByRank:l,trainerGpuMetricsIsLoading:c=!1,trainerAvailableGpuMetrics:f=[],selectedTrainerGpuMetrics:h=[],onSelectedTrainerGpuMetricsChange:m,trainerSystemGpuIndices:x,trainerRankInfoByRank:b,totalSetupNodes:_,inferenceServerNodeMap:S,numInferenceServers:M=0,maxConcurrentPrompts:T=12,groupSize:A=1,freeLaneAfterGeneration:N=!1}){const D=Kn(KT),k=w.useMemo(()=>{const z=(x??[]).filter(X=>Number.isFinite(X));return z.length>0?z:a?Object.keys(a).map(Number).filter(X=>Number.isFinite(X)).sort((X,F)=>X-F):[]},[x,a]),O=o-s,R=w.useMemo(()=>!t||t.length===0?[]:t.filter(z=>z.timestamp>=s&&z.timestamp<o),[t,s,o]),{rewardStartedKeys:L,rewardEndedKeys:B}=w.useMemo(()=>{const z=new Set,j=new Set;if(t){for(const X of t)if(X.sample_id!=null&&X.sample_id!==-1&&X.group_id!=null){const F=`${X.group_id}:${X.sample_id}`;X.event_type==="compute_reward_start"?z.add(F):X.event_type==="compute_reward_end"&&j.add(F)}}return{rewardStartedKeys:z,rewardEndedKeys:j}},[t]),H=w.useMemo(()=>!e||e.length===0?[]:e.filter(z=>z.start_time<o&&z.end_time>s),[e,s,o]),$=w.useMemo(()=>{var X,F;const z=n??[];if(!(r!=null&&r.snapshot_time))return z;const j=[];if((X=r.running)!=null&&X.length){const ce=new Set(z.filter(oe=>oe.sample_id!=null).map(oe=>oe.sample_id));for(const oe of r.running)ce.has(oe.sample_id)||j.push({event_type:"request",server:oe.server,start_time:oe.start_time,end_time:r.snapshot_time,prompt_tokens:oe.prompt_tokens,sample_id:oe.sample_id,group_id:oe.group_id,lane:oe.server_lane,is_eval:oe.is_eval,phase:"inflight"})}if((F=r.running_compute_reward)!=null&&F.length)for(const ce of r.running_compute_reward)j.push({event_type:"request",server:ce.server,start_time:ce.start_time,end_time:r.snapshot_time,sample_id:ce.sample_id,group_id:ce.group_id,lane:ce.server_lane,is_eval:ce.is_eval,phase:"inflight"});return j.length>0?[...z,...j]:z},[n,r]),G=w.useMemo(()=>!$||$.length===0?[]:$.filter(z=>{const j=z.end_time+(z.environment_response_time??0)+(z.compute_reward_time??0);return z.start_time<o&&j>s}),[$,s,o]),{eventsByRank:Z,ranks:V}=w.useMemo(()=>{const z={};H.forEach(X=>{z[X.rank]||(z[X.rank]=[]),z[X.rank].push(X)});const j=Object.keys(z).map(Number).sort((X,F)=>X-F);return{eventsByRank:z,ranks:j}},[H]),{eventsByServer:W,servers:J}=w.useMemo(()=>{const z={};G.forEach(X=>{z[X.server]||(z[X.server]=[]),z[X.server].push(X)});const j=Object.keys(z).map(Number).sort((X,F)=>X-F);return{eventsByServer:z,servers:j}},[G]),ne=M>0?M:Math.max(1,J.length),ie=Math.max(1,Math.floor(T/ne*A));return d.jsx("div",{className:`transition-opacity duration-200 overflow-visible ${i&&!D?"opacity-50":""}`,children:d.jsxs("div",{className:"space-y-6",children:[(J.length>0||M>0)&&d.jsx(bSe,{servers:J.length>0?J:Array.from({length:M},(z,j)=>j),eventsByServer:W,intervalStart:s,intervalDuration:O,lanesPerServer:ie,inferenceServerNodeMap:S,totalSetupNodes:_,isLoading:i,freeLaneAfterGeneration:N,inflightSnapshot:r,rewardStartedKeys:L,rewardEndedKeys:B}),d.jsx(gSe,{events:R,intervalStart:s,intervalDuration:O,isLoading:i}),d.jsx(FSe,{ranks:V,eventsByRank:Z,intervalStart:s,intervalDuration:O,intervalEnd:o,trainerGpuMetricsByGpuIndex:a,trainerGpuMetricsByRank:l,trainerGpuMetricsIsLoading:c,trainerAvailableGpuMetrics:f,selectedMetricNames:h,onSelectedMetricNamesChange:m,trainerSystemGpuIndices:k,trainerRankInfoByRank:b,totalSetupNodes:_,isLoading:i})]})})}function gSe({events:t,intervalStart:e,intervalDuration:n,isLoading:r}){const[i,s]=w.useState(!0),[o,a]=w.useState(null),[l,c]=w.useState(null),[f,h]=w.useState(()=>new Set(["compute reward start","compute reward end"])),m=l??o,x=w.useMemo(()=>{const T=[],A=new Map;return t.forEach(N=>{const D=e5(N.event_type),k=A.get(D);k!==void 0?T[k].count++:(A.set(D,T.length),T.push({displayName:D,color:v8(N.event_type),count:1}))}),T},[t]),{thresholdSeconds:b,displayLabel:_}=w.useMemo(()=>cSe(n),[n]),{sortedEvents:S,windowByOriginalIndex:M}=w.useMemo(()=>pSe(t,b),[t,b]);return d.jsxs(Pi,{open:i,onOpenChange:s,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!i&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Orchestrator"}),r&&d.jsx(Ya,{className:"size-3.5 text-muted-foreground"})]})})}),d.jsx(Di,{children:d.jsxs("div",{className:"mt-3",children:[x.length>0&&d.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 mb-6 text-xs",children:x.map(({displayName:T,color:A,count:N})=>{const D=f.has(T),k=!D&&m===T,O=D||m!==null&&!k;return d.jsx(xSe,{displayName:T,color:A,count:N,isHidden:D,isActive:k,isDimmed:O,onPointerEnter:()=>{D||a(T)},onPointerLeave:()=>a(null),onClick:()=>{D?h(R=>{const L=new Set(R);return L.delete(T),L}):c(R=>R===T?null:T)},onHide:()=>{h(R=>new Set(R).add(T)),l===T&&c(null)},onShow:()=>{h(R=>{const L=new Set(R);return L.delete(T),L})}},T)})}),d.jsx("div",{className:"relative",children:d.jsxs("div",{className:"relative h-32 bg-background rounded-lg border border-border/50",children:[d.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:[d.jsx("span",{children:bp(0)}),d.jsx("span",{children:bp(n/2)}),d.jsx("span",{children:bp(n)})]}),d.jsx("div",{className:"absolute top-0 left-0 right-0 h-24",children:t.map((T,A)=>d.jsx(vSe,{event:T,intervalStart:e,intervalDuration:n,sortedEvents:S,closeEventWindow:M.get(A),thresholdLabel:_,highlightedDisplayName:m,isHidden:f.has(e5(T.event_type))},`${T.timestamp}-${A}`))})]})})]})})]})}function xSe({displayName:t,color:e,count:n,isHidden:r,isActive:i,isDimmed:s,onPointerEnter:o,onPointerLeave:a,onClick:l,onHide:c,onShow:f}){return d.jsxs(Hge,{children:[d.jsx(Gge,{asChild:!0,children:d.jsxs("div",{className:`flex items-center gap-1.5 cursor-pointer select-none transition-opacity duration-150 ${i?"ring-1 ring-border rounded-full px-1.5 py-0.5 -mx-1.5 -my-0.5":""}`,style:{opacity:s?.3:1},onPointerEnter:o,onPointerLeave:a,onClick:l,children:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e}}),d.jsx("span",{className:"capitalize text-muted-foreground",children:t}),d.jsx("span",{className:"text-muted-foreground/50",children:n})]})}),d.jsx(Vge,{children:d.jsx(Wge,{onSelect:r?f:c,className:"text-xs",children:r?"Show":"Hide"})})]})}function vSe({event:t,intervalStart:e,intervalDuration:n,sortedEvents:r,closeEventWindow:i,thresholdLabel:s,highlightedDisplayName:o,isHidden:a}){const c=(t.timestamp-e)/n*100;if(a||c<0||c>100)return null;const f=Kn(us),h=v8(t.event_type),x=(i?Math.max(0,i.end-i.start):0)>0,b=e5(t.event_type),_=o!==null&&b!==o,S=o!==null&&b===o;return d.jsx(Fc,{className:"absolute top-0 bottom-0 w-0.5 group cursor-pointer",style:{left:`${c}%`,backgroundColor:_?fSe(h,.8,f):h,zIndex:S?20:1},interactive:x,tooltip:d.jsx(ySe,{event:t,sortedEvents:r,closeEventWindow:i,thresholdLabel:s})})}function ySe({event:t,sortedEvents:e,closeEventWindow:n,thresholdLabel:r}){const i=a=>{const l=e5(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=w.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 d.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&&d.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:[d.jsx("div",{className:"w-1 h-1 rounded-full bg-amber-500 flex-shrink-0"}),d.jsxs("span",{className:"text-amber-500 font-medium text-[10px]",children:[s.length," events within ",r]})]}),d.jsx("div",{className:`px-3 ${o?"pt-2 pb-2 space-y-3":"py-2"}`,children:s.map((a,l)=>{const c=v8(a.event_type),f=i(a);return d.jsxs("div",{className:o&&l>0?"pt-2 border-t border-border/30":"",children:[d.jsxs("div",{className:"font-semibold mb-1.5 flex items-center gap-2",children:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:c}}),d.jsx("span",{children:f})]}),d.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[a.step!==-1&&d.jsxs("div",{children:["Step: ",a.step]}),a.group_id!=null&&a.group_id!==-1&&d.jsxs("div",{children:["Group: ",a.group_id]}),a.sample_id!=null&&a.sample_id!==-1&&d.jsxs("div",{children:["Sample: ",a.sample_id]}),d.jsxs("div",{children:["Time:"," ",new Date(a.timestamp*1e3).toISOString().slice(11,23)]})]})]},`${a.timestamp}-${l}`)})})]})}function bSe({servers:t,eventsByServer:e,intervalStart:n,intervalDuration:r,lanesPerServer:i,inferenceServerNodeMap:s,totalSetupNodes:o,isLoading:a,freeLaneAfterGeneration:l=!1,inflightSnapshot:c,rewardStartedKeys:f,rewardEndedKeys:h}){var rt;const[S,M]=w.useState(!0),[T,A]=cn(Cue),[N,D]=cn(KT),[k,O]=cn(Mue),[R,L]=cn(LW),[B,H]=cn(Tue),$=Kn(us),G=$?"1px solid rgba(255, 255, 255, 0.15)":"1px solid rgba(0, 0, 0, 0.2)",[Z,V]=cn(Eue),[W,J]=cn(Aue),[ne,ie]=cn(wue),[z,j]=cn(zW),X=Kn(wl),F=8,ce=t.length>F,oe=w.useMemo(()=>{if(!ce)return[];const ye=[];for(let $e=0;$e<t.length;$e+=F){const Ze=t.slice($e,$e+F),ft=$e,lt=Math.min($e+F,t.length)-1;ye.push({label:`${ft} – ${lt}`,servers:Ze})}return ye},[t,ce]),Q=ce?Math.min(ne,Math.max(0,oe.length-1)):0;w.useEffect(()=>{ce&&ne!==Q&&ie(Q)},[ce,ne,Q,ie]);const se=ce?((rt=oe[Q])==null?void 0:rt.servers)??t.slice(0,F):t,re=w.useMemo(()=>typeof o=="number"&&Number.isFinite(o)?o>1:s?new Set(Object.values(s).filter($e=>$e!==null)).size>1:!1,[s,o]),K=w.useMemo(()=>{const ye=new Set;for(const Ze of Object.values(e))for(const ft of Ze)ft.is_canceled&&ft.group_id!=null&&ye.add(ft.group_id);if(ye.size===0)return e;const $e={};for(const[Ze,ft]of Object.entries(e))$e[Number(Ze)]=ft.map(lt=>!lt.is_canceled&&lt.group_id!=null&&ye.has(lt.group_id)?{...lt,is_canceled:!0}:lt);return $e},[e]),fe=w.useMemo(()=>{const ye=new Set,$e=[];for(const Ze of Object.values(K))for(const ft of Ze){if(ft.event_type!=="request"||ft.sample_id==null||ft.group_id==null)continue;const lt=`${ft.group_id}:${ft.sample_id}`;ye.has(lt)||(ye.add(lt),$e.push({group_id:ft.group_id,sample_idx:ft.sample_id}))}return $e},[K]),{data:he}=y8(X??"",fe,!!X&&fe.length>0&&N,!0),ae=!N||fe.length===0||!!he,Se=!N||ae,de=w.useMemo(()=>{const ye=new Map;return he==null||he.statuses.forEach($e=>{ye.set(`${$e.group_id}:${$e.sample_idx}`,$e.kind)}),ye},[he]),Me=w.useMemo(()=>{let ye=i;for(const $e of Object.values(K))for(const Ze of $e)Ze.event_type==="request"&&Ze.lane!=null&&Ze.lane+1>ye&&(ye=Ze.lane+1);return ye},[K,i]),Ce=Math.max(1,t.length),Re=Math.max(1,Math.floor(W/Ce)),le=Me,He=Math.max(1,Math.ceil(le/Re)),Le=Math.min(Z,Math.max(0,He-1));w.useEffect(()=>{Z!==Le&&V(Le)},[Z,Le,V]);const ze=Le*Re,Ve=Re,ue=Math.min(ze+Re-1,le-1),Y=w.useMemo(()=>{let ye=0;for(const $e of Object.values(K))ye+=$e.length;return ye},[K]),xe=w.useMemo(()=>({servers:se,eventsByServer:K,intervalStart:n,intervalDuration:r,lanesPerServer:i}),[se,K,n,r,i]),we=w.useMemo(()=>`${n}:${r}:${se.join(",")}:${Y}:${N}`,[n,r,se,Y,N]),[Te,ge]=w.useState(null),[Ue,be]=w.useState(null),[ke,qe]=w.useState(null);Se&&(Te!==xe||Ue!==de||ke!==we)&&(ge(xe),be(de),qe(we));const Qe=N&&ke!==null&&we!==ke,nt=w.useCallback(ye=>{if(ye.event_type==="request"&&!(ye.sample_id===void 0||ye.group_id===void 0)){if((z==null?void 0:z.sampleId)===ye.sample_id){j(null);return}j({sampleId:ye.sample_id,groupId:ye.group_id,isEval:ye.is_eval})}},[z,j]),st=w.useMemo(()=>{var $e;if(!R||!B)return[];const ye=[];for(const[Ze,ft]of Object.entries(K)){const lt=Number(Ze);for(const Je of ft){if(Je.event_type!=="request")continue;const Ae=Je.compute_reward_time;if(Ae==null||Ae<=0)continue;const We=Je.environment_response_time,De=Je.end_time+(We!=null&&We>0?We:0);ye.push({startTime:De,duration:Ae,sourceEvent:Je,server:lt})}}if(($e=c==null?void 0:c.running_compute_reward)!=null&&$e.length&&c.snapshot_time)for(const Ze of c.running_compute_reward){const ft=c.snapshot_time-Ze.start_time;ft<=0||ye.push({startTime:Ze.start_time,duration:ft,sourceEvent:{event_type:"request",server:Ze.server,start_time:Ze.start_time,end_time:c.snapshot_time,sample_id:Ze.sample_id,group_id:Ze.group_id,lane:Ze.server_lane,is_eval:Ze.is_eval,phase:"inflight"},server:Ze.server})}return ye.sort((Ze,ft)=>Ze.startTime-ft.startTime),ye},[R,B,K,c]),{packedRewardItems:Pe,rewardLaneCount:Ke}=w.useMemo(()=>{if(st.length===0)return{packedRewardItems:[],rewardLaneCount:0};const ye=[],$e=[];for(const Ze of st){let ft=!1;for(let lt=0;lt<ye.length;lt++)if(ye[lt]<=Ze.startTime){ye[lt]=Ze.startTime+Ze.duration,$e.push({...Ze,lane:lt}),ft=!0;break}ft||($e.push({...Ze,lane:ye.length}),ye.push(Ze.startTime+Ze.duration))}return{packedRewardItems:$e,rewardLaneCount:ye.length}},[st]);return d.jsxs(Pi,{open:S,onOpenChange:M,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(Ii,{asChild:!0,children:d.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-muted rounded transition-colors",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!S&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Inference Servers"}),d.jsx("div",{className:"w-6 flex items-center justify-center shrink-0",children:a&&d.jsx(Ya,{className:"size-3.5 text-muted-foreground"})})]})}),S&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center rounded-md border border-input",children:[d.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:()=>A(ye=>Math.max(2,ye-4)),disabled:T<=2,children:d.jsx(Hde,{className:"h-3 w-3"})}),d.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:()=>A(14),children:"Reset"}),d.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:()=>A(ye=>Math.min(42,ye+4)),disabled:T>=42,children:d.jsx(yp,{className:"h-3 w-3"})})]}),d.jsxs("div",{className:"flex items-center rounded-md border border-input",children:[d.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:()=>V(ye=>Math.max(0,ye-1)),disabled:Le<=0,children:d.jsx(m8,{className:"h-3 w-3"})}),d.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:le===0?"0":`${ze}–${ue}`}),d.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:()=>V(ye=>Math.min(He-1,ye+1)),disabled:Le>=He-1,children:d.jsx(Rr,{className:"h-3 w-3"})})]}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx($W,{className:"h-3.5 w-3.5"})})}),d.jsxs($s,{align:"end",children:[d.jsx(y0,{children:"Max Lanes"}),d.jsx(ys,{}),[64,128,256,512,1024].map(ye=>d.jsx(hr,{checked:W===ye,onCheckedChange:()=>{J(ye),V(0)},children:ye},ye))]})]}),ce&&d.jsxs(gy,{value:String(Q),onValueChange:ye=>ie(Number(ye)),children:[d.jsx(vy,{size:"sm",className:"text-xs h-7 gap-1",children:d.jsx(xy,{})}),d.jsx(yy,{children:oe.map((ye,$e)=>d.jsxs(Ox,{value:String($e),children:["Servers ",ye.label]},$e))})]}),d.jsx(U1,{variant:"selecting",size:"sm",pressed:N,onPressedChange:D,className:"text-xs px-2 h-7",children:"Highlight Discarded"}),d.jsx(U1,{variant:"selecting",size:"sm",pressed:k,onPressedChange:O,className:"text-xs px-2 h-7",children:"Show Weight Update"}),d.jsxs("div",{className:"flex items-center",children:[d.jsx(U1,{variant:"selecting",size:"sm",pressed:R,onPressedChange:L,className:"text-xs px-2 h-7 rounded-r-none",children:"Show Compute Reward"}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsx("button",{className:vt("flex items-center justify-center h-7 w-6 rounded-r-[min(var(--radius-md),12px)] transition-colors",R?"bg-primary text-secondary hover:bg-primary/90":"bg-accent text-muted-foreground hover:text-accent-foreground hover:bg-muted"),children:d.jsx(Rr,{className:"h-3 w-3"})})}),d.jsx($s,{align:"end",children:d.jsx(hr,{checked:B,onCheckedChange:H,children:"Separate"})})]})]})]})]}),d.jsxs(Di,{children:[d.jsx("div",{className:"space-y-4",children:t.length>0?(()=>{const ye=Te??(Se?xe:null),$e=Ue??(Se?de:null);if(!ye||!$e)return null;const Ze=Qe?!0:ae;return d.jsx("div",{className:`transition-opacity ${Qe?"opacity-60":"opacity-100"}`,children:d.jsx("div",{className:"space-y-3",children:ye.servers.map(ft=>d.jsx(OSe,{server:ft,nodeId:(s==null?void 0:s[ft])??null,showNodeLabel:re,events:ye.eventsByServer[ft]||[],intervalStart:ye.intervalStart,intervalDuration:ye.intervalDuration,numLanes:ye.lanesPerServer,selectedRequest:z,sampleStatusByKey:$e,highlightDiscarded:N,discardStatusReady:Ze,onEventClick:nt,showWeightUpdate:k,showComputeReward:R&&!B,laneHeight:T,laneStart:ze,maxLanesToShow:Ve,freeLaneAfterGeneration:l,rewardStartedKeys:f,rewardEndedKeys:h},ft))})})})():d.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"})}),B&&Pe.length>0&&d.jsxs("div",{className:"mt-3",children:[d.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-0.5",children:"Compute Reward"}),d.jsx("div",{className:"relative bg-muted/30 rounded-lg border border-border/50",style:{height:Ke*T+Math.max(0,Ke-1)*2},children:Pe.map((ye,$e)=>{const Ze=n+r,ft=ye.startTime+ye.duration;if(ye.startTime>=Ze||ft<=n)return null;const lt=Math.max(ye.startTime,n),Je=Math.min(ft,Ze),Ae=Math.max(0,(lt-n)/r*100),We=Math.max(.3,(Je-lt)/r*100),De=ye.lane*(T+2),Ne=ye.sourceEvent.phase==="inflight",ot=Ne?{color:$?"rgba(250, 204, 21, 0.5)":"rgba(234, 179, 8, 0.5)",opacity:.85}:NR(ye.sourceEvent,"reward",z,de,N,ae,$),dt=Ne?$?"1.5px dashed rgba(250, 204, 21, 0.7)":"1.5px dashed rgba(234, 179, 8, 0.7)":G;return d.jsx(Fc,{className:"absolute group cursor-pointer",style:{left:`${Ae}%`,width:`${Math.min(We,100-Ae)}%`,top:De,height:T,backgroundColor:ot.color,borderRadius:"1px",border:dt,boxSizing:"border-box",opacity:ot.opacity},onClick:()=>nt(ye.sourceEvent),tooltip:d.jsx(fu,{title:ye.sourceEvent.is_eval?"Compute Metrics":"Compute Reward",statusLabel:Ne?{text:"In Progress",className:"text-yellow-500"}:{text:"Waiting for Group",className:"text-yellow-600"},titleSecondary:ye.sourceEvent.sample_id!==void 0?`Sample ${ye.sourceEvent.sample_id}`:void 0,color:ot.color,details:[{label:"Duration",value:xs(ye.duration*1e3)},...ye.sourceEvent.group_id!==void 0?[{label:"Group",value:String(ye.sourceEvent.group_id)}]:[],{label:"Server",value:String(ye.server)},{label:"Lane",value:String(ye.lane)}]})},`cr-${$e}`)})})]}),d.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[d.jsx("span",{children:bp(0)}),d.jsx("span",{children:bp(r/2)}),d.jsx("span",{children:bp(r)})]})]})]})}const _Se="#075985",wSe="#047857",NY="#0284c7",kY="#10b981",RY="#a1a1a1",PY="#555555",IY="#b0b0b0",DY="#4a4a4a",SSe="#0c4a6e",MSe="#065f46",OY="#8a8a8a",LY="#606060",TSe="#0ea5e9",CSe="#ababab",ESe="#555555",ASe="#38bdf8",NSe="#ababab",kSe="#555555",RSe="#34d399",PSe="#ababab",ISe="#555555",jY="#0369a1",zY="#0369a1",FY="#047857",UY="#0284c7",BY="#0284c7",HY="#10b981",GY="#b3b3b3",VY="#505050",WY="#b3b3b3",$Y="#505050",qY="#b3b3b3",XY="#505050";function DSe({eventsBySampleId:t,selectedSampleId:e,timeBounds:n,groupId:r,runPath:i,envResponseTimesBySample:s,computeRewardTimeBySample:o,inflightSnapshot:a,onSampleClick:l,showNodeLabel:c,isEval:f}){const h=Object.keys(t).map(Number).sort((G,Z)=>G-Z),m=Kn(KT),x=Kn(us),b=x?"1px solid rgba(255, 255, 255, 0.2)":"1px solid rgba(0, 0, 0, 0.3)",_=x?"1px solid rgba(255, 255, 255, 0.1)":"1px solid rgba(0, 0, 0, 0.12)",S=x?"1px solid rgba(255, 255, 255, 0.15)":"1px solid rgba(0, 0, 0, 0.2)",M=w.useMemo(()=>h.map(G=>({group_id:r,sample_idx:G})),[r,h.join(",")]),{data:T}=y8(i,M,!!i&&M.length>0&&m,!0),A=!m||M.length===0||!!T,N=w.useMemo(()=>!m||!(T!=null&&T.statuses)?!1:T.statuses.some(G=>G.kind==="rollouts_discarded"),[m,T]),D=w.useMemo(()=>{for(const G of Object.values(t))if(G.some(Z=>Z.is_eval))return!0;return!1},[t]),k=w.useMemo(()=>{for(const G of Object.values(t))if(G.some(Z=>Z.is_canceled))return!0;return!1},[t]),O=w.useMemo(()=>{var G;return k||N||!m||D?!1:!A||!((G=T==null?void 0:T.statuses)!=null&&G.length)?!0:!T.statuses.some(Z=>Z.kind==="rollouts")},[k,N,D,m,A,T]),R=k?x?DY:IY:N?x?PY:RY:O?x?"rgba(202, 138, 4, 0.7)":"rgba(202, 138, 4, 0.8)":D?kY:NY,L=16,B=3,H=h.length*L+(h.length-1)*B,$=48;return A?d.jsxs("div",{className:"px-3 pb-2",children:[d.jsxs("div",{className:"flex items-start",children:[d.jsx("div",{className:"flex flex-col pr-2",style:{width:$,gap:B},children:h.map(G=>{const Z=G===e;return d.jsx(aSe,{runPath:i,groupId:r,sampleId:G,isEval:f,isCanceled:k,children:d.jsx("button",{className:`text-[10px] font-semibold text-center rounded transition-colors flex items-center justify-center ${Z?k?"text-muted-foreground bg-gray-400/15 hover:bg-gray-400/25":N?"text-muted-foreground bg-gray-500/15 hover:bg-gray-500/25":O?"text-yellow-800 bg-yellow-500/15 hover:bg-yellow-500/25":D?"text-emerald-800 bg-emerald-500/15 hover:bg-emerald-500/25":"text-sky-900 bg-sky-500/15 hover:bg-sky-500/25":k?"text-muted-foreground bg-gray-400/10 hover:bg-gray-400/20":N?"text-muted-foreground bg-gray-500/10 hover:bg-gray-500/20":O?"text-yellow-700 bg-yellow-500/10 hover:bg-yellow-500/20":D?"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:L,width:34},children:G})},G)})}),d.jsx("div",{className:"relative flex-1 bg-muted/30 rounded-lg border border-border/50",style:{height:H},children:h.map((G,Z)=>{var se;const V=t[G],W=G===e,J=Z*(L+B),ne=W?k?x?LY:OY:N?x?"#9ca3af":"#6b7280":O?x?"rgba(161, 98, 7, 0.8)":"rgba(161, 98, 7, 0.9)":D?MSe:SSe:R,ie=[...V].sort((re,K)=>re.start_time-K.start_time),z=(s==null?void 0:s[G])??[],j=(o==null?void 0:o[G])??0,X=(se=a==null?void 0:a.running_compute_reward)==null?void 0:se.find(re=>re.sample_id===G&&re.group_id===r),F=X&&(a!=null&&a.snapshot_time)?a.snapshot_time-X.start_time:0,ce=[];for(let re=0;re<ie.length&&re<z.length;re++){const K=z[re].time;K>0&&ce.push({start:ie[re].end_time,duration:K,idx:re})}const oe=j>0?j:F;let Q=0;if(oe>0&&ie.length>0){if(X)Q=X.start_time;else if(Q=ie[ie.length-1].end_time,z.length>=ie.length){const K=z[ie.length-1];K&&K.time>0&&(Q+=K.time)}}return d.jsxs("div",{className:"absolute left-0 right-0",style:{top:J,height:L},children:[V.map((re,K)=>{const he=(re.start_time-n.start)/n.duration*100,ae=re.end_time-re.start_time,Se=ae*1e3,de=Math.max(.5,ae/n.duration*100);return d.jsx(Fc,{className:`absolute top-px bottom-px group ${l?"cursor-pointer":""}`,style:{left:`${he}%`,width:`${Math.min(de,100-he)}%`,backgroundColor:ne,borderRadius:"1px",border:k?_:b,boxSizing:"border-box"},onClick:l?()=>l(G):void 0,tooltip:d.jsx(fu,{title:re.sample_id!==void 0?`Sample ${re.sample_id}`:re.group_id!==void 0?`Group ${re.group_id}`:"Request",titleSecondary:re.group_id!==void 0?`Group ${re.group_id}`:null,color:ne,statusLabel:k?{text:"Canceled",className:"text-muted-foreground"}:N?{text:"Discarded",className:"text-red-700"}:null,details:EY(re,Se,[{label:"Server",value:String(re.server)},...c&&re.node_id!==null&&re.node_id!==void 0?[{label:"Node",value:String(re.node_id)}]:[]]),startTime:re.start_time,endTime:re.end_time})},`req-${K}`)}),ce.map(re=>{const fe=(re.start-n.start)/n.duration*100,he=Math.max(.3,re.duration/n.duration*100),ae=re.duration*1e3,Se=W?N?x?"#9ca3af":"#6b7280":jY:N?x?VY:GY:UY;return d.jsx(Fc,{className:`absolute top-px bottom-px group ${l?"cursor-pointer":""}`,style:{left:`${fe}%`,width:`${Math.min(he,100-fe)}%`,backgroundColor:Se,borderRadius:"1px",border:S,boxSizing:"border-box",opacity:.85},onClick:l?()=>l(G):void 0,tooltip:d.jsx(fu,{title:"Env Response",titleSecondary:`Turn ${re.idx}`,color:Se,details:[{label:"Duration",value:xs(ae)}]})},`env-${re.idx}`)}),oe>0&&ie.length>0&&(()=>{const re=!!X&&j<=0,fe=(Q-n.start)/n.duration*100,he=Math.max(.3,oe/n.duration*100),ae=oe*1e3,Se=re?x?"rgba(250, 204, 21, 0.5)":"rgba(234, 179, 8, 0.5)":W?N?x?"#9ca3af":"#6b7280":f?FY:zY:N?f?x?XY:qY:x?$Y:WY:f?HY:BY,de=re?x?"1.5px dashed rgba(250, 204, 21, 0.7)":"1.5px dashed rgba(234, 179, 8, 0.7)":S;return d.jsx(Fc,{className:`absolute top-px bottom-px group ${l?"cursor-pointer":""}`,style:{left:`${fe}%`,width:`${Math.min(he,100-fe)}%`,backgroundColor:Se,borderRadius:"1px",border:de,boxSizing:"border-box",opacity:.85},onClick:l?()=>l(G):void 0,tooltip:d.jsx(fu,{title:f?"Compute Metrics":"Compute Reward",statusLabel:re?{text:"In Progress",className:"text-yellow-500"}:{text:"Waiting for Group",className:"text-yellow-600"},color:Se,details:[{label:"Duration",value:xs(ae)}]})})})()]},G)})})]}),d.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",style:{marginLeft:$},children:[d.jsx("span",{children:xs(0)}),d.jsx("span",{children:xs(n.duration/2*1e3)}),d.jsx("span",{children:xs(n.duration*1e3)})]})]}):d.jsx("div",{className:"px-3 pb-2 flex items-center justify-center",style:{height:H+24},children:d.jsx("span",{className:"text-xs text-muted-foreground",children:"Loading…"})})}function OSe({server:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,numLanes:o,selectedRequest:a,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:f,onEventClick:h,showWeightUpdate:m=!0,showComputeReward:x=!1,laneHeight:b=14,laneStart:_=0,maxLanesToShow:S,freeLaneAfterGeneration:M=!1,rewardStartedKeys:T,rewardEndedKeys:A}){const N=Kn(us),D=N?"1px solid rgba(255, 255, 255, 0.15)":"1px solid rgba(0, 0, 0, 0.2)",k=N?"1.5px solid rgba(255, 255, 255, 0.15)":"1.5px solid rgba(0, 0, 0, 0.2)",O=n&&e!==null&&e!==void 0?e:void 0,R=w.useMemo(()=>r.filter(z=>z.event_type==="weight_broadcast"),[r]),L=w.useMemo(()=>r.filter(z=>z.event_type==="request"),[r]),{assignedEvents:B,actualNumLanes:H}=w.useMemo(()=>{const z=[],j=[];for(const F of L)F.lane!=null&&F.lane>=0?z.push({...F,lane:F.lane}):j.push(F);if(j.length>0){const F=[...j].sort((oe,Q)=>oe.start_time-Q.start_time),ce=[];for(const oe of F){const Q=M?oe.end_time+(oe.environment_response_time??0):oe.end_time+(oe.environment_response_time??0)+(oe.compute_reward_time??0);let se=!1;for(let re=0;re<ce.length;re++)if(ce[re]<=oe.start_time){ce[re]=Q,z.push({...oe,lane:re}),se=!0;break}if(!se){const re=ce.length;ce.push(Q),z.push({...oe,lane:re})}}}const X=z.reduce((F,ce)=>Math.max(F,ce.lane),-1);return{assignedEvents:z,actualNumLanes:Math.max(o,X+1)}},[L,o,M]),$=i+s,G=b,Z=S!==void 0?Math.min(_+S,H):H,V=Math.max(0,Z-_),W=V*G+Math.max(0,V-1)*2,J=w.useMemo(()=>Array.from({length:V},(z,j)=>j),[V]),{laneEventsByIndex:ne,idlePeriodsByLane:ie}=w.useMemo(()=>{const z=Array.from({length:H},()=>[]);for(const X of B){const F=X.lane;z[F]&&z[F].push(X)}const j=z.map(X=>{const F=[];if(X.length>0){X[0].start_time>i&&F.push({start:i,end:X[0].start_time,duration:X[0].start_time-i});for(let oe=0;oe<X.length-1;oe++){const Q=X[oe].end_time,se=X[oe+1].start_time;Q<se&&F.push({start:Q,end:se,duration:se-Q})}const ce=X[X.length-1];ce.end_time<$&&F.push({start:ce.end_time,end:$,duration:$-ce.end_time})}else F.push({start:i,end:$,duration:s});return F});return{laneEventsByIndex:z,idlePeriodsByLane:j}},[B,i,$,s,H]);return d.jsxs("div",{children:[d.jsxs("div",{className:"text-xs font-medium text-muted-foreground mb-0.5 flex items-center gap-1.5",children:[d.jsxs("span",{children:["Server ",t]}),n&&e!==null&&e!==void 0&&d.jsxs("span",{className:"text-[10px] text-muted-foreground/80",children:["Node ",e]})]}),d.jsx("div",{className:"relative",children:d.jsxs("div",{className:"relative bg-muted/30 rounded-lg border border-border/50",style:{height:W},children:[J.map(z=>{const j=z+_,X=z*(G+2),F=ne[j]||[],ce=ie[j]||[];return d.jsxs("div",{className:"absolute left-0 right-0",style:{top:X,height:G},children:[ce.map((oe,Q)=>{const se=Math.max(oe.start,i),re=Math.min(oe.end,$),K=re-se,fe=(se-i)/s*100,he=K/s*100;if(he<.5||fe>=100||re<=se)return null;const ae=N?x8:jw;return d.jsx(Fc,{className:"absolute top-0 bottom-0 group",style:{left:`${fe}%`,width:`${Math.min(he,100-fe)}%`,backgroundColor:ae,borderRadius:"1px"},tooltip:d.jsx(fu,{title:"Idle",color:ae,details:[{label:"Duration",value:xs(oe.duration*1e3)},{label:"Server",value:String(t)},...O!==void 0?[{label:"Node",value:String(O)}]:[],{label:"Lane",value:String(j)}]})},`idle-${Q}`)}),F.map((oe,Q)=>{const se=oe.environment_response_time,re=oe.compute_reward_time,K=NR(oe,"env",a,l,c,f,N),fe=NR(oe,"reward",a,l,c,f,N);return d.jsxs(w.Fragment,{children:[d.jsx(zSe,{event:oe,server:t,nodeId:O,lane:j,intervalStart:i,intervalDuration:s,selectedRequest:a,sampleStatusByKey:l,highlightDiscarded:c,discardStatusReady:f,onClick:()=>h(oe),rewardStartedKeys:T,rewardEndedKeys:A}),se!=null&&se>0&&(()=>{const he=i+s,ae=oe.end_time,Se=ae+se;if(ae>=he||Se<=i)return null;const de=Math.max(ae,i),Me=Math.min(Se,he),Ce=Math.max(0,(de-i)/s*100),Re=Math.max(.3,(Me-de)/s*100),le=se*1e3;return d.jsx(Fc,{className:"absolute top-0 bottom-0 group cursor-pointer",style:{left:`${Ce}%`,width:`${Math.min(Re,100-Ce)}%`,backgroundColor:K.color,borderRadius:"1px",border:D,boxSizing:"border-box",opacity:K.opacity},onClick:()=>h(oe),tooltip:d.jsx(fu,{title:"Env Response",titleSecondary:oe.sample_id!==void 0?`Sample ${oe.sample_id}`:void 0,color:K.color,details:[{label:"Duration",value:xs(le)},...oe.group_id!==void 0?[{label:"Group",value:String(oe.group_id)}]:[],{label:"Server",value:String(t)},...O!==void 0?[{label:"Node",value:String(O)}]:[],{label:"Lane",value:String(j)}]})})})(),x&&re!=null&&re>0&&(()=>{const he=i+s,ae=oe.end_time+(se!=null&&se>0?se:0),Se=ae+re;if(ae>=he||Se<=i)return null;const de=Math.max(ae,i),Me=Math.min(Se,he),Ce=Math.max(0,(de-i)/s*100),Re=Math.max(.3,(Me-de)/s*100),le=re*1e3,He=M?Math.max(3,Math.round(G*.4)):void 0,Le=M?Math.round((G-He)/2):void 0;return d.jsx(Fc,{className:"absolute group cursor-pointer",style:{left:`${Ce}%`,width:`${Math.min(Re,100-Ce)}%`,backgroundColor:fe.color,borderRadius:"1px",border:D,boxSizing:"border-box",opacity:fe.opacity,...M?{top:Le,height:He,zIndex:2}:{top:0,bottom:0}},onClick:()=>h(oe),tooltip:d.jsx(fu,{title:oe.is_eval?"Compute Metrics":"Waiting for Reward",titleSecondary:oe.sample_id!==void 0?`Sample ${oe.sample_id}`:void 0,color:fe.color,details:[{label:"Duration",value:xs(le)},...oe.group_id!==void 0?[{label:"Group",value:String(oe.group_id)}]:[],{label:"Server",value:String(t)},...O!==void 0?[{label:"Node",value:String(O)}]:[],{label:"Lane",value:String(j)}]})})})()]},`event-${Q}`)})]},j)}),m&&R.map((z,j)=>{const X=z.start_time-i,F=Math.max(0,X/s*100),oe=(z.end_time-z.start_time)*1e3,Q=Math.max(z.start_time,i),se=z.end_time-Q,re=Math.max(.5,se/s*100),K=qW(z.event_type);return d.jsx(Fc,{className:"absolute group cursor-default",style:{top:0,left:`${F}%`,width:`${Math.min(re,100-F)}%`,height:W,backgroundColor:K,borderRadius:"2px",border:k,boxSizing:"border-box",opacity:.6},tooltip:d.jsx(fu,{title:"Weight Broadcast",color:K,details:[...z.step!=null?[{label:"Step",value:String(z.step)}]:[],{label:"Duration",value:xs(oe)},{label:"Server",value:String(t)},...O!==void 0?[{label:"Node",value:String(O)}]:[]],startTime:z.start_time,endTime:z.end_time})},`wb-${j}`)})]})})]})}function LSe(t,e,n=!0,r=!0,i=!1){if(t.event_type!=="request")return qW(t.event_type);if(t.phase==="inflight")return i?"rgba(250, 204, 21, 0.5)":"rgba(234, 179, 8, 0.5)";if(t.is_canceled)return i?Lw:dC;if(!n||t.is_eval)return t.is_eval?FA:rw;if(!r)return i?"rgba(202, 138, 4, 0.6)":"rgba(202, 138, 4, 0.7)";if(!e||t.sample_id==null||t.group_id==null)return t.is_eval?FA:rw;const s=`${t.group_id}:${t.sample_id}`,o=e.get(s);return o==="rollouts_discarded"?i?uC:cC:o==null?i?"rgba(202, 138, 4, 0.6)":"rgba(202, 138, 4, 0.7)":t.is_eval?FA:rw}function jSe(t,e,n,r=!0,i=!0,s=!1){const o=LSe(t,n,r,i,s);if(!e)return{color:o,opacity:1};const a=o===cC||o===uC,l=o===dC||o===Lw,c=t.phase==="inflight"||o.includes("202, 138, 4")||o.includes("234, 179, 8")||o.includes("250, 204, 21");return t.sample_id===e.sampleId?l?{color:s?LY:OY,opacity:1}:a?{color:s?"#9ca3af":"#6b7280",opacity:1}:c?{color:s?"rgba(161, 98, 7, 0.8)":"rgba(161, 98, 7, 0.9)",opacity:1}:{color:t.is_eval?wSe:_Se,opacity:1}:t.group_id===e.groupId?l?{color:s?DY:IY,opacity:1}:a?{color:s?PY:RY,opacity:1}:c?{color:s?"rgba(202, 138, 4, 0.7)":"rgba(202, 138, 4, 0.8)",opacity:1}:{color:t.is_eval?kY:NY,opacity:1}:{color:o,opacity:.55}}function NR(t,e,n,r,i,s,o=!1){const a=e==="reward"&&t.is_eval,l=(()=>{if(!i)return!1;if(!s)return!0;if(t.sample_id==null||t.group_id==null)return!1;const f=`${t.group_id}:${t.sample_id}`;return r.get(f)==="rollouts_discarded"})(),c=l?e==="env"?o?ESe:CSe:a?o?ISe:PSe:o?kSe:NSe:e==="env"?TSe:a?RSe:ASe;return n?t.sample_id===n.sampleId?l?{color:o?"#9ca3af":"#6b7280",opacity:1}:{color:e==="env"?jY:a?FY:zY,opacity:1}:t.group_id===n.groupId?{color:l?e==="env"?o?VY:GY:a?o?XY:qY:o?$Y:WY:e==="env"?UY:a?HY:BY,opacity:1}:{color:c,opacity:.35}:{color:c,opacity:.85}}function zSe({event:t,server:e,nodeId:n,lane:r,intervalStart:i,intervalDuration:s,selectedRequest:o,sampleStatusByKey:a,highlightDiscarded:l,discardStatusReady:c,onClick:f,rewardStartedKeys:h,rewardEndedKeys:m}){const x=Kn(us),b=i+s;if(t.end_time<=i||t.start_time>=b)return null;const _=t.start_time-i,S=Math.max(0,_/s*100),T=(t.end_time-t.start_time)*1e3,A=Math.max(t.start_time,i),D=(t.end_time-A)/s*100,{color:k,opacity:O}=jSe(t,o,a,l,c,x),R=t.event_type==="request"&&t.sample_id!==void 0,L=(()=>{if(t.event_type!=="request")return null;if(t.phase==="inflight")return{text:"In Progress",className:"text-yellow-500"};if(t.is_canceled)return{text:"Canceled",className:"text-muted-foreground"};if(t.phase==="end"&&t.sample_id!=null&&t.group_id!=null){const B=`${t.group_id}:${t.sample_id}`,H=h==null?void 0:h.has(B),$=m==null?void 0:m.has(B);return H?$?{text:"Finished (Waiting for Group)",className:"text-yellow-600"}:{text:"Finished (Waiting for Reward)",className:"text-yellow-600"}:{text:"Finished (Waiting)",className:"text-yellow-600"}}if(l&&!t.is_eval&&t.sample_id!=null&&t.group_id!=null){if(!c)return{text:"Pending Status",className:"text-yellow-600"};const B=`${t.group_id}:${t.sample_id}`,H=a.get(B);if(H==="rollouts_discarded")return{text:"Discarded",className:"text-red-700"};if(H==null)return{text:"Finished (Waiting for Group)",className:"text-yellow-600"}}return null})();return d.jsx(Fc,{className:`absolute top-0 bottom-0 group ${R?"cursor-pointer":"cursor-default"}`,style:{left:`${S}%`,width:`${Math.min(D,100-S)}%`,minWidth:"1px",backgroundColor:k,borderRadius:"1px",border:t.phase==="inflight"?x?"1.5px dashed rgba(250, 204, 21, 0.7)":"1.5px dashed rgba(234, 179, 8, 0.7)":t.is_canceled?x?"1.5px solid rgba(255, 255, 255, 0.15)":"1.5px solid rgba(0, 0, 0, 0.2)":x?"1.5px solid rgba(255, 255, 255, 0.2)":"1.5px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box",opacity:O},onClick:R?f:void 0,tooltip:d.jsx(fu,{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:k,capitalize:!0,statusLabel:L,details:t.event_type==="request"?EY(t,T,[{label:"Server",value:String(e)},...n!=null?[{label:"Node",value:String(n)}]:[],{label:"Lane",value:String(r)}]):[{label:"Duration",value:xs(T)},{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 FSe({ranks:t,eventsByRank:e,intervalStart:n,intervalDuration:r,intervalEnd:i,trainerGpuMetricsByGpuIndex:s,trainerGpuMetricsByRank:o,trainerGpuMetricsIsLoading:a,trainerAvailableGpuMetrics:l,selectedMetricNames:c,onSelectedMetricNamesChange:f,trainerSystemGpuIndices:h,trainerRankInfoByRank:m,totalSetupNodes:x,isLoading:b}){var se;const[_,S]=w.useState(!0),[M,T]=cn(jW),[A,N]=cn(Sue),D=w.useMemo(()=>{const re=new Set;return(l??[]).forEach(K=>{typeof K=="string"&&re.add(K)}),Array.from(re)},[l]),[k,O]=w.useState([]),R=((h==null?void 0:h.length)??0)===0;R&&k.length>0?O([]):!R&&D.length>0&&k!==D&&O(D);const L=w.useMemo(()=>R?[]:D.length>0?D:k,[R,D,k]),B=w.useMemo(()=>Array.from(new Set((c??[]).filter(re=>typeof re=="string"&&re.trim().length>0))),[c]),H=w.useMemo(()=>L.length===0?B:B.filter(re=>L.includes(re)),[L,B]),$=w.useMemo(()=>{const re=Object.keys(m??{}).map(Number).filter(K=>Number.isFinite(K)).sort((K,fe)=>K-fe);return re.length>0?re:!h||h.length===0?[]:h.map((K,fe)=>fe)},[m,h]),G=w.useMemo(()=>{const re=new Set;return t.forEach(K=>re.add(K)),$.forEach(K=>re.add(K)),Array.from(re).sort((K,fe)=>K-fe)},[t,$]),Z=8,V=G.length>Z,W=w.useMemo(()=>{if(!V)return[];const re=[];for(let K=0;K<G.length;K+=Z){const fe=G.slice(K,K+Z),he=K+1,ae=Math.min(K+Z,G.length);re.push({label:`${he} – ${ae}`,ranks:fe})}return re},[G,V]),J=V?Math.min(A,Math.max(0,W.length-1)):0;w.useEffect(()=>{V&&A!==J&&N(J)},[V,A,J,N]);const ne=V?((se=W[J])==null?void 0:se.ranks)??G.slice(0,Z):G;w.useMemo(()=>new Set(ne),[ne]);const ie=w.useMemo(()=>{const re=new Map;return Object.entries(e).forEach(([K,fe])=>{const he=new Set;fe.forEach(ae=>{if(!ae.event_type.includes("/"))return;const Se=ae.event_type.split("/")[0];he.add(`${Se}|${ae.step}`)}),re.set(Number(K),he)}),re},[e]),z=w.useMemo(()=>{const re=new Map;return ne.forEach(K=>{var ae;const fe=((ae=m==null?void 0:m[K])==null?void 0:ae.node_id)??null,he=fe===null?"__unknown__":String(fe);re.has(he)||re.set(he,{nodeId:fe,ranks:[]}),re.get(he).ranks.push(K)}),Array.from(re.values()).map(K=>({nodeId:K.nodeId,ranks:K.ranks.sort((fe,he)=>fe-he)})).sort((K,fe)=>K.nodeId===null&&fe.nodeId===null?0:K.nodeId===null?1:fe.nodeId===null?-1:K.nodeId-fe.nodeId)},[ne,m]),j=w.useMemo(()=>typeof x=="number"&&Number.isFinite(x)?x>1:z.filter(K=>K.nodeId!==null).length>1,[z,x]),X=w.useCallback(re=>{var fe;re.event_type.includes("/")||!(((fe=ie.get(re.rank))==null?void 0:fe.has(`${re.event_type}|${re.step}`))??!1)||T(he=>(he==null?void 0:he.eventType)===re.event_type&&(he==null?void 0:he.rank)===re.rank&&(he==null?void 0:he.step)===re.step?null:{eventType:re.event_type,rank:re.rank,step:re.step})},[ie,T]),F=w.useCallback((re,K)=>{const fe=H,ae=K===!0?fe.includes(re)?fe:[...fe,re]:fe.filter(Se=>Se!==re);f==null||f(ae)},[H,f]),ce=w.useCallback(()=>f==null?void 0:f([...L]),[L,f]),oe=w.useCallback(()=>f==null?void 0:f([]),[f]),Q=w.useCallback(re=>{const K=m==null?void 0:m[re],fe=(K==null?void 0:K.local_rank)??(h?h[re]:void 0),he=(o==null?void 0:o[re])??(fe!==void 0&&s?s[fe]??[]:void 0);return d.jsx(BSe,{rank:re,nodeId:(K==null?void 0:K.node_id)??null,showNodeLabel:j,events:e[re]||[],intervalStart:n,intervalDuration:r,intervalEnd:i,selectedEvent:M,onEventClick:X,childEventKeys:ie.get(re)??hSe,systemGpuIndex:fe,gpuMetrics:he,selectedMetricNames:H,gpuMetricsIsLoading:a??!1},re)},[ie,H,e,X,r,i,n,M,s,o,a,m,h,j]);return d.jsxs(Pi,{open:_,onOpenChange:S,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(Ii,{asChild:!0,children:d.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-muted rounded transition-colors",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!_&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"Trainer GPUs"}),d.jsx("div",{className:"w-6 flex items-center justify-center shrink-0",children:b&&d.jsx(Ya,{className:"size-3.5 text-muted-foreground"})})]})}),_&&d.jsxs(d.Fragment,{children:[V&&d.jsxs(gy,{value:String(J),onValueChange:re=>N(Number(re)),children:[d.jsx(vy,{size:"sm",className:"text-xs h-7 gap-1",children:d.jsx(xy,{})}),d.jsx(yy,{children:W.map((re,K)=>d.jsxs(Ox,{value:String(K),children:["GPUs ",re.label]},K))})]}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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",d.jsx("span",{className:"text-[10px] font-medium rounded bg-accent text-accent-foreground px-1.5 py-0.5",children:H.length}),d.jsx(Rr,{className:"h-3 w-3 text-muted-foreground"})]})}),d.jsxs($s,{align:"start",className:"w-64",children:[d.jsx(y0,{children:"Trainer GPU Plots"}),d.jsx(ys,{}),d.jsx(Mo,{onSelect:re=>{re.preventDefault(),ce()},className:"text-xs",children:"Select All"}),d.jsx(Mo,{onSelect:re=>{re.preventDefault(),oe()},className:"text-xs",children:"Unselect All"}),d.jsx(ys,{}),L.length>0?L.map(re=>d.jsx(hr,{checked:H.includes(re),onCheckedChange:K=>F(re,K),onSelect:K=>K.preventDefault(),className:"text-xs",children:AY(re)},re)):d.jsx(Mo,{disabled:!0,className:"text-xs text-muted-foreground",children:a?"Loading plots...":"No plots available"})]})]})]})]}),d.jsxs(Di,{children:[d.jsx("div",{className:"space-y-4",children:ne.length>0?j?z.map(re=>d.jsx(USe,{nodeId:re.nodeId,rankCount:re.ranks.length,children:re.ranks.map(K=>Q(K))},re.nodeId===null?"__unknown__":String(re.nodeId))):ne.map(re=>Q(re)):d.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"})}),d.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[d.jsx("span",{children:bp(0)}),d.jsx("span",{children:bp(r/2)}),d.jsx("span",{children:bp(r)})]})]})]})}function USe({nodeId:t,rankCount:e,children:n}){const[r,i]=w.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return d.jsxs(Pi,{open:r,onOpenChange:i,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!r&&"-rotate-90")}),d.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s}),d.jsxs("span",{className:"text-[11px] text-muted-foreground/80",children:[e," GPU",e!==1?"s":""]})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"space-y-4 mt-2",children:n})})]})}function BSe({rank:t,nodeId:e,showNodeLabel:n,events:r,intervalStart:i,intervalDuration:s,intervalEnd:o,selectedEvent:a,onEventClick:l,childEventKeys:c,systemGpuIndex:f,gpuMetrics:h,selectedMetricNames:m,gpuMetricsIsLoading:x}){const b=w.useMemo(()=>[...r.filter(D=>!D.event_type.includes("/"))].sort((D,k)=>D.start_time-k.start_time),[r]),_=w.useMemo(()=>YY(b,i,o),[b,i,o]),S=w.useMemo(()=>{if(!h||h.length===0)return{};const N={};return h.forEach(D=>{N[D.metric_name]||(N[D.metric_name]=[]),N[D.metric_name].push(D)}),N},[h]),M=w.useMemo(()=>{const N=new Set;return h==null||h.forEach(D=>{Number.isFinite(D.gpu_index)&&N.add(D.gpu_index)}),N.size>0?Array.from(N).sort((D,k)=>D-k):f!==void 0?[f]:[]},[h,f]),T=n&&e!==null&&e!==void 0?`Rank ${t} Node ${e}`:`Rank ${t}`,A=w.useMemo(()=>{if(M.length===0)return;const N={};return M.forEach(D=>{N[D]=T}),N},[M,T]);return d.jsxs("div",{children:[d.jsxs("div",{className:"text-xs font-medium text-muted-foreground mb-0.5 flex items-center gap-1.5",children:[d.jsxs("span",{children:["Rank ",t]}),n&&e!==null&&e!==void 0&&d.jsxs("span",{className:"text-[10px] text-muted-foreground/80",children:["Node ",e]})]}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"relative h-12 bg-muted/30 rounded-lg border border-border/50",children:[_.map((N,D)=>d.jsx(HSe,{idle:N,rank:t,intervalStart:i,intervalDuration:s,dimmed:a!==null},`idle-${D}`)),b.map((N,D)=>{const k=(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,O=c.has(`${N.event_type}|${N.step}`),R=a!==null&&!k;return d.jsx(GSe,{event:N,intervalStart:i,intervalDuration:s,isSelected:k,isDimmed:R,hasChildren:O,onClick:()=>l(N)},`${N.start_time}-${N.rank}-${D}`)})]}),M.length>0&&m.map(N=>d.jsxs("div",{className:`mt-2 transition-opacity duration-200 ${x?"opacity-50":""}`,children:[d.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-0.5",children:AY(N)}),d.jsx(Uq,{metricName:N,data:S[N]??[],gpuIndices:M,intervalStart:i,intervalEnd:o,variant:"timeline",strokeColor:"#ef4444",gpuDisplayNames:A,isLoading:x})]},N))]})]})}function HSe({idle:t,rank:e,intervalStart:n,intervalDuration:r,dimmed:i=!1}){const o=Kn(us)?x8:jw,l=(t.start-n)/r*100,c=t.duration/r*100;return c<.5||l<0||l>=100?null:d.jsx(Fc,{className:"absolute top-1 bottom-1 group cursor-pointer transition-opacity duration-200",style:{left:`${l}%`,width:`${Math.min(c,100-l)}%`,backgroundColor:o,borderRadius:"2px",opacity:i?.3:1},tooltip:d.jsx(fu,{title:"Idle",color:o,details:[{label:"Duration",value:xs(t.duration*1e3)},{label:"Rank",value:String(e)}],startTime:t.start,endTime:t.end})})}function GSe({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,m=Math.max(t.start_time,e),b=(t.end_time-m)/n*100,_=J2(t.event_type),S=XW(t.event_type,t.step,t.microbatch,t.minibatch);return d.jsx(Fc,{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:d.jsx(fu,{title:S.primary,titleSecondary:S.secondary,color:_,details:[{label:"Duration",value:xs(h)},{label:"Rank",value:String(t.rank)},...s?[{label:"Click",value:"to expand children"}]:[]],startTime:t.start_time,endTime:t.end_time})})}function VSe({parentEvent:t,childEvents:e}){const n=Kn(us),r=[...e].sort((l,c)=>l.start_time-c.start_time),i=t.start_time,s=t.end_time,o=s-i,a=YY(r,i,s);return d.jsxs("div",{className:"px-3 pb-2",children:[d.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2 text-xs",children:r.map(l=>{const c=J2(l.event_type),f=l.event_type.includes("/")?l.event_type.split("/").pop():l.event_type,h=l.end_time-l.start_time,m=o>0?(h/o*100).toFixed(0):"0";return d.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full",style:{backgroundColor:`${c}20`},children:[d.jsx("div",{className:"w-2 h-2 rounded-sm",style:{backgroundColor:c}}),d.jsx("span",{className:"capitalize text-muted-foreground",children:f}),d.jsx("span",{className:"font-medium",children:xs(h*1e3)}),d.jsxs("span",{className:"text-muted-foreground",children:[m,"%"]})]},l.event_type)})}),d.jsx("div",{className:"relative",children:d.jsxs("div",{className:"relative h-7 bg-muted/30 rounded-lg border border-border/50",children:[a.map((l,c)=>{const h=(l.start-i)/o*100,m=l.duration/o*100;return m<.5||h<0||h>=100?null:d.jsx(Fc,{className:"absolute top-px bottom-px group",style:{left:`${h}%`,width:`${Math.min(m,100-h)}%`,backgroundColor:jw,borderRadius:"1px",opacity:.5},tooltip:d.jsx(fu,{title:"Gap",color:jw,details:[{label:"Duration",value:xs(l.duration*1e3)}]})},`child-idle-${c}`)}),r.map((l,c)=>{const f=l.start_time-i,h=Math.max(0,f/o*100),m=l.end_time-l.start_time,x=m*1e3,b=Math.max(.5,m/o*100),_=J2(l.event_type),S=l.event_type.includes("/")?l.event_type.split("/").pop():l.event_type;return d.jsx(Fc,{className:"absolute top-px bottom-px group cursor-default flex items-center justify-center",style:{left:`${h}%`,width:`${Math.min(b,100-h)}%`,backgroundColor:_,borderRadius:"1px",border:n?"1px solid rgba(255, 255, 255, 0.2)":"1px solid rgba(0, 0, 0, 0.3)",boxSizing:"border-box"},tooltip:d.jsx(fu,{title:S||l.event_type,color:_,capitalize:!0,details:[{label:"Duration",value:xs(x)},{label:"% of parent",value:`${(m/o*100).toFixed(1)}%`}],startTime:l.start_time,endTime:l.end_time}),children:b>8&&d.jsx("span",{className:"text-[9px] font-medium text-white truncate px-1 drop-shadow-sm pointer-events-none",children:S})},`child-${l.start_time}-${c}`)})]})}),d.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground mt-1",children:[d.jsx("span",{children:xs(0)}),d.jsx("span",{children:xs(o/2*1e3)}),d.jsx("span",{children:xs(o*1e3)})]})]})}function fu({title:t,titleSecondary:e,color:n,details:r,capitalize:i=!1,timestamp:s,startTime:o,endTime:a,statusLabel:l}){return d.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:[d.jsxs("div",{className:"font-semibold mb-1.5 flex items-center gap-2",children:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm flex-shrink-0",style:{backgroundColor:n}}),d.jsxs("span",{className:i?"capitalize":"",children:[t,e&&d.jsx("span",{className:"text-muted-foreground font-normal ml-1",children:e})]})]}),l&&d.jsx("div",{className:`font-semibold mb-1.5 ${l.className}`,children:l.text}),d.jsxs("div",{className:"space-y-0.5 text-muted-foreground",children:[r.map(c=>d.jsxs("div",{children:[c.label,": ",c.value]},c.label)),s!==void 0&&d.jsxs("div",{children:["Time: ",new Date(s*1e3).toISOString().slice(11,23)]}),o!==void 0&&d.jsxs("div",{children:["Start: ",new Date(o*1e3).toISOString().slice(11,23)]}),a!==void 0&&d.jsxs("div",{children:["End: ",new Date(a*1e3).toISOString().slice(11,23)]})]})]})}function Fc({className:t,style:e,onClick:n,tooltip:r,children:i,interactive:s=!1}){const[o,a]=w.useState(!1),[l,c]=w.useState(!1),[f,h]=w.useState({x:0,y:0}),[m,x]=w.useState(null),b=w.useRef(null),_=w.useRef(null),S=o||l,M=l&&m?m:f;w.useLayoutEffect(()=>{const A=b.current;if(!S||!A)return;const N=A.getBoundingClientRect(),D=8;let k=M.x-N.width/2;k+N.width+D>window.innerWidth&&(k=window.innerWidth-N.width-D),k<D&&(k=D);let O=M.y-N.height-12;O<D&&(O=M.y+16),O+N.height+D>window.innerHeight&&(O=window.innerHeight-N.height-D),A.style.left=`${k}px`,A.style.top=`${O}px`,A.style.visibility="visible"},[S,M]),w.useEffect(()=>{if(!l)return;const A=D=>{var O,R;const k=D.target;(O=b.current)!=null&&O.contains(k)||(R=_.current)!=null&&R.contains(k)||(c(!1),x(null))},N=setTimeout(()=>{document.addEventListener("pointerdown",A)},0);return()=>{clearTimeout(N),document.removeEventListener("pointerdown",A)}},[l]);const T=w.useCallback(()=>{s&&c(A=>A?(x(null),!1):(x(f),!0)),n==null||n()},[s,n,f]);return d.jsxs("div",{ref:_,className:t,style:e,onClick:T,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,S?Yl.createPortal(d.jsx("div",{ref:b,className:"fixed",style:{left:M.x,top:M.y,zIndex:99999,visibility:"hidden",pointerEvents:l?"auto":"none"},children:r}),document.body):null]})}function YY(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 NP({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]=w.useState(s.toString());w.useEffect(()=>{c(s.toString())},[s]);const f=x=>{c(x.target.value)},h=x=>{if(x.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())}},m=()=>{c(s.toString())};return d.jsxs("div",{className:"flex items-center gap-0.5",children:[d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(0),disabled:r||t===0,title:"First page",children:d.jsx(vde,{className:"h-3.5 w-3.5"})}),d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t-1),disabled:r||t===0,title:"Previous page",children:d.jsx(eC,{className:"h-3.5 w-3.5"})}),d.jsxs("div",{className:"flex items-center gap-1 text-xs px-1",children:[d.jsx(tf,{type:"number",value:l,onChange:f,onKeyDown:h,onBlur:m,disabled:r,className:"w-12 h-6 text-center px-1 py-0 text-xs",min:o,max:a}),d.jsxs("span",{className:"text-muted-foreground",children:["/ ",a]})]}),d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t+1),disabled:r||t>=e-1,title:"Next page",children:d.jsx(p0,{className:"h-3.5 w-3.5"})}),d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(e-1),disabled:r||t>=e-1,title:"Last page",children:d.jsx(bde,{className:"h-3.5 w-3.5"})})]})}/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const QS="183",rx={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ix={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},KY=0,kR=1,ZY=2,WSe=3,QY=0,q1=1,mw=2,cx=3,Lp=0,Jl=1,uu=2,fh=0,Tx=1,RR=2,PR=3,IR=4,JY=5,$Se=6,Zm=100,eK=101,tK=102,nK=103,rK=104,iK=200,sK=201,oK=202,aK=203,_5=204,w5=205,lK=206,cK=207,uK=208,dK=209,fK=210,hK=211,pK=212,mK=213,gK=214,S5=0,M5=1,T5=2,jx=3,C5=4,E5=5,A5=6,N5=7,JS=0,xK=1,vK=2,vu=0,kP=1,RP=2,PP=3,VC=4,IP=5,DP=6,OP=7,DR="attached",yK="detached",WC=300,gh=301,k0=302,gw=303,xw=304,lb=306,qw=1e3,Uc=1001,Xw=1002,zo=1003,LP=1004,qSe=1004,N1=1005,XSe=1005,as=1006,vw=1007,YSe=1007,ah=1008,KSe=1008,ql=1009,jP=1010,zP=1011,Oy=1012,$C=1013,xd=1014,Ql=1015,xh=1016,qC=1017,XC=1018,Ly=1020,FP=35902,UP=35899,BP=1021,HP=1022,bl=1023,vh=1026,u0=1027,YC=1028,e3=1029,zx=1030,KC=1031,ZSe=1032,ZC=1033,yw=33776,bw=33777,_w=33778,ww=33779,k5=35840,R5=35841,P5=35842,I5=35843,D5=36196,O5=37492,L5=37496,j5=37488,z5=37489,F5=37490,U5=37491,B5=37808,H5=37809,G5=37810,V5=37811,W5=37812,$5=37813,q5=37814,X5=37815,Y5=37816,K5=37817,Z5=37818,Q5=37819,J5=37820,eT=37821,tT=36492,nT=36494,rT=36495,iT=36283,sT=36284,oT=36285,aT=36286,bK=2200,_K=2201,wK=2202,Yw=2300,lT=2301,w2=2302,OR=2303,ux=2400,dx=2401,Kw=2402,QC=2500,GP=2501,QSe=0,JSe=1,e3e=2,SK=3200,MK=3201,t3e=3202,n3e=3203,K0=0,TK=1,xp="",yl="srgb",R0="srgb-linear",Zw="linear",Hi="srgb",r3e="",i3e="rg",s3e="ga",o3e=0,sx=7680,a3e=7681,l3e=7682,c3e=7683,u3e=34055,d3e=34056,f3e=5386,h3e=512,p3e=513,m3e=514,g3e=515,x3e=516,v3e=517,y3e=518,LR=519,CK=512,EK=513,AK=514,JC=515,NK=516,kK=517,eE=518,RK=519,Qw=35044,b3e=35048,_3e=35040,w3e=35045,S3e=35049,M3e=35041,T3e=35046,C3e=35050,E3e=35042,A3e="100",jR="300 es",hu=2e3,Fx=2001,N3e={COMPUTE:"compute",RENDER:"render"},k3e={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},R3e={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},P3e={TEXTURE_COMPARE:"depthTextureCompare"};function I3e(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const D3e={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function k1(t,e){return new D3e[t](e)}function PK(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Jw(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function IK(){const t=Jw("canvas");return t.style.display="block",t}const Bj={};let P0=null;function O3e(t){P0=t}function L3e(){return P0}function eS(...t){const e="THREE."+t.shift();P0?P0("log",e,...t):console.log(e,...t)}function DK(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 En(...t){t=DK(t);const e="THREE."+t.shift();if(P0)P0("warn",e,...t);else{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function qn(...t){t=DK(t);const e="THREE."+t.shift();if(P0)P0("error",e,...t);else{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function tS(...t){const e=t.join(" ");e in Bj||(Bj[e]=!0,En(...t))}function j3e(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 z3e={[S5]:M5,[T5]:A5,[C5]:N5,[jx]:E5,[M5]:S5,[A5]:T5,[N5]:C5,[E5]:jx};let Eh=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 pl=["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 Hj=1234567;const Cx=Math.PI/180,jy=180/Math.PI;function yu(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(pl[t&255]+pl[t>>8&255]+pl[t>>16&255]+pl[t>>24&255]+"-"+pl[e&255]+pl[e>>8&255]+"-"+pl[e>>16&15|64]+pl[e>>24&255]+"-"+pl[n&63|128]+pl[n>>8&255]+"-"+pl[n>>16&255]+pl[n>>24&255]+pl[r&255]+pl[r>>8&255]+pl[r>>16&255]+pl[r>>24&255]).toLowerCase()}function gr(t,e,n){return Math.max(e,Math.min(n,t))}function VP(t,e){return(t%e+e)%e}function F3e(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function U3e(t,e,n){return t!==e?(n-t)/(e-t):0}function Sw(t,e,n){return(1-n)*t+n*e}function B3e(t,e,n,r){return Sw(t,e,1-Math.exp(-n*r))}function H3e(t,e=1){return e-Math.abs(VP(t,e*2)-e)}function G3e(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function V3e(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function W3e(t,e){return t+Math.floor(Math.random()*(e-t+1))}function $3e(t,e){return t+Math.random()*(e-t)}function q3e(t){return t*(.5-Math.random())}function X3e(t){t!==void 0&&(Hj=t);let e=Hj+=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 Y3e(t){return t*Cx}function K3e(t){return t*jy}function Z3e(t){return(t&t-1)===0&&t!==0}function Q3e(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function J3e(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function e4e(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),f=o((e+r)/2),h=s((e-r)/2),m=o((e-r)/2),x=s((r-e)/2),b=o((r-e)/2);switch(i){case"XYX":t.set(a*f,l*h,l*m,a*c);break;case"YZY":t.set(l*m,a*f,l*h,a*c);break;case"ZXZ":t.set(l*h,l*m,a*f,a*c);break;case"XZX":t.set(a*f,l*b,l*x,a*c);break;case"YXY":t.set(l*x,a*f,l*b,a*c);break;case"ZYZ":t.set(l*b,l*x,a*f,a*c);break;default:En("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Xl(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 jr(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 OK={DEG2RAD:Cx,RAD2DEG:jy,generateUUID:yu,clamp:gr,euclideanModulo:VP,mapLinear:F3e,inverseLerp:U3e,lerp:Sw,damp:B3e,pingpong:H3e,smoothstep:G3e,smootherstep:V3e,randInt:W3e,randFloat:$3e,randFloatSpread:q3e,seededRandom:X3e,degToRad:Y3e,radToDeg:K3e,isPowerOfTwo:Z3e,ceilPowerOfTwo:Q3e,floorPowerOfTwo:J3e,setQuaternionFromProperEuler:e4e,normalize:jr,denormalize:Xl};class qt{constructor(e=0,n=0){qt.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=gr(this.x,e.x,n.x),this.y=gr(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=gr(this.x,e,n),this.y=gr(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(gr(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(gr(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 Za{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],f=r[i+2],h=r[i+3],m=s[o+0],x=s[o+1],b=s[o+2],_=s[o+3];if(h!==_||l!==m||c!==x||f!==b){let S=l*m+c*x+f*b+h*_;S<0&&(m=-m,x=-x,b=-b,_=-_,S=-S);let M=1-a;if(S<.9995){const T=Math.acos(S),A=Math.sin(T);M=Math.sin(M*T)/A,a=Math.sin(a*T)/A,l=l*M+m*a,c=c*M+x*a,f=f*M+b*a,h=h*M+_*a}else{l=l*M+m*a,c=c*M+x*a,f=f*M+b*a,h=h*M+_*a;const T=1/Math.sqrt(l*l+c*c+f*f+h*h);l*=T,c*=T,f*=T,h*=T}}e[n]=l,e[n+1]=c,e[n+2]=f,e[n+3]=h}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],f=r[i+3],h=s[o],m=s[o+1],x=s[o+2],b=s[o+3];return e[n]=a*b+f*h+l*x-c*m,e[n+1]=l*b+f*m+c*h-a*x,e[n+2]=c*b+f*x+a*m-l*h,e[n+3]=f*b-a*h-l*m-c*x,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),f=a(i/2),h=a(s/2),m=l(r/2),x=l(i/2),b=l(s/2);switch(o){case"XYZ":this._x=m*f*h+c*x*b,this._y=c*x*h-m*f*b,this._z=c*f*b+m*x*h,this._w=c*f*h-m*x*b;break;case"YXZ":this._x=m*f*h+c*x*b,this._y=c*x*h-m*f*b,this._z=c*f*b-m*x*h,this._w=c*f*h+m*x*b;break;case"ZXY":this._x=m*f*h-c*x*b,this._y=c*x*h+m*f*b,this._z=c*f*b+m*x*h,this._w=c*f*h-m*x*b;break;case"ZYX":this._x=m*f*h-c*x*b,this._y=c*x*h+m*f*b,this._z=c*f*b-m*x*h,this._w=c*f*h+m*x*b;break;case"YZX":this._x=m*f*h+c*x*b,this._y=c*x*h+m*f*b,this._z=c*f*b-m*x*h,this._w=c*f*h-m*x*b;break;case"XZY":this._x=m*f*h-c*x*b,this._y=c*x*h-m*f*b,this._z=c*f*b+m*x*h,this._w=c*f*h+m*x*b;break;default:En("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],f=n[6],h=n[10],m=r+a+h;if(m>0){const x=.5/Math.sqrt(m+1);this._w=.25/x,this._x=(f-l)*x,this._y=(s-c)*x,this._z=(o-i)*x}else if(r>a&&r>h){const x=2*Math.sqrt(1+r-a-h);this._w=(f-l)/x,this._x=.25*x,this._y=(i+o)/x,this._z=(s+c)/x}else if(a>h){const x=2*Math.sqrt(1+a-r-h);this._w=(s-c)/x,this._x=(i+o)/x,this._y=.25*x,this._z=(l+f)/x}else{const x=2*Math.sqrt(1+h-r-a);this._w=(o-i)/x,this._x=(s+c)/x,this._y=(l+f)/x,this._z=.25*x}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(gr(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,f=n._w;return this._x=r*f+o*a+i*c-s*l,this._y=i*f+o*l+s*a-r*c,this._z=s*f+o*c+r*l-i*a,this._w=o*f-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),f=Math.sin(c);l=Math.sin(l*c)/f,n=Math.sin(n*c)/f,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 Ge{constructor(e=0,n=0,r=0){Ge.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(Gj.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Gj.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),f=2*(a*n-s*i),h=2*(s*r-o*n);return this.x=n+l*c+o*h-a*f,this.y=r+l*f+a*c-s*h,this.z=i+l*h+s*f-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=gr(this.x,e.x,n.x),this.y=gr(this.y,e.y,n.y),this.z=gr(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=gr(this.x,e,n),this.y=gr(this.y,e,n),this.z=gr(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(gr(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 z6.copy(this).projectOnVector(e),this.sub(z6)}reflect(e){return this.sub(z6.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(gr(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 z6=new Ge,Gj=new Za;class Er{constructor(e,n,r,i,s,o,a,l,c){Er.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 f=this.elements;return f[0]=e,f[1]=i,f[2]=a,f[3]=n,f[4]=s,f[5]=l,f[6]=r,f[7]=o,f[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],f=r[4],h=r[7],m=r[2],x=r[5],b=r[8],_=i[0],S=i[3],M=i[6],T=i[1],A=i[4],N=i[7],D=i[2],k=i[5],O=i[8];return s[0]=o*_+a*T+l*D,s[3]=o*S+a*A+l*k,s[6]=o*M+a*N+l*O,s[1]=c*_+f*T+h*D,s[4]=c*S+f*A+h*k,s[7]=c*M+f*N+h*O,s[2]=m*_+x*T+b*D,s[5]=m*S+x*A+b*k,s[8]=m*M+x*N+b*O,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],f=e[8];return n*o*f-n*a*c-r*s*f+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],f=e[8],h=f*o-a*c,m=a*l-f*s,x=c*s-o*l,b=n*h+r*m+i*x;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-f*r)*_,e[2]=(a*r-i*o)*_,e[3]=m*_,e[4]=(f*n-i*l)*_,e[5]=(i*s-a*n)*_,e[6]=x*_,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(F6.makeScale(e,n)),this}rotate(e){return this.premultiply(F6.makeRotation(-e)),this}translate(e,n){return this.premultiply(F6.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 F6=new Er,Vj=new Er().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Wj=new Er().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function t4e(){const t={enabled:!0,workingColorSpace:R0,spaces:{},convert:function(i,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Hi&&(i.r=Mp(i.r),i.g=Mp(i.g),i.b=Mp(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===Hi&&(i.r=X1(i.r),i.g=X1(i.g),i.b=X1(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===xp?Zw: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 tS("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return tS("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[R0]:{primaries:e,whitePoint:r,transfer:Zw,toXYZ:Vj,fromXYZ:Wj,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:yl},outputColorSpaceConfig:{drawingBufferColorSpace:yl}},[yl]:{primaries:e,whitePoint:r,transfer:Hi,toXYZ:Vj,fromXYZ:Wj,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:yl}}}),t}const li=t4e();function Mp(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function X1(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let e1;class LK{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{e1===void 0&&(e1=Jw("canvas")),e1.width=e.width,e1.height=e.height;const i=e1.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=e1}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=Jw("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]=Mp(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(Mp(n[r]/255)*255):n[r]=Mp(n[r]);return{data:n,width:e.width,height:e.height}}else return En("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let n4e=0;class d0{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:n4e++}),this.uuid=yu(),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(U6(i[o].image)):s.push(U6(i[o]))}else s=U6(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function U6(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?LK.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(En("Texture: Unable to serialize Texture."),{})}let r4e=0;const B6=new Ge;class fo extends Eh{constructor(e=fo.DEFAULT_IMAGE,n=fo.DEFAULT_MAPPING,r=Uc,i=Uc,s=as,o=ah,a=bl,l=ql,c=fo.DEFAULT_ANISOTROPY,f=xp){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:r4e++}),this.uuid=yu(),this.name="",this.source=new d0(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 qt(0,0),this.repeat=new qt(1,1),this.center=new qt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Er,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,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(B6).x}get height(){return this.source.getSize(B6).y}get depth(){return this.source.getSize(B6).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){En(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){En(`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!==WC)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case qw:e.x=e.x-Math.floor(e.x);break;case Uc:e.x=e.x<0?0:1;break;case Xw: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 qw:e.y=e.y-Math.floor(e.y);break;case Uc:e.y=e.y<0?0:1;break;case Xw: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++}}fo.DEFAULT_IMAGE=null;fo.DEFAULT_MAPPING=WC;fo.DEFAULT_ANISOTROPY=1;class pi{constructor(e=0,n=0,r=0,i=1){pi.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],f=l[4],h=l[8],m=l[1],x=l[5],b=l[9],_=l[2],S=l[6],M=l[10];if(Math.abs(f-m)<.01&&Math.abs(h-_)<.01&&Math.abs(b-S)<.01){if(Math.abs(f+m)<.1&&Math.abs(h+_)<.1&&Math.abs(b+S)<.1&&Math.abs(c+x+M-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const A=(c+1)/2,N=(x+1)/2,D=(M+1)/2,k=(f+m)/4,O=(h+_)/4,R=(b+S)/4;return A>N&&A>D?A<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(A),i=k/r,s=O/r):N>D?N<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(N),r=k/i,s=R/i):D<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(D),r=O/s,i=R/s),this.set(r,i,s,n),this}let T=Math.sqrt((S-b)*(S-b)+(h-_)*(h-_)+(m-f)*(m-f));return Math.abs(T)<.001&&(T=1),this.x=(S-b)/T,this.y=(h-_)/T,this.z=(m-f)/T,this.w=Math.acos((c+x+M-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=gr(this.x,e.x,n.x),this.y=gr(this.y,e.y,n.y),this.z=gr(this.z,e.z,n.z),this.w=gr(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=gr(this.x,e,n),this.y=gr(this.y,e,n),this.z=gr(this.z,e,n),this.w=gr(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(gr(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 WP extends Eh{constructor(e=1,n=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:as,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 pi(0,0,e,n),this.scissorTest=!1,this.viewport=new pi(0,0,e,n),this.textures=[];const i={width:e,height:n,depth:r.depth},s=new fo(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:as,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 d0(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 bu extends WP{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class tE extends fo{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=zo,this.minFilter=zo,this.wrapR=Uc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class i4e extends bu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new tE(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class nE extends fo{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=zo,this.minFilter=zo,this.wrapR=Uc,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class s4e extends bu{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new nE(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class pr{constructor(e,n,r,i,s,o,a,l,c,f,h,m,x,b,_,S){pr.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,f,h,m,x,b,_,S)}set(e,n,r,i,s,o,a,l,c,f,h,m,x,b,_,S){const M=this.elements;return M[0]=e,M[4]=n,M[8]=r,M[12]=i,M[1]=s,M[5]=o,M[9]=a,M[13]=l,M[2]=c,M[6]=f,M[10]=h,M[14]=m,M[3]=x,M[7]=b,M[11]=_,M[15]=S,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 pr().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/t1.setFromMatrixColumn(e,0).length(),s=1/t1.setFromMatrixColumn(e,1).length(),o=1/t1.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),f=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const m=o*f,x=o*h,b=a*f,_=a*h;n[0]=l*f,n[4]=-l*h,n[8]=c,n[1]=x+b*c,n[5]=m-_*c,n[9]=-a*l,n[2]=_-m*c,n[6]=b+x*c,n[10]=o*l}else if(e.order==="YXZ"){const m=l*f,x=l*h,b=c*f,_=c*h;n[0]=m+_*a,n[4]=b*a-x,n[8]=o*c,n[1]=o*h,n[5]=o*f,n[9]=-a,n[2]=x*a-b,n[6]=_+m*a,n[10]=o*l}else if(e.order==="ZXY"){const m=l*f,x=l*h,b=c*f,_=c*h;n[0]=m-_*a,n[4]=-o*h,n[8]=b+x*a,n[1]=x+b*a,n[5]=o*f,n[9]=_-m*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const m=o*f,x=o*h,b=a*f,_=a*h;n[0]=l*f,n[4]=b*c-x,n[8]=m*c+_,n[1]=l*h,n[5]=_*c+m,n[9]=x*c-b,n[2]=-c,n[6]=a*l,n[10]=o*l}else if(e.order==="YZX"){const m=o*l,x=o*c,b=a*l,_=a*c;n[0]=l*f,n[4]=_-m*h,n[8]=b*h+x,n[1]=h,n[5]=o*f,n[9]=-a*f,n[2]=-c*f,n[6]=x*h+b,n[10]=m-_*h}else if(e.order==="XZY"){const m=o*l,x=o*c,b=a*l,_=a*c;n[0]=l*f,n[4]=-h,n[8]=c*f,n[1]=m*h+_,n[5]=o*f,n[9]=x*h-b,n[2]=b*h-x,n[6]=a*f,n[10]=_*h+m}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(o4e,e,a4e)}lookAt(e,n,r){const i=this.elements;return iu.subVectors(e,n),iu.lengthSq()===0&&(iu.z=1),iu.normalize(),Lm.crossVectors(r,iu),Lm.lengthSq()===0&&(Math.abs(r.z)===1?iu.x+=1e-4:iu.z+=1e-4,iu.normalize(),Lm.crossVectors(r,iu)),Lm.normalize(),sM.crossVectors(iu,Lm),i[0]=Lm.x,i[4]=sM.x,i[8]=iu.x,i[1]=Lm.y,i[5]=sM.y,i[9]=iu.y,i[2]=Lm.z,i[6]=sM.z,i[10]=iu.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],f=r[1],h=r[5],m=r[9],x=r[13],b=r[2],_=r[6],S=r[10],M=r[14],T=r[3],A=r[7],N=r[11],D=r[15],k=i[0],O=i[4],R=i[8],L=i[12],B=i[1],H=i[5],$=i[9],G=i[13],Z=i[2],V=i[6],W=i[10],J=i[14],ne=i[3],ie=i[7],z=i[11],j=i[15];return s[0]=o*k+a*B+l*Z+c*ne,s[4]=o*O+a*H+l*V+c*ie,s[8]=o*R+a*$+l*W+c*z,s[12]=o*L+a*G+l*J+c*j,s[1]=f*k+h*B+m*Z+x*ne,s[5]=f*O+h*H+m*V+x*ie,s[9]=f*R+h*$+m*W+x*z,s[13]=f*L+h*G+m*J+x*j,s[2]=b*k+_*B+S*Z+M*ne,s[6]=b*O+_*H+S*V+M*ie,s[10]=b*R+_*$+S*W+M*z,s[14]=b*L+_*G+S*J+M*j,s[3]=T*k+A*B+N*Z+D*ne,s[7]=T*O+A*H+N*V+D*ie,s[11]=T*R+A*$+N*W+D*z,s[15]=T*L+A*G+N*J+D*j,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],f=e[2],h=e[6],m=e[10],x=e[14],b=e[3],_=e[7],S=e[11],M=e[15],T=l*x-c*m,A=a*x-c*h,N=a*m-l*h,D=o*x-c*f,k=o*m-l*f,O=o*h-a*f;return n*(_*T-S*A+M*N)-r*(b*T-S*D+M*k)+i*(b*A-_*D+M*O)-s*(b*N-_*k+S*O)}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],f=e[8],h=e[9],m=e[10],x=e[11],b=e[12],_=e[13],S=e[14],M=e[15],T=n*a-r*o,A=n*l-i*o,N=n*c-s*o,D=r*l-i*a,k=r*c-s*a,O=i*c-s*l,R=f*_-h*b,L=f*S-m*b,B=f*M-x*b,H=h*S-m*_,$=h*M-x*_,G=m*M-x*S,Z=T*G-A*$+N*H+D*B-k*L+O*R;if(Z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const V=1/Z;return e[0]=(a*G-l*$+c*H)*V,e[1]=(i*$-r*G-s*H)*V,e[2]=(_*O-S*k+M*D)*V,e[3]=(m*k-h*O-x*D)*V,e[4]=(l*B-o*G-c*L)*V,e[5]=(n*G-i*B+s*L)*V,e[6]=(S*N-b*O-M*A)*V,e[7]=(f*O-m*N+x*A)*V,e[8]=(o*$-a*B+c*R)*V,e[9]=(r*B-n*$-s*R)*V,e[10]=(b*k-_*N+M*T)*V,e[11]=(h*N-f*k-x*T)*V,e[12]=(a*L-o*H-l*R)*V,e[13]=(n*H-r*L+i*R)*V,e[14]=(_*A-b*D-S*T)*V,e[15]=(f*D-h*A+m*T)*V,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,f=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,f*a+r,f*l-i*o,0,c*l-i*a,f*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,f=o+o,h=a+a,m=s*c,x=s*f,b=s*h,_=o*f,S=o*h,M=a*h,T=l*c,A=l*f,N=l*h,D=r.x,k=r.y,O=r.z;return i[0]=(1-(_+M))*D,i[1]=(x+N)*D,i[2]=(b-A)*D,i[3]=0,i[4]=(x-N)*k,i[5]=(1-(m+M))*k,i[6]=(S+T)*k,i[7]=0,i[8]=(b+A)*O,i[9]=(S-T)*O,i[10]=(1-(m+_))*O,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=t1.set(i[0],i[1],i[2]).length();const a=t1.set(i[4],i[5],i[6]).length(),l=t1.set(i[8],i[9],i[10]).length();s<0&&(o=-o),Wd.copy(this);const c=1/o,f=1/a,h=1/l;return Wd.elements[0]*=c,Wd.elements[1]*=c,Wd.elements[2]*=c,Wd.elements[4]*=f,Wd.elements[5]*=f,Wd.elements[6]*=f,Wd.elements[8]*=h,Wd.elements[9]*=h,Wd.elements[10]*=h,n.setFromRotationMatrix(Wd),r.x=o,r.y=a,r.z=l,this}makePerspective(e,n,r,i,s,o,a=hu,l=!1){const c=this.elements,f=2*s/(n-e),h=2*s/(r-i),m=(n+e)/(n-e),x=(r+i)/(r-i);let b,_;if(l)b=s/(o-s),_=o*s/(o-s);else if(a===hu)b=-(o+s)/(o-s),_=-2*o*s/(o-s);else if(a===Fx)b=-o/(o-s),_=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=f,c[4]=0,c[8]=m,c[12]=0,c[1]=0,c[5]=h,c[9]=x,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=hu,l=!1){const c=this.elements,f=2/(n-e),h=2/(r-i),m=-(n+e)/(n-e),x=-(r+i)/(r-i);let b,_;if(l)b=1/(o-s),_=o/(o-s);else if(a===hu)b=-2/(o-s),_=-(o+s)/(o-s);else if(a===Fx)b=-1/(o-s),_=-s/(o-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=f,c[4]=0,c[8]=0,c[12]=m,c[1]=0,c[5]=h,c[9]=0,c[13]=x,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 t1=new Ge,Wd=new pr,o4e=new Ge(0,0,0),a4e=new Ge(1,1,1),Lm=new Ge,sM=new Ge,iu=new Ge,$j=new pr,qj=new Za;class Su{constructor(e=0,n=0,r=0,i=Su.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],f=i[9],h=i[2],m=i[6],x=i[10];switch(n){case"XYZ":this._y=Math.asin(gr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,x),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-gr(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(a,x),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(gr(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-h,x),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-gr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(m,x),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(gr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,x));break;case"XZY":this._z=Math.asin(-gr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-f,x),this._y=0);break;default:En("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return $j.makeRotationFromQuaternion(e),this.setFromRotationMatrix($j,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return qj.setFromEuler(this),this.setFromQuaternion(qj,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Su.DEFAULT_ORDER="XYZ";class zy{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 l4e=0;const Xj=new Ge,n1=new Za,np=new pr,oM=new Ge,A_=new Ge,c4e=new Ge,u4e=new Za,Yj=new Ge(1,0,0),Kj=new Ge(0,1,0),Zj=new Ge(0,0,1),Qj={type:"added"},d4e={type:"removed"},r1={type:"childadded",child:null},H6={type:"childremoved",child:null};class wi extends Eh{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:l4e++}),this.uuid=yu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=wi.DEFAULT_UP.clone();const e=new Ge,n=new Su,r=new Za,i=new Ge(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 pr},normalMatrix:{value:new Er}}),this.matrix=new pr,this.matrixWorld=new pr,this.matrixAutoUpdate=wi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=wi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new zy,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 n1.setFromAxisAngle(e,n),this.quaternion.multiply(n1),this}rotateOnWorldAxis(e,n){return n1.setFromAxisAngle(e,n),this.quaternion.premultiply(n1),this}rotateX(e){return this.rotateOnAxis(Yj,e)}rotateY(e){return this.rotateOnAxis(Kj,e)}rotateZ(e){return this.rotateOnAxis(Zj,e)}translateOnAxis(e,n){return Xj.copy(e).applyQuaternion(this.quaternion),this.position.add(Xj.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(Yj,e)}translateY(e){return this.translateOnAxis(Kj,e)}translateZ(e){return this.translateOnAxis(Zj,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(np.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?oM.copy(e):oM.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),A_.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?np.lookAt(A_,oM,this.up):np.lookAt(oM,A_,this.up),this.quaternion.setFromRotationMatrix(np),i&&(np.extractRotation(i.matrixWorld),n1.setFromRotationMatrix(np),this.quaternion.premultiply(n1.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(qn("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(Qj),r1.child=e,this.dispatchEvent(r1),r1.child=null):qn("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(d4e),H6.child=e,this.dispatchEvent(H6),H6.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),np.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),np.multiply(e.parent.matrixWorld)),e.applyMatrix4(np),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Qj),r1.child=e,this.dispatchEvent(r1),r1.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(A_,e,c4e),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(A_,u4e,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,f=l.length;c<f;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),f=o(e.images),h=o(e.shapes),m=o(e.skeletons),x=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),f.length>0&&(r.images=f),h.length>0&&(r.shapes=h),m.length>0&&(r.skeletons=m),x.length>0&&(r.animations=x),b.length>0&&(r.nodes=b)}return r.object=i,r;function o(a){const l=[];for(const c in a){const f=a[c];delete f.metadata,l.push(f)}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}}wi.DEFAULT_UP=new Ge(0,1,0);wi.DEFAULT_MATRIX_AUTO_UPDATE=!0;wi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class R1 extends wi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const f4e={type:"move"};class S2{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new R1,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 R1,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ge,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ge),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new R1,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ge,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ge),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 S=n.getJointPose(_,r),M=this._getHandJoint(c,_);S!==null&&(M.matrix.fromArray(S.transform.matrix),M.matrix.decompose(M.position,M.rotation,M.scale),M.matrixWorldNeedsUpdate=!0,M.jointRadius=S.radius),M.visible=S!==null}const f=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],m=f.position.distanceTo(h.position),x=.02,b=.005;c.inputState.pinching&&m>x+b?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&m<=x-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(f4e)))}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 R1;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const jK={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},jm={h:0,s:0,l:0},aM={h:0,s:0,l:0};function G6(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 Rn{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=yl){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,li.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=li.workingColorSpace){return this.r=e,this.g=n,this.b=r,li.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=li.workingColorSpace){if(e=VP(e,1),n=gr(n,0,1),r=gr(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=G6(o,s,e+1/3),this.g=G6(o,s,e),this.b=G6(o,s,e-1/3)}return li.colorSpaceToWorking(this,i),this}setStyle(e,n=yl){function r(s){s!==void 0&&parseFloat(s)<1&&En("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:En("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);En("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=yl){const r=jK[e.toLowerCase()];return r!==void 0?this.setHex(r,n):En("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=Mp(e.r),this.g=Mp(e.g),this.b=Mp(e.b),this}copyLinearToSRGB(e){return this.r=X1(e.r),this.g=X1(e.g),this.b=X1(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=yl){return li.workingToColorSpace(ml.copy(this),e),Math.round(gr(ml.r*255,0,255))*65536+Math.round(gr(ml.g*255,0,255))*256+Math.round(gr(ml.b*255,0,255))}getHexString(e=yl){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=li.workingColorSpace){li.workingToColorSpace(ml.copy(this),n);const r=ml.r,i=ml.g,s=ml.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const f=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=f<=.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=f,e}getRGB(e,n=li.workingColorSpace){return li.workingToColorSpace(ml.copy(this),n),e.r=ml.r,e.g=ml.g,e.b=ml.b,e}getStyle(e=yl){li.workingToColorSpace(ml.copy(this),e);const n=ml.r,r=ml.g,i=ml.b;return e!==yl?`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(jm),this.setHSL(jm.h+e,jm.s+n,jm.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(jm),e.getHSL(aM);const r=Sw(jm.h,aM.h,n),i=Sw(jm.s,aM.s,n),s=Sw(jm.l,aM.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 ml=new Rn;Rn.NAMES=jK;class rE{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new Rn(e),this.density=n}clone(){return new rE(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class iE{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new Rn(e),this.near=n,this.far=r}clone(){return new iE(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}let $P=class extends wi{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Su,this.environmentIntensity=1,this.environmentRotation=new Su,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}};const $d=new Ge,rp=new Ge,V6=new Ge,ip=new Ge,i1=new Ge,s1=new Ge,Jj=new Ge,W6=new Ge,$6=new Ge,q6=new Ge,X6=new pi,Y6=new pi,K6=new pi;class zc{constructor(e=new Ge,n=new Ge,r=new Ge){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),$d.subVectors(e,n),i.cross($d);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){$d.subVectors(i,n),rp.subVectors(r,n),V6.subVectors(e,n);const o=$d.dot($d),a=$d.dot(rp),l=$d.dot(V6),c=rp.dot(rp),f=rp.dot(V6),h=o*c-a*a;if(h===0)return s.set(0,0,0),null;const m=1/h,x=(c*l-a*f)*m,b=(o*f-a*l)*m;return s.set(1-x-b,b,x)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,ip)===null?!1:ip.x>=0&&ip.y>=0&&ip.x+ip.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,ip)===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,ip.x),l.addScaledVector(o,ip.y),l.addScaledVector(a,ip.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return X6.setScalar(0),Y6.setScalar(0),K6.setScalar(0),X6.fromBufferAttribute(e,n),Y6.fromBufferAttribute(e,r),K6.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(X6,s.x),o.addScaledVector(Y6,s.y),o.addScaledVector(K6,s.z),o}static isFrontFacing(e,n,r,i){return $d.subVectors(r,n),rp.subVectors(e,n),$d.cross(rp).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 $d.subVectors(this.c,this.b),rp.subVectors(this.a,this.b),$d.cross(rp).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return zc.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return zc.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return zc.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return zc.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return zc.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;i1.subVectors(i,r),s1.subVectors(s,r),W6.subVectors(e,r);const l=i1.dot(W6),c=s1.dot(W6);if(l<=0&&c<=0)return n.copy(r);$6.subVectors(e,i);const f=i1.dot($6),h=s1.dot($6);if(f>=0&&h<=f)return n.copy(i);const m=l*h-f*c;if(m<=0&&l>=0&&f<=0)return o=l/(l-f),n.copy(r).addScaledVector(i1,o);q6.subVectors(e,s);const x=i1.dot(q6),b=s1.dot(q6);if(b>=0&&x<=b)return n.copy(s);const _=x*c-l*b;if(_<=0&&c>=0&&b<=0)return a=c/(c-b),n.copy(r).addScaledVector(s1,a);const S=f*b-x*h;if(S<=0&&h-f>=0&&x-b>=0)return Jj.subVectors(s,i),a=(h-f)/(h-f+(x-b)),n.copy(i).addScaledVector(Jj,a);const M=1/(S+_+m);return o=_*M,a=m*M,n.copy(r).addScaledVector(i1,o).addScaledVector(s1,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Fo{constructor(e=new Ge(1/0,1/0,1/0),n=new Ge(-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(qd.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(qd.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=qd.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,qd):qd.fromBufferAttribute(s,o),qd.applyMatrix4(e.matrixWorld),this.expandByPoint(qd);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),lM.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),lM.copy(r.boundingBox)),lM.applyMatrix4(e.matrixWorld),this.union(lM)}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,qd),qd.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(N_),cM.subVectors(this.max,N_),o1.subVectors(e.a,N_),a1.subVectors(e.b,N_),l1.subVectors(e.c,N_),zm.subVectors(a1,o1),Fm.subVectors(l1,a1),Ug.subVectors(o1,l1);let n=[0,-zm.z,zm.y,0,-Fm.z,Fm.y,0,-Ug.z,Ug.y,zm.z,0,-zm.x,Fm.z,0,-Fm.x,Ug.z,0,-Ug.x,-zm.y,zm.x,0,-Fm.y,Fm.x,0,-Ug.y,Ug.x,0];return!Z6(n,o1,a1,l1,cM)||(n=[1,0,0,0,1,0,0,0,1],!Z6(n,o1,a1,l1,cM))?!1:(uM.crossVectors(zm,Fm),n=[uM.x,uM.y,uM.z],Z6(n,o1,a1,l1,cM))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,qd).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(qd).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:(sp[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),sp[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),sp[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),sp[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),sp[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),sp[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),sp[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),sp[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(sp),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 sp=[new Ge,new Ge,new Ge,new Ge,new Ge,new Ge,new Ge,new Ge],qd=new Ge,lM=new Fo,o1=new Ge,a1=new Ge,l1=new Ge,zm=new Ge,Fm=new Ge,Ug=new Ge,N_=new Ge,cM=new Ge,uM=new Ge,Bg=new Ge;function Z6(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){Bg.fromArray(t,s);const a=i.x*Math.abs(Bg.x)+i.y*Math.abs(Bg.y)+i.z*Math.abs(Bg.z),l=e.dot(Bg),c=n.dot(Bg),f=r.dot(Bg);if(Math.max(-Math.max(l,c,f),Math.min(l,c,f))>a)return!1}return!0}const vp=h4e();function h4e(){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,f=0;for(;(c&8388608)===0;)c<<=1,f-=8388608;c&=-8388609,f+=947912704,s[l]=c|f}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 kc(t){Math.abs(t)>65504&&En("DataUtils.toHalfFloat(): Value out of range."),t=gr(t,-65504,65504),vp.floatView[0]=t;const e=vp.uint32View[0],n=e>>23&511;return vp.baseTable[n]+((e&8388607)>>vp.shiftTable[n])}function J_(t){const e=t>>10;return vp.uint32View[0]=vp.mantissaTable[vp.offsetTable[e]+(t&1023)]+vp.exponentTable[e],vp.floatView[0]}class p4e{static toHalfFloat(e){return kc(e)}static fromHalfFloat(e){return J_(e)}}const Ko=new Ge,dM=new qt;let m4e=0;class Xi{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:m4e++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=Qw,this.updateRanges=[],this.gpuType=Ql,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++)dM.fromBufferAttribute(this,n),dM.applyMatrix3(e),this.setXY(n,dM.x,dM.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)Ko.fromBufferAttribute(this,n),Ko.applyMatrix3(e),this.setXYZ(n,Ko.x,Ko.y,Ko.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)Ko.fromBufferAttribute(this,n),Ko.applyMatrix4(e),this.setXYZ(n,Ko.x,Ko.y,Ko.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Ko.fromBufferAttribute(this,n),Ko.applyNormalMatrix(e),this.setXYZ(n,Ko.x,Ko.y,Ko.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Ko.fromBufferAttribute(this,n),Ko.transformDirection(e),this.setXYZ(n,Ko.x,Ko.y,Ko.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=Xl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=jr(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=Xl(n,this.array)),n}setX(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=Xl(n,this.array)),n}setY(e,n){return this.normalized&&(n=jr(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=Xl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=jr(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=Xl(n,this.array)),n}setW(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=jr(n,this.array),r=jr(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=jr(n,this.array),r=jr(r,this.array),i=jr(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=jr(n,this.array),r=jr(r,this.array),i=jr(i,this.array),s=jr(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!==Qw&&(e.usage=this.usage),e}}class g4e extends Xi{constructor(e,n,r){super(new Int8Array(e),n,r)}}class x4e extends Xi{constructor(e,n,r){super(new Uint8Array(e),n,r)}}class v4e extends Xi{constructor(e,n,r){super(new Uint8ClampedArray(e),n,r)}}class y4e extends Xi{constructor(e,n,r){super(new Int16Array(e),n,r)}}class qP extends Xi{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class b4e extends Xi{constructor(e,n,r){super(new Int32Array(e),n,r)}}class XP extends Xi{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class _4e extends Xi{constructor(e,n,r){super(new Uint16Array(e),n,r),this.isFloat16BufferAttribute=!0}getX(e){let n=J_(this.array[e*this.itemSize]);return this.normalized&&(n=Xl(n,this.array)),n}setX(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize]=kc(n),this}getY(e){let n=J_(this.array[e*this.itemSize+1]);return this.normalized&&(n=Xl(n,this.array)),n}setY(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+1]=kc(n),this}getZ(e){let n=J_(this.array[e*this.itemSize+2]);return this.normalized&&(n=Xl(n,this.array)),n}setZ(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+2]=kc(n),this}getW(e){let n=J_(this.array[e*this.itemSize+3]);return this.normalized&&(n=Xl(n,this.array)),n}setW(e,n){return this.normalized&&(n=jr(n,this.array)),this.array[e*this.itemSize+3]=kc(n),this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=jr(n,this.array),r=jr(r,this.array)),this.array[e+0]=kc(n),this.array[e+1]=kc(r),this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=jr(n,this.array),r=jr(r,this.array),i=jr(i,this.array)),this.array[e+0]=kc(n),this.array[e+1]=kc(r),this.array[e+2]=kc(i),this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=jr(n,this.array),r=jr(r,this.array),i=jr(i,this.array),s=jr(s,this.array)),this.array[e+0]=kc(n),this.array[e+1]=kc(r),this.array[e+2]=kc(i),this.array[e+3]=kc(s),this}}class jn extends Xi{constructor(e,n,r){super(new Float32Array(e),n,r)}}const w4e=new Fo,k_=new Ge,Q6=new Ge;class ea{constructor(e=new Ge,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):w4e.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;k_.subVectors(e,this.center);const n=k_.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(k_,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):(Q6.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(k_.copy(e.center).add(Q6)),this.expandByPoint(k_.copy(e.center).sub(Q6))),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 S4e=0;const Zu=new pr,J6=new wi,c1=new Ge,su=new Fo,R_=new Fo,Ca=new Ge;class Nr extends Eh{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:S4e++}),this.uuid=yu(),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(I3e(e)?XP:qP)(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 Er().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 Zu.makeRotationFromQuaternion(e),this.applyMatrix4(Zu),this}rotateX(e){return Zu.makeRotationX(e),this.applyMatrix4(Zu),this}rotateY(e){return Zu.makeRotationY(e),this.applyMatrix4(Zu),this}rotateZ(e){return Zu.makeRotationZ(e),this.applyMatrix4(Zu),this}translate(e,n,r){return Zu.makeTranslation(e,n,r),this.applyMatrix4(Zu),this}scale(e,n,r){return Zu.makeScale(e,n,r),this.applyMatrix4(Zu),this}lookAt(e){return J6.lookAt(e),J6.updateMatrix(),this.applyMatrix4(J6.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(c1).negate(),this.translate(c1.x,c1.y,c1.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 jn(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&&En("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 Fo);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){qn("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Ge(-1/0,-1/0,-1/0),new Ge(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];su.setFromBufferAttribute(s),this.morphTargetsRelative?(Ca.addVectors(this.boundingBox.min,su.min),this.boundingBox.expandByPoint(Ca),Ca.addVectors(this.boundingBox.max,su.max),this.boundingBox.expandByPoint(Ca)):(this.boundingBox.expandByPoint(su.min),this.boundingBox.expandByPoint(su.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&qn('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 ea);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){qn("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Ge,1/0);return}if(e){const r=this.boundingSphere.center;if(su.setFromBufferAttribute(e),n)for(let s=0,o=n.length;s<o;s++){const a=n[s];R_.setFromBufferAttribute(a),this.morphTargetsRelative?(Ca.addVectors(su.min,R_.min),su.expandByPoint(Ca),Ca.addVectors(su.max,R_.max),su.expandByPoint(Ca)):(su.expandByPoint(R_.min),su.expandByPoint(R_.max))}su.getCenter(r);let i=0;for(let s=0,o=e.count;s<o;s++)Ca.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(Ca));if(n)for(let s=0,o=n.length;s<o;s++){const a=n[s],l=this.morphTargetsRelative;for(let c=0,f=a.count;c<f;c++)Ca.fromBufferAttribute(a,c),l&&(c1.fromBufferAttribute(e,c),Ca.add(c1)),i=Math.max(i,r.distanceToSquared(Ca))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&qn('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){qn("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 Xi(new Float32Array(4*r.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let R=0;R<r.count;R++)a[R]=new Ge,l[R]=new Ge;const c=new Ge,f=new Ge,h=new Ge,m=new qt,x=new qt,b=new qt,_=new Ge,S=new Ge;function M(R,L,B){c.fromBufferAttribute(r,R),f.fromBufferAttribute(r,L),h.fromBufferAttribute(r,B),m.fromBufferAttribute(s,R),x.fromBufferAttribute(s,L),b.fromBufferAttribute(s,B),f.sub(c),h.sub(c),x.sub(m),b.sub(m);const H=1/(x.x*b.y-b.x*x.y);isFinite(H)&&(_.copy(f).multiplyScalar(b.y).addScaledVector(h,-x.y).multiplyScalar(H),S.copy(h).multiplyScalar(x.x).addScaledVector(f,-b.x).multiplyScalar(H),a[R].add(_),a[L].add(_),a[B].add(_),l[R].add(S),l[L].add(S),l[B].add(S))}let T=this.groups;T.length===0&&(T=[{start:0,count:e.count}]);for(let R=0,L=T.length;R<L;++R){const B=T[R],H=B.start,$=B.count;for(let G=H,Z=H+$;G<Z;G+=3)M(e.getX(G+0),e.getX(G+1),e.getX(G+2))}const A=new Ge,N=new Ge,D=new Ge,k=new Ge;function O(R){D.fromBufferAttribute(i,R),k.copy(D);const L=a[R];A.copy(L),A.sub(D.multiplyScalar(D.dot(L))).normalize(),N.crossVectors(k,L);const H=N.dot(l[R])<0?-1:1;o.setXYZW(R,A.x,A.y,A.z,H)}for(let R=0,L=T.length;R<L;++R){const B=T[R],H=B.start,$=B.count;for(let G=H,Z=H+$;G<Z;G+=3)O(e.getX(G+0)),O(e.getX(G+1)),O(e.getX(G+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new Xi(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let m=0,x=r.count;m<x;m++)r.setXYZ(m,0,0,0);const i=new Ge,s=new Ge,o=new Ge,a=new Ge,l=new Ge,c=new Ge,f=new Ge,h=new Ge;if(e)for(let m=0,x=e.count;m<x;m+=3){const b=e.getX(m+0),_=e.getX(m+1),S=e.getX(m+2);i.fromBufferAttribute(n,b),s.fromBufferAttribute(n,_),o.fromBufferAttribute(n,S),f.subVectors(o,s),h.subVectors(i,s),f.cross(h),a.fromBufferAttribute(r,b),l.fromBufferAttribute(r,_),c.fromBufferAttribute(r,S),a.add(f),l.add(f),c.add(f),r.setXYZ(b,a.x,a.y,a.z),r.setXYZ(_,l.x,l.y,l.z),r.setXYZ(S,c.x,c.y,c.z)}else for(let m=0,x=n.count;m<x;m+=3)i.fromBufferAttribute(n,m+0),s.fromBufferAttribute(n,m+1),o.fromBufferAttribute(n,m+2),f.subVectors(o,s),h.subVectors(i,s),f.cross(h),r.setXYZ(m+0,f.x,f.y,f.z),r.setXYZ(m+1,f.x,f.y,f.z),r.setXYZ(m+2,f.x,f.y,f.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)Ca.fromBufferAttribute(e,n),Ca.normalize(),e.setXYZ(n,Ca.x,Ca.y,Ca.z)}toNonIndexed(){function e(a,l){const c=a.array,f=a.itemSize,h=a.normalized,m=new c.constructor(l.length*f);let x=0,b=0;for(let _=0,S=l.length;_<S;_++){a.isInterleavedBufferAttribute?x=l[_]*a.data.stride+a.offset:x=l[_]*f;for(let M=0;M<f;M++)m[b++]=c[x++]}return new Xi(m,f,h)}if(this.index===null)return En("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Nr,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 f=0,h=c.length;f<h;f++){const m=c[f],x=e(m,r);l.push(x)}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],f=[];for(let h=0,m=c.length;h<m;h++){const x=c[h];f.push(x.toJSON(e.data))}f.length>0&&(i[l]=f,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 f=i[c];this.setAttribute(c,f.clone(n))}const s=e.morphAttributes;for(const c in s){const f=[],h=s[c];for(let m=0,x=h.length;m<x;m++)f.push(h[m].clone(n));this.morphAttributes[c]=f}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,f=o.length;c<f;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 sE{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=Qw,this.updateRanges=[],this.version=0,this.uuid=yu()}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=yu()),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=yu()),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 Bl=new Ge;class pu{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++)Bl.fromBufferAttribute(this,n),Bl.applyMatrix4(e),this.setXYZ(n,Bl.x,Bl.y,Bl.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Bl.fromBufferAttribute(this,n),Bl.applyNormalMatrix(e),this.setXYZ(n,Bl.x,Bl.y,Bl.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Bl.fromBufferAttribute(this,n),Bl.transformDirection(e),this.setXYZ(n,Bl.x,Bl.y,Bl.z);return this}getComponent(e,n){let r=this.array[e*this.data.stride+this.offset+n];return this.normalized&&(r=Xl(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=jr(r,this.array)),this.data.array[e*this.data.stride+this.offset+n]=r,this}setX(e,n){return this.normalized&&(n=jr(n,this.array)),this.data.array[e*this.data.stride+this.offset]=n,this}setY(e,n){return this.normalized&&(n=jr(n,this.array)),this.data.array[e*this.data.stride+this.offset+1]=n,this}setZ(e,n){return this.normalized&&(n=jr(n,this.array)),this.data.array[e*this.data.stride+this.offset+2]=n,this}setW(e,n){return this.normalized&&(n=jr(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=Xl(n,this.array)),n}getY(e){let n=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(n=Xl(n,this.array)),n}getZ(e){let n=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(n=Xl(n,this.array)),n}getW(e){let n=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(n=Xl(n,this.array)),n}setXY(e,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(n=jr(n,this.array),r=jr(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=jr(n,this.array),r=jr(r,this.array),i=jr(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=jr(n,this.array),r=jr(r,this.array),i=jr(i,this.array),s=jr(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){eS("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 Xi(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 pu(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){eS("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 M4e=0;class Cl extends Eh{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:M4e++}),this.uuid=yu(),this.name="",this.type="Material",this.blending=Tx,this.side=Lp,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=_5,this.blendDst=w5,this.blendEquation=Zm,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Rn(0,0,0),this.blendAlpha=0,this.depthFunc=jx,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=LR,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=sx,this.stencilZFail=sx,this.stencilZPass=sx,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){En(`Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){En(`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!==Tx&&(r.blending=this.blending),this.side!==Lp&&(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!==_5&&(r.blendSrc=this.blendSrc),this.blendDst!==w5&&(r.blendDst=this.blendDst),this.blendEquation!==Zm&&(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!==jx&&(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!==LR&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==sx&&(r.stencilFail=this.stencilFail),this.stencilZFail!==sx&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==sx&&(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 YP extends Cl{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Rn(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 u1;const P_=new Ge,d1=new Ge,f1=new Ge,h1=new qt,I_=new qt,zK=new pr,fM=new Ge,D_=new Ge,hM=new Ge,ez=new qt,eN=new qt,tz=new qt;class FK extends wi{constructor(e=new YP){if(super(),this.isSprite=!0,this.type="Sprite",u1===void 0){u1=new Nr;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 sE(n,5);u1.setIndex([0,1,2,0,2,3]),u1.setAttribute("position",new pu(r,3,0,!1)),u1.setAttribute("uv",new pu(r,2,3,!1))}this.geometry=u1,this.material=e,this.center=new qt(.5,.5),this.count=1}raycast(e,n){e.camera===null&&qn('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),d1.setFromMatrixScale(this.matrixWorld),zK.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),f1.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&d1.multiplyScalar(-f1.z);const r=this.material.rotation;let i,s;r!==0&&(s=Math.cos(r),i=Math.sin(r));const o=this.center;pM(fM.set(-.5,-.5,0),f1,o,d1,i,s),pM(D_.set(.5,-.5,0),f1,o,d1,i,s),pM(hM.set(.5,.5,0),f1,o,d1,i,s),ez.set(0,0),eN.set(1,0),tz.set(1,1);let a=e.ray.intersectTriangle(fM,D_,hM,!1,P_);if(a===null&&(pM(D_.set(-.5,.5,0),f1,o,d1,i,s),eN.set(0,1),a=e.ray.intersectTriangle(fM,hM,D_,!1,P_),a===null))return;const l=e.ray.origin.distanceTo(P_);l<e.near||l>e.far||n.push({distance:l,point:P_.clone(),uv:zc.getInterpolation(P_,fM,D_,hM,ez,eN,tz,new qt),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 pM(t,e,n,r,i,s){h1.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(I_.x=s*h1.x-i*h1.y,I_.y=i*h1.x+s*h1.y):I_.copy(h1),t.copy(e),t.x+=I_.x,t.y+=I_.y,t.applyMatrix4(zK)}const mM=new Ge,nz=new Ge;class UK extends wi{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){mM.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(mM);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){mM.setFromMatrixPosition(e.matrixWorld),nz.setFromMatrixPosition(this.matrixWorld);const r=mM.distanceTo(nz)/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 op=new Ge,tN=new Ge,gM=new Ge,Um=new Ge,nN=new Ge,xM=new Ge,rN=new Ge;class Zx{constructor(e=new Ge,n=new Ge(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,op)),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=op.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(op.copy(this.origin).addScaledVector(this.direction,n),op.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){tN.copy(e).add(n).multiplyScalar(.5),gM.copy(n).sub(e).normalize(),Um.copy(this.origin).sub(tN);const s=e.distanceTo(n)*.5,o=-this.direction.dot(gM),a=Um.dot(this.direction),l=-Um.dot(gM),c=Um.lengthSq(),f=Math.abs(1-o*o);let h,m,x,b;if(f>0)if(h=o*l-a,m=o*a-l,b=s*f,h>=0)if(m>=-b)if(m<=b){const _=1/f;h*=_,m*=_,x=h*(h+o*m+2*a)+m*(o*h+m+2*l)+c}else m=s,h=Math.max(0,-(o*m+a)),x=-h*h+m*(m+2*l)+c;else m=-s,h=Math.max(0,-(o*m+a)),x=-h*h+m*(m+2*l)+c;else m<=-b?(h=Math.max(0,-(-o*s+a)),m=h>0?-s:Math.min(Math.max(-s,-l),s),x=-h*h+m*(m+2*l)+c):m<=b?(h=0,m=Math.min(Math.max(-s,-l),s),x=m*(m+2*l)+c):(h=Math.max(0,-(o*s+a)),m=h>0?s:Math.min(Math.max(-s,-l),s),x=-h*h+m*(m+2*l)+c);else m=o>0?-s:s,h=Math.max(0,-(o*m+a)),x=-h*h+m*(m+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(tN).addScaledVector(gM,m),x}intersectSphere(e,n){op.subVectors(e.center,this.origin);const r=op.dot(this.direction),i=op.dot(op)-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,f=1/this.direction.y,h=1/this.direction.z,m=this.origin;return c>=0?(r=(e.min.x-m.x)*c,i=(e.max.x-m.x)*c):(r=(e.max.x-m.x)*c,i=(e.min.x-m.x)*c),f>=0?(s=(e.min.y-m.y)*f,o=(e.max.y-m.y)*f):(s=(e.max.y-m.y)*f,o=(e.min.y-m.y)*f),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o<i||isNaN(i))&&(i=o),h>=0?(a=(e.min.z-m.z)*h,l=(e.max.z-m.z)*h):(a=(e.max.z-m.z)*h,l=(e.min.z-m.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,op)!==null}intersectTriangle(e,n,r,i,s){nN.subVectors(n,e),xM.subVectors(r,e),rN.crossVectors(nN,xM);let o=this.direction.dot(rN),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Um.subVectors(this.origin,e);const l=a*this.direction.dot(xM.crossVectors(Um,xM));if(l<0)return null;const c=a*this.direction.dot(nN.cross(Um));if(c<0||l+c>o)return null;const f=-a*Um.dot(rN);return f<0?null:this.at(f/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 Vp extends Cl{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Rn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Su,this.combine=JS,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 rz=new pr,Hg=new Zx,vM=new ea,iz=new Ge,yM=new Ge,bM=new Ge,_M=new Ge,iN=new Ge,wM=new Ge,sz=new Ge,SM=new Ge;class Xs extends wi{constructor(e=new Nr,n=new Vp){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){wM.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const f=a[l],h=s[l];f!==0&&(iN.fromBufferAttribute(h,e),o?wM.addScaledVector(iN,f):wM.addScaledVector(iN.sub(n),f))}n.add(wM)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),vM.copy(r.boundingSphere),vM.applyMatrix4(s),Hg.copy(e.ray).recast(e.near),!(vM.containsPoint(Hg.origin)===!1&&(Hg.intersectSphere(vM,iz)===null||Hg.origin.distanceToSquared(iz)>(e.far-e.near)**2))&&(rz.copy(s).invert(),Hg.copy(e.ray).applyMatrix4(rz),!(r.boundingBox!==null&&Hg.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Hg)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,f=s.attributes.uv1,h=s.attributes.normal,m=s.groups,x=s.drawRange;if(a!==null)if(Array.isArray(o))for(let b=0,_=m.length;b<_;b++){const S=m[b],M=o[S.materialIndex],T=Math.max(S.start,x.start),A=Math.min(a.count,Math.min(S.start+S.count,x.start+x.count));for(let N=T,D=A;N<D;N+=3){const k=a.getX(N),O=a.getX(N+1),R=a.getX(N+2);i=MM(this,M,e,r,c,f,h,k,O,R),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=S.materialIndex,n.push(i))}}else{const b=Math.max(0,x.start),_=Math.min(a.count,x.start+x.count);for(let S=b,M=_;S<M;S+=3){const T=a.getX(S),A=a.getX(S+1),N=a.getX(S+2);i=MM(this,o,e,r,c,f,h,T,A,N),i&&(i.faceIndex=Math.floor(S/3),n.push(i))}}else if(l!==void 0)if(Array.isArray(o))for(let b=0,_=m.length;b<_;b++){const S=m[b],M=o[S.materialIndex],T=Math.max(S.start,x.start),A=Math.min(l.count,Math.min(S.start+S.count,x.start+x.count));for(let N=T,D=A;N<D;N+=3){const k=N,O=N+1,R=N+2;i=MM(this,M,e,r,c,f,h,k,O,R),i&&(i.faceIndex=Math.floor(N/3),i.face.materialIndex=S.materialIndex,n.push(i))}}else{const b=Math.max(0,x.start),_=Math.min(l.count,x.start+x.count);for(let S=b,M=_;S<M;S+=3){const T=S,A=S+1,N=S+2;i=MM(this,o,e,r,c,f,h,T,A,N),i&&(i.faceIndex=Math.floor(S/3),n.push(i))}}}}function T4e(t,e,n,r,i,s,o,a){let l;if(e.side===Jl?l=r.intersectTriangle(o,s,i,!0,a):l=r.intersectTriangle(i,s,o,e.side===Lp,a),l===null)return null;SM.copy(a),SM.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(SM);return c<n.near||c>n.far?null:{distance:c,point:SM.clone(),object:t}}function MM(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,yM),t.getVertexPosition(l,bM),t.getVertexPosition(c,_M);const f=T4e(t,e,n,r,yM,bM,_M,sz);if(f){const h=new Ge;zc.getBarycoord(sz,yM,bM,_M,h),i&&(f.uv=zc.getInterpolatedAttribute(i,a,l,c,h,new qt)),s&&(f.uv1=zc.getInterpolatedAttribute(s,a,l,c,h,new qt)),o&&(f.normal=zc.getInterpolatedAttribute(o,a,l,c,h,new Ge),f.normal.dot(r.direction)>0&&f.normal.multiplyScalar(-1));const m={a,b:l,c,normal:new Ge,materialIndex:0};zc.getNormal(yM,bM,_M,m.normal),f.face=m,f.barycoord=h}return f}const oz=new Ge,az=new pi,lz=new pi,C4e=new Ge,cz=new pr,TM=new Ge,sN=new ea,uz=new pr,oN=new Zx;class BK extends Xs{constructor(e,n){super(e,n),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=DR,this.bindMatrix=new pr,this.bindMatrixInverse=new pr,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new Fo),this.boundingBox.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,TM),this.boundingBox.expandByPoint(TM)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ea),this.boundingSphere.makeEmpty();const n=e.getAttribute("position");for(let r=0;r<n.count;r++)this.getVertexPosition(r,TM),this.boundingSphere.expandByPoint(TM)}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(),sN.copy(this.boundingSphere),sN.applyMatrix4(i),e.ray.intersectsSphere(sN)!==!1&&(uz.copy(i).invert(),oN.copy(e.ray).applyMatrix4(uz),!(this.boundingBox!==null&&oN.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,n,oN)))}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 pi,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===DR?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===yK?this.bindMatrixInverse.copy(this.bindMatrix).invert():En("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,n){const r=this.skeleton,i=this.geometry;az.fromBufferAttribute(i.attributes.skinIndex,e),lz.fromBufferAttribute(i.attributes.skinWeight,e),oz.copy(n).applyMatrix4(this.bindMatrix),n.set(0,0,0);for(let s=0;s<4;s++){const o=lz.getComponent(s);if(o!==0){const a=az.getComponent(s);cz.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),n.addScaledVector(C4e.copy(oz).applyMatrix4(cz),o)}}return n.applyMatrix4(this.bindMatrixInverse)}}class KP extends wi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class rf extends fo{constructor(e=null,n=1,r=1,i,s,o,a,l,c=zo,f=zo,h,m){super(null,o,a,l,c,f,i,s,h,m),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const dz=new pr,E4e=new pr;class oE{constructor(e=[],n=[]){this.uuid=yu(),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){En("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 pr)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,n=this.bones.length;e<n;e++){const r=new pr;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:E4e;dz.multiplyMatrices(a,n[s]),dz.toArray(r,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new oE(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const n=new Float32Array(e*e*4);n.set(this.boneMatrices);const r=new rf(n,e,e,bl,Ql);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&&(En("Skeleton: No bone found with UUID:",s),o=new KP),this.bones.push(o),this.boneInverses.push(new pr().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 Ux extends Xi{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 p1=new pr,fz=new pr,CM=[],hz=new Fo,A4e=new pr,O_=new Xs,L_=new ea;class HK extends Xs{constructor(e,n,r){super(e,n),this.isInstancedMesh=!0,this.instanceMatrix=new Ux(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,A4e)}computeBoundingBox(){const e=this.geometry,n=this.count;this.boundingBox===null&&(this.boundingBox=new Fo),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,p1),hz.copy(e.boundingBox).applyMatrix4(p1),this.boundingBox.union(hz)}computeBoundingSphere(){const e=this.geometry,n=this.count;this.boundingSphere===null&&(this.boundingSphere=new ea),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let r=0;r<n;r++)this.getMatrixAt(r,p1),L_.copy(e.boundingSphere).applyMatrix4(p1),this.boundingSphere.union(L_)}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(O_.geometry=this.geometry,O_.material=this.material,O_.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),L_.copy(this.boundingSphere),L_.applyMatrix4(r),e.ray.intersectsSphere(L_)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,p1),fz.multiplyMatrices(r,p1),O_.matrixWorld=fz,O_.raycast(e,CM);for(let o=0,a=CM.length;o<a;o++){const l=CM[o];l.instanceId=s,l.object=this,n.push(l)}CM.length=0}}setColorAt(e,n){this.instanceColor===null&&(this.instanceColor=new Ux(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 rf(new Float32Array(i*this.count),i,this.count,YC,Ql));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 aN=new Ge,N4e=new Ge,k4e=new Er;class fp{constructor(e=new Ge(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=aN.subVectors(r,n).cross(N4e.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(aN),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||k4e.getNormalMatrix(e),i=this.coplanarPoint(aN).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 Gg=new ea,R4e=new qt(.5,.5),EM=new Ge;class cb{constructor(e=new fp,n=new fp,r=new fp,i=new fp,s=new fp,o=new fp){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=hu,r=!1){const i=this.planes,s=e.elements,o=s[0],a=s[1],l=s[2],c=s[3],f=s[4],h=s[5],m=s[6],x=s[7],b=s[8],_=s[9],S=s[10],M=s[11],T=s[12],A=s[13],N=s[14],D=s[15];if(i[0].setComponents(c-o,x-f,M-b,D-T).normalize(),i[1].setComponents(c+o,x+f,M+b,D+T).normalize(),i[2].setComponents(c+a,x+h,M+_,D+A).normalize(),i[3].setComponents(c-a,x-h,M-_,D-A).normalize(),r)i[4].setComponents(l,m,S,N).normalize(),i[5].setComponents(c-l,x-m,M-S,D-N).normalize();else if(i[4].setComponents(c-l,x-m,M-S,D-N).normalize(),n===hu)i[5].setComponents(c+l,x+m,M+S,D+N).normalize();else if(n===Fx)i[5].setComponents(l,m,S,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(),Gg.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Gg.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Gg)}intersectsSprite(e){Gg.center.set(0,0,0);const n=R4e.distanceTo(e.center);return Gg.radius=.7071067811865476+n,Gg.applyMatrix4(e.matrixWorld),this.intersectsSphere(Gg)}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(EM.x=i.normal.x>0?e.max.x:e.min.x,EM.y=i.normal.y>0?e.max.y:e.min.y,EM.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(EM)<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 Bf=new pr,Hf=new cb;class aE{constructor(){this.coordinateSystem=hu}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(Bf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Hf.setFromProjectionMatrix(Bf,i.coordinateSystem,i.reversedDepth),Hf.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(Bf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Hf.setFromProjectionMatrix(Bf,i.coordinateSystem,i.reversedDepth),Hf.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(Bf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Hf.setFromProjectionMatrix(Bf,i.coordinateSystem,i.reversedDepth),Hf.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(Bf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Hf.setFromProjectionMatrix(Bf,i.coordinateSystem,i.reversedDepth),Hf.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(Bf.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),Hf.setFromProjectionMatrix(Bf,i.coordinateSystem,i.reversedDepth),Hf.containsPoint(e))return!0}return!1}clone(){return new aE}}function lN(t,e){return t-e}function P4e(t,e){return t.z-e.z}function I4e(t,e){return e.z-t.z}class D4e{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 Ac=new pr,O4e=new Rn(1,1,1),pz=new cb,L4e=new aE,AM=new Fo,Vg=new ea,j_=new Ge,mz=new Ge,j4e=new Ge,cN=new D4e,gl=new Xs,NM=[];function z4e(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 Wg(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 GK extends Xs{constructor(e,n,r=n*2,i){super(new Nr,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 rf(n,e,e,bl,Ql);this._matricesTexture=r}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const n=new Uint32Array(e*e),r=new rf(n,e,e,e3,xd);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 rf(n,e,e,bl,Ql);r.colorSpace=li.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,f=new a.constructor(r*l),h=new Xi(f,l,c);n.setAttribute(s,h)}if(e.getIndex()!==null){const s=r>65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new Xi(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 Fo);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,Ac),this.getBoundingBoxAt(s,AM).applyMatrix4(Ac),e.union(AM)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ea);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,Ac),this.getBoundingSphereAt(s,Vg).applyMatrix4(Ac),e.union(Vg)}}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(lN),i=this._availableInstanceIds.shift(),this._instanceInfo[i]=r):(i=this._instanceInfo.length,this._instanceInfo.push(r));const s=this._matricesTexture;Ac.identity().toArray(s.image.data,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(O4e.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(lN),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 f in r.attributes){const h=n.getAttribute(f),m=r.getAttribute(f);z4e(h,m,l);const x=h.itemSize;for(let b=h.count,_=c;b<_;b++){const S=l+b;for(let M=0;M<x;M++)m.setComponent(S,M,0)}m.needsUpdate=!0,m.addUpdateRange(l*x,c*x)}if(i){const f=a.indexStart,h=a.reservedIndexCount;a.indexCount=n.getIndex().count;for(let m=0;m<o.count;m++)s.setX(f+m,l+o.getX(m));for(let m=o.count,x=h;m<x;m++)s.setX(f+m,l);s.needsUpdate=!0,s.addUpdateRange(f,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:f,vertexStart:h,reservedIndexCount:m}=c,x=s.index,b=x.array,_=e-h;for(let S=f;S<f+m;S++)b[S]=b[S]+_;x.array.copyWithin(n,f,f+m),x.addUpdateRange(n,m),x.needsUpdate=!0,c.indexStart=n}n+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:f,reservedVertexCount:h}=c,m=s.attributes;for(const x in m){const b=m[x],{array:_,itemSize:S}=b;_.copyWithin(e*S,f*S,(f+h)*S),b.addUpdateRange(e*S,h*S),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 Fo,o=r.index,a=r.attributes.position;for(let l=i.start,c=i.start+i.count;l<c;l++){let f=l;o&&(f=o.getX(f)),s.expandByPoint(j_.fromBufferAttribute(a,f))}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 ea;this.getBoundingBoxAt(e,AM),AM.getCenter(s.center);const o=r.index,a=r.attributes.position;let l=0;for(let c=i.start,f=i.start+i.count;c<f;c++){let h=c;o&&(h=o.getX(h)),j_.fromBufferAttribute(a,h),l=Math.max(l,s.center.distanceToSquared(j_))}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(lN);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);Wg(this._multiDrawCounts,i),Wg(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(),Wg(o.image.data,this._indirectTexture.image.data),a.dispose(),this._initMatricesTexture(),Wg(a.image.data,this._matricesTexture.image.data),l&&(l.dispose(),this._initColorsTexture(),Wg(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 Nr,this._initializeGeometry(s));const o=this.geometry;s.index&&Wg(s.index.array,o.index.array);for(const a in s.attributes)Wg(s.attributes[a].array,o.attributes[a].array)}raycast(e,n){const r=this._instanceInfo,i=this._geometryInfo,s=this.matrixWorld,o=this.geometry;gl.material=this.material,gl.geometry.index=o.index,gl.geometry.attributes=o.attributes,gl.geometry.boundingBox===null&&(gl.geometry.boundingBox=new Fo),gl.geometry.boundingSphere===null&&(gl.geometry.boundingSphere=new ea);for(let a=0,l=r.length;a<l;a++){if(!r[a].visible||!r[a].active)continue;const c=r[a].geometryIndex,f=i[c];gl.geometry.setDrawRange(f.start,f.count),this.getMatrixAt(a,gl.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,gl.geometry.boundingBox),this.getBoundingSphereAt(c,gl.geometry.boundingSphere),gl.raycast(e,NM);for(let h=0,m=NM.length;h<m;h++){const x=NM[h];x.object=this,x.batchId=a,n.push(x)}NM.length=0}gl.material=null,gl.geometry.index=null,gl.geometry.attributes={},gl.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,f=this._multiDrawStarts,h=this._multiDrawCounts,m=this._geometryInfo,x=this.perObjectFrustumCulled,b=this._indirectTexture,_=b.image.data,S=r.isArrayCamera?L4e:pz;x&&!r.isArrayCamera&&(Ac.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),pz.setFromProjectionMatrix(Ac,r.coordinateSystem,r.reversedDepth));let M=0;if(this.sortObjects){Ac.copy(this.matrixWorld).invert(),j_.setFromMatrixPosition(r.matrixWorld).applyMatrix4(Ac),mz.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(Ac);for(let N=0,D=c.length;N<D;N++)if(c[N].visible&&c[N].active){const k=c[N].geometryIndex;this.getMatrixAt(N,Ac),this.getBoundingSphereAt(k,Vg).applyMatrix4(Ac);let O=!1;if(x&&(O=!S.intersectsSphere(Vg,r)),!O){const R=m[k],L=j4e.subVectors(Vg.center,j_).dot(mz);cN.push(R.start,R.count,L,N)}}const T=cN.list,A=this.customSort;A===null?T.sort(s.transparent?I4e:P4e):A.call(this,T,r);for(let N=0,D=T.length;N<D;N++){const k=T[N];f[M]=k.start*a*l,h[M]=k.count*l,_[M]=k.index,M++}cN.reset()}else for(let T=0,A=c.length;T<A;T++)if(c[T].visible&&c[T].active){const N=c[T].geometryIndex;let D=!1;if(x&&(this.getMatrixAt(T,Ac),this.getBoundingSphereAt(N,Vg).applyMatrix4(Ac),D=!S.intersectsSphere(Vg,r)),!D){const k=m[N];f[M]=k.start*a*l,h[M]=k.count*l,_[M]=T,M++}}b.needsUpdate=!0,this._multiDrawCount=M,this._visibilityChanged=!1}onBeforeShadow(e,n,r,i,s,o){this.onBeforeRender(e,null,i,s,o)}}class rc extends Cl{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Rn(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 cT=new Ge,uT=new Ge,gz=new pr,z_=new Zx,kM=new ea,uN=new Ge,xz=new Ge;let I0=class extends wi{constructor(e=new Nr,n=new rc){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++)cT.fromBufferAttribute(n,i-1),uT.fromBufferAttribute(n,i),r[i]=r[i-1],r[i]+=cT.distanceTo(uT);e.setAttribute("lineDistance",new jn(r,1))}else En("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(),kM.copy(r.boundingSphere),kM.applyMatrix4(i),kM.radius+=s,e.ray.intersectsSphere(kM)===!1)return;gz.copy(i).invert(),z_.copy(e.ray).applyMatrix4(gz);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=this.isLineSegments?2:1,f=r.index,m=r.attributes.position;if(f!==null){const x=Math.max(0,o.start),b=Math.min(f.count,o.start+o.count);for(let _=x,S=b-1;_<S;_+=c){const M=f.getX(_),T=f.getX(_+1),A=RM(this,e,z_,l,M,T,_);A&&n.push(A)}if(this.isLineLoop){const _=f.getX(b-1),S=f.getX(x),M=RM(this,e,z_,l,_,S,b-1);M&&n.push(M)}}else{const x=Math.max(0,o.start),b=Math.min(m.count,o.start+o.count);for(let _=x,S=b-1;_<S;_+=c){const M=RM(this,e,z_,l,_,_+1,_);M&&n.push(M)}if(this.isLineLoop){const _=RM(this,e,z_,l,b-1,x,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 RM(t,e,n,r,i,s,o){const a=t.geometry.attributes.position;if(cT.fromBufferAttribute(a,i),uT.fromBufferAttribute(a,s),n.distanceSqToSegment(cT,uT,uN,xz)>r)return;uN.applyMatrix4(t.matrixWorld);const c=e.ray.origin.distanceTo(uN);if(!(c<e.near||c>e.far))return{distance:c,point:xz.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const vz=new Ge,yz=new Ge;class Ah extends I0{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)vz.fromBufferAttribute(n,i),yz.fromBufferAttribute(n,i+1),r[i]=i===0?0:r[i-1],r[i+1]=r[i]+vz.distanceTo(yz);e.setAttribute("lineDistance",new jn(r,1))}else En("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class VK extends I0{constructor(e,n){super(e,n),this.isLineLoop=!0,this.type="LineLoop"}}class ZP extends Cl{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Rn(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 bz=new pr,zR=new Zx,PM=new ea,IM=new Ge;class WK extends wi{constructor(e=new Nr,n=new ZP){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(),PM.copy(r.boundingSphere),PM.applyMatrix4(i),PM.radius+=s,e.ray.intersectsSphere(PM)===!1)return;bz.copy(i).invert(),zR.copy(e.ray).applyMatrix4(bz);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 m=Math.max(0,o.start),x=Math.min(c.count,o.start+o.count);for(let b=m,_=x;b<_;b++){const S=c.getX(b);IM.fromBufferAttribute(h,S),_z(IM,S,l,i,e,n,this)}}else{const m=Math.max(0,o.start),x=Math.min(h.count,o.start+o.count);for(let b=m,_=x;b<_;b++)IM.fromBufferAttribute(h,b),_z(IM,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 _z(t,e,n,r,i,s,o){const a=zR.distanceSqToPoint(t);if(a<n){const l=new Ge;zR.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 $K extends fo{constructor(e,n,r,i,s=as,o=as,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const f=this;function h(){f.needsUpdate=!0,f._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 F4e extends $K{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 U4e extends fo{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=zo,this.minFilter=zo,this.generateMipmaps=!1,this.needsUpdate=!0}}class lE extends fo{constructor(e,n,r,i,s,o,a,l,c,f,h,m){super(null,o,a,l,c,f,i,s,h,m),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class B4e extends lE{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Uc,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class H4e extends lE{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,gh),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class t3 extends fo{constructor(e=[],n=gh,r,i,s,o,a,l,c,f){super(e,n,r,i,s,o,a,l,c,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class G4e extends fo{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 Fy extends fo{constructor(e,n,r=xd,i,s,o,a=zo,l=zo,c,f=vh,h=1){if(f!==vh&&f!==u0)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const m={width:e,height:n,depth:h};super(m,i,s,o,a,l,f,r,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new d0(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 qK extends Fy{constructor(e,n=xd,r=gh,i,s,o=zo,a=zo,l,c=vh){const f={width:e,height:e,depth:1},h=[f,f,f,f,f,f];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 QP extends fo{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Qx extends Nr{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=[],f=[],h=[];let m=0,x=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 jn(c,3)),this.setAttribute("normal",new jn(f,3)),this.setAttribute("uv",new jn(h,2));function b(_,S,M,T,A,N,D,k,O,R,L){const B=N/O,H=D/R,$=N/2,G=D/2,Z=k/2,V=O+1,W=R+1;let J=0,ne=0;const ie=new Ge;for(let z=0;z<W;z++){const j=z*H-G;for(let X=0;X<V;X++){const F=X*B-$;ie[_]=F*T,ie[S]=j*A,ie[M]=Z,c.push(ie.x,ie.y,ie.z),ie[_]=0,ie[S]=0,ie[M]=k>0?1:-1,f.push(ie.x,ie.y,ie.z),h.push(X/O),h.push(1-z/R),J+=1}}for(let z=0;z<R;z++)for(let j=0;j<O;j++){const X=m+j+V*z,F=m+j+V*(z+1),ce=m+(j+1)+V*(z+1),oe=m+(j+1)+V*z;l.push(X,F,oe),l.push(F,ce,oe),ne+=6}a.addGroup(x,ne,L),x+=ne,m+=J}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Qx(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class cE extends Nr{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=[],f=n/2,h=Math.PI/2*e,m=n,x=2*h+m,b=r*2+s,_=i+1,S=new Ge,M=new Ge;for(let T=0;T<=b;T++){let A=0,N=0,D=0,k=0;if(T<=r){const L=T/r,B=L*Math.PI/2;N=-f-e*Math.cos(B),D=e*Math.sin(B),k=-e*Math.cos(B),A=L*h}else if(T<=r+s){const L=(T-r)/s;N=-f+L*n,D=e,k=0,A=h+L*m}else{const L=(T-r-s)/r,B=L*Math.PI/2;N=f+e*Math.sin(B),D=e*Math.cos(B),k=e*Math.sin(B),A=h+m+L*h}const O=Math.max(0,Math.min(1,A/x));let R=0;T===0?R=.5/i:T===b&&(R=-.5/i);for(let L=0;L<=i;L++){const B=L/i,H=B*Math.PI*2,$=Math.sin(H),G=Math.cos(H);M.x=-D*G,M.y=N,M.z=D*$,a.push(M.x,M.y,M.z),S.set(-D*G,k,D*$),S.normalize(),l.push(S.x,S.y,S.z),c.push(B+R,O)}if(T>0){const L=(T-1)*_;for(let B=0;B<i;B++){const H=L+B,$=L+B+1,G=T*_+B,Z=T*_+B+1;o.push(H,$,G),o.push($,Z,G)}}}this.setIndex(o),this.setAttribute("position",new jn(a,3)),this.setAttribute("normal",new jn(l,3)),this.setAttribute("uv",new jn(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new cE(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class uE extends Nr{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 Ge,f=new qt;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,m=3;h<=n;h++,m+=3){const x=r+h/n*i;c.x=e*Math.cos(x),c.y=e*Math.sin(x),o.push(c.x,c.y,c.z),a.push(0,0,1),f.x=(o[m]/e+1)/2,f.y=(o[m+1]/e+1)/2,l.push(f.x,f.y)}for(let h=1;h<=n;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new jn(o,3)),this.setAttribute("normal",new jn(a,3)),this.setAttribute("uv",new jn(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uE(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class n3 extends Nr{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 f=[],h=[],m=[],x=[];let b=0;const _=[],S=r/2;let M=0;T(),o===!1&&(e>0&&A(!0),n>0&&A(!1)),this.setIndex(f),this.setAttribute("position",new jn(h,3)),this.setAttribute("normal",new jn(m,3)),this.setAttribute("uv",new jn(x,2));function T(){const N=new Ge,D=new Ge;let k=0;const O=(n-e)/r;for(let R=0;R<=s;R++){const L=[],B=R/s,H=B*(n-e)+e;for(let $=0;$<=i;$++){const G=$/i,Z=G*l+a,V=Math.sin(Z),W=Math.cos(Z);D.x=H*V,D.y=-B*r+S,D.z=H*W,h.push(D.x,D.y,D.z),N.set(V,O,W).normalize(),m.push(N.x,N.y,N.z),x.push(G,1-B),L.push(b++)}_.push(L)}for(let R=0;R<i;R++)for(let L=0;L<s;L++){const B=_[L][R],H=_[L+1][R],$=_[L+1][R+1],G=_[L][R+1];(e>0||L!==0)&&(f.push(B,H,G),k+=3),(n>0||L!==s-1)&&(f.push(H,$,G),k+=3)}c.addGroup(M,k,0),M+=k}function A(N){const D=b,k=new qt,O=new Ge;let R=0;const L=N===!0?e:n,B=N===!0?1:-1;for(let $=1;$<=i;$++)h.push(0,S*B,0),m.push(0,B,0),x.push(.5,.5),b++;const H=b;for(let $=0;$<=i;$++){const Z=$/i*l+a,V=Math.cos(Z),W=Math.sin(Z);O.x=L*W,O.y=S*B,O.z=L*V,h.push(O.x,O.y,O.z),m.push(0,B,0),k.x=V*.5+.5,k.y=W*.5*B+.5,x.push(k.x,k.y),b++}for(let $=0;$<i;$++){const G=D+$,Z=H+$;N===!0?f.push(Z,Z+1,G):f.push(Z+1,Z,G),R+=3}c.addGroup(M,R,N===!0?1:2),M+=R}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n3(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class r3 extends n3{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 r3(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Z0 extends Nr{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),f(),this.setAttribute("position",new jn(s,3)),this.setAttribute("normal",new jn(s.slice(),3)),this.setAttribute("uv",new jn(o,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function a(T){const A=new Ge,N=new Ge,D=new Ge;for(let k=0;k<n.length;k+=3)x(n[k+0],A),x(n[k+1],N),x(n[k+2],D),l(A,N,D,T)}function l(T,A,N,D){const k=D+1,O=[];for(let R=0;R<=k;R++){O[R]=[];const L=T.clone().lerp(N,R/k),B=A.clone().lerp(N,R/k),H=k-R;for(let $=0;$<=H;$++)$===0&&R===k?O[R][$]=L:O[R][$]=L.clone().lerp(B,$/H)}for(let R=0;R<k;R++)for(let L=0;L<2*(k-R)-1;L++){const B=Math.floor(L/2);L%2===0?(m(O[R][B+1]),m(O[R+1][B]),m(O[R][B])):(m(O[R][B+1]),m(O[R+1][B+1]),m(O[R+1][B]))}}function c(T){const A=new Ge;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(T),s[N+0]=A.x,s[N+1]=A.y,s[N+2]=A.z}function f(){const T=new Ge;for(let A=0;A<s.length;A+=3){T.x=s[A+0],T.y=s[A+1],T.z=s[A+2];const N=S(T)/2/Math.PI+.5,D=M(T)/Math.PI+.5;o.push(N,1-D)}b(),h()}function h(){for(let T=0;T<o.length;T+=6){const A=o[T+0],N=o[T+2],D=o[T+4],k=Math.max(A,N,D),O=Math.min(A,N,D);k>.9&&O<.1&&(A<.2&&(o[T+0]+=1),N<.2&&(o[T+2]+=1),D<.2&&(o[T+4]+=1))}}function m(T){s.push(T.x,T.y,T.z)}function x(T,A){const N=T*3;A.x=e[N+0],A.y=e[N+1],A.z=e[N+2]}function b(){const T=new Ge,A=new Ge,N=new Ge,D=new Ge,k=new qt,O=new qt,R=new qt;for(let L=0,B=0;L<s.length;L+=9,B+=6){T.set(s[L+0],s[L+1],s[L+2]),A.set(s[L+3],s[L+4],s[L+5]),N.set(s[L+6],s[L+7],s[L+8]),k.set(o[B+0],o[B+1]),O.set(o[B+2],o[B+3]),R.set(o[B+4],o[B+5]),D.copy(T).add(A).add(N).divideScalar(3);const H=S(D);_(k,B+0,T,H),_(O,B+2,A,H),_(R,B+4,N,H)}}function _(T,A,N,D){D<0&&T.x===1&&(o[A]=T.x-1),N.x===0&&N.z===0&&(o[A]=D/2/Math.PI+.5)}function S(T){return Math.atan2(T.z,-T.x)}function M(T){return Math.atan2(-T.y,Math.sqrt(T.x*T.x+T.z*T.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Z0(e.vertices,e.indices,e.radius,e.detail)}}class dE extends Z0{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 dE(e.radius,e.detail)}}const DM=new Ge,OM=new Ge,dN=new Ge,LM=new zc;class JP extends Nr{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(Cx*n),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],f=["a","b","c"],h=new Array(3),m={},x=[];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:S,c:M}=LM;if(_.fromBufferAttribute(a,c[0]),S.fromBufferAttribute(a,c[1]),M.fromBufferAttribute(a,c[2]),LM.getNormal(dN),h[0]=`${Math.round(_.x*i)},${Math.round(_.y*i)},${Math.round(_.z*i)}`,h[1]=`${Math.round(S.x*i)},${Math.round(S.y*i)},${Math.round(S.z*i)}`,h[2]=`${Math.round(M.x*i)},${Math.round(M.y*i)},${Math.round(M.z*i)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let T=0;T<3;T++){const A=(T+1)%3,N=h[T],D=h[A],k=LM[f[T]],O=LM[f[A]],R=`${N}_${D}`,L=`${D}_${N}`;L in m&&m[L]?(dN.dot(m[L].normal)<=s&&(x.push(k.x,k.y,k.z),x.push(O.x,O.y,O.z)),m[L]=null):R in m||(m[R]={index0:c[T],index1:c[A],normal:dN.clone()})}}for(const b in m)if(m[b]){const{index0:_,index1:S}=m[b];DM.fromBufferAttribute(a,_),OM.fromBufferAttribute(a,S),x.push(DM.x,DM.y,DM.z),x.push(OM.x,OM.y,OM.z)}this.setAttribute("position",new jn(x,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class ff{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){En("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 f=r[i],m=r[i+1]-f,x=(o-f)/m;return(i+x)/(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 qt:new Ge);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 Ge,i=[],s=[],o=[],a=new Ge,l=new pr;for(let x=0;x<=e;x++){const b=x/e;i[x]=this.getTangentAt(b,new Ge)}s[0]=new Ge,o[0]=new Ge;let c=Number.MAX_VALUE;const f=Math.abs(i[0].x),h=Math.abs(i[0].y),m=Math.abs(i[0].z);f<=c&&(c=f,r.set(1,0,0)),h<=c&&(c=h,r.set(0,1,0)),m<=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 x=1;x<=e;x++){if(s[x]=s[x-1].clone(),o[x]=o[x-1].clone(),a.crossVectors(i[x-1],i[x]),a.length()>Number.EPSILON){a.normalize();const b=Math.acos(gr(i[x-1].dot(i[x]),-1,1));s[x].applyMatrix4(l.makeRotationAxis(a,b))}o[x].crossVectors(i[x],s[x])}if(n===!0){let x=Math.acos(gr(s[0].dot(s[e]),-1,1));x/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(x=-x);for(let b=1;b<=e;b++)s[b].applyMatrix4(l.makeRotationAxis(i[b],x*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 fE extends ff{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 qt){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 f=Math.cos(this.aRotation),h=Math.sin(this.aRotation),m=l-this.aX,x=c-this.aY;l=m*f-x*h+this.aX,c=m*h+x*f+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 XK extends fE{constructor(e,n,r,i,s,o){super(e,n,r,r,i,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function eI(){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,f,h){let m=(o-s)/c-(a-s)/(c+f)+(a-o)/f,x=(a-o)/f-(l-o)/(f+h)+(l-a)/h;m*=f,x*=f,i(o,a,m,x)},calc:function(s){const o=s*s,a=o*s;return t+e*s+n*o+r*a}}}const jM=new Ge,fN=new eI,hN=new eI,pN=new eI;class YK extends ff{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 Ge){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,f;this.closed||a>0?c=i[(a-1)%s]:(jM.subVectors(i[0],i[1]).add(i[0]),c=jM);const h=i[a%s],m=i[(a+1)%s];if(this.closed||a+2<s?f=i[(a+2)%s]:(jM.subVectors(i[s-1],i[s-2]).add(i[s-1]),f=jM),this.curveType==="centripetal"||this.curveType==="chordal"){const x=this.curveType==="chordal"?.5:.25;let b=Math.pow(c.distanceToSquared(h),x),_=Math.pow(h.distanceToSquared(m),x),S=Math.pow(m.distanceToSquared(f),x);_<1e-4&&(_=1),b<1e-4&&(b=_),S<1e-4&&(S=_),fN.initNonuniformCatmullRom(c.x,h.x,m.x,f.x,b,_,S),hN.initNonuniformCatmullRom(c.y,h.y,m.y,f.y,b,_,S),pN.initNonuniformCatmullRom(c.z,h.z,m.z,f.z,b,_,S)}else this.curveType==="catmullrom"&&(fN.initCatmullRom(c.x,h.x,m.x,f.x,this.tension),hN.initCatmullRom(c.y,h.y,m.y,f.y,this.tension),pN.initCatmullRom(c.z,h.z,m.z,f.z,this.tension));return r.set(fN.calc(l),hN.calc(l),pN.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 Ge().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function wz(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 V4e(t,e){const n=1-t;return n*n*e}function W4e(t,e){return 2*(1-t)*t*e}function $4e(t,e){return t*t*e}function Mw(t,e,n,r){return V4e(t,e)+W4e(t,n)+$4e(t,r)}function q4e(t,e){const n=1-t;return n*n*n*e}function X4e(t,e){const n=1-t;return 3*n*n*t*e}function Y4e(t,e){return 3*(1-t)*t*t*e}function K4e(t,e){return t*t*t*e}function Tw(t,e,n,r,i){return q4e(t,e)+X4e(t,n)+Y4e(t,r)+K4e(t,i)}class tI extends ff{constructor(e=new qt,n=new qt,r=new qt,i=new qt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new qt){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Tw(e,i.x,s.x,o.x,a.x),Tw(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 KK extends ff{constructor(e=new Ge,n=new Ge,r=new Ge,i=new Ge){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=n,this.v2=r,this.v3=i}getPoint(e,n=new Ge){const r=n,i=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Tw(e,i.x,s.x,o.x,a.x),Tw(e,i.y,s.y,o.y,a.y),Tw(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 nI extends ff{constructor(e=new qt,n=new qt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=n}getPoint(e,n=new qt){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 qt){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 ZK extends ff{constructor(e=new Ge,n=new Ge){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=n}getPoint(e,n=new Ge){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 Ge){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 rI extends ff{constructor(e=new qt,n=new qt,r=new qt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new qt){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(Mw(e,i.x,s.x,o.x),Mw(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 iI extends ff{constructor(e=new Ge,n=new Ge,r=new Ge){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=n,this.v2=r}getPoint(e,n=new Ge){const r=n,i=this.v0,s=this.v1,o=this.v2;return r.set(Mw(e,i.x,s.x,o.x),Mw(e,i.y,s.y,o.y),Mw(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 sI extends ff{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,n=new qt){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],f=i[o>i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return r.set(wz(a,l.x,c.x,f.x,h.x),wz(a,l.y,c.y,f.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 qt().fromArray(i))}return this}}var dT=Object.freeze({__proto__:null,ArcCurve:XK,CatmullRomCurve3:YK,CubicBezierCurve:tI,CubicBezierCurve3:KK,EllipseCurve:fE,LineCurve:nI,LineCurve3:ZK,QuadraticBezierCurve:rI,QuadraticBezierCurve3:iI,SplineCurve:sI});class QK extends ff{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 dT[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 f=l[c];r&&r.equals(f)||(n.push(f),r=f)}}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 dT[i.type]().fromJSON(i))}return this}}class fT extends QK{constructor(e){super(),this.type="Path",this.currentPoint=new qt,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 nI(this.currentPoint.clone(),new qt(e,n));return this.curves.push(r),this.currentPoint.set(e,n),this}quadraticCurveTo(e,n,r,i){const s=new rI(this.currentPoint.clone(),new qt(e,n),new qt(r,i));return this.curves.push(s),this.currentPoint.set(r,i),this}bezierCurveTo(e,n,r,i,s,o){const a=new tI(this.currentPoint.clone(),new qt(e,n),new qt(r,i),new qt(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const n=[this.currentPoint.clone()].concat(e),r=new sI(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,f=this.currentPoint.y;return this.absellipse(e+c,n+f,r,i,s,o,a,l),this}absellipse(e,n,r,i,s,o,a,l){const c=new fE(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 f=c.getPoint(1);return this.currentPoint.copy(f),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 m0 extends fT{constructor(e){super(e),this.uuid=yu(),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 fT().fromJSON(i))}return this}}function Z4e(t,e,n=2){const r=e&&e.length,i=r?e[0]*n:t.length;let s=JK(t,0,i,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c;if(r&&(s=nMe(t,e,s,n)),t.length>80*n){a=t[0],l=t[1];let f=a,h=l;for(let m=n;m<i;m+=n){const x=t[m],b=t[m+1];x<a&&(a=x),b<l&&(l=b),x>f&&(f=x),b>h&&(h=b)}c=Math.max(f-a,h-l),c=c!==0?32767/c:0}return nS(s,o,n,a,l,c,0),o}function JK(t,e,n,r,i){let s;if(i===hMe(t,e,n,r)>0)for(let o=e;o<n;o+=r)s=Sz(o/r|0,t[o],t[o+1],s);else for(let o=n-r;o>=e;o-=r)s=Sz(o/r|0,t[o],t[o+1],s);return s&&Uy(s,s.next)&&(iS(s),s=s.next),s}function Bx(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(Uy(n,n.next)||co(n.prev,n,n.next)===0)){if(iS(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function nS(t,e,n,r,i,s,o){if(!t)return;!o&&s&&aMe(t,r,i,s);let a=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?J4e(t,r,i,s):Q4e(t)){e.push(l.i,t.i,c.i),iS(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=eMe(Bx(t),e),nS(t,e,n,r,i,s,2)):o===2&&tMe(t,e,n,r,i,s):nS(Bx(t),e,n,r,i,s,1);break}}}function Q4e(t){const e=t.prev,n=t,r=t.next;if(co(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,f=Math.min(i,s,o),h=Math.min(a,l,c),m=Math.max(i,s,o),x=Math.max(a,l,c);let b=r.next;for(;b!==e;){if(b.x>=f&&b.x<=m&&b.y>=h&&b.y<=x&&ew(i,a,s,l,o,c,b.x,b.y)&&co(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function J4e(t,e,n,r){const i=t.prev,s=t,o=t.next;if(co(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,f=i.y,h=s.y,m=o.y,x=Math.min(a,l,c),b=Math.min(f,h,m),_=Math.max(a,l,c),S=Math.max(f,h,m),M=FR(x,b,e,n,r),T=FR(_,S,e,n,r);let A=t.prevZ,N=t.nextZ;for(;A&&A.z>=M&&N&&N.z<=T;){if(A.x>=x&&A.x<=_&&A.y>=b&&A.y<=S&&A!==i&&A!==o&&ew(a,f,l,h,c,m,A.x,A.y)&&co(A.prev,A,A.next)>=0||(A=A.prevZ,N.x>=x&&N.x<=_&&N.y>=b&&N.y<=S&&N!==i&&N!==o&&ew(a,f,l,h,c,m,N.x,N.y)&&co(N.prev,N,N.next)>=0))return!1;N=N.nextZ}for(;A&&A.z>=M;){if(A.x>=x&&A.x<=_&&A.y>=b&&A.y<=S&&A!==i&&A!==o&&ew(a,f,l,h,c,m,A.x,A.y)&&co(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;N&&N.z<=T;){if(N.x>=x&&N.x<=_&&N.y>=b&&N.y<=S&&N!==i&&N!==o&&ew(a,f,l,h,c,m,N.x,N.y)&&co(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function eMe(t,e){let n=t;do{const r=n.prev,i=n.next.next;!Uy(r,i)&&tZ(r,n,n.next,i)&&rS(r,i)&&rS(i,r)&&(e.push(r.i,n.i,i.i),iS(n),iS(n.next),n=t=i),n=n.next}while(n!==t);return Bx(n)}function tMe(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&uMe(o,a)){let l=nZ(o,a);o=Bx(o,o.next),l=Bx(l,l.next),nS(o,e,n,r,i,s,0),nS(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function nMe(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=JK(t,a,l,r,!1);c===c.next&&(c.steiner=!0),i.push(cMe(c))}i.sort(rMe);for(let s=0;s<i.length;s++)n=iMe(i[s],n);return n}function rMe(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 iMe(t,e){const n=sMe(t,e);if(!n)return e;const r=nZ(n,t);return Bx(r,r.next),Bx(n,n.next)}function sMe(t,e){let n=e;const r=t.x,i=t.y;let s=-1/0,o;if(Uy(t,n))return n;do{if(Uy(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 f=1/0;n=o;do{if(r>=n.x&&n.x>=l&&r!==n.x&&eZ(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);rS(n,t)&&(h<f||h===f&&(n.x>o.x||n.x===o.x&&oMe(o,n)))&&(o=n,f=h)}n=n.next}while(n!==a);return o}function oMe(t,e){return co(t.prev,t,e.prev)<0&&co(e.next,t,t.next)<0}function aMe(t,e,n,r){let i=t;do i.z===0&&(i.z=FR(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,lMe(i)}function lMe(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 FR(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 cMe(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 eZ(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 ew(t,e,n,r,i,s,o,a){return!(t===o&&e===a)&&eZ(t,e,n,r,i,s,o,a)}function uMe(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!dMe(t,e)&&(rS(t,e)&&rS(e,t)&&fMe(t,e)&&(co(t.prev,t,e.prev)||co(t,e.prev,e))||Uy(t,e)&&co(t.prev,t,t.next)>0&&co(e.prev,e,e.next)>0)}function co(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Uy(t,e){return t.x===e.x&&t.y===e.y}function tZ(t,e,n,r){const i=FM(co(t,e,n)),s=FM(co(t,e,r)),o=FM(co(n,r,t)),a=FM(co(n,r,e));return!!(i!==s&&o!==a||i===0&&zM(t,n,e)||s===0&&zM(t,r,e)||o===0&&zM(n,t,r)||a===0&&zM(n,e,r))}function zM(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 FM(t){return t>0?1:t<0?-1:0}function dMe(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&&tZ(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function rS(t,e){return co(t.prev,t,t.next)<0?co(t,e,t.next)>=0&&co(t,t.prev,e)>=0:co(t,e,t.prev)<0||co(t,t.next,e)<0}function fMe(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 nZ(t,e){const n=UR(t.i,t.x,t.y),r=UR(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 Sz(t,e,n,r){const i=UR(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 iS(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 UR(t,e,n){return{i:t,x:e,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function hMe(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 pMe{static triangulate(e,n,r=2){return Z4e(e,n,r)}}class nf{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 nf.area(e)<0}static triangulateShape(e,n){const r=[],i=[],s=[];Mz(e),Tz(r,e);let o=e.length;n.forEach(Mz);for(let l=0;l<n.length;l++)i.push(o),o+=n[l].length,Tz(r,n[l]);const a=pMe.triangulate(r,i);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function Mz(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Tz(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class hE extends Nr{constructor(e=new m0([new qt(.5,.5),new qt(-.5,.5),new qt(-.5,-.5),new qt(.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 jn(i,3)),this.setAttribute("uv",new jn(s,2)),this.computeVertexNormals();function o(a){const l=[],c=n.curveSegments!==void 0?n.curveSegments:12,f=n.steps!==void 0?n.steps:1,h=n.depth!==void 0?n.depth:1;let m=n.bevelEnabled!==void 0?n.bevelEnabled:!0,x=n.bevelThickness!==void 0?n.bevelThickness:.2,b=n.bevelSize!==void 0?n.bevelSize:x-.1,_=n.bevelOffset!==void 0?n.bevelOffset:0,S=n.bevelSegments!==void 0?n.bevelSegments:3;const M=n.extrudePath,T=n.UVGenerator!==void 0?n.UVGenerator:mMe;let A,N=!1,D,k,O,R;if(M){A=M.getSpacedPoints(f),N=!0,m=!1;const de=M.isCatmullRomCurve3?M.closed:!1;D=M.computeFrenetFrames(f,de),k=new Ge,O=new Ge,R=new Ge}m||(S=0,x=0,b=0,_=0);const L=a.extractPoints(c);let B=L.shape;const H=L.holes;if(!nf.isClockWise(B)){B=B.reverse();for(let de=0,Me=H.length;de<Me;de++){const Ce=H[de];nf.isClockWise(Ce)&&(H[de]=Ce.reverse())}}function G(de){const Ce=10000000000000001e-36;let Re=de[0];for(let le=1;le<=de.length;le++){const He=le%de.length,Le=de[He],ze=Le.x-Re.x,Ve=Le.y-Re.y,ue=ze*ze+Ve*Ve,Y=Math.max(Math.abs(Le.x),Math.abs(Le.y),Math.abs(Re.x),Math.abs(Re.y)),xe=Ce*Y*Y;if(ue<=xe){de.splice(He,1),le--;continue}Re=Le}}G(B),H.forEach(G);const Z=H.length,V=B;for(let de=0;de<Z;de++){const Me=H[de];B=B.concat(Me)}function W(de,Me,Ce){return Me||qn("ExtrudeGeometry: vec does not exist"),de.clone().addScaledVector(Me,Ce)}const J=B.length;function ne(de,Me,Ce){let Re,le,He;const Le=de.x-Me.x,ze=de.y-Me.y,Ve=Ce.x-de.x,ue=Ce.y-de.y,Y=Le*Le+ze*ze,xe=Le*ue-ze*Ve;if(Math.abs(xe)>Number.EPSILON){const we=Math.sqrt(Y),Te=Math.sqrt(Ve*Ve+ue*ue),ge=Me.x-ze/we,Ue=Me.y+Le/we,be=Ce.x-ue/Te,ke=Ce.y+Ve/Te,qe=((be-ge)*ue-(ke-Ue)*Ve)/(Le*ue-ze*Ve);Re=ge+Le*qe-de.x,le=Ue+ze*qe-de.y;const Qe=Re*Re+le*le;if(Qe<=2)return new qt(Re,le);He=Math.sqrt(Qe/2)}else{let we=!1;Le>Number.EPSILON?Ve>Number.EPSILON&&(we=!0):Le<-Number.EPSILON?Ve<-Number.EPSILON&&(we=!0):Math.sign(ze)===Math.sign(ue)&&(we=!0),we?(Re=-ze,le=Le,He=Math.sqrt(Y)):(Re=Le,le=ze,He=Math.sqrt(Y/2))}return new qt(Re/He,le/He)}const ie=[];for(let de=0,Me=V.length,Ce=Me-1,Re=de+1;de<Me;de++,Ce++,Re++)Ce===Me&&(Ce=0),Re===Me&&(Re=0),ie[de]=ne(V[de],V[Ce],V[Re]);const z=[];let j,X=ie.concat();for(let de=0,Me=Z;de<Me;de++){const Ce=H[de];j=[];for(let Re=0,le=Ce.length,He=le-1,Le=Re+1;Re<le;Re++,He++,Le++)He===le&&(He=0),Le===le&&(Le=0),j[Re]=ne(Ce[Re],Ce[He],Ce[Le]);z.push(j),X=X.concat(j)}let F;if(S===0)F=nf.triangulateShape(V,H);else{const de=[],Me=[];for(let Ce=0;Ce<S;Ce++){const Re=Ce/S,le=x*Math.cos(Re*Math.PI/2),He=b*Math.sin(Re*Math.PI/2)+_;for(let Le=0,ze=V.length;Le<ze;Le++){const Ve=W(V[Le],ie[Le],He);K(Ve.x,Ve.y,-le),Re===0&&de.push(Ve)}for(let Le=0,ze=Z;Le<ze;Le++){const Ve=H[Le];j=z[Le];const ue=[];for(let Y=0,xe=Ve.length;Y<xe;Y++){const we=W(Ve[Y],j[Y],He);K(we.x,we.y,-le),Re===0&&ue.push(we)}Re===0&&Me.push(ue)}}F=nf.triangulateShape(de,Me)}const ce=F.length,oe=b+_;for(let de=0;de<J;de++){const Me=m?W(B[de],X[de],oe):B[de];N?(O.copy(D.normals[0]).multiplyScalar(Me.x),k.copy(D.binormals[0]).multiplyScalar(Me.y),R.copy(A[0]).add(O).add(k),K(R.x,R.y,R.z)):K(Me.x,Me.y,0)}for(let de=1;de<=f;de++)for(let Me=0;Me<J;Me++){const Ce=m?W(B[Me],X[Me],oe):B[Me];N?(O.copy(D.normals[de]).multiplyScalar(Ce.x),k.copy(D.binormals[de]).multiplyScalar(Ce.y),R.copy(A[de]).add(O).add(k),K(R.x,R.y,R.z)):K(Ce.x,Ce.y,h/f*de)}for(let de=S-1;de>=0;de--){const Me=de/S,Ce=x*Math.cos(Me*Math.PI/2),Re=b*Math.sin(Me*Math.PI/2)+_;for(let le=0,He=V.length;le<He;le++){const Le=W(V[le],ie[le],Re);K(Le.x,Le.y,h+Ce)}for(let le=0,He=H.length;le<He;le++){const Le=H[le];j=z[le];for(let ze=0,Ve=Le.length;ze<Ve;ze++){const ue=W(Le[ze],j[ze],Re);N?K(ue.x,ue.y+A[f-1].y,A[f-1].x+Ce):K(ue.x,ue.y,h+Ce)}}}Q(),se();function Q(){const de=i.length/3;if(m){let Me=0,Ce=J*Me;for(let Re=0;Re<ce;Re++){const le=F[Re];fe(le[2]+Ce,le[1]+Ce,le[0]+Ce)}Me=f+S*2,Ce=J*Me;for(let Re=0;Re<ce;Re++){const le=F[Re];fe(le[0]+Ce,le[1]+Ce,le[2]+Ce)}}else{for(let Me=0;Me<ce;Me++){const Ce=F[Me];fe(Ce[2],Ce[1],Ce[0])}for(let Me=0;Me<ce;Me++){const Ce=F[Me];fe(Ce[0]+J*f,Ce[1]+J*f,Ce[2]+J*f)}}r.addGroup(de,i.length/3-de,0)}function se(){const de=i.length/3;let Me=0;re(V,Me),Me+=V.length;for(let Ce=0,Re=H.length;Ce<Re;Ce++){const le=H[Ce];re(le,Me),Me+=le.length}r.addGroup(de,i.length/3-de,1)}function re(de,Me){let Ce=de.length;for(;--Ce>=0;){const Re=Ce;let le=Ce-1;le<0&&(le=de.length-1);for(let He=0,Le=f+S*2;He<Le;He++){const ze=J*He,Ve=J*(He+1),ue=Me+Re+ze,Y=Me+le+ze,xe=Me+le+Ve,we=Me+Re+Ve;he(ue,Y,xe,we)}}}function K(de,Me,Ce){l.push(de),l.push(Me),l.push(Ce)}function fe(de,Me,Ce){ae(de),ae(Me),ae(Ce);const Re=i.length/3,le=T.generateTopUV(r,i,Re-3,Re-2,Re-1);Se(le[0]),Se(le[1]),Se(le[2])}function he(de,Me,Ce,Re){ae(de),ae(Me),ae(Re),ae(Me),ae(Ce),ae(Re);const le=i.length/3,He=T.generateSideWallUV(r,i,le-6,le-3,le-2,le-1);Se(He[0]),Se(He[1]),Se(He[3]),Se(He[1]),Se(He[2]),Se(He[3])}function ae(de){i.push(l[de*3+0]),i.push(l[de*3+1]),i.push(l[de*3+2])}function Se(de){s.push(de.x),s.push(de.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 gMe(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 dT[i.type]().fromJSON(i)),new hE(r,e.options)}}const mMe={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],f=e[i*3+1];return[new qt(s,o),new qt(a,l),new qt(c,f)]},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],f=e[r*3+1],h=e[r*3+2],m=e[i*3],x=e[i*3+1],b=e[i*3+2],_=e[s*3],S=e[s*3+1],M=e[s*3+2];return Math.abs(a-f)<Math.abs(o-c)?[new qt(o,1-l),new qt(c,1-h),new qt(m,1-b),new qt(_,1-M)]:[new qt(a,1-l),new qt(f,1-h),new qt(x,1-b),new qt(S,1-M)]}};function gMe(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 pE extends Z0{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 pE(e.radius,e.detail)}}class mE extends Nr{constructor(e=[new qt(0,-.5),new qt(.5,0),new qt(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=gr(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],f=1/n,h=new Ge,m=new qt,x=new Ge,b=new Ge,_=new Ge;let S=0,M=0;for(let T=0;T<=e.length-1;T++)switch(T){case 0:S=e[T+1].x-e[T].x,M=e[T+1].y-e[T].y,x.x=M*1,x.y=-S,x.z=M*0,_.copy(x),x.normalize(),l.push(x.x,x.y,x.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:S=e[T+1].x-e[T].x,M=e[T+1].y-e[T].y,x.x=M*1,x.y=-S,x.z=M*0,b.copy(x),x.x+=_.x,x.y+=_.y,x.z+=_.z,x.normalize(),l.push(x.x,x.y,x.z),_.copy(b)}for(let T=0;T<=n;T++){const A=r+T*f*i,N=Math.sin(A),D=Math.cos(A);for(let k=0;k<=e.length-1;k++){h.x=e[k].x*N,h.y=e[k].y,h.z=e[k].x*D,o.push(h.x,h.y,h.z),m.x=T/n,m.y=k/(e.length-1),a.push(m.x,m.y);const O=l[3*k+0]*N,R=l[3*k+1],L=l[3*k+0]*D;c.push(O,R,L)}}for(let T=0;T<n;T++)for(let A=0;A<e.length-1;A++){const N=A+T*e.length,D=N,k=N+e.length,O=N+e.length+1,R=N+1;s.push(D,k,R),s.push(O,R,k)}this.setIndex(s),this.setAttribute("position",new jn(o,3)),this.setAttribute("uv",new jn(a,2)),this.setAttribute("normal",new jn(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new mE(e.points,e.segments,e.phiStart,e.phiLength)}}class i3 extends Z0{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 i3(e.radius,e.detail)}}class Wp extends Nr{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,f=l+1,h=e/a,m=n/l,x=[],b=[],_=[],S=[];for(let M=0;M<f;M++){const T=M*m-o;for(let A=0;A<c;A++){const N=A*h-s;b.push(N,-T,0),_.push(0,0,1),S.push(A/a),S.push(1-M/l)}}for(let M=0;M<l;M++)for(let T=0;T<a;T++){const A=T+c*M,N=T+c*(M+1),D=T+1+c*(M+1),k=T+1+c*M;x.push(A,N,k),x.push(N,D,k)}this.setIndex(x),this.setAttribute("position",new jn(b,3)),this.setAttribute("normal",new jn(_,3)),this.setAttribute("uv",new jn(S,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 gE extends Nr{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=[],f=[];let h=e;const m=(n-e)/i,x=new Ge,b=new qt;for(let _=0;_<=i;_++){for(let S=0;S<=r;S++){const M=s+S/r*o;x.x=h*Math.cos(M),x.y=h*Math.sin(M),l.push(x.x,x.y,x.z),c.push(0,0,1),b.x=(x.x/n+1)/2,b.y=(x.y/n+1)/2,f.push(b.x,b.y)}h+=m}for(let _=0;_<i;_++){const S=_*(r+1);for(let M=0;M<r;M++){const T=M+S,A=T,N=T+r+1,D=T+r+2,k=T+1;a.push(A,N,k),a.push(N,D,k)}}this.setIndex(a),this.setAttribute("position",new jn(l,3)),this.setAttribute("normal",new jn(c,3)),this.setAttribute("uv",new jn(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gE(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class xE extends Nr{constructor(e=new m0([new qt(0,.5),new qt(-.5,-.5),new qt(.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 f=0;f<e.length;f++)c(e[f]),this.addGroup(a,l,f),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new jn(i,3)),this.setAttribute("normal",new jn(s,3)),this.setAttribute("uv",new jn(o,2));function c(f){const h=i.length/3,m=f.extractPoints(n);let x=m.shape;const b=m.holes;nf.isClockWise(x)===!1&&(x=x.reverse());for(let S=0,M=b.length;S<M;S++){const T=b[S];nf.isClockWise(T)===!0&&(b[S]=T.reverse())}const _=nf.triangulateShape(x,b);for(let S=0,M=b.length;S<M;S++){const T=b[S];x=x.concat(T)}for(let S=0,M=x.length;S<M;S++){const T=x[S];i.push(T.x,T.y,0),s.push(0,0,1),o.push(T.x,T.y)}for(let S=0,M=_.length;S<M;S++){const T=_[S],A=T[0]+h,N=T[1]+h,D=T[2]+h;r.push(A,N,D),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),n=this.parameters.shapes;return xMe(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 xMe(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 s3 extends Nr{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 f=[],h=new Ge,m=new Ge,x=[],b=[],_=[],S=[];for(let M=0;M<=r;M++){const T=[],A=M/r;let N=0;M===0&&o===0?N=.5/n:M===r&&l===Math.PI&&(N=-.5/n);for(let D=0;D<=n;D++){const k=D/n;h.x=-e*Math.cos(i+k*s)*Math.sin(o+A*a),h.y=e*Math.cos(o+A*a),h.z=e*Math.sin(i+k*s)*Math.sin(o+A*a),b.push(h.x,h.y,h.z),m.copy(h).normalize(),_.push(m.x,m.y,m.z),S.push(k+N,1-A),T.push(c++)}f.push(T)}for(let M=0;M<r;M++)for(let T=0;T<n;T++){const A=f[M][T+1],N=f[M][T],D=f[M+1][T],k=f[M+1][T+1];(M!==0||o>0)&&x.push(A,N,k),(M!==r-1||l<Math.PI)&&x.push(N,D,k)}this.setIndex(x),this.setAttribute("position",new jn(b,3)),this.setAttribute("normal",new jn(_,3)),this.setAttribute("uv",new jn(S,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new s3(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class vE extends Z0{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 vE(e.radius,e.detail)}}class yE extends Nr{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=[],f=[],h=[],m=new Ge,x=new Ge,b=new Ge;for(let _=0;_<=r;_++){const S=o+_/r*a;for(let M=0;M<=i;M++){const T=M/i*s;x.x=(e+n*Math.cos(S))*Math.cos(T),x.y=(e+n*Math.cos(S))*Math.sin(T),x.z=n*Math.sin(S),c.push(x.x,x.y,x.z),m.x=e*Math.cos(T),m.y=e*Math.sin(T),b.subVectors(x,m).normalize(),f.push(b.x,b.y,b.z),h.push(M/i),h.push(_/r)}}for(let _=1;_<=r;_++)for(let S=1;S<=i;S++){const M=(i+1)*_+S-1,T=(i+1)*(_-1)+S-1,A=(i+1)*(_-1)+S,N=(i+1)*_+S;l.push(M,T,N),l.push(T,A,N)}this.setIndex(l),this.setAttribute("position",new jn(c,3)),this.setAttribute("normal",new jn(f,3)),this.setAttribute("uv",new jn(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new yE(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class bE extends Nr{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=[],f=[],h=new Ge,m=new Ge,x=new Ge,b=new Ge,_=new Ge,S=new Ge,M=new Ge;for(let A=0;A<=r;++A){const N=A/r*s*Math.PI*2;T(N,s,o,e,x),T(N+.01,s,o,e,b),S.subVectors(b,x),M.addVectors(b,x),_.crossVectors(S,M),M.crossVectors(_,S),_.normalize(),M.normalize();for(let D=0;D<=i;++D){const k=D/i*Math.PI*2,O=-n*Math.cos(k),R=n*Math.sin(k);h.x=x.x+(O*M.x+R*_.x),h.y=x.y+(O*M.y+R*_.y),h.z=x.z+(O*M.z+R*_.z),l.push(h.x,h.y,h.z),m.subVectors(h,x).normalize(),c.push(m.x,m.y,m.z),f.push(A/r),f.push(D/i)}}for(let A=1;A<=r;A++)for(let N=1;N<=i;N++){const D=(i+1)*(A-1)+(N-1),k=(i+1)*A+(N-1),O=(i+1)*A+N,R=(i+1)*(A-1)+N;a.push(D,k,R),a.push(k,O,R)}this.setIndex(a),this.setAttribute("position",new jn(l,3)),this.setAttribute("normal",new jn(c,3)),this.setAttribute("uv",new jn(f,2));function T(A,N,D,k,O){const R=Math.cos(A),L=Math.sin(A),B=D/N*A,H=Math.cos(B);O.x=k*(2+H)*.5*R,O.y=k*(2+H)*L*.5,O.z=k*Math.sin(B)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bE(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class _E extends Nr{constructor(e=new iI(new Ge(-1,-1,0),new Ge(-1,1,0),new Ge(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 Ge,l=new Ge,c=new qt;let f=new Ge;const h=[],m=[],x=[],b=[];_(),this.setIndex(b),this.setAttribute("position",new jn(h,3)),this.setAttribute("normal",new jn(m,3)),this.setAttribute("uv",new jn(x,2));function _(){for(let A=0;A<n;A++)S(A);S(s===!1?n:0),T(),M()}function S(A){f=e.getPointAt(A/n,f);const N=o.normals[A],D=o.binormals[A];for(let k=0;k<=i;k++){const O=k/i*Math.PI*2,R=Math.sin(O),L=-Math.cos(O);l.x=L*N.x+R*D.x,l.y=L*N.y+R*D.y,l.z=L*N.z+R*D.z,l.normalize(),m.push(l.x,l.y,l.z),a.x=f.x+r*l.x,a.y=f.y+r*l.y,a.z=f.z+r*l.z,h.push(a.x,a.y,a.z)}}function M(){for(let A=1;A<=n;A++)for(let N=1;N<=i;N++){const D=(i+1)*(A-1)+(N-1),k=(i+1)*A+(N-1),O=(i+1)*A+N,R=(i+1)*(A-1)+N;b.push(D,k,R),b.push(k,O,R)}}function T(){for(let A=0;A<=n;A++)for(let N=0;N<=i;N++)c.x=A/n,c.y=N/i,x.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 _E(new dT[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class oI extends Nr{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const n=[],r=new Set,i=new Ge,s=new Ge;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,f=l.length;c<f;++c){const h=l[c],m=h.start,x=h.count;for(let b=m,_=m+x;b<_;b+=3)for(let S=0;S<3;S++){const M=a.getX(b+S),T=a.getX(b+(S+1)%3);i.fromBufferAttribute(o,M),s.fromBufferAttribute(o,T),Cz(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 f=3*a+c,h=3*a+(c+1)%3;i.fromBufferAttribute(o,f),s.fromBufferAttribute(o,h),Cz(i,s,r)===!0&&(n.push(i.x,i.y,i.z),n.push(s.x,s.y,s.z))}}this.setAttribute("position",new jn(n,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Cz(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 Ez=Object.freeze({__proto__:null,BoxGeometry:Qx,CapsuleGeometry:cE,CircleGeometry:uE,ConeGeometry:r3,CylinderGeometry:n3,DodecahedronGeometry:dE,EdgesGeometry:JP,ExtrudeGeometry:hE,IcosahedronGeometry:pE,LatheGeometry:mE,OctahedronGeometry:i3,PlaneGeometry:Wp,PolyhedronGeometry:Z0,RingGeometry:gE,ShapeGeometry:xE,SphereGeometry:s3,TetrahedronGeometry:vE,TorusGeometry:yE,TorusKnotGeometry:bE,TubeGeometry:_E,WireframeGeometry:oI});class rZ extends Cl{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Rn(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 By(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?(En("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 Hl(t){const e={};for(let n=0;n<t.length;n++){const r=By(t[n]);for(const i in r)e[i]=r[i]}return e}function vMe(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function iZ(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:li.workingColorSpace}const sS={clone:By,merge:Hl};var yMe=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,bMe=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class Mu extends Cl{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=yMe,this.fragmentShader=bMe,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=By(e.uniforms),this.uniformsGroups=vMe(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 aI extends Mu{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class lI extends Cl{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Rn(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 Rn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=K0,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Su,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class sZ extends lI{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 qt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return gr(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 Rn(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 Rn(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Rn(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 oZ extends Cl{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Rn(16777215),this.specular=new Rn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Rn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=K0,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Su,this.combine=JS,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 aZ extends Cl{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Rn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Rn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=K0,this.normalScale=new qt(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 lZ extends Cl{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=K0,this.normalScale=new qt(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 cZ extends Cl{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Rn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Rn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=K0,this.normalScale=new qt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Su,this.combine=JS,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 Cl{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=SK,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 SE extends Cl{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 uZ extends Cl{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Rn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=K0,this.normalScale=new qt(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 dZ extends rc{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 fx(t,e){return!t||t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function fZ(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 BR(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 cI(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 _Me(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],f=c.getValueSize(),h=[],m=[];for(let x=0;x<c.times.length;++x){const b=c.times[x]*i;if(!(b<n||b>=r)){h.push(c.times[x]);for(let _=0;_<f;++_)m.push(c.values[x*f+_])}}h.length!==0&&(c.times=fx(h,c.times.constructor),c.values=fx(m,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 wMe(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(M){return M.name===a.name&&M.ValueTypeName===l});if(c===void 0)continue;let f=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=h/3);let m=0;const x=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(m=x/3);const b=a.times.length-1;let _;if(s<=a.times[0]){const M=f,T=h-f;_=a.values.slice(M,T)}else if(s>=a.times[b]){const M=b*h+f,T=M+h-f;_=a.values.slice(M,T)}else{const M=a.createInterpolant(),T=f,A=h-f;M.evaluate(s),_=M.resultBuffer.slice(T,A)}l==="quaternion"&&new Za().fromArray(_).normalize().conjugate().toArray(_);const S=c.times.length;for(let M=0;M<S;++M){const T=M*x+m;if(l==="quaternion")Za.multiplyQuaternionsFlat(c.values,T,_,0,c.values,T);else{const A=x-m*2;for(let N=0;N<A;++N)c.values[T+N]-=_[N]}}}return t.blendMode=GP,t}class SMe{static convertArray(e,n){return fx(e,n)}static isTypedArray(e){return PK(e)}static getKeyframeOrder(e){return fZ(e)}static sortedArray(e,n,r){return BR(e,n,r)}static flattenJSON(e,n,r,i){cI(e,n,r,i)}static subclip(e,n,r,i,s=30){return _Me(e,n,r,i,s)}static makeClipAdditive(e,n=0,r=e,i=30){return wMe(e,n,r,i)}}class ub{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 hZ extends ub{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:ux,endingEnd:ux}}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 dx:s=e,a=2*n-r;break;case Kw: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 dx:o=e,l=2*r-n;break;case Kw:o=1,l=r+i[1]-i[0];break;default:o=e-1,l=n}const c=(r-n)*.5,f=this.valueSize;this._weightPrev=c/(n-a),this._weightNext=c/(l-r),this._offsetPrev=s*f,this._offsetNext=o*f}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,f=this._offsetPrev,h=this._offsetNext,m=this._weightPrev,x=this._weightNext,b=(r-n)/(i-n),_=b*b,S=_*b,M=-m*S+2*m*_-m*b,T=(1+m)*S+(-1.5-2*m)*_+(-.5+m)*b+1,A=(-1-x)*S+(1.5+x)*_+.5*b,N=x*S-x*_;for(let D=0;D!==a;++D)s[D]=M*o[f+D]+T*o[c+D]+A*o[l+D]+N*o[h+D];return s}}class uI extends ub{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,f=(r-n)/(i-n),h=1-f;for(let m=0;m!==a;++m)s[m]=o[c+m]*h+o[l+m]*f;return s}}class pZ extends ub{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class mZ extends ub{interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,f=this.settings||this.DefaultSettings_,h=f.inTangents,m=f.outTangents;if(!h||!m){const _=(r-n)/(i-n),S=1-_;for(let M=0;M!==a;++M)s[M]=o[c+M]*S+o[l+M]*_;return s}const x=a*2,b=e-1;for(let _=0;_!==a;++_){const S=o[c+_],M=o[l+_],T=b*x+_*2,A=m[T],N=m[T+1],D=e*x+_*2,k=h[D],O=h[D+1];let R=(r-n)/(i-n),L,B,H,$,G;for(let Z=0;Z<8;Z++){L=R*R,B=L*R,H=1-R,$=H*H,G=$*H;const W=G*n+3*$*R*A+3*H*L*k+B*i-r;if(Math.abs(W)<1e-10)break;const J=3*$*(A-n)+6*H*R*(k-A)+3*L*(i-k);if(Math.abs(J)<1e-10)break;R=R-W/J,R=Math.max(0,Math.min(1,R))}s[_]=G*S+3*$*R*N+3*H*L*O+B*M}return s}}class bd{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=fx(n,this.TimeBufferType),this.values=fx(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:fx(e.times,Array),values:fx(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(r.interpolation=i)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new pZ(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new uI(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new hZ(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const n=new mZ(this.times,this.values,this.getValueSize(),e);return this.settings&&(n.settings=this.settings),n}setInterpolation(e){let n;switch(e){case Yw:n=this.InterpolantFactoryMethodDiscrete;break;case lT:n=this.InterpolantFactoryMethodLinear;break;case w2:n=this.InterpolantFactoryMethodSmooth;break;case OR: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 En("KeyframeTrack:",r),this}return this.createInterpolant=n,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Yw;case this.InterpolantFactoryMethodLinear:return lT;case this.InterpolantFactoryMethodSmooth:return w2;case this.InterpolantFactoryMethodBezier:return OR}}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&&(qn("KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(qn("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)){qn("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){qn("KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&PK(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){qn("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()===w2,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],f=e[a+1];if(c!==f&&(a!==1||c!==e[0]))if(i)l=!0;else{const h=a*r,m=h-r,x=h+r;for(let b=0;b!==r;++b){const _=n[h+b];if(_!==n[m+b]||_!==n[x+b]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*r,m=o*r;for(let x=0;x!==r;++x)n[m+x]=n[h+x]}++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}}bd.prototype.ValueTypeName="";bd.prototype.TimeBufferType=Float32Array;bd.prototype.ValueBufferType=Float32Array;bd.prototype.DefaultInterpolation=lT;class Jx extends bd{constructor(e,n,r){super(e,n,r)}}Jx.prototype.ValueTypeName="bool";Jx.prototype.ValueBufferType=Array;Jx.prototype.DefaultInterpolation=Yw;Jx.prototype.InterpolantFactoryMethodLinear=void 0;Jx.prototype.InterpolantFactoryMethodSmooth=void 0;class dI extends bd{constructor(e,n,r,i){super(e,n,r,i)}}dI.prototype.ValueTypeName="color";class oS extends bd{constructor(e,n,r,i){super(e,n,r,i)}}oS.prototype.ValueTypeName="number";class gZ extends ub{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 f=c+a;c!==f;c+=4)Za.slerpFlat(s,0,o,c-a,o,c,l);return s}}class o3 extends bd{constructor(e,n,r,i){super(e,n,r,i)}InterpolantFactoryMethodLinear(e){return new gZ(this.times,this.values,this.getValueSize(),e)}}o3.prototype.ValueTypeName="quaternion";o3.prototype.InterpolantFactoryMethodSmooth=void 0;class ev extends bd{constructor(e,n,r){super(e,n,r)}}ev.prototype.ValueTypeName="string";ev.prototype.ValueBufferType=Array;ev.prototype.DefaultInterpolation=Yw;ev.prototype.InterpolantFactoryMethodLinear=void 0;ev.prototype.InterpolantFactoryMethodSmooth=void 0;class aS extends bd{constructor(e,n,r,i){super(e,n,r,i)}}aS.prototype.ValueTypeName="vector";class lS{constructor(e="",n=-1,r=[],i=QC){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=yu(),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(TMe(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(bd.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 f=fZ(l);l=BR(l,1,f),c=BR(c,1,f),!i&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new oS(".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],f=c.name.match(s);if(f&&f.length>1){const h=f[1];let m=i[h];m||(i[h]=m=[]),m.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(En("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return qn("AnimationClip: No animation in JSONLoader data."),null;const r=function(h,m,x,b,_){if(x.length!==0){const S=[],M=[];cI(x,S,M,b),S.length!==0&&_.push(new h(m,S,M))}},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 m=c[h].keys;if(!(!m||m.length===0))if(m[0].morphTargets){const x={};let b;for(b=0;b<m.length;b++)if(m[b].morphTargets)for(let _=0;_<m[b].morphTargets.length;_++)x[m[b].morphTargets[_]]=-1;for(const _ in x){const S=[],M=[];for(let T=0;T!==m[b].morphTargets.length;++T){const A=m[b];S.push(A.time),M.push(A.morphTarget===_?1:0)}i.push(new oS(".morphTargetInfluence["+_+"]",S,M))}l=x.length*o}else{const x=".bones["+n[h].name+"]";r(aS,x+".position",m,"pos",i),r(o3,x+".quaternion",m,"rot",i),r(aS,x+".scale",m,"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 MMe(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return oS;case"vector":case"vector2":case"vector3":case"vector4":return aS;case"color":return dI;case"quaternion":return o3;case"bool":case"boolean":return Jx;case"string":return ev}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function TMe(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=MMe(t.type);if(t.times===void 0){const n=[],r=[];cI(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 lh={enabled:!1,files:{},add:function(t,e){this.enabled!==!1&&(Az(t)||(this.files[t]=e))},get:function(t){if(this.enabled!==!1&&!Az(t))return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function Az(t){try{const e=t.slice(t.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class fI{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(f){a++,s===!1&&i.onStart!==void 0&&i.onStart(f,o,a),s=!0},this.itemEnd=function(f){o++,i.onProgress!==void 0&&i.onProgress(f,o,a),o===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(f){i.onError!==void 0&&i.onError(f)},this.resolveURL=function(f){return l?l(f):f},this.setURLModifier=function(f){return l=f,this},this.addHandler=function(f,h){return c.push(f,h),this},this.removeHandler=function(f){const h=c.indexOf(f);return h!==-1&&c.splice(h,2),this},this.getHandler=function(f){for(let h=0,m=c.length;h<m;h+=2){const x=c[h],b=c[h+1];if(x.global&&(x.lastIndex=0),x.test(f))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 xZ=new fI;class qc{constructor(e){this.manager=e!==void 0?e:xZ,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}}qc.DEFAULT_MATERIAL_NAME="__DEFAULT";const ap={};class CMe extends Error{constructor(e,n){super(e),this.response=n}}class jp extends qc{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=lh.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{n&&n(s),this.manager.itemEnd(e)},0),s;if(ap[e]!==void 0){ap[e].push({onLoad:n,onProgress:r,onError:i});return}ap[e]=[],ap[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&&En("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const f=ap[e],h=c.body.getReader(),m=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),x=m?parseInt(m):0,b=x!==0;let _=0;const S=new ReadableStream({start(M){T();function T(){h.read().then(({done:A,value:N})=>{if(A)M.close();else{_+=N.byteLength;const D=new ProgressEvent("progress",{lengthComputable:b,loaded:_,total:x});for(let k=0,O=f.length;k<O;k++){const R=f[k];R.onProgress&&R.onProgress(D)}M.enqueue(N),T()}},A=>{M.error(A)})}}});return new Response(S)}else throw new CMe(`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(f=>new DOMParser().parseFromString(f,a));case"json":return c.json();default:if(a==="")return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),m=h&&h[1]?h[1].toLowerCase():void 0,x=new TextDecoder(m);return c.arrayBuffer().then(b=>x.decode(b))}}}).then(c=>{lh.add(`file:${e}`,c);const f=ap[e];delete ap[e];for(let h=0,m=f.length;h<m;h++){const x=f[h];x.onLoad&&x.onLoad(c)}}).catch(c=>{const f=ap[e];if(f===void 0)throw this.manager.itemError(e),c;delete ap[e];for(let h=0,m=f.length;h<m;h++){const x=f[h];x.onError&&x.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 EMe extends qc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new jp(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):qn(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r<e.length;r++){const i=lS.parse(e[r]);n.push(i)}return n}}class AMe extends qc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=[],a=new lE,l=new jp(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function f(h){l.load(e[h],function(m){const x=s.parse(m,!0);o[h]={width:x.width,height:x.height,format:x.format,mipmaps:x.mipmaps},c+=1,c===6&&(x.mipmapCount===1&&(a.minFilter=as),a.image=o,a.format=x.format,a.needsUpdate=!0,n&&n(a))},r,i)}if(Array.isArray(e))for(let h=0,m=e.length;h<m;++h)f(h);else l.load(e,function(h){const m=s.parse(h,!0);if(m.isCubemap){const x=m.mipmaps.length/m.mipmapCount;for(let b=0;b<x;b++){o[b]={mipmaps:[]};for(let _=0;_<m.mipmapCount;_++)o[b].mipmaps.push(m.mipmaps[b*m.mipmapCount+_]),o[b].format=m.format,o[b].width=m.width,o[b].height=m.height}a.image=o}else a.image.width=m.width,a.image.height=m.height,a.mipmaps=m.mipmaps;m.mipmapCount===1&&(a.minFilter=as),a.format=m.format,a.needsUpdate=!0,n&&n(a)},r,i);return a}}const m1=new WeakMap;class cS extends qc{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=lh.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=m1.get(o);h===void 0&&(h=[],m1.set(o,h)),h.push({onLoad:n,onError:i})}return o}const a=Jw("img");function l(){f(),n&&n(this);const h=m1.get(this)||[];for(let m=0;m<h.length;m++){const x=h[m];x.onLoad&&x.onLoad(this)}m1.delete(this),s.manager.itemEnd(e)}function c(h){f(),i&&i(h),lh.remove(`image:${e}`);const m=m1.get(this)||[];for(let x=0;x<m.length;x++){const b=m[x];b.onError&&b.onError(h)}m1.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function f(){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),lh.add(`image:${e}`,a),s.manager.itemStart(e),a.src=e,a}}class NMe extends qc{constructor(e){super(e)}load(e,n,r,i){const s=new t3;s.colorSpace=yl;const o=new cS(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(f){s.images[c]=f,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 kMe extends qc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new rf,a=new jp(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(f){if(i!==void 0)i(f);else{f(f);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:Uc,o.wrapT=c.wrapT!==void 0?c.wrapT:Uc,o.magFilter=c.magFilter!==void 0?c.magFilter:as,o.minFilter=c.minFilter!==void 0?c.minFilter:as,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=ah),c.mipmapCount===1&&(o.minFilter=as),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,n&&n(o,c)},r,i),o}}class RMe extends qc{constructor(e){super(e)}load(e,n,r,i){const s=new fo,o=new cS(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 Q0 extends wi{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new Rn(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 vZ extends Q0{constructor(e,n,r){super(e,r),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(wi.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Rn(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 mN=new pr,Nz=new Ge,kz=new Ge;class hI{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 qt(512,512),this.mapType=ql,this.map=null,this.mapPass=null,this.matrix=new pr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new cb,this._frameExtents=new qt(1,1),this._viewportCount=1,this._viewports=[new pi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;Nz.setFromMatrixPosition(e.matrixWorld),n.position.copy(Nz),kz.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(kz),n.updateMatrixWorld(),mN.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(mN,n.coordinateSystem,n.reversedDepth),n.coordinateSystem===Fx||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(mN)}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 UM=new Ge,BM=new Za,Gf=new Ge;class ME extends wi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new pr,this.projectionMatrix=new pr,this.projectionMatrixInverse=new pr,this.coordinateSystem=hu,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(UM,BM,Gf),Gf.x===1&&Gf.y===1&&Gf.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(UM,BM,Gf.set(1,1,1)).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorld.decompose(UM,BM,Gf),Gf.x===1&&Gf.y===1&&Gf.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(UM,BM,Gf.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Bm=new Ge,Rz=new qt,Pz=new qt;class lo extends ME{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=jy*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Cx*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return jy*2*Math.atan(Math.tan(Cx*.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){Bm.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Bm.x,Bm.y).multiplyScalar(-e/Bm.z),Bm.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Bm.x,Bm.y).multiplyScalar(-e/Bm.z)}getViewSize(e,n){return this.getViewBounds(e,Rz,Pz),n.subVectors(Pz,Rz)}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(Cx*.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 PMe extends hI{constructor(){super(new lo(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const n=this.camera,r=jy*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 yZ extends Q0{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(wi.DEFAULT_UP),this.updateMatrix(),this.target=new wi,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new PMe}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 IMe extends hI{constructor(){super(new lo(90,1,.5,500)),this.isPointLightShadow=!0}}class bZ extends Q0{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 IMe}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 sf extends ME{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,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=f*this.view.offsetY,l=a-f*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 DMe extends hI{constructor(){super(new sf(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class _Z extends Q0{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(wi.DEFAULT_UP),this.updateMatrix(),this.target=new wi,this.shadow=new DMe}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 wZ extends Q0{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class SZ extends Q0{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 pI{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Ge)}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 MZ extends Q0{constructor(e=new pI,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 TE extends qc{constructor(e){super(e),this.textures={}}load(e,n,r,i){const s=this,o=new jp(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):qn(l),s.manager.itemError(e)}},r,i)}parse(e){const n=this.textures;function r(s){return n[s]===void 0&&En("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 Rn().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 Rn().setHex(o.value);break;case"v2":i.uniforms[s].value=new qt().fromArray(o.value);break;case"v3":i.uniforms[s].value=new Ge().fromArray(o.value);break;case"v4":i.uniforms[s].value=new pi().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Er().fromArray(o.value);break;case"m4":i.uniforms[s].value=new pr().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 qt().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 qt().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 TE.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:rZ,SpriteMaterial:YP,RawShaderMaterial:aI,ShaderMaterial:Mu,PointsMaterial:ZP,MeshPhysicalMaterial:sZ,MeshStandardMaterial:lI,MeshPhongMaterial:oZ,MeshToonMaterial:aZ,MeshNormalMaterial:lZ,MeshLambertMaterial:cZ,MeshDepthMaterial:wE,MeshDistanceMaterial:SE,MeshBasicMaterial:Vp,MeshMatcapMaterial:uZ,LineDashedMaterial:dZ,LineBasicMaterial:rc,Material:Cl};return new n[e]}}class HR{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 Nr{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 TZ extends qc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new jp(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):qn(l),s.manager.itemError(e)}},r,i)}parse(e){const n={},r={};function i(x,b){if(n[b]!==void 0)return n[b];const S=x.interleavedBuffers[b],M=s(x,S.buffer),T=k1(S.type,M),A=new sE(T,S.stride);return A.uuid=S.uuid,n[b]=A,A}function s(x,b){if(r[b]!==void 0)return r[b];const S=x.arrayBuffers[b],M=new Uint32Array(S).buffer;return r[b]=M,M}const o=e.isInstancedBufferGeometry?new CE:new Nr,a=e.data.index;if(a!==void 0){const x=k1(a.type,a.array);o.setIndex(new Xi(x,1))}const l=e.data.attributes;for(const x in l){const b=l[x];let _;if(b.isInterleavedBufferAttribute){const S=i(e.data,b.data);_=new pu(S,b.itemSize,b.offset,b.normalized)}else{const S=k1(b.type,b.array),M=b.isInstancedBufferAttribute?Ux:Xi;_=new M(S,b.itemSize,b.normalized)}b.name!==void 0&&(_.name=b.name),b.usage!==void 0&&_.setUsage(b.usage),o.setAttribute(x,_)}const c=e.data.morphAttributes;if(c)for(const x in c){const b=c[x],_=[];for(let S=0,M=b.length;S<M;S++){const T=b[S];let A;if(T.isInterleavedBufferAttribute){const N=i(e.data,T.data);A=new pu(N,T.itemSize,T.offset,T.normalized)}else{const N=k1(T.type,T.array);A=new Xi(N,T.itemSize,T.normalized)}T.name!==void 0&&(A.name=T.name),_.push(A)}o.morphAttributes[x]=_}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let x=0,b=h.length;x!==b;++x){const _=h[x];o.addGroup(_.start,_.count,_.materialIndex)}const m=e.data.boundingSphere;return m!==void 0&&(o.boundingSphere=new ea().fromJSON(m)),e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class OMe extends qc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=this.path===""?HR.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new jp(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 f=c.metadata;if(f===void 0||f.type===void 0||f.type.toLowerCase()==="geometry"){i!==void 0&&i(new Error("THREE.ObjectLoader: Can't load "+e)),qn("ObjectLoader: Can't load "+e);return}s.parse(c,n)},r,i)}async loadAsync(e,n){const r=this,i=this.path===""?HR.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||i;const s=new jp(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),f=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,f),this.bindLightTargets(c),n!==void 0){let h=!1;for(const m in o)if(o[m].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 m0().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 oE().fromJSON(e[s],i);r[a.uuid]=a}return r}parseGeometries(e,n){const r={};if(e!==void 0){const i=new TZ;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 Ez?a=Ez[l.type].fromJSON(l,n):En(`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 TE;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=lS.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,f=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:r.resourcePath+c;return o(f)}else return l.data?{data:k1(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new fI(n);s=new cS(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,f=e.length;c<f;c++){const h=e[c],m=h.url;if(Array.isArray(m)){const x=[];for(let b=0,_=m.length;b<_;b++){const S=m[b],M=a(S);M!==null&&(M instanceof HTMLImageElement?x.push(M):x.push(new rf(M.data,M.width,M.height)))}i[h.uuid]=new d0(x)}else{const x=a(h.url);i[h.uuid]=new d0(x)}}}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:k1(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){i=new cS(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 f=[];for(let h=0,m=c.length;h<m;h++){const x=c[h],b=await s(x);b!==null&&(b instanceof HTMLImageElement?f.push(b):f.push(new rf(b.data,b.width,b.height)))}r[l.uuid]=new d0(f)}else{const f=await s(l.url);r[l.uuid]=new d0(f)}}}return r}parseTextures(e,n){function r(s,o){return typeof s=="number"?s:(En("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&&En('ObjectLoader: No "image" specified for',a.uuid),n[a.image]===void 0&&En("ObjectLoader: Undefined image",a.image);const l=n[a.image],c=l.data;let f;Array.isArray(c)?(f=new t3,c.length===6&&(f.needsUpdate=!0)):(c&&c.data?f=new rf:f=new fo,c&&(f.needsUpdate=!0)),f.source=l,f.uuid=a.uuid,a.name!==void 0&&(f.name=a.name),a.mapping!==void 0&&(f.mapping=r(a.mapping,LMe)),a.channel!==void 0&&(f.channel=a.channel),a.offset!==void 0&&f.offset.fromArray(a.offset),a.repeat!==void 0&&f.repeat.fromArray(a.repeat),a.center!==void 0&&f.center.fromArray(a.center),a.rotation!==void 0&&(f.rotation=a.rotation),a.wrap!==void 0&&(f.wrapS=r(a.wrap[0],Iz),f.wrapT=r(a.wrap[1],Iz)),a.format!==void 0&&(f.format=a.format),a.internalFormat!==void 0&&(f.internalFormat=a.internalFormat),a.type!==void 0&&(f.type=a.type),a.colorSpace!==void 0&&(f.colorSpace=a.colorSpace),a.minFilter!==void 0&&(f.minFilter=r(a.minFilter,Dz)),a.magFilter!==void 0&&(f.magFilter=r(a.magFilter,Dz)),a.anisotropy!==void 0&&(f.anisotropy=a.anisotropy),a.flipY!==void 0&&(f.flipY=a.flipY),a.generateMipmaps!==void 0&&(f.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(f.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(f.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(f.compareFunction=a.compareFunction),a.userData!==void 0&&(f.userData=a.userData),i[a.uuid]=f}return i}parseObject(e,n,r,i,s){let o;function a(m){return n[m]===void 0&&En("ObjectLoader: Undefined geometry",m),n[m]}function l(m){if(m!==void 0){if(Array.isArray(m)){const x=[];for(let b=0,_=m.length;b<_;b++){const S=m[b];r[S]===void 0&&En("ObjectLoader: Undefined material",S),x.push(r[S])}return x}return r[m]===void 0&&En("ObjectLoader: Undefined material",m),r[m]}}function c(m){return i[m]===void 0&&En("ObjectLoader: Undefined texture",m),i[m]}let f,h;switch(e.type){case"Scene":o=new $P,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new Rn(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 iE(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new rE(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 lo(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 sf(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 wZ(e.color,e.intensity);break;case"DirectionalLight":o=new _Z(e.color,e.intensity),o.target=e.target||"";break;case"PointLight":o=new bZ(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new SZ(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new yZ(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),o.target=e.target||"";break;case"HemisphereLight":o=new vZ(e.color,e.groundColor,e.intensity);break;case"LightProbe":const m=new pI().fromArray(e.sh);o=new MZ(m,e.intensity);break;case"SkinnedMesh":f=a(e.geometry),h=l(e.material),o=new BK(f,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":f=a(e.geometry),h=l(e.material),o=new Xs(f,h);break;case"InstancedMesh":f=a(e.geometry),h=l(e.material);const x=e.count,b=e.instanceMatrix,_=e.instanceColor;o=new HK(f,h,x),o.instanceMatrix=new Ux(new Float32Array(b.array),16),_!==void 0&&(o.instanceColor=new Ux(new Float32Array(_.array),_.itemSize));break;case"BatchedMesh":f=a(e.geometry),h=l(e.material),o=new GK(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=f,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._geometryInfo=e.geometryInfo.map(S=>{let M=null,T=null;return S.boundingBox!==void 0&&(M=new Fo().fromJSON(S.boundingBox)),S.boundingSphere!==void 0&&(T=new ea().fromJSON(S.boundingSphere)),{...S,boundingBox:M,boundingSphere:T}}),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 ea().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(o.boundingBox=new Fo().fromJSON(e.boundingBox));break;case"LOD":o=new UK;break;case"Line":o=new I0(a(e.geometry),l(e.material));break;case"LineLoop":o=new VK(a(e.geometry),l(e.material));break;case"LineSegments":o=new Ah(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new WK(a(e.geometry),l(e.material));break;case"Sprite":o=new FK(l(e.material));break;case"Group":o=new R1;break;case"Bone":o=new KP;break;default:o=new wi}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 Ge().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 m=e.children;for(let x=0;x<m.length;x++)o.add(this.parseObject(m[x],n,r,i,s))}if(e.animations!==void 0){const m=e.animations;for(let x=0;x<m.length;x++){const b=m[x];o.animations.push(s[b])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const m=e.levels;for(let x=0;x<m.length;x++){const b=m[x],_=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?En("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 wi}})}}const LMe={UVMapping:WC,CubeReflectionMapping:gh,CubeRefractionMapping:k0,EquirectangularReflectionMapping:gw,EquirectangularRefractionMapping:xw,CubeUVReflectionMapping:lb},Iz={RepeatWrapping:qw,ClampToEdgeWrapping:Uc,MirroredRepeatWrapping:Xw},Dz={NearestFilter:zo,NearestMipmapNearestFilter:LP,NearestMipmapLinearFilter:N1,LinearFilter:as,LinearMipmapNearestFilter:vw,LinearMipmapLinearFilter:ah},gN=new WeakMap;class jMe extends qc{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&En("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&En("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=lh.get(`image-bitmap:${e}`);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{if(gN.has(o)===!0)i&&i(gN.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 lh.add(`image-bitmap:${e}`,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),gN.set(l,c),lh.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});lh.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let HM;class mI{static getContext(){return HM===void 0&&(HM=new(window.AudioContext||window.webkitAudioContext)),HM}static setContext(e){HM=e}}class zMe extends qc{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new jp(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);mI.getContext().decodeAudioData(c,function(h){n(h)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):qn(l),s.manager.itemError(e)}}}const Oz=new pr,Lz=new pr,$g=new pr;class FMe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new lo,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new lo,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,$g.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(Cx*n.fov*.5)/n.zoom;let a,l;Lz.elements[12]=-i,Oz.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,$g.elements[0]=2*n.near/(l-a),$g.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy($g),a=-o*n.aspect-s,l=o*n.aspect-s,$g.elements[0]=2*n.near/(l-a),$g.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy($g)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Lz),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Oz)}}const g1=-90,x1=1;class CZ extends wi{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new lo(g1,x1,e,n);i.layers=this.layers,this.add(i);const s=new lo(g1,x1,e,n);s.layers=this.layers,this.add(s);const o=new lo(g1,x1,e,n);o.layers=this.layers,this.add(o);const a=new lo(g1,x1,e,n);a.layers=this.layers,this.add(a);const l=new lo(g1,x1,e,n);l.layers=this.layers,this.add(l);const c=new lo(g1,x1,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===hu)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===Fx)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,f]=this.children,h=e.getRenderTarget(),m=e.getActiveCubeFace(),x=e.getActiveMipmapLevel(),b=e.xr.enabled;e.xr.enabled=!1;const _=r.texture.generateMipmaps;r.texture.generateMipmaps=!1;let S=!1;e.isWebGLRenderer===!0?S=e.state.buffers.depth.getReversed():S=e.reversedDepthBuffer,e.setRenderTarget(r,0,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,s),e.setRenderTarget(r,1,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,o),e.setRenderTarget(r,2,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,a),e.setRenderTarget(r,3,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,l),e.setRenderTarget(r,4,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,c),r.texture.generateMipmaps=_,e.setRenderTarget(r,5,i),S&&e.autoClear===!1&&e.clearDepth(),e.render(n,f),e.setRenderTarget(h,m,x),e.xr.enabled=b,r.texture.needsPMREMUpdate=!0}}class EZ extends lo{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class AZ{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=UMe.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 UMe(){this._document.hidden===!1&&this.reset()}const qg=new Ge,xN=new Za,BMe=new Ge,Xg=new Ge,Yg=new Ge;class HMe extends wi{constructor(){super(),this.type="AudioListener",this.context=mI.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new AZ}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(qg,xN,BMe),Xg.set(0,0,-1).applyQuaternion(xN),Yg.set(0,1,0).applyQuaternion(xN),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(qg.x,r),n.positionY.linearRampToValueAtTime(qg.y,r),n.positionZ.linearRampToValueAtTime(qg.z,r),n.forwardX.linearRampToValueAtTime(Xg.x,r),n.forwardY.linearRampToValueAtTime(Xg.y,r),n.forwardZ.linearRampToValueAtTime(Xg.z,r),n.upX.linearRampToValueAtTime(Yg.x,r),n.upY.linearRampToValueAtTime(Yg.y,r),n.upZ.linearRampToValueAtTime(Yg.z,r)}else n.setPosition(qg.x,qg.y,qg.z),n.setOrientation(Xg.x,Xg.y,Xg.z,Yg.x,Yg.y,Yg.z)}}class NZ extends wi{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){En("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){En("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){En("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){En("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){En("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?(En("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){En("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"?(En("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 Kg=new Ge,jz=new Za,GMe=new Ge,Zg=new Ge;class VMe extends NZ{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(Kg,jz,GMe),Zg.set(0,0,1).applyQuaternion(jz);const n=this.panner;if(n.positionX){const r=this.context.currentTime+this.listener.timeDelta;n.positionX.linearRampToValueAtTime(Kg.x,r),n.positionY.linearRampToValueAtTime(Kg.y,r),n.positionZ.linearRampToValueAtTime(Kg.z,r),n.orientationX.linearRampToValueAtTime(Zg.x,r),n.orientationY.linearRampToValueAtTime(Zg.y,r),n.orientationZ.linearRampToValueAtTime(Zg.z,r)}else n.setPosition(Kg.x,Kg.y,Kg.z),n.setOrientation(Zg.x,Zg.y,Zg.z)}}class WMe{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 kZ{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){Za.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;Za.multiplyQuaternionsFlat(e,o,e,n,e,r),Za.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 gI="\\[\\]\\.:\\/",$Me=new RegExp("["+gI+"]","g"),xI="[^"+gI+"]",qMe="[^"+gI.replace("\\.","")+"]",XMe=/((?:WC+[\/:])*)/.source.replace("WC",xI),YMe=/(WCOD+)?/.source.replace("WCOD",qMe),KMe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",xI),ZMe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",xI),QMe=new RegExp("^"+XMe+YMe+KMe+ZMe+"$"),JMe=["material","materials","bones","map"];class e2e{constructor(e,n,r){const i=r||bi.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 bi{constructor(e,n,r){this.path=n,this.parsedPath=r||bi.parseTrackName(n),this.node=bi.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 bi.Composite(e,n,r):new bi(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace($Me,"")}static parseTrackName(e){const n=QMe.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);JMe.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=bi.findNode(this.rootNode,n.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){En("PropertyBinding: No target node found for track: "+this.path+".");return}if(r){let c=n.objectIndex;switch(r){case"materials":if(!e.material){qn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){qn("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){qn("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let f=0;f<e.length;f++)if(e[f].name===c){c=f;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){qn("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){qn("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){qn("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){qn("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;qn("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){qn("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){qn("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}}bi.Composite=e2e;bi.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};bi.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};bi.prototype.GetterByBindingType=[bi.prototype._getValue_direct,bi.prototype._getValue_array,bi.prototype._getValue_arrayElement,bi.prototype._getValue_toArray];bi.prototype.SetterByBindingTypeAndVersioning=[[bi.prototype._setValue_direct,bi.prototype._setValue_direct_setNeedsUpdate,bi.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[bi.prototype._setValue_array,bi.prototype._setValue_array_setNeedsUpdate,bi.prototype._setValue_array_setMatrixWorldNeedsUpdate],[bi.prototype._setValue_arrayElement,bi.prototype._setValue_arrayElement_setNeedsUpdate,bi.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[bi.prototype._setValue_fromArray,bi.prototype._setValue_fromArray_setNeedsUpdate,bi.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class t2e{constructor(){this.isAnimationObjectGroup=!0,this.uuid=yu(),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 f=0,h=arguments.length;f!==h;++f){const m=arguments[f],x=m.uuid;let b=n[x];if(b===void 0){b=l++,n[x]=b,e.push(m);for(let _=0,S=o;_!==S;++_)s[_].push(new bi(m,r[_],i[_]))}else if(b<c){a=e[b];const _=--c,S=e[_];n[S.uuid]=b,e[b]=S,n[x]=_,e[_]=m;for(let M=0,T=o;M!==T;++M){const A=s[M],N=A[_];let D=A[b];A[b]=N,D===void 0&&(D=new bi(m,r[M],i[M])),A[_]=D}}else e[b]!==a&&qn("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,f=n[c];if(f!==void 0&&f>=s){const h=s++,m=e[h];n[m.uuid]=f,e[f]=m,n[c]=h,e[h]=l;for(let x=0,b=i;x!==b;++x){const _=r[x],S=_[h],M=_[f];_[f]=S,_[h]=M}}}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],f=c.uuid,h=n[f];if(h!==void 0)if(delete n[f],h<s){const m=--s,x=e[m],b=--o,_=e[b];n[x.uuid]=h,e[h]=x,n[_.uuid]=m,e[m]=_,e.pop();for(let S=0,M=i;S!==M;++S){const T=r[S],A=T[m],N=T[b];T[h]=A,T[m]=N,T.pop()}}else{const m=--o,x=e[m];m>0&&(n[x.uuid]=h),e[h]=x,e.pop();for(let b=0,_=i;b!==_;++b){const S=r[b];S[h]=S[m],S.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,f=this.nCachedObjects_,h=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(h);for(let m=f,x=l.length;m!==x;++m){const b=l[m];h[m]=new bi(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 RZ{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:ux,endingEnd:ux};for(let c=0;c!==o;++c){const f=s[c].createInterpolant(null);a[c]=f,f.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=_K,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 GP:for(let f=0,h=l.length;f!==h;++f)l[f].evaluate(o),c[f].accumulateAdditive(a);break;case QC:default:for(let f=0,h=l.length;f!==h;++f)l[f].evaluate(o),c[f].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===wK;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===bK){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=dx,i.endingEnd=dx):(e?i.endingStart=this.zeroSlopeAtStart?dx:ux:i.endingStart=Kw,n?i.endingEnd=this.zeroSlopeAtEnd?dx:ux:i.endingEnd=Kw)}_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 n2e=new Float32Array(1);class r2e extends Eh{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 f=c[l];f===void 0&&(f={},c[l]=f);for(let h=0;h!==s;++h){const m=i[h],x=m.name;let b=f[x];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,x));continue}const _=n&&n._propertyBindings[h].binding.parsedPath;b=new kZ(bi.create(r,x,_),m.ValueTypeName,m.getValueSize()),++b.referenceCount,this._addInactiveBinding(b,l,x),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],f=e._byClipCacheIndex;c._byClipCacheIndex=f,l[f]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,m=(e._localRoot||this._root).uuid;delete h[m],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 uI(new Float32Array(2),new Float32Array(2),1,n2e),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"?lS.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=QC),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 f=new RZ(this,o,n,r);return this._bindAction(f,c),this._addInactiveAction(f,a,s),f}existingAction(e,n){const r=n||this._root,i=r.uuid,s=typeof e=="string"?lS.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 f=c._cacheIndex,h=n[n.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=f,n[f]=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 i2e extends WP{constructor(e=1,n=1,r=1,i={}){super(e,n,i),this.isRenderTarget3D=!0,this.depth=r,this.texture=new nE(null,e,n,r),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class vI{constructor(e){this.value=e}clone(){return new vI(this.value.clone===void 0?this.value:this.value.clone())}}let s2e=0;class o2e extends Eh{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:s2e++}),this.name="",this.usage=Qw,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 hT extends sE{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 a2e{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 zz=new pr;class PZ{constructor(e,n,r=0,i=1/0){this.ray=new Zx(e,n),this.near=r,this.far=i,this.camera=null,this.layers=new zy,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):qn("Raycaster: Unsupported camera type: "+n.type)}setFromXRController(e){return zz.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(zz),this}intersectObject(e,n=!0,r=[]){return GR(e,this,r,n),r.sort(Fz),r}intersectObjects(e,n=!0,r=[]){for(let i=0,s=e.length;i<s;i++)GR(e[i],this,r,n);return r.sort(Fz),r}}function Fz(t,e){return t.distance-e.distance}function GR(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++)GR(s[o],e,n,!0)}}class IZ{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,En("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 VR{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=gr(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(gr(n/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class l2e{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 yI{constructor(e,n,r,i){yI.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 Uz=new qt;class c2e{constructor(e=new qt(1/0,1/0),n=new qt(-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=Uz.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,Uz).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 Bz=new Ge,GM=new Ge,v1=new Ge,y1=new Ge,vN=new Ge,u2e=new Ge,d2e=new Ge;class DZ{constructor(e=new Ge,n=new Ge){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){Bz.subVectors(e,this.start),GM.subVectors(this.end,this.start);const r=GM.dot(GM);let s=GM.dot(Bz)/r;return n&&(s=gr(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=u2e,r=d2e){const i=10000000000000001e-32;let s,o;const a=this.start,l=e.start,c=this.end,f=e.end;v1.subVectors(c,a),y1.subVectors(f,l),vN.subVectors(a,l);const h=v1.dot(v1),m=y1.dot(y1),x=y1.dot(vN);if(h<=i&&m<=i)return n.copy(a),r.copy(l),n.sub(r),n.dot(n);if(h<=i)s=0,o=x/m,o=gr(o,0,1);else{const b=v1.dot(vN);if(m<=i)o=0,s=gr(-b/h,0,1);else{const _=v1.dot(y1),S=h*m-_*_;S!==0?s=gr((_*x-b*m)/S,0,1):s=0,o=(_*s+x)/m,o<0?(o=0,s=gr(-b/h,0,1)):o>1&&(o=1,s=gr((_-b)/h,0,1))}}return n.copy(a).addScaledVector(v1,s),r.copy(l).addScaledVector(y1,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 Hz=new Ge;class f2e extends wi{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new Nr,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,f=a/l*Math.PI*2;i.push(Math.cos(c),Math.sin(c),1,Math.cos(f),Math.sin(f),1)}r.setAttribute("position",new jn(i,3));const s=new rc({fog:!1,toneMapped:!1});this.cone=new Ah(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),Hz.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Hz),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Hm=new Ge,VM=new pr,yN=new pr;class h2e extends Ah{constructor(e){const n=OZ(e),r=new Nr,i=[],s=[];for(let c=0;c<n.length;c++){const f=n[c];f.parent&&f.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 jn(i,3)),r.setAttribute("color",new jn(s,3));const o=new rc({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 Rn(255),l=new Rn(65280);this.setColors(a,l)}updateMatrixWorld(e){const n=this.bones,r=this.geometry,i=r.getAttribute("position");yN.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<n.length;s++){const a=n[s];a.parent&&a.parent.isBone&&(VM.multiplyMatrices(yN,a.matrixWorld),Hm.setFromMatrixPosition(VM),i.setXYZ(o,Hm.x,Hm.y,Hm.z),VM.multiplyMatrices(yN,a.parent.matrixWorld),Hm.setFromMatrixPosition(VM),i.setXYZ(o+1,Hm.x,Hm.y,Hm.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 OZ(t){const e=[];t.isBone===!0&&e.push(t);for(let n=0;n<t.children.length;n++)e.push(...OZ(t.children[n]));return e}class p2e extends Xs{constructor(e,n,r){const i=new s3(n,4,2),s=new Vp({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 m2e=new Ge,Gz=new Rn,Vz=new Rn;class g2e extends wi{constructor(e,n,r){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,this.type="HemisphereLightHelper";const i=new i3(n);i.rotateY(Math.PI*.5),this.material=new Vp({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 Xi(o,3)),this.add(new Xs(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");Gz.copy(this.light.color),Vz.copy(this.light.groundColor);for(let r=0,i=n.count;r<i;r++){const s=r<i/2?Gz:Vz;n.setXYZ(r,s.r,s.g,s.b)}n.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(m2e.setFromMatrixPosition(this.light.matrixWorld).negate())}}class x2e extends Ah{constructor(e=10,n=10,r=4473924,i=8947848){r=new Rn(r),i=new Rn(i);const s=n/2,o=e/n,a=e/2,l=[],c=[];for(let m=0,x=0,b=-a;m<=n;m++,b+=o){l.push(-a,0,b,a,0,b),l.push(b,0,-a,b,0,a);const _=m===s?r:i;_.toArray(c,x),x+=3,_.toArray(c,x),x+=3,_.toArray(c,x),x+=3,_.toArray(c,x),x+=3}const f=new Nr;f.setAttribute("position",new jn(l,3)),f.setAttribute("color",new jn(c,3));const h=new rc({vertexColors:!0,toneMapped:!1});super(f,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class v2e extends Ah{constructor(e=10,n=16,r=8,i=64,s=4473924,o=8947848){s=new Rn(s),o=new Rn(o);const a=[],l=[];if(n>1)for(let h=0;h<n;h++){const m=h/n*(Math.PI*2),x=Math.sin(m)*e,b=Math.cos(m)*e;a.push(0,0,0),a.push(x,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 m=h&1?s:o,x=e-e/r*h;for(let b=0;b<i;b++){let _=b/i*(Math.PI*2),S=Math.sin(_)*x,M=Math.cos(_)*x;a.push(S,0,M),l.push(m.r,m.g,m.b),_=(b+1)/i*(Math.PI*2),S=Math.sin(_)*x,M=Math.cos(_)*x,a.push(S,0,M),l.push(m.r,m.g,m.b)}}const c=new Nr;c.setAttribute("position",new jn(a,3)),c.setAttribute("color",new jn(l,3));const f=new rc({vertexColors:!0,toneMapped:!1});super(c,f),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Wz=new Ge,WM=new Ge,$z=new Ge;class y2e extends wi{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 Nr;i.setAttribute("position",new jn([-n,n,0,n,n,0,n,-n,0,-n,-n,0,-n,n,0],3));const s=new rc({fog:!1,toneMapped:!1});this.lightPlane=new I0(i,s),this.add(this.lightPlane),i=new Nr,i.setAttribute("position",new jn([0,0,0,0,0,1],3)),this.targetLine=new I0(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),Wz.setFromMatrixPosition(this.light.matrixWorld),WM.setFromMatrixPosition(this.light.target.matrixWorld),$z.subVectors(WM,Wz),this.lightPlane.lookAt(WM),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(WM),this.targetLine.scale.z=$z.length()}}const $M=new Ge,_o=new ME;class b2e extends Ah{constructor(e){const n=new Nr,r=new rc({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 jn(i,3)),n.setAttribute("color",new jn(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 Rn(16755200),f=new Rn(16711680),h=new Rn(43775),m=new Rn(16777215),x=new Rn(3355443);this.setColors(c,f,h,m,x)}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(_o.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,o=0;else if(this.camera.coordinateSystem===hu)s=-1,o=1;else if(this.camera.coordinateSystem===Fx)s=0,o=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Lo("c",n,e,_o,0,0,s),Lo("t",n,e,_o,0,0,o),Lo("n1",n,e,_o,-r,-i,s),Lo("n2",n,e,_o,r,-i,s),Lo("n3",n,e,_o,-r,i,s),Lo("n4",n,e,_o,r,i,s),Lo("f1",n,e,_o,-r,-i,o),Lo("f2",n,e,_o,r,-i,o),Lo("f3",n,e,_o,-r,i,o),Lo("f4",n,e,_o,r,i,o),Lo("u1",n,e,_o,r*.7,i*1.1,s),Lo("u2",n,e,_o,-r*.7,i*1.1,s),Lo("u3",n,e,_o,0,i*2,s),Lo("cf1",n,e,_o,-r,0,o),Lo("cf2",n,e,_o,r,0,o),Lo("cf3",n,e,_o,0,-i,o),Lo("cf4",n,e,_o,0,i,o),Lo("cn1",n,e,_o,-r,0,s),Lo("cn2",n,e,_o,r,0,s),Lo("cn3",n,e,_o,0,-i,s),Lo("cn4",n,e,_o,0,i,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Lo(t,e,n,r,i,s,o){$M.set(i,s,o).unproject(r);const a=e[t];if(a!==void 0){const l=n.getAttribute("position");for(let c=0,f=a.length;c<f;c++)l.setXYZ(a[c],$M.x,$M.y,$M.z)}}const qM=new Fo;class _2e extends Ah{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 Nr;s.setIndex(new Xi(r,1)),s.setAttribute("position",new Xi(i,3)),super(s,new rc({color:n,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&qM.setFromObject(this.object),qM.isEmpty())return;const e=qM.min,n=qM.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 w2e extends Ah{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 Nr;s.setIndex(new Xi(r,1)),s.setAttribute("position",new jn(i,3)),super(s,new rc({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 S2e extends I0{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 Nr;o.setAttribute("position",new jn(s,3)),o.computeBoundingSphere(),super(o,new rc({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 Nr;l.setAttribute("position",new jn(a,3)),l.computeBoundingSphere(),this.add(new Xs(l,new Vp({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 qz=new Ge;let XM,bN;class M2e extends wi{constructor(e=new Ge(0,0,1),n=new Ge(0,0,0),r=1,i=16776960,s=r*.2,o=s*.2){super(),this.type="ArrowHelper",XM===void 0&&(XM=new Nr,XM.setAttribute("position",new jn([0,0,0,0,1,0],3)),bN=new r3(.5,1,5,1),bN.translate(0,-.5,0)),this.position.copy(n),this.line=new I0(XM,new rc({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Xs(bN,new Vp({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{qz.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(qz,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 T2e extends Ah{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 Nr;i.setAttribute("position",new jn(n,3)),i.setAttribute("color",new jn(r,3));const s=new rc({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new Rn,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 C2e{constructor(){this.type="ShapePath",this.color=new Rn,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new fT,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(M){const T=[];for(let A=0,N=M.length;A<N;A++){const D=M[A],k=new m0;k.curves=D.curves,T.push(k)}return T}function r(M,T){const A=T.length;let N=!1;for(let D=A-1,k=0;k<A;D=k++){let O=T[D],R=T[k],L=R.x-O.x,B=R.y-O.y;if(Math.abs(B)>Number.EPSILON){if(B<0&&(O=T[k],L=-L,R=T[D],B=-B),M.y<O.y||M.y>R.y)continue;if(M.y===O.y){if(M.x===O.x)return!0}else{const H=B*(M.x-O.x)-L*(M.y-O.y);if(H===0)return!0;if(H<0)continue;N=!N}}else{if(M.y!==O.y)continue;if(R.x<=M.x&&M.x<=O.x||O.x<=M.x&&M.x<=R.x)return!0}}return N}const i=nf.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 m0,l.curves=a.curves,c.push(l),c;let f=!i(s[0].getPoints());f=e?!f:f;const h=[],m=[];let x=[],b=0,_;m[b]=void 0,x[b]=[];for(let M=0,T=s.length;M<T;M++)a=s[M],_=a.getPoints(),o=i(_),o=e?!o:o,o?(!f&&m[b]&&b++,m[b]={s:new m0,p:_},m[b].s.curves=a.curves,f&&b++,x[b]=[]):x[b].push({h:a,p:_[0]});if(!m[0])return n(s);if(m.length>1){let M=!1,T=0;for(let A=0,N=m.length;A<N;A++)h[A]=[];for(let A=0,N=m.length;A<N;A++){const D=x[A];for(let k=0;k<D.length;k++){const O=D[k];let R=!0;for(let L=0;L<m.length;L++)r(O.p,m[L].p)&&(A!==L&&T++,R?(R=!1,h[L].push(O)):M=!0);R&&h[A].push(O)}}T>0&&M===!1&&(x=h)}let S;for(let M=0,T=m.length;M<T;M++){l=m[M].s,c.push(l),S=x[M];for(let A=0,N=S.length;A<N;A++)l.holes.push(S[A].h)}return c}}class E2e extends Eh{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){En("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function A2e(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 N2e(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 k2e(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function WR(t,e,n,r){const i=R2e(r);switch(n){case BP:return t*e;case YC:return t*e/i.components*i.byteLength;case e3:return t*e/i.components*i.byteLength;case zx:return t*e*2/i.components*i.byteLength;case KC:return t*e*2/i.components*i.byteLength;case HP:return t*e*3/i.components*i.byteLength;case bl:return t*e*4/i.components*i.byteLength;case ZC:return t*e*4/i.components*i.byteLength;case yw:case bw:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case _w:case ww:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case R5:case I5:return Math.max(t,16)*Math.max(e,8)/4;case k5:case P5:return Math.max(t,8)*Math.max(e,8)/2;case D5:case O5:case j5:case z5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case L5:case F5:case U5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case B5:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case H5:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case G5:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case V5:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case W5:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case $5:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case q5:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case X5:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case Y5:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case K5:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Z5:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Q5:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case J5:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case eT:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case tT:case nT:case rT:return Math.ceil(t/4)*Math.ceil(e/4)*16;case iT:case sT:return Math.ceil(t/4)*Math.ceil(e/4)*8;case oT:case aT:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function R2e(t){switch(t){case ql:case jP:return{byteLength:1,components:1};case Oy:case zP:case xh:return{byteLength:2,components:1};case qC:case XC:return{byteLength:2,components:4};case xd:case $C:case Ql:return{byteLength:4,components:1};case FP:case UP:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}class P2e{static contain(e,n){return A2e(e,n)}static cover(e,n){return N2e(e,n)}static fill(e){return k2e(e)}static getByteLength(e,n,r,i){return WR(e,n,r,i)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:QS}}));typeof window<"u"&&(window.__THREE__?En("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=QS);/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */function LZ(){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 I2e(t){const e=new WeakMap;function n(a,l){const c=a.array,f=a.usage,h=c.byteLength,m=t.createBuffer();t.bindBuffer(l,m),t.bufferData(l,c,f),a.onUploadCallback();let x;if(c instanceof Float32Array)x=t.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)x=t.HALF_FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?x=t.HALF_FLOAT:x=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)x=t.SHORT;else if(c instanceof Uint32Array)x=t.UNSIGNED_INT;else if(c instanceof Int32Array)x=t.INT;else if(c instanceof Int8Array)x=t.BYTE;else if(c instanceof Uint8Array)x=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)x=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:m,type:x,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:h}}function r(a,l,c){const f=l.array,h=l.updateRanges;if(t.bindBuffer(c,a),h.length===0)t.bufferSubData(c,0,f);else{h.sort((x,b)=>x.start-b.start);let m=0;for(let x=1;x<h.length;x++){const b=h[m],_=h[x];_.start<=b.start+b.count+1?b.count=Math.max(b.count,_.start+_.count-b.start):(++m,h[m]=_)}h.length=m+1;for(let x=0,b=h.length;x<b;x++){const _=h[x];t.bufferSubData(c,_.start*f.BYTES_PER_ELEMENT,f,_.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 f=e.get(a);(!f||f.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 D2e=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,O2e=`#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`,L2e=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,j2e=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,z2e=`#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`,F2e=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,U2e=`#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`,B2e=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,H2e=`#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`,G2e=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,V2e=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,W2e=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,$2e=`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`,q2e=`#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`,X2e=`#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`,Y2e=`#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`,K2e=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,Z2e=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,Q2e=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,J2e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#endif`,e5e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#endif`,t5e=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec4 vColor;
#endif`,n5e=`#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`,r5e=`#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`,i5e=`#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`,s5e=`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`,o5e=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,a5e=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,l5e=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,c5e=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,u5e="gl_FragColor = linearToOutputTexel( gl_FragColor );",d5e=`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 );
}`,f5e=`#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`,h5e=`#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`,p5e=`#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`,m5e=`#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`,g5e=`#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`,x5e=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,v5e=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,y5e=`#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`,b5e=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,_5e=`#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
}`,w5e=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,S5e=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,M5e=`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`,T5e=`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`,C5e=`#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`,E5e=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,A5e=`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`,N5e=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,k5e=`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`,R5e=`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`,P5e=`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 );
}`,I5e=`
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`,D5e=`#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`,O5e=`#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`,L5e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,j5e=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,z5e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,F5e=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,U5e=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,B5e=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,H5e=`#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`,G5e=`#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`,V5e=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,W5e=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,$5e=`#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`,q5e=`#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`,X5e=`#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`,Y5e=`#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`,K5e=`#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`,Z5e=`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;`,Q5e=`#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`,J5e=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,eTe=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,tTe=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,nTe=`#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`,rTe=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,iTe=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,sTe=`#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`,oTe=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,aTe=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,lTe=`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
}`,cTe=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,uTe=`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;`,dTe=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,fTe=`#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`,hTe=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,pTe=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,mTe=`#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`,gTe=`#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`,xTe=`#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`,vTe=`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;
}`,yTe=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,bTe=`#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`,_Te=`#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`,wTe=`#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`,STe=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,MTe=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,TTe=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,CTe=`#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; }`,ETe=`#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`,ATe=`#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`,NTe=`#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`,kTe=`#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`,RTe=`#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`,PTe=`#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 ITe=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,DTe=`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>
}`,OTe=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,LTe=`#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>
}`,jTe=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,zTe=`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>
}`,FTe=`#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;
}`,UTe=`#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
}`,BTe=`#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;
}`,HTe=`#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 );
}`,GTe=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,VTe=`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>
}`,WTe=`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>
}`,$Te=`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>
}`,qTe=`#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>
}`,XTe=`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>
}`,YTe=`#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>
}`,KTe=`#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>
}`,ZTe=`#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;
}`,QTe=`#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>
}`,JTe=`#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
}`,eCe=`#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
}`,tCe=`#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>
}`,nCe=`#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>
}`,rCe=`#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
}`,iCe=`#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>
}`,sCe=`#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>
}`,oCe=`#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>
}`,aCe=`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>
}`,lCe=`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>
}`,cCe=`#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>
}`,uCe=`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>
}`,dCe=`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>
}`,fCe=`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>
}`,Or={alphahash_fragment:D2e,alphahash_pars_fragment:O2e,alphamap_fragment:L2e,alphamap_pars_fragment:j2e,alphatest_fragment:z2e,alphatest_pars_fragment:F2e,aomap_fragment:U2e,aomap_pars_fragment:B2e,batching_pars_vertex:H2e,batching_vertex:G2e,begin_vertex:V2e,beginnormal_vertex:W2e,bsdfs:$2e,iridescence_fragment:q2e,bumpmap_pars_fragment:X2e,clipping_planes_fragment:Y2e,clipping_planes_pars_fragment:K2e,clipping_planes_pars_vertex:Z2e,clipping_planes_vertex:Q2e,color_fragment:J2e,color_pars_fragment:e5e,color_pars_vertex:t5e,color_vertex:n5e,common:r5e,cube_uv_reflection_fragment:i5e,defaultnormal_vertex:s5e,displacementmap_pars_vertex:o5e,displacementmap_vertex:a5e,emissivemap_fragment:l5e,emissivemap_pars_fragment:c5e,colorspace_fragment:u5e,colorspace_pars_fragment:d5e,envmap_fragment:f5e,envmap_common_pars_fragment:h5e,envmap_pars_fragment:p5e,envmap_pars_vertex:m5e,envmap_physical_pars_fragment:C5e,envmap_vertex:g5e,fog_vertex:x5e,fog_pars_vertex:v5e,fog_fragment:y5e,fog_pars_fragment:b5e,gradientmap_pars_fragment:_5e,lightmap_pars_fragment:w5e,lights_lambert_fragment:S5e,lights_lambert_pars_fragment:M5e,lights_pars_begin:T5e,lights_toon_fragment:E5e,lights_toon_pars_fragment:A5e,lights_phong_fragment:N5e,lights_phong_pars_fragment:k5e,lights_physical_fragment:R5e,lights_physical_pars_fragment:P5e,lights_fragment_begin:I5e,lights_fragment_maps:D5e,lights_fragment_end:O5e,logdepthbuf_fragment:L5e,logdepthbuf_pars_fragment:j5e,logdepthbuf_pars_vertex:z5e,logdepthbuf_vertex:F5e,map_fragment:U5e,map_pars_fragment:B5e,map_particle_fragment:H5e,map_particle_pars_fragment:G5e,metalnessmap_fragment:V5e,metalnessmap_pars_fragment:W5e,morphinstance_vertex:$5e,morphcolor_vertex:q5e,morphnormal_vertex:X5e,morphtarget_pars_vertex:Y5e,morphtarget_vertex:K5e,normal_fragment_begin:Z5e,normal_fragment_maps:Q5e,normal_pars_fragment:J5e,normal_pars_vertex:eTe,normal_vertex:tTe,normalmap_pars_fragment:nTe,clearcoat_normal_fragment_begin:rTe,clearcoat_normal_fragment_maps:iTe,clearcoat_pars_fragment:sTe,iridescence_pars_fragment:oTe,opaque_fragment:aTe,packing:lTe,premultiplied_alpha_fragment:cTe,project_vertex:uTe,dithering_fragment:dTe,dithering_pars_fragment:fTe,roughnessmap_fragment:hTe,roughnessmap_pars_fragment:pTe,shadowmap_pars_fragment:mTe,shadowmap_pars_vertex:gTe,shadowmap_vertex:xTe,shadowmask_pars_fragment:vTe,skinbase_vertex:yTe,skinning_pars_vertex:bTe,skinning_vertex:_Te,skinnormal_vertex:wTe,specularmap_fragment:STe,specularmap_pars_fragment:MTe,tonemapping_fragment:TTe,tonemapping_pars_fragment:CTe,transmission_fragment:ETe,transmission_pars_fragment:ATe,uv_pars_fragment:NTe,uv_pars_vertex:kTe,uv_vertex:RTe,worldpos_vertex:PTe,background_vert:ITe,background_frag:DTe,backgroundCube_vert:OTe,backgroundCube_frag:LTe,cube_vert:jTe,cube_frag:zTe,depth_vert:FTe,depth_frag:UTe,distance_vert:BTe,distance_frag:HTe,equirect_vert:GTe,equirect_frag:VTe,linedashed_vert:WTe,linedashed_frag:$Te,meshbasic_vert:qTe,meshbasic_frag:XTe,meshlambert_vert:YTe,meshlambert_frag:KTe,meshmatcap_vert:ZTe,meshmatcap_frag:QTe,meshnormal_vert:JTe,meshnormal_frag:eCe,meshphong_vert:tCe,meshphong_frag:nCe,meshphysical_vert:rCe,meshphysical_frag:iCe,meshtoon_vert:sCe,meshtoon_frag:oCe,points_vert:aCe,points_frag:lCe,shadow_vert:cCe,shadow_frag:uCe,sprite_vert:dCe,sprite_frag:fCe},An={common:{diffuse:{value:new Rn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Er},alphaMap:{value:null},alphaMapTransform:{value:new Er},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Er}},envmap:{envMap:{value:null},envMapRotation:{value:new Er},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 Er}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Er}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Er},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Er},normalScale:{value:new qt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Er},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Er}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Er}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Er}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Rn(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 Rn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Er},alphaTest:{value:0},uvTransform:{value:new Er}},sprite:{diffuse:{value:new Rn(16777215)},opacity:{value:1},center:{value:new qt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Er},alphaMap:{value:null},alphaMapTransform:{value:new Er},alphaTest:{value:0}}},Jd={basic:{uniforms:Hl([An.common,An.specularmap,An.envmap,An.aomap,An.lightmap,An.fog]),vertexShader:Or.meshbasic_vert,fragmentShader:Or.meshbasic_frag},lambert:{uniforms:Hl([An.common,An.specularmap,An.envmap,An.aomap,An.lightmap,An.emissivemap,An.bumpmap,An.normalmap,An.displacementmap,An.fog,An.lights,{emissive:{value:new Rn(0)},envMapIntensity:{value:1}}]),vertexShader:Or.meshlambert_vert,fragmentShader:Or.meshlambert_frag},phong:{uniforms:Hl([An.common,An.specularmap,An.envmap,An.aomap,An.lightmap,An.emissivemap,An.bumpmap,An.normalmap,An.displacementmap,An.fog,An.lights,{emissive:{value:new Rn(0)},specular:{value:new Rn(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Or.meshphong_vert,fragmentShader:Or.meshphong_frag},standard:{uniforms:Hl([An.common,An.envmap,An.aomap,An.lightmap,An.emissivemap,An.bumpmap,An.normalmap,An.displacementmap,An.roughnessmap,An.metalnessmap,An.fog,An.lights,{emissive:{value:new Rn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Or.meshphysical_vert,fragmentShader:Or.meshphysical_frag},toon:{uniforms:Hl([An.common,An.aomap,An.lightmap,An.emissivemap,An.bumpmap,An.normalmap,An.displacementmap,An.gradientmap,An.fog,An.lights,{emissive:{value:new Rn(0)}}]),vertexShader:Or.meshtoon_vert,fragmentShader:Or.meshtoon_frag},matcap:{uniforms:Hl([An.common,An.bumpmap,An.normalmap,An.displacementmap,An.fog,{matcap:{value:null}}]),vertexShader:Or.meshmatcap_vert,fragmentShader:Or.meshmatcap_frag},points:{uniforms:Hl([An.points,An.fog]),vertexShader:Or.points_vert,fragmentShader:Or.points_frag},dashed:{uniforms:Hl([An.common,An.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Or.linedashed_vert,fragmentShader:Or.linedashed_frag},depth:{uniforms:Hl([An.common,An.displacementmap]),vertexShader:Or.depth_vert,fragmentShader:Or.depth_frag},normal:{uniforms:Hl([An.common,An.bumpmap,An.normalmap,An.displacementmap,{opacity:{value:1}}]),vertexShader:Or.meshnormal_vert,fragmentShader:Or.meshnormal_frag},sprite:{uniforms:Hl([An.sprite,An.fog]),vertexShader:Or.sprite_vert,fragmentShader:Or.sprite_frag},background:{uniforms:{uvTransform:{value:new Er},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Or.background_vert,fragmentShader:Or.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Er}},vertexShader:Or.backgroundCube_vert,fragmentShader:Or.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Or.cube_vert,fragmentShader:Or.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Or.equirect_vert,fragmentShader:Or.equirect_frag},distance:{uniforms:Hl([An.common,An.displacementmap,{referencePosition:{value:new Ge},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Or.distance_vert,fragmentShader:Or.distance_frag},shadow:{uniforms:Hl([An.lights,An.fog,{color:{value:new Rn(0)},opacity:{value:1}}]),vertexShader:Or.shadow_vert,fragmentShader:Or.shadow_frag}};Jd.physical={uniforms:Hl([Jd.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Er},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Er},clearcoatNormalScale:{value:new qt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Er},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Er},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Er},sheen:{value:0},sheenColor:{value:new Rn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Er},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Er},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Er},transmissionSamplerSize:{value:new qt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Er},attenuationDistance:{value:0},attenuationColor:{value:new Rn(0)},specularColor:{value:new Rn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Er},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Er},anisotropyVector:{value:new qt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Er}}]),vertexShader:Or.meshphysical_vert,fragmentShader:Or.meshphysical_frag};const YM={r:0,b:0,g:0},Qg=new Su,hCe=new pr;function pCe(t,e,n,r,i,s){const o=new Rn(0);let a=i===!0?0:1,l,c,f=null,h=0,m=null;function x(T){let A=T.isScene===!0?T.background:null;if(A&&A.isTexture){const N=T.backgroundBlurriness>0;A=e.get(A,N)}return A}function b(T){let A=!1;const N=x(T);N===null?S(o,a):N&&N.isColor&&(S(N,1),A=!0);const D=t.xr.getEnvironmentBlendMode();D==="additive"?n.buffers.color.setClear(0,0,0,1,s):D==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,s),(t.autoClear||A)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function _(T,A){const N=x(A);N&&(N.isCubeTexture||N.mapping===lb)?(c===void 0&&(c=new Xs(new Qx(1,1,1),new Mu({name:"BackgroundCubeMaterial",uniforms:By(Jd.backgroundCube.uniforms),vertexShader:Jd.backgroundCube.vertexShader,fragmentShader:Jd.backgroundCube.fragmentShader,side:Jl,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(D,k,O){this.matrixWorld.copyPosition(O.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Qg.copy(A.backgroundRotation),Qg.x*=-1,Qg.y*=-1,Qg.z*=-1,N.isCubeTexture&&N.isRenderTargetTexture===!1&&(Qg.y*=-1,Qg.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(hCe.makeRotationFromEuler(Qg)),c.material.toneMapped=li.getTransfer(N.colorSpace)!==Hi,(f!==N||h!==N.version||m!==t.toneMapping)&&(c.material.needsUpdate=!0,f=N,h=N.version,m=t.toneMapping),c.layers.enableAll(),T.unshift(c,c.geometry,c.material,0,0,null)):N&&N.isTexture&&(l===void 0&&(l=new Xs(new Wp(2,2),new Mu({name:"BackgroundMaterial",uniforms:By(Jd.background.uniforms),vertexShader:Jd.background.vertexShader,fragmentShader:Jd.background.fragmentShader,side:Lp,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=li.getTransfer(N.colorSpace)!==Hi,N.matrixAutoUpdate===!0&&N.updateMatrix(),l.material.uniforms.uvTransform.value.copy(N.matrix),(f!==N||h!==N.version||m!==t.toneMapping)&&(l.material.needsUpdate=!0,f=N,h=N.version,m=t.toneMapping),l.layers.enableAll(),T.unshift(l,l.geometry,l.material,0,0,null))}function S(T,A){T.getRGB(YM,iZ(t)),n.buffers.color.setClear(YM.r,YM.g,YM.b,A,s)}function M(){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(T,A=1){o.set(T),a=A,S(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(T){a=T,S(o,a)},render:b,addToRenderList:_,dispose:M}}function mCe(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(H,$,G,Z,V){let W=!1;const J=h(H,Z,G,$);s!==J&&(s=J,c(s.object)),W=x(H,Z,G,V),W&&b(H,Z,G,V),V!==null&&e.update(V,t.ELEMENT_ARRAY_BUFFER),(W||o)&&(o=!1,N(H,$,G,Z),V!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(V).buffer))}function l(){return t.createVertexArray()}function c(H){return t.bindVertexArray(H)}function f(H){return t.deleteVertexArray(H)}function h(H,$,G,Z){const V=Z.wireframe===!0;let W=r[$.id];W===void 0&&(W={},r[$.id]=W);const J=H.isInstancedMesh===!0?H.id:0;let ne=W[J];ne===void 0&&(ne={},W[J]=ne);let ie=ne[G.id];ie===void 0&&(ie={},ne[G.id]=ie);let z=ie[V];return z===void 0&&(z=m(l()),ie[V]=z),z}function m(H){const $=[],G=[],Z=[];for(let V=0;V<n;V++)$[V]=0,G[V]=0,Z[V]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:$,enabledAttributes:G,attributeDivisors:Z,object:H,attributes:{},index:null}}function x(H,$,G,Z){const V=s.attributes,W=$.attributes;let J=0;const ne=G.getAttributes();for(const ie in ne)if(ne[ie].location>=0){const j=V[ie];let X=W[ie];if(X===void 0&&(ie==="instanceMatrix"&&H.instanceMatrix&&(X=H.instanceMatrix),ie==="instanceColor"&&H.instanceColor&&(X=H.instanceColor)),j===void 0||j.attribute!==X||X&&j.data!==X.data)return!0;J++}return s.attributesNum!==J||s.index!==Z}function b(H,$,G,Z){const V={},W=$.attributes;let J=0;const ne=G.getAttributes();for(const ie in ne)if(ne[ie].location>=0){let j=W[ie];j===void 0&&(ie==="instanceMatrix"&&H.instanceMatrix&&(j=H.instanceMatrix),ie==="instanceColor"&&H.instanceColor&&(j=H.instanceColor));const X={};X.attribute=j,j&&j.data&&(X.data=j.data),V[ie]=X,J++}s.attributes=V,s.attributesNum=J,s.index=Z}function _(){const H=s.newAttributes;for(let $=0,G=H.length;$<G;$++)H[$]=0}function S(H){M(H,0)}function M(H,$){const G=s.newAttributes,Z=s.enabledAttributes,V=s.attributeDivisors;G[H]=1,Z[H]===0&&(t.enableVertexAttribArray(H),Z[H]=1),V[H]!==$&&(t.vertexAttribDivisor(H,$),V[H]=$)}function T(){const H=s.newAttributes,$=s.enabledAttributes;for(let G=0,Z=$.length;G<Z;G++)$[G]!==H[G]&&(t.disableVertexAttribArray(G),$[G]=0)}function A(H,$,G,Z,V,W,J){J===!0?t.vertexAttribIPointer(H,$,G,V,W):t.vertexAttribPointer(H,$,G,Z,V,W)}function N(H,$,G,Z){_();const V=Z.attributes,W=G.getAttributes(),J=$.defaultAttributeValues;for(const ne in W){const ie=W[ne];if(ie.location>=0){let z=V[ne];if(z===void 0&&(ne==="instanceMatrix"&&H.instanceMatrix&&(z=H.instanceMatrix),ne==="instanceColor"&&H.instanceColor&&(z=H.instanceColor)),z!==void 0){const j=z.normalized,X=z.itemSize,F=e.get(z);if(F===void 0)continue;const ce=F.buffer,oe=F.type,Q=F.bytesPerElement,se=oe===t.INT||oe===t.UNSIGNED_INT||z.gpuType===$C;if(z.isInterleavedBufferAttribute){const re=z.data,K=re.stride,fe=z.offset;if(re.isInstancedInterleavedBuffer){for(let he=0;he<ie.locationSize;he++)M(ie.location+he,re.meshPerAttribute);H.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let he=0;he<ie.locationSize;he++)S(ie.location+he);t.bindBuffer(t.ARRAY_BUFFER,ce);for(let he=0;he<ie.locationSize;he++)A(ie.location+he,X/ie.locationSize,oe,j,K*Q,(fe+X/ie.locationSize*he)*Q,se)}else{if(z.isInstancedBufferAttribute){for(let re=0;re<ie.locationSize;re++)M(ie.location+re,z.meshPerAttribute);H.isInstancedMesh!==!0&&Z._maxInstanceCount===void 0&&(Z._maxInstanceCount=z.meshPerAttribute*z.count)}else for(let re=0;re<ie.locationSize;re++)S(ie.location+re);t.bindBuffer(t.ARRAY_BUFFER,ce);for(let re=0;re<ie.locationSize;re++)A(ie.location+re,X/ie.locationSize,oe,j,X*Q,X/ie.locationSize*re*Q,se)}}else if(J!==void 0){const j=J[ne];if(j!==void 0)switch(j.length){case 2:t.vertexAttrib2fv(ie.location,j);break;case 3:t.vertexAttrib3fv(ie.location,j);break;case 4:t.vertexAttrib4fv(ie.location,j);break;default:t.vertexAttrib1fv(ie.location,j)}}}}T()}function D(){L();for(const H in r){const $=r[H];for(const G in $){const Z=$[G];for(const V in Z){const W=Z[V];for(const J in W)f(W[J].object),delete W[J];delete Z[V]}}delete r[H]}}function k(H){if(r[H.id]===void 0)return;const $=r[H.id];for(const G in $){const Z=$[G];for(const V in Z){const W=Z[V];for(const J in W)f(W[J].object),delete W[J];delete Z[V]}}delete r[H.id]}function O(H){for(const $ in r){const G=r[$];for(const Z in G){const V=G[Z];if(V[H.id]===void 0)continue;const W=V[H.id];for(const J in W)f(W[J].object),delete W[J];delete V[H.id]}}}function R(H){for(const $ in r){const G=r[$],Z=H.isInstancedMesh===!0?H.id:0,V=G[Z];if(V!==void 0){for(const W in V){const J=V[W];for(const ne in J)f(J[ne].object),delete J[ne];delete V[W]}delete G[Z],Object.keys(G).length===0&&delete r[$]}}}function L(){B(),o=!0,s!==i&&(s=i,c(s.object))}function B(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:a,reset:L,resetDefaultState:B,dispose:D,releaseStatesOfGeometry:k,releaseStatesOfObject:R,releaseStatesOfProgram:O,initAttributes:_,enableAttribute:S,disableUnusedAttributes:T}}function gCe(t,e,n){let r;function i(c){r=c}function s(c,f){t.drawArrays(r,c,f),n.update(f,r,1)}function o(c,f,h){h!==0&&(t.drawArraysInstanced(r,c,f,h),n.update(f,r,h))}function a(c,f,h){if(h===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,f,0,h);let x=0;for(let b=0;b<h;b++)x+=f[b];n.update(x,r,1)}function l(c,f,h,m){if(h===0)return;const x=e.get("WEBGL_multi_draw");if(x===null)for(let b=0;b<c.length;b++)o(c[b],f[b],m[b]);else{x.multiDrawArraysInstancedWEBGL(r,c,0,f,0,m,0,h);let b=0;for(let _=0;_<h;_++)b+=f[_]*m[_];n.update(b,r,1)}}this.setMode=i,this.render=s,this.renderInstances=o,this.renderMultiDraw=a,this.renderMultiDrawInstances=l}function xCe(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const O=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(O.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function o(O){return!(O!==bl&&r.convert(O)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function a(O){const R=O===xh&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(O!==ql&&r.convert(O)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&O!==Ql&&!R)}function l(O){if(O==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";O="mediump"}return O==="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 f=l(c);f!==c&&(En("WebGLRenderer:",c,"not supported, using",f,"instead."),c=f);const h=n.logarithmicDepthBuffer===!0,m=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),x=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_TEXTURE_SIZE),S=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),M=t.getParameter(t.MAX_VERTEX_ATTRIBS),T=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),A=t.getParameter(t.MAX_VARYING_VECTORS),N=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),D=t.getParameter(t.MAX_SAMPLES),k=t.getParameter(t.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:h,reversedDepthBuffer:m,maxTextures:x,maxVertexTextures:b,maxTextureSize:_,maxCubemapSize:S,maxAttributes:M,maxVertexUniforms:T,maxVaryings:A,maxFragmentUniforms:N,maxSamples:D,samples:k}}function vCe(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new fp,a=new Er,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,m){const x=h.length!==0||m||r!==0||i;return i=m,r=h.length,x},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,m){n=f(h,m,0)},this.setState=function(h,m,x){const b=h.clippingPlanes,_=h.clipIntersection,S=h.clipShadows,M=t.get(h);if(!i||b===null||b.length===0||s&&!S)s?f(null):c();else{const T=s?0:r,A=T*4;let N=M.clippingState||null;l.value=N,N=f(b,m,A,x);for(let D=0;D!==A;++D)N[D]=n[D];M.clippingState=N,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=T}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function f(h,m,x,b){const _=h!==null?h.length:0;let S=null;if(_!==0){if(S=l.value,b!==!0||S===null){const M=x+_*4,T=m.matrixWorldInverse;a.getNormalMatrix(T),(S===null||S.length<M)&&(S=new Float32Array(M));for(let A=0,N=x;A!==_;++A,N+=4)o.copy(h[A]).applyMatrix4(T,a),o.normal.toArray(S,N),S[N+3]=o.constant}l.value=S,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,S}}const f0=4,Xz=[.125,.215,.35,.446,.526,.582],ax=20,yCe=256,F_=new sf,Yz=new Rn;let _N=null,wN=0,SN=0,MN=!1;const bCe=new Ge;class $R{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=bCe}=s;_N=this._renderer.getRenderTarget(),wN=this._renderer.getActiveCubeFace(),SN=this._renderer.getActiveMipmapLevel(),MN=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=Qz(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Zz(),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(_N,wN,SN),this._renderer.xr.enabled=MN,e.scissorTest=!1,b1(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===gh||e.mapping===k0?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),_N=this._renderer.getRenderTarget(),wN=this._renderer.getActiveCubeFace(),SN=this._renderer.getActiveMipmapLevel(),MN=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:as,minFilter:as,generateMipmaps:!1,type:xh,format:bl,colorSpace:R0,depthBuffer:!1},i=Kz(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Kz(e,n,r);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=_Ce(s)),this._blurMaterial=SCe(s,e,n),this._ggxMaterial=wCe(s,e,n)}return i}_compileMaterial(e){const n=new Xs(new Nr,e);this._renderer.compile(n,F_)}_sceneToCubeUV(e,n,r,i,s){const l=new lo(90,1,n,r),c=[1,-1,1,1,1,1],f=[1,1,1,-1,-1,-1],h=this._renderer,m=h.autoClear,x=h.toneMapping;h.getClearColor(Yz),h.toneMapping=vu,h.autoClear=!1,h.state.buffers.depth.getReversed()&&(h.setRenderTarget(i),h.clearDepth(),h.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Xs(new Qx,new Vp({name:"PMREM.Background",side:Jl,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,S=_.material;let M=!1;const T=e.background;T?T.isColor&&(S.color.copy(T),e.background=null,M=!0):(S.color.copy(Yz),M=!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+f[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+f[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+f[A]));const D=this._cubeSize;b1(i,N*D,A>2?D:0,D,D),h.setRenderTarget(i),M&&h.render(_,l),h.render(e,l)}h.toneMapping=x,h.autoClear=m,e.background=T}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===gh||e.mapping===k0;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Qz()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Zz());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;b1(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,F_)}_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),f=n/(this._lodMeshes.length-1),h=Math.sqrt(c*c-f*f),m=0+c*1.25,x=h*m,{_lodMax:b}=this,_=this._sizeLods[r],S=3*_*(r>b-f0?r-b+f0:0),M=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=x,l.mipInt.value=b-n,b1(s,S,M,3*_,2*_),i.setRenderTarget(s),i.render(a,F_),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=b-r,b1(e,S,M,3*_,2*_),i.setRenderTarget(e),i.render(a,F_)}_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"&&qn("blur direction must be either latitudinal or longitudinal!");const f=3,h=this._lodMeshes[i];h.material=c;const m=c.uniforms,x=this._sizeLods[r]-1,b=isFinite(s)?Math.PI/(2*x):2*Math.PI/(2*ax-1),_=s/b,S=isFinite(s)?1+Math.floor(f*_):ax;S>ax&&En(`sigmaRadians, ${s}, is too large and will clip, as it requested ${S} samples when the maximum is set to ${ax}`);const M=[];let T=0;for(let O=0;O<ax;++O){const R=O/_,L=Math.exp(-R*R/2);M.push(L),O===0?T+=L:O<S&&(T+=2*L)}for(let O=0;O<M.length;O++)M[O]=M[O]/T;m.envMap.value=e.texture,m.samples.value=S,m.weights.value=M,m.latitudinal.value=o==="latitudinal",a&&(m.poleAxis.value=a);const{_lodMax:A}=this;m.dTheta.value=b,m.mipInt.value=A-r;const N=this._sizeLods[i],D=3*N*(i>A-f0?i-A+f0:0),k=4*(this._cubeSize-N);b1(n,D,k,3*N,2*N),l.setRenderTarget(n),l.render(h,F_)}}function _Ce(t){const e=[],n=[],r=[];let i=t;const s=t-f0+1+Xz.length;for(let o=0;o<s;o++){const a=Math.pow(2,i);e.push(a);let l=1/a;o>t-f0?l=Xz[o-t+f0-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),f=-c,h=1+c,m=[f,f,h,f,h,h,f,f,h,h,f,h],x=6,b=6,_=3,S=2,M=1,T=new Float32Array(_*b*x),A=new Float32Array(S*b*x),N=new Float32Array(M*b*x);for(let k=0;k<x;k++){const O=k%3*2/3-1,R=k>2?0:-1,L=[O,R,0,O+2/3,R,0,O+2/3,R+1,0,O,R,0,O+2/3,R+1,0,O,R+1,0];T.set(L,_*b*k),A.set(m,S*b*k);const B=[k,k,k,k,k,k];N.set(B,M*b*k)}const D=new Nr;D.setAttribute("position",new Xi(T,_)),D.setAttribute("uv",new Xi(A,S)),D.setAttribute("faceIndex",new Xi(N,M)),r.push(new Xs(D,null)),i>f0&&i--}return{lodMeshes:r,sizeLods:e,sigmas:n}}function Kz(t,e,n){const r=new bu(t,e,n);return r.texture.mapping=lb,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function b1(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function wCe(t,e,n){return new Mu({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:yCe,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:EE(),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:fh,depthTest:!1,depthWrite:!1})}function SCe(t,e,n){const r=new Float32Array(ax),i=new Ge(0,1,0);return new Mu({name:"SphericalGaussianBlur",defines:{n:ax,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:EE(),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:fh,depthTest:!1,depthWrite:!1})}function Zz(){return new Mu({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:EE(),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:fh,depthTest:!1,depthWrite:!1})}function Qz(){return new Mu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:EE(),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:fh,depthTest:!1,depthWrite:!1})}function EE(){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 bI extends bu{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 t3(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 Qx(5,5,5),s=new Mu({name:"CubemapFromEquirect",uniforms:By(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Jl,blending:fh});s.uniforms.tEquirect.value=n;const o=new Xs(i,s),a=n.minFilter;return n.minFilter===ah&&(n.minFilter=as),new CZ(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 MCe(t){let e=new WeakMap,n=new WeakMap,r=null;function i(m,x=!1){return m==null?null:x?o(m):s(m)}function s(m){if(m&&m.isTexture){const x=m.mapping;if(x===gw||x===xw)if(e.has(m)){const b=e.get(m).texture;return a(b,m.mapping)}else{const b=m.image;if(b&&b.height>0){const _=new bI(b.height);return _.fromEquirectangularTexture(t,m),e.set(m,_),m.addEventListener("dispose",c),a(_.texture,m.mapping)}else return null}}return m}function o(m){if(m&&m.isTexture){const x=m.mapping,b=x===gw||x===xw,_=x===gh||x===k0;if(b||_){let S=n.get(m);const M=S!==void 0?S.texture.pmremVersion:0;if(m.isRenderTargetTexture&&m.pmremVersion!==M)return r===null&&(r=new $R(t)),S=b?r.fromEquirectangular(m,S):r.fromCubemap(m,S),S.texture.pmremVersion=m.pmremVersion,n.set(m,S),S.texture;if(S!==void 0)return S.texture;{const T=m.image;return b&&T&&T.height>0||_&&T&&l(T)?(r===null&&(r=new $R(t)),S=b?r.fromEquirectangular(m):r.fromCubemap(m),S.texture.pmremVersion=m.pmremVersion,n.set(m,S),m.addEventListener("dispose",f),S.texture):null}}}return m}function a(m,x){return x===gw?m.mapping=gh:x===xw&&(m.mapping=k0),m}function l(m){let x=0;const b=6;for(let _=0;_<b;_++)m[_]!==void 0&&x++;return x===b}function c(m){const x=m.target;x.removeEventListener("dispose",c);const b=e.get(x);b!==void 0&&(e.delete(x),b.dispose())}function f(m){const x=m.target;x.removeEventListener("dispose",f);const b=n.get(x);b!==void 0&&(n.delete(x),b.dispose())}function h(){e=new WeakMap,n=new WeakMap,r!==null&&(r.dispose(),r=null)}return{get:i,dispose:h}}function TCe(t){const e={};function n(r){if(e[r]!==void 0)return e[r];const i=t.getExtension(r);return e[r]=i,i}return{has:function(r){return n(r)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(r){const i=n(r);return i===null&&tS("WebGLRenderer: "+r+" extension not supported."),i}}}function CCe(t,e,n,r){const i={},s=new WeakMap;function o(h){const m=h.target;m.index!==null&&e.remove(m.index);for(const b in m.attributes)e.remove(m.attributes[b]);m.removeEventListener("dispose",o),delete i[m.id];const x=s.get(m);x&&(e.remove(x),s.delete(m)),r.releaseStatesOfGeometry(m),m.isInstancedBufferGeometry===!0&&delete m._maxInstanceCount,n.memory.geometries--}function a(h,m){return i[m.id]===!0||(m.addEventListener("dispose",o),i[m.id]=!0,n.memory.geometries++),m}function l(h){const m=h.attributes;for(const x in m)e.update(m[x],t.ARRAY_BUFFER)}function c(h){const m=[],x=h.index,b=h.attributes.position;let _=0;if(b===void 0)return;if(x!==null){const T=x.array;_=x.version;for(let A=0,N=T.length;A<N;A+=3){const D=T[A+0],k=T[A+1],O=T[A+2];m.push(D,k,k,O,O,D)}}else{const T=b.array;_=b.version;for(let A=0,N=T.length/3-1;A<N;A+=3){const D=A+0,k=A+1,O=A+2;m.push(D,k,k,O,O,D)}}const S=new(b.count>=65535?XP:qP)(m,1);S.version=_;const M=s.get(h);M&&e.remove(M),s.set(h,S)}function f(h){const m=s.get(h);if(m){const x=h.index;x!==null&&m.version<x.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:f}}function ECe(t,e,n){let r;function i(m){r=m}let s,o;function a(m){s=m.type,o=m.bytesPerElement}function l(m,x){t.drawElements(r,x,s,m*o),n.update(x,r,1)}function c(m,x,b){b!==0&&(t.drawElementsInstanced(r,x,s,m*o,b),n.update(x,r,b))}function f(m,x,b){if(b===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,x,0,s,m,0,b);let S=0;for(let M=0;M<b;M++)S+=x[M];n.update(S,r,1)}function h(m,x,b,_){if(b===0)return;const S=e.get("WEBGL_multi_draw");if(S===null)for(let M=0;M<m.length;M++)c(m[M]/o,x[M],_[M]);else{S.multiDrawElementsInstancedWEBGL(r,x,0,s,m,0,_,0,b);let M=0;for(let T=0;T<b;T++)M+=x[T]*_[T];n.update(M,r,1)}}this.setMode=i,this.setIndex=a,this.render=l,this.renderInstances=c,this.renderMultiDraw=f,this.renderMultiDrawInstances=h}function ACe(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:qn("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 NCe(t,e,n){const r=new WeakMap,i=new pi;function s(o,a,l){const c=o.morphTargetInfluences,f=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=f!==void 0?f.length:0;let m=r.get(a);if(m===void 0||m.count!==h){let B=function(){R.dispose(),r.delete(a),a.removeEventListener("dispose",B)};var x=B;m!==void 0&&m.texture.dispose();const b=a.morphAttributes.position!==void 0,_=a.morphAttributes.normal!==void 0,S=a.morphAttributes.color!==void 0,M=a.morphAttributes.position||[],T=a.morphAttributes.normal||[],A=a.morphAttributes.color||[];let N=0;b===!0&&(N=1),_===!0&&(N=2),S===!0&&(N=3);let D=a.attributes.position.count*N,k=1;D>e.maxTextureSize&&(k=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const O=new Float32Array(D*k*4*h),R=new tE(O,D,k,h);R.type=Ql,R.needsUpdate=!0;const L=N*4;for(let H=0;H<h;H++){const $=M[H],G=T[H],Z=A[H],V=D*k*4*H;for(let W=0;W<$.count;W++){const J=W*L;b===!0&&(i.fromBufferAttribute($,W),O[V+J+0]=i.x,O[V+J+1]=i.y,O[V+J+2]=i.z,O[V+J+3]=0),_===!0&&(i.fromBufferAttribute(G,W),O[V+J+4]=i.x,O[V+J+5]=i.y,O[V+J+6]=i.z,O[V+J+7]=0),S===!0&&(i.fromBufferAttribute(Z,W),O[V+J+8]=i.x,O[V+J+9]=i.y,O[V+J+10]=i.z,O[V+J+11]=Z.itemSize===4?i.w:1)}}m={count:h,texture:R,size:new qt(D,k)},r.set(a,m),a.addEventListener("dispose",B)}if(o.isInstancedMesh===!0&&o.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",o.morphTexture,n);else{let b=0;for(let S=0;S<c.length;S++)b+=c[S];const _=a.morphTargetsRelative?1:1-b;l.getUniforms().setValue(t,"morphTargetBaseInfluence",_),l.getUniforms().setValue(t,"morphTargetInfluences",c)}l.getUniforms().setValue(t,"morphTargetsTexture",m.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",m.size)}return{update:s}}function kCe(t,e,n,r,i){let s=new WeakMap;function o(c){const f=i.render.frame,h=c.geometry,m=e.get(c,h);if(s.get(m)!==f&&(e.update(m),s.set(m,f)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==f&&(n.update(c.instanceMatrix,t.ARRAY_BUFFER),c.instanceColor!==null&&n.update(c.instanceColor,t.ARRAY_BUFFER),s.set(c,f))),c.isSkinnedMesh){const x=c.skeleton;s.get(x)!==f&&(x.update(),s.set(x,f))}return m}function a(){s=new WeakMap}function l(c){const f=c.target;f.removeEventListener("dispose",l),r.releaseStatesOfObject(f),n.remove(f.instanceMatrix),f.instanceColor!==null&&n.remove(f.instanceColor)}return{update:o,dispose:a}}const RCe={[kP]:"LINEAR_TONE_MAPPING",[RP]:"REINHARD_TONE_MAPPING",[PP]:"CINEON_TONE_MAPPING",[VC]:"ACES_FILMIC_TONE_MAPPING",[DP]:"AGX_TONE_MAPPING",[OP]:"NEUTRAL_TONE_MAPPING",[IP]:"CUSTOM_TONE_MAPPING"};function PCe(t,e,n,r,i){const s=new bu(e,n,{type:t,depthBuffer:r,stencilBuffer:i}),o=new bu(e,n,{type:xh,depthBuffer:!1,stencilBuffer:!1}),a=new Nr;a.setAttribute("position",new jn([-1,3,0,-1,-1,0,3,-1,0],3)),a.setAttribute("uv",new jn([0,2,0,0,2,0],2));const l=new aI({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 Xs(a,l),f=new sf(-1,1,1,-1,0,1);let h=null,m=null,x=!1,b,_=null,S=[],M=!1;this.setSize=function(T,A){s.setSize(T,A),o.setSize(T,A);for(let N=0;N<S.length;N++){const D=S[N];D.setSize&&D.setSize(T,A)}},this.setEffects=function(T){S=T,M=S.length>0&&S[0].isRenderPass===!0;const A=s.width,N=s.height;for(let D=0;D<S.length;D++){const k=S[D];k.setSize&&k.setSize(A,N)}},this.begin=function(T,A){if(x||T.toneMapping===vu&&S.length===0)return!1;if(_=A,A!==null){const N=A.width,D=A.height;(s.width!==N||s.height!==D)&&this.setSize(N,D)}return M===!1&&T.setRenderTarget(s),b=T.toneMapping,T.toneMapping=vu,!0},this.hasRenderPass=function(){return M},this.end=function(T,A){T.toneMapping=b,x=!0;let N=s,D=o;for(let k=0;k<S.length;k++){const O=S[k];if(O.enabled!==!1&&(O.render(T,D,N,A),O.needsSwap!==!1)){const R=N;N=D,D=R}}if(h!==T.outputColorSpace||m!==T.toneMapping){h=T.outputColorSpace,m=T.toneMapping,l.defines={},li.getTransfer(h)===Hi&&(l.defines.SRGB_TRANSFER="");const k=RCe[m];k&&(l.defines[k]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=N.texture,T.setRenderTarget(_),T.render(c,f),_=null,x=!1},this.isCompositing=function(){return x},this.dispose=function(){s.dispose(),o.dispose(),a.dispose(),l.dispose()}}const jZ=new fo,qR=new Fy(1,1),zZ=new tE,FZ=new nE,UZ=new t3,Jz=[],eF=[],tF=new Float32Array(16),nF=new Float32Array(9),rF=new Float32Array(4);function db(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=Jz[i];if(s===void 0&&(s=new Float32Array(i),Jz[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 xa(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 va(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function AE(t,e){let n=eF[e];n===void 0&&(n=new Int32Array(e),eF[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function ICe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function DCe(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(xa(n,e))return;t.uniform2fv(this.addr,e),va(n,e)}}function OCe(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(xa(n,e))return;t.uniform3fv(this.addr,e),va(n,e)}}function LCe(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(xa(n,e))return;t.uniform4fv(this.addr,e),va(n,e)}}function jCe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(xa(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),va(n,e)}else{if(xa(n,r))return;rF.set(r),t.uniformMatrix2fv(this.addr,!1,rF),va(n,r)}}function zCe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(xa(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),va(n,e)}else{if(xa(n,r))return;nF.set(r),t.uniformMatrix3fv(this.addr,!1,nF),va(n,r)}}function FCe(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(xa(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),va(n,e)}else{if(xa(n,r))return;tF.set(r),t.uniformMatrix4fv(this.addr,!1,tF),va(n,r)}}function UCe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function BCe(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(xa(n,e))return;t.uniform2iv(this.addr,e),va(n,e)}}function HCe(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(xa(n,e))return;t.uniform3iv(this.addr,e),va(n,e)}}function GCe(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(xa(n,e))return;t.uniform4iv(this.addr,e),va(n,e)}}function VCe(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function WCe(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(xa(n,e))return;t.uniform2uiv(this.addr,e),va(n,e)}}function $Ce(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(xa(n,e))return;t.uniform3uiv(this.addr,e),va(n,e)}}function qCe(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(xa(n,e))return;t.uniform4uiv(this.addr,e),va(n,e)}}function XCe(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?(qR.compareFunction=n.isReversedDepthBuffer()?eE:JC,s=qR):s=jZ,n.setTexture2D(e||s,i)}function YCe(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||FZ,i)}function KCe(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||UZ,i)}function ZCe(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||zZ,i)}function QCe(t){switch(t){case 5126:return ICe;case 35664:return DCe;case 35665:return OCe;case 35666:return LCe;case 35674:return jCe;case 35675:return zCe;case 35676:return FCe;case 5124:case 35670:return UCe;case 35667:case 35671:return BCe;case 35668:case 35672:return HCe;case 35669:case 35673:return GCe;case 5125:return VCe;case 36294:return WCe;case 36295:return $Ce;case 36296:return qCe;case 35678:case 36198:case 36298:case 36306:case 35682:return XCe;case 35679:case 36299:case 36307:return YCe;case 35680:case 36300:case 36308:case 36293:return KCe;case 36289:case 36303:case 36311:case 36292:return ZCe}}function JCe(t,e){t.uniform1fv(this.addr,e)}function eEe(t,e){const n=db(e,this.size,2);t.uniform2fv(this.addr,n)}function tEe(t,e){const n=db(e,this.size,3);t.uniform3fv(this.addr,n)}function nEe(t,e){const n=db(e,this.size,4);t.uniform4fv(this.addr,n)}function rEe(t,e){const n=db(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function iEe(t,e){const n=db(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function sEe(t,e){const n=db(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function oEe(t,e){t.uniform1iv(this.addr,e)}function aEe(t,e){t.uniform2iv(this.addr,e)}function lEe(t,e){t.uniform3iv(this.addr,e)}function cEe(t,e){t.uniform4iv(this.addr,e)}function uEe(t,e){t.uniform1uiv(this.addr,e)}function dEe(t,e){t.uniform2uiv(this.addr,e)}function fEe(t,e){t.uniform3uiv(this.addr,e)}function hEe(t,e){t.uniform4uiv(this.addr,e)}function pEe(t,e,n){const r=this.cache,i=e.length,s=AE(n,i);xa(r,s)||(t.uniform1iv(this.addr,s),va(r,s));let o;this.type===t.SAMPLER_2D_SHADOW?o=qR:o=jZ;for(let a=0;a!==i;++a)n.setTexture2D(e[a]||o,s[a])}function mEe(t,e,n){const r=this.cache,i=e.length,s=AE(n,i);xa(r,s)||(t.uniform1iv(this.addr,s),va(r,s));for(let o=0;o!==i;++o)n.setTexture3D(e[o]||FZ,s[o])}function gEe(t,e,n){const r=this.cache,i=e.length,s=AE(n,i);xa(r,s)||(t.uniform1iv(this.addr,s),va(r,s));for(let o=0;o!==i;++o)n.setTextureCube(e[o]||UZ,s[o])}function xEe(t,e,n){const r=this.cache,i=e.length,s=AE(n,i);xa(r,s)||(t.uniform1iv(this.addr,s),va(r,s));for(let o=0;o!==i;++o)n.setTexture2DArray(e[o]||zZ,s[o])}function vEe(t){switch(t){case 5126:return JCe;case 35664:return eEe;case 35665:return tEe;case 35666:return nEe;case 35674:return rEe;case 35675:return iEe;case 35676:return sEe;case 5124:case 35670:return oEe;case 35667:case 35671:return aEe;case 35668:case 35672:return lEe;case 35669:case 35673:return cEe;case 5125:return uEe;case 36294:return dEe;case 36295:return fEe;case 36296:return hEe;case 35678:case 36198:case 36298:case 36306:case 35682:return pEe;case 35679:case 36299:case 36307:return mEe;case 35680:case 36300:case 36308:case 36293:return gEe;case 36289:case 36303:case 36311:case 36292:return xEe}}class yEe{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=QCe(n.type)}}class bEe{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=vEe(n.type)}}class _Ee{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 TN=/(\w+)(\])?(\[|\.)?/g;function iF(t,e){t.seq.push(e),t.map[e.id]=e}function wEe(t,e,n){const r=t.name,i=r.length;for(TN.lastIndex=0;;){const s=TN.exec(r),o=TN.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===i){iF(n,c===void 0?new yEe(a,t,e):new bEe(a,t,e));break}else{let h=n.map[a];h===void 0&&(h=new _Ee(a),iF(n,h)),n=h}}}class M2{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);wEe(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 sF(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const SEe=37297;let MEe=0;function TEe(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 oF=new Er;function CEe(t){li._getMatrix(oF,li.workingColorSpace,t);const e=`mat3( ${oF.elements.map(n=>n.toFixed(4))} )`;switch(li.getTransfer(t)){case Zw:return[e,"LinearTransferOETF"];case Hi:return[e,"sRGBTransferOETF"];default:return En("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function aF(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+`

`+TEe(t.getShaderSource(e),a)}else return s}function EEe(t,e){const n=CEe(e);return[`vec4 ${t}( vec4 value ) {`,`	return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
`)}const AEe={[kP]:"Linear",[RP]:"Reinhard",[PP]:"Cineon",[VC]:"ACESFilmic",[DP]:"AgX",[OP]:"Neutral",[IP]:"Custom"};function NEe(t,e){const n=AEe[e];return n===void 0?(En("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+t+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const KM=new Ge;function kEe(){li.getLuminanceCoefficients(KM);const t=KM.x.toFixed(4),e=KM.y.toFixed(4),n=KM.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${t}, ${e}, ${n} );`,"	return dot( weights, rgb );","}"].join(`
`)}function REe(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(tw).join(`
`)}function PEe(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
`)}function IEe(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 tw(t){return t!==""}function lF(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 cF(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const DEe=/^[ \t]*#include +<([\w\d./]+)>/gm;function XR(t){return t.replace(DEe,LEe)}const OEe=new Map;function LEe(t,e){let n=Or[e];if(n===void 0){const r=OEe.get(e);if(r!==void 0)n=Or[r],En('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return XR(n)}const jEe=/#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 uF(t){return t.replace(jEe,zEe)}function zEe(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 dF(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 FEe={[q1]:"SHADOWMAP_TYPE_PCF",[cx]:"SHADOWMAP_TYPE_VSM"};function UEe(t){return FEe[t.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const BEe={[gh]:"ENVMAP_TYPE_CUBE",[k0]:"ENVMAP_TYPE_CUBE",[lb]:"ENVMAP_TYPE_CUBE_UV"};function HEe(t){return t.envMap===!1?"ENVMAP_TYPE_CUBE":BEe[t.envMapMode]||"ENVMAP_TYPE_CUBE"}const GEe={[k0]:"ENVMAP_MODE_REFRACTION"};function VEe(t){return t.envMap===!1?"ENVMAP_MODE_REFLECTION":GEe[t.envMapMode]||"ENVMAP_MODE_REFLECTION"}const WEe={[JS]:"ENVMAP_BLENDING_MULTIPLY",[xK]:"ENVMAP_BLENDING_MIX",[vK]:"ENVMAP_BLENDING_ADD"};function $Ee(t){return t.envMap===!1?"ENVMAP_BLENDING_NONE":WEe[t.combine]||"ENVMAP_BLENDING_NONE"}function qEe(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 XEe(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=UEe(n),c=HEe(n),f=VEe(n),h=$Ee(n),m=qEe(n),x=REe(n),b=PEe(s),_=i.createProgram();let S,M,T=n.glslVersion?"#version "+n.glslVersion+`
`:"";n.isRawShaderMaterial?(S=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(tw).join(`
`),S.length>0&&(S+=`
`),M=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(tw).join(`
`),M.length>0&&(M+=`
`)):(S=[dF(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 "+f:"",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(tw).join(`
`),M=[dF(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 "+f:"",n.envMap?"#define "+h:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.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!==vu?"#define TONE_MAPPING":"",n.toneMapping!==vu?Or.tonemapping_pars_fragment:"",n.toneMapping!==vu?NEe("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Or.colorspace_pars_fragment,EEe("linearToOutputTexel",n.outputColorSpace),kEe(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
`].filter(tw).join(`
`)),o=XR(o),o=lF(o,n),o=cF(o,n),a=XR(a),a=lF(a,n),a=cF(a,n),o=uF(o),a=uF(a),n.isRawShaderMaterial!==!0&&(T=`#version 300 es
`,S=[x,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+S,M=["#define varying in",n.glslVersion===jR?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===jR?"":"#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(`
`)+`
`+M);const A=T+S+o,N=T+M+a,D=sF(i,i.VERTEX_SHADER,A),k=sF(i,i.FRAGMENT_SHADER,N);i.attachShader(_,D),i.attachShader(_,k),n.index0AttributeName!==void 0?i.bindAttribLocation(_,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);function O(H){if(t.debug.checkShaderErrors){const $=i.getProgramInfoLog(_)||"",G=i.getShaderInfoLog(D)||"",Z=i.getShaderInfoLog(k)||"",V=$.trim(),W=G.trim(),J=Z.trim();let ne=!0,ie=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(ne=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,_,D,k);else{const z=aF(i,D,"vertex"),j=aF(i,k,"fragment");qn("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`

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

Program Info Log: `+V+`
`+z+`
`+j)}else V!==""?En("WebGLProgram: Program Info Log:",V):(W===""||J==="")&&(ie=!1);ie&&(H.diagnostics={runnable:ne,programLog:V,vertexShader:{log:W,prefix:S},fragmentShader:{log:J,prefix:M}})}i.deleteShader(D),i.deleteShader(k),R=new M2(i,_),L=IEe(i,_)}let R;this.getUniforms=function(){return R===void 0&&O(this),R};let L;this.getAttributes=function(){return L===void 0&&O(this),L};let B=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return B===!1&&(B=i.getProgramParameter(_,SEe)),B},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=MEe++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=D,this.fragmentShader=k,this}let YEe=0;class KEe{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 ZEe(e),n.set(e,r)),r}}class ZEe{constructor(e){this.id=YEe++,this.code=e,this.usedTimes=0}}function QEe(t,e,n,r,i,s){const o=new zy,a=new KEe,l=new Set,c=[],f=new Map,h=r.logarithmicDepthBuffer;let m=r.precision;const x={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,L,B,H,$){const G=H.fog,Z=$.geometry,V=R.isMeshStandardMaterial||R.isMeshLambertMaterial||R.isMeshPhongMaterial?H.environment:null,W=R.isMeshStandardMaterial||R.isMeshLambertMaterial&&!R.envMap||R.isMeshPhongMaterial&&!R.envMap,J=e.get(R.envMap||V,W),ne=J&&J.mapping===lb?J.image.height:null,ie=x[R.type];R.precision!==null&&(m=r.getMaxPrecision(R.precision),m!==R.precision&&En("WebGLProgram.getParameters:",R.precision,"not supported, using",m,"instead."));const z=Z.morphAttributes.position||Z.morphAttributes.normal||Z.morphAttributes.color,j=z!==void 0?z.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 F,ce,oe,Q;if(ie){const Ne=Jd[ie];F=Ne.vertexShader,ce=Ne.fragmentShader}else F=R.vertexShader,ce=R.fragmentShader,a.update(R),oe=a.getVertexShaderID(R),Q=a.getFragmentShaderID(R);const se=t.getRenderTarget(),re=t.state.buffers.depth.getReversed(),K=$.isInstancedMesh===!0,fe=$.isBatchedMesh===!0,he=!!R.map,ae=!!R.matcap,Se=!!J,de=!!R.aoMap,Me=!!R.lightMap,Ce=!!R.bumpMap,Re=!!R.normalMap,le=!!R.displacementMap,He=!!R.emissiveMap,Le=!!R.metalnessMap,ze=!!R.roughnessMap,Ve=R.anisotropy>0,ue=R.clearcoat>0,Y=R.dispersion>0,xe=R.iridescence>0,we=R.sheen>0,Te=R.transmission>0,ge=Ve&&!!R.anisotropyMap,Ue=ue&&!!R.clearcoatMap,be=ue&&!!R.clearcoatNormalMap,ke=ue&&!!R.clearcoatRoughnessMap,qe=xe&&!!R.iridescenceMap,Qe=xe&&!!R.iridescenceThicknessMap,nt=we&&!!R.sheenColorMap,st=we&&!!R.sheenRoughnessMap,Pe=!!R.specularMap,Ke=!!R.specularColorMap,rt=!!R.specularIntensityMap,ye=Te&&!!R.transmissionMap,$e=Te&&!!R.thicknessMap,Ze=!!R.gradientMap,ft=!!R.alphaMap,lt=R.alphaTest>0,Je=!!R.alphaHash,Ae=!!R.extensions;let We=vu;R.toneMapped&&(se===null||se.isXRRenderTarget===!0)&&(We=t.toneMapping);const De={shaderID:ie,shaderType:R.type,shaderName:R.name,vertexShader:F,fragmentShader:ce,defines:R.defines,customVertexShaderID:oe,customFragmentShaderID:Q,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:m,batching:fe,batchingColor:fe&&$._colorsTexture!==null,instancing:K,instancingColor:K&&$.instanceColor!==null,instancingMorph:K&&$.morphTexture!==null,outputColorSpace:se===null?t.outputColorSpace:se.isXRRenderTarget===!0?se.texture.colorSpace:R0,alphaToCoverage:!!R.alphaToCoverage,map:he,matcap:ae,envMap:Se,envMapMode:Se&&J.mapping,envMapCubeUVHeight:ne,aoMap:de,lightMap:Me,bumpMap:Ce,normalMap:Re,displacementMap:le,emissiveMap:He,normalMapObjectSpace:Re&&R.normalMapType===TK,normalMapTangentSpace:Re&&R.normalMapType===K0,metalnessMap:Le,roughnessMap:ze,anisotropy:Ve,anisotropyMap:ge,clearcoat:ue,clearcoatMap:Ue,clearcoatNormalMap:be,clearcoatRoughnessMap:ke,dispersion:Y,iridescence:xe,iridescenceMap:qe,iridescenceThicknessMap:Qe,sheen:we,sheenColorMap:nt,sheenRoughnessMap:st,specularMap:Pe,specularColorMap:Ke,specularIntensityMap:rt,transmission:Te,transmissionMap:ye,thicknessMap:$e,gradientMap:Ze,opaque:R.transparent===!1&&R.blending===Tx&&R.alphaToCoverage===!1,alphaMap:ft,alphaTest:lt,alphaHash:Je,combine:R.combine,mapUv:he&&b(R.map.channel),aoMapUv:de&&b(R.aoMap.channel),lightMapUv:Me&&b(R.lightMap.channel),bumpMapUv:Ce&&b(R.bumpMap.channel),normalMapUv:Re&&b(R.normalMap.channel),displacementMapUv:le&&b(R.displacementMap.channel),emissiveMapUv:He&&b(R.emissiveMap.channel),metalnessMapUv:Le&&b(R.metalnessMap.channel),roughnessMapUv:ze&&b(R.roughnessMap.channel),anisotropyMapUv:ge&&b(R.anisotropyMap.channel),clearcoatMapUv:Ue&&b(R.clearcoatMap.channel),clearcoatNormalMapUv:be&&b(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ke&&b(R.clearcoatRoughnessMap.channel),iridescenceMapUv:qe&&b(R.iridescenceMap.channel),iridescenceThicknessMapUv:Qe&&b(R.iridescenceThicknessMap.channel),sheenColorMapUv:nt&&b(R.sheenColorMap.channel),sheenRoughnessMapUv:st&&b(R.sheenRoughnessMap.channel),specularMapUv:Pe&&b(R.specularMap.channel),specularColorMapUv:Ke&&b(R.specularColorMap.channel),specularIntensityMapUv:rt&&b(R.specularIntensityMap.channel),transmissionMapUv:ye&&b(R.transmissionMap.channel),thicknessMapUv:$e&&b(R.thicknessMap.channel),alphaMapUv:ft&&b(R.alphaMap.channel),vertexTangents:!!Z.attributes.tangent&&(Re||Ve),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!Z.attributes.color&&Z.attributes.color.itemSize===4,pointsUvs:$.isPoints===!0&&!!Z.attributes.uv&&(he||ft),fog:!!G,useFog:R.fog===!0,fogExp2:!!G&&G.isFogExp2,flatShading:R.wireframe===!1&&(R.flatShading===!0||Z.attributes.normal===void 0&&Re===!1&&(R.isMeshLambertMaterial||R.isMeshPhongMaterial||R.isMeshStandardMaterial||R.isMeshPhysicalMaterial)),sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:h,reversedDepthBuffer:re,skinning:$.isSkinnedMesh===!0,morphTargets:Z.morphAttributes.position!==void 0,morphNormals:Z.morphAttributes.normal!==void 0,morphColors:Z.morphAttributes.color!==void 0,morphTargetsCount:j,morphTextureStride:X,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:R.dithering,shadowMapEnabled:t.shadowMap.enabled&&B.length>0,shadowMapType:t.shadowMap.type,toneMapping:We,decodeVideoTexture:he&&R.map.isVideoTexture===!0&&li.getTransfer(R.map.colorSpace)===Hi,decodeVideoTextureEmissive:He&&R.emissiveMap.isVideoTexture===!0&&li.getTransfer(R.emissiveMap.colorSpace)===Hi,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===uu,flipSided:R.side===Jl,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||fe)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()};return De.vertexUv1s=l.has(1),De.vertexUv2s=l.has(2),De.vertexUv3s=l.has(3),l.clear(),De}function S(R){const L=[];if(R.shaderID?L.push(R.shaderID):(L.push(R.customVertexShaderID),L.push(R.customFragmentShaderID)),R.defines!==void 0)for(const B in R.defines)L.push(B),L.push(R.defines[B]);return R.isRawShaderMaterial===!1&&(M(L,R),T(L,R),L.push(t.outputColorSpace)),L.push(R.customProgramCacheKey),L.join()}function M(R,L){R.push(L.precision),R.push(L.outputColorSpace),R.push(L.envMapMode),R.push(L.envMapCubeUVHeight),R.push(L.mapUv),R.push(L.alphaMapUv),R.push(L.lightMapUv),R.push(L.aoMapUv),R.push(L.bumpMapUv),R.push(L.normalMapUv),R.push(L.displacementMapUv),R.push(L.emissiveMapUv),R.push(L.metalnessMapUv),R.push(L.roughnessMapUv),R.push(L.anisotropyMapUv),R.push(L.clearcoatMapUv),R.push(L.clearcoatNormalMapUv),R.push(L.clearcoatRoughnessMapUv),R.push(L.iridescenceMapUv),R.push(L.iridescenceThicknessMapUv),R.push(L.sheenColorMapUv),R.push(L.sheenRoughnessMapUv),R.push(L.specularMapUv),R.push(L.specularColorMapUv),R.push(L.specularIntensityMapUv),R.push(L.transmissionMapUv),R.push(L.thicknessMapUv),R.push(L.combine),R.push(L.fogExp2),R.push(L.sizeAttenuation),R.push(L.morphTargetsCount),R.push(L.morphAttributeCount),R.push(L.numDirLights),R.push(L.numPointLights),R.push(L.numSpotLights),R.push(L.numSpotLightMaps),R.push(L.numHemiLights),R.push(L.numRectAreaLights),R.push(L.numDirLightShadows),R.push(L.numPointLightShadows),R.push(L.numSpotLightShadows),R.push(L.numSpotLightShadowsWithMaps),R.push(L.numLightProbes),R.push(L.shadowMapType),R.push(L.toneMapping),R.push(L.numClippingPlanes),R.push(L.numClipIntersection),R.push(L.depthPacking)}function T(R,L){o.disableAll(),L.instancing&&o.enable(0),L.instancingColor&&o.enable(1),L.instancingMorph&&o.enable(2),L.matcap&&o.enable(3),L.envMap&&o.enable(4),L.normalMapObjectSpace&&o.enable(5),L.normalMapTangentSpace&&o.enable(6),L.clearcoat&&o.enable(7),L.iridescence&&o.enable(8),L.alphaTest&&o.enable(9),L.vertexColors&&o.enable(10),L.vertexAlphas&&o.enable(11),L.vertexUv1s&&o.enable(12),L.vertexUv2s&&o.enable(13),L.vertexUv3s&&o.enable(14),L.vertexTangents&&o.enable(15),L.anisotropy&&o.enable(16),L.alphaHash&&o.enable(17),L.batching&&o.enable(18),L.dispersion&&o.enable(19),L.batchingColor&&o.enable(20),L.gradientMap&&o.enable(21),R.push(o.mask),o.disableAll(),L.fog&&o.enable(0),L.useFog&&o.enable(1),L.flatShading&&o.enable(2),L.logarithmicDepthBuffer&&o.enable(3),L.reversedDepthBuffer&&o.enable(4),L.skinning&&o.enable(5),L.morphTargets&&o.enable(6),L.morphNormals&&o.enable(7),L.morphColors&&o.enable(8),L.premultipliedAlpha&&o.enable(9),L.shadowMapEnabled&&o.enable(10),L.doubleSided&&o.enable(11),L.flipSided&&o.enable(12),L.useDepthPacking&&o.enable(13),L.dithering&&o.enable(14),L.transmission&&o.enable(15),L.sheen&&o.enable(16),L.opaque&&o.enable(17),L.pointsUvs&&o.enable(18),L.decodeVideoTexture&&o.enable(19),L.decodeVideoTextureEmissive&&o.enable(20),L.alphaToCoverage&&o.enable(21),R.push(o.mask)}function A(R){const L=x[R.type];let B;if(L){const H=Jd[L];B=sS.clone(H.uniforms)}else B=R.uniforms;return B}function N(R,L){let B=f.get(L);return B!==void 0?++B.usedTimes:(B=new XEe(t,L,R,i),c.push(B),f.set(L,B)),B}function D(R){if(--R.usedTimes===0){const L=c.indexOf(R);c[L]=c[c.length-1],c.pop(),f.delete(R.cacheKey),R.destroy()}}function k(R){a.remove(R)}function O(){a.dispose()}return{getParameters:_,getProgramCacheKey:S,getUniforms:A,acquireProgram:N,releaseProgram:D,releaseShaderCache:k,programs:c,dispose:O}}function JEe(){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 eAe(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 fF(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 hF(){const t=[];let e=0;const n=[],r=[],i=[];function s(){e=0,n.length=0,r.length=0,i.length=0}function o(m){let x=0;return m.isInstancedMesh&&(x+=2),m.isSkinnedMesh&&(x+=1),x}function a(m,x,b,_,S,M){let T=t[e];return T===void 0?(T={id:m.id,object:m,geometry:x,material:b,materialVariant:o(m),groupOrder:_,renderOrder:m.renderOrder,z:S,group:M},t[e]=T):(T.id=m.id,T.object=m,T.geometry=x,T.material=b,T.materialVariant=o(m),T.groupOrder=_,T.renderOrder=m.renderOrder,T.z=S,T.group=M),e++,T}function l(m,x,b,_,S,M){const T=a(m,x,b,_,S,M);b.transmission>0?r.push(T):b.transparent===!0?i.push(T):n.push(T)}function c(m,x,b,_,S,M){const T=a(m,x,b,_,S,M);b.transmission>0?r.unshift(T):b.transparent===!0?i.unshift(T):n.unshift(T)}function f(m,x){n.length>1&&n.sort(m||eAe),r.length>1&&r.sort(x||fF),i.length>1&&i.sort(x||fF)}function h(){for(let m=e,x=t.length;m<x;m++){const b=t[m];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:f}}function tAe(){let t=new WeakMap;function e(r,i){const s=t.get(r);let o;return s===void 0?(o=new hF,t.set(r,[o])):i>=s.length?(o=new hF,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function nAe(){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 Ge,color:new Rn};break;case"SpotLight":n={position:new Ge,direction:new Ge,color:new Rn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ge,color:new Rn,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ge,skyColor:new Rn,groundColor:new Rn};break;case"RectAreaLight":n={color:new Rn,position:new Ge,halfWidth:new Ge,halfHeight:new Ge};break}return t[e.id]=n,n}}}function rAe(){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 qt};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qt};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let iAe=0;function sAe(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function oAe(t){const e=new nAe,n=rAe(),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 Ge);const i=new Ge,s=new pr,o=new pr;function a(c){let f=0,h=0,m=0;for(let L=0;L<9;L++)r.probe[L].set(0,0,0);let x=0,b=0,_=0,S=0,M=0,T=0,A=0,N=0,D=0,k=0,O=0;c.sort(sAe);for(let L=0,B=c.length;L<B;L++){const H=c[L],$=H.color,G=H.intensity,Z=H.distance;let V=null;if(H.shadow&&H.shadow.map&&(H.shadow.map.texture.format===zx?V=H.shadow.map.texture:V=H.shadow.map.depthTexture||H.shadow.map.texture),H.isAmbientLight)f+=$.r*G,h+=$.g*G,m+=$.b*G;else if(H.isLightProbe){for(let W=0;W<9;W++)r.probe[W].addScaledVector(H.sh.coefficients[W],G);O++}else if(H.isDirectionalLight){const W=e.get(H);if(W.color.copy(H.color).multiplyScalar(H.intensity),H.castShadow){const J=H.shadow,ne=n.get(H);ne.shadowIntensity=J.intensity,ne.shadowBias=J.bias,ne.shadowNormalBias=J.normalBias,ne.shadowRadius=J.radius,ne.shadowMapSize=J.mapSize,r.directionalShadow[x]=ne,r.directionalShadowMap[x]=V,r.directionalShadowMatrix[x]=H.shadow.matrix,T++}r.directional[x]=W,x++}else if(H.isSpotLight){const W=e.get(H);W.position.setFromMatrixPosition(H.matrixWorld),W.color.copy($).multiplyScalar(G),W.distance=Z,W.coneCos=Math.cos(H.angle),W.penumbraCos=Math.cos(H.angle*(1-H.penumbra)),W.decay=H.decay,r.spot[_]=W;const J=H.shadow;if(H.map&&(r.spotLightMap[D]=H.map,D++,J.updateMatrices(H),H.castShadow&&k++),r.spotLightMatrix[_]=J.matrix,H.castShadow){const ne=n.get(H);ne.shadowIntensity=J.intensity,ne.shadowBias=J.bias,ne.shadowNormalBias=J.normalBias,ne.shadowRadius=J.radius,ne.shadowMapSize=J.mapSize,r.spotShadow[_]=ne,r.spotShadowMap[_]=V,N++}_++}else if(H.isRectAreaLight){const W=e.get(H);W.color.copy($).multiplyScalar(G),W.halfWidth.set(H.width*.5,0,0),W.halfHeight.set(0,H.height*.5,0),r.rectArea[S]=W,S++}else if(H.isPointLight){const W=e.get(H);if(W.color.copy(H.color).multiplyScalar(H.intensity),W.distance=H.distance,W.decay=H.decay,H.castShadow){const J=H.shadow,ne=n.get(H);ne.shadowIntensity=J.intensity,ne.shadowBias=J.bias,ne.shadowNormalBias=J.normalBias,ne.shadowRadius=J.radius,ne.shadowMapSize=J.mapSize,ne.shadowCameraNear=J.camera.near,ne.shadowCameraFar=J.camera.far,r.pointShadow[b]=ne,r.pointShadowMap[b]=V,r.pointShadowMatrix[b]=H.shadow.matrix,A++}r.point[b]=W,b++}else if(H.isHemisphereLight){const W=e.get(H);W.skyColor.copy(H.color).multiplyScalar(G),W.groundColor.copy(H.groundColor).multiplyScalar(G),r.hemi[M]=W,M++}}S>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=An.LTC_FLOAT_1,r.rectAreaLTC2=An.LTC_FLOAT_2):(r.rectAreaLTC1=An.LTC_HALF_1,r.rectAreaLTC2=An.LTC_HALF_2)),r.ambient[0]=f,r.ambient[1]=h,r.ambient[2]=m;const R=r.hash;(R.directionalLength!==x||R.pointLength!==b||R.spotLength!==_||R.rectAreaLength!==S||R.hemiLength!==M||R.numDirectionalShadows!==T||R.numPointShadows!==A||R.numSpotShadows!==N||R.numSpotMaps!==D||R.numLightProbes!==O)&&(r.directional.length=x,r.spot.length=_,r.rectArea.length=S,r.point.length=b,r.hemi.length=M,r.directionalShadow.length=T,r.directionalShadowMap.length=T,r.pointShadow.length=A,r.pointShadowMap.length=A,r.spotShadow.length=N,r.spotShadowMap.length=N,r.directionalShadowMatrix.length=T,r.pointShadowMatrix.length=A,r.spotLightMatrix.length=N+D-k,r.spotLightMap.length=D,r.numSpotLightShadowsWithMaps=k,r.numLightProbes=O,R.directionalLength=x,R.pointLength=b,R.spotLength=_,R.rectAreaLength=S,R.hemiLength=M,R.numDirectionalShadows=T,R.numPointShadows=A,R.numSpotShadows=N,R.numSpotMaps=D,R.numLightProbes=O,r.version=iAe++)}function l(c,f){let h=0,m=0,x=0,b=0,_=0;const S=f.matrixWorldInverse;for(let M=0,T=c.length;M<T;M++){const A=c[M];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(S),h++}else if(A.isSpotLight){const N=r.spot[x];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(S),N.direction.setFromMatrixPosition(A.matrixWorld),i.setFromMatrixPosition(A.target.matrixWorld),N.direction.sub(i),N.direction.transformDirection(S),x++}else if(A.isRectAreaLight){const N=r.rectArea[b];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(S),o.identity(),s.copy(A.matrixWorld),s.premultiply(S),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[m];N.position.setFromMatrixPosition(A.matrixWorld),N.position.applyMatrix4(S),m++}else if(A.isHemisphereLight){const N=r.hemi[_];N.direction.setFromMatrixPosition(A.matrixWorld),N.direction.transformDirection(S),_++}}}return{setup:a,setupView:l,state:r}}function pF(t){const e=new oAe(t),n=[],r=[];function i(f){c.camera=f,n.length=0,r.length=0}function s(f){n.push(f)}function o(f){r.push(f)}function a(){e.setup(n)}function l(f){e.setupView(n,f)}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 aAe(t){let e=new WeakMap;function n(i,s=0){const o=e.get(i);let a;return o===void 0?(a=new pF(t),e.set(i,[a])):s>=o.length?(a=new pF(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}const lAe=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,cAe=`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 );
}`,uAe=[new Ge(1,0,0),new Ge(-1,0,0),new Ge(0,1,0),new Ge(0,-1,0),new Ge(0,0,1),new Ge(0,0,-1)],dAe=[new Ge(0,-1,0),new Ge(0,-1,0),new Ge(0,0,1),new Ge(0,0,-1),new Ge(0,-1,0),new Ge(0,-1,0)],mF=new pr,U_=new Ge,CN=new Ge;function fAe(t,e,n){let r=new cb;const i=new qt,s=new qt,o=new pi,a=new wE,l=new SE,c={},f=n.maxTextureSize,h={[Lp]:Jl,[Jl]:Lp,[uu]:uu},m=new Mu({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new qt},radius:{value:4}},vertexShader:lAe,fragmentShader:cAe}),x=m.clone();x.defines.HORIZONTAL_PASS=1;const b=new Nr;b.setAttribute("position",new Xi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Xs(b,m),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=q1;let M=this.type;this.render=function(k,O,R){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||k.length===0)return;this.type===mw&&(En("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=q1);const L=t.getRenderTarget(),B=t.getActiveCubeFace(),H=t.getActiveMipmapLevel(),$=t.state;$.setBlending(fh),$.buffers.depth.getReversed()===!0?$.buffers.color.setClear(0,0,0,0):$.buffers.color.setClear(1,1,1,1),$.buffers.depth.setTest(!0),$.setScissorTest(!1);const G=M!==this.type;G&&O.traverse(function(Z){Z.material&&(Array.isArray(Z.material)?Z.material.forEach(V=>V.needsUpdate=!0):Z.material.needsUpdate=!0)});for(let Z=0,V=k.length;Z<V;Z++){const W=k[Z],J=W.shadow;if(J===void 0){En("WebGLShadowMap:",W,"has no shadow.");continue}if(J.autoUpdate===!1&&J.needsUpdate===!1)continue;i.copy(J.mapSize);const ne=J.getFrameExtents();i.multiply(ne),s.copy(J.mapSize),(i.x>f||i.y>f)&&(i.x>f&&(s.x=Math.floor(f/ne.x),i.x=s.x*ne.x,J.mapSize.x=s.x),i.y>f&&(s.y=Math.floor(f/ne.y),i.y=s.y*ne.y,J.mapSize.y=s.y));const ie=t.state.buffers.depth.getReversed();if(J.camera._reversedDepth=ie,J.map===null||G===!0){if(J.map!==null&&(J.map.depthTexture!==null&&(J.map.depthTexture.dispose(),J.map.depthTexture=null),J.map.dispose()),this.type===cx){if(W.isPointLight){En("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}J.map=new bu(i.x,i.y,{format:zx,type:xh,minFilter:as,magFilter:as,generateMipmaps:!1}),J.map.texture.name=W.name+".shadowMap",J.map.depthTexture=new Fy(i.x,i.y,Ql),J.map.depthTexture.name=W.name+".shadowMapDepth",J.map.depthTexture.format=vh,J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=zo,J.map.depthTexture.magFilter=zo}else W.isPointLight?(J.map=new bI(i.x),J.map.depthTexture=new qK(i.x,xd)):(J.map=new bu(i.x,i.y),J.map.depthTexture=new Fy(i.x,i.y,xd)),J.map.depthTexture.name=W.name+".shadowMap",J.map.depthTexture.format=vh,this.type===q1?(J.map.depthTexture.compareFunction=ie?eE:JC,J.map.depthTexture.minFilter=as,J.map.depthTexture.magFilter=as):(J.map.depthTexture.compareFunction=null,J.map.depthTexture.minFilter=zo,J.map.depthTexture.magFilter=zo);J.camera.updateProjectionMatrix()}const z=J.map.isWebGLCubeRenderTarget?6:1;for(let j=0;j<z;j++){if(J.map.isWebGLCubeRenderTarget)t.setRenderTarget(J.map,j),t.clear();else{j===0&&(t.setRenderTarget(J.map),t.clear());const X=J.getViewport(j);o.set(s.x*X.x,s.y*X.y,s.x*X.z,s.y*X.w),$.viewport(o)}if(W.isPointLight){const X=J.camera,F=J.matrix,ce=W.distance||X.far;ce!==X.far&&(X.far=ce,X.updateProjectionMatrix()),U_.setFromMatrixPosition(W.matrixWorld),X.position.copy(U_),CN.copy(X.position),CN.add(uAe[j]),X.up.copy(dAe[j]),X.lookAt(CN),X.updateMatrixWorld(),F.makeTranslation(-U_.x,-U_.y,-U_.z),mF.multiplyMatrices(X.projectionMatrix,X.matrixWorldInverse),J._frustum.setFromProjectionMatrix(mF,X.coordinateSystem,X.reversedDepth)}else J.updateMatrices(W);r=J.getFrustum(),N(O,R,J.camera,W,this.type)}J.isPointLightShadow!==!0&&this.type===cx&&T(J,R),J.needsUpdate=!1}M=this.type,S.needsUpdate=!1,t.setRenderTarget(L,B,H)};function T(k,O){const R=e.update(_);m.defines.VSM_SAMPLES!==k.blurSamples&&(m.defines.VSM_SAMPLES=k.blurSamples,x.defines.VSM_SAMPLES=k.blurSamples,m.needsUpdate=!0,x.needsUpdate=!0),k.mapPass===null&&(k.mapPass=new bu(i.x,i.y,{format:zx,type:xh})),m.uniforms.shadow_pass.value=k.map.depthTexture,m.uniforms.resolution.value=k.mapSize,m.uniforms.radius.value=k.radius,t.setRenderTarget(k.mapPass),t.clear(),t.renderBufferDirect(O,null,R,m,_,null),x.uniforms.shadow_pass.value=k.mapPass.texture,x.uniforms.resolution.value=k.mapSize,x.uniforms.radius.value=k.radius,t.setRenderTarget(k.map),t.clear(),t.renderBufferDirect(O,null,R,x,_,null)}function A(k,O,R,L){let B=null;const H=R.isPointLight===!0?k.customDistanceMaterial:k.customDepthMaterial;if(H!==void 0)B=H;else if(B=R.isPointLight===!0?l:a,t.localClippingEnabled&&O.clipShadows===!0&&Array.isArray(O.clippingPlanes)&&O.clippingPlanes.length!==0||O.displacementMap&&O.displacementScale!==0||O.alphaMap&&O.alphaTest>0||O.map&&O.alphaTest>0||O.alphaToCoverage===!0){const $=B.uuid,G=O.uuid;let Z=c[$];Z===void 0&&(Z={},c[$]=Z);let V=Z[G];V===void 0&&(V=B.clone(),Z[G]=V,O.addEventListener("dispose",D)),B=V}if(B.visible=O.visible,B.wireframe=O.wireframe,L===cx?B.side=O.shadowSide!==null?O.shadowSide:O.side:B.side=O.shadowSide!==null?O.shadowSide:h[O.side],B.alphaMap=O.alphaMap,B.alphaTest=O.alphaToCoverage===!0?.5:O.alphaTest,B.map=O.map,B.clipShadows=O.clipShadows,B.clippingPlanes=O.clippingPlanes,B.clipIntersection=O.clipIntersection,B.displacementMap=O.displacementMap,B.displacementScale=O.displacementScale,B.displacementBias=O.displacementBias,B.wireframeLinewidth=O.wireframeLinewidth,B.linewidth=O.linewidth,R.isPointLight===!0&&B.isMeshDistanceMaterial===!0){const $=t.properties.get(B);$.light=R}return B}function N(k,O,R,L,B){if(k.visible===!1)return;if(k.layers.test(O.layers)&&(k.isMesh||k.isLine||k.isPoints)&&(k.castShadow||k.receiveShadow&&B===cx)&&(!k.frustumCulled||r.intersectsObject(k))){k.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,k.matrixWorld);const G=e.update(k),Z=k.material;if(Array.isArray(Z)){const V=G.groups;for(let W=0,J=V.length;W<J;W++){const ne=V[W],ie=Z[ne.materialIndex];if(ie&&ie.visible){const z=A(k,ie,L,B);k.onBeforeShadow(t,k,O,R,G,z,ne),t.renderBufferDirect(R,null,G,z,k,ne),k.onAfterShadow(t,k,O,R,G,z,ne)}}}else if(Z.visible){const V=A(k,Z,L,B);k.onBeforeShadow(t,k,O,R,G,V,null),t.renderBufferDirect(R,null,G,V,k,null),k.onAfterShadow(t,k,O,R,G,V,null)}}const $=k.children;for(let G=0,Z=$.length;G<Z;G++)N($[G],O,R,L,B)}function D(k){k.target.removeEventListener("dispose",D);for(const R in c){const L=c[R],B=k.target.uuid;B in L&&(L[B].dispose(),delete L[B])}}}function hAe(t,e){function n(){let ye=!1;const $e=new pi;let Ze=null;const ft=new pi(0,0,0,0);return{setMask:function(lt){Ze!==lt&&!ye&&(t.colorMask(lt,lt,lt,lt),Ze=lt)},setLocked:function(lt){ye=lt},setClear:function(lt,Je,Ae,We,De){De===!0&&(lt*=We,Je*=We,Ae*=We),$e.set(lt,Je,Ae,We),ft.equals($e)===!1&&(t.clearColor(lt,Je,Ae,We),ft.copy($e))},reset:function(){ye=!1,Ze=null,ft.set(-1,0,0,0)}}}function r(){let ye=!1,$e=!1,Ze=null,ft=null,lt=null;return{setReversed:function(Je){if($e!==Je){const Ae=e.get("EXT_clip_control");Je?Ae.clipControlEXT(Ae.LOWER_LEFT_EXT,Ae.ZERO_TO_ONE_EXT):Ae.clipControlEXT(Ae.LOWER_LEFT_EXT,Ae.NEGATIVE_ONE_TO_ONE_EXT),$e=Je;const We=lt;lt=null,this.setClear(We)}},getReversed:function(){return $e},setTest:function(Je){Je?se(t.DEPTH_TEST):re(t.DEPTH_TEST)},setMask:function(Je){Ze!==Je&&!ye&&(t.depthMask(Je),Ze=Je)},setFunc:function(Je){if($e&&(Je=z3e[Je]),ft!==Je){switch(Je){case S5:t.depthFunc(t.NEVER);break;case M5:t.depthFunc(t.ALWAYS);break;case T5:t.depthFunc(t.LESS);break;case jx:t.depthFunc(t.LEQUAL);break;case C5:t.depthFunc(t.EQUAL);break;case E5:t.depthFunc(t.GEQUAL);break;case A5:t.depthFunc(t.GREATER);break;case N5:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}ft=Je}},setLocked:function(Je){ye=Je},setClear:function(Je){lt!==Je&&(lt=Je,$e&&(Je=1-Je),t.clearDepth(Je))},reset:function(){ye=!1,Ze=null,ft=null,lt=null,$e=!1}}}function i(){let ye=!1,$e=null,Ze=null,ft=null,lt=null,Je=null,Ae=null,We=null,De=null;return{setTest:function(Ne){ye||(Ne?se(t.STENCIL_TEST):re(t.STENCIL_TEST))},setMask:function(Ne){$e!==Ne&&!ye&&(t.stencilMask(Ne),$e=Ne)},setFunc:function(Ne,ot,dt){(Ze!==Ne||ft!==ot||lt!==dt)&&(t.stencilFunc(Ne,ot,dt),Ze=Ne,ft=ot,lt=dt)},setOp:function(Ne,ot,dt){(Je!==Ne||Ae!==ot||We!==dt)&&(t.stencilOp(Ne,ot,dt),Je=Ne,Ae=ot,We=dt)},setLocked:function(Ne){ye=Ne},setClear:function(Ne){De!==Ne&&(t.clearStencil(Ne),De=Ne)},reset:function(){ye=!1,$e=null,Ze=null,ft=null,lt=null,Je=null,Ae=null,We=null,De=null}}}const s=new n,o=new r,a=new i,l=new WeakMap,c=new WeakMap;let f={},h={},m=new WeakMap,x=[],b=null,_=!1,S=null,M=null,T=null,A=null,N=null,D=null,k=null,O=new Rn(0,0,0),R=0,L=!1,B=null,H=null,$=null,G=null,Z=null;const V=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let W=!1,J=0;const ne=t.getParameter(t.VERSION);ne.indexOf("WebGL")!==-1?(J=parseFloat(/^WebGL (\d)/.exec(ne)[1]),W=J>=1):ne.indexOf("OpenGL ES")!==-1&&(J=parseFloat(/^OpenGL ES (\d)/.exec(ne)[1]),W=J>=2);let ie=null,z={};const j=t.getParameter(t.SCISSOR_BOX),X=t.getParameter(t.VIEWPORT),F=new pi().fromArray(j),ce=new pi().fromArray(X);function oe(ye,$e,Ze,ft){const lt=new Uint8Array(4),Je=t.createTexture();t.bindTexture(ye,Je),t.texParameteri(ye,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(ye,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Ae=0;Ae<Ze;Ae++)ye===t.TEXTURE_3D||ye===t.TEXTURE_2D_ARRAY?t.texImage3D($e,0,t.RGBA,1,1,ft,0,t.RGBA,t.UNSIGNED_BYTE,lt):t.texImage2D($e+Ae,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,lt);return Je}const Q={};Q[t.TEXTURE_2D]=oe(t.TEXTURE_2D,t.TEXTURE_2D,1),Q[t.TEXTURE_CUBE_MAP]=oe(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),Q[t.TEXTURE_2D_ARRAY]=oe(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),Q[t.TEXTURE_3D]=oe(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),o.setClear(1),a.setClear(0),se(t.DEPTH_TEST),o.setFunc(jx),Ce(!1),Re(kR),se(t.CULL_FACE),de(fh);function se(ye){f[ye]!==!0&&(t.enable(ye),f[ye]=!0)}function re(ye){f[ye]!==!1&&(t.disable(ye),f[ye]=!1)}function K(ye,$e){return h[ye]!==$e?(t.bindFramebuffer(ye,$e),h[ye]=$e,ye===t.DRAW_FRAMEBUFFER&&(h[t.FRAMEBUFFER]=$e),ye===t.FRAMEBUFFER&&(h[t.DRAW_FRAMEBUFFER]=$e),!0):!1}function fe(ye,$e){let Ze=x,ft=!1;if(ye){Ze=m.get($e),Ze===void 0&&(Ze=[],m.set($e,Ze));const lt=ye.textures;if(Ze.length!==lt.length||Ze[0]!==t.COLOR_ATTACHMENT0){for(let Je=0,Ae=lt.length;Je<Ae;Je++)Ze[Je]=t.COLOR_ATTACHMENT0+Je;Ze.length=lt.length,ft=!0}}else Ze[0]!==t.BACK&&(Ze[0]=t.BACK,ft=!0);ft&&t.drawBuffers(Ze)}function he(ye){return b!==ye?(t.useProgram(ye),b=ye,!0):!1}const ae={[Zm]:t.FUNC_ADD,[eK]:t.FUNC_SUBTRACT,[tK]:t.FUNC_REVERSE_SUBTRACT};ae[nK]=t.MIN,ae[rK]=t.MAX;const Se={[iK]:t.ZERO,[sK]:t.ONE,[oK]:t.SRC_COLOR,[_5]:t.SRC_ALPHA,[fK]:t.SRC_ALPHA_SATURATE,[uK]:t.DST_COLOR,[lK]:t.DST_ALPHA,[aK]:t.ONE_MINUS_SRC_COLOR,[w5]:t.ONE_MINUS_SRC_ALPHA,[dK]:t.ONE_MINUS_DST_COLOR,[cK]:t.ONE_MINUS_DST_ALPHA,[hK]:t.CONSTANT_COLOR,[pK]:t.ONE_MINUS_CONSTANT_COLOR,[mK]:t.CONSTANT_ALPHA,[gK]:t.ONE_MINUS_CONSTANT_ALPHA};function de(ye,$e,Ze,ft,lt,Je,Ae,We,De,Ne){if(ye===fh){_===!0&&(re(t.BLEND),_=!1);return}if(_===!1&&(se(t.BLEND),_=!0),ye!==JY){if(ye!==S||Ne!==L){if((M!==Zm||N!==Zm)&&(t.blendEquation(t.FUNC_ADD),M=Zm,N=Zm),Ne)switch(ye){case Tx:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case RR:t.blendFunc(t.ONE,t.ONE);break;case PR:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case IR:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:qn("WebGLState: Invalid blending: ",ye);break}else switch(ye){case Tx:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case RR:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case PR:qn("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case IR:qn("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:qn("WebGLState: Invalid blending: ",ye);break}T=null,A=null,D=null,k=null,O.set(0,0,0),R=0,S=ye,L=Ne}return}lt=lt||$e,Je=Je||Ze,Ae=Ae||ft,($e!==M||lt!==N)&&(t.blendEquationSeparate(ae[$e],ae[lt]),M=$e,N=lt),(Ze!==T||ft!==A||Je!==D||Ae!==k)&&(t.blendFuncSeparate(Se[Ze],Se[ft],Se[Je],Se[Ae]),T=Ze,A=ft,D=Je,k=Ae),(We.equals(O)===!1||De!==R)&&(t.blendColor(We.r,We.g,We.b,De),O.copy(We),R=De),S=ye,L=!1}function Me(ye,$e){ye.side===uu?re(t.CULL_FACE):se(t.CULL_FACE);let Ze=ye.side===Jl;$e&&(Ze=!Ze),Ce(Ze),ye.blending===Tx&&ye.transparent===!1?de(fh):de(ye.blending,ye.blendEquation,ye.blendSrc,ye.blendDst,ye.blendEquationAlpha,ye.blendSrcAlpha,ye.blendDstAlpha,ye.blendColor,ye.blendAlpha,ye.premultipliedAlpha),o.setFunc(ye.depthFunc),o.setTest(ye.depthTest),o.setMask(ye.depthWrite),s.setMask(ye.colorWrite);const ft=ye.stencilWrite;a.setTest(ft),ft&&(a.setMask(ye.stencilWriteMask),a.setFunc(ye.stencilFunc,ye.stencilRef,ye.stencilFuncMask),a.setOp(ye.stencilFail,ye.stencilZFail,ye.stencilZPass)),He(ye.polygonOffset,ye.polygonOffsetFactor,ye.polygonOffsetUnits),ye.alphaToCoverage===!0?se(t.SAMPLE_ALPHA_TO_COVERAGE):re(t.SAMPLE_ALPHA_TO_COVERAGE)}function Ce(ye){B!==ye&&(ye?t.frontFace(t.CW):t.frontFace(t.CCW),B=ye)}function Re(ye){ye!==KY?(se(t.CULL_FACE),ye!==H&&(ye===kR?t.cullFace(t.BACK):ye===ZY?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):re(t.CULL_FACE),H=ye}function le(ye){ye!==$&&(W&&t.lineWidth(ye),$=ye)}function He(ye,$e,Ze){ye?(se(t.POLYGON_OFFSET_FILL),(G!==$e||Z!==Ze)&&(G=$e,Z=Ze,o.getReversed()&&($e=-$e),t.polygonOffset($e,Ze))):re(t.POLYGON_OFFSET_FILL)}function Le(ye){ye?se(t.SCISSOR_TEST):re(t.SCISSOR_TEST)}function ze(ye){ye===void 0&&(ye=t.TEXTURE0+V-1),ie!==ye&&(t.activeTexture(ye),ie=ye)}function Ve(ye,$e,Ze){Ze===void 0&&(ie===null?Ze=t.TEXTURE0+V-1:Ze=ie);let ft=z[Ze];ft===void 0&&(ft={type:void 0,texture:void 0},z[Ze]=ft),(ft.type!==ye||ft.texture!==$e)&&(ie!==Ze&&(t.activeTexture(Ze),ie=Ze),t.bindTexture(ye,$e||Q[ye]),ft.type=ye,ft.texture=$e)}function ue(){const ye=z[ie];ye!==void 0&&ye.type!==void 0&&(t.bindTexture(ye.type,null),ye.type=void 0,ye.texture=void 0)}function Y(){try{t.compressedTexImage2D(...arguments)}catch(ye){qn("WebGLState:",ye)}}function xe(){try{t.compressedTexImage3D(...arguments)}catch(ye){qn("WebGLState:",ye)}}function we(){try{t.texSubImage2D(...arguments)}catch(ye){qn("WebGLState:",ye)}}function Te(){try{t.texSubImage3D(...arguments)}catch(ye){qn("WebGLState:",ye)}}function ge(){try{t.compressedTexSubImage2D(...arguments)}catch(ye){qn("WebGLState:",ye)}}function Ue(){try{t.compressedTexSubImage3D(...arguments)}catch(ye){qn("WebGLState:",ye)}}function be(){try{t.texStorage2D(...arguments)}catch(ye){qn("WebGLState:",ye)}}function ke(){try{t.texStorage3D(...arguments)}catch(ye){qn("WebGLState:",ye)}}function qe(){try{t.texImage2D(...arguments)}catch(ye){qn("WebGLState:",ye)}}function Qe(){try{t.texImage3D(...arguments)}catch(ye){qn("WebGLState:",ye)}}function nt(ye){F.equals(ye)===!1&&(t.scissor(ye.x,ye.y,ye.z,ye.w),F.copy(ye))}function st(ye){ce.equals(ye)===!1&&(t.viewport(ye.x,ye.y,ye.z,ye.w),ce.copy(ye))}function Pe(ye,$e){let Ze=c.get($e);Ze===void 0&&(Ze=new WeakMap,c.set($e,Ze));let ft=Ze.get(ye);ft===void 0&&(ft=t.getUniformBlockIndex($e,ye.name),Ze.set(ye,ft))}function Ke(ye,$e){const ft=c.get($e).get(ye);l.get($e)!==ft&&(t.uniformBlockBinding($e,ft,ye.__bindingPointIndex),l.set($e,ft))}function rt(){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),f={},ie=null,z={},h={},m=new WeakMap,x=[],b=null,_=!1,S=null,M=null,T=null,A=null,N=null,D=null,k=null,O=new Rn(0,0,0),R=0,L=!1,B=null,H=null,$=null,G=null,Z=null,F.set(0,0,t.canvas.width,t.canvas.height),ce.set(0,0,t.canvas.width,t.canvas.height),s.reset(),o.reset(),a.reset()}return{buffers:{color:s,depth:o,stencil:a},enable:se,disable:re,bindFramebuffer:K,drawBuffers:fe,useProgram:he,setBlending:de,setMaterial:Me,setFlipSided:Ce,setCullFace:Re,setLineWidth:le,setPolygonOffset:He,setScissorTest:Le,activeTexture:ze,bindTexture:Ve,unbindTexture:ue,compressedTexImage2D:Y,compressedTexImage3D:xe,texImage2D:qe,texImage3D:Qe,updateUBOMapping:Pe,uniformBlockBinding:Ke,texStorage2D:be,texStorage3D:ke,texSubImage2D:we,texSubImage3D:Te,compressedTexSubImage2D:ge,compressedTexSubImage3D:Ue,scissor:nt,viewport:st,reset:rt}}function pAe(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 qt,f=new WeakMap;let h;const m=new WeakMap;let x=!1;try{x=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(ue,Y){return x?new OffscreenCanvas(ue,Y):Jw("canvas")}function _(ue,Y,xe){let we=1;const Te=Ve(ue);if((Te.width>xe||Te.height>xe)&&(we=xe/Math.max(Te.width,Te.height)),we<1)if(typeof HTMLImageElement<"u"&&ue instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&ue instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&ue instanceof ImageBitmap||typeof VideoFrame<"u"&&ue instanceof VideoFrame){const ge=Math.floor(we*Te.width),Ue=Math.floor(we*Te.height);h===void 0&&(h=b(ge,Ue));const be=Y?b(ge,Ue):h;return be.width=ge,be.height=Ue,be.getContext("2d").drawImage(ue,0,0,ge,Ue),En("WebGLRenderer: Texture has been resized from ("+Te.width+"x"+Te.height+") to ("+ge+"x"+Ue+")."),be}else return"data"in ue&&En("WebGLRenderer: Image in DataTexture is too big ("+Te.width+"x"+Te.height+")."),ue;return ue}function S(ue){return ue.generateMipmaps}function M(ue){t.generateMipmap(ue)}function T(ue){return ue.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:ue.isWebGL3DRenderTarget?t.TEXTURE_3D:ue.isWebGLArrayRenderTarget||ue.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function A(ue,Y,xe,we,Te=!1){if(ue!==null){if(t[ue]!==void 0)return t[ue];En("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+ue+"'")}let ge=Y;if(Y===t.RED&&(xe===t.FLOAT&&(ge=t.R32F),xe===t.HALF_FLOAT&&(ge=t.R16F),xe===t.UNSIGNED_BYTE&&(ge=t.R8)),Y===t.RED_INTEGER&&(xe===t.UNSIGNED_BYTE&&(ge=t.R8UI),xe===t.UNSIGNED_SHORT&&(ge=t.R16UI),xe===t.UNSIGNED_INT&&(ge=t.R32UI),xe===t.BYTE&&(ge=t.R8I),xe===t.SHORT&&(ge=t.R16I),xe===t.INT&&(ge=t.R32I)),Y===t.RG&&(xe===t.FLOAT&&(ge=t.RG32F),xe===t.HALF_FLOAT&&(ge=t.RG16F),xe===t.UNSIGNED_BYTE&&(ge=t.RG8)),Y===t.RG_INTEGER&&(xe===t.UNSIGNED_BYTE&&(ge=t.RG8UI),xe===t.UNSIGNED_SHORT&&(ge=t.RG16UI),xe===t.UNSIGNED_INT&&(ge=t.RG32UI),xe===t.BYTE&&(ge=t.RG8I),xe===t.SHORT&&(ge=t.RG16I),xe===t.INT&&(ge=t.RG32I)),Y===t.RGB_INTEGER&&(xe===t.UNSIGNED_BYTE&&(ge=t.RGB8UI),xe===t.UNSIGNED_SHORT&&(ge=t.RGB16UI),xe===t.UNSIGNED_INT&&(ge=t.RGB32UI),xe===t.BYTE&&(ge=t.RGB8I),xe===t.SHORT&&(ge=t.RGB16I),xe===t.INT&&(ge=t.RGB32I)),Y===t.RGBA_INTEGER&&(xe===t.UNSIGNED_BYTE&&(ge=t.RGBA8UI),xe===t.UNSIGNED_SHORT&&(ge=t.RGBA16UI),xe===t.UNSIGNED_INT&&(ge=t.RGBA32UI),xe===t.BYTE&&(ge=t.RGBA8I),xe===t.SHORT&&(ge=t.RGBA16I),xe===t.INT&&(ge=t.RGBA32I)),Y===t.RGB&&(xe===t.UNSIGNED_INT_5_9_9_9_REV&&(ge=t.RGB9_E5),xe===t.UNSIGNED_INT_10F_11F_11F_REV&&(ge=t.R11F_G11F_B10F)),Y===t.RGBA){const Ue=Te?Zw:li.getTransfer(we);xe===t.FLOAT&&(ge=t.RGBA32F),xe===t.HALF_FLOAT&&(ge=t.RGBA16F),xe===t.UNSIGNED_BYTE&&(ge=Ue===Hi?t.SRGB8_ALPHA8:t.RGBA8),xe===t.UNSIGNED_SHORT_4_4_4_4&&(ge=t.RGBA4),xe===t.UNSIGNED_SHORT_5_5_5_1&&(ge=t.RGB5_A1)}return(ge===t.R16F||ge===t.R32F||ge===t.RG16F||ge===t.RG32F||ge===t.RGBA16F||ge===t.RGBA32F)&&e.get("EXT_color_buffer_float"),ge}function N(ue,Y){let xe;return ue?Y===null||Y===xd||Y===Ly?xe=t.DEPTH24_STENCIL8:Y===Ql?xe=t.DEPTH32F_STENCIL8:Y===Oy&&(xe=t.DEPTH24_STENCIL8,En("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):Y===null||Y===xd||Y===Ly?xe=t.DEPTH_COMPONENT24:Y===Ql?xe=t.DEPTH_COMPONENT32F:Y===Oy&&(xe=t.DEPTH_COMPONENT16),xe}function D(ue,Y){return S(ue)===!0||ue.isFramebufferTexture&&ue.minFilter!==zo&&ue.minFilter!==as?Math.log2(Math.max(Y.width,Y.height))+1:ue.mipmaps!==void 0&&ue.mipmaps.length>0?ue.mipmaps.length:ue.isCompressedTexture&&Array.isArray(ue.image)?Y.mipmaps.length:1}function k(ue){const Y=ue.target;Y.removeEventListener("dispose",k),R(Y),Y.isVideoTexture&&f.delete(Y)}function O(ue){const Y=ue.target;Y.removeEventListener("dispose",O),B(Y)}function R(ue){const Y=r.get(ue);if(Y.__webglInit===void 0)return;const xe=ue.source,we=m.get(xe);if(we){const Te=we[Y.__cacheKey];Te.usedTimes--,Te.usedTimes===0&&L(ue),Object.keys(we).length===0&&m.delete(xe)}r.remove(ue)}function L(ue){const Y=r.get(ue);t.deleteTexture(Y.__webglTexture);const xe=ue.source,we=m.get(xe);delete we[Y.__cacheKey],o.memory.textures--}function B(ue){const Y=r.get(ue);if(ue.depthTexture&&(ue.depthTexture.dispose(),r.remove(ue.depthTexture)),ue.isWebGLCubeRenderTarget)for(let we=0;we<6;we++){if(Array.isArray(Y.__webglFramebuffer[we]))for(let Te=0;Te<Y.__webglFramebuffer[we].length;Te++)t.deleteFramebuffer(Y.__webglFramebuffer[we][Te]);else t.deleteFramebuffer(Y.__webglFramebuffer[we]);Y.__webglDepthbuffer&&t.deleteRenderbuffer(Y.__webglDepthbuffer[we])}else{if(Array.isArray(Y.__webglFramebuffer))for(let we=0;we<Y.__webglFramebuffer.length;we++)t.deleteFramebuffer(Y.__webglFramebuffer[we]);else t.deleteFramebuffer(Y.__webglFramebuffer);if(Y.__webglDepthbuffer&&t.deleteRenderbuffer(Y.__webglDepthbuffer),Y.__webglMultisampledFramebuffer&&t.deleteFramebuffer(Y.__webglMultisampledFramebuffer),Y.__webglColorRenderbuffer)for(let we=0;we<Y.__webglColorRenderbuffer.length;we++)Y.__webglColorRenderbuffer[we]&&t.deleteRenderbuffer(Y.__webglColorRenderbuffer[we]);Y.__webglDepthRenderbuffer&&t.deleteRenderbuffer(Y.__webglDepthRenderbuffer)}const xe=ue.textures;for(let we=0,Te=xe.length;we<Te;we++){const ge=r.get(xe[we]);ge.__webglTexture&&(t.deleteTexture(ge.__webglTexture),o.memory.textures--),r.remove(xe[we])}r.remove(ue)}let H=0;function $(){H=0}function G(){const ue=H;return ue>=i.maxTextures&&En("WebGLTextures: Trying to use "+ue+" texture units while this GPU supports only "+i.maxTextures),H+=1,ue}function Z(ue){const Y=[];return Y.push(ue.wrapS),Y.push(ue.wrapT),Y.push(ue.wrapR||0),Y.push(ue.magFilter),Y.push(ue.minFilter),Y.push(ue.anisotropy),Y.push(ue.internalFormat),Y.push(ue.format),Y.push(ue.type),Y.push(ue.generateMipmaps),Y.push(ue.premultiplyAlpha),Y.push(ue.flipY),Y.push(ue.unpackAlignment),Y.push(ue.colorSpace),Y.join()}function V(ue,Y){const xe=r.get(ue);if(ue.isVideoTexture&&Le(ue),ue.isRenderTargetTexture===!1&&ue.isExternalTexture!==!0&&ue.version>0&&xe.__version!==ue.version){const we=ue.image;if(we===null)En("WebGLRenderer: Texture marked for update but no image data found.");else if(we.complete===!1)En("WebGLRenderer: Texture marked for update but image is incomplete");else{Q(xe,ue,Y);return}}else ue.isExternalTexture&&(xe.__webglTexture=ue.sourceTexture?ue.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,xe.__webglTexture,t.TEXTURE0+Y)}function W(ue,Y){const xe=r.get(ue);if(ue.isRenderTargetTexture===!1&&ue.version>0&&xe.__version!==ue.version){Q(xe,ue,Y);return}else ue.isExternalTexture&&(xe.__webglTexture=ue.sourceTexture?ue.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,xe.__webglTexture,t.TEXTURE0+Y)}function J(ue,Y){const xe=r.get(ue);if(ue.isRenderTargetTexture===!1&&ue.version>0&&xe.__version!==ue.version){Q(xe,ue,Y);return}n.bindTexture(t.TEXTURE_3D,xe.__webglTexture,t.TEXTURE0+Y)}function ne(ue,Y){const xe=r.get(ue);if(ue.isCubeDepthTexture!==!0&&ue.version>0&&xe.__version!==ue.version){se(xe,ue,Y);return}n.bindTexture(t.TEXTURE_CUBE_MAP,xe.__webglTexture,t.TEXTURE0+Y)}const ie={[qw]:t.REPEAT,[Uc]:t.CLAMP_TO_EDGE,[Xw]:t.MIRRORED_REPEAT},z={[zo]:t.NEAREST,[LP]:t.NEAREST_MIPMAP_NEAREST,[N1]:t.NEAREST_MIPMAP_LINEAR,[as]:t.LINEAR,[vw]:t.LINEAR_MIPMAP_NEAREST,[ah]:t.LINEAR_MIPMAP_LINEAR},j={[CK]:t.NEVER,[RK]:t.ALWAYS,[EK]:t.LESS,[JC]:t.LEQUAL,[AK]:t.EQUAL,[eE]:t.GEQUAL,[NK]:t.GREATER,[kK]:t.NOTEQUAL};function X(ue,Y){if(Y.type===Ql&&e.has("OES_texture_float_linear")===!1&&(Y.magFilter===as||Y.magFilter===vw||Y.magFilter===N1||Y.magFilter===ah||Y.minFilter===as||Y.minFilter===vw||Y.minFilter===N1||Y.minFilter===ah)&&En("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(ue,t.TEXTURE_WRAP_S,ie[Y.wrapS]),t.texParameteri(ue,t.TEXTURE_WRAP_T,ie[Y.wrapT]),(ue===t.TEXTURE_3D||ue===t.TEXTURE_2D_ARRAY)&&t.texParameteri(ue,t.TEXTURE_WRAP_R,ie[Y.wrapR]),t.texParameteri(ue,t.TEXTURE_MAG_FILTER,z[Y.magFilter]),t.texParameteri(ue,t.TEXTURE_MIN_FILTER,z[Y.minFilter]),Y.compareFunction&&(t.texParameteri(ue,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(ue,t.TEXTURE_COMPARE_FUNC,j[Y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(Y.magFilter===zo||Y.minFilter!==N1&&Y.minFilter!==ah||Y.type===Ql&&e.has("OES_texture_float_linear")===!1)return;if(Y.anisotropy>1||r.get(Y).__currentAnisotropy){const xe=e.get("EXT_texture_filter_anisotropic");t.texParameterf(ue,xe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Y.anisotropy,i.getMaxAnisotropy())),r.get(Y).__currentAnisotropy=Y.anisotropy}}}function F(ue,Y){let xe=!1;ue.__webglInit===void 0&&(ue.__webglInit=!0,Y.addEventListener("dispose",k));const we=Y.source;let Te=m.get(we);Te===void 0&&(Te={},m.set(we,Te));const ge=Z(Y);if(ge!==ue.__cacheKey){Te[ge]===void 0&&(Te[ge]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,xe=!0),Te[ge].usedTimes++;const Ue=Te[ue.__cacheKey];Ue!==void 0&&(Te[ue.__cacheKey].usedTimes--,Ue.usedTimes===0&&L(Y)),ue.__cacheKey=ge,ue.__webglTexture=Te[ge].texture}return xe}function ce(ue,Y,xe){return Math.floor(Math.floor(ue/xe)/Y)}function oe(ue,Y,xe,we){const ge=ue.updateRanges;if(ge.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,Y.width,Y.height,xe,we,Y.data);else{ge.sort((Qe,nt)=>Qe.start-nt.start);let Ue=0;for(let Qe=1;Qe<ge.length;Qe++){const nt=ge[Ue],st=ge[Qe],Pe=nt.start+nt.count,Ke=ce(st.start,Y.width,4),rt=ce(nt.start,Y.width,4);st.start<=Pe+1&&Ke===rt&&ce(st.start+st.count-1,Y.width,4)===Ke?nt.count=Math.max(nt.count,st.start+st.count-nt.start):(++Ue,ge[Ue]=st)}ge.length=Ue+1;const be=t.getParameter(t.UNPACK_ROW_LENGTH),ke=t.getParameter(t.UNPACK_SKIP_PIXELS),qe=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,Y.width);for(let Qe=0,nt=ge.length;Qe<nt;Qe++){const st=ge[Qe],Pe=Math.floor(st.start/4),Ke=Math.ceil(st.count/4),rt=Pe%Y.width,ye=Math.floor(Pe/Y.width),$e=Ke,Ze=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,rt),t.pixelStorei(t.UNPACK_SKIP_ROWS,ye),n.texSubImage2D(t.TEXTURE_2D,0,rt,ye,$e,Ze,xe,we,Y.data)}ue.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,be),t.pixelStorei(t.UNPACK_SKIP_PIXELS,ke),t.pixelStorei(t.UNPACK_SKIP_ROWS,qe)}}function Q(ue,Y,xe){let we=t.TEXTURE_2D;(Y.isDataArrayTexture||Y.isCompressedArrayTexture)&&(we=t.TEXTURE_2D_ARRAY),Y.isData3DTexture&&(we=t.TEXTURE_3D);const Te=F(ue,Y),ge=Y.source;n.bindTexture(we,ue.__webglTexture,t.TEXTURE0+xe);const Ue=r.get(ge);if(ge.version!==Ue.__version||Te===!0){n.activeTexture(t.TEXTURE0+xe);const be=li.getPrimaries(li.workingColorSpace),ke=Y.colorSpace===xp?null:li.getPrimaries(Y.colorSpace),qe=Y.colorSpace===xp||be===ke?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,Y.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,Y.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,qe);let Qe=_(Y.image,!1,i.maxTextureSize);Qe=ze(Y,Qe);const nt=s.convert(Y.format,Y.colorSpace),st=s.convert(Y.type);let Pe=A(Y.internalFormat,nt,st,Y.colorSpace,Y.isVideoTexture);X(we,Y);let Ke;const rt=Y.mipmaps,ye=Y.isVideoTexture!==!0,$e=Ue.__version===void 0||Te===!0,Ze=ge.dataReady,ft=D(Y,Qe);if(Y.isDepthTexture)Pe=N(Y.format===u0,Y.type),$e&&(ye?n.texStorage2D(t.TEXTURE_2D,1,Pe,Qe.width,Qe.height):n.texImage2D(t.TEXTURE_2D,0,Pe,Qe.width,Qe.height,0,nt,st,null));else if(Y.isDataTexture)if(rt.length>0){ye&&$e&&n.texStorage2D(t.TEXTURE_2D,ft,Pe,rt[0].width,rt[0].height);for(let lt=0,Je=rt.length;lt<Je;lt++)Ke=rt[lt],ye?Ze&&n.texSubImage2D(t.TEXTURE_2D,lt,0,0,Ke.width,Ke.height,nt,st,Ke.data):n.texImage2D(t.TEXTURE_2D,lt,Pe,Ke.width,Ke.height,0,nt,st,Ke.data);Y.generateMipmaps=!1}else ye?($e&&n.texStorage2D(t.TEXTURE_2D,ft,Pe,Qe.width,Qe.height),Ze&&oe(Y,Qe,nt,st)):n.texImage2D(t.TEXTURE_2D,0,Pe,Qe.width,Qe.height,0,nt,st,Qe.data);else if(Y.isCompressedTexture)if(Y.isCompressedArrayTexture){ye&&$e&&n.texStorage3D(t.TEXTURE_2D_ARRAY,ft,Pe,rt[0].width,rt[0].height,Qe.depth);for(let lt=0,Je=rt.length;lt<Je;lt++)if(Ke=rt[lt],Y.format!==bl)if(nt!==null)if(ye){if(Ze)if(Y.layerUpdates.size>0){const Ae=WR(Ke.width,Ke.height,Y.format,Y.type);for(const We of Y.layerUpdates){const De=Ke.data.subarray(We*Ae/Ke.data.BYTES_PER_ELEMENT,(We+1)*Ae/Ke.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,lt,0,0,We,Ke.width,Ke.height,1,nt,De)}Y.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,lt,0,0,0,Ke.width,Ke.height,Qe.depth,nt,Ke.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,lt,Pe,Ke.width,Ke.height,Qe.depth,0,Ke.data,0,0);else En("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ye?Ze&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,lt,0,0,0,Ke.width,Ke.height,Qe.depth,nt,st,Ke.data):n.texImage3D(t.TEXTURE_2D_ARRAY,lt,Pe,Ke.width,Ke.height,Qe.depth,0,nt,st,Ke.data)}else{ye&&$e&&n.texStorage2D(t.TEXTURE_2D,ft,Pe,rt[0].width,rt[0].height);for(let lt=0,Je=rt.length;lt<Je;lt++)Ke=rt[lt],Y.format!==bl?nt!==null?ye?Ze&&n.compressedTexSubImage2D(t.TEXTURE_2D,lt,0,0,Ke.width,Ke.height,nt,Ke.data):n.compressedTexImage2D(t.TEXTURE_2D,lt,Pe,Ke.width,Ke.height,0,Ke.data):En("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ye?Ze&&n.texSubImage2D(t.TEXTURE_2D,lt,0,0,Ke.width,Ke.height,nt,st,Ke.data):n.texImage2D(t.TEXTURE_2D,lt,Pe,Ke.width,Ke.height,0,nt,st,Ke.data)}else if(Y.isDataArrayTexture)if(ye){if($e&&n.texStorage3D(t.TEXTURE_2D_ARRAY,ft,Pe,Qe.width,Qe.height,Qe.depth),Ze)if(Y.layerUpdates.size>0){const lt=WR(Qe.width,Qe.height,Y.format,Y.type);for(const Je of Y.layerUpdates){const Ae=Qe.data.subarray(Je*lt/Qe.data.BYTES_PER_ELEMENT,(Je+1)*lt/Qe.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Je,Qe.width,Qe.height,1,nt,st,Ae)}Y.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Qe.width,Qe.height,Qe.depth,nt,st,Qe.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Pe,Qe.width,Qe.height,Qe.depth,0,nt,st,Qe.data);else if(Y.isData3DTexture)ye?($e&&n.texStorage3D(t.TEXTURE_3D,ft,Pe,Qe.width,Qe.height,Qe.depth),Ze&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Qe.width,Qe.height,Qe.depth,nt,st,Qe.data)):n.texImage3D(t.TEXTURE_3D,0,Pe,Qe.width,Qe.height,Qe.depth,0,nt,st,Qe.data);else if(Y.isFramebufferTexture){if($e)if(ye)n.texStorage2D(t.TEXTURE_2D,ft,Pe,Qe.width,Qe.height);else{let lt=Qe.width,Je=Qe.height;for(let Ae=0;Ae<ft;Ae++)n.texImage2D(t.TEXTURE_2D,Ae,Pe,lt,Je,0,nt,st,null),lt>>=1,Je>>=1}}else if(rt.length>0){if(ye&&$e){const lt=Ve(rt[0]);n.texStorage2D(t.TEXTURE_2D,ft,Pe,lt.width,lt.height)}for(let lt=0,Je=rt.length;lt<Je;lt++)Ke=rt[lt],ye?Ze&&n.texSubImage2D(t.TEXTURE_2D,lt,0,0,nt,st,Ke):n.texImage2D(t.TEXTURE_2D,lt,Pe,nt,st,Ke);Y.generateMipmaps=!1}else if(ye){if($e){const lt=Ve(Qe);n.texStorage2D(t.TEXTURE_2D,ft,Pe,lt.width,lt.height)}Ze&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,nt,st,Qe)}else n.texImage2D(t.TEXTURE_2D,0,Pe,nt,st,Qe);S(Y)&&M(we),Ue.__version=ge.version,Y.onUpdate&&Y.onUpdate(Y)}ue.__version=Y.version}function se(ue,Y,xe){if(Y.image.length!==6)return;const we=F(ue,Y),Te=Y.source;n.bindTexture(t.TEXTURE_CUBE_MAP,ue.__webglTexture,t.TEXTURE0+xe);const ge=r.get(Te);if(Te.version!==ge.__version||we===!0){n.activeTexture(t.TEXTURE0+xe);const Ue=li.getPrimaries(li.workingColorSpace),be=Y.colorSpace===xp?null:li.getPrimaries(Y.colorSpace),ke=Y.colorSpace===xp||Ue===be?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,Y.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Y.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,Y.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,ke);const qe=Y.isCompressedTexture||Y.image[0].isCompressedTexture,Qe=Y.image[0]&&Y.image[0].isDataTexture,nt=[];for(let Je=0;Je<6;Je++)!qe&&!Qe?nt[Je]=_(Y.image[Je],!0,i.maxCubemapSize):nt[Je]=Qe?Y.image[Je].image:Y.image[Je],nt[Je]=ze(Y,nt[Je]);const st=nt[0],Pe=s.convert(Y.format,Y.colorSpace),Ke=s.convert(Y.type),rt=A(Y.internalFormat,Pe,Ke,Y.colorSpace),ye=Y.isVideoTexture!==!0,$e=ge.__version===void 0||we===!0,Ze=Te.dataReady;let ft=D(Y,st);X(t.TEXTURE_CUBE_MAP,Y);let lt;if(qe){ye&&$e&&n.texStorage2D(t.TEXTURE_CUBE_MAP,ft,rt,st.width,st.height);for(let Je=0;Je<6;Je++){lt=nt[Je].mipmaps;for(let Ae=0;Ae<lt.length;Ae++){const We=lt[Ae];Y.format!==bl?Pe!==null?ye?Ze&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ae,0,0,We.width,We.height,Pe,We.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ae,rt,We.width,We.height,0,We.data):En("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):ye?Ze&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ae,0,0,We.width,We.height,Pe,Ke,We.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ae,rt,We.width,We.height,0,Pe,Ke,We.data)}}}else{if(lt=Y.mipmaps,ye&&$e){lt.length>0&&ft++;const Je=Ve(nt[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,ft,rt,Je.width,Je.height)}for(let Je=0;Je<6;Je++)if(Qe){ye?Ze&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,0,0,0,nt[Je].width,nt[Je].height,Pe,Ke,nt[Je].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,0,rt,nt[Je].width,nt[Je].height,0,Pe,Ke,nt[Je].data);for(let Ae=0;Ae<lt.length;Ae++){const De=lt[Ae].image[Je].image;ye?Ze&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ae+1,0,0,De.width,De.height,Pe,Ke,De.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ae+1,rt,De.width,De.height,0,Pe,Ke,De.data)}}else{ye?Ze&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,0,0,0,Pe,Ke,nt[Je]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,0,rt,Pe,Ke,nt[Je]);for(let Ae=0;Ae<lt.length;Ae++){const We=lt[Ae];ye?Ze&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ae+1,0,0,Pe,Ke,We.image[Je]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Je,Ae+1,rt,Pe,Ke,We.image[Je])}}}S(Y)&&M(t.TEXTURE_CUBE_MAP),ge.__version=Te.version,Y.onUpdate&&Y.onUpdate(Y)}ue.__version=Y.version}function re(ue,Y,xe,we,Te,ge){const Ue=s.convert(xe.format,xe.colorSpace),be=s.convert(xe.type),ke=A(xe.internalFormat,Ue,be,xe.colorSpace),qe=r.get(Y),Qe=r.get(xe);if(Qe.__renderTarget=Y,!qe.__hasExternalTextures){const nt=Math.max(1,Y.width>>ge),st=Math.max(1,Y.height>>ge);Te===t.TEXTURE_3D||Te===t.TEXTURE_2D_ARRAY?n.texImage3D(Te,ge,ke,nt,st,Y.depth,0,Ue,be,null):n.texImage2D(Te,ge,ke,nt,st,0,Ue,be,null)}n.bindFramebuffer(t.FRAMEBUFFER,ue),He(Y)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,we,Te,Qe.__webglTexture,0,le(Y)):(Te===t.TEXTURE_2D||Te>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Te<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,we,Te,Qe.__webglTexture,ge),n.bindFramebuffer(t.FRAMEBUFFER,null)}function K(ue,Y,xe){if(t.bindRenderbuffer(t.RENDERBUFFER,ue),Y.depthBuffer){const we=Y.depthTexture,Te=we&&we.isDepthTexture?we.type:null,ge=N(Y.stencilBuffer,Te),Ue=Y.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;He(Y)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,le(Y),ge,Y.width,Y.height):xe?t.renderbufferStorageMultisample(t.RENDERBUFFER,le(Y),ge,Y.width,Y.height):t.renderbufferStorage(t.RENDERBUFFER,ge,Y.width,Y.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ue,t.RENDERBUFFER,ue)}else{const we=Y.textures;for(let Te=0;Te<we.length;Te++){const ge=we[Te],Ue=s.convert(ge.format,ge.colorSpace),be=s.convert(ge.type),ke=A(ge.internalFormat,Ue,be,ge.colorSpace);He(Y)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,le(Y),ke,Y.width,Y.height):xe?t.renderbufferStorageMultisample(t.RENDERBUFFER,le(Y),ke,Y.width,Y.height):t.renderbufferStorage(t.RENDERBUFFER,ke,Y.width,Y.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function fe(ue,Y,xe){const we=Y.isWebGLCubeRenderTarget===!0;if(n.bindFramebuffer(t.FRAMEBUFFER,ue),!(Y.depthTexture&&Y.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Te=r.get(Y.depthTexture);if(Te.__renderTarget=Y,(!Te.__webglTexture||Y.depthTexture.image.width!==Y.width||Y.depthTexture.image.height!==Y.height)&&(Y.depthTexture.image.width=Y.width,Y.depthTexture.image.height=Y.height,Y.depthTexture.needsUpdate=!0),we){if(Te.__webglInit===void 0&&(Te.__webglInit=!0,Y.depthTexture.addEventListener("dispose",k)),Te.__webglTexture===void 0){Te.__webglTexture=t.createTexture(),n.bindTexture(t.TEXTURE_CUBE_MAP,Te.__webglTexture),X(t.TEXTURE_CUBE_MAP,Y.depthTexture);const qe=s.convert(Y.depthTexture.format),Qe=s.convert(Y.depthTexture.type);let nt;Y.depthTexture.format===vh?nt=t.DEPTH_COMPONENT24:Y.depthTexture.format===u0&&(nt=t.DEPTH24_STENCIL8);for(let st=0;st<6;st++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+st,0,nt,Y.width,Y.height,0,qe,Qe,null)}}else V(Y.depthTexture,0);const ge=Te.__webglTexture,Ue=le(Y),be=we?t.TEXTURE_CUBE_MAP_POSITIVE_X+xe:t.TEXTURE_2D,ke=Y.depthTexture.format===u0?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(Y.depthTexture.format===vh)He(Y)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ke,be,ge,0,Ue):t.framebufferTexture2D(t.FRAMEBUFFER,ke,be,ge,0);else if(Y.depthTexture.format===u0)He(Y)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ke,be,ge,0,Ue):t.framebufferTexture2D(t.FRAMEBUFFER,ke,be,ge,0);else throw new Error("Unknown depthTexture format")}function he(ue){const Y=r.get(ue),xe=ue.isWebGLCubeRenderTarget===!0;if(Y.__boundDepthTexture!==ue.depthTexture){const we=ue.depthTexture;if(Y.__depthDisposeCallback&&Y.__depthDisposeCallback(),we){const Te=()=>{delete Y.__boundDepthTexture,delete Y.__depthDisposeCallback,we.removeEventListener("dispose",Te)};we.addEventListener("dispose",Te),Y.__depthDisposeCallback=Te}Y.__boundDepthTexture=we}if(ue.depthTexture&&!Y.__autoAllocateDepthBuffer)if(xe)for(let we=0;we<6;we++)fe(Y.__webglFramebuffer[we],ue,we);else{const we=ue.texture.mipmaps;we&&we.length>0?fe(Y.__webglFramebuffer[0],ue,0):fe(Y.__webglFramebuffer,ue,0)}else if(xe){Y.__webglDepthbuffer=[];for(let we=0;we<6;we++)if(n.bindFramebuffer(t.FRAMEBUFFER,Y.__webglFramebuffer[we]),Y.__webglDepthbuffer[we]===void 0)Y.__webglDepthbuffer[we]=t.createRenderbuffer(),K(Y.__webglDepthbuffer[we],ue,!1);else{const Te=ue.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ge=Y.__webglDepthbuffer[we];t.bindRenderbuffer(t.RENDERBUFFER,ge),t.framebufferRenderbuffer(t.FRAMEBUFFER,Te,t.RENDERBUFFER,ge)}}else{const we=ue.texture.mipmaps;if(we&&we.length>0?n.bindFramebuffer(t.FRAMEBUFFER,Y.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,Y.__webglFramebuffer),Y.__webglDepthbuffer===void 0)Y.__webglDepthbuffer=t.createRenderbuffer(),K(Y.__webglDepthbuffer,ue,!1);else{const Te=ue.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ge=Y.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ge),t.framebufferRenderbuffer(t.FRAMEBUFFER,Te,t.RENDERBUFFER,ge)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function ae(ue,Y,xe){const we=r.get(ue);Y!==void 0&&re(we.__webglFramebuffer,ue,ue.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),xe!==void 0&&he(ue)}function Se(ue){const Y=ue.texture,xe=r.get(ue),we=r.get(Y);ue.addEventListener("dispose",O);const Te=ue.textures,ge=ue.isWebGLCubeRenderTarget===!0,Ue=Te.length>1;if(Ue||(we.__webglTexture===void 0&&(we.__webglTexture=t.createTexture()),we.__version=Y.version,o.memory.textures++),ge){xe.__webglFramebuffer=[];for(let be=0;be<6;be++)if(Y.mipmaps&&Y.mipmaps.length>0){xe.__webglFramebuffer[be]=[];for(let ke=0;ke<Y.mipmaps.length;ke++)xe.__webglFramebuffer[be][ke]=t.createFramebuffer()}else xe.__webglFramebuffer[be]=t.createFramebuffer()}else{if(Y.mipmaps&&Y.mipmaps.length>0){xe.__webglFramebuffer=[];for(let be=0;be<Y.mipmaps.length;be++)xe.__webglFramebuffer[be]=t.createFramebuffer()}else xe.__webglFramebuffer=t.createFramebuffer();if(Ue)for(let be=0,ke=Te.length;be<ke;be++){const qe=r.get(Te[be]);qe.__webglTexture===void 0&&(qe.__webglTexture=t.createTexture(),o.memory.textures++)}if(ue.samples>0&&He(ue)===!1){xe.__webglMultisampledFramebuffer=t.createFramebuffer(),xe.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,xe.__webglMultisampledFramebuffer);for(let be=0;be<Te.length;be++){const ke=Te[be];xe.__webglColorRenderbuffer[be]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,xe.__webglColorRenderbuffer[be]);const qe=s.convert(ke.format,ke.colorSpace),Qe=s.convert(ke.type),nt=A(ke.internalFormat,qe,Qe,ke.colorSpace,ue.isXRRenderTarget===!0),st=le(ue);t.renderbufferStorageMultisample(t.RENDERBUFFER,st,nt,ue.width,ue.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+be,t.RENDERBUFFER,xe.__webglColorRenderbuffer[be])}t.bindRenderbuffer(t.RENDERBUFFER,null),ue.depthBuffer&&(xe.__webglDepthRenderbuffer=t.createRenderbuffer(),K(xe.__webglDepthRenderbuffer,ue,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(ge){n.bindTexture(t.TEXTURE_CUBE_MAP,we.__webglTexture),X(t.TEXTURE_CUBE_MAP,Y);for(let be=0;be<6;be++)if(Y.mipmaps&&Y.mipmaps.length>0)for(let ke=0;ke<Y.mipmaps.length;ke++)re(xe.__webglFramebuffer[be][ke],ue,Y,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+be,ke);else re(xe.__webglFramebuffer[be],ue,Y,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+be,0);S(Y)&&M(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Ue){for(let be=0,ke=Te.length;be<ke;be++){const qe=Te[be],Qe=r.get(qe);let nt=t.TEXTURE_2D;(ue.isWebGL3DRenderTarget||ue.isWebGLArrayRenderTarget)&&(nt=ue.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(nt,Qe.__webglTexture),X(nt,qe),re(xe.__webglFramebuffer,ue,qe,t.COLOR_ATTACHMENT0+be,nt,0),S(qe)&&M(nt)}n.unbindTexture()}else{let be=t.TEXTURE_2D;if((ue.isWebGL3DRenderTarget||ue.isWebGLArrayRenderTarget)&&(be=ue.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(be,we.__webglTexture),X(be,Y),Y.mipmaps&&Y.mipmaps.length>0)for(let ke=0;ke<Y.mipmaps.length;ke++)re(xe.__webglFramebuffer[ke],ue,Y,t.COLOR_ATTACHMENT0,be,ke);else re(xe.__webglFramebuffer,ue,Y,t.COLOR_ATTACHMENT0,be,0);S(Y)&&M(be),n.unbindTexture()}ue.depthBuffer&&he(ue)}function de(ue){const Y=ue.textures;for(let xe=0,we=Y.length;xe<we;xe++){const Te=Y[xe];if(S(Te)){const ge=T(ue),Ue=r.get(Te).__webglTexture;n.bindTexture(ge,Ue),M(ge),n.unbindTexture()}}}const Me=[],Ce=[];function Re(ue){if(ue.samples>0){if(He(ue)===!1){const Y=ue.textures,xe=ue.width,we=ue.height;let Te=t.COLOR_BUFFER_BIT;const ge=ue.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ue=r.get(ue),be=Y.length>1;if(be)for(let qe=0;qe<Y.length;qe++)n.bindFramebuffer(t.FRAMEBUFFER,Ue.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+qe,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Ue.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+qe,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Ue.__webglMultisampledFramebuffer);const ke=ue.texture.mipmaps;ke&&ke.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ue.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ue.__webglFramebuffer);for(let qe=0;qe<Y.length;qe++){if(ue.resolveDepthBuffer&&(ue.depthBuffer&&(Te|=t.DEPTH_BUFFER_BIT),ue.stencilBuffer&&ue.resolveStencilBuffer&&(Te|=t.STENCIL_BUFFER_BIT)),be){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Ue.__webglColorRenderbuffer[qe]);const Qe=r.get(Y[qe]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Qe,0)}t.blitFramebuffer(0,0,xe,we,0,0,xe,we,Te,t.NEAREST),l===!0&&(Me.length=0,Ce.length=0,Me.push(t.COLOR_ATTACHMENT0+qe),ue.depthBuffer&&ue.resolveDepthBuffer===!1&&(Me.push(ge),Ce.push(ge),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Ce)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,Me))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),be)for(let qe=0;qe<Y.length;qe++){n.bindFramebuffer(t.FRAMEBUFFER,Ue.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+qe,t.RENDERBUFFER,Ue.__webglColorRenderbuffer[qe]);const Qe=r.get(Y[qe]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Ue.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+qe,t.TEXTURE_2D,Qe,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ue.__webglMultisampledFramebuffer)}else if(ue.depthBuffer&&ue.resolveDepthBuffer===!1&&l){const Y=ue.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[Y])}}}function le(ue){return Math.min(i.maxSamples,ue.samples)}function He(ue){const Y=r.get(ue);return ue.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&Y.__useRenderToTexture!==!1}function Le(ue){const Y=o.render.frame;f.get(ue)!==Y&&(f.set(ue,Y),ue.update())}function ze(ue,Y){const xe=ue.colorSpace,we=ue.format,Te=ue.type;return ue.isCompressedTexture===!0||ue.isVideoTexture===!0||xe!==R0&&xe!==xp&&(li.getTransfer(xe)===Hi?(we!==bl||Te!==ql)&&En("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):qn("WebGLTextures: Unsupported texture color space:",xe)),Y}function Ve(ue){return typeof HTMLImageElement<"u"&&ue instanceof HTMLImageElement?(c.width=ue.naturalWidth||ue.width,c.height=ue.naturalHeight||ue.height):typeof VideoFrame<"u"&&ue instanceof VideoFrame?(c.width=ue.displayWidth,c.height=ue.displayHeight):(c.width=ue.width,c.height=ue.height),c}this.allocateTextureUnit=G,this.resetTextureUnits=$,this.setTexture2D=V,this.setTexture2DArray=W,this.setTexture3D=J,this.setTextureCube=ne,this.rebindTextures=ae,this.setupRenderTarget=Se,this.updateRenderTargetMipmap=de,this.updateMultisampleRenderTarget=Re,this.setupDepthRenderbuffer=he,this.setupFrameBufferTexture=re,this.useMultisampledRTT=He,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function BZ(t,e){function n(r,i=xp){let s;const o=li.getTransfer(i);if(r===ql)return t.UNSIGNED_BYTE;if(r===qC)return t.UNSIGNED_SHORT_4_4_4_4;if(r===XC)return t.UNSIGNED_SHORT_5_5_5_1;if(r===FP)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===UP)return t.UNSIGNED_INT_10F_11F_11F_REV;if(r===jP)return t.BYTE;if(r===zP)return t.SHORT;if(r===Oy)return t.UNSIGNED_SHORT;if(r===$C)return t.INT;if(r===xd)return t.UNSIGNED_INT;if(r===Ql)return t.FLOAT;if(r===xh)return t.HALF_FLOAT;if(r===BP)return t.ALPHA;if(r===HP)return t.RGB;if(r===bl)return t.RGBA;if(r===vh)return t.DEPTH_COMPONENT;if(r===u0)return t.DEPTH_STENCIL;if(r===YC)return t.RED;if(r===e3)return t.RED_INTEGER;if(r===zx)return t.RG;if(r===KC)return t.RG_INTEGER;if(r===ZC)return t.RGBA_INTEGER;if(r===yw||r===bw||r===_w||r===ww)if(o===Hi)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===yw)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===bw)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===_w)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===ww)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===yw)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===bw)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===_w)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===ww)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===k5||r===R5||r===P5||r===I5)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===k5)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===R5)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===P5)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===I5)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===D5||r===O5||r===L5||r===j5||r===z5||r===F5||r===U5)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===D5||r===O5)return o===Hi?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===L5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(r===j5)return s.COMPRESSED_R11_EAC;if(r===z5)return s.COMPRESSED_SIGNED_R11_EAC;if(r===F5)return s.COMPRESSED_RG11_EAC;if(r===U5)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(r===B5||r===H5||r===G5||r===V5||r===W5||r===$5||r===q5||r===X5||r===Y5||r===K5||r===Z5||r===Q5||r===J5||r===eT)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===B5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===H5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===G5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===V5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===W5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===$5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===q5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===X5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===Y5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===K5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===Z5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Q5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===J5)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===eT)return o===Hi?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===tT||r===nT||r===rT)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===tT)return o===Hi?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===nT)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===rT)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===iT||r===sT||r===oT||r===aT)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===iT)return s.COMPRESSED_RED_RGTC1_EXT;if(r===sT)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===oT)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===aT)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Ly?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}const mAe=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,gAe=`
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 xAe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const r=new QP(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 Mu({vertexShader:mAe,fragmentShader:gAe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Xs(new Wp(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class vAe extends Eh{constructor(e,n){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,f=null,h=null,m=null,x=null,b=null;const _=typeof XRWebGLBinding<"u",S=new xAe,M={},T=n.getContextAttributes();let A=null,N=null;const D=[],k=[],O=new qt;let R=null;const L=new lo;L.viewport=new pi;const B=new lo;B.viewport=new pi;const H=[L,B],$=new EZ;let G=null,Z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Q){let se=D[Q];return se===void 0&&(se=new S2,D[Q]=se),se.getTargetRaySpace()},this.getControllerGrip=function(Q){let se=D[Q];return se===void 0&&(se=new S2,D[Q]=se),se.getGripSpace()},this.getHand=function(Q){let se=D[Q];return se===void 0&&(se=new S2,D[Q]=se),se.getHandSpace()};function V(Q){const se=k.indexOf(Q.inputSource);if(se===-1)return;const re=D[se];re!==void 0&&(re.update(Q.inputSource,Q.frame,c||o),re.dispatchEvent({type:Q.type,data:Q.inputSource}))}function W(){i.removeEventListener("select",V),i.removeEventListener("selectstart",V),i.removeEventListener("selectend",V),i.removeEventListener("squeeze",V),i.removeEventListener("squeezestart",V),i.removeEventListener("squeezeend",V),i.removeEventListener("end",W),i.removeEventListener("inputsourceschange",J);for(let Q=0;Q<D.length;Q++){const se=k[Q];se!==null&&(k[Q]=null,D[Q].disconnect(se))}G=null,Z=null,S.reset();for(const Q in M)delete M[Q];e.setRenderTarget(A),x=null,m=null,h=null,i=null,N=null,oe.stop(),r.isPresenting=!1,e.setPixelRatio(R),e.setSize(O.width,O.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Q){s=Q,r.isPresenting===!0&&En("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Q){a=Q,r.isPresenting===!0&&En("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Q){c=Q},this.getBaseLayer=function(){return m!==null?m:x},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(Q){if(i=Q,i!==null){if(A=e.getRenderTarget(),i.addEventListener("select",V),i.addEventListener("selectstart",V),i.addEventListener("selectend",V),i.addEventListener("squeeze",V),i.addEventListener("squeezestart",V),i.addEventListener("squeezeend",V),i.addEventListener("end",W),i.addEventListener("inputsourceschange",J),T.xrCompatible!==!0&&await n.makeXRCompatible(),R=e.getPixelRatio(),e.getSize(O),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let re=null,K=null,fe=null;T.depth&&(fe=T.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,re=T.stencil?u0:vh,K=T.stencil?Ly:xd);const he={colorFormat:n.RGBA8,depthFormat:fe,scaleFactor:s};h=this.getBinding(),m=h.createProjectionLayer(he),i.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),N=new bu(m.textureWidth,m.textureHeight,{format:bl,type:ql,depthTexture:new Fy(m.textureWidth,m.textureHeight,K,void 0,void 0,void 0,void 0,void 0,void 0,re),stencilBuffer:T.stencil,colorSpace:e.outputColorSpace,samples:T.antialias?4:0,resolveDepthBuffer:m.ignoreDepthValues===!1,resolveStencilBuffer:m.ignoreDepthValues===!1})}else{const re={antialias:T.antialias,alpha:!0,depth:T.depth,stencil:T.stencil,framebufferScaleFactor:s};x=new XRWebGLLayer(i,n,re),i.updateRenderState({baseLayer:x}),e.setPixelRatio(1),e.setSize(x.framebufferWidth,x.framebufferHeight,!1),N=new bu(x.framebufferWidth,x.framebufferHeight,{format:bl,type:ql,colorSpace:e.outputColorSpace,stencilBuffer:T.stencil,resolveDepthBuffer:x.ignoreDepthValues===!1,resolveStencilBuffer:x.ignoreDepthValues===!1})}N.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),oe.setContext(i),oe.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function J(Q){for(let se=0;se<Q.removed.length;se++){const re=Q.removed[se],K=k.indexOf(re);K>=0&&(k[K]=null,D[K].disconnect(re))}for(let se=0;se<Q.added.length;se++){const re=Q.added[se];let K=k.indexOf(re);if(K===-1){for(let he=0;he<D.length;he++)if(he>=k.length){k.push(re),K=he;break}else if(k[he]===null){k[he]=re,K=he;break}if(K===-1)break}const fe=D[K];fe&&fe.connect(re)}}const ne=new Ge,ie=new Ge;function z(Q,se,re){ne.setFromMatrixPosition(se.matrixWorld),ie.setFromMatrixPosition(re.matrixWorld);const K=ne.distanceTo(ie),fe=se.projectionMatrix.elements,he=re.projectionMatrix.elements,ae=fe[14]/(fe[10]-1),Se=fe[14]/(fe[10]+1),de=(fe[9]+1)/fe[5],Me=(fe[9]-1)/fe[5],Ce=(fe[8]-1)/fe[0],Re=(he[8]+1)/he[0],le=ae*Ce,He=ae*Re,Le=K/(-Ce+Re),ze=Le*-Ce;if(se.matrixWorld.decompose(Q.position,Q.quaternion,Q.scale),Q.translateX(ze),Q.translateZ(Le),Q.matrixWorld.compose(Q.position,Q.quaternion,Q.scale),Q.matrixWorldInverse.copy(Q.matrixWorld).invert(),fe[10]===-1)Q.projectionMatrix.copy(se.projectionMatrix),Q.projectionMatrixInverse.copy(se.projectionMatrixInverse);else{const Ve=ae+Le,ue=Se+Le,Y=le-ze,xe=He+(K-ze),we=de*Se/ue*Ve,Te=Me*Se/ue*Ve;Q.projectionMatrix.makePerspective(Y,xe,we,Te,Ve,ue),Q.projectionMatrixInverse.copy(Q.projectionMatrix).invert()}}function j(Q,se){se===null?Q.matrixWorld.copy(Q.matrix):Q.matrixWorld.multiplyMatrices(se.matrixWorld,Q.matrix),Q.matrixWorldInverse.copy(Q.matrixWorld).invert()}this.updateCamera=function(Q){if(i===null)return;let se=Q.near,re=Q.far;S.texture!==null&&(S.depthNear>0&&(se=S.depthNear),S.depthFar>0&&(re=S.depthFar)),$.near=B.near=L.near=se,$.far=B.far=L.far=re,(G!==$.near||Z!==$.far)&&(i.updateRenderState({depthNear:$.near,depthFar:$.far}),G=$.near,Z=$.far),$.layers.mask=Q.layers.mask|6,L.layers.mask=$.layers.mask&-5,B.layers.mask=$.layers.mask&-3;const K=Q.parent,fe=$.cameras;j($,K);for(let he=0;he<fe.length;he++)j(fe[he],K);fe.length===2?z($,L,B):$.projectionMatrix.copy(L.projectionMatrix),X(Q,$,K)};function X(Q,se,re){re===null?Q.matrix.copy(se.matrixWorld):(Q.matrix.copy(re.matrixWorld),Q.matrix.invert(),Q.matrix.multiply(se.matrixWorld)),Q.matrix.decompose(Q.position,Q.quaternion,Q.scale),Q.updateMatrixWorld(!0),Q.projectionMatrix.copy(se.projectionMatrix),Q.projectionMatrixInverse.copy(se.projectionMatrixInverse),Q.isPerspectiveCamera&&(Q.fov=jy*2*Math.atan(1/Q.projectionMatrix.elements[5]),Q.zoom=1)}this.getCamera=function(){return $},this.getFoveation=function(){if(!(m===null&&x===null))return l},this.setFoveation=function(Q){l=Q,m!==null&&(m.fixedFoveation=Q),x!==null&&x.fixedFoveation!==void 0&&(x.fixedFoveation=Q)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh($)},this.getCameraTexture=function(Q){return M[Q]};let F=null;function ce(Q,se){if(f=se.getViewerPose(c||o),b=se,f!==null){const re=f.views;x!==null&&(e.setRenderTargetFramebuffer(N,x.framebuffer),e.setRenderTarget(N));let K=!1;re.length!==$.cameras.length&&($.cameras.length=0,K=!0);for(let Se=0;Se<re.length;Se++){const de=re[Se];let Me=null;if(x!==null)Me=x.getViewport(de);else{const Re=h.getViewSubImage(m,de);Me=Re.viewport,Se===0&&(e.setRenderTargetTextures(N,Re.colorTexture,Re.depthStencilTexture),e.setRenderTarget(N))}let Ce=H[Se];Ce===void 0&&(Ce=new lo,Ce.layers.enable(Se),Ce.viewport=new pi,H[Se]=Ce),Ce.matrix.fromArray(de.transform.matrix),Ce.matrix.decompose(Ce.position,Ce.quaternion,Ce.scale),Ce.projectionMatrix.fromArray(de.projectionMatrix),Ce.projectionMatrixInverse.copy(Ce.projectionMatrix).invert(),Ce.viewport.set(Me.x,Me.y,Me.width,Me.height),Se===0&&($.matrix.copy(Ce.matrix),$.matrix.decompose($.position,$.quaternion,$.scale)),K===!0&&$.cameras.push(Ce)}const fe=i.enabledFeatures;if(fe&&fe.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){h=r.getBinding();const Se=h.getDepthInformation(re[0]);Se&&Se.isValid&&Se.texture&&S.init(Se,i.renderState)}if(fe&&fe.includes("camera-access")&&_){e.state.unbindTexture(),h=r.getBinding();for(let Se=0;Se<re.length;Se++){const de=re[Se].camera;if(de){let Me=M[de];Me||(Me=new QP,M[de]=Me);const Ce=h.getCameraImage(de);Me.sourceTexture=Ce}}}}for(let re=0;re<D.length;re++){const K=k[re],fe=D[re];K!==null&&fe!==void 0&&fe.update(K,se,c||o)}F&&F(Q,se),se.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:se}),b=null}const oe=new LZ;oe.setAnimationLoop(ce),this.setAnimationLoop=function(Q){F=Q},this.dispose=function(){}}}const Jg=new Su,yAe=new pr;function bAe(t,e){function n(S,M){S.matrixAutoUpdate===!0&&S.updateMatrix(),M.value.copy(S.matrix)}function r(S,M){M.color.getRGB(S.fogColor.value,iZ(t)),M.isFog?(S.fogNear.value=M.near,S.fogFar.value=M.far):M.isFogExp2&&(S.fogDensity.value=M.density)}function i(S,M,T,A,N){M.isMeshBasicMaterial?s(S,M):M.isMeshLambertMaterial?(s(S,M),M.envMap&&(S.envMapIntensity.value=M.envMapIntensity)):M.isMeshToonMaterial?(s(S,M),h(S,M)):M.isMeshPhongMaterial?(s(S,M),f(S,M),M.envMap&&(S.envMapIntensity.value=M.envMapIntensity)):M.isMeshStandardMaterial?(s(S,M),m(S,M),M.isMeshPhysicalMaterial&&x(S,M,N)):M.isMeshMatcapMaterial?(s(S,M),b(S,M)):M.isMeshDepthMaterial?s(S,M):M.isMeshDistanceMaterial?(s(S,M),_(S,M)):M.isMeshNormalMaterial?s(S,M):M.isLineBasicMaterial?(o(S,M),M.isLineDashedMaterial&&a(S,M)):M.isPointsMaterial?l(S,M,T,A):M.isSpriteMaterial?c(S,M):M.isShadowMaterial?(S.color.value.copy(M.color),S.opacity.value=M.opacity):M.isShaderMaterial&&(M.uniformsNeedUpdate=!1)}function s(S,M){S.opacity.value=M.opacity,M.color&&S.diffuse.value.copy(M.color),M.emissive&&S.emissive.value.copy(M.emissive).multiplyScalar(M.emissiveIntensity),M.map&&(S.map.value=M.map,n(M.map,S.mapTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,n(M.alphaMap,S.alphaMapTransform)),M.bumpMap&&(S.bumpMap.value=M.bumpMap,n(M.bumpMap,S.bumpMapTransform),S.bumpScale.value=M.bumpScale,M.side===Jl&&(S.bumpScale.value*=-1)),M.normalMap&&(S.normalMap.value=M.normalMap,n(M.normalMap,S.normalMapTransform),S.normalScale.value.copy(M.normalScale),M.side===Jl&&S.normalScale.value.negate()),M.displacementMap&&(S.displacementMap.value=M.displacementMap,n(M.displacementMap,S.displacementMapTransform),S.displacementScale.value=M.displacementScale,S.displacementBias.value=M.displacementBias),M.emissiveMap&&(S.emissiveMap.value=M.emissiveMap,n(M.emissiveMap,S.emissiveMapTransform)),M.specularMap&&(S.specularMap.value=M.specularMap,n(M.specularMap,S.specularMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest);const T=e.get(M),A=T.envMap,N=T.envMapRotation;A&&(S.envMap.value=A,Jg.copy(N),Jg.x*=-1,Jg.y*=-1,Jg.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(Jg.y*=-1,Jg.z*=-1),S.envMapRotation.value.setFromMatrix4(yAe.makeRotationFromEuler(Jg)),S.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=M.reflectivity,S.ior.value=M.ior,S.refractionRatio.value=M.refractionRatio),M.lightMap&&(S.lightMap.value=M.lightMap,S.lightMapIntensity.value=M.lightMapIntensity,n(M.lightMap,S.lightMapTransform)),M.aoMap&&(S.aoMap.value=M.aoMap,S.aoMapIntensity.value=M.aoMapIntensity,n(M.aoMap,S.aoMapTransform))}function o(S,M){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,M.map&&(S.map.value=M.map,n(M.map,S.mapTransform))}function a(S,M){S.dashSize.value=M.dashSize,S.totalSize.value=M.dashSize+M.gapSize,S.scale.value=M.scale}function l(S,M,T,A){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,S.size.value=M.size*T,S.scale.value=A*.5,M.map&&(S.map.value=M.map,n(M.map,S.uvTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,n(M.alphaMap,S.alphaMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest)}function c(S,M){S.diffuse.value.copy(M.color),S.opacity.value=M.opacity,S.rotation.value=M.rotation,M.map&&(S.map.value=M.map,n(M.map,S.mapTransform)),M.alphaMap&&(S.alphaMap.value=M.alphaMap,n(M.alphaMap,S.alphaMapTransform)),M.alphaTest>0&&(S.alphaTest.value=M.alphaTest)}function f(S,M){S.specular.value.copy(M.specular),S.shininess.value=Math.max(M.shininess,1e-4)}function h(S,M){M.gradientMap&&(S.gradientMap.value=M.gradientMap)}function m(S,M){S.metalness.value=M.metalness,M.metalnessMap&&(S.metalnessMap.value=M.metalnessMap,n(M.metalnessMap,S.metalnessMapTransform)),S.roughness.value=M.roughness,M.roughnessMap&&(S.roughnessMap.value=M.roughnessMap,n(M.roughnessMap,S.roughnessMapTransform)),M.envMap&&(S.envMapIntensity.value=M.envMapIntensity)}function x(S,M,T){S.ior.value=M.ior,M.sheen>0&&(S.sheenColor.value.copy(M.sheenColor).multiplyScalar(M.sheen),S.sheenRoughness.value=M.sheenRoughness,M.sheenColorMap&&(S.sheenColorMap.value=M.sheenColorMap,n(M.sheenColorMap,S.sheenColorMapTransform)),M.sheenRoughnessMap&&(S.sheenRoughnessMap.value=M.sheenRoughnessMap,n(M.sheenRoughnessMap,S.sheenRoughnessMapTransform))),M.clearcoat>0&&(S.clearcoat.value=M.clearcoat,S.clearcoatRoughness.value=M.clearcoatRoughness,M.clearcoatMap&&(S.clearcoatMap.value=M.clearcoatMap,n(M.clearcoatMap,S.clearcoatMapTransform)),M.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=M.clearcoatRoughnessMap,n(M.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),M.clearcoatNormalMap&&(S.clearcoatNormalMap.value=M.clearcoatNormalMap,n(M.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(M.clearcoatNormalScale),M.side===Jl&&S.clearcoatNormalScale.value.negate())),M.dispersion>0&&(S.dispersion.value=M.dispersion),M.iridescence>0&&(S.iridescence.value=M.iridescence,S.iridescenceIOR.value=M.iridescenceIOR,S.iridescenceThicknessMinimum.value=M.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=M.iridescenceThicknessRange[1],M.iridescenceMap&&(S.iridescenceMap.value=M.iridescenceMap,n(M.iridescenceMap,S.iridescenceMapTransform)),M.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=M.iridescenceThicknessMap,n(M.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),M.transmission>0&&(S.transmission.value=M.transmission,S.transmissionSamplerMap.value=T.texture,S.transmissionSamplerSize.value.set(T.width,T.height),M.transmissionMap&&(S.transmissionMap.value=M.transmissionMap,n(M.transmissionMap,S.transmissionMapTransform)),S.thickness.value=M.thickness,M.thicknessMap&&(S.thicknessMap.value=M.thicknessMap,n(M.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=M.attenuationDistance,S.attenuationColor.value.copy(M.attenuationColor)),M.anisotropy>0&&(S.anisotropyVector.value.set(M.anisotropy*Math.cos(M.anisotropyRotation),M.anisotropy*Math.sin(M.anisotropyRotation)),M.anisotropyMap&&(S.anisotropyMap.value=M.anisotropyMap,n(M.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=M.specularIntensity,S.specularColor.value.copy(M.specularColor),M.specularColorMap&&(S.specularColorMap.value=M.specularColorMap,n(M.specularColorMap,S.specularColorMapTransform)),M.specularIntensityMap&&(S.specularIntensityMap.value=M.specularIntensityMap,n(M.specularIntensityMap,S.specularIntensityMapTransform))}function b(S,M){M.matcap&&(S.matcap.value=M.matcap)}function _(S,M){const T=e.get(M).light;S.referencePosition.value.setFromMatrixPosition(T.matrixWorld),S.nearDistance.value=T.shadow.camera.near,S.farDistance.value=T.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function _Ae(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(T,A){const N=A.program;r.uniformBlockBinding(T,N)}function c(T,A){let N=i[T.id];N===void 0&&(b(T),N=f(T),i[T.id]=N,T.addEventListener("dispose",S));const D=A.program;r.updateUBOMapping(T,D);const k=e.render.frame;s[T.id]!==k&&(m(T),s[T.id]=k)}function f(T){const A=h();T.__bindingPointIndex=A;const N=t.createBuffer(),D=T.__size,k=T.usage;return t.bindBuffer(t.UNIFORM_BUFFER,N),t.bufferData(t.UNIFORM_BUFFER,D,k),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,A,N),N}function h(){for(let T=0;T<a;T++)if(o.indexOf(T)===-1)return o.push(T),T;return qn("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function m(T){const A=i[T.id],N=T.uniforms,D=T.__cache;t.bindBuffer(t.UNIFORM_BUFFER,A);for(let k=0,O=N.length;k<O;k++){const R=Array.isArray(N[k])?N[k]:[N[k]];for(let L=0,B=R.length;L<B;L++){const H=R[L];if(x(H,k,L,D)===!0){const $=H.__offset,G=Array.isArray(H.value)?H.value:[H.value];let Z=0;for(let V=0;V<G.length;V++){const W=G[V],J=_(W);typeof W=="number"||typeof W=="boolean"?(H.__data[0]=W,t.bufferSubData(t.UNIFORM_BUFFER,$+Z,H.__data)):W.isMatrix3?(H.__data[0]=W.elements[0],H.__data[1]=W.elements[1],H.__data[2]=W.elements[2],H.__data[3]=0,H.__data[4]=W.elements[3],H.__data[5]=W.elements[4],H.__data[6]=W.elements[5],H.__data[7]=0,H.__data[8]=W.elements[6],H.__data[9]=W.elements[7],H.__data[10]=W.elements[8],H.__data[11]=0):(W.toArray(H.__data,Z),Z+=J.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,$,H.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function x(T,A,N,D){const k=T.value,O=A+"_"+N;if(D[O]===void 0)return typeof k=="number"||typeof k=="boolean"?D[O]=k:D[O]=k.clone(),!0;{const R=D[O];if(typeof k=="number"||typeof k=="boolean"){if(R!==k)return D[O]=k,!0}else if(R.equals(k)===!1)return R.copy(k),!0}return!1}function b(T){const A=T.uniforms;let N=0;const D=16;for(let O=0,R=A.length;O<R;O++){const L=Array.isArray(A[O])?A[O]:[A[O]];for(let B=0,H=L.length;B<H;B++){const $=L[B],G=Array.isArray($.value)?$.value:[$.value];for(let Z=0,V=G.length;Z<V;Z++){const W=G[Z],J=_(W),ne=N%D,ie=ne%J.boundary,z=ne+ie;N+=ie,z!==0&&D-z<J.storage&&(N+=D-z),$.__data=new Float32Array(J.storage/Float32Array.BYTES_PER_ELEMENT),$.__offset=N,N+=J.storage}}}const k=N%D;return k>0&&(N+=D-k),T.__size=N,T.__cache={},this}function _(T){const A={boundary:0,storage:0};return typeof T=="number"||typeof T=="boolean"?(A.boundary=4,A.storage=4):T.isVector2?(A.boundary=8,A.storage=8):T.isVector3||T.isColor?(A.boundary=16,A.storage=12):T.isVector4?(A.boundary=16,A.storage=16):T.isMatrix3?(A.boundary=48,A.storage=48):T.isMatrix4?(A.boundary=64,A.storage=64):T.isTexture?En("WebGLRenderer: Texture samplers can not be part of an uniforms group."):En("WebGLRenderer: Unsupported uniform value type.",T),A}function S(T){const A=T.target;A.removeEventListener("dispose",S);const N=o.indexOf(A.__bindingPointIndex);o.splice(N,1),t.deleteBuffer(i[A.id]),delete i[A.id],delete s[A.id]}function M(){for(const T in i)t.deleteBuffer(i[T]);o=[],i={},s={}}return{bind:l,update:c,dispose:M}}const wAe=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 Vf=null;function SAe(){return Vf===null&&(Vf=new rf(wAe,16,16,zx,xh),Vf.name="DFG_LUT",Vf.minFilter=as,Vf.magFilter=as,Vf.wrapS=Uc,Vf.wrapT=Uc,Vf.generateMipmaps=!1,Vf.needsUpdate=!0),Vf}class HZ{constructor(e={}){const{canvas:n=IK(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:m=!1,outputBufferType:x=ql}=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 _=x,S=new Set([ZC,KC,e3]),M=new Set([ql,xd,Oy,Ly,qC,XC]),T=new Uint32Array(4),A=new Int32Array(4);let N=null,D=null;const k=[],O=[];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=vu,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const L=this;let B=!1;this._outputColorSpace=yl;let H=0,$=0,G=null,Z=-1,V=null;const W=new pi,J=new pi;let ne=null;const ie=new Rn(0);let z=0,j=n.width,X=n.height,F=1,ce=null,oe=null;const Q=new pi(0,0,j,X),se=new pi(0,0,j,X);let re=!1;const K=new cb;let fe=!1,he=!1;const ae=new pr,Se=new Ge,de=new pi,Me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ce=!1;function Re(){return G===null?F:1}let le=r;function He(_e,tt){return n.getContext(_e,tt)}try{const _e={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:f,failIfMajorPerformanceCaveat:h};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${QS}`),n.addEventListener("webglcontextlost",Ae,!1),n.addEventListener("webglcontextrestored",We,!1),n.addEventListener("webglcontextcreationerror",De,!1),le===null){const tt="webgl2";if(le=He(tt,_e),le===null)throw He(tt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(_e){throw qn("WebGLRenderer: "+_e.message),_e}let Le,ze,Ve,ue,Y,xe,we,Te,ge,Ue,be,ke,qe,Qe,nt,st,Pe,Ke,rt,ye,$e,Ze,ft;function lt(){Le=new TCe(le),Le.init(),$e=new BZ(le,Le),ze=new xCe(le,Le,e,$e),Ve=new hAe(le,Le),ze.reversedDepthBuffer&&m&&Ve.buffers.depth.setReversed(!0),ue=new ACe(le),Y=new JEe,xe=new pAe(le,Le,Ve,Y,ze,$e,ue),we=new MCe(L),Te=new I2e(le),Ze=new mCe(le,Te),ge=new CCe(le,Te,ue,Ze),Ue=new kCe(le,ge,Te,Ze,ue),Ke=new NCe(le,ze,xe),nt=new vCe(Y),be=new QEe(L,we,Le,ze,Ze,nt),ke=new bAe(L,Y),qe=new tAe,Qe=new aAe(Le),Pe=new pCe(L,we,Ve,Ue,b,l),st=new fAe(L,Ue,ze),ft=new _Ae(le,ue,ze,Ve),rt=new gCe(le,Le,ue),ye=new ECe(le,Le,ue),ue.programs=be.programs,L.capabilities=ze,L.extensions=Le,L.properties=Y,L.renderLists=qe,L.shadowMap=st,L.state=Ve,L.info=ue}lt(),_!==ql&&(R=new PCe(_,n.width,n.height,i,s));const Je=new vAe(L,le);this.xr=Je,this.getContext=function(){return le},this.getContextAttributes=function(){return le.getContextAttributes()},this.forceContextLoss=function(){const _e=Le.get("WEBGL_lose_context");_e&&_e.loseContext()},this.forceContextRestore=function(){const _e=Le.get("WEBGL_lose_context");_e&&_e.restoreContext()},this.getPixelRatio=function(){return F},this.setPixelRatio=function(_e){_e!==void 0&&(F=_e,this.setSize(j,X,!1))},this.getSize=function(_e){return _e.set(j,X)},this.setSize=function(_e,tt,gt=!0){if(Je.isPresenting){En("WebGLRenderer: Can't change size while VR device is presenting.");return}j=_e,X=tt,n.width=Math.floor(_e*F),n.height=Math.floor(tt*F),gt===!0&&(n.style.width=_e+"px",n.style.height=tt+"px"),R!==null&&R.setSize(n.width,n.height),this.setViewport(0,0,_e,tt)},this.getDrawingBufferSize=function(_e){return _e.set(j*F,X*F).floor()},this.setDrawingBufferSize=function(_e,tt,gt){j=_e,X=tt,F=gt,n.width=Math.floor(_e*gt),n.height=Math.floor(tt*gt),this.setViewport(0,0,_e,tt)},this.setEffects=function(_e){if(_===ql){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(_e){for(let tt=0;tt<_e.length;tt++)if(_e[tt].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}R.setEffects(_e||[])},this.getCurrentViewport=function(_e){return _e.copy(W)},this.getViewport=function(_e){return _e.copy(Q)},this.setViewport=function(_e,tt,gt,pt){_e.isVector4?Q.set(_e.x,_e.y,_e.z,_e.w):Q.set(_e,tt,gt,pt),Ve.viewport(W.copy(Q).multiplyScalar(F).round())},this.getScissor=function(_e){return _e.copy(se)},this.setScissor=function(_e,tt,gt,pt){_e.isVector4?se.set(_e.x,_e.y,_e.z,_e.w):se.set(_e,tt,gt,pt),Ve.scissor(J.copy(se).multiplyScalar(F).round())},this.getScissorTest=function(){return re},this.setScissorTest=function(_e){Ve.setScissorTest(re=_e)},this.setOpaqueSort=function(_e){ce=_e},this.setTransparentSort=function(_e){oe=_e},this.getClearColor=function(_e){return _e.copy(Pe.getClearColor())},this.setClearColor=function(){Pe.setClearColor(...arguments)},this.getClearAlpha=function(){return Pe.getClearAlpha()},this.setClearAlpha=function(){Pe.setClearAlpha(...arguments)},this.clear=function(_e=!0,tt=!0,gt=!0){let pt=0;if(_e){let xt=!1;if(G!==null){const $t=G.texture.format;xt=S.has($t)}if(xt){const $t=G.texture.type,sn=M.has($t),Zt=Pe.getClearColor(),Fe=Pe.getClearAlpha(),bt=Zt.r,Tt=Zt.g,Yt=Zt.b;sn?(T[0]=bt,T[1]=Tt,T[2]=Yt,T[3]=Fe,le.clearBufferuiv(le.COLOR,0,T)):(A[0]=bt,A[1]=Tt,A[2]=Yt,A[3]=Fe,le.clearBufferiv(le.COLOR,0,A))}else pt|=le.COLOR_BUFFER_BIT}tt&&(pt|=le.DEPTH_BUFFER_BIT),gt&&(pt|=le.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),pt!==0&&le.clear(pt)},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",We,!1),n.removeEventListener("webglcontextcreationerror",De,!1),Pe.dispose(),qe.dispose(),Qe.dispose(),Y.dispose(),we.dispose(),Ue.dispose(),Ze.dispose(),ft.dispose(),be.dispose(),Je.dispose(),Je.removeEventListener("sessionstart",Vt),Je.removeEventListener("sessionend",rn),Bt.stop()};function Ae(_e){_e.preventDefault(),eS("WebGLRenderer: Context Lost."),B=!0}function We(){eS("WebGLRenderer: Context Restored."),B=!1;const _e=ue.autoReset,tt=st.enabled,gt=st.autoUpdate,pt=st.needsUpdate,xt=st.type;lt(),ue.autoReset=_e,st.enabled=tt,st.autoUpdate=gt,st.needsUpdate=pt,st.type=xt}function De(_e){qn("WebGLRenderer: A WebGL context could not be created. Reason: ",_e.statusMessage)}function Ne(_e){const tt=_e.target;tt.removeEventListener("dispose",Ne),ot(tt)}function ot(_e){dt(_e),Y.remove(_e)}function dt(_e){const tt=Y.get(_e).programs;tt!==void 0&&(tt.forEach(function(gt){be.releaseProgram(gt)}),_e.isShaderMaterial&&be.releaseShaderCache(_e))}this.renderBufferDirect=function(_e,tt,gt,pt,xt,$t){tt===null&&(tt=Me);const sn=xt.isMesh&&xt.matrixWorld.determinant()<0,Zt=Ot(_e,tt,gt,pt,xt);Ve.setMaterial(pt,sn);let Fe=gt.index,bt=1;if(pt.wireframe===!0){if(Fe=ge.getWireframeAttribute(gt),Fe===void 0)return;bt=2}const Tt=gt.drawRange,Yt=gt.attributes.position;let Ht=Tt.start*bt,Cn=(Tt.start+Tt.count)*bt;$t!==null&&(Ht=Math.max(Ht,$t.start*bt),Cn=Math.min(Cn,($t.start+$t.count)*bt)),Fe!==null?(Ht=Math.max(Ht,0),Cn=Math.min(Cn,Fe.count)):Yt!=null&&(Ht=Math.max(Ht,0),Cn=Math.min(Cn,Yt.count));const zn=Cn-Ht;if(zn<0||zn===1/0)return;Ze.setup(xt,pt,Zt,gt,Fe);let Zn,Xn=rt;if(Fe!==null&&(Zn=Te.get(Fe),Xn=ye,Xn.setIndex(Zn)),xt.isMesh)pt.wireframe===!0?(Ve.setLineWidth(pt.wireframeLinewidth*Re()),Xn.setMode(le.LINES)):Xn.setMode(le.TRIANGLES);else if(xt.isLine){let ir=pt.linewidth;ir===void 0&&(ir=1),Ve.setLineWidth(ir*Re()),xt.isLineSegments?Xn.setMode(le.LINES):xt.isLineLoop?Xn.setMode(le.LINE_LOOP):Xn.setMode(le.LINE_STRIP)}else xt.isPoints?Xn.setMode(le.POINTS):xt.isSprite&&Xn.setMode(le.TRIANGLES);if(xt.isBatchedMesh)if(xt._multiDrawInstances!==null)tS("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),Xn.renderMultiDrawInstances(xt._multiDrawStarts,xt._multiDrawCounts,xt._multiDrawCount,xt._multiDrawInstances);else if(Le.get("WEBGL_multi_draw"))Xn.renderMultiDraw(xt._multiDrawStarts,xt._multiDrawCounts,xt._multiDrawCount);else{const ir=xt._multiDrawStarts,dn=xt._multiDrawCounts,Wi=xt._multiDrawCount,vn=Fe?Te.get(Fe).bytesPerElement:1,ts=Y.get(pt).currentProgram.getUniforms();for(let Ds=0;Ds<Wi;Ds++)ts.setValue(le,"_gl_DrawID",Ds),Xn.render(ir[Ds]/vn,dn[Ds])}else if(xt.isInstancedMesh)Xn.renderInstances(Ht,zn,xt.count);else if(gt.isInstancedBufferGeometry){const ir=gt._maxInstanceCount!==void 0?gt._maxInstanceCount:1/0,dn=Math.min(gt.instanceCount,ir);Xn.renderInstances(Ht,zn,dn)}else Xn.render(Ht,zn)};function Pt(_e,tt,gt){_e.transparent===!0&&_e.side===uu&&_e.forceSinglePass===!1?(_e.side=Jl,_e.needsUpdate=!0,Lt(_e,tt,gt),_e.side=Lp,_e.needsUpdate=!0,Lt(_e,tt,gt),_e.side=uu):Lt(_e,tt,gt)}this.compile=function(_e,tt,gt=null){gt===null&&(gt=_e),D=Qe.get(gt),D.init(tt),O.push(D),gt.traverseVisible(function(xt){xt.isLight&&xt.layers.test(tt.layers)&&(D.pushLight(xt),xt.castShadow&&D.pushShadow(xt))}),_e!==gt&&_e.traverseVisible(function(xt){xt.isLight&&xt.layers.test(tt.layers)&&(D.pushLight(xt),xt.castShadow&&D.pushShadow(xt))}),D.setupLights();const pt=new Set;return _e.traverse(function(xt){if(!(xt.isMesh||xt.isPoints||xt.isLine||xt.isSprite))return;const $t=xt.material;if($t)if(Array.isArray($t))for(let sn=0;sn<$t.length;sn++){const Zt=$t[sn];Pt(Zt,gt,xt),pt.add(Zt)}else Pt($t,gt,xt),pt.add($t)}),D=O.pop(),pt},this.compileAsync=function(_e,tt,gt=null){const pt=this.compile(_e,tt,gt);return new Promise(xt=>{function $t(){if(pt.forEach(function(sn){Y.get(sn).currentProgram.isReady()&&pt.delete(sn)}),pt.size===0){xt(_e);return}setTimeout($t,10)}Le.get("KHR_parallel_shader_compile")!==null?$t():setTimeout($t,10)})};let kt=null;function wt(_e){kt&&kt(_e)}function Vt(){Bt.stop()}function rn(){Bt.start()}const Bt=new LZ;Bt.setAnimationLoop(wt),typeof self<"u"&&Bt.setContext(self),this.setAnimationLoop=function(_e){kt=_e,Je.setAnimationLoop(_e),_e===null?Bt.stop():Bt.start()},Je.addEventListener("sessionstart",Vt),Je.addEventListener("sessionend",rn),this.render=function(_e,tt){if(tt!==void 0&&tt.isCamera!==!0){qn("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(B===!0)return;const gt=Je.enabled===!0&&Je.isPresenting===!0,pt=R!==null&&(G===null||gt)&&R.begin(L,G);if(_e.matrixWorldAutoUpdate===!0&&_e.updateMatrixWorld(),tt.parent===null&&tt.matrixWorldAutoUpdate===!0&&tt.updateMatrixWorld(),Je.enabled===!0&&Je.isPresenting===!0&&(R===null||R.isCompositing()===!1)&&(Je.cameraAutoUpdate===!0&&Je.updateCamera(tt),tt=Je.getCamera()),_e.isScene===!0&&_e.onBeforeRender(L,_e,tt,G),D=Qe.get(_e,O.length),D.init(tt),O.push(D),ae.multiplyMatrices(tt.projectionMatrix,tt.matrixWorldInverse),K.setFromProjectionMatrix(ae,hu,tt.reversedDepth),he=this.localClippingEnabled,fe=nt.init(this.clippingPlanes,he),N=qe.get(_e,k.length),N.init(),k.push(N),Je.enabled===!0&&Je.isPresenting===!0){const sn=L.xr.getDepthSensingMesh();sn!==null&&Gt(sn,tt,-1/0,L.sortObjects)}Gt(_e,tt,0,L.sortObjects),N.finish(),L.sortObjects===!0&&N.sort(ce,oe),Ce=Je.enabled===!1||Je.isPresenting===!1||Je.hasDepthSensing()===!1,Ce&&Pe.addToRenderList(N,_e),this.info.render.frame++,fe===!0&&nt.beginShadows();const xt=D.state.shadowsArray;if(st.render(xt,_e,tt),fe===!0&&nt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(pt&&R.hasRenderPass())===!1){const sn=N.opaque,Zt=N.transmissive;if(D.setupLights(),tt.isArrayCamera){const Fe=tt.cameras;if(Zt.length>0)for(let bt=0,Tt=Fe.length;bt<Tt;bt++){const Yt=Fe[bt];Qt(sn,Zt,_e,Yt)}Ce&&Pe.render(_e);for(let bt=0,Tt=Fe.length;bt<Tt;bt++){const Yt=Fe[bt];Dt(N,_e,Yt,Yt.viewport)}}else Zt.length>0&&Qt(sn,Zt,_e,tt),Ce&&Pe.render(_e),Dt(N,_e,tt)}G!==null&&$===0&&(xe.updateMultisampleRenderTarget(G),xe.updateRenderTargetMipmap(G)),pt&&R.end(L),_e.isScene===!0&&_e.onAfterRender(L,_e,tt),Ze.resetDefaultState(),Z=-1,V=null,O.pop(),O.length>0?(D=O[O.length-1],fe===!0&&nt.setGlobalState(L.clippingPlanes,D.state.camera)):D=null,k.pop(),k.length>0?N=k[k.length-1]:N=null};function Gt(_e,tt,gt,pt){if(_e.visible===!1)return;if(_e.layers.test(tt.layers)){if(_e.isGroup)gt=_e.renderOrder;else if(_e.isLOD)_e.autoUpdate===!0&&_e.update(tt);else if(_e.isLight)D.pushLight(_e),_e.castShadow&&D.pushShadow(_e);else if(_e.isSprite){if(!_e.frustumCulled||K.intersectsSprite(_e)){pt&&de.setFromMatrixPosition(_e.matrixWorld).applyMatrix4(ae);const sn=Ue.update(_e),Zt=_e.material;Zt.visible&&N.push(_e,sn,Zt,gt,de.z,null)}}else if((_e.isMesh||_e.isLine||_e.isPoints)&&(!_e.frustumCulled||K.intersectsObject(_e))){const sn=Ue.update(_e),Zt=_e.material;if(pt&&(_e.boundingSphere!==void 0?(_e.boundingSphere===null&&_e.computeBoundingSphere(),de.copy(_e.boundingSphere.center)):(sn.boundingSphere===null&&sn.computeBoundingSphere(),de.copy(sn.boundingSphere.center)),de.applyMatrix4(_e.matrixWorld).applyMatrix4(ae)),Array.isArray(Zt)){const Fe=sn.groups;for(let bt=0,Tt=Fe.length;bt<Tt;bt++){const Yt=Fe[bt],Ht=Zt[Yt.materialIndex];Ht&&Ht.visible&&N.push(_e,sn,Ht,gt,de.z,Yt)}}else Zt.visible&&N.push(_e,sn,Zt,gt,de.z,null)}}const $t=_e.children;for(let sn=0,Zt=$t.length;sn<Zt;sn++)Gt($t[sn],tt,gt,pt)}function Dt(_e,tt,gt,pt){const{opaque:xt,transmissive:$t,transparent:sn}=_e;D.setupLightsView(gt),fe===!0&&nt.setGlobalState(L.clippingPlanes,gt),pt&&Ve.viewport(W.copy(pt)),xt.length>0&&hn(xt,tt,gt),$t.length>0&&hn($t,tt,gt),sn.length>0&&hn(sn,tt,gt),Ve.buffers.depth.setTest(!0),Ve.buffers.depth.setMask(!0),Ve.buffers.color.setMask(!0),Ve.setPolygonOffset(!1)}function Qt(_e,tt,gt,pt){if((gt.isScene===!0?gt.overrideMaterial:null)!==null)return;if(D.state.transmissionRenderTarget[pt.id]===void 0){const Ht=Le.has("EXT_color_buffer_half_float")||Le.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[pt.id]=new bu(1,1,{generateMipmaps:!0,type:Ht?xh:ql,minFilter:ah,samples:ze.samples,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:li.workingColorSpace})}const $t=D.state.transmissionRenderTarget[pt.id],sn=pt.viewport||W;$t.setSize(sn.z*L.transmissionResolutionScale,sn.w*L.transmissionResolutionScale);const Zt=L.getRenderTarget(),Fe=L.getActiveCubeFace(),bt=L.getActiveMipmapLevel();L.setRenderTarget($t),L.getClearColor(ie),z=L.getClearAlpha(),z<1&&L.setClearColor(16777215,.5),L.clear(),Ce&&Pe.render(gt);const Tt=L.toneMapping;L.toneMapping=vu;const Yt=pt.viewport;if(pt.viewport!==void 0&&(pt.viewport=void 0),D.setupLightsView(pt),fe===!0&&nt.setGlobalState(L.clippingPlanes,pt),hn(_e,gt,pt),xe.updateMultisampleRenderTarget($t),xe.updateRenderTargetMipmap($t),Le.has("WEBGL_multisampled_render_to_texture")===!1){let Ht=!1;for(let Cn=0,zn=tt.length;Cn<zn;Cn++){const Zn=tt[Cn],{object:Xn,geometry:ir,material:dn,group:Wi}=Zn;if(dn.side===uu&&Xn.layers.test(pt.layers)){const vn=dn.side;dn.side=Jl,dn.needsUpdate=!0,It(Xn,gt,pt,ir,dn,Wi),dn.side=vn,dn.needsUpdate=!0,Ht=!0}}Ht===!0&&(xe.updateMultisampleRenderTarget($t),xe.updateRenderTargetMipmap($t))}L.setRenderTarget(Zt,Fe,bt),L.setClearColor(ie,z),Yt!==void 0&&(pt.viewport=Yt),L.toneMapping=Tt}function hn(_e,tt,gt){const pt=tt.isScene===!0?tt.overrideMaterial:null;for(let xt=0,$t=_e.length;xt<$t;xt++){const sn=_e[xt],{object:Zt,geometry:Fe,group:bt}=sn;let Tt=sn.material;Tt.allowOverride===!0&&pt!==null&&(Tt=pt),Zt.layers.test(gt.layers)&&It(Zt,tt,gt,Fe,Tt,bt)}}function It(_e,tt,gt,pt,xt,$t){_e.onBeforeRender(L,tt,gt,pt,xt,$t),_e.modelViewMatrix.multiplyMatrices(gt.matrixWorldInverse,_e.matrixWorld),_e.normalMatrix.getNormalMatrix(_e.modelViewMatrix),xt.onBeforeRender(L,tt,gt,pt,_e,$t),xt.transparent===!0&&xt.side===uu&&xt.forceSinglePass===!1?(xt.side=Jl,xt.needsUpdate=!0,L.renderBufferDirect(gt,tt,pt,xt,_e,$t),xt.side=Lp,xt.needsUpdate=!0,L.renderBufferDirect(gt,tt,pt,xt,_e,$t),xt.side=uu):L.renderBufferDirect(gt,tt,pt,xt,_e,$t),_e.onAfterRender(L,tt,gt,pt,xt,$t)}function Lt(_e,tt,gt){tt.isScene!==!0&&(tt=Me);const pt=Y.get(_e),xt=D.state.lights,$t=D.state.shadowsArray,sn=xt.state.version,Zt=be.getParameters(_e,xt.state,$t,tt,gt),Fe=be.getProgramCacheKey(Zt);let bt=pt.programs;pt.environment=_e.isMeshStandardMaterial||_e.isMeshLambertMaterial||_e.isMeshPhongMaterial?tt.environment:null,pt.fog=tt.fog;const Tt=_e.isMeshStandardMaterial||_e.isMeshLambertMaterial&&!_e.envMap||_e.isMeshPhongMaterial&&!_e.envMap;pt.envMap=we.get(_e.envMap||pt.environment,Tt),pt.envMapRotation=pt.environment!==null&&_e.envMap===null?tt.environmentRotation:_e.envMapRotation,bt===void 0&&(_e.addEventListener("dispose",Ne),bt=new Map,pt.programs=bt);let Yt=bt.get(Fe);if(Yt!==void 0){if(pt.currentProgram===Yt&&pt.lightsStateVersion===sn)return pn(_e,Zt),Yt}else Zt.uniforms=be.getUniforms(_e),_e.onBeforeCompile(Zt,L),Yt=be.acquireProgram(Zt,Fe),bt.set(Fe,Yt),pt.uniforms=Zt.uniforms;const Ht=pt.uniforms;return(!_e.isShaderMaterial&&!_e.isRawShaderMaterial||_e.clipping===!0)&&(Ht.clippingPlanes=nt.uniform),pn(_e,Zt),pt.needsLights=tn(_e),pt.lightsStateVersion=sn,pt.needsLights&&(Ht.ambientLightColor.value=xt.state.ambient,Ht.lightProbe.value=xt.state.probe,Ht.directionalLights.value=xt.state.directional,Ht.directionalLightShadows.value=xt.state.directionalShadow,Ht.spotLights.value=xt.state.spot,Ht.spotLightShadows.value=xt.state.spotShadow,Ht.rectAreaLights.value=xt.state.rectArea,Ht.ltc_1.value=xt.state.rectAreaLTC1,Ht.ltc_2.value=xt.state.rectAreaLTC2,Ht.pointLights.value=xt.state.point,Ht.pointLightShadows.value=xt.state.pointShadow,Ht.hemisphereLights.value=xt.state.hemi,Ht.directionalShadowMatrix.value=xt.state.directionalShadowMatrix,Ht.spotLightMatrix.value=xt.state.spotLightMatrix,Ht.spotLightMap.value=xt.state.spotLightMap,Ht.pointShadowMatrix.value=xt.state.pointShadowMatrix),pt.currentProgram=Yt,pt.uniformsList=null,Yt}function zt(_e){if(_e.uniformsList===null){const tt=_e.currentProgram.getUniforms();_e.uniformsList=M2.seqWithValue(tt.seq,_e.uniforms)}return _e.uniformsList}function pn(_e,tt){const gt=Y.get(_e);gt.outputColorSpace=tt.outputColorSpace,gt.batching=tt.batching,gt.batchingColor=tt.batchingColor,gt.instancing=tt.instancing,gt.instancingColor=tt.instancingColor,gt.instancingMorph=tt.instancingMorph,gt.skinning=tt.skinning,gt.morphTargets=tt.morphTargets,gt.morphNormals=tt.morphNormals,gt.morphColors=tt.morphColors,gt.morphTargetsCount=tt.morphTargetsCount,gt.numClippingPlanes=tt.numClippingPlanes,gt.numIntersection=tt.numClipIntersection,gt.vertexAlphas=tt.vertexAlphas,gt.vertexTangents=tt.vertexTangents,gt.toneMapping=tt.toneMapping}function Ot(_e,tt,gt,pt,xt){tt.isScene!==!0&&(tt=Me),xe.resetTextureUnits();const $t=tt.fog,sn=pt.isMeshStandardMaterial||pt.isMeshLambertMaterial||pt.isMeshPhongMaterial?tt.environment:null,Zt=G===null?L.outputColorSpace:G.isXRRenderTarget===!0?G.texture.colorSpace:R0,Fe=pt.isMeshStandardMaterial||pt.isMeshLambertMaterial&&!pt.envMap||pt.isMeshPhongMaterial&&!pt.envMap,bt=we.get(pt.envMap||sn,Fe),Tt=pt.vertexColors===!0&&!!gt.attributes.color&&gt.attributes.color.itemSize===4,Yt=!!gt.attributes.tangent&&(!!pt.normalMap||pt.anisotropy>0),Ht=!!gt.morphAttributes.position,Cn=!!gt.morphAttributes.normal,zn=!!gt.morphAttributes.color;let Zn=vu;pt.toneMapped&&(G===null||G.isXRRenderTarget===!0)&&(Zn=L.toneMapping);const Xn=gt.morphAttributes.position||gt.morphAttributes.normal||gt.morphAttributes.color,ir=Xn!==void 0?Xn.length:0,dn=Y.get(pt),Wi=D.state.lights;if(fe===!0&&(he===!0||_e!==V)){const ji=_e===V&&pt.id===Z;nt.setState(pt,_e,ji)}let vn=!1;pt.version===dn.__version?(dn.needsLights&&dn.lightsStateVersion!==Wi.state.version||dn.outputColorSpace!==Zt||xt.isBatchedMesh&&dn.batching===!1||!xt.isBatchedMesh&&dn.batching===!0||xt.isBatchedMesh&&dn.batchingColor===!0&&xt.colorTexture===null||xt.isBatchedMesh&&dn.batchingColor===!1&&xt.colorTexture!==null||xt.isInstancedMesh&&dn.instancing===!1||!xt.isInstancedMesh&&dn.instancing===!0||xt.isSkinnedMesh&&dn.skinning===!1||!xt.isSkinnedMesh&&dn.skinning===!0||xt.isInstancedMesh&&dn.instancingColor===!0&&xt.instanceColor===null||xt.isInstancedMesh&&dn.instancingColor===!1&&xt.instanceColor!==null||xt.isInstancedMesh&&dn.instancingMorph===!0&&xt.morphTexture===null||xt.isInstancedMesh&&dn.instancingMorph===!1&&xt.morphTexture!==null||dn.envMap!==bt||pt.fog===!0&&dn.fog!==$t||dn.numClippingPlanes!==void 0&&(dn.numClippingPlanes!==nt.numPlanes||dn.numIntersection!==nt.numIntersection)||dn.vertexAlphas!==Tt||dn.vertexTangents!==Yt||dn.morphTargets!==Ht||dn.morphNormals!==Cn||dn.morphColors!==zn||dn.toneMapping!==Zn||dn.morphTargetsCount!==ir)&&(vn=!0):(vn=!0,dn.__version=pt.version);let ts=dn.currentProgram;vn===!0&&(ts=Lt(pt,tt,xt));let Ds=!1,Li=!1,ws=!1;const wr=ts.getUniforms(),mi=dn.uniforms;if(Ve.useProgram(ts.program)&&(Ds=!0,Li=!0,ws=!0),pt.id!==Z&&(Z=pt.id,Li=!0),Ds||V!==_e){Ve.buffers.depth.getReversed()&&_e.reversedDepth!==!0&&(_e._reversedDepth=!0,_e.updateProjectionMatrix()),wr.setValue(le,"projectionMatrix",_e.projectionMatrix),wr.setValue(le,"viewMatrix",_e.matrixWorldInverse);const na=wr.map.cameraPosition;na!==void 0&&na.setValue(le,Se.setFromMatrixPosition(_e.matrixWorld)),ze.logarithmicDepthBuffer&&wr.setValue(le,"logDepthBufFC",2/(Math.log(_e.far+1)/Math.LN2)),(pt.isMeshPhongMaterial||pt.isMeshToonMaterial||pt.isMeshLambertMaterial||pt.isMeshBasicMaterial||pt.isMeshStandardMaterial||pt.isShaderMaterial)&&wr.setValue(le,"isOrthographic",_e.isOrthographicCamera===!0),V!==_e&&(V=_e,Li=!0,ws=!0)}if(dn.needsLights&&(Wi.state.directionalShadowMap.length>0&&wr.setValue(le,"directionalShadowMap",Wi.state.directionalShadowMap,xe),Wi.state.spotShadowMap.length>0&&wr.setValue(le,"spotShadowMap",Wi.state.spotShadowMap,xe),Wi.state.pointShadowMap.length>0&&wr.setValue(le,"pointShadowMap",Wi.state.pointShadowMap,xe)),xt.isSkinnedMesh){wr.setOptional(le,xt,"bindMatrix"),wr.setOptional(le,xt,"bindMatrixInverse");const ji=xt.skeleton;ji&&(ji.boneTexture===null&&ji.computeBoneTexture(),wr.setValue(le,"boneTexture",ji.boneTexture,xe))}xt.isBatchedMesh&&(wr.setOptional(le,xt,"batchingTexture"),wr.setValue(le,"batchingTexture",xt._matricesTexture,xe),wr.setOptional(le,xt,"batchingIdTexture"),wr.setValue(le,"batchingIdTexture",xt._indirectTexture,xe),wr.setOptional(le,xt,"batchingColorTexture"),xt._colorsTexture!==null&&wr.setValue(le,"batchingColorTexture",xt._colorsTexture,xe));const Os=gt.morphAttributes;if((Os.position!==void 0||Os.normal!==void 0||Os.color!==void 0)&&Ke.update(xt,gt,ts),(Li||dn.receiveShadow!==xt.receiveShadow)&&(dn.receiveShadow=xt.receiveShadow,wr.setValue(le,"receiveShadow",xt.receiveShadow)),(pt.isMeshStandardMaterial||pt.isMeshLambertMaterial||pt.isMeshPhongMaterial)&&pt.envMap===null&&tt.environment!==null&&(mi.envMapIntensity.value=tt.environmentIntensity),mi.dfgLUT!==void 0&&(mi.dfgLUT.value=SAe()),Li&&(wr.setValue(le,"toneMappingExposure",L.toneMappingExposure),dn.needsLights&&Ct(mi,ws),$t&&pt.fog===!0&&ke.refreshFogUniforms(mi,$t),ke.refreshMaterialUniforms(mi,pt,F,X,D.state.transmissionRenderTarget[_e.id]),M2.upload(le,zt(dn),mi,xe)),pt.isShaderMaterial&&pt.uniformsNeedUpdate===!0&&(M2.upload(le,zt(dn),mi,xe),pt.uniformsNeedUpdate=!1),pt.isSpriteMaterial&&wr.setValue(le,"center",xt.center),wr.setValue(le,"modelViewMatrix",xt.modelViewMatrix),wr.setValue(le,"normalMatrix",xt.normalMatrix),wr.setValue(le,"modelMatrix",xt.matrixWorld),pt.isShaderMaterial||pt.isRawShaderMaterial){const ji=pt.uniformsGroups;for(let na=0,ba=ji.length;na<ba;na++){const Pa=ji[na];ft.update(Pa,ts),ft.bind(Pa,ts)}}return ts}function Ct(_e,tt){_e.ambientLightColor.needsUpdate=tt,_e.lightProbe.needsUpdate=tt,_e.directionalLights.needsUpdate=tt,_e.directionalLightShadows.needsUpdate=tt,_e.pointLights.needsUpdate=tt,_e.pointLightShadows.needsUpdate=tt,_e.spotLights.needsUpdate=tt,_e.spotLightShadows.needsUpdate=tt,_e.rectAreaLights.needsUpdate=tt,_e.hemisphereLights.needsUpdate=tt}function tn(_e){return _e.isMeshLambertMaterial||_e.isMeshToonMaterial||_e.isMeshPhongMaterial||_e.isMeshStandardMaterial||_e.isShadowMaterial||_e.isShaderMaterial&&_e.lights===!0}this.getActiveCubeFace=function(){return H},this.getActiveMipmapLevel=function(){return $},this.getRenderTarget=function(){return G},this.setRenderTargetTextures=function(_e,tt,gt){const pt=Y.get(_e);pt.__autoAllocateDepthBuffer=_e.resolveDepthBuffer===!1,pt.__autoAllocateDepthBuffer===!1&&(pt.__useRenderToTexture=!1),Y.get(_e.texture).__webglTexture=tt,Y.get(_e.depthTexture).__webglTexture=pt.__autoAllocateDepthBuffer?void 0:gt,pt.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(_e,tt){const gt=Y.get(_e);gt.__webglFramebuffer=tt,gt.__useDefaultFramebuffer=tt===void 0};const en=le.createFramebuffer();this.setRenderTarget=function(_e,tt=0,gt=0){G=_e,H=tt,$=gt;let pt=null,xt=!1,$t=!1;if(_e){const Zt=Y.get(_e);if(Zt.__useDefaultFramebuffer!==void 0){Ve.bindFramebuffer(le.FRAMEBUFFER,Zt.__webglFramebuffer),W.copy(_e.viewport),J.copy(_e.scissor),ne=_e.scissorTest,Ve.viewport(W),Ve.scissor(J),Ve.setScissorTest(ne),Z=-1;return}else if(Zt.__webglFramebuffer===void 0)xe.setupRenderTarget(_e);else if(Zt.__hasExternalTextures)xe.rebindTextures(_e,Y.get(_e.texture).__webglTexture,Y.get(_e.depthTexture).__webglTexture);else if(_e.depthBuffer){const Tt=_e.depthTexture;if(Zt.__boundDepthTexture!==Tt){if(Tt!==null&&Y.has(Tt)&&(_e.width!==Tt.image.width||_e.height!==Tt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");xe.setupDepthRenderbuffer(_e)}}const Fe=_e.texture;(Fe.isData3DTexture||Fe.isDataArrayTexture||Fe.isCompressedArrayTexture)&&($t=!0);const bt=Y.get(_e).__webglFramebuffer;_e.isWebGLCubeRenderTarget?(Array.isArray(bt[tt])?pt=bt[tt][gt]:pt=bt[tt],xt=!0):_e.samples>0&&xe.useMultisampledRTT(_e)===!1?pt=Y.get(_e).__webglMultisampledFramebuffer:Array.isArray(bt)?pt=bt[gt]:pt=bt,W.copy(_e.viewport),J.copy(_e.scissor),ne=_e.scissorTest}else W.copy(Q).multiplyScalar(F).floor(),J.copy(se).multiplyScalar(F).floor(),ne=re;if(gt!==0&&(pt=en),Ve.bindFramebuffer(le.FRAMEBUFFER,pt)&&Ve.drawBuffers(_e,pt),Ve.viewport(W),Ve.scissor(J),Ve.setScissorTest(ne),xt){const Zt=Y.get(_e.texture);le.framebufferTexture2D(le.FRAMEBUFFER,le.COLOR_ATTACHMENT0,le.TEXTURE_CUBE_MAP_POSITIVE_X+tt,Zt.__webglTexture,gt)}else if($t){const Zt=tt;for(let Fe=0;Fe<_e.textures.length;Fe++){const bt=Y.get(_e.textures[Fe]);le.framebufferTextureLayer(le.FRAMEBUFFER,le.COLOR_ATTACHMENT0+Fe,bt.__webglTexture,gt,Zt)}}else if(_e!==null&&gt!==0){const Zt=Y.get(_e.texture);le.framebufferTexture2D(le.FRAMEBUFFER,le.COLOR_ATTACHMENT0,le.TEXTURE_2D,Zt.__webglTexture,gt)}Z=-1},this.readRenderTargetPixels=function(_e,tt,gt,pt,xt,$t,sn,Zt=0){if(!(_e&&_e.isWebGLRenderTarget)){qn("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Fe=Y.get(_e).__webglFramebuffer;if(_e.isWebGLCubeRenderTarget&&sn!==void 0&&(Fe=Fe[sn]),Fe){Ve.bindFramebuffer(le.FRAMEBUFFER,Fe);try{const bt=_e.textures[Zt],Tt=bt.format,Yt=bt.type;if(_e.textures.length>1&&le.readBuffer(le.COLOR_ATTACHMENT0+Zt),!ze.textureFormatReadable(Tt)){qn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ze.textureTypeReadable(Yt)){qn("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}tt>=0&&tt<=_e.width-pt&&gt>=0&&gt<=_e.height-xt&&le.readPixels(tt,gt,pt,xt,$e.convert(Tt),$e.convert(Yt),$t)}finally{const bt=G!==null?Y.get(G).__webglFramebuffer:null;Ve.bindFramebuffer(le.FRAMEBUFFER,bt)}}},this.readRenderTargetPixelsAsync=async function(_e,tt,gt,pt,xt,$t,sn,Zt=0){if(!(_e&&_e.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Fe=Y.get(_e).__webglFramebuffer;if(_e.isWebGLCubeRenderTarget&&sn!==void 0&&(Fe=Fe[sn]),Fe)if(tt>=0&&tt<=_e.width-pt&&gt>=0&&gt<=_e.height-xt){Ve.bindFramebuffer(le.FRAMEBUFFER,Fe);const bt=_e.textures[Zt],Tt=bt.format,Yt=bt.type;if(_e.textures.length>1&&le.readBuffer(le.COLOR_ATTACHMENT0+Zt),!ze.textureFormatReadable(Tt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ze.textureTypeReadable(Yt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ht=le.createBuffer();le.bindBuffer(le.PIXEL_PACK_BUFFER,Ht),le.bufferData(le.PIXEL_PACK_BUFFER,$t.byteLength,le.STREAM_READ),le.readPixels(tt,gt,pt,xt,$e.convert(Tt),$e.convert(Yt),0);const Cn=G!==null?Y.get(G).__webglFramebuffer:null;Ve.bindFramebuffer(le.FRAMEBUFFER,Cn);const zn=le.fenceSync(le.SYNC_GPU_COMMANDS_COMPLETE,0);return le.flush(),await j3e(le,zn,4),le.bindBuffer(le.PIXEL_PACK_BUFFER,Ht),le.getBufferSubData(le.PIXEL_PACK_BUFFER,0,$t),le.deleteBuffer(Ht),le.deleteSync(zn),$t}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(_e,tt=null,gt=0){const pt=Math.pow(2,-gt),xt=Math.floor(_e.image.width*pt),$t=Math.floor(_e.image.height*pt),sn=tt!==null?tt.x:0,Zt=tt!==null?tt.y:0;xe.setTexture2D(_e,0),le.copyTexSubImage2D(le.TEXTURE_2D,gt,0,0,sn,Zt,xt,$t),Ve.unbindTexture()};const bn=le.createFramebuffer(),On=le.createFramebuffer();this.copyTextureToTexture=function(_e,tt,gt=null,pt=null,xt=0,$t=0){let sn,Zt,Fe,bt,Tt,Yt,Ht,Cn,zn;const Zn=_e.isCompressedTexture?_e.mipmaps[$t]:_e.image;if(gt!==null)sn=gt.max.x-gt.min.x,Zt=gt.max.y-gt.min.y,Fe=gt.isBox3?gt.max.z-gt.min.z:1,bt=gt.min.x,Tt=gt.min.y,Yt=gt.isBox3?gt.min.z:0;else{const mi=Math.pow(2,-xt);sn=Math.floor(Zn.width*mi),Zt=Math.floor(Zn.height*mi),_e.isDataArrayTexture?Fe=Zn.depth:_e.isData3DTexture?Fe=Math.floor(Zn.depth*mi):Fe=1,bt=0,Tt=0,Yt=0}pt!==null?(Ht=pt.x,Cn=pt.y,zn=pt.z):(Ht=0,Cn=0,zn=0);const Xn=$e.convert(tt.format),ir=$e.convert(tt.type);let dn;tt.isData3DTexture?(xe.setTexture3D(tt,0),dn=le.TEXTURE_3D):tt.isDataArrayTexture||tt.isCompressedArrayTexture?(xe.setTexture2DArray(tt,0),dn=le.TEXTURE_2D_ARRAY):(xe.setTexture2D(tt,0),dn=le.TEXTURE_2D),le.pixelStorei(le.UNPACK_FLIP_Y_WEBGL,tt.flipY),le.pixelStorei(le.UNPACK_PREMULTIPLY_ALPHA_WEBGL,tt.premultiplyAlpha),le.pixelStorei(le.UNPACK_ALIGNMENT,tt.unpackAlignment);const Wi=le.getParameter(le.UNPACK_ROW_LENGTH),vn=le.getParameter(le.UNPACK_IMAGE_HEIGHT),ts=le.getParameter(le.UNPACK_SKIP_PIXELS),Ds=le.getParameter(le.UNPACK_SKIP_ROWS),Li=le.getParameter(le.UNPACK_SKIP_IMAGES);le.pixelStorei(le.UNPACK_ROW_LENGTH,Zn.width),le.pixelStorei(le.UNPACK_IMAGE_HEIGHT,Zn.height),le.pixelStorei(le.UNPACK_SKIP_PIXELS,bt),le.pixelStorei(le.UNPACK_SKIP_ROWS,Tt),le.pixelStorei(le.UNPACK_SKIP_IMAGES,Yt);const ws=_e.isDataArrayTexture||_e.isData3DTexture,wr=tt.isDataArrayTexture||tt.isData3DTexture;if(_e.isDepthTexture){const mi=Y.get(_e),Os=Y.get(tt),ji=Y.get(mi.__renderTarget),na=Y.get(Os.__renderTarget);Ve.bindFramebuffer(le.READ_FRAMEBUFFER,ji.__webglFramebuffer),Ve.bindFramebuffer(le.DRAW_FRAMEBUFFER,na.__webglFramebuffer);for(let ba=0;ba<Fe;ba++)ws&&(le.framebufferTextureLayer(le.READ_FRAMEBUFFER,le.COLOR_ATTACHMENT0,Y.get(_e).__webglTexture,xt,Yt+ba),le.framebufferTextureLayer(le.DRAW_FRAMEBUFFER,le.COLOR_ATTACHMENT0,Y.get(tt).__webglTexture,$t,zn+ba)),le.blitFramebuffer(bt,Tt,sn,Zt,Ht,Cn,sn,Zt,le.DEPTH_BUFFER_BIT,le.NEAREST);Ve.bindFramebuffer(le.READ_FRAMEBUFFER,null),Ve.bindFramebuffer(le.DRAW_FRAMEBUFFER,null)}else if(xt!==0||_e.isRenderTargetTexture||Y.has(_e)){const mi=Y.get(_e),Os=Y.get(tt);Ve.bindFramebuffer(le.READ_FRAMEBUFFER,bn),Ve.bindFramebuffer(le.DRAW_FRAMEBUFFER,On);for(let ji=0;ji<Fe;ji++)ws?le.framebufferTextureLayer(le.READ_FRAMEBUFFER,le.COLOR_ATTACHMENT0,mi.__webglTexture,xt,Yt+ji):le.framebufferTexture2D(le.READ_FRAMEBUFFER,le.COLOR_ATTACHMENT0,le.TEXTURE_2D,mi.__webglTexture,xt),wr?le.framebufferTextureLayer(le.DRAW_FRAMEBUFFER,le.COLOR_ATTACHMENT0,Os.__webglTexture,$t,zn+ji):le.framebufferTexture2D(le.DRAW_FRAMEBUFFER,le.COLOR_ATTACHMENT0,le.TEXTURE_2D,Os.__webglTexture,$t),xt!==0?le.blitFramebuffer(bt,Tt,sn,Zt,Ht,Cn,sn,Zt,le.COLOR_BUFFER_BIT,le.NEAREST):wr?le.copyTexSubImage3D(dn,$t,Ht,Cn,zn+ji,bt,Tt,sn,Zt):le.copyTexSubImage2D(dn,$t,Ht,Cn,bt,Tt,sn,Zt);Ve.bindFramebuffer(le.READ_FRAMEBUFFER,null),Ve.bindFramebuffer(le.DRAW_FRAMEBUFFER,null)}else wr?_e.isDataTexture||_e.isData3DTexture?le.texSubImage3D(dn,$t,Ht,Cn,zn,sn,Zt,Fe,Xn,ir,Zn.data):tt.isCompressedArrayTexture?le.compressedTexSubImage3D(dn,$t,Ht,Cn,zn,sn,Zt,Fe,Xn,Zn.data):le.texSubImage3D(dn,$t,Ht,Cn,zn,sn,Zt,Fe,Xn,ir,Zn):_e.isDataTexture?le.texSubImage2D(le.TEXTURE_2D,$t,Ht,Cn,sn,Zt,Xn,ir,Zn.data):_e.isCompressedTexture?le.compressedTexSubImage2D(le.TEXTURE_2D,$t,Ht,Cn,Zn.width,Zn.height,Xn,Zn.data):le.texSubImage2D(le.TEXTURE_2D,$t,Ht,Cn,sn,Zt,Xn,ir,Zn);le.pixelStorei(le.UNPACK_ROW_LENGTH,Wi),le.pixelStorei(le.UNPACK_IMAGE_HEIGHT,vn),le.pixelStorei(le.UNPACK_SKIP_PIXELS,ts),le.pixelStorei(le.UNPACK_SKIP_ROWS,Ds),le.pixelStorei(le.UNPACK_SKIP_IMAGES,Li),$t===0&&tt.generateMipmaps&&le.generateMipmap(dn),Ve.unbindTexture()},this.initRenderTarget=function(_e){Y.get(_e).__webglFramebuffer===void 0&&xe.setupRenderTarget(_e)},this.initTexture=function(_e){_e.isCubeTexture?xe.setTextureCube(_e,0):_e.isData3DTexture?xe.setTexture3D(_e,0):_e.isDataArrayTexture||_e.isCompressedArrayTexture?xe.setTexture2DArray(_e,0):xe.setTexture2D(_e,0),Ve.unbindTexture()},this.resetState=function(){H=0,$=0,G=null,Ve.reset(),Ze.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return hu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=li._getDrawingBufferColorSpace(e),n.unpackColorSpace=li._getUnpackColorSpace()}}const MAe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:VC,AddEquation:Zm,AddOperation:vK,AdditiveAnimationBlendMode:GP,AdditiveBlending:RR,AgXToneMapping:DP,AlphaFormat:BP,AlwaysCompare:RK,AlwaysDepth:M5,AlwaysStencilFunc:LR,AmbientLight:wZ,AnimationAction:RZ,AnimationClip:lS,AnimationLoader:EMe,AnimationMixer:r2e,AnimationObjectGroup:t2e,AnimationUtils:SMe,ArcCurve:XK,ArrayCamera:EZ,ArrowHelper:M2e,AttachedBindMode:DR,Audio:NZ,AudioAnalyser:WMe,AudioContext:mI,AudioListener:HMe,AudioLoader:zMe,AxesHelper:T2e,BackSide:Jl,BasicDepthPacking:SK,BasicShadowMap:QY,BatchedMesh:GK,BezierInterpolant:mZ,Bone:KP,BooleanKeyframeTrack:Jx,Box2:c2e,Box3:Fo,Box3Helper:w2e,BoxGeometry:Qx,BoxHelper:_2e,BufferAttribute:Xi,BufferGeometry:Nr,BufferGeometryLoader:TZ,ByteType:jP,Cache:lh,Camera:ME,CameraHelper:b2e,CanvasTexture:G4e,CapsuleGeometry:cE,CatmullRomCurve3:YK,CineonToneMapping:PP,CircleGeometry:uE,ClampToEdgeWrapping:Uc,Clock:IZ,Color:Rn,ColorKeyframeTrack:dI,ColorManagement:li,Compatibility:P3e,CompressedArrayTexture:B4e,CompressedCubeTexture:H4e,CompressedTexture:lE,CompressedTextureLoader:AMe,ConeGeometry:r3,ConstantAlphaFactor:mK,ConstantColorFactor:hK,Controls:E2e,CubeCamera:CZ,CubeDepthTexture:qK,CubeReflectionMapping:gh,CubeRefractionMapping:k0,CubeTexture:t3,CubeTextureLoader:NMe,CubeUVReflectionMapping:lb,CubicBezierCurve:tI,CubicBezierCurve3:KK,CubicInterpolant:hZ,CullFaceBack:kR,CullFaceFront:ZY,CullFaceFrontBack:WSe,CullFaceNone:KY,Curve:ff,CurvePath:QK,CustomBlending:JY,CustomToneMapping:IP,CylinderGeometry:n3,Cylindrical:l2e,Data3DTexture:nE,DataArrayTexture:tE,DataTexture:rf,DataTextureLoader:kMe,DataUtils:p4e,DecrementStencilOp:c3e,DecrementWrapStencilOp:d3e,DefaultLoadingManager:xZ,DepthFormat:vh,DepthStencilFormat:u0,DepthTexture:Fy,DetachedBindMode:yK,DirectionalLight:_Z,DirectionalLightHelper:y2e,DiscreteInterpolant:pZ,DodecahedronGeometry:dE,DoubleSide:uu,DstAlphaFactor:lK,DstColorFactor:uK,DynamicCopyUsage:C3e,DynamicDrawUsage:b3e,DynamicReadUsage:S3e,EdgesGeometry:JP,EllipseCurve:fE,EqualCompare:AK,EqualDepth:C5,EqualStencilFunc:m3e,EquirectangularReflectionMapping:gw,EquirectangularRefractionMapping:xw,Euler:Su,EventDispatcher:Eh,ExternalTexture:QP,ExtrudeGeometry:hE,FileLoader:jp,Float16BufferAttribute:_4e,Float32BufferAttribute:jn,FloatType:Ql,Fog:iE,FogExp2:rE,FramebufferTexture:U4e,FrontSide:Lp,Frustum:cb,FrustumArray:aE,GLBufferAttribute:a2e,GLSL1:A3e,GLSL3:jR,GreaterCompare:NK,GreaterDepth:A5,GreaterEqualCompare:eE,GreaterEqualDepth:E5,GreaterEqualStencilFunc:y3e,GreaterStencilFunc:x3e,GridHelper:x2e,Group:R1,HalfFloatType:xh,HemisphereLight:vZ,HemisphereLightHelper:g2e,IcosahedronGeometry:pE,ImageBitmapLoader:jMe,ImageLoader:cS,ImageUtils:LK,IncrementStencilOp:l3e,IncrementWrapStencilOp:u3e,InstancedBufferAttribute:Ux,InstancedBufferGeometry:CE,InstancedInterleavedBuffer:hT,InstancedMesh:HK,Int16BufferAttribute:y4e,Int32BufferAttribute:b4e,Int8BufferAttribute:g4e,IntType:$C,InterleavedBuffer:sE,InterleavedBufferAttribute:pu,Interpolant:ub,InterpolateBezier:OR,InterpolateDiscrete:Yw,InterpolateLinear:lT,InterpolateSmooth:w2,InterpolationSamplingMode:R3e,InterpolationSamplingType:k3e,InvertStencilOp:f3e,KeepStencilOp:sx,KeyframeTrack:bd,LOD:UK,LatheGeometry:mE,Layers:zy,LessCompare:EK,LessDepth:T5,LessEqualCompare:JC,LessEqualDepth:jx,LessEqualStencilFunc:g3e,LessStencilFunc:p3e,Light:Q0,LightProbe:MZ,Line:I0,Line3:DZ,LineBasicMaterial:rc,LineCurve:nI,LineCurve3:ZK,LineDashedMaterial:dZ,LineLoop:VK,LineSegments:Ah,LinearFilter:as,LinearInterpolant:uI,LinearMipMapLinearFilter:KSe,LinearMipMapNearestFilter:YSe,LinearMipmapLinearFilter:ah,LinearMipmapNearestFilter:vw,LinearSRGBColorSpace:R0,LinearToneMapping:kP,LinearTransfer:Zw,Loader:qc,LoaderUtils:HR,LoadingManager:fI,LoopOnce:bK,LoopPingPong:wK,LoopRepeat:_K,MOUSE:rx,Material:Cl,MaterialBlending:$Se,MaterialLoader:TE,MathUtils:OK,Matrix2:yI,Matrix3:Er,Matrix4:pr,MaxEquation:rK,Mesh:Xs,MeshBasicMaterial:Vp,MeshDepthMaterial:wE,MeshDistanceMaterial:SE,MeshLambertMaterial:cZ,MeshMatcapMaterial:uZ,MeshNormalMaterial:lZ,MeshPhongMaterial:oZ,MeshPhysicalMaterial:sZ,MeshStandardMaterial:lI,MeshToonMaterial:aZ,MinEquation:nK,MirroredRepeatWrapping:Xw,MixOperation:xK,MultiplyBlending:IR,MultiplyOperation:JS,NearestFilter:zo,NearestMipMapLinearFilter:XSe,NearestMipMapNearestFilter:qSe,NearestMipmapLinearFilter:N1,NearestMipmapNearestFilter:LP,NeutralToneMapping:OP,NeverCompare:CK,NeverDepth:S5,NeverStencilFunc:h3e,NoBlending:fh,NoColorSpace:xp,NoNormalPacking:r3e,NoToneMapping:vu,NormalAnimationBlendMode:QC,NormalBlending:Tx,NormalGAPacking:s3e,NormalRGPacking:i3e,NotEqualCompare:kK,NotEqualDepth:N5,NotEqualStencilFunc:v3e,NumberKeyframeTrack:oS,Object3D:wi,ObjectLoader:OMe,ObjectSpaceNormalMap:TK,OctahedronGeometry:i3,OneFactor:sK,OneMinusConstantAlphaFactor:gK,OneMinusConstantColorFactor:pK,OneMinusDstAlphaFactor:cK,OneMinusDstColorFactor:dK,OneMinusSrcAlphaFactor:w5,OneMinusSrcColorFactor:aK,OrthographicCamera:sf,PCFShadowMap:q1,PCFSoftShadowMap:mw,PMREMGenerator:$R,Path:fT,PerspectiveCamera:lo,Plane:fp,PlaneGeometry:Wp,PlaneHelper:S2e,PointLight:bZ,PointLightHelper:p2e,Points:WK,PointsMaterial:ZP,PolarGridHelper:v2e,PolyhedronGeometry:Z0,PositionalAudio:VMe,PropertyBinding:bi,PropertyMixer:kZ,QuadraticBezierCurve:rI,QuadraticBezierCurve3:iI,Quaternion:Za,QuaternionKeyframeTrack:o3,QuaternionLinearInterpolant:gZ,R11_EAC_Format:j5,RED_GREEN_RGTC2_Format:oT,RED_RGTC1_Format:iT,REVISION:QS,RG11_EAC_Format:F5,RGBADepthPacking:MK,RGBAFormat:bl,RGBAIntegerFormat:ZC,RGBA_ASTC_10x10_Format:Q5,RGBA_ASTC_10x5_Format:Y5,RGBA_ASTC_10x6_Format:K5,RGBA_ASTC_10x8_Format:Z5,RGBA_ASTC_12x10_Format:J5,RGBA_ASTC_12x12_Format:eT,RGBA_ASTC_4x4_Format:B5,RGBA_ASTC_5x4_Format:H5,RGBA_ASTC_5x5_Format:G5,RGBA_ASTC_6x5_Format:V5,RGBA_ASTC_6x6_Format:W5,RGBA_ASTC_8x5_Format:$5,RGBA_ASTC_8x6_Format:q5,RGBA_ASTC_8x8_Format:X5,RGBA_BPTC_Format:tT,RGBA_ETC2_EAC_Format:L5,RGBA_PVRTC_2BPPV1_Format:I5,RGBA_PVRTC_4BPPV1_Format:P5,RGBA_S3TC_DXT1_Format:bw,RGBA_S3TC_DXT3_Format:_w,RGBA_S3TC_DXT5_Format:ww,RGBDepthPacking:t3e,RGBFormat:HP,RGBIntegerFormat:ZSe,RGB_BPTC_SIGNED_Format:nT,RGB_BPTC_UNSIGNED_Format:rT,RGB_ETC1_Format:D5,RGB_ETC2_Format:O5,RGB_PVRTC_2BPPV1_Format:R5,RGB_PVRTC_4BPPV1_Format:k5,RGB_S3TC_DXT1_Format:yw,RGDepthPacking:n3e,RGFormat:zx,RGIntegerFormat:KC,RawShaderMaterial:aI,Ray:Zx,Raycaster:PZ,RectAreaLight:SZ,RedFormat:YC,RedIntegerFormat:e3,ReinhardToneMapping:RP,RenderTarget:WP,RenderTarget3D:i2e,RepeatWrapping:qw,ReplaceStencilOp:a3e,ReverseSubtractEquation:tK,RingGeometry:gE,SIGNED_R11_EAC_Format:z5,SIGNED_RED_GREEN_RGTC2_Format:aT,SIGNED_RED_RGTC1_Format:sT,SIGNED_RG11_EAC_Format:U5,SRGBColorSpace:yl,SRGBTransfer:Hi,Scene:$P,ShaderChunk:Or,ShaderLib:Jd,ShaderMaterial:Mu,ShadowMaterial:rZ,Shape:m0,ShapeGeometry:xE,ShapePath:C2e,ShapeUtils:nf,ShortType:zP,Skeleton:oE,SkeletonHelper:h2e,SkinnedMesh:BK,Source:d0,Sphere:ea,SphereGeometry:s3,Spherical:VR,SphericalHarmonics3:pI,SplineCurve:sI,SpotLight:yZ,SpotLightHelper:f2e,Sprite:FK,SpriteMaterial:YP,SrcAlphaFactor:_5,SrcAlphaSaturateFactor:fK,SrcColorFactor:oK,StaticCopyUsage:T3e,StaticDrawUsage:Qw,StaticReadUsage:w3e,StereoCamera:FMe,StreamCopyUsage:E3e,StreamDrawUsage:_3e,StreamReadUsage:M3e,StringKeyframeTrack:ev,SubtractEquation:eK,SubtractiveBlending:PR,TOUCH:ix,TangentSpaceNormalMap:K0,TetrahedronGeometry:vE,Texture:fo,TextureLoader:RMe,TextureUtils:P2e,Timer:AZ,TimestampQuery:N3e,TorusGeometry:yE,TorusKnotGeometry:bE,Triangle:zc,TriangleFanDrawMode:e3e,TriangleStripDrawMode:JSe,TrianglesDrawMode:QSe,TubeGeometry:_E,UVMapping:WC,Uint16BufferAttribute:qP,Uint32BufferAttribute:XP,Uint8BufferAttribute:x4e,Uint8ClampedBufferAttribute:v4e,Uniform:vI,UniformsGroup:o2e,UniformsLib:An,UniformsUtils:sS,UnsignedByteType:ql,UnsignedInt101111Type:UP,UnsignedInt248Type:Ly,UnsignedInt5999Type:FP,UnsignedIntType:xd,UnsignedShort4444Type:qC,UnsignedShort5551Type:XC,UnsignedShortType:Oy,VSMShadowMap:cx,Vector2:qt,Vector3:Ge,Vector4:pi,VectorKeyframeTrack:aS,VideoFrameTexture:F4e,VideoTexture:$K,WebGL3DRenderTarget:s4e,WebGLArrayRenderTarget:i4e,WebGLCoordinateSystem:hu,WebGLCubeRenderTarget:bI,WebGLRenderTarget:bu,WebGLRenderer:HZ,WebGLUtils:BZ,WebGPUCoordinateSystem:Fx,WebXRController:S2,WireframeGeometry:oI,WrapAroundEnding:Kw,ZeroCurvatureEnding:ux,ZeroFactor:iK,ZeroSlopeEnding:dx,ZeroStencilOp:o3e,createCanvasElement:IK,error:qn,getConsoleFunction:L3e,log:eS,setConsoleFunction:O3e,warn:En,warnOnce:tS},Symbol.toStringTag,{value:"Module"}));var EN={exports:{}},AN={};/**
 * @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 gF;function TAe(){if(gF)return AN;gF=1;var t=wS(),e=mie();function n(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}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 AN.useSyncExternalStoreWithSelector=function(c,f,h,m,x){var b=s(null);if(b.current===null){var _={hasValue:!1,value:null};b.current=_}else _=b.current;b=a(function(){function M(k){if(!T){if(T=!0,A=k,k=m(k),x!==void 0&&_.hasValue){var O=_.value;if(x(O,k))return N=O}return N=k}if(O=N,r(A,k))return O;var R=m(k);return x!==void 0&&x(O,R)?(A=k,O):(A=k,N=R)}var T=!1,A,N,D=h===void 0?null:h;return[function(){return M(f())},D===null?void 0:function(){return M(D())}]},[f,h,m,x]);var S=i(c,b[0],b[1]);return o(function(){_.hasValue=!0,_.value=S},[S]),l(S),S},AN}var xF;function CAe(){return xF||(xF=1,EN.exports=TAe()),EN.exports}var EAe=CAe();const AAe=Vy(EAe),vF=t=>{let e;const n=new Set,r=(c,f)=>{const h=typeof c=="function"?c(e):c;if(!Object.is(h,e)){const m=e;e=f??(typeof h!="object"||h===null)?h:Object.assign({},e,h),n.forEach(x=>x(e,m))}},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},NAe=(t=>t?vF(t):vF),{useSyncExternalStoreWithSelector:kAe}=AAe,RAe=t=>t;function PAe(t,e=RAe,n){const r=kAe(t.subscribe,t.getState,t.getInitialState,e,n);return ri.useDebugValue(r),r}const yF=(t,e)=>{const n=NAe(t),r=(i,s=e)=>PAe(n,i,s);return Object.assign(r,n),r},IAe=((t,e)=>t?yF(t,e):yF),DAe=t=>typeof t=="object"&&typeof t.then=="function",ZM=[];function OAe(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 LAe(t,e=null,n=!1,r={}){e===null&&(e=[t]);for(const s of ZM)if(OAe(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=ZM.indexOf(i);s!==-1&&ZM.splice(s,1)},promise:(DAe(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(ZM.push(i),!n)throw i.promise}const jAe=(t,e,n)=>LAe(t,e,!1,n);var YR=TU();const zAe=Vy(YR);function _I(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=e?t.return:t.child;for(;r;){const i=_I(r,e,n);if(i)return i;r=e?null:r.sibling}}function GZ(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const wI=GZ(w.createContext(null));class VZ extends w.Component{render(){return w.createElement(wI.Provider,{value:this._reactInternals},this.props.children)}}function WZ(){const t=w.useContext(wI);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=w.useId();return w.useMemo(()=>{for(const n of[t,t==null?void 0:t.alternate]){if(!n)continue;const r=_I(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 FAe=Symbol.for("react.context"),UAe=t=>t!==null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===FAe;function BAe(){const t=WZ(),[e]=w.useState(()=>new Map);e.clear();let n=t;for(;n;){const r=n.type;UAe(r)&&r!==wI&&!e.has(r)&&e.set(r,w.use(GZ(r))),n=n.return}return e}function HAe(){const t=BAe();return w.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>w.createElement(e,null,w.createElement(n.Provider,{...r,value:t.get(n)})),e=>w.createElement(VZ,{...e})),[t])}function $Z(t){let e=t.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const qZ=t=>t&&t.isOrthographicCamera,GAe=t=>t&&t.hasOwnProperty("current"),VAe=t=>t!=null&&(typeof t=="string"||typeof t=="number"||t.isColor),a3=((t,e)=>typeof window<"u"&&(((t=window.document)==null?void 0:t.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?w.useLayoutEffect:w.useEffect;function XZ(t){const e=w.useRef(t);return a3(()=>void(e.current=t),[t]),e}function WAe(){const t=WZ(),e=HAe();return w.useMemo(()=>({children:n})=>{const i=!!_I(t,!0,s=>s.type===w.StrictMode)?w.StrictMode:w.Fragment;return d.jsx(i,{children:d.jsx(e,{children:n})})},[t,e])}function $Ae({set:t}){return a3(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}const qAe=(t=>(t=class extends w.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 YZ(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 _1(t){var e;return(e=t.__r3f)==null?void 0:e.root.getState()}const oo={obj:t=>t===Object(t)&&!oo.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(oo.str(t)||oo.num(t)||oo.boo(t))return t===e;const s=oo.obj(t);if(s&&r==="reference")return t===e;const o=oo.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(!oo.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(oo.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 XAe(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 KZ=["children","key","ref"];function YAe(t){const e={};for(const n in t)KZ.includes(n)||(e[n]=t[n]);return e}function pT(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:YAe(r),object:i,eventCount:0,handlers:{},isHidden:!1},i&&(i.__r3f=s)),s}function uS(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 bF=/-\d+$/;function mT(t,e){if(oo.str(e.props.attach)){if(bF.test(e.props.attach)){const i=e.props.attach.replace(bF,""),{root:s,key:o}=uS(t.object,i);Array.isArray(s[o])||(s[o]=[])}const{root:n,key:r}=uS(t.object,e.props.attach);e.previousAttach=n[r],n[r]=e.object}else oo.fun(e.props.attach)&&(e.previousAttach=e.props.attach(t.object,e.object))}function gT(t,e){if(oo.str(e.props.attach)){const{root:n,key:r}=uS(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 KR=[...KZ,"args","dispose","attach","object","onUpdate","dispose"],_F=new Map;function KAe(t){let e=_F.get(t.constructor);try{e||(e=new t.constructor,_F.set(t.constructor,e))}catch{}return e}function ZAe(t,e){const n={};for(const r in e)if(!KR.includes(r)&&!oo.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(KR.includes(r)||e.hasOwnProperty(r))continue;const{root:i,key:s}=uS(t.object,r);if(i.constructor&&i.constructor.length===0){const o=KAe(i);oo.und(o)||(n[s]=o[s])}else n[s]=0}return n}const QAe=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],JAe=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Qm(t,e){var n;const r=t.__r3f,i=r&&$Z(r).getState(),s=r==null?void 0:r.eventCount;for(const a in e){let l=e[a];if(KR.includes(a))continue;if(r&&JAe.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:f,target:h}=uS(t,a);if(h===void 0&&(typeof c!="object"||c===null))throw Error(`R3F: Cannot set "${a}". Ensure it is an object before setting "${f}".`);if(h instanceof zy&&l instanceof zy)h.mask=l.mask;else if(h instanceof Rn&&VAe(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[f]=l,i&&!i.linear&&QAe.includes(f)&&(o=c[f])!=null&&o.isTexture&&c[f].format===bl&&c[f].type===ql&&(c[f].colorSpace=yl)}}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&&fb(r),t}function fb(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 e6e(t,e){t.manual||(qZ(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 Ic=t=>t==null?void 0:t.isObject3D;function QM(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function ZZ(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function t6e(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)=>{ZZ(n.capturedMap,e,r,i)})}function n6e(t){function e(l){const{internal:c}=t.getState(),f=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(f*f+h*h))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(f=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+f]}))}function r(l,c){const f=t.getState(),h=new Set,m=[],x=c?c(f.internal.interaction):f.internal.interaction;for(let M=0;M<x.length;M++){const T=_1(x[M]);T&&(T.raycaster.camera=void 0)}f.previousRoot||f.events.compute==null||f.events.compute(l,f);function b(M){const T=_1(M);if(!T||!T.events.enabled||T.raycaster.camera===null)return[];if(T.raycaster.camera===void 0){var A;T.events.compute==null||T.events.compute(l,T,(A=T.previousRoot)==null?void 0:A.getState()),T.raycaster.camera===void 0&&(T.raycaster.camera=null)}return T.raycaster.camera?T.raycaster.intersectObject(M,!0):[]}let _=x.flatMap(b).sort((M,T)=>{const A=_1(M.object),N=_1(T.object);return!A||!N?M.distance-T.distance:N.events.priority-A.events.priority||M.distance-T.distance}).filter(M=>{const T=QM(M);return h.has(T)?!1:(h.add(T),!0)});f.events.filter&&(_=f.events.filter(_,f));for(const M of _){let T=M.object;for(;T;){var S;(S=T.__r3f)!=null&&S.eventCount&&m.push({...M,eventObject:T}),T=T.parent}}if("pointerId"in l&&f.internal.capturedMap.has(l.pointerId))for(let M of f.internal.capturedMap.get(l.pointerId).values())h.has(QM(M.intersection))||m.push(M.intersection);return m}function i(l,c,f,h){if(l.length){const m={stopped:!1};for(const x of l){let b=_1(x.object);if(b||x.object.traverseAncestors(_=>{const S=_1(_);if(S)return b=S,!1}),b){const{raycaster:_,pointer:S,camera:M,internal:T}=b,A=new Ge(S.x,S.y,0).unproject(M),N=L=>{var B,H;return(B=(H=T.capturedMap.get(L))==null?void 0:H.has(x.eventObject))!=null?B:!1},D=L=>{const B={intersection:x,target:c.target};T.capturedMap.has(L)?T.capturedMap.get(L).set(x.eventObject,B):T.capturedMap.set(L,new Map([[x.eventObject,B]])),c.target.setPointerCapture(L)},k=L=>{const B=T.capturedMap.get(L);B&&ZZ(T.capturedMap,x.eventObject,B,L)};let O={};for(let L in c){let B=c[L];typeof B!="function"&&(O[L]=B)}let R={...x,...O,pointer:S,intersections:l,stopped:m.stopped,delta:f,unprojectedPoint:A,ray:_.ray,camera:M,stopPropagation(){const L="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!L||L.has(x.eventObject))&&(R.stopped=m.stopped=!0,T.hovered.size&&Array.from(T.hovered.values()).find(B=>B.eventObject===x.eventObject))){const B=l.slice(0,l.indexOf(x));s([...B,x])}},target:{hasPointerCapture:N,setPointerCapture:D,releasePointerCapture:k},currentTarget:{hasPointerCapture:N,setPointerCapture:D,releasePointerCapture:k},nativeEvent:c};if(h(R),m.stopped===!0)break}}}return l}function s(l){const{internal:c}=t.getState();for(const f of c.hovered.values())if(!l.length||!l.find(h=>h.object===f.object&&h.index===f.index&&h.instanceId===f.instanceId)){const m=f.eventObject.__r3f;if(c.hovered.delete(QM(f)),m!=null&&m.eventCount){const x=m.handlers,b={...f,intersections:l};x.onPointerOut==null||x.onPointerOut(b),x.onPointerLeave==null||x.onPointerLeave(b)}}}function o(l,c){for(let f=0;f<c.length;f++){const h=c[f].__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:f}=t.getState();"pointerId"in c&&f.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{f.capturedMap.has(c.pointerId)&&(f.capturedMap.delete(c.pointerId),s([]))})}}return function(f){const{onPointerMissed:h,internal:m}=t.getState();m.lastEvent.current=f;const x=l==="onPointerMove",b=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",S=r(f,x?n:void 0),M=b?e(f):0;l==="onPointerDown"&&(m.initialClick=[f.offsetX,f.offsetY],m.initialHits=S.map(A=>A.eventObject)),b&&!S.length&&M<=2&&(o(f,m.interaction),h&&h(f)),x&&s(S);function T(A){const N=A.eventObject,D=N.__r3f;if(!(D!=null&&D.eventCount))return;const k=D.handlers;if(x){if(k.onPointerOver||k.onPointerEnter||k.onPointerOut||k.onPointerLeave){const O=QM(A),R=m.hovered.get(O);R?R.stopped&&A.stopPropagation():(m.hovered.set(O,A),k.onPointerOver==null||k.onPointerOver(A),k.onPointerEnter==null||k.onPointerEnter(A))}k.onPointerMove==null||k.onPointerMove(A)}else{const O=k[l];O?(!b||m.initialHits.includes(N))&&(o(f,m.interaction.filter(R=>!m.initialHits.includes(R))),O(A)):b&&m.initialHits.includes(N)&&o(f,m.interaction.filter(R=>!m.initialHits.includes(R)))}}i(S,f,M,T)}}return{handlePointer:a}}const wF=t=>!!(t!=null&&t.render),QZ=w.createContext(null),r6e=(t,e)=>{const n=IAe((a,l)=>{const c=new Ge,f=new Ge,h=new Ge;function m(M=l().camera,T=f,A=l().size){const{width:N,height:D,top:k,left:O}=A,R=N/D;T.isVector3?h.copy(T):h.set(...T);const L=M.getWorldPosition(c).distanceTo(h);if(qZ(M))return{width:N/M.zoom,height:D/M.zoom,top:k,left:O,factor:1,distance:L,aspect:R};{const B=M.fov*Math.PI/180,H=2*Math.tan(B/2)*L,$=H*(N/D);return{width:$,height:H,top:k,left:O,factor:N/$,distance:L,aspect:R}}}let x;const b=M=>a(T=>({performance:{...T.performance,current:M}})),_=new qt;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(M=1)=>t(l(),M),advance:(M,T)=>e(M,T,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new IZ,pointer:_,mouse:_,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const M=l();x&&clearTimeout(x),M.performance.current!==M.performance.min&&b(M.performance.min),x=setTimeout(()=>b(l().performance.max),M.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:m},setEvents:M=>a(T=>({...T,events:{...T.events,...M}})),setSize:(M,T,A=0,N=0)=>{const D=l().camera,k={width:M,height:T,top:A,left:N};a(O=>({size:k,viewport:{...O.viewport,...m(D,f,k)}}))},setDpr:M=>a(T=>{const A=YZ(M);return{viewport:{...T.viewport,dpr:A,initialDpr:T.viewport.initialDpr||A}}}),setFrameloop:(M="always")=>{const T=l().clock;T.stop(),T.elapsedTime=0,M!=="never"&&(T.start(),T.elapsedTime=0),a(()=>({frameloop:M}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:w.createRef(),active:!1,frames:0,priority:0,subscribe:(M,T,A)=>{const N=l().internal;return N.priority=N.priority+(T>0?1:0),N.subscribers.push({ref:M,priority:T,store:A}),N.subscribers=N.subscribers.sort((D,k)=>D.priority-k.priority),()=>{const D=l().internal;D!=null&&D.subscribers&&(D.priority=D.priority-(T>0?1:0),D.subscribers=D.subscribers.filter(k=>k.ref!==M))}}}}}),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:f,set:h}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){i=l,s=c.dpr,e6e(a,l),c.dpr>0&&f.setPixelRatio(c.dpr);const m=typeof HTMLCanvasElement<"u"&&f.domElement instanceof HTMLCanvasElement;f.setSize(l.width,l.height,m)}a!==o&&(o=a,h(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};function JZ(){const t=w.useContext(QZ);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function Dc(t=n=>n,e){return JZ()(t,e)}function NE(t,e=0){const n=JZ(),r=n.getState().internal.subscribe,i=XZ(t);return a3(()=>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 i6e=1,s6e=8,o6e=32,a6e=2;var l6e={version:"9.5.0"};function c6e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var SF={exports:{}},MF={exports:{}},TF;function u6e(){return TF||(TF=1,(function(t){t.exports=function(e){function n(g,v,E,P){return new gb(g,v,E,P)}function r(){}function i(g){var v="https://react.dev/errors/"+g;if(1<arguments.length){v+="?args[]="+encodeURIComponent(arguments[1]);for(var E=2;E<arguments.length;E++)v+="&args[]="+encodeURIComponent(arguments[E])}return"Minified React error #"+g+"; visit "+v+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(g){var v=g,E=g;if(g.alternate)for(;v.return;)v=v.return;else{g=v;do v=g,(v.flags&4098)!==0&&(E=v.return),g=v.return;while(g)}return v.tag===3?E:null}function o(g){if(s(g)!==g)throw Error(i(188))}function a(g){var v=g.alternate;if(!v){if(v=s(g),v===null)throw Error(i(188));return v!==g?null:g}for(var E=g,P=v;;){var q=E.return;if(q===null)break;var te=q.alternate;if(te===null){if(P=q.return,P!==null){E=P;continue}break}if(q.child===te.child){for(te=q.child;te;){if(te===E)return o(q),g;if(te===P)return o(q),v;te=te.sibling}throw Error(i(188))}if(E.return!==P.return)E=q,P=te;else{for(var Oe=!1,ut=q.child;ut;){if(ut===E){Oe=!0,E=q,P=te;break}if(ut===P){Oe=!0,P=q,E=te;break}ut=ut.sibling}if(!Oe){for(ut=te.child;ut;){if(ut===E){Oe=!0,E=te,P=q;break}if(ut===P){Oe=!0,P=te,E=q;break}ut=ut.sibling}if(!Oe)throw Error(i(189))}}if(E.alternate!==P)throw Error(i(190))}if(E.tag!==3)throw Error(i(188));return E.stateNode.current===E?g:v}function l(g){var v=g.tag;if(v===5||v===26||v===27||v===6)return g;for(g=g.child;g!==null;){if(v=l(g),v!==null)return v;g=g.sibling}return null}function c(g){var v=g.tag;if(v===5||v===26||v===27||v===6)return g;for(g=g.child;g!==null;){if(g.tag!==4&&(v=c(g),v!==null))return v;g=g.sibling}return null}function f(g){return g===null||typeof g!="object"?null:(g=Od&&g[Od]||g["@@iterator"],typeof g=="function"?g:null)}function h(g){if(g==null)return null;if(typeof g=="function")return g.$$typeof===Mf?null:g.displayName||g.name||null;if(typeof g=="string")return g;switch(g){case Lh:return"Fragment";case zh:return"Profiler";case jh:return"StrictMode";case mv:return"Suspense";case Dd:return"SuspenseList";case mg:return"Activity"}if(typeof g=="object")switch(g.$$typeof){case Oh:return"Portal";case gc:return g.displayName||"Context";case pg:return(g._context.displayName||"Context")+".Consumer";case lm:var v=g.render;return g=g.displayName,g||(g=v.displayName||v.name||"",g=g!==""?"ForwardRef("+g+")":"ForwardRef"),g;case gv:return v=g.displayName||null,v!==null?v:h(g.type)||"Memo";case za:v=g._payload,g=g._init;try{return h(g(v))}catch{}}return null}function m(g){return{current:g}}function x(g){0>Gh||(g.current=Nv[Gh],Nv[Gh]=null,Gh--)}function b(g,v){Gh++,Nv[Gh]=g.current,g.current=v}function _(g){return g>>>=0,g===0?32:31-(kv(g)/e4|0)|0}function S(g){var v=g&42;if(v!==0)return v;switch(g&-g){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 g&261888;case 262144:case 524288:case 1048576:case 2097152:return g&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return g&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return g}}function M(g,v,E){var P=g.pendingLanes;if(P===0)return 0;var q=0,te=g.suspendedLanes,Oe=g.pingedLanes;g=g.warmLanes;var ut=P&134217727;return ut!==0?(P=ut&~te,P!==0?q=S(P):(Oe&=ut,Oe!==0?q=S(Oe):E||(E=ut&~g,E!==0&&(q=S(E))))):(ut=P&~te,ut!==0?q=S(ut):Oe!==0?q=S(Oe):E||(E=P&~g,E!==0&&(q=S(E)))),q===0?0:v!==0&&v!==q&&(v&te)===0&&(te=q&-q,E=v&-v,te>=E||te===32&&(E&4194048)!==0)?v:q}function T(g,v){return(g.pendingLanes&~(g.suspendedLanes&~g.pingedLanes)&v)===0}function A(g,v){switch(g){case 1:case 2:case 4:case 8:case 64:return v+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 v+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 g=mm;return mm<<=1,(mm&62914560)===0&&(mm=4194304),g}function D(g){for(var v=[],E=0;31>E;E++)v.push(g);return v}function k(g,v){g.pendingLanes|=v,v!==268435456&&(g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0)}function O(g,v,E,P,q,te){var Oe=g.pendingLanes;g.pendingLanes=E,g.suspendedLanes=0,g.pingedLanes=0,g.warmLanes=0,g.expiredLanes&=E,g.entangledLanes&=E,g.errorRecoveryDisabledLanes&=E,g.shellSuspendCounter=0;var ut=g.entanglements,Ft=g.expirationTimes,on=g.hiddenUpdates;for(E=Oe&~E;0<E;){var _n=31-ll(E),ln=1<<_n;ut[_n]=0,Ft[_n]=-1;var Pn=on[_n];if(Pn!==null)for(on[_n]=null,_n=0;_n<Pn.length;_n++){var br=Pn[_n];br!==null&&(br.lane&=-536870913)}E&=~ln}P!==0&&R(g,P,0),te!==0&&q===0&&g.tag!==0&&(g.suspendedLanes|=te&~(Oe&~v))}function R(g,v,E){g.pendingLanes|=v,g.suspendedLanes&=~v;var P=31-ll(v);g.entangledLanes|=v,g.entanglements[P]=g.entanglements[P]|1073741824|E&261930}function L(g,v){var E=g.entangledLanes|=v;for(g=g.entanglements;E;){var P=31-ll(E),q=1<<P;q&v|g[P]&v&&(g[P]|=v),E&=~q}}function B(g,v){var E=v&-v;return E=(E&42)!==0?1:H(E),(E&(g.suspendedLanes|v))!==0?0:E}function H(g){switch(g){case 2:g=1;break;case 8:g=4;break;case 32:g=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:g=128;break;case 268435456:g=134217728;break;default:g=0}return g}function $(g){return g&=-g,2<g?8<g?(g&134217727)!==0?32:268435456:8:2}function G(g){if(typeof t_=="function"&&r4(g),cl&&typeof cl.setStrictMode=="function")try{cl.setStrictMode(Wh,g)}catch{}}function Z(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}function V(g){if(Lv===void 0)try{throw Error()}catch(E){var v=E.stack.trim().match(/\n( *(at )?)/);Lv=v&&v[1]||"",Bu=-1<E.stack.indexOf(`
    at`)?" (<anonymous>)":-1<E.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Lv+g+Bu}function W(g,v){if(!g||Mg)return"";Mg=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var P={DetermineComponentFrameRoot:function(){try{if(v){var ln=function(){throw Error()};if(Object.defineProperty(ln.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ln,[])}catch(br){var Pn=br}Reflect.construct(g,[],ln)}else{try{ln.call()}catch(br){Pn=br}g.call(ln.prototype)}}else{try{throw Error()}catch(br){Pn=br}(ln=g())&&typeof ln.catch=="function"&&ln.catch(function(){})}}catch(br){if(br&&Pn&&typeof br.stack=="string")return[br.stack,Pn.stack]}return[null,null]}};P.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var q=Object.getOwnPropertyDescriptor(P.DetermineComponentFrameRoot,"name");q&&q.configurable&&Object.defineProperty(P.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var te=P.DetermineComponentFrameRoot(),Oe=te[0],ut=te[1];if(Oe&&ut){var Ft=Oe.split(`
`),on=ut.split(`
`);for(q=P=0;P<Ft.length&&!Ft[P].includes("DetermineComponentFrameRoot");)P++;for(;q<on.length&&!on[q].includes("DetermineComponentFrameRoot");)q++;if(P===Ft.length||q===on.length)for(P=Ft.length-1,q=on.length-1;1<=P&&0<=q&&Ft[P]!==on[q];)q--;for(;1<=P&&0<=q;P--,q--)if(Ft[P]!==on[q]){if(P!==1||q!==1)do if(P--,q--,0>q||Ft[P]!==on[q]){var _n=`
`+Ft[P].replace(" at new "," at ");return g.displayName&&_n.includes("<anonymous>")&&(_n=_n.replace("<anonymous>",g.displayName)),_n}while(1<=P&&0<=q);break}}}finally{Mg=!1,Error.prepareStackTrace=E}return(E=g?g.displayName||g.name:"")?V(E):""}function J(g,v){switch(g.tag){case 26:case 27:case 5:return V(g.type);case 16:return V("Lazy");case 13:return g.child!==v&&v!==null?V("Suspense Fallback"):V("Suspense");case 19:return V("SuspenseList");case 0:case 15:return W(g.type,!1);case 11:return W(g.type.render,!1);case 1:return W(g.type,!0);case 31:return V("Activity");default:return""}}function ne(g){try{var v="",E=null;do v+=J(g,E),E=g,g=g.return;while(g);return v}catch(P){return`
Error generating stack: `+P.message+`
`+P.stack}}function ie(g,v){if(typeof g=="object"&&g!==null){var E=n_.get(g);return E!==void 0?E:(v={value:g,source:v,stack:ne(v)},n_.set(g,v),v)}return{value:g,source:v,stack:ne(v)}}function z(g,v){zd[Hu++]=Tg,zd[Hu++]=Ui,Ui=g,Tg=v}function j(g,v,E){yc[Ol++]=oa,yc[Ol++]=eu,yc[Ol++]=bc,bc=g;var P=oa;g=eu;var q=32-ll(P)-1;P&=~(1<<q),E+=1;var te=32-ll(v)+q;if(30<te){var Oe=q-q%5;te=(P&(1<<Oe)-1).toString(32),P>>=Oe,q-=Oe,oa=1<<32-ll(v)+q|E<<q|P,eu=te+g}else oa=1<<te|E<<q|P,eu=g}function X(g){g.return!==null&&(z(g,1),j(g,1,0))}function F(g){for(;g===Ui;)Ui=zd[--Hu],zd[Hu]=null,Tg=zd[--Hu],zd[Hu]=null;for(;g===bc;)bc=yc[--Ol],yc[Ol]=null,eu=yc[--Ol],yc[Ol]=null,oa=yc[--Ol],yc[Ol]=null}function ce(g,v){yc[Ol++]=oa,yc[Ol++]=eu,yc[Ol++]=bc,oa=v.id,eu=v.overflow,bc=g}function oe(g,v){b(aa,v),b(Fd,g),b(qo,null),g=g3(v),x(qo),b(qo,g)}function Q(){x(qo),x(Fd),x(aa)}function se(g){g.memoizedState!==null&&b(Cg,g);var v=qo.current,E=dm(v,g.type);v!==E&&(b(Fd,g),b(qo,E))}function re(g){Fd.current===g&&(x(qo),x(Fd)),Cg.current===g&&(x(Cg),Js?Bh._currentValue=Uh:Bh._currentValue2=Uh)}function K(g){var v=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Me(ie(v,g)),jv}function fe(g,v){if(!hs)throw Error(i(175));H3(g.stateNode,g.type,g.memoizedProps,v,g)||K(g,!0)}function he(g){for(Io=g.return;Io;)switch(Io.tag){case 5:case 31:case 13:Ua=!1;return;case 27:case 3:Ua=!0;return;default:Io=Io.return}}function ae(g){if(!hs||g!==Io)return!1;if(!qr)return he(g),qr=!0,!1;var v=g.tag;if(Po?v!==3&&v!==27&&(v!==5||pm(g.type)&&!Fa(g.type,g.memoizedProps))&&ps&&K(g):v!==3&&(v!==5||pm(g.type)&&!Fa(g.type,g.memoizedProps))&&ps&&K(g),he(g),v===13){if(!hs)throw Error(i(316));if(g=g.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));ps=Vb(g)}else if(v===31){if(g=g.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));ps=V3(g)}else ps=Po&&v===27?D3(g.type,ps):Io?I3(g.stateNode):null;return!0}function Se(){hs&&(ps=Io=null,qr=!1)}function de(){var g=Gu;return g!==null&&(fl===null?fl=g:fl.push.apply(fl,g),Gu=null),g}function Me(g){Gu===null?Gu=[g]:Gu.push(g)}function Ce(g,v,E){Js?(b(_c,v._currentValue),v._currentValue=E):(b(_c,v._currentValue2),v._currentValue2=E)}function Re(g){var v=_c.current;Js?g._currentValue=v:g._currentValue2=v,x(_c)}function le(g,v,E){for(;g!==null;){var P=g.alternate;if((g.childLanes&v)!==v?(g.childLanes|=v,P!==null&&(P.childLanes|=v)):P!==null&&(P.childLanes&v)!==v&&(P.childLanes|=v),g===E)break;g=g.return}}function He(g,v,E,P){var q=g.child;for(q!==null&&(q.return=g);q!==null;){var te=q.dependencies;if(te!==null){var Oe=q.child;te=te.firstContext;e:for(;te!==null;){var ut=te;te=q;for(var Ft=0;Ft<v.length;Ft++)if(ut.context===v[Ft]){te.lanes|=E,ut=te.alternate,ut!==null&&(ut.lanes|=E),le(te.return,E,g),P||(Oe=null);break e}te=ut.next}}else if(q.tag===18){if(Oe=q.return,Oe===null)throw Error(i(341));Oe.lanes|=E,te=Oe.alternate,te!==null&&(te.lanes|=E),le(Oe,E,g),Oe=null}else Oe=q.child;if(Oe!==null)Oe.return=q;else for(Oe=q;Oe!==null;){if(Oe===g){Oe=null;break}if(q=Oe.sibling,q!==null){q.return=Oe.return,Oe=q;break}Oe=Oe.return}q=Oe}}function Le(g,v,E,P){g=null;for(var q=v,te=!1;q!==null;){if(!te){if((q.flags&524288)!==0)te=!0;else if((q.flags&262144)!==0)break}if(q.tag===10){var Oe=q.alternate;if(Oe===null)throw Error(i(387));if(Oe=Oe.memoizedProps,Oe!==null){var ut=q.type;to(q.pendingProps.value,Oe.value)||(g!==null?g.push(ut):g=[ut])}}else if(q===Cg.current){if(Oe=q.alternate,Oe===null)throw Error(i(387));Oe.memoizedState.memoizedState!==q.memoizedState.memoizedState&&(g!==null?g.push(Bh):g=[Bh])}q=q.return}g!==null&&He(v,g,E,P),v.flags|=262144}function ze(g){for(g=g.firstContext;g!==null;){var v=g.context;if(!to(Js?v._currentValue:v._currentValue2,g.memoizedValue))return!0;g=g.next}return!1}function Ve(g){Zi=g,tu=null,g=g.dependencies,g!==null&&(g.firstContext=null)}function ue(g){return xe(Zi,g)}function Y(g,v){return Zi===null&&Ve(g),xe(g,v)}function xe(g,v){var E=Js?v._currentValue:v._currentValue2;if(v={context:v,memoizedValue:E,next:null},tu===null){if(g===null)throw Error(i(308));tu=v,g.dependencies={lanes:0,firstContext:v},g.flags|=524288}else tu=tu.next=v;return E}function we(){return{controller:new i4,data:new Map,refCount:0}}function Te(g){g.refCount--,g.refCount===0&&Xo(BE,function(){g.controller.abort()})}function ge(){}function Ue(g){g!==Ai&&g.next===null&&(Ai===null?Eg=Ai=g:Ai=Ai.next=g),wc=!0,Ma||(Ma=!0,Pe())}function be(g,v){if(!zv&&wc){zv=!0;do for(var E=!1,P=Eg;P!==null;){if(g!==0){var q=P.pendingLanes;if(q===0)var te=0;else{var Oe=P.suspendedLanes,ut=P.pingedLanes;te=(1<<31-ll(42|g)+1)-1,te&=q&~(Oe&~ut),te=te&201326741?te&201326741|1:te?te|2:0}te!==0&&(E=!0,st(P,te))}else te=Xr,te=M(P,P===Dr?te:0,P.cancelPendingCommit!==null||P.timeoutHandle!==al),(te&3)===0||T(P,te)||(E=!0,st(P,te));P=P.next}while(E);zv=!1}}function ke(){qe()}function qe(){wc=Ma=!1;var g=0;Nf!==0&&Fh()&&(g=Nf);for(var v=Sa(),E=null,P=Eg;P!==null;){var q=P.next,te=Qe(P,v);te===0?(P.next=null,E===null?Eg=q:E.next=q,q===null&&(Ai=E)):(E=P,(g!==0||(te&3)!==0)&&(wc=!0)),P=q}yo!==0&&yo!==5||be(g),Nf!==0&&(Nf=0)}function Qe(g,v){for(var E=g.suspendedLanes,P=g.pingedLanes,q=g.expirationTimes,te=g.pendingLanes&-62914561;0<te;){var Oe=31-ll(te),ut=1<<Oe,Ft=q[Oe];Ft===-1?((ut&E)===0||(ut&P)!==0)&&(q[Oe]=A(ut,v)):Ft<=v&&(g.expiredLanes|=ut),te&=~ut}if(v=Dr,E=Xr,E=M(g,g===v?E:0,g.cancelPendingCommit!==null||g.timeoutHandle!==al),P=g.callbackNode,E===0||g===v&&(ki===2||ki===9)||g.cancelPendingCommit!==null)return P!==null&&P!==null&&Pv(P),g.callbackNode=null,g.callbackPriority=0;if((E&3)===0||T(g,E)){if(v=E&-E,v===g.callbackPriority)return v;switch(P!==null&&Pv(P),$(E)){case 2:case 8:E=n4;break;case 32:E=Sg;break;case 268435456:E=Dv;break;default:E=Sg}return P=nt.bind(null,g),E=wg(E,P),g.callbackPriority=v,g.callbackNode=E,v}return P!==null&&P!==null&&Pv(P),g.callbackPriority=2,g.callbackNode=null,2}function nt(g,v){if(yo!==0&&yo!==5)return g.callbackNode=null,g.callbackPriority=0,null;var E=g.callbackNode;if(zu()&&g.callbackNode!==E)return null;var P=Xr;return P=M(g,g===Dr?P:0,g.cancelPendingCommit!==null||g.timeoutHandle!==al),P===0?null:(Jc(g,P,v),Qe(g,Sa()),g.callbackNode!=null&&g.callbackNode===E?nt.bind(null,g):null)}function st(g,v){if(zu())return null;Jc(g,v,!0)}function Pe(){Ab?Nb(function(){(Br&6)!==0?wg(Iv,ke):qe()}):wg(Iv,ke)}function Ke(){if(Nf===0){var g=Ud;g===0&&(g=Rv,Rv<<=1,(Rv&261888)===0&&(Rv=256)),Nf=g}return Nf}function rt(g,v){if(gm===null){var E=gm=[];r_=0,Ud=Ke(),Do={status:"pending",value:void 0,then:function(P){E.push(P)}}}return r_++,v.then(ye,ye),v}function ye(){if(--r_===0&&gm!==null){Do!==null&&(Do.status="fulfilled");var g=gm;gm=null,Ud=0,Do=null;for(var v=0;v<g.length;v++)(0,g[v])()}}function $e(g,v){var E=[],P={status:"pending",value:null,reason:null,then:function(q){E.push(q)}};return g.then(function(){P.status="fulfilled",P.value=v;for(var q=0;q<E.length;q++)(0,E[q])(v)},function(q){for(P.status="rejected",P.reason=q,q=0;q<E.length;q++)(0,E[q])(void 0)}),P}function Ze(){var g=kf.current;return g!==null?g:Dr.pooledCache}function ft(g,v){v===null?b(kf,kf.current):b(kf,v.pool)}function lt(){var g=Ze();return g===null?null:{parent:Js?ms._currentValue:ms._currentValue2,pool:g}}function Je(g,v){if(to(g,v))return!0;if(typeof g!="object"||g===null||typeof v!="object"||v===null)return!1;var E=Object.keys(g),P=Object.keys(v);if(E.length!==P.length)return!1;for(P=0;P<E.length;P++){var q=E[P];if(!UE.call(v,q)||!to(g[q],v[q]))return!1}return!0}function Ae(g){return g=g.status,g==="fulfilled"||g==="rejected"}function We(g,v,E){switch(E=g[E],E===void 0?g.push(v):E!==v&&(v.then(ge,ge),v=E),v.status){case"fulfilled":return v.value;case"rejected":throw g=v.reason,ot(g),g;default:if(typeof v.status=="string")v.then(ge,ge);else{if(g=Dr,g!==null&&100<g.shellSuspendCounter)throw Error(i(482));g=v,g.status="pending",g.then(function(P){if(v.status==="pending"){var q=v;q.status="fulfilled",q.value=P}},function(P){if(v.status==="pending"){var q=v;q.status="rejected",q.reason=P}})}switch(v.status){case"fulfilled":return v.value;case"rejected":throw g=v.reason,ot(g),g}throw Ba=v,Oo}}function De(g){try{var v=g._init;return v(g._payload)}catch(E){throw E!==null&&typeof E=="object"&&typeof E.then=="function"?(Ba=E,Oo):E}}function Ne(){if(Ba===null)throw Error(i(459));var g=Ba;return Ba=null,g}function ot(g){if(g===Oo||g===Mc)throw Error(i(483))}function dt(g){var v=$h;return $h+=1,Rf===null&&(Rf=[]),We(Rf,g,v)}function Pt(g,v){v=v.props.ref,g.ref=v!==void 0?v:null}function kt(g,v){throw v.$$typeof===Dh?Error(i(525)):(g=Object.prototype.toString.call(v),Error(i(31,g==="[object Object]"?"object with keys {"+Object.keys(v).join(", ")+"}":g)))}function wt(g){function v(Nt,St){if(g){var jt=Nt.deletions;jt===null?(Nt.deletions=[St],Nt.flags|=16):jt.push(St)}}function E(Nt,St){if(!g)return null;for(;St!==null;)v(Nt,St),St=St.sibling;return null}function P(Nt){for(var St=new Map;Nt!==null;)Nt.key!==null?St.set(Nt.key,Nt):St.set(Nt.index,Nt),Nt=Nt.sibling;return St}function q(Nt,St){return Nt=Il(Nt,St),Nt.index=0,Nt.sibling=null,Nt}function te(Nt,St,jt){return Nt.index=jt,g?(jt=Nt.alternate,jt!==null?(jt=jt.index,jt<St?(Nt.flags|=67108866,St):jt):(Nt.flags|=67108866,St)):(Nt.flags|=1048576,St)}function Oe(Nt){return g&&Nt.alternate===null&&(Nt.flags|=67108866),Nt}function ut(Nt,St,jt,xn){return St===null||St.tag!==6?(St=xb(jt,Nt.mode,xn),St.return=Nt,St):(St=q(St,jt),St.return=Nt,St)}function Ft(Nt,St,jt,xn){var tr=jt.type;return tr===Lh?_n(Nt,St,jt.props.children,xn,jt.key):St!==null&&(St.elementType===tr||typeof tr=="object"&&tr!==null&&tr.$$typeof===za&&De(tr)===St.type)?(St=q(St,jt.props),Pt(St,jt),St.return=Nt,St):(St=Id(jt.type,jt.key,jt.props,null,Nt.mode,xn),Pt(St,jt),St.return=Nt,St)}function on(Nt,St,jt,xn){return St===null||St.tag!==4||St.stateNode.containerInfo!==jt.containerInfo||St.stateNode.implementation!==jt.implementation?(St=yb(jt,Nt.mode,xn),St.return=Nt,St):(St=q(St,jt.children||[]),St.return=Nt,St)}function _n(Nt,St,jt,xn,tr){return St===null||St.tag!==7?(St=mc(jt,Nt.mode,xn,tr),St.return=Nt,St):(St=q(St,jt),St.return=Nt,St)}function ln(Nt,St,jt){if(typeof St=="string"&&St!==""||typeof St=="number"||typeof St=="bigint")return St=xb(""+St,Nt.mode,jt),St.return=Nt,St;if(typeof St=="object"&&St!==null){switch(St.$$typeof){case Fu:return jt=Id(St.type,St.key,St.props,null,Nt.mode,jt),Pt(jt,St),jt.return=Nt,jt;case Oh:return St=yb(St,Nt.mode,jt),St.return=Nt,St;case za:return St=De(St),ln(Nt,St,jt)}if(Tf(St)||f(St))return St=mc(St,Nt.mode,jt,null),St.return=Nt,St;if(typeof St.then=="function")return ln(Nt,dt(St),jt);if(St.$$typeof===gc)return ln(Nt,Y(Nt,St),jt);kt(Nt,St)}return null}function Pn(Nt,St,jt,xn){var tr=St!==null?St.key:null;if(typeof jt=="string"&&jt!==""||typeof jt=="number"||typeof jt=="bigint")return tr!==null?null:ut(Nt,St,""+jt,xn);if(typeof jt=="object"&&jt!==null){switch(jt.$$typeof){case Fu:return jt.key===tr?Ft(Nt,St,jt,xn):null;case Oh:return jt.key===tr?on(Nt,St,jt,xn):null;case za:return jt=De(jt),Pn(Nt,St,jt,xn)}if(Tf(jt)||f(jt))return tr!==null?null:_n(Nt,St,jt,xn,null);if(typeof jt.then=="function")return Pn(Nt,St,dt(jt),xn);if(jt.$$typeof===gc)return Pn(Nt,St,Y(Nt,jt),xn);kt(Nt,jt)}return null}function br(Nt,St,jt,xn,tr){if(typeof xn=="string"&&xn!==""||typeof xn=="number"||typeof xn=="bigint")return Nt=Nt.get(jt)||null,ut(St,Nt,""+xn,tr);if(typeof xn=="object"&&xn!==null){switch(xn.$$typeof){case Fu:return Nt=Nt.get(xn.key===null?jt:xn.key)||null,Ft(St,Nt,xn,tr);case Oh:return Nt=Nt.get(xn.key===null?jt:xn.key)||null,on(St,Nt,xn,tr);case za:return xn=De(xn),br(Nt,St,jt,xn,tr)}if(Tf(xn)||f(xn))return Nt=Nt.get(jt)||null,_n(St,Nt,xn,tr,null);if(typeof xn.then=="function")return br(Nt,St,jt,dt(xn),tr);if(xn.$$typeof===gc)return br(Nt,St,jt,Y(St,xn),tr);kt(St,xn)}return null}function io(Nt,St,jt,xn){for(var tr=null,Ps=null,sr=St,si=St=0,Yo=null;sr!==null&&si<jt.length;si++){sr.index>si?(Yo=sr,sr=null):Yo=sr.sibling;var gi=Pn(Nt,sr,jt[si],xn);if(gi===null){sr===null&&(sr=Yo);break}g&&sr&&gi.alternate===null&&v(Nt,sr),St=te(gi,St,si),Ps===null?tr=gi:Ps.sibling=gi,Ps=gi,sr=Yo}if(si===jt.length)return E(Nt,sr),qr&&z(Nt,si),tr;if(sr===null){for(;si<jt.length;si++)sr=ln(Nt,jt[si],xn),sr!==null&&(St=te(sr,St,si),Ps===null?tr=sr:Ps.sibling=sr,Ps=sr);return qr&&z(Nt,si),tr}for(sr=P(sr);si<jt.length;si++)Yo=br(sr,Nt,si,jt[si],xn),Yo!==null&&(g&&Yo.alternate!==null&&sr.delete(Yo.key===null?si:Yo.key),St=te(Yo,St,si),Ps===null?tr=Yo:Ps.sibling=Yo,Ps=Yo);return g&&sr.forEach(function(Ec){return v(Nt,Ec)}),qr&&z(Nt,si),tr}function Mm(Nt,St,jt,xn){if(jt==null)throw Error(i(151));for(var tr=null,Ps=null,sr=St,si=St=0,Yo=null,gi=jt.next();sr!==null&&!gi.done;si++,gi=jt.next()){sr.index>si?(Yo=sr,sr=null):Yo=sr.sibling;var Ec=Pn(Nt,sr,gi.value,xn);if(Ec===null){sr===null&&(sr=Yo);break}g&&sr&&Ec.alternate===null&&v(Nt,sr),St=te(Ec,St,si),Ps===null?tr=Ec:Ps.sibling=Ec,Ps=Ec,sr=Yo}if(gi.done)return E(Nt,sr),qr&&z(Nt,si),tr;if(sr===null){for(;!gi.done;si++,gi=jt.next())gi=ln(Nt,gi.value,xn),gi!==null&&(St=te(gi,St,si),Ps===null?tr=gi:Ps.sibling=gi,Ps=gi);return qr&&z(Nt,si),tr}for(sr=P(sr);!gi.done;si++,gi=jt.next())gi=br(sr,Nt,si,gi.value,xn),gi!==null&&(g&&gi.alternate!==null&&sr.delete(gi.key===null?si:gi.key),St=te(gi,St,si),Ps===null?tr=gi:Ps.sibling=gi,Ps=gi);return g&&sr.forEach(function(HE){return v(Nt,HE)}),qr&&z(Nt,si),tr}function Ff(Nt,St,jt,xn){if(typeof jt=="object"&&jt!==null&&jt.type===Lh&&jt.key===null&&(jt=jt.props.children),typeof jt=="object"&&jt!==null){switch(jt.$$typeof){case Fu:e:{for(var tr=jt.key;St!==null;){if(St.key===tr){if(tr=jt.type,tr===Lh){if(St.tag===7){E(Nt,St.sibling),xn=q(St,jt.props.children),xn.return=Nt,Nt=xn;break e}}else if(St.elementType===tr||typeof tr=="object"&&tr!==null&&tr.$$typeof===za&&De(tr)===St.type){E(Nt,St.sibling),xn=q(St,jt.props),Pt(xn,jt),xn.return=Nt,Nt=xn;break e}E(Nt,St);break}else v(Nt,St);St=St.sibling}jt.type===Lh?(xn=mc(jt.props.children,Nt.mode,xn,jt.key),xn.return=Nt,Nt=xn):(xn=Id(jt.type,jt.key,jt.props,null,Nt.mode,xn),Pt(xn,jt),xn.return=Nt,Nt=xn)}return Oe(Nt);case Oh:e:{for(tr=jt.key;St!==null;){if(St.key===tr)if(St.tag===4&&St.stateNode.containerInfo===jt.containerInfo&&St.stateNode.implementation===jt.implementation){E(Nt,St.sibling),xn=q(St,jt.children||[]),xn.return=Nt,Nt=xn;break e}else{E(Nt,St);break}else v(Nt,St);St=St.sibling}xn=yb(jt,Nt.mode,xn),xn.return=Nt,Nt=xn}return Oe(Nt);case za:return jt=De(jt),Ff(Nt,St,jt,xn)}if(Tf(jt))return io(Nt,St,jt,xn);if(f(jt)){if(tr=f(jt),typeof tr!="function")throw Error(i(150));return jt=tr.call(jt),Mm(Nt,St,jt,xn)}if(typeof jt.then=="function")return Ff(Nt,St,dt(jt),xn);if(jt.$$typeof===gc)return Ff(Nt,St,Y(Nt,jt),xn);kt(Nt,jt)}return typeof jt=="string"&&jt!==""||typeof jt=="number"||typeof jt=="bigint"?(jt=""+jt,St!==null&&St.tag===6?(E(Nt,St.sibling),xn=q(St,jt),xn.return=Nt,Nt=xn):(E(Nt,St),xn=xb(jt,Nt.mode,xn),xn.return=Nt,Nt=xn),Oe(Nt)):E(Nt,St)}return function(Nt,St,jt,xn){try{$h=0;var tr=Ff(Nt,St,jt,xn);return Rf=null,tr}catch(sr){if(sr===Oo||sr===Mc)throw sr;var Ps=n(29,sr,null,Nt.mode);return Ps.lanes=xn,Ps.return=Nt,Ps}finally{}}}function Vt(){for(var g=Wu,v=qh=Wu=0;v<g;){var E=ca[v];ca[v++]=null;var P=ca[v];ca[v++]=null;var q=ca[v];ca[v++]=null;var te=ca[v];if(ca[v++]=null,P!==null&&q!==null){var Oe=P.pending;Oe===null?q.next=q:(q.next=Oe.next,Oe.next=q),P.pending=q}te!==0&&Dt(E,q,te)}}function rn(g,v,E,P){ca[Wu++]=g,ca[Wu++]=v,ca[Wu++]=E,ca[Wu++]=P,qh|=P,g.lanes|=P,g=g.alternate,g!==null&&(g.lanes|=P)}function Bt(g,v,E,P){return rn(g,v,E,P),Qt(g)}function Gt(g,v){return rn(g,null,null,v),Qt(g)}function Dt(g,v,E){g.lanes|=E;var P=g.alternate;P!==null&&(P.lanes|=E);for(var q=!1,te=g.return;te!==null;)te.childLanes|=E,P=te.alternate,P!==null&&(P.childLanes|=E),te.tag===22&&(g=te.stateNode,g===null||g._visibility&1||(q=!0)),g=te,te=te.return;return g.tag===3?(te=g.stateNode,q&&v!==null&&(q=31-ll(E),g=te.hiddenUpdates,P=g[q],P===null?g[q]=[v]:P.push(v),v.lane=E|536870912),te):null}function Qt(g){if(50<di)throw di=0,Ig=null,Error(i(185));for(var v=g.return;v!==null;)g=v,v=g.return;return g.tag===3?g.stateNode:null}function hn(g){g.updateQueue={baseState:g.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function It(g,v){g=g.updateQueue,v.updateQueue===g&&(v.updateQueue={baseState:g.baseState,firstBaseUpdate:g.firstBaseUpdate,lastBaseUpdate:g.lastBaseUpdate,shared:g.shared,callbacks:null})}function Lt(g){return{lane:g,tag:0,payload:null,callback:null,next:null}}function zt(g,v,E){var P=g.updateQueue;if(P===null)return null;if(P=P.shared,(Br&2)!==0){var q=P.pending;return q===null?v.next=v:(v.next=q.next,q.next=v),P.pending=v,v=Qt(g),Dt(g,null,E),v}return rn(g,P,v,E),Qt(g)}function pn(g,v,E){if(v=v.updateQueue,v!==null&&(v=v.shared,(E&4194048)!==0)){var P=v.lanes;P&=g.pendingLanes,E|=P,v.lanes=E,L(g,E)}}function Ot(g,v){var E=g.updateQueue,P=g.alternate;if(P!==null&&(P=P.updateQueue,E===P)){var q=null,te=null;if(E=E.firstBaseUpdate,E!==null){do{var Oe={lane:E.lane,tag:E.tag,payload:E.payload,callback:null,next:null};te===null?q=te=Oe:te=te.next=Oe,E=E.next}while(E!==null);te===null?q=te=v:te=te.next=v}else q=te=v;E={baseState:P.baseState,firstBaseUpdate:q,lastBaseUpdate:te,shared:P.shared,callbacks:P.callbacks},g.updateQueue=E;return}g=E.lastBaseUpdate,g===null?E.firstBaseUpdate=v:g.next=v,E.lastBaseUpdate=v}function Ct(){if(Uv){var g=Do;if(g!==null)throw g}}function tn(g,v,E,P){Uv=!1;var q=g.updateQueue;Ll=!1;var te=q.firstBaseUpdate,Oe=q.lastBaseUpdate,ut=q.shared.pending;if(ut!==null){q.shared.pending=null;var Ft=ut,on=Ft.next;Ft.next=null,Oe===null?te=on:Oe.next=on,Oe=Ft;var _n=g.alternate;_n!==null&&(_n=_n.updateQueue,ut=_n.lastBaseUpdate,ut!==Oe&&(ut===null?_n.firstBaseUpdate=on:ut.next=on,_n.lastBaseUpdate=Ft))}if(te!==null){var ln=q.baseState;Oe=0,_n=on=Ft=null,ut=te;do{var Pn=ut.lane&-536870913,br=Pn!==ut.lane;if(br?(Xr&Pn)===Pn:(P&Pn)===Pn){Pn!==0&&Pn===Ud&&(Uv=!0),_n!==null&&(_n=_n.next={lane:0,tag:ut.tag,payload:ut.payload,callback:null,next:null});e:{var io=g,Mm=ut;Pn=v;var Ff=E;switch(Mm.tag){case 1:if(io=Mm.payload,typeof io=="function"){ln=io.call(Ff,ln,Pn);break e}ln=io;break e;case 3:io.flags=io.flags&-65537|128;case 0:if(io=Mm.payload,Pn=typeof io=="function"?io.call(Ff,ln,Pn):io,Pn==null)break e;ln=pv({},ln,Pn);break e;case 2:Ll=!0}}Pn=ut.callback,Pn!==null&&(g.flags|=64,br&&(g.flags|=8192),br=q.callbacks,br===null?q.callbacks=[Pn]:br.push(Pn))}else br={lane:Pn,tag:ut.tag,payload:ut.payload,callback:ut.callback,next:null},_n===null?(on=_n=br,Ft=ln):_n=_n.next=br,Oe|=Pn;if(ut=ut.next,ut===null){if(ut=q.shared.pending,ut===null)break;br=ut,ut=br.next,br.next=null,q.lastBaseUpdate=br,q.shared.pending=null}}while(!0);_n===null&&(Ft=ln),q.baseState=Ft,q.firstBaseUpdate=on,q.lastBaseUpdate=_n,te===null&&(q.shared.lanes=0),Hd|=Oe,g.lanes=Oe,g.memoizedState=ln}}function en(g,v){if(typeof g!="function")throw Error(i(191,g));g.call(v)}function bn(g,v){var E=g.callbacks;if(E!==null)for(g.callbacks=null,g=0;g<E.length;g++)en(E[g],v)}function On(g,v){g=qu,b(Pf,g),b(Xh,v),qu=g|v.baseLanes}function _e(){b(Pf,qu),b(Xh,Xh.current)}function tt(){qu=Pf.current,x(Xh),x(Pf)}function gt(g){var v=g.alternate;b(Bs,Bs.current&1),b(ul,g),dl===null&&(v===null||Xh.current!==null||v.memoizedState!==null)&&(dl=g)}function pt(g){b(Bs,Bs.current),b(ul,g),dl===null&&(dl=g)}function xt(g){g.tag===22?(b(Bs,Bs.current),b(ul,g),dl===null&&(dl=g)):$t()}function $t(){b(Bs,Bs.current),b(ul,ul.current)}function sn(g){x(ul),dl===g&&(dl=null),x(Bs)}function Zt(g){for(var v=g;v!==null;){if(v.tag===13){var E=v.memoizedState;if(E!==null&&(E=E.dehydrated,E===null||Ef(E)||wv(E)))return v}else if(v.tag===19&&(v.memoizedProps.revealOrder==="forwards"||v.memoizedProps.revealOrder==="backwards"||v.memoizedProps.revealOrder==="unstable_legacy-backwards"||v.memoizedProps.revealOrder==="together")){if((v.flags&128)!==0)return v}else if(v.child!==null){v.child.return=v,v=v.child;continue}if(v===g)break;for(;v.sibling===null;){if(v.return===null||v.return===g)return null;v=v.return}v.sibling.return=v.return,v=v.sibling}return null}function Fe(){throw Error(i(321))}function bt(g,v){if(v===null)return!1;for(var E=0;E<v.length&&E<g.length;E++)if(!to(g[E],v[E]))return!1;return!0}function Tt(g,v,E,P,q,te){return Bd=te,Tr=v,v.memoizedState=null,v.updateQueue=null,v.lanes=0,Qn.H=g===null||g.memoizedState===null?Ns:$u,ti=!1,te=E(P,q),ti=!1,kr&&(te=Ht(v,E,P,q)),Yt(g),te}function Yt(g){Qn.H=jl;var v=$n!==null&&$n.next!==null;if(Bd=0,xr=$n=Tr=null,Ir=!1,Tc=0,nu=null,v)throw Error(i(300));g===null||rs||(g=g.dependencies,g!==null&&ze(g)&&(rs=!0))}function Ht(g,v,E,P){Tr=g;var q=0;do{if(kr&&(nu=null),Tc=0,kr=!1,25<=q)throw Error(i(301));if(q+=1,xr=$n=null,g.updateQueue!=null){var te=g.updateQueue;te.lastEffect=null,te.events=null,te.stores=null,te.memoCache!=null&&(te.memoCache.index=0)}Qn.H=If,te=v(E,P)}while(kr);return te}function Cn(){var g=Qn.H,v=g.useState()[0];return v=typeof v.then=="function"?vn(v):v,g=g.useState()[0],($n!==null?$n.memoizedState:null)!==g&&(Tr.flags|=1024),v}function zn(){var g=Ta!==0;return Ta=0,g}function Zn(g,v,E){v.updateQueue=g.updateQueue,v.flags&=-2053,g.lanes&=~E}function Xn(g){if(Ir){for(g=g.memoizedState;g!==null;){var v=g.queue;v!==null&&(v.pending=null),g=g.next}Ir=!1}Bd=0,xr=$n=Tr=null,kr=!1,Tc=Ta=0,nu=null}function ir(){var g={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xr===null?Tr.memoizedState=xr=g:xr=xr.next=g,xr}function dn(){if($n===null){var g=Tr.alternate;g=g!==null?g.memoizedState:null}else g=$n.next;var v=xr===null?Tr.memoizedState:xr.next;if(v!==null)xr=v,$n=g;else{if(g===null)throw Tr.alternate===null?Error(i(467)):Error(i(310));$n=g,g={memoizedState:$n.memoizedState,baseState:$n.baseState,baseQueue:$n.baseQueue,queue:$n.queue,next:null},xr===null?Tr.memoizedState=xr=g:xr=xr.next=g}return xr}function Wi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function vn(g){var v=Tc;return Tc+=1,nu===null&&(nu=[]),g=We(nu,g,v),v=Tr,(xr===null?v.memoizedState:xr.next)===null&&(v=v.alternate,Qn.H=v===null||v.memoizedState===null?Ns:$u),g}function ts(g){if(g!==null&&typeof g=="object"){if(typeof g.then=="function")return vn(g);if(g.$$typeof===gc)return ue(g)}throw Error(i(438,String(g)))}function Ds(g){var v=null,E=Tr.updateQueue;if(E!==null&&(v=E.memoCache),v==null){var P=Tr.alternate;P!==null&&(P=P.updateQueue,P!==null&&(P=P.memoCache,P!=null&&(v={data:P.data.map(function(q){return q.slice()}),index:0})))}if(v==null&&(v={data:[],index:0}),E===null&&(E=Wi(),Tr.updateQueue=E),E.memoCache=v,E=v.data[v.index],E===void 0)for(E=v.data[v.index]=Array(g),P=0;P<g;P++)E[P]=_b;return v.index++,E}function Li(g,v){return typeof v=="function"?v(g):v}function ws(g){var v=dn();return wr(v,$n,g)}function wr(g,v,E){var P=g.queue;if(P===null)throw Error(i(311));P.lastRenderedReducer=E;var q=g.baseQueue,te=P.pending;if(te!==null){if(q!==null){var Oe=q.next;q.next=te.next,te.next=Oe}v.baseQueue=q=te,P.pending=null}if(te=g.baseState,q===null)g.memoizedState=te;else{v=q.next;var ut=Oe=null,Ft=null,on=v,_n=!1;do{var ln=on.lane&-536870913;if(ln!==on.lane?(Xr&ln)===ln:(Bd&ln)===ln){var Pn=on.revertLane;if(Pn===0)Ft!==null&&(Ft=Ft.next={lane:0,revertLane:0,gesture:null,action:on.action,hasEagerState:on.hasEagerState,eagerState:on.eagerState,next:null}),ln===Ud&&(_n=!0);else if((Bd&Pn)===Pn){on=on.next,Pn===Ud&&(_n=!0);continue}else ln={lane:0,revertLane:on.revertLane,gesture:null,action:on.action,hasEagerState:on.hasEagerState,eagerState:on.eagerState,next:null},Ft===null?(ut=Ft=ln,Oe=te):Ft=Ft.next=ln,Tr.lanes|=Pn,Hd|=Pn;ln=on.action,ti&&E(te,ln),te=on.hasEagerState?on.eagerState:E(te,ln)}else Pn={lane:ln,revertLane:on.revertLane,gesture:on.gesture,action:on.action,hasEagerState:on.hasEagerState,eagerState:on.eagerState,next:null},Ft===null?(ut=Ft=Pn,Oe=te):Ft=Ft.next=Pn,Tr.lanes|=ln,Hd|=ln;on=on.next}while(on!==null&&on!==v);if(Ft===null?Oe=te:Ft.next=ut,!to(te,g.memoizedState)&&(rs=!0,_n&&(E=Do,E!==null)))throw E;g.memoizedState=te,g.baseState=Oe,g.baseQueue=Ft,P.lastRenderedState=te}return q===null&&(P.lanes=0),[g.memoizedState,P.dispatch]}function mi(g){var v=dn(),E=v.queue;if(E===null)throw Error(i(311));E.lastRenderedReducer=g;var P=E.dispatch,q=E.pending,te=v.memoizedState;if(q!==null){E.pending=null;var Oe=q=q.next;do te=g(te,Oe.action),Oe=Oe.next;while(Oe!==q);to(te,v.memoizedState)||(rs=!0),v.memoizedState=te,v.baseQueue===null&&(v.baseState=te),E.lastRenderedState=te}return[te,P]}function Os(g,v,E){var P=Tr,q=dn(),te=qr;if(te){if(E===void 0)throw Error(i(407));E=E()}else E=v();var Oe=!to(($n||q).memoizedState,E);if(Oe&&(q.memoizedState=E,rs=!0),q=q.queue,Wr(ba.bind(null,P,q,g),[g]),q.getSnapshot!==v||Oe||xr!==null&&xr.memoizedState.tag&1){if(P.flags|=2048,Ss(9,{destroy:void 0},na.bind(null,P,q,E,v),null),Dr===null)throw Error(i(349));te||(Bd&127)!==0||ji(P,v,E)}return E}function ji(g,v,E){g.flags|=16384,g={getSnapshot:v,value:E},v=Tr.updateQueue,v===null?(v=Wi(),Tr.updateQueue=v,v.stores=[g]):(E=v.stores,E===null?v.stores=[g]:E.push(g))}function na(g,v,E,P){v.value=E,v.getSnapshot=P,Pa(v)&&ic(g)}function ba(g,v,E){return E(function(){Pa(v)&&ic(g)})}function Pa(g){var v=g.getSnapshot;g=g.value;try{var E=v();return!to(g,E)}catch{return!0}}function ic(g){var v=Gt(g,2);v!==null&&Es(v,g,2)}function El(g){var v=ir();if(typeof g=="function"){var E=g;if(g=E(),ti){G(!0);try{E()}finally{G(!1)}}}return v.memoizedState=v.baseState=g,v.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Li,lastRenderedState:g},v}function _a(g,v,E,P){return g.baseState=E,wr(g,$n,typeof P=="function"?P:Li)}function Ls(g,v,E,P,q){if(kh(g))throw Error(i(485));if(g=v.action,g!==null){var te={payload:q,action:g,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(Oe){te.listeners.push(Oe)}};Qn.T!==null?E(!0):te.isTransition=!1,P(te),E=v.pending,E===null?(te.next=v.pending=te,sc(v,te)):(te.next=E.next,v.pending=E.next=te)}}function sc(g,v){var E=v.action,P=v.payload,q=g.state;if(v.isTransition){var te=Qn.T,Oe={};Qn.T=Oe;try{var ut=E(q,P),Ft=Qn.S;Ft!==null&&Ft(Oe,ut),el(g,v,ut)}catch(on){Da(g,v,on)}finally{te!==null&&Oe.types!==null&&(te.types=Oe.types),Qn.T=te}}else try{te=E(q,P),el(g,v,te)}catch(on){Da(g,v,on)}}function el(g,v,E){E!==null&&typeof E=="object"&&typeof E.then=="function"?E.then(function(P){Ia(g,v,P)},function(P){return Da(g,v,P)}):Ia(g,v,E)}function Ia(g,v,E){v.status="fulfilled",v.value=E,Xc(v),g.state=E,v=g.pending,v!==null&&(E=v.next,E===v?g.pending=null:(E=E.next,v.next=E,sc(g,E)))}function Da(g,v,E){var P=g.pending;if(g.pending=null,P!==null){P=P.next;do v.status="rejected",v.reason=E,Xc(v),v=v.next;while(v!==P)}g.action=null}function Xc(g){g=g.listeners;for(var v=0;v<g.length;v++)(0,g[v])()}function Yc(g,v){return v}function oc(g,v){if(qr){var E=Dr.formState;if(E!==null){e:{var P=Tr;if(qr){if(ps){var q=P3(ps,Ua);if(q){ps=I3(q),P=Ub(q);break e}}K(P)}P=!1}P&&(v=E[0])}}E=ir(),E.memoizedState=E.baseState=v,P={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Yc,lastRenderedState:v},E.queue=P,E=kl.bind(null,Tr,P),P.dispatch=E,P=El(!1);var te=$p.bind(null,Tr,!1,P.queue);return P=ir(),q={state:v,dispatch:null,action:g,pending:null},P.queue=q,E=Ls.bind(null,Tr,q,te,E),q.dispatch=E,P.memoizedState=g,[v,E,!1]}function ra(g){var v=dn();return ho(v,$n,g)}function ho(g,v,E){if(v=wr(g,v,Yc)[0],g=ws(Li)[0],typeof v=="object"&&v!==null&&typeof v.then=="function")try{var P=vn(v)}catch(Oe){throw Oe===Oo?Mc:Oe}else P=v;v=dn();var q=v.queue,te=q.dispatch;return E!==v.memoizedState&&(Tr.flags|=2048,Ss(9,{destroy:void 0},Uo.bind(null,q,E),null)),[P,te,g]}function Uo(g,v){g.action=v}function Al(g){var v=dn(),E=$n;if(E!==null)return ho(v,E,g);dn(),v=v.memoizedState,E=dn();var P=E.queue.dispatch;return E.memoizedState=g,[v,P,!1]}function Ss(g,v,E,P){return g={tag:g,create:E,deps:P,inst:v,next:null},v=Tr.updateQueue,v===null&&(v=Wi(),Tr.updateQueue=v),E=v.lastEffect,E===null?v.lastEffect=g.next=g:(P=E.next,E.next=g,g.next=P,v.lastEffect=g),g}function tl(){return dn().memoizedState}function nl(g,v,E,P){var q=ir();Tr.flags|=g,q.memoizedState=Ss(1|v,{destroy:void 0},E,P===void 0?null:P)}function Kc(g,v,E,P){var q=dn();P=P===void 0?null:P;var te=q.memoizedState.inst;$n!==null&&P!==null&&bt(P,$n.memoizedState.deps)?q.memoizedState=Ss(v,te,E,P):(Tr.flags|=g,q.memoizedState=Ss(1|v,te,E,P))}function ii(g,v){nl(8390656,8,g,v)}function Wr(g,v){Kc(2048,8,g,v)}function ia(g){Tr.flags|=4;var v=Tr.updateQueue;if(v===null)v=Wi(),Tr.updateQueue=v,v.events=[g];else{var E=v.events;E===null?v.events=[g]:E.push(g)}}function Sr(g){var v=dn().memoizedState;return ia({ref:v,nextImpl:g}),function(){if((Br&2)!==0)throw Error(i(440));return v.impl.apply(void 0,arguments)}}function Si(g,v){return Kc(4,2,g,v)}function zi(g,v){return Kc(4,4,g,v)}function Kr(g,v){if(typeof v=="function"){g=g();var E=v(g);return function(){typeof E=="function"?E():v(null)}}if(v!=null)return g=g(),v.current=g,function(){v.current=null}}function Oa(g,v,E){E=E!=null?E.concat([g]):null,Kc(4,4,Kr.bind(null,v,g),E)}function Nl(){}function ac(g,v){var E=dn();v=v===void 0?null:v;var P=E.memoizedState;return v!==null&&bt(v,P[1])?P[0]:(E.memoizedState=[g,v],g)}function Ao(g,v){var E=dn();v=v===void 0?null:v;var P=E.memoizedState;if(v!==null&&bt(v,P[1]))return P[0];if(P=g(),ti){G(!0);try{g()}finally{G(!1)}}return E.memoizedState=[P,v],P}function xi(g,v,E){return E===void 0||(Bd&1073741824)!==0&&(Xr&261930)===0?g.memoizedState=v:(g.memoizedState=E,g=kd(),Tr.lanes|=g,Hd|=g,E)}function Nh(g,v,E,P){return to(E,v)?E:Xh.current!==null?(g=xi(g,E,P),to(g,v)||(rs=!0),g):(Bd&42)===0||(Bd&1073741824)!==0&&(Xr&261930)===0?(rs=!0,g.memoizedState=E):(g=kd(),Tr.lanes|=g,Hd|=g,v)}function _d(g,v,E,P,q){var te=xc();$r(te!==0&&8>te?te:8);var Oe=Qn.T,ut={};Qn.T=ut,$p(g,!1,v,E);try{var Ft=q(),on=Qn.S;if(on!==null&&on(ut,Ft),Ft!==null&&typeof Ft=="object"&&typeof Ft.then=="function"){var _n=$e(Ft,P);No(g,v,_n,fs(g))}else No(g,v,P,fs(g))}catch(ln){No(g,v,{then:function(){},status:"rejected",reason:ln},fs())}finally{$r(te),Oe!==null&&ut.types!==null&&(Oe.types=ut.types),Qn.T=Oe}}function wd(g){var v=g.memoizedState;if(v!==null)return v;v={memoizedState:Uh,baseState:Uh,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Li,lastRenderedState:Uh},next:null};var E={};return v.next={memoizedState:E,baseState:E,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Li,lastRenderedState:E},next:null},g.memoizedState=v,g=g.alternate,g!==null&&(g.memoizedState=v),v}function hf(){return ue(Bh)}function wa(){return dn().memoizedState}function Yi(){return dn().memoizedState}function Ks(g){for(var v=g.return;v!==null;){switch(v.tag){case 24:case 3:var E=fs();g=Lt(E);var P=zt(v,g,E);P!==null&&(Es(P,v,E),pn(P,v,E)),v={cache:we()},g.payload=v;return}v=v.return}}function Ms(g,v,E){var P=fs();E={lane:P,revertLane:0,gesture:null,action:E,hasEagerState:!1,eagerState:null,next:null},kh(g)?J0(v,E):(E=Bt(g,v,E,P),E!==null&&(Es(E,g,P),pf(E,v,P)))}function kl(g,v,E){var P=fs();No(g,v,E,P)}function No(g,v,E,P){var q={lane:P,revertLane:0,gesture:null,action:E,hasEagerState:!1,eagerState:null,next:null};if(kh(g))J0(v,q);else{var te=g.alternate;if(g.lanes===0&&(te===null||te.lanes===0)&&(te=v.lastRenderedReducer,te!==null))try{var Oe=v.lastRenderedState,ut=te(Oe,E);if(q.hasEagerState=!0,q.eagerState=ut,to(ut,Oe))return rn(g,v,q,0),Dr===null&&Vt(),!1}catch{}finally{}if(E=Bt(g,v,q,P),E!==null)return Es(E,g,P),pf(E,v,P),!0}return!1}function $p(g,v,E,P){if(P={lane:2,revertLane:Ke(),gesture:null,action:P,hasEagerState:!1,eagerState:null,next:null},kh(g)){if(v)throw Error(i(479))}else v=Bt(g,E,P,2),v!==null&&Es(v,g,2)}function kh(g){var v=g.alternate;return g===Tr||v!==null&&v===Tr}function J0(g,v){kr=Ir=!0;var E=g.pending;E===null?v.next=v:(v.next=E.next,E.next=v),g.pending=v}function pf(g,v,E){if((E&4194048)!==0){var P=v.lanes;P&=g.pendingLanes,E|=P,v.lanes=E,L(g,E)}}function Sd(g,v,E,P){v=g.memoizedState,E=E(P,v),E=E==null?v:pv({},v,E),g.memoizedState=E,g.lanes===0&&(g.updateQueue.baseState=E)}function qp(g,v,E,P,q,te,Oe){return g=g.stateNode,typeof g.shouldComponentUpdate=="function"?g.shouldComponentUpdate(P,te,Oe):v.prototype&&v.prototype.isPureReactComponent?!Je(E,P)||!Je(q,te):!0}function Xp(g,v,E,P){g=v.state,typeof v.componentWillReceiveProps=="function"&&v.componentWillReceiveProps(E,P),typeof v.UNSAFE_componentWillReceiveProps=="function"&&v.UNSAFE_componentWillReceiveProps(E,P),v.state!==g&&Ag.enqueueReplaceState(v,v.state,null)}function Md(g,v){var E=v;if("ref"in v){E={};for(var P in v)P!=="ref"&&(E[P]=v[P])}if(g=g.defaultProps){E===v&&(E=pv({},E));for(var q in g)E[q]===void 0&&(E[q]=g[q])}return E}function lc(g,v){try{var E=g.onUncaughtError;E(v.value,{componentStack:v.stack})}catch(P){setTimeout(function(){throw P})}}function cc(g,v,E){try{var P=g.onCaughtError;P(E.value,{componentStack:E.stack,errorBoundary:v.tag===1?v.stateNode:null})}catch(q){setTimeout(function(){throw q})}}function Td(g,v,E){return E=Lt(E),E.tag=3,E.payload={element:null},E.callback=function(){lc(g,v)},E}function eg(g){return g=Lt(g),g.tag=3,g}function Yp(g,v,E,P){var q=E.type.getDerivedStateFromError;if(typeof q=="function"){var te=P.value;g.payload=function(){return q(te)},g.callback=function(){cc(v,E,P)}}var Oe=E.stateNode;Oe!==null&&typeof Oe.componentDidCatch=="function"&&(g.callback=function(){cc(v,E,P),typeof q!="function"&&(Gd===null?Gd=new Set([this]):Gd.add(this));var ut=P.stack;this.componentDidCatch(P.value,{componentStack:ut!==null?ut:""})})}function tg(g,v,E,P,q){if(E.flags|=32768,P!==null&&typeof P=="object"&&typeof P.then=="function"){if(v=E.alternate,v!==null&&Le(v,E,q,!0),E=ul.current,E!==null){switch(E.tag){case 31:case 13:return dl===null?im():E.alternate===null&&Rs===0&&(Rs=3),E.flags&=-257,E.flags|=65536,E.lanes=q,P===Vu?E.flags|=16384:(v=E.updateQueue,v===null?E.updateQueue=new Set([P]):v.add(P),am(g,P,q)),!1;case 22:return E.flags|=65536,P===Vu?E.flags|=16384:(v=E.updateQueue,v===null?(v={transitions:null,markerInstances:null,retryQueue:new Set([P])},E.updateQueue=v):(E=v.retryQueue,E===null?v.retryQueue=new Set([P]):E.add(P)),am(g,P,q)),!1}throw Error(i(435,E.tag))}return am(g,P,q),im(),!1}if(qr)return v=ul.current,v!==null?((v.flags&65536)===0&&(v.flags|=256),v.flags|=65536,v.lanes=q,P!==jv&&(g=Error(i(422),{cause:P}),Me(ie(g,E)))):(P!==jv&&(v=Error(i(423),{cause:P}),Me(ie(v,E))),g=g.current.alternate,g.flags|=65536,q&=-q,g.lanes|=q,P=ie(P,E),q=Td(g.stateNode,P,q),Ot(g,q),Rs!==4&&(Rs=2)),!1;var te=Error(i(520),{cause:P});if(te=ie(te,E),kg===null?kg=[te]:kg.push(te),Rs!==4&&(Rs=2),v===null)return!0;P=ie(P,E),E=v;do{switch(E.tag){case 3:return E.flags|=65536,g=q&-q,E.lanes|=g,g=Td(E.stateNode,P,g),Ot(E,g),!1;case 1:if(v=E.type,te=E.stateNode,(E.flags&128)===0&&(typeof v.getDerivedStateFromError=="function"||te!==null&&typeof te.componentDidCatch=="function"&&(Gd===null||!Gd.has(te))))return E.flags|=65536,q&=-q,E.lanes|=q,q=eg(q),Yp(q,g,E,P),Ot(E,q),!1}E=E.return}while(E!==null);return!1}function Zs(g,v,E,P){v.child=g===null?i_(v,null,E,P):la(v,g.child,E,P)}function ng(g,v,E,P,q){E=E.render;var te=v.ref;if("ref"in P){var Oe={};for(var ut in P)ut!=="ref"&&(Oe[ut]=P[ut])}else Oe=P;return Ve(v),P=Tt(g,v,E,Oe,te,q),ut=zn(),g!==null&&!rs?(Zn(g,v,q),Ye(g,v,q)):(qr&&ut&&X(v),v.flags|=1,Zs(g,v,P,q),v.child)}function rg(g,v,E,P,q){if(g===null){var te=E.type;return typeof te=="function"&&!Ph(te)&&te.defaultProps===void 0&&E.compare===null?(v.tag=15,v.type=te,ig(g,v,te,P,q)):(g=Id(E.type,null,P,v,v.mode,q),g.ref=v.ref,g.return=v,v.child=g)}if(te=g.child,!ht(g,q)){var Oe=te.memoizedProps;if(E=E.compare,E=E!==null?E:Je,E(Oe,P)&&g.ref===v.ref)return Ye(g,v,q)}return v.flags|=1,g=Il(te,P),g.ref=v.ref,g.return=v,v.child=g}function ig(g,v,E,P,q){if(g!==null){var te=g.memoizedProps;if(Je(te,P)&&g.ref===v.ref)if(rs=!1,v.pendingProps=P=te,ht(g,q))(g.flags&131072)!==0&&(rs=!0);else return v.lanes=g.lanes,Ye(g,v,q)}return Ed(g,v,E,P,q)}function sg(g,v,E,P){var q=P.children,te=g!==null?g.memoizedState:null;if(g===null&&v.stateNode===null&&(v.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),P.mode==="hidden"){if((v.flags&128)!==0){if(te=te!==null?te.baseLanes|E:E,g!==null){for(P=v.child=g.child,q=0;P!==null;)q=q|P.lanes|P.childLanes,P=P.sibling;P=q&~te}else P=0,v.child=null;return Cd(g,v,te,E,P)}if((E&536870912)!==0)v.memoizedState={baseLanes:0,cachePool:null},g!==null&&ft(v,te!==null?te.cachePool:null),te!==null?On(v,te):_e(),xt(v);else return P=v.lanes=536870912,Cd(g,v,te!==null?te.baseLanes|E:E,E,P)}else te!==null?(ft(v,te.cachePool),On(v,te),$t(),v.memoizedState=null):(g!==null&&ft(v,null),_e(),$t());return Zs(g,v,q,E),v.child}function Au(g,v){return g!==null&&g.tag===22||v.stateNode!==null||(v.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),v.sibling}function Cd(g,v,E,P,q){var te=Ze();return te=te===null?null:{parent:Js?ms._currentValue:ms._currentValue2,pool:te},v.memoizedState={baseLanes:E,cachePool:te},g!==null&&ft(v,null),_e(),xt(v),g!==null&&Le(g,v,P,!0),v.childLanes=q,null}function Kp(g,v){return v=ku({mode:v.mode,children:v.children},g.mode),v.ref=g.ref,g.child=v,v.return=g,v}function Zp(g,v,E){return la(v,g.child,null,E),g=Kp(v,v.pendingProps),g.flags|=2,sn(v),v.memoizedState=null,g}function og(g,v,E){var P=v.pendingProps,q=(v.flags&128)!==0;if(v.flags&=-129,g===null){if(qr){if(P.mode==="hidden")return g=Kp(v,P),v.lanes=536870912,Au(null,g);if(pt(v),(g=ps)?(g=Hb(g,Ua),g!==null&&(v.memoizedState={dehydrated:g,treeContext:bc!==null?{id:oa,overflow:eu}:null,retryLane:536870912,hydrationErrors:null},E=vb(g),E.return=v,v.child=E,Io=v,ps=null)):g=null,g===null)throw K(v);return v.lanes=536870912,null}return Kp(v,P)}var te=g.memoizedState;if(te!==null){var Oe=te.dehydrated;if(pt(v),q)if(v.flags&256)v.flags&=-257,v=Zp(g,v,E);else if(v.memoizedState!==null)v.child=g.child,v.flags|=128,v=null;else throw Error(i(558));else if(rs||Le(g,v,E,!1),q=(E&g.childLanes)!==0,rs||q){if(P=Dr,P!==null&&(Oe=B(P,E),Oe!==0&&Oe!==te.retryLane))throw te.retryLane=Oe,Gt(g,Oe),Es(P,g,Oe),Ha;im(),v=Zp(g,v,E)}else g=te.treeContext,hs&&(ps=j3(Oe),Io=v,qr=!0,Gu=null,Ua=!1,g!==null&&ce(v,g)),v=Kp(v,P),v.flags|=4096;return v}return g=Il(g.child,{mode:P.mode,children:P.children}),g.ref=v.ref,v.child=g,g.return=v,g}function uc(g,v){var E=v.ref;if(E===null)g!==null&&g.ref!==null&&(v.flags|=4194816);else{if(typeof E!="function"&&typeof E!="object")throw Error(i(284));(g===null||g.ref!==E)&&(v.flags|=4194816)}}function Ed(g,v,E,P,q){return Ve(v),E=Tt(g,v,E,P,void 0,q),P=zn(),g!==null&&!rs?(Zn(g,v,q),Ye(g,v,q)):(qr&&P&&X(v),v.flags|=1,Zs(g,v,E,q),v.child)}function js(g,v,E,P,q,te){return Ve(v),v.updateQueue=null,E=Ht(v,P,E,q),Yt(g),P=zn(),g!==null&&!rs?(Zn(g,v,te),Ye(g,v,te)):(qr&&P&&X(v),v.flags|=1,Zs(g,v,E,te),v.child)}function Nu(g,v,E,P,q){if(Ve(v),v.stateNode===null){var te=Uu,Oe=E.contextType;typeof Oe=="object"&&Oe!==null&&(te=ue(Oe)),te=new E(P,te),v.memoizedState=te.state!==null&&te.state!==void 0?te.state:null,te.updater=Ag,v.stateNode=te,te._reactInternals=v,te=v.stateNode,te.props=P,te.state=v.memoizedState,te.refs={},hn(v),Oe=E.contextType,te.context=typeof Oe=="object"&&Oe!==null?ue(Oe):Uu,te.state=v.memoizedState,Oe=E.getDerivedStateFromProps,typeof Oe=="function"&&(Sd(v,E,Oe,P),te.state=v.memoizedState),typeof E.getDerivedStateFromProps=="function"||typeof te.getSnapshotBeforeUpdate=="function"||typeof te.UNSAFE_componentWillMount!="function"&&typeof te.componentWillMount!="function"||(Oe=te.state,typeof te.componentWillMount=="function"&&te.componentWillMount(),typeof te.UNSAFE_componentWillMount=="function"&&te.UNSAFE_componentWillMount(),Oe!==te.state&&Ag.enqueueReplaceState(te,te.state,null),tn(v,P,te,q),Ct(),te.state=v.memoizedState),typeof te.componentDidMount=="function"&&(v.flags|=4194308),P=!0}else if(g===null){te=v.stateNode;var ut=v.memoizedProps,Ft=Md(E,ut);te.props=Ft;var on=te.context,_n=E.contextType;Oe=Uu,typeof _n=="object"&&_n!==null&&(Oe=ue(_n));var ln=E.getDerivedStateFromProps;_n=typeof ln=="function"||typeof te.getSnapshotBeforeUpdate=="function",ut=v.pendingProps!==ut,_n||typeof te.UNSAFE_componentWillReceiveProps!="function"&&typeof te.componentWillReceiveProps!="function"||(ut||on!==Oe)&&Xp(v,te,P,Oe),Ll=!1;var Pn=v.memoizedState;te.state=Pn,tn(v,P,te,q),Ct(),on=v.memoizedState,ut||Pn!==on||Ll?(typeof ln=="function"&&(Sd(v,E,ln,P),on=v.memoizedState),(Ft=Ll||qp(v,E,Ft,P,Pn,on,Oe))?(_n||typeof te.UNSAFE_componentWillMount!="function"&&typeof te.componentWillMount!="function"||(typeof te.componentWillMount=="function"&&te.componentWillMount(),typeof te.UNSAFE_componentWillMount=="function"&&te.UNSAFE_componentWillMount()),typeof te.componentDidMount=="function"&&(v.flags|=4194308)):(typeof te.componentDidMount=="function"&&(v.flags|=4194308),v.memoizedProps=P,v.memoizedState=on),te.props=P,te.state=on,te.context=Oe,P=Ft):(typeof te.componentDidMount=="function"&&(v.flags|=4194308),P=!1)}else{te=v.stateNode,It(g,v),Oe=v.memoizedProps,_n=Md(E,Oe),te.props=_n,ln=v.pendingProps,Pn=te.context,on=E.contextType,Ft=Uu,typeof on=="object"&&on!==null&&(Ft=ue(on)),ut=E.getDerivedStateFromProps,(on=typeof ut=="function"||typeof te.getSnapshotBeforeUpdate=="function")||typeof te.UNSAFE_componentWillReceiveProps!="function"&&typeof te.componentWillReceiveProps!="function"||(Oe!==ln||Pn!==Ft)&&Xp(v,te,P,Ft),Ll=!1,Pn=v.memoizedState,te.state=Pn,tn(v,P,te,q),Ct();var br=v.memoizedState;Oe!==ln||Pn!==br||Ll||g!==null&&g.dependencies!==null&&ze(g.dependencies)?(typeof ut=="function"&&(Sd(v,E,ut,P),br=v.memoizedState),(_n=Ll||qp(v,E,_n,P,Pn,br,Ft)||g!==null&&g.dependencies!==null&&ze(g.dependencies))?(on||typeof te.UNSAFE_componentWillUpdate!="function"&&typeof te.componentWillUpdate!="function"||(typeof te.componentWillUpdate=="function"&&te.componentWillUpdate(P,br,Ft),typeof te.UNSAFE_componentWillUpdate=="function"&&te.UNSAFE_componentWillUpdate(P,br,Ft)),typeof te.componentDidUpdate=="function"&&(v.flags|=4),typeof te.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof te.componentDidUpdate!="function"||Oe===g.memoizedProps&&Pn===g.memoizedState||(v.flags|=4),typeof te.getSnapshotBeforeUpdate!="function"||Oe===g.memoizedProps&&Pn===g.memoizedState||(v.flags|=1024),v.memoizedProps=P,v.memoizedState=br),te.props=P,te.state=br,te.context=Ft,P=_n):(typeof te.componentDidUpdate!="function"||Oe===g.memoizedProps&&Pn===g.memoizedState||(v.flags|=4),typeof te.getSnapshotBeforeUpdate!="function"||Oe===g.memoizedProps&&Pn===g.memoizedState||(v.flags|=1024),P=!1)}return te=P,uc(g,v),P=(v.flags&128)!==0,te||P?(te=v.stateNode,E=P&&typeof E.getDerivedStateFromError!="function"?null:te.render(),v.flags|=1,g!==null&&P?(v.child=la(v,g.child,null,q),v.child=la(v,null,E,q)):Zs(g,v,E,q),v.memoizedState=te.state,g=v.child):g=Ye(g,v,q),g}function Ts(g,v,E,P){return Se(),v.flags|=256,Zs(g,v,E,P),v.child}function Qp(g){return{baseLanes:g,cachePool:lt()}}function Rh(g,v,E){return g=g!==null?g.childLanes&~E:0,v&&(g|=Ga),g}function Ad(g,v,E){var P=v.pendingProps,q=!1,te=(v.flags&128)!==0,Oe;if((Oe=te)||(Oe=g!==null&&g.memoizedState===null?!1:(Bs.current&2)!==0),Oe&&(q=!0,v.flags&=-129),Oe=(v.flags&32)!==0,v.flags&=-33,g===null){if(qr){if(q?gt(v):$t(),(g=ps)?(g=B3(g,Ua),g!==null&&(v.memoizedState={dehydrated:g,treeContext:bc!==null?{id:oa,overflow:eu}:null,retryLane:536870912,hydrationErrors:null},E=vb(g),E.return=v,v.child=E,Io=v,ps=null)):g=null,g===null)throw K(v);return wv(g)?v.lanes=32:v.lanes=536870912,null}var ut=P.children;return P=P.fallback,q?($t(),q=v.mode,ut=ku({mode:"hidden",children:ut},q),P=mc(P,q,E,null),ut.return=v,P.return=v,ut.sibling=P,v.child=ut,P=v.child,P.memoizedState=Qp(E),P.childLanes=Rh(g,Oe,E),v.memoizedState=Yh,Au(null,P)):(gt(v),Jp(v,ut))}var Ft=g.memoizedState;if(Ft!==null&&(ut=Ft.dehydrated,ut!==null)){if(te)v.flags&256?(gt(v),v.flags&=-257,v=Zc(g,v,E)):v.memoizedState!==null?($t(),v.child=g.child,v.flags|=128,v=null):($t(),ut=P.fallback,q=v.mode,P=ku({mode:"visible",children:P.children},q),ut=mc(ut,q,E,null),ut.flags|=2,P.return=v,ut.return=v,P.sibling=ut,v.child=P,la(v,g.child,null,E),P=v.child,P.memoizedState=Qp(E),P.childLanes=Rh(g,Oe,E),v.memoizedState=Yh,v=Au(null,P));else if(gt(v),wv(ut))Oe=Sv(ut).digest,P=Error(i(419)),P.stack="",P.digest=Oe,Me({value:P,source:null,stack:null}),v=Zc(g,v,E);else if(rs||Le(g,v,E,!1),Oe=(E&g.childLanes)!==0,rs||Oe){if(Oe=Dr,Oe!==null&&(P=B(Oe,E),P!==0&&P!==Ft.retryLane))throw Ft.retryLane=P,Gt(g,P),Es(Oe,g,P),Ha;Ef(ut)||im(),v=Zc(g,v,E)}else Ef(ut)?(v.flags|=192,v.child=g.child,v=null):(g=Ft.treeContext,hs&&(ps=z3(ut),Io=v,qr=!0,Gu=null,Ua=!1,g!==null&&ce(v,g)),v=Jp(v,P.children),v.flags|=4096);return v}return q?($t(),ut=P.fallback,q=v.mode,Ft=g.child,te=Ft.sibling,P=Il(Ft,{mode:"hidden",children:P.children}),P.subtreeFlags=Ft.subtreeFlags&65011712,te!==null?ut=Il(te,ut):(ut=mc(ut,q,E,null),ut.flags|=2),ut.return=v,P.return=v,P.sibling=ut,v.child=P,Au(null,P),P=v.child,ut=g.child.memoizedState,ut===null?ut=Qp(E):(q=ut.cachePool,q!==null?(Ft=Js?ms._currentValue:ms._currentValue2,q=q.parent!==Ft?{parent:Ft,pool:Ft}:q):q=lt(),ut={baseLanes:ut.baseLanes|E,cachePool:q}),P.memoizedState=ut,P.childLanes=Rh(g,Oe,E),v.memoizedState=Yh,Au(g.child,P)):(gt(v),E=g.child,g=E.sibling,E=Il(E,{mode:"visible",children:P.children}),E.return=v,E.sibling=null,g!==null&&(Oe=v.deletions,Oe===null?(v.deletions=[g],v.flags|=16):Oe.push(g)),v.child=E,v.memoizedState=null,E)}function Jp(g,v){return v=ku({mode:"visible",children:v},g.mode),v.return=g,g.child=v}function ku(g,v){return g=n(22,g,null,v),g.lanes=0,g}function Zc(g,v,E){return la(v,g.child,null,E),g=Jp(v,v.pendingProps.children),g.flags|=2,v.memoizedState=null,g}function ve(g,v,E){g.lanes|=v;var P=g.alternate;P!==null&&(P.lanes|=v),le(g.return,v,E)}function Ie(g,v,E,P,q,te){var Oe=g.memoizedState;Oe===null?g.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:P,tail:E,tailMode:q,treeForkCount:te}:(Oe.isBackwards=v,Oe.rendering=null,Oe.renderingStartTime=0,Oe.last=P,Oe.tail=E,Oe.tailMode=q,Oe.treeForkCount=te)}function Xe(g,v,E){var P=v.pendingProps,q=P.revealOrder,te=P.tail;P=P.children;var Oe=Bs.current,ut=(Oe&2)!==0;if(ut?(Oe=Oe&1|2,v.flags|=128):Oe&=1,b(Bs,Oe),Zs(g,v,P,E),P=qr?Tg:0,!ut&&g!==null&&(g.flags&128)!==0)e:for(g=v.child;g!==null;){if(g.tag===13)g.memoizedState!==null&&ve(g,E,v);else if(g.tag===19)ve(g,E,v);else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===v)break e;for(;g.sibling===null;){if(g.return===null||g.return===v)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}switch(q){case"forwards":for(E=v.child,q=null;E!==null;)g=E.alternate,g!==null&&Zt(g)===null&&(q=E),E=E.sibling;E=q,E===null?(q=v.child,v.child=null):(q=E.sibling,E.sibling=null),Ie(v,!1,q,E,te,P);break;case"backwards":case"unstable_legacy-backwards":for(E=null,q=v.child,v.child=null;q!==null;){if(g=q.alternate,g!==null&&Zt(g)===null){v.child=q;break}g=q.sibling,q.sibling=E,E=q,q=g}Ie(v,!0,E,null,te,P);break;case"together":Ie(v,!1,null,null,void 0,P);break;default:v.memoizedState=null}return v.child}function Ye(g,v,E){if(g!==null&&(v.dependencies=g.dependencies),Hd|=v.lanes,(E&v.childLanes)===0)if(g!==null){if(Le(g,v,E,!1),(E&v.childLanes)===0)return null}else return null;if(g!==null&&v.child!==g.child)throw Error(i(153));if(v.child!==null){for(g=v.child,E=Il(g,g.pendingProps),v.child=E,E.return=v;g.sibling!==null;)g=g.sibling,E=E.sibling=Il(g,g.pendingProps),E.return=v;E.sibling=null}return v.child}function ht(g,v){return(g.lanes&v)!==0?!0:(g=g.dependencies,!!(g!==null&&ze(g)))}function Mt(g,v,E){switch(v.tag){case 3:oe(v,v.stateNode.containerInfo),Ce(v,ms,g.memoizedState.cache),Se();break;case 27:case 5:se(v);break;case 4:oe(v,v.stateNode.containerInfo);break;case 10:Ce(v,v.type,v.memoizedProps.value);break;case 31:if(v.memoizedState!==null)return v.flags|=128,pt(v),null;break;case 13:var P=v.memoizedState;if(P!==null)return P.dehydrated!==null?(gt(v),v.flags|=128,null):(E&v.child.childLanes)!==0?Ad(g,v,E):(gt(v),g=Ye(g,v,E),g!==null?g.sibling:null);gt(v);break;case 19:var q=(g.flags&128)!==0;if(P=(E&v.childLanes)!==0,P||(Le(g,v,E,!1),P=(E&v.childLanes)!==0),q){if(P)return Xe(g,v,E);v.flags|=128}if(q=v.memoizedState,q!==null&&(q.rendering=null,q.tail=null,q.lastEffect=null),b(Bs,Bs.current),P)break;return null;case 22:return v.lanes=0,sg(g,v,E,v.pendingProps);case 24:Ce(v,ms,g.memoizedState.cache)}return Ye(g,v,E)}function Xt(g,v,E){if(g!==null)if(g.memoizedProps!==v.pendingProps)rs=!0;else{if(!ht(g,E)&&(v.flags&128)===0)return rs=!1,Mt(g,v,E);rs=(g.flags&131072)!==0}else rs=!1,qr&&(v.flags&1048576)!==0&&j(v,Tg,v.index);switch(v.lanes=0,v.tag){case 16:e:{var P=v.pendingProps;if(g=De(v.elementType),v.type=g,typeof g=="function")Ph(g)?(P=Md(g,P),v.tag=1,v=Nu(null,v,g,P,E)):(v.tag=0,v=Ed(null,v,g,P,E));else{if(g!=null){var q=g.$$typeof;if(q===lm){v.tag=11,v=ng(null,v,g,P,E);break e}else if(q===gv){v.tag=14,v=rg(null,v,g,P,E);break e}}throw v=h(g)||g,Error(i(306,v,""))}}return v;case 0:return Ed(g,v,v.type,v.pendingProps,E);case 1:return P=v.type,q=Md(P,v.pendingProps),Nu(g,v,P,q,E);case 3:e:{if(oe(v,v.stateNode.containerInfo),g===null)throw Error(i(387));var te=v.pendingProps;q=v.memoizedState,P=q.element,It(g,v),tn(v,te,null,E);var Oe=v.memoizedState;if(te=Oe.cache,Ce(v,ms,te),te!==q.cache&&He(v,[ms],E,!0),Ct(),te=Oe.element,hs&&q.isDehydrated)if(q={element:te,isDehydrated:!1,cache:Oe.cache},v.updateQueue.baseState=q,v.memoizedState=q,v.flags&256){v=Ts(g,v,te,E);break e}else if(te!==P){P=ie(Error(i(424)),v),Me(P),v=Ts(g,v,te,E);break e}else for(hs&&(ps=L3(v.stateNode.containerInfo),Io=v,qr=!0,Gu=null,Ua=!0),E=i_(v,null,te,E),v.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(Se(),te===P){v=Ye(g,v,E);break e}Zs(g,v,te,E)}v=v.child}return v;case 26:if(vc)return uc(g,v),g===null?(E=qb(v.type,null,v.pendingProps,null))?v.memoizedState=E:qr||(v.stateNode=Ev(v.type,v.pendingProps,aa.current,v)):v.memoizedState=qb(v.type,g.memoizedProps,v.pendingProps,g.memoizedState),null;case 27:if(Po)return se(v),g===null&&Po&&qr&&(P=v.stateNode=Av(v.type,v.pendingProps,aa.current,qo.current,!1),Io=v,Ua=!0,ps=Bb(v.type,P,ps)),Zs(g,v,v.pendingProps.children,E),uc(g,v),g===null&&(v.flags|=4194304),v.child;case 5:return g===null&&qr&&(K3(v.type,v.pendingProps,qo.current),(q=P=ps)&&(P=F3(P,v.type,v.pendingProps,Ua),P!==null?(v.stateNode=P,Io=v,ps=O3(P),Ua=!1,q=!0):q=!1),q||K(v)),se(v),q=v.type,te=v.pendingProps,Oe=g!==null?g.memoizedProps:null,P=te.children,Fa(q,te)?P=null:Oe!==null&&Fa(q,Oe)&&(v.flags|=32),v.memoizedState!==null&&(q=Tt(g,v,Cn,null,null,E),Js?Bh._currentValue=q:Bh._currentValue2=q),uc(g,v),Zs(g,v,P,E),v.child;case 6:return g===null&&qr&&($b(v.pendingProps,qo.current),(g=E=ps)&&(E=U3(E,v.pendingProps,Ua),E!==null?(v.stateNode=E,Io=v,ps=null,g=!0):g=!1),g||K(v)),null;case 13:return Ad(g,v,E);case 4:return oe(v,v.stateNode.containerInfo),P=v.pendingProps,g===null?v.child=la(v,null,P,E):Zs(g,v,P,E),v.child;case 11:return ng(g,v,v.type,v.pendingProps,E);case 7:return Zs(g,v,v.pendingProps,E),v.child;case 8:return Zs(g,v,v.pendingProps.children,E),v.child;case 12:return Zs(g,v,v.pendingProps.children,E),v.child;case 10:return P=v.pendingProps,Ce(v,v.type,P.value),Zs(g,v,P.children,E),v.child;case 9:return q=v.type._context,P=v.pendingProps.children,Ve(v),q=ue(q),P=P(q),v.flags|=1,Zs(g,v,P,E),v.child;case 14:return rg(g,v,v.type,v.pendingProps,E);case 15:return ig(g,v,v.type,v.pendingProps,E);case 19:return Xe(g,v,E);case 31:return og(g,v,E);case 22:return sg(g,v,E,v.pendingProps);case 24:return Ve(v),P=ue(ms),g===null?(q=Ze(),q===null&&(q=Dr,te=we(),q.pooledCache=te,te.refCount++,te!==null&&(q.pooledCacheLanes|=E),q=te),v.memoizedState={parent:P,cache:q},hn(v),Ce(v,ms,q)):((g.lanes&E)!==0&&(It(g,v),tn(v,null,null,E),Ct()),q=g.memoizedState,te=v.memoizedState,q.parent!==P?(q={parent:P,cache:P},v.memoizedState=q,v.lanes===0&&(v.memoizedState=v.updateQueue.baseState=q),Ce(v,ms,P)):(P=te.cache,Ce(v,ms,P),P!==q.cache&&He(v,[ms],E,!0))),Zs(g,v,v.pendingProps.children,E),v.child;case 29:throw v.pendingProps}throw Error(i(156,v.tag))}function nn(g){g.flags|=4}function fn(g){Dl&&(g.flags|=8)}function Nn(g,v){if(g!==null&&g.child===v.child)return!1;if((v.flags&16)!==0)return!0;for(g=v.child;g!==null;){if((g.flags&8218)!==0||(g.subtreeFlags&8218)!==0)return!0;g=g.sibling}return!1}function kn(g,v,E,P){if(Qr)for(E=v.child;E!==null;){if(E.tag===5||E.tag===6)xg(g,E.stateNode);else if(!(E.tag===4||Po&&E.tag===27)&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===v)break;for(;E.sibling===null;){if(E.return===null||E.return===v)return;E=E.return}E.sibling.return=E.return,E=E.sibling}else if(Dl)for(var q=v.child;q!==null;){if(q.tag===5){var te=q.stateNode;E&&P&&(te=R3(te,q.type,q.memoizedProps)),xg(g,te)}else if(q.tag===6)te=q.stateNode,E&&P&&(te=Fb(te,q.memoizedProps)),xg(g,te);else if(q.tag!==4){if(q.tag===22&&q.memoizedState!==null)te=q.child,te!==null&&(te.return=q),kn(g,q,!0,!0);else if(q.child!==null){q.child.return=q,q=q.child;continue}}if(q===v)break;for(;q.sibling===null;){if(q.return===null||q.return===v)return;q=q.return}q.sibling.return=q.return,q=q.sibling}}function Dn(g,v,E,P){var q=!1;if(Dl)for(var te=v.child;te!==null;){if(te.tag===5){var Oe=te.stateNode;E&&P&&(Oe=R3(Oe,te.type,te.memoizedProps)),jb(g,Oe)}else if(te.tag===6)Oe=te.stateNode,E&&P&&(Oe=Fb(Oe,te.memoizedProps)),jb(g,Oe);else if(te.tag!==4){if(te.tag===22&&te.memoizedState!==null)q=te.child,q!==null&&(q.return=te),Dn(g,te,!0,!0),q=!0;else if(te.child!==null){te.child.return=te,te=te.child;continue}}if(te===v)break;for(;te.sibling===null;){if(te.return===null||te.return===v)return q;te=te.return}te.sibling.return=te.return,te=te.sibling}return q}function cr(g,v){if(Dl&&Nn(g,v)){g=v.stateNode;var E=g.containerInfo,P=Lb();Dn(P,v,!1,!1),g.pendingChildren=P,nn(v),k3(E,P)}}function ei(g,v,E,P){if(Qr)g.memoizedProps!==P&&nn(v);else if(Dl){var q=g.stateNode,te=g.memoizedProps;if((g=Nn(g,v))||te!==P){var Oe=qo.current;te=N3(q,E,te,P,!g,null),te===q?v.stateNode=q:(fn(v),ol(te,E,P,Oe)&&nn(v),v.stateNode=te,g&&kn(te,v,!1,!1))}else v.stateNode=q}}function ur(g,v,E,P,q){if((g.mode&32)!==0&&(E===null?vg(v,P):hm(v,E,P))){if(g.flags|=16777216,(q&335544128)===q||Tb(v,P))if(As(g.stateNode,v,P))g.flags|=8192;else if(Zr())g.flags|=8192;else throw Ba=Vu,Fv}else g.flags&=-16777217}function yr(g,v){if(Zb(v)){if(g.flags|=16777216,!Qb(v))if(Zr())g.flags|=8192;else throw Ba=Vu,Fv}else g.flags&=-16777217}function Yn(g,v){v!==null&&(g.flags|=4),g.flags&16384&&(v=g.tag!==22?N():536870912,g.lanes|=v,wm|=v)}function Un(g,v){if(!qr)switch(g.tailMode){case"hidden":v=g.tail;for(var E=null;v!==null;)v.alternate!==null&&(E=v),v=v.sibling;E===null?g.tail=null:E.sibling=null;break;case"collapsed":E=g.tail;for(var P=null;E!==null;)E.alternate!==null&&(P=E),E=E.sibling;P===null?v||g.tail===null?g.tail=null:g.tail.sibling=null:P.sibling=null}}function er(g){var v=g.alternate!==null&&g.alternate.child===g.child,E=0,P=0;if(v)for(var q=g.child;q!==null;)E|=q.lanes|q.childLanes,P|=q.subtreeFlags&65011712,P|=q.flags&65011712,q.return=g,q=q.sibling;else for(q=g.child;q!==null;)E|=q.lanes|q.childLanes,P|=q.subtreeFlags,P|=q.flags,q.return=g,q=q.sibling;return g.subtreeFlags|=P,g.childLanes=E,v}function ns(g,v,E){var P=v.pendingProps;switch(F(v),v.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return er(v),null;case 1:return er(v),null;case 3:return E=v.stateNode,P=null,g!==null&&(P=g.memoizedState.cache),v.memoizedState.cache!==P&&(v.flags|=2048),Re(ms),Q(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(g===null||g.child===null)&&(ae(v)?nn(v):g===null||g.memoizedState.isDehydrated&&(v.flags&256)===0||(v.flags|=1024,de())),cr(g,v),er(v),null;case 26:if(vc){var q=v.type,te=v.memoizedState;return g===null?(nn(v),te!==null?(er(v),yr(v,te)):(er(v),ur(v,q,null,P,E))):te?te!==g.memoizedState?(nn(v),er(v),yr(v,te)):(er(v),v.flags&=-16777217):(te=g.memoizedProps,Qr?te!==P&&nn(v):ei(g,v,q,P),er(v),ur(v,q,te,P,E)),null}case 27:if(Po){if(re(v),E=aa.current,q=v.type,g!==null&&v.stateNode!=null)Qr?g.memoizedProps!==P&&nn(v):ei(g,v,q,P);else{if(!P){if(v.stateNode===null)throw Error(i(166));return er(v),null}g=qo.current,ae(v)?fe(v,g):(g=Av(q,P,E,g,!0),v.stateNode=g,nn(v))}return er(v),null}case 5:if(re(v),q=v.type,g!==null&&v.stateNode!=null)ei(g,v,q,P);else{if(!P){if(v.stateNode===null)throw Error(i(166));return er(v),null}if(te=qo.current,ae(v))fe(v,te),q3(v.stateNode,q,P,te)&&(v.flags|=64);else{var Oe=Sb(q,P,aa.current,te,v);fn(v),kn(Oe,v,!1,!1),v.stateNode=Oe,ol(Oe,q,P,te)&&nn(v)}}return er(v),ur(v,v.type,g===null?null:g.memoizedProps,v.pendingProps,E),null;case 6:if(g&&v.stateNode!=null)E=g.memoizedProps,Qr?E!==P&&nn(v):Dl&&(E!==P?(g=aa.current,E=qo.current,fn(v),v.stateNode=Ld(P,g,E,v)):v.stateNode=g.stateNode);else{if(typeof P!="string"&&v.stateNode===null)throw Error(i(166));if(g=aa.current,E=qo.current,ae(v)){if(!hs)throw Error(i(176));if(g=v.stateNode,E=v.memoizedProps,P=null,q=Io,q!==null)switch(q.tag){case 27:case 5:P=q.memoizedProps}jE(g,E,v,P)||K(v,!0)}else fn(v),v.stateNode=Ld(P,g,E,v)}return er(v),null;case 31:if(E=v.memoizedState,g===null||g.memoizedState!==null){if(P=ae(v),E!==null){if(g===null){if(!P)throw Error(i(318));if(!hs)throw Error(i(556));if(g=v.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(557));Gb(g,v)}else Se(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;er(v),g=!1}else E=de(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=E),g=!0;if(!g)return v.flags&256?(sn(v),v):(sn(v),null);if((v.flags&128)!==0)throw Error(i(558))}return er(v),null;case 13:if(P=v.memoizedState,g===null||g.memoizedState!==null&&g.memoizedState.dehydrated!==null){if(q=ae(v),P!==null&&P.dehydrated!==null){if(g===null){if(!q)throw Error(i(318));if(!hs)throw Error(i(344));if(q=v.memoizedState,q=q!==null?q.dehydrated:null,!q)throw Error(i(317));G3(q,v)}else Se(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;er(v),q=!1}else q=de(),g!==null&&g.memoizedState!==null&&(g.memoizedState.hydrationErrors=q),q=!0;if(!q)return v.flags&256?(sn(v),v):(sn(v),null)}return sn(v),(v.flags&128)!==0?(v.lanes=E,v):(E=P!==null,g=g!==null&&g.memoizedState!==null,E&&(P=v.child,q=null,P.alternate!==null&&P.alternate.memoizedState!==null&&P.alternate.memoizedState.cachePool!==null&&(q=P.alternate.memoizedState.cachePool.pool),te=null,P.memoizedState!==null&&P.memoizedState.cachePool!==null&&(te=P.memoizedState.cachePool.pool),te!==q&&(P.flags|=2048)),E!==g&&E&&(v.child.flags|=8192),Yn(v,v.updateQueue),er(v),null);case 4:return Q(),cr(g,v),g===null&&Fi(v.stateNode.containerInfo),er(v),null;case 10:return Re(v.type),er(v),null;case 19:if(x(Bs),P=v.memoizedState,P===null)return er(v),null;if(q=(v.flags&128)!==0,te=P.rendering,te===null)if(q)Un(P,!1);else{if(Rs!==0||g!==null&&(g.flags&128)!==0)for(g=v.child;g!==null;){if(te=Zt(g),te!==null){for(v.flags|=128,Un(P,!1),g=te.updateQueue,v.updateQueue=g,Yn(v,g),v.subtreeFlags=0,g=E,E=v.child;E!==null;)dv(E,g),E=E.sibling;return b(Bs,Bs.current&1|2),qr&&z(v,P.treeForkCount),v.child}g=g.sibling}P.tail!==null&&Sa()>zf&&(v.flags|=128,q=!0,Un(P,!1),v.lanes=4194304)}else{if(!q)if(g=Zt(te),g!==null){if(v.flags|=128,q=!0,g=g.updateQueue,v.updateQueue=g,Yn(v,g),Un(P,!0),P.tail===null&&P.tailMode==="hidden"&&!te.alternate&&!qr)return er(v),null}else 2*Sa()-P.renderingStartTime>zf&&E!==536870912&&(v.flags|=128,q=!0,Un(P,!1),v.lanes=4194304);P.isBackwards?(te.sibling=v.child,v.child=te):(g=P.last,g!==null?g.sibling=te:v.child=te,P.last=te)}return P.tail!==null?(g=P.tail,P.rendering=g,P.tail=g.sibling,P.renderingStartTime=Sa(),g.sibling=null,E=Bs.current,b(Bs,q?E&1|2:E&1),qr&&z(v,P.treeForkCount),g):(er(v),null);case 22:case 23:return sn(v),tt(),P=v.memoizedState!==null,g!==null?g.memoizedState!==null!==P&&(v.flags|=8192):P&&(v.flags|=8192),P?(E&536870912)!==0&&(v.flags&128)===0&&(er(v),v.subtreeFlags&6&&(v.flags|=8192)):er(v),E=v.updateQueue,E!==null&&Yn(v,E.retryQueue),E=null,g!==null&&g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(E=g.memoizedState.cachePool.pool),P=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(P=v.memoizedState.cachePool.pool),P!==E&&(v.flags|=2048),g!==null&&x(kf),null;case 24:return E=null,g!==null&&(E=g.memoizedState.cache),v.memoizedState.cache!==E&&(v.flags|=2048),Re(ms),er(v),null;case 25:return null;case 30:return null}throw Error(i(156,v.tag))}function zs(g,v){switch(F(v),v.tag){case 1:return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 3:return Re(ms),Q(),g=v.flags,(g&65536)!==0&&(g&128)===0?(v.flags=g&-65537|128,v):null;case 26:case 27:case 5:return re(v),null;case 31:if(v.memoizedState!==null){if(sn(v),v.alternate===null)throw Error(i(340));Se()}return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 13:if(sn(v),g=v.memoizedState,g!==null&&g.dehydrated!==null){if(v.alternate===null)throw Error(i(340));Se()}return g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 19:return x(Bs),null;case 4:return Q(),null;case 10:return Re(v.type),null;case 22:case 23:return sn(v),tt(),g!==null&&x(kf),g=v.flags,g&65536?(v.flags=g&-65537|128,v):null;case 24:return Re(ms),null;case 25:return null;default:return null}}function vi(g,v){switch(F(v),v.tag){case 3:Re(ms),Q();break;case 26:case 27:case 5:re(v);break;case 4:Q();break;case 31:v.memoizedState!==null&&sn(v);break;case 13:sn(v);break;case 19:x(Bs);break;case 10:Re(v.type);break;case 22:case 23:sn(v),tt(),g!==null&&x(kf);break;case 24:Re(ms)}}function ui(g,v){try{var E=v.updateQueue,P=E!==null?E.lastEffect:null;if(P!==null){var q=P.next;E=q;do{if((E.tag&g)===g){P=void 0;var te=E.create,Oe=E.inst;P=te(),Oe.destroy=P}E=E.next}while(E!==q)}}catch(ut){dr(v,v.return,ut)}}function ds(g,v,E){try{var P=v.updateQueue,q=P!==null?P.lastEffect:null;if(q!==null){var te=q.next;P=te;do{if((P.tag&g)===g){var Oe=P.inst,ut=Oe.destroy;if(ut!==void 0){Oe.destroy=void 0,q=v;var Ft=E,on=ut;try{on()}catch(_n){dr(q,Ft,_n)}}}P=P.next}while(P!==te)}}catch(_n){dr(v,v.return,_n)}}function Fs(g){var v=g.updateQueue;if(v!==null){var E=g.stateNode;try{bn(v,E)}catch(P){dr(g,g.return,P)}}}function sa(g,v,E){E.props=Md(g.type,g.memoizedProps),E.state=g.memoizedState;try{E.componentWillUnmount()}catch(P){dr(g,v,P)}}function Bo(g,v){try{var E=g.ref;if(E!==null){switch(g.tag){case 26:case 27:case 5:var P=um(g.stateNode);break;case 30:P=g.stateNode;break;default:P=g.stateNode}typeof E=="function"?g.refCleanup=E(P):E.current=P}}catch(q){dr(g,v,q)}}function $i(g,v){var E=g.ref,P=g.refCleanup;if(E!==null)if(typeof P=="function")try{P()}catch(q){dr(g,v,q)}finally{g.refCleanup=null,g=g.alternate,g!=null&&(g.refCleanup=null)}else if(typeof E=="function")try{E(null)}catch(q){dr(g,v,q)}else E.current=null}function Qs(g){var v=g.type,E=g.memoizedProps,P=g.stateNode;try{_3(P,v,E,g)}catch(q){dr(g,g.return,q)}}function Ho(g,v,E){try{w3(g.stateNode,g.type,E,v,g)}catch(P){dr(g,g.return,P)}}function La(g){return g.tag===5||g.tag===3||(vc?g.tag===26:!1)||(Po?g.tag===27&&Hh(g.type):!1)||g.tag===4}function po(g){e:for(;;){for(;g.sibling===null;){if(g.return===null||La(g.return))return null;g=g.return}for(g.sibling.return=g.return,g=g.sibling;g.tag!==5&&g.tag!==6&&g.tag!==18;){if(Po&&g.tag===27&&Hh(g.type)||g.flags&2||g.child===null||g.tag===4)continue e;g.child.return=g,g=g.child}if(!(g.flags&2))return g.stateNode}}function mo(g,v,E){var P=g.tag;if(P===5||P===6)g=g.stateNode,v?M3(E,g,v):Pb(E,g);else if(P!==4&&(Po&&P===27&&Hh(g.type)&&(E=g.stateNode,v=null),g=g.child,g!==null))for(mo(g,v,E),g=g.sibling;g!==null;)mo(g,v,E),g=g.sibling}function ko(g,v,E){var P=g.tag;if(P===5||P===6)g=g.stateNode,v?S3(E,g,v):Rb(E,g);else if(P!==4&&(Po&&P===27&&Hh(g.type)&&(E=g.stateNode),g=g.child,g!==null))for(ko(g,v,E),g=g.sibling;g!==null;)ko(g,v,E),g=g.sibling}function Qc(g,v,E){g=g.containerInfo;try{zb(g,E)}catch(P){dr(v,v.return,P)}}function Go(g){var v=g.stateNode,E=g.memoizedProps;try{xo(g.type,E,v,g)}catch(P){dr(g,g.return,P)}}function tv(g,v){for(xv(g.containerInfo),no=v;no!==null;)if(g=no,v=g.child,(g.subtreeFlags&1028)!==0&&v!==null)v.return=g,no=v;else for(;no!==null;){g=no;var E=g.alternate;switch(v=g.flags,g.tag){case 0:if((v&4)!==0&&(v=g.updateQueue,v=v!==null?v.events:null,v!==null))for(var P=0;P<v.length;P++){var q=v[P];q.ref.impl=q.nextImpl}break;case 11:case 15:break;case 1:if((v&1024)!==0&&E!==null){v=void 0,P=g,q=E.memoizedProps,E=E.memoizedState;var te=P.stateNode;try{var Oe=Md(P.type,q);v=te.getSnapshotBeforeUpdate(Oe,E),te.__reactInternalSnapshotBeforeUpdate=v}catch(ut){dr(P,P.return,ut)}}break;case 3:(v&1024)!==0&&Qr&&Ob(g.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((v&1024)!==0)throw Error(i(163))}if(v=g.sibling,v!==null){v.return=g.return,no=v;break}no=g.return}}function c3(g,v,E){var P=E.flags;switch(E.tag){case 0:case 11:case 15:ja(g,E),P&4&&ui(5,E);break;case 1:if(ja(g,E),P&4)if(g=E.stateNode,v===null)try{g.componentDidMount()}catch(Oe){dr(E,E.return,Oe)}else{var q=Md(E.type,v.memoizedProps);v=v.memoizedState;try{g.componentDidUpdate(q,v,g.__reactInternalSnapshotBeforeUpdate)}catch(Oe){dr(E,E.return,Oe)}}P&64&&Fs(E),P&512&&Bo(E,E.return);break;case 3:if(ja(g,E),P&64&&(P=E.updateQueue,P!==null)){if(g=null,E.child!==null)switch(E.child.tag){case 27:case 5:g=um(E.child.stateNode);break;case 1:g=E.child.stateNode}try{bn(P,g)}catch(Oe){dr(E,E.return,Oe)}}break;case 27:Po&&v===null&&P&4&&Go(E);case 26:case 5:if(ja(g,E),v===null){if(P&4)Qs(E);else if(P&64){g=E.type,v=E.memoizedProps,q=E.stateNode;try{W3(q,g,v,E)}catch(Oe){dr(E,E.return,Oe)}}}P&512&&Bo(E,E.return);break;case 12:ja(g,E);break;case 31:ja(g,E),P&4&&fc(g,E);break;case 13:ja(g,E),P&4&&lg(g,E),P&64&&(P=E.memoizedState,P!==null&&(P=P.dehydrated,P!==null&&(E=DE.bind(null,E),Mv(P,E))));break;case 22:if(P=E.memoizedState!==null||Hs,!P){v=v!==null&&v.memoizedState!==null||Gs,q=Hs;var te=Gs;Hs=P,(Gs=v)&&!te?pc(g,E,(E.subtreeFlags&8772)!==0):ja(g,E),Hs=q,Gs=te}break;case 30:break;default:ja(g,E)}}function pb(g){var v=g.alternate;v!==null&&(g.alternate=null,pb(v)),g.child=null,g.deletions=null,g.sibling=null,g.tag===5&&(v=g.stateNode,v!==null&&vv(v)),g.stateNode=null,g.return=null,g.dependencies=null,g.memoizedProps=null,g.memoizedState=null,g.pendingProps=null,g.stateNode=null,g.updateQueue=null}function dc(g,v,E){for(E=E.child;E!==null;)ag(g,v,E),E=E.sibling}function ag(g,v,E){if(cl&&typeof cl.onCommitFiberUnmount=="function")try{cl.onCommitFiberUnmount(Wh,E)}catch{}switch(E.tag){case 26:if(vc){Gs||$i(E,v),dc(g,v,E),E.memoizedState?Af(E.memoizedState):E.stateNode&&Kb(E.stateNode);break}case 27:if(Po){Gs||$i(E,v);var P=ks,q=ro;Hh(E.type)&&(ks=E.stateNode,ro=!1),dc(g,v,E),$o(E.stateNode),ks=P,ro=q;break}case 5:Gs||$i(E,v);case 6:if(Qr){if(P=ks,q=ro,ks=null,dc(g,v,E),ks=P,ro=q,ks!==null)if(ro)try{Ib(ks,E.stateNode)}catch(te){dr(E,v,te)}else try{T3(ks,E.stateNode)}catch(te){dr(E,v,te)}}else dc(g,v,E);break;case 18:Qr&&ks!==null&&(ro?Tv(ks,E.stateNode):Wb(ks,E.stateNode));break;case 4:Qr?(P=ks,q=ro,ks=E.stateNode.containerInfo,ro=!0,dc(g,v,E),ks=P,ro=q):(Dl&&Qc(E.stateNode,E,Lb()),dc(g,v,E));break;case 0:case 11:case 14:case 15:ds(2,E,v),Gs||ds(4,E,v),dc(g,v,E);break;case 1:Gs||($i(E,v),P=E.stateNode,typeof P.componentWillUnmount=="function"&&sa(E,v,P)),dc(g,v,E);break;case 21:dc(g,v,E);break;case 22:Gs=(P=Gs)||E.memoizedState!==null,dc(g,v,E),Gs=P;break;default:dc(g,v,E)}}function fc(g,v){if(hs&&v.memoizedState===null&&(g=v.alternate,g!==null&&(g=g.memoizedState,g!==null))){g=g.dehydrated;try{zE(g)}catch(E){dr(v,v.return,E)}}}function lg(g,v){if(hs&&v.memoizedState===null&&(g=v.alternate,g!==null&&(g=g.memoizedState,g!==null&&(g=g.dehydrated,g!==null))))try{FE(g)}catch(E){dr(v,v.return,E)}}function hc(g){switch(g.tag){case 31:case 13:case 19:var v=g.stateNode;return v===null&&(v=g.stateNode=new o_),v;case 22:return g=g.stateNode,v=g._retryCache,v===null&&(v=g._retryCache=new o_),v;default:throw Error(i(435,g.tag))}}function Nd(g,v){var E=hc(g);v.forEach(function(P){if(!E.has(P)){E.add(P);var q=OE.bind(null,g,P);P.then(q,q)}})}function Vo(g,v){var E=v.deletions;if(E!==null)for(var P=0;P<E.length;P++){var q=E[P],te=g,Oe=v;if(Qr){var ut=Oe;e:for(;ut!==null;){switch(ut.tag){case 27:if(Po){if(Hh(ut.type)){ks=ut.stateNode,ro=!1;break e}break}case 5:ks=ut.stateNode,ro=!1;break e;case 3:case 4:ks=ut.stateNode.containerInfo,ro=!0;break e}ut=ut.return}if(ks===null)throw Error(i(160));ag(te,Oe,q),ks=null,ro=!1}else ag(te,Oe,q);te=q.alternate,te!==null&&(te.return=null),q.return=null}if(v.subtreeFlags&13886)for(v=v.child;v!==null;)cg(v,g),v=v.sibling}function cg(g,v){var E=g.alternate,P=g.flags;switch(g.tag){case 0:case 11:case 14:case 15:Vo(v,g),Wo(g),P&4&&(ds(3,g,g.return),ui(3,g),ds(5,g,g.return));break;case 1:Vo(v,g),Wo(g),P&512&&(Gs||E===null||$i(E,E.return)),P&64&&Hs&&(g=g.updateQueue,g!==null&&(P=g.callbacks,P!==null&&(E=g.shared.hiddenCallbacks,g.shared.hiddenCallbacks=E===null?P:E.concat(P))));break;case 26:if(vc){var q=Ni;if(Vo(v,g),Wo(g),P&512&&(Gs||E===null||$i(E,E.return)),P&4){P=E!==null?E.memoizedState:null;var te=g.memoizedState;E===null?te===null?g.stateNode===null?g.stateNode=Z3(q,g.type,g.memoizedProps,g):Yb(q,g.type,g.stateNode):g.stateNode=Xb(q,te,g.memoizedProps):P!==te?(P===null?E.stateNode!==null&&Kb(E.stateNode):Af(P),te===null?Yb(q,g.type,g.stateNode):Xb(q,te,g.memoizedProps)):te===null&&g.stateNode!==null&&Ho(g,g.memoizedProps,E.memoizedProps)}break}case 27:if(Po){Vo(v,g),Wo(g),P&512&&(Gs||E===null||$i(E,E.return)),E!==null&&P&4&&Ho(g,g.memoizedProps,E.memoizedProps);break}case 5:if(Vo(v,g),Wo(g),P&512&&(Gs||E===null||$i(E,E.return)),Qr){if(g.flags&32){q=g.stateNode;try{Db(q)}catch(ln){dr(g,g.return,ln)}}P&4&&g.stateNode!=null&&(q=g.memoizedProps,Ho(g,q,E!==null?E.memoizedProps:q)),P&1024&&(xm=!0)}else Dl&&g.alternate!==null&&(g.alternate.stateNode=g.stateNode);break;case 6:if(Vo(v,g),Wo(g),P&4&&Qr){if(g.stateNode===null)throw Error(i(162));P=g.memoizedProps,E=E!==null?E.memoizedProps:P,q=g.stateNode;try{b3(q,E,P)}catch(ln){dr(g,g.return,ln)}}break;case 3:if(vc?(Q3(),q=Ni,Ni=_g(v.containerInfo),Vo(v,g),Ni=q):Vo(v,g),Wo(g),P&4){if(Qr&&hs&&E!==null&&E.memoizedState.isDehydrated)try{$3(v.containerInfo)}catch(ln){dr(g,g.return,ln)}if(Dl){P=v.containerInfo,E=v.pendingChildren;try{zb(P,E)}catch(ln){dr(g,g.return,ln)}}}xm&&(xm=!1,nv(g));break;case 4:vc?(E=Ni,Ni=_g(g.stateNode.containerInfo),Vo(v,g),Wo(g),Ni=E):(Vo(v,g),Wo(g)),P&4&&Dl&&Qc(g.stateNode,g,g.stateNode.pendingChildren);break;case 12:Vo(v,g),Wo(g);break;case 31:Vo(v,g),Wo(g),P&4&&(P=g.updateQueue,P!==null&&(g.updateQueue=null,Nd(g,P)));break;case 13:Vo(v,g),Wo(g),g.child.flags&8192&&g.memoizedState!==null!=(E!==null&&E.memoizedState!==null)&&(Rg=Sa()),P&4&&(P=g.updateQueue,P!==null&&(g.updateQueue=null,Nd(g,P)));break;case 22:q=g.memoizedState!==null;var Oe=E!==null&&E.memoizedState!==null,ut=Hs,Ft=Gs;if(Hs=ut||q,Gs=Ft||Oe,Vo(v,g),Gs=Ft,Hs=ut,Wo(g),P&8192&&(v=g.stateNode,v._visibility=q?v._visibility&-2:v._visibility|1,q&&(E===null||Oe||Hs||Gs||mf(g)),Qr)){e:if(E=null,Qr)for(v=g;;){if(v.tag===5||vc&&v.tag===26){if(E===null){Oe=E=v;try{te=Oe.stateNode,q?LE(te):E3(Oe.stateNode,Oe.memoizedProps)}catch(ln){dr(Oe,Oe.return,ln)}}}else if(v.tag===6){if(E===null){Oe=v;try{var on=Oe.stateNode;q?C3(on):A3(on,Oe.memoizedProps)}catch(ln){dr(Oe,Oe.return,ln)}}}else if(v.tag===18){if(E===null){Oe=v;try{var _n=Oe.stateNode;q?X3(_n):Y3(Oe.stateNode)}catch(ln){dr(Oe,Oe.return,ln)}}}else if((v.tag!==22&&v.tag!==23||v.memoizedState===null||v===g)&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===g)break e;for(;v.sibling===null;){if(v.return===null||v.return===g)break e;E===v&&(E=null),v=v.return}E===v&&(E=null),v.sibling.return=v.return,v=v.sibling}}P&4&&(P=g.updateQueue,P!==null&&(E=P.retryQueue,E!==null&&(P.retryQueue=null,Nd(g,E))));break;case 19:Vo(v,g),Wo(g),P&4&&(P=g.updateQueue,P!==null&&(g.updateQueue=null,Nd(g,P)));break;case 30:break;case 21:break;default:Vo(v,g),Wo(g)}}function Wo(g){var v=g.flags;if(v&2){try{for(var E,P=g.return;P!==null;){if(La(P)){E=P;break}P=P.return}if(Qr){if(E==null)throw Error(i(160));switch(E.tag){case 27:if(Po){var q=E.stateNode,te=po(g);ko(g,te,q);break}case 5:var Oe=E.stateNode;E.flags&32&&(Db(Oe),E.flags&=-33);var ut=po(g);ko(g,ut,Oe);break;case 3:case 4:var Ft=E.stateNode.containerInfo,on=po(g);mo(g,on,Ft);break;default:throw Error(i(161))}}}catch(_n){dr(g,g.return,_n)}g.flags&=-3}v&4096&&(g.flags&=-4097)}function nv(g){if(g.subtreeFlags&1024)for(g=g.child;g!==null;){var v=g;nv(v),v.tag===5&&v.flags&1024&&Eb(v.stateNode),g=g.sibling}}function ja(g,v){if(v.subtreeFlags&8772)for(v=v.child;v!==null;)c3(g,v.alternate,v),v=v.sibling}function mf(g){for(g=g.child;g!==null;){var v=g;switch(v.tag){case 0:case 11:case 14:case 15:ds(4,v,v.return),mf(v);break;case 1:$i(v,v.return);var E=v.stateNode;typeof E.componentWillUnmount=="function"&&sa(v,v.return,E),mf(v);break;case 27:Po&&$o(v.stateNode);case 26:case 5:$i(v,v.return),mf(v);break;case 22:v.memoizedState===null&&mf(v);break;case 30:mf(v);break;default:mf(v)}g=g.sibling}}function pc(g,v,E){for(E=E&&(v.subtreeFlags&8772)!==0,v=v.child;v!==null;){var P=v.alternate,q=g,te=v,Oe=te.flags;switch(te.tag){case 0:case 11:case 15:pc(q,te,E),ui(4,te);break;case 1:if(pc(q,te,E),P=te,q=P.stateNode,typeof q.componentDidMount=="function")try{q.componentDidMount()}catch(on){dr(P,P.return,on)}if(P=te,q=P.updateQueue,q!==null){var ut=P.stateNode;try{var Ft=q.shared.hiddenCallbacks;if(Ft!==null)for(q.shared.hiddenCallbacks=null,q=0;q<Ft.length;q++)en(Ft[q],ut)}catch(on){dr(P,P.return,on)}}E&&Oe&64&&Fs(te),Bo(te,te.return);break;case 27:Po&&Go(te);case 26:case 5:pc(q,te,E),E&&P===null&&Oe&4&&Qs(te),Bo(te,te.return);break;case 12:pc(q,te,E);break;case 31:pc(q,te,E),E&&Oe&4&&fc(q,te);break;case 13:pc(q,te,E),E&&Oe&4&&lg(q,te);break;case 22:te.memoizedState===null&&pc(q,te,E),Bo(te,te.return);break;case 30:break;default:pc(q,te,E)}v=v.sibling}}function gf(g,v){var E=null;g!==null&&g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(E=g.memoizedState.cachePool.pool),g=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(g=v.memoizedState.cachePool.pool),g!==E&&(g!=null&&g.refCount++,E!=null&&Te(E))}function mb(g,v){g=null,v.alternate!==null&&(g=v.alternate.memoizedState.cache),v=v.memoizedState.cache,v!==g&&(v.refCount++,g!=null&&Te(g))}function Cs(g,v,E,P){if(v.subtreeFlags&10256)for(v=v.child;v!==null;)rv(g,v,E,P),v=v.sibling}function rv(g,v,E,P){var q=v.flags;switch(v.tag){case 0:case 11:case 15:Cs(g,v,E,P),q&2048&&ui(9,v);break;case 1:Cs(g,v,E,P);break;case 3:Cs(g,v,E,P),q&2048&&(g=null,v.alternate!==null&&(g=v.alternate.memoizedState.cache),v=v.memoizedState.cache,v!==g&&(v.refCount++,g!=null&&Te(g)));break;case 12:if(q&2048){Cs(g,v,E,P),g=v.stateNode;try{var te=v.memoizedProps,Oe=te.id,ut=te.onPostCommit;typeof ut=="function"&&ut(Oe,v.alternate===null?"mount":"update",g.passiveEffectDuration,-0)}catch(Ft){dr(v,v.return,Ft)}}else Cs(g,v,E,P);break;case 31:Cs(g,v,E,P);break;case 13:Cs(g,v,E,P);break;case 23:break;case 22:te=v.stateNode,Oe=v.alternate,v.memoizedState!==null?te._visibility&2?Cs(g,v,E,P):em(g,v):te._visibility&2?Cs(g,v,E,P):(te._visibility|=2,rl(g,v,E,P,(v.subtreeFlags&10256)!==0||!1)),q&2048&&gf(Oe,v);break;case 24:Cs(g,v,E,P),q&2048&&mb(v.alternate,v);break;default:Cs(g,v,E,P)}}function rl(g,v,E,P,q){for(q=q&&((v.subtreeFlags&10256)!==0||!1),v=v.child;v!==null;){var te=g,Oe=v,ut=E,Ft=P,on=Oe.flags;switch(Oe.tag){case 0:case 11:case 15:rl(te,Oe,ut,Ft,q),ui(8,Oe);break;case 23:break;case 22:var _n=Oe.stateNode;Oe.memoizedState!==null?_n._visibility&2?rl(te,Oe,ut,Ft,q):em(te,Oe):(_n._visibility|=2,rl(te,Oe,ut,Ft,q)),q&&on&2048&&gf(Oe.alternate,Oe);break;case 24:rl(te,Oe,ut,Ft,q),q&&on&2048&&mb(Oe.alternate,Oe);break;default:rl(te,Oe,ut,Ft,q)}v=v.sibling}}function em(g,v){if(v.subtreeFlags&10256)for(v=v.child;v!==null;){var E=g,P=v,q=P.flags;switch(P.tag){case 22:em(E,P),q&2048&&gf(P.alternate,P);break;case 24:em(E,P),q&2048&&mb(P.alternate,P);break;default:em(E,P)}v=v.sibling}}function Ru(g,v,E){if(g.subtreeFlags&zl)for(g=g.child;g!==null;)xf(g,v,E),g=g.sibling}function xf(g,v,E){switch(g.tag){case 26:if(Ru(g,v,E),g.flags&zl)if(g.memoizedState!==null)J3(E,Ni,g.memoizedState,g.memoizedProps);else{var P=g.stateNode,q=g.type;g=g.memoizedProps,((v&335544128)===v||Tb(q,g))&&yv(E,P,q,g)}break;case 5:Ru(g,v,E),g.flags&zl&&(P=g.stateNode,q=g.type,g=g.memoizedProps,((v&335544128)===v||Tb(q,g))&&yv(E,P,q,g));break;case 3:case 4:vc?(P=Ni,Ni=_g(g.stateNode.containerInfo),Ru(g,v,E),Ni=P):Ru(g,v,E);break;case 22:g.memoizedState===null&&(P=g.alternate,P!==null&&P.memoizedState!==null?(P=zl,zl=16777216,Ru(g,v,E),zl=P):Ru(g,v,E));break;default:Ru(g,v,E)}}function iv(g){var v=g.alternate;if(v!==null&&(g=v.child,g!==null)){v.child=null;do v=g.sibling,g.sibling=null,g=v;while(g!==null)}}function tm(g){var v=g.deletions;if((g.flags&16)!==0){if(v!==null)for(var E=0;E<v.length;E++){var P=v[E];no=P,Rl(P,g)}iv(g)}if(g.subtreeFlags&10256)for(g=g.child;g!==null;)sv(g),g=g.sibling}function sv(g){switch(g.tag){case 0:case 11:case 15:tm(g),g.flags&2048&&ds(9,g,g.return);break;case 3:tm(g);break;case 12:tm(g);break;case 22:var v=g.stateNode;g.memoizedState!==null&&v._visibility&2&&(g.return===null||g.return.tag!==13)?(v._visibility&=-3,ug(g)):tm(g);break;default:tm(g)}}function ug(g){var v=g.deletions;if((g.flags&16)!==0){if(v!==null)for(var E=0;E<v.length;E++){var P=v[E];no=P,Rl(P,g)}iv(g)}for(g=g.child;g!==null;){switch(v=g,v.tag){case 0:case 11:case 15:ds(8,v,v.return),ug(v);break;case 22:E=v.stateNode,E._visibility&2&&(E._visibility&=-3,ug(v));break;default:ug(v)}g=g.sibling}}function Rl(g,v){for(;no!==null;){var E=no;switch(E.tag){case 0:case 11:case 15:ds(8,E,v);break;case 23:case 22:if(E.memoizedState!==null&&E.memoizedState.cachePool!==null){var P=E.memoizedState.cachePool.pool;P!=null&&P.refCount++}break;case 24:Te(E.memoizedState.cache)}if(P=E.child,P!==null)P.return=E,no=P;else e:for(E=g;no!==null;){P=no;var q=P.sibling,te=P.return;if(pb(P),P===E){no=null;break e}if(q!==null){q.return=te,no=q;break e}no=te}}}function vf(g){var v=Mr(g);if(v!=null){if(typeof v.memoizedProps["data-testname"]!="string")throw Error(i(364));return v}if(g=eo(g),g===null)throw Error(i(362));return g.stateNode.current}function yf(g,v){var E=g.tag;switch(v.$$typeof){case Cc:if(g.type===v.value)return!0;break;case ym:e:{for(v=v.value,g=[g,0],E=0;E<g.length;){var P=g[E++],q=P.tag,te=g[E++],Oe=v[te];if(q!==5&&q!==26&&q!==27||!Cf(P)){for(;Oe!=null&&yf(P,Oe);)te++,Oe=v[te];if(te===v.length){v=!0;break e}else for(P=P.child;P!==null;)g.push(P,te),P=P.sibling}}v=!1}return v;case bm:if((E===5||E===26||E===27)&&kb(g.stateNode,v.value))return!0;break;case Df:if((E===5||E===6||E===26||E===27)&&(g=yg(g),g!==null&&0<=g.indexOf(v.value)))return!0;break;case Ng:if((E===5||E===26||E===27)&&(g=g.memoizedProps["data-testname"],typeof g=="string"&&g.toLowerCase()===v.value.toLowerCase()))return!0;break;default:throw Error(i(365))}return!1}function nm(g){switch(g.$$typeof){case Cc:return"<"+(h(g.value)||"Unknown")+">";case ym:return":has("+(nm(g)||"")+")";case bm:return'[role="'+g.value+'"]';case Df:return'"'+g.value+'"';case Ng:return'[data-testname="'+g.value+'"]';default:throw Error(i(365))}}function rm(g,v){var E=[];g=[g,0];for(var P=0;P<g.length;){var q=g[P++],te=q.tag,Oe=g[P++],ut=v[Oe];if(te!==5&&te!==26&&te!==27||!Cf(q)){for(;ut!=null&&yf(q,ut);)Oe++,ut=v[Oe];if(Oe===v.length)E.push(q);else for(q=q.child;q!==null;)g.push(q,Oe),q=q.sibling}}return E}function il(g,v){if(!Ro)throw Error(i(363));g=vf(g),g=rm(g,v),v=[],g=Array.from(g);for(var E=0;E<g.length;){var P=g[E++],q=P.tag;if(q===5||q===26||q===27)Cf(P)||v.push(P.stateNode);else for(P=P.child;P!==null;)g.push(P),P=P.sibling}return v}function fs(){return(Br&2)!==0&&Xr!==0?Xr&-Xr:Qn.T!==null?Ke():fm()}function kd(){if(Ga===0)if((Xr&536870912)===0||qr){var g=Vh;Vh<<=1,(Vh&3932160)===0&&(Vh=262144),Ga=g}else Ga=536870912;return g=ul.current,g!==null&&(g.flags|=32),Ga}function Es(g,v,E){(g===Dr&&(ki===2||ki===9)||g.cancelPendingCommit!==null)&&(Us(g,0),Iu(g,Xr,Ga,!1)),k(g,E),((Br&2)===0||g!==Dr)&&(g===Dr&&((Br&2)===0&&(jf|=E),Rs===4&&Iu(g,Xr,Ga,!1)),Ue(g))}function Jc(g,v,E){if((Br&6)!==0)throw Error(i(327));var P=!E&&(v&127)===0&&(v&g.expiredLanes)===0||T(g,v),q=P?f3(g,v):Du(g,v,!0),te=P;do{if(q===0){Of&&!P&&Iu(g,v,0,!1);break}else{if(E=g.current.alternate,te&&!u3(E)){q=Du(g,v,!1),te=!1;continue}if(q===2){if(te=v,g.errorRecoveryDisabledLanes&te)var Oe=0;else Oe=g.pendingLanes&-536870913,Oe=Oe!==0?Oe:Oe&536870912?536870912:0;if(Oe!==0){v=Oe;e:{var ut=g;q=kg;var Ft=hs&&ut.current.memoizedState.isDehydrated;if(Ft&&(Us(ut,Oe).flags|=256),Oe=Du(ut,Oe,!1),Oe!==2){if(Lf&&!Ft){ut.errorRecoveryDisabledLanes|=te,jf|=te,q=4;break e}te=fl,fl=q,te!==null&&(fl===null?fl=te:fl.push.apply(fl,te))}q=Oe}if(te=!1,q!==2)continue}}if(q===1){Us(g,0),Iu(g,v,0,!0);break}e:{switch(P=g,te=q,te){case 0:case 1:throw Error(i(345));case 4:if((v&4194048)!==v)break;case 6:Iu(P,v,Ga,!ru);break e;case 2:fl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((v&62914560)===v&&(q=Rg+300-Sa(),10<q)){if(Iu(P,v,Ga,!ru),M(P,0,!0)!==0)break e;Xu=v,P.timeoutHandle=Mb(Pu.bind(null,P,E,fl,Pg,Bv,v,Ga,jf,wm,ru,te,"Throttled",-0,0),q);break e}Pu(P,E,fl,Pg,Bv,v,Ga,jf,wm,ru,te,null,-0,0)}}break}while(!0);Ue(g)}function Pu(g,v,E,P,q,te,Oe,ut,Ft,on,_n,ln,Pn,br){if(g.timeoutHandle=al,ln=v.subtreeFlags,ln&8192||(ln&16785408)===16785408){ln=Cb(),xf(v,te,ln);var io=(te&62914560)===te?Rg-Sa():(te&4194048)===te?Zh-Sa():0;if(io=y3(ln,io),io!==null){Xu=te,g.cancelPendingCommit=io(Lu.bind(null,g,v,te,E,P,q,Oe,ut,Ft,_n,ln,null,Pn,br)),Iu(g,te,Oe,!on);return}}Lu(g,v,te,E,P,q,Oe,ut,Ft)}function u3(g){for(var v=g;;){var E=v.tag;if((E===0||E===11||E===15)&&v.flags&16384&&(E=v.updateQueue,E!==null&&(E=E.stores,E!==null)))for(var P=0;P<E.length;P++){var q=E[P],te=q.getSnapshot;q=q.value;try{if(!to(te(),q))return!1}catch{return!1}}if(E=v.child,v.subtreeFlags&16384&&E!==null)E.return=v,v=E;else{if(v===g)break;for(;v.sibling===null;){if(v.return===null||v.return===g)return!0;v=v.return}v.sibling.return=v.return,v=v.sibling}}return!0}function Iu(g,v,E,P){v&=~_m,v&=~jf,g.suspendedLanes|=v,g.pingedLanes&=~v,P&&(g.warmLanes|=v),P=g.expirationTimes;for(var q=v;0<q;){var te=31-ll(q),Oe=1<<te;P[te]=-1,q&=~Oe}E!==0&&R(g,E,v)}function ov(){return(Br&6)===0?(be(0),!1):!0}function av(){if(Hr!==null){if(ki===0)var g=Hr.return;else g=Hr,tu=Zi=null,Xn(g),Rf=null,$h=0,g=Hr;for(;g!==null;)vi(g.alternate,g),g=g.return;Hr=null}}function Us(g,v){var E=g.timeoutHandle;E!==al&&(g.timeoutHandle=al,v3(E)),E=g.cancelPendingCommit,E!==null&&(g.cancelPendingCommit=null,E()),Xu=0,av(),Dr=g,Hr=E=Il(g.current,null),Xr=v,ki=0,vo=null,ru=!1,Of=T(g,v),Lf=!1,wm=Ga=_m=jf=Hd=Rs=0,fl=kg=null,Bv=!1,(v&8)!==0&&(v|=v&32);var P=g.entangledLanes;if(P!==0)for(g=g.entanglements,P&=v;0<P;){var q=31-ll(P),te=1<<q;v|=g[q],P&=~te}return qu=v,Vt(),E}function Ki(g,v){Tr=null,Qn.H=jl,v===Oo||v===Mc?(v=Ne(),ki=3):v===Fv?(v=Ne(),ki=4):ki=v===Ha?8:v!==null&&typeof v=="object"&&typeof v.then=="function"?6:1,vo=v,Hr===null&&(Rs=1,lc(g,ie(v,g.current)))}function Zr(){var g=ul.current;return g===null?!0:(Xr&4194048)===Xr?dl===null:(Xr&62914560)===Xr||(Xr&536870912)!==0?g===dl:!1}function Rd(){var g=Qn.H;return Qn.H=jl,g===null?jl:g}function Pl(){var g=Qn.A;return Qn.A=vm,g}function im(){Rs=4,ru||(Xr&4194048)!==Xr&&ul.current!==null||(Of=!0),(Hd&134217727)===0&&(jf&134217727)===0||Dr===null||Iu(Dr,Xr,Ga,!1)}function Du(g,v,E){var P=Br;Br|=2;var q=Rd(),te=Pl();(Dr!==g||Xr!==v)&&(Pg=null,Us(g,v)),v=!1;var Oe=Rs;e:do try{if(ki!==0&&Hr!==null){var ut=Hr,Ft=vo;switch(ki){case 8:av(),Oe=6;break e;case 3:case 2:case 9:case 6:ul.current===null&&(v=!0);var on=ki;if(ki=0,vo=null,Ou(g,ut,Ft,on),E&&Of){Oe=0;break e}break;default:on=ki,ki=0,vo=null,Ou(g,ut,Ft,on)}}d3(),Oe=Rs;break}catch(_n){Ki(g,_n)}while(!0);return v&&g.shellSuspendCounter++,tu=Zi=null,Br=P,Qn.H=q,Qn.A=te,Hr===null&&(Dr=null,Xr=0,Vt()),Oe}function d3(){for(;Hr!==null;)bf(Hr)}function f3(g,v){var E=Br;Br|=2;var P=Rd(),q=Pl();Dr!==g||Xr!==v?(Pg=null,zf=Sa()+500,Us(g,v)):Of=T(g,v);e:do try{if(ki!==0&&Hr!==null){v=Hr;var te=vo;t:switch(ki){case 1:ki=0,vo=null,Ou(g,v,te,1);break;case 2:case 9:if(Ae(te)){ki=0,vo=null,lv(v);break}v=function(){ki!==2&&ki!==9||Dr!==g||(ki=7),Ue(g)},te.then(v,v);break e;case 3:ki=7;break e;case 4:ki=5;break e;case 7:Ae(te)?(ki=0,vo=null,lv(v)):(ki=0,vo=null,Ou(g,v,te,7));break;case 5:var Oe=null;switch(Hr.tag){case 26:Oe=Hr.memoizedState;case 5:case 27:var ut=Hr,Ft=ut.type,on=ut.pendingProps;if(Oe?Qb(Oe):As(ut.stateNode,Ft,on)){ki=0,vo=null;var _n=ut.sibling;if(_n!==null)Hr=_n;else{var ln=ut.return;ln!==null?(Hr=ln,om(ln)):Hr=null}break t}}ki=0,vo=null,Ou(g,v,te,5);break;case 6:ki=0,vo=null,Ou(g,v,te,6);break;case 8:av(),Rs=6;break e;default:throw Error(i(462))}}sm();break}catch(Pn){Ki(g,Pn)}while(!0);return tu=Zi=null,Qn.H=P,Qn.A=q,Br=E,Hr!==null?0:(Dr=null,Xr=0,Vt(),Rs)}function sm(){for(;Hr!==null&&!t4();)bf(Hr)}function bf(g){var v=Xt(g.alternate,g,qu);g.memoizedProps=g.pendingProps,v===null?om(g):Hr=v}function lv(g){var v=g,E=v.alternate;switch(v.tag){case 15:case 0:v=js(E,v,v.pendingProps,v.type,void 0,Xr);break;case 11:v=js(E,v,v.pendingProps,v.type.render,v.ref,Xr);break;case 5:Xn(v);default:vi(E,v),v=Hr=dv(v,qu),v=Xt(E,v,qu)}g.memoizedProps=g.pendingProps,v===null?om(g):Hr=v}function Ou(g,v,E,P){tu=Zi=null,Xn(v),Rf=null,$h=0;var q=v.return;try{if(tg(g,q,v,E,Xr)){Rs=1,lc(g,ie(E,g.current)),Hr=null;return}}catch(te){if(q!==null)throw Hr=q,te;Rs=1,lc(g,ie(E,g.current)),Hr=null;return}v.flags&32768?(qr||P===1?g=!0:Of||(Xr&536870912)!==0?g=!1:(ru=g=!0,(P===2||P===9||P===3||P===6)&&(P=ul.current,P!==null&&P.tag===13&&(P.flags|=16384))),_f(v,g)):om(v)}function om(g){var v=g;do{if((v.flags&32768)!==0){_f(v,ru);return}g=v.return;var E=ns(v.alternate,v,qu);if(E!==null){Hr=E;return}if(v=v.sibling,v!==null){Hr=v;return}Hr=v=g}while(v!==null);Rs===0&&(Rs=5)}function _f(g,v){do{var E=zs(g.alternate,g);if(E!==null){E.flags&=32767,Hr=E;return}if(E=g.return,E!==null&&(E.flags|=32768,E.subtreeFlags=0,E.deletions=null),!v&&(g=g.sibling,g!==null)){Hr=g;return}Hr=g=E}while(g!==null);Rs=6,Hr=null}function Lu(g,v,E,P,q,te,Oe,ut,Ft){g.cancelPendingCommit=null;do zu();while(yo!==0);if((Br&6)!==0)throw Error(i(327));if(v!==null){if(v===g.current)throw Error(i(177));if(te=v.lanes|v.childLanes,te|=qh,O(g,E,te,Oe,ut,Ft),g===Dr&&(Hr=Dr=null,Xr=0),Qh=v,Vd=g,Xu=E,Sm=te,Hv=q,a_=P,(v.subtreeFlags&10256)!==0||(v.flags&10256)!==0?(g.callbackNode=null,g.callbackPriority=0,go(Sg,function(){return dg(),null})):(g.callbackNode=null,g.callbackPriority=0),P=(v.flags&13878)!==0,(v.subtreeFlags&13878)!==0||P){P=Qn.T,Qn.T=null,q=xc(),$r(2),Oe=Br,Br|=4;try{tv(g,v,E)}finally{Br=Oe,$r(q),Qn.T=P}}yo=1,Pd(),ju(),cv()}}function Pd(){if(yo===1){yo=0;var g=Vd,v=Qh,E=(v.flags&13878)!==0;if((v.subtreeFlags&13878)!==0||E){E=Qn.T,Qn.T=null;var P=xc();$r(2);var q=Br;Br|=4;try{cg(v,g),x3(g.containerInfo)}finally{Br=q,$r(P),Qn.T=E}}g.current=v,yo=2}}function ju(){if(yo===2){yo=0;var g=Vd,v=Qh,E=(v.flags&8772)!==0;if((v.subtreeFlags&8772)!==0||E){E=Qn.T,Qn.T=null;var P=xc();$r(2);var q=Br;Br|=4;try{c3(g,v.alternate,v)}finally{Br=q,$r(P),Qn.T=E}}yo=3}}function cv(){if(yo===4||yo===3){yo=0,e_();var g=Vd,v=Qh,E=Xu,P=a_;(v.subtreeFlags&10256)!==0||(v.flags&10256)!==0?yo=5:(yo=0,Qh=Vd=null,uv(g,g.pendingLanes));var q=g.pendingLanes;if(q===0&&(Gd=null),$(E),v=v.stateNode,cl&&typeof cl.onCommitFiberRoot=="function")try{cl.onCommitFiberRoot(Wh,v,void 0,(v.current.flags&128)===128)}catch{}if(P!==null){v=Qn.T,q=xc(),$r(2),Qn.T=null;try{for(var te=g.onRecoverableError,Oe=0;Oe<P.length;Oe++){var ut=P[Oe];te(ut.value,{componentStack:ut.stack})}}finally{Qn.T=v,$r(q)}}(Xu&3)!==0&&zu(),Ue(g),q=g.pendingLanes,(E&261930)!==0&&(q&42)!==0?g===Ig?di++:(di=0,Ig=g):di=0,hs&&bg(),be(0)}}function uv(g,v){(g.pooledCacheLanes&=v)===0&&(v=g.pooledCache,v!=null&&(g.pooledCache=null,Te(v)))}function zu(){return Pd(),ju(),cv(),dg()}function dg(){if(yo!==5)return!1;var g=Vd,v=Sm;Sm=0;var E=$(Xu),P=32>E?32:E;E=Qn.T;var q=xc();try{$r(P),Qn.T=null,P=Hv,Hv=null;var te=Vd,Oe=Xu;if(yo=0,Qh=Vd=null,Xu=0,(Br&6)!==0)throw Error(i(331));var ut=Br;if(Br|=4,sv(te.current),rv(te,te.current,Oe,P),Br=ut,be(0,!1),cl&&typeof cl.onPostCommitFiberRoot=="function")try{cl.onPostCommitFiberRoot(Wh,te)}catch{}return!0}finally{$r(q),Qn.T=E,uv(g,v)}}function wf(g,v,E){v=ie(E,v),v=Td(g.stateNode,v,2),g=zt(g,v,2),g!==null&&(k(g,2),Ue(g))}function dr(g,v,E){if(g.tag===3)wf(g,g,E);else for(;v!==null;){if(v.tag===3){wf(v,g,E);break}else if(v.tag===1){var P=v.stateNode;if(typeof v.type.getDerivedStateFromError=="function"||typeof P.componentDidCatch=="function"&&(Gd===null||!Gd.has(P))){g=ie(E,g),E=eg(2),P=zt(v,E,2),P!==null&&(Yp(E,P,v,g),k(P,2),Ue(P));break}}v=v.return}}function am(g,v,E){var P=g.pingCache;if(P===null){P=g.pingCache=new Fl;var q=new Set;P.set(v,q)}else q=P.get(v),q===void 0&&(q=new Set,P.set(v,q));q.has(E)||(Lf=!0,q.add(E),g=h3.bind(null,g,v,E),v.then(g,g))}function h3(g,v,E){var P=g.pingCache;P!==null&&P.delete(v),g.pingedLanes|=g.suspendedLanes&E,g.warmLanes&=~E,Dr===g&&(Xr&E)===E&&(Rs===4||Rs===3&&(Xr&62914560)===Xr&&300>Sa()-Rg?(Br&2)===0&&Us(g,0):_m|=E,wm===Xr&&(wm=0)),Ue(g)}function p3(g,v){v===0&&(v=N()),g=Gt(g,v),g!==null&&(k(g,v),Ue(g))}function DE(g){var v=g.memoizedState,E=0;v!==null&&(E=v.retryLane),p3(g,E)}function OE(g,v){var E=0;switch(g.tag){case 31:case 13:var P=g.stateNode,q=g.memoizedState;q!==null&&(E=q.retryLane);break;case 19:P=g.stateNode;break;case 22:P=g.stateNode._retryCache;break;default:throw Error(i(314))}P!==null&&P.delete(v),p3(g,E)}function go(g,v){return wg(g,v)}function gb(g,v,E,P){this.tag=g,this.key=E,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=v,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=P,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ph(g){return g=g.prototype,!(!g||!g.isReactComponent)}function Il(g,v){var E=g.alternate;return E===null?(E=n(g.tag,v,g.key,g.mode),E.elementType=g.elementType,E.type=g.type,E.stateNode=g.stateNode,E.alternate=g,g.alternate=E):(E.pendingProps=v,E.type=g.type,E.flags=0,E.subtreeFlags=0,E.deletions=null),E.flags=g.flags&65011712,E.childLanes=g.childLanes,E.lanes=g.lanes,E.child=g.child,E.memoizedProps=g.memoizedProps,E.memoizedState=g.memoizedState,E.updateQueue=g.updateQueue,v=g.dependencies,E.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext},E.sibling=g.sibling,E.index=g.index,E.ref=g.ref,E.refCleanup=g.refCleanup,E}function dv(g,v){g.flags&=65011714;var E=g.alternate;return E===null?(g.childLanes=0,g.lanes=v,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=E.childLanes,g.lanes=E.lanes,g.child=E.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=E.memoizedProps,g.memoizedState=E.memoizedState,g.updateQueue=E.updateQueue,g.type=E.type,v=E.dependencies,g.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext}),g}function Id(g,v,E,P,q,te){var Oe=0;if(P=g,typeof g=="function")Ph(g)&&(Oe=1);else if(typeof g=="string")Oe=vc&&Po?Cv(g,E,qo.current)?26:Jb(g)?27:5:vc?Cv(g,E,qo.current)?26:5:Po&&Jb(g)?27:5;else e:switch(g){case mg:return g=n(31,E,v,q),g.elementType=mg,g.lanes=te,g;case Lh:return mc(E.children,q,te,v);case jh:Oe=8,q|=24;break;case zh:return g=n(12,E,v,q|2),g.elementType=zh,g.lanes=te,g;case mv:return g=n(13,E,v,q),g.elementType=mv,g.lanes=te,g;case Dd:return g=n(19,E,v,q),g.elementType=Dd,g.lanes=te,g;default:if(typeof g=="object"&&g!==null)switch(g.$$typeof){case gc:Oe=10;break e;case pg:Oe=9;break e;case lm:Oe=11;break e;case gv:Oe=14;break e;case za:Oe=16,P=null;break e}Oe=29,E=Error(i(130,g===null?"null":typeof g,"")),P=null}return v=n(Oe,E,v,q),v.elementType=g,v.type=P,v.lanes=te,v}function mc(g,v,E,P){return g=n(7,g,P,v),g.lanes=E,g}function xb(g,v,E){return g=n(6,g,null,v),g.lanes=E,g}function vb(g){var v=n(18,null,null,0);return v.stateNode=g,v}function yb(g,v,E){return v=n(4,g.children!==null?g.children:[],g.key,v),v.lanes=E,v.stateNode={containerInfo:g.containerInfo,pendingChildren:null,implementation:g.implementation},v}function m3(g,v,E,P,q,te,Oe,ut,Ft){this.tag=1,this.containerInfo=g,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=al,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=D(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=D(0),this.hiddenUpdates=D(null),this.identifierPrefix=P,this.onUncaughtError=q,this.onCaughtError=te,this.onRecoverableError=Oe,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Ft,this.incompleteTransitions=new Map}function Sf(g,v,E,P,q,te,Oe,ut,Ft,on,_n,ln){return g=new m3(g,v,E,Oe,Ft,on,_n,ln,ut),v=1,te===!0&&(v|=24),te=n(3,null,null,v),g.current=te,te.stateNode=g,v=we(),v.refCount++,g.pooledCache=v,v.refCount++,te.memoizedState={element:P,isDehydrated:E,cache:v},hn(te),g}function fv(g){return g?(g=Uu,g):Uu}function fg(g){var v=g._reactInternals;if(v===void 0)throw typeof g.render=="function"?Error(i(188)):(g=Object.keys(g).join(","),Error(i(268,g)));return g=a(v),g=g!==null?l(g):null,g===null?null:um(g.stateNode)}function bb(g,v,E,P,q,te){q=fv(q),P.context===null?P.context=q:P.pendingContext=q,P=Lt(v),P.payload={element:E},te=te===void 0?null:te,te!==null&&(P.callback=te),E=zt(g,P,v),E!==null&&(Es(E,g,v),pn(E,g,v))}function Ih(g,v){if(g=g.memoizedState,g!==null&&g.dehydrated!==null){var E=g.retryLane;g.retryLane=E!==0&&E<v?E:v}}function hg(g,v){Ih(g,v),(g=g.alternate)&&Ih(g,v)}var Pr={},hv=ri,sl=zAe,pv=Object.assign,Dh=Symbol.for("react.element"),Fu=Symbol.for("react.transitional.element"),Oh=Symbol.for("react.portal"),Lh=Symbol.for("react.fragment"),jh=Symbol.for("react.strict_mode"),zh=Symbol.for("react.profiler"),pg=Symbol.for("react.consumer"),gc=Symbol.for("react.context"),lm=Symbol.for("react.forward_ref"),mv=Symbol.for("react.suspense"),Dd=Symbol.for("react.suspense_list"),gv=Symbol.for("react.memo"),za=Symbol.for("react.lazy"),mg=Symbol.for("react.activity"),_b=Symbol.for("react.memo_cache_sentinel"),Od=Symbol.iterator,Mf=Symbol.for("react.client.reference"),Tf=Array.isArray,Qn=hv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,wb=e.rendererVersion,gg=e.rendererPackageName,cm=e.extraDevToolsConfig,um=e.getPublicInstance,g3=e.getRootHostContext,dm=e.getChildHostContext,xv=e.prepareForCommit,x3=e.resetAfterCommit,Sb=e.createInstance;e.cloneMutableInstance;var xg=e.appendInitialChild,ol=e.finalizeInitialChildren,Fa=e.shouldSetTextContent,Ld=e.createTextInstance;e.cloneMutableTextInstance;var Mb=e.scheduleTimeout,v3=e.cancelTimeout,al=e.noTimeout,Js=e.isPrimaryRenderer;e.warnsIfNotActing;var Qr=e.supportsMutation,Dl=e.supportsPersistence,hs=e.supportsHydration,Mr=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var Fi=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var $r=e.setCurrentUpdatePriority,xc=e.getCurrentUpdatePriority,fm=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var Fh=e.shouldAttemptEagerTransition,vv=e.detachDeletedInstance;e.requestPostPaintCallback;var vg=e.maySuspendCommit,hm=e.maySuspendCommitOnUpdate,Tb=e.maySuspendCommitInSyncRender,As=e.preloadInstance,Cb=e.startSuspendingCommit,yv=e.suspendInstance;e.suspendOnActiveViewTransition;var y3=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var Uh=e.NotPendingTransition,Bh=e.HostTransitionContext,Eb=e.resetFormInstance;e.bindToConsole;var Ab=e.supportsMicrotasks,Nb=e.scheduleMicrotask,Ro=e.supportsTestSelectors,eo=e.findFiberRoot,bv=e.getBoundingRect,yg=e.getTextContent,Cf=e.isHiddenSubtree,kb=e.matchAccessibilityRole,jd=e.setFocusIfFocusable,_v=e.setupIntersectionObserver,Rb=e.appendChild,Pb=e.appendChildToContainer,b3=e.commitTextUpdate,_3=e.commitMount,w3=e.commitUpdate,S3=e.insertBefore,M3=e.insertInContainerBefore,T3=e.removeChild,Ib=e.removeChildFromContainer,Db=e.resetTextContent,LE=e.hideInstance,C3=e.hideTextInstance,E3=e.unhideInstance,A3=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 Ob=e.clearContainer;e.createFragmentInstance,e.updateFragmentInstanceFiber,e.commitNewChildToFragmentInstance,e.deleteChildFromFragmentInstance;var N3=e.cloneInstance,Lb=e.createContainerChildSet,jb=e.appendChildToContainerChildSet,k3=e.finalizeContainerChildren,zb=e.replaceContainerChildren,R3=e.cloneHiddenInstance,Fb=e.cloneHiddenTextInstance,Ef=e.isSuspenseInstancePending,wv=e.isSuspenseInstanceFallback,Sv=e.getSuspenseInstanceFallbackErrorDetails,Mv=e.registerSuspenseInstanceRetry,P3=e.canHydrateFormStateMarker,Ub=e.isFormStateMarkerMatching,I3=e.getNextHydratableSibling,D3=e.getNextHydratableSiblingAfterSingleton,O3=e.getFirstHydratableChild,L3=e.getFirstHydratableChildWithinContainer,j3=e.getFirstHydratableChildWithinActivityInstance,z3=e.getFirstHydratableChildWithinSuspenseInstance,Bb=e.getFirstHydratableChildWithinSingleton,F3=e.canHydrateInstance,U3=e.canHydrateTextInstance,Hb=e.canHydrateActivityInstance,B3=e.canHydrateSuspenseInstance,H3=e.hydrateInstance,jE=e.hydrateTextInstance,Gb=e.hydrateActivityInstance,G3=e.hydrateSuspenseInstance,V3=e.getNextHydratableInstanceAfterActivityInstance,Vb=e.getNextHydratableInstanceAfterSuspenseInstance,W3=e.commitHydratedInstance,$3=e.commitHydratedContainer,zE=e.commitHydratedActivityInstance,FE=e.commitHydratedSuspenseInstance,q3=e.finalizeHydratedChildren,bg=e.flushHydrationEvents;e.clearActivityBoundary;var Wb=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var Tv=e.clearSuspenseBoundaryFromContainer,X3=e.hideDehydratedBoundary,Y3=e.unhideDehydratedBoundary,pm=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var K3=e.validateHydratableInstance,$b=e.validateHydratableTextInstance,vc=e.supportsResources,Cv=e.isHostHoistableType,_g=e.getHoistableRoot,qb=e.getResource,Xb=e.acquireResource,Af=e.releaseResource,Z3=e.hydrateHoistable,Yb=e.mountHoistable,Kb=e.unmountHoistable,Ev=e.createHoistableInstance,Q3=e.prepareToCommitHoistables,Zb=e.mayResourceSuspendCommit,Qb=e.preloadResource,J3=e.suspendResource,Po=e.supportsSingletons,Av=e.resolveSingletonInstance,xo=e.acquireSingletonInstance,$o=e.releaseSingletonInstance,Jb=e.isHostSingletonType,Hh=e.isSingletonScope,Nv=[],Gh=-1,Uu={},ll=Math.clz32?Math.clz32:_,kv=Math.log,e4=Math.LN2,Rv=256,Vh=262144,mm=4194304,wg=sl.unstable_scheduleCallback,Pv=sl.unstable_cancelCallback,t4=sl.unstable_shouldYield,e_=sl.unstable_requestPaint,Sa=sl.unstable_now,Iv=sl.unstable_ImmediatePriority,n4=sl.unstable_UserBlockingPriority,Sg=sl.unstable_NormalPriority,Dv=sl.unstable_IdlePriority,t_=sl.log,r4=sl.unstable_setDisableYieldValue,Wh=null,cl=null,to=typeof Object.is=="function"?Object.is:Z,Ov=typeof reportError=="function"?reportError:function(g){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var v=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof g=="object"&&g!==null&&typeof g.message=="string"?String(g.message):String(g),error:g});if(!window.dispatchEvent(v))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",g);return}console.error(g)},UE=Object.prototype.hasOwnProperty,Lv,Bu,Mg=!1,n_=new WeakMap,zd=[],Hu=0,Ui=null,Tg=0,yc=[],Ol=0,bc=null,oa=1,eu="",qo=m(null),Fd=m(null),aa=m(null),Cg=m(null),Io=null,ps=null,qr=!1,Gu=null,Ua=!1,jv=Error(i(519)),_c=m(null),Zi=null,tu=null,i4=typeof AbortController<"u"?AbortController:function(){var g=[],v=this.signal={aborted:!1,addEventListener:function(E,P){g.push(P)}};this.abort=function(){v.aborted=!0,g.forEach(function(E){return E()})}},Xo=sl.unstable_scheduleCallback,BE=sl.unstable_NormalPriority,ms={$$typeof:gc,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Eg=null,Ai=null,Ma=!1,wc=!1,zv=!1,Nf=0,gm=null,r_=0,Ud=0,Do=null,Sc=Qn.S;Qn.S=function(g,v){Zh=Sa(),typeof v=="object"&&v!==null&&typeof v.then=="function"&&rt(g,v),Sc!==null&&Sc(g,v)};var kf=m(null),Oo=Error(i(460)),Fv=Error(i(474)),Mc=Error(i(542)),Vu={then:function(){}},Ba=null,Rf=null,$h=0,la=wt(!0),i_=wt(!1),ca=[],Wu=0,qh=0,Ll=!1,Uv=!1,Xh=m(null),Pf=m(0),ul=m(null),dl=null,Bs=m(0),Bd=0,Tr=null,$n=null,xr=null,Ir=!1,kr=!1,ti=!1,Ta=0,Tc=0,nu=null,s_=0,jl={readContext:ue,use:ts,useCallback:Fe,useContext:Fe,useEffect:Fe,useImperativeHandle:Fe,useLayoutEffect:Fe,useInsertionEffect:Fe,useMemo:Fe,useReducer:Fe,useRef:Fe,useState:Fe,useDebugValue:Fe,useDeferredValue:Fe,useTransition:Fe,useSyncExternalStore:Fe,useId:Fe,useHostTransitionStatus:Fe,useFormState:Fe,useActionState:Fe,useOptimistic:Fe,useMemoCache:Fe,useCacheRefresh:Fe};jl.useEffectEvent=Fe;var Ns={readContext:ue,use:ts,useCallback:function(g,v){return ir().memoizedState=[g,v===void 0?null:v],g},useContext:ue,useEffect:ii,useImperativeHandle:function(g,v,E){E=E!=null?E.concat([g]):null,nl(4194308,4,Kr.bind(null,v,g),E)},useLayoutEffect:function(g,v){return nl(4194308,4,g,v)},useInsertionEffect:function(g,v){nl(4,2,g,v)},useMemo:function(g,v){var E=ir();v=v===void 0?null:v;var P=g();if(ti){G(!0);try{g()}finally{G(!1)}}return E.memoizedState=[P,v],P},useReducer:function(g,v,E){var P=ir();if(E!==void 0){var q=E(v);if(ti){G(!0);try{E(v)}finally{G(!1)}}}else q=v;return P.memoizedState=P.baseState=q,g={pending:null,lanes:0,dispatch:null,lastRenderedReducer:g,lastRenderedState:q},P.queue=g,g=g.dispatch=Ms.bind(null,Tr,g),[P.memoizedState,g]},useRef:function(g){var v=ir();return g={current:g},v.memoizedState=g},useState:function(g){g=El(g);var v=g.queue,E=kl.bind(null,Tr,v);return v.dispatch=E,[g.memoizedState,E]},useDebugValue:Nl,useDeferredValue:function(g,v){var E=ir();return xi(E,g,v)},useTransition:function(){var g=El(!1);return g=_d.bind(null,Tr,g.queue,!0,!1),ir().memoizedState=g,[!1,g]},useSyncExternalStore:function(g,v,E){var P=Tr,q=ir();if(qr){if(E===void 0)throw Error(i(407));E=E()}else{if(E=v(),Dr===null)throw Error(i(349));(Xr&127)!==0||ji(P,v,E)}q.memoizedState=E;var te={value:E,getSnapshot:v};return q.queue=te,ii(ba.bind(null,P,te,g),[g]),P.flags|=2048,Ss(9,{destroy:void 0},na.bind(null,P,te,E,v),null),E},useId:function(){var g=ir(),v=Dr.identifierPrefix;if(qr){var E=eu,P=oa;E=(P&~(1<<32-ll(P)-1)).toString(32)+E,v="_"+v+"R_"+E,E=Ta++,0<E&&(v+="H"+E.toString(32)),v+="_"}else E=s_++,v="_"+v+"r_"+E.toString(32)+"_";return g.memoizedState=v},useHostTransitionStatus:hf,useFormState:oc,useActionState:oc,useOptimistic:function(g){var v=ir();v.memoizedState=v.baseState=g;var E={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return v.queue=E,v=$p.bind(null,Tr,!0,E),E.dispatch=v,[g,v]},useMemoCache:Ds,useCacheRefresh:function(){return ir().memoizedState=Ks.bind(null,Tr)},useEffectEvent:function(g){var v=ir(),E={impl:g};return v.memoizedState=E,function(){if((Br&2)!==0)throw Error(i(440));return E.impl.apply(void 0,arguments)}}},$u={readContext:ue,use:ts,useCallback:ac,useContext:ue,useEffect:Wr,useImperativeHandle:Oa,useInsertionEffect:Si,useLayoutEffect:zi,useMemo:Ao,useReducer:ws,useRef:tl,useState:function(){return ws(Li)},useDebugValue:Nl,useDeferredValue:function(g,v){var E=dn();return Nh(E,$n.memoizedState,g,v)},useTransition:function(){var g=ws(Li)[0],v=dn().memoizedState;return[typeof g=="boolean"?g:vn(g),v]},useSyncExternalStore:Os,useId:wa,useHostTransitionStatus:hf,useFormState:ra,useActionState:ra,useOptimistic:function(g,v){var E=dn();return _a(E,$n,g,v)},useMemoCache:Ds,useCacheRefresh:Yi};$u.useEffectEvent=Sr;var If={readContext:ue,use:ts,useCallback:ac,useContext:ue,useEffect:Wr,useImperativeHandle:Oa,useInsertionEffect:Si,useLayoutEffect:zi,useMemo:Ao,useReducer:mi,useRef:tl,useState:function(){return mi(Li)},useDebugValue:Nl,useDeferredValue:function(g,v){var E=dn();return $n===null?xi(E,g,v):Nh(E,$n.memoizedState,g,v)},useTransition:function(){var g=mi(Li)[0],v=dn().memoizedState;return[typeof g=="boolean"?g:vn(g),v]},useSyncExternalStore:Os,useId:wa,useHostTransitionStatus:hf,useFormState:Al,useActionState:Al,useOptimistic:function(g,v){var E=dn();return $n!==null?_a(E,$n,g,v):(E.baseState=g,[g,E.queue.dispatch])},useMemoCache:Ds,useCacheRefresh:Yi};If.useEffectEvent=Sr;var Ag={enqueueSetState:function(g,v,E){g=g._reactInternals;var P=fs(),q=Lt(P);q.payload=v,E!=null&&(q.callback=E),v=zt(g,q,P),v!==null&&(Es(v,g,P),pn(v,g,P))},enqueueReplaceState:function(g,v,E){g=g._reactInternals;var P=fs(),q=Lt(P);q.tag=1,q.payload=v,E!=null&&(q.callback=E),v=zt(g,q,P),v!==null&&(Es(v,g,P),pn(v,g,P))},enqueueForceUpdate:function(g,v){g=g._reactInternals;var E=fs(),P=Lt(E);P.tag=2,v!=null&&(P.callback=v),v=zt(g,P,E),v!==null&&(Es(v,g,E),pn(v,g,E))}},Ha=Error(i(461)),rs=!1,Yh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},Hs=!1,Gs=!1,xm=!1,o_=typeof WeakSet=="function"?WeakSet:Set,no=null,ks=null,ro=!1,Ni=null,zl=8192,vm={getCacheForType:function(g){var v=ue(ms),E=v.data.get(g);return E===void 0&&(E=g(),v.data.set(g,E)),E},cacheSignal:function(){return ue(ms).controller.signal}},Cc=0,ym=1,bm=2,Ng=3,Df=4;if(typeof Symbol=="function"&&Symbol.for){var Kh=Symbol.for;Cc=Kh("selector.component"),ym=Kh("selector.has_pseudo_class"),bm=Kh("selector.role"),Ng=Kh("selector.test_id"),Df=Kh("selector.text")}var Fl=typeof WeakMap=="function"?WeakMap:Map,Br=0,Dr=null,Hr=null,Xr=0,ki=0,vo=null,ru=!1,Of=!1,Lf=!1,qu=0,Rs=0,Hd=0,jf=0,_m=0,Ga=0,wm=0,kg=null,fl=null,Bv=!1,Rg=0,Zh=0,zf=1/0,Pg=null,Gd=null,yo=0,Vd=null,Qh=null,Xu=0,Sm=0,Hv=null,a_=null,di=0,Ig=null;return Pr.attemptContinuousHydration=function(g){if(g.tag===13||g.tag===31){var v=Gt(g,67108864);v!==null&&Es(v,g,67108864),hg(g,67108864)}},Pr.attemptHydrationAtCurrentPriority=function(g){if(g.tag===13||g.tag===31){var v=fs();v=H(v);var E=Gt(g,v);E!==null&&Es(E,g,v),hg(g,v)}},Pr.attemptSynchronousHydration=function(g){switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var v=S(g.pendingLanes);if(v!==0){for(g.pendingLanes|=2,g.entangledLanes|=2;v;){var E=1<<31-ll(v);g.entanglements[1]|=E,v&=~E}Ue(g),(Br&6)===0&&(zf=Sa()+500,be(0))}}break;case 31:case 13:v=Gt(g,2),v!==null&&Es(v,g,2),ov(),hg(g,2)}},Pr.batchedUpdates=function(g,v){return g(v)},Pr.createComponentSelector=function(g){return{$$typeof:Cc,value:g}},Pr.createContainer=function(g,v,E,P,q,te,Oe,ut,Ft,on){return Sf(g,v,!1,null,E,P,te,null,Oe,ut,Ft,on)},Pr.createHasPseudoClassSelector=function(g){return{$$typeof:ym,value:g}},Pr.createHydrationContainer=function(g,v,E,P,q,te,Oe,ut,Ft,on,_n,ln,Pn,br){var io;return g=Sf(E,P,!0,g,q,te,ut,br,Ft,on,_n,ln),g.context=fv(null),E=g.current,P=fs(),P=H(P),q=Lt(P),q.callback=(io=v)!=null?io:null,zt(E,q,P),v=P,g.current.lanes=v,k(g,v),Ue(g),g},Pr.createPortal=function(g,v,E){var P=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Oh,key:P==null?null:""+P,children:g,containerInfo:v,implementation:E}},Pr.createRoleSelector=function(g){return{$$typeof:bm,value:g}},Pr.createTestNameSelector=function(g){return{$$typeof:Ng,value:g}},Pr.createTextSelector=function(g){return{$$typeof:Df,value:g}},Pr.defaultOnCaughtError=function(g){console.error(g)},Pr.defaultOnRecoverableError=function(g){Ov(g)},Pr.defaultOnUncaughtError=function(g){Ov(g)},Pr.deferredUpdates=function(g){var v=Qn.T,E=xc();try{return $r(32),Qn.T=null,g()}finally{$r(E),Qn.T=v}},Pr.discreteUpdates=function(g,v,E,P,q){var te=Qn.T,Oe=xc();try{return $r(2),Qn.T=null,g(v,E,P,q)}finally{$r(Oe),Qn.T=te,Br===0&&(zf=Sa()+500)}},Pr.findAllNodes=il,Pr.findBoundingRects=function(g,v){if(!Ro)throw Error(i(363));v=il(g,v),g=[];for(var E=0;E<v.length;E++)g.push(bv(v[E]));for(v=g.length-1;0<v;v--){E=g[v];for(var P=E.x,q=P+E.width,te=E.y,Oe=te+E.height,ut=v-1;0<=ut;ut--)if(v!==ut){var Ft=g[ut],on=Ft.x,_n=on+Ft.width,ln=Ft.y,Pn=ln+Ft.height;if(P>=on&&te>=ln&&q<=_n&&Oe<=Pn){g.splice(v,1);break}else if(P!==on||E.width!==Ft.width||Pn<te||ln>Oe){if(!(te!==ln||E.height!==Ft.height||_n<P||on>q)){on>P&&(Ft.width+=on-P,Ft.x=P),_n<q&&(Ft.width=q-on),g.splice(v,1);break}}else{ln>te&&(Ft.height+=ln-te,Ft.y=te),Pn<Oe&&(Ft.height=Oe-ln),g.splice(v,1);break}}}return g},Pr.findHostInstance=fg,Pr.findHostInstanceWithNoPortals=function(g){return g=a(g),g=g!==null?c(g):null,g===null?null:um(g.stateNode)},Pr.findHostInstanceWithWarning=function(g){return fg(g)},Pr.flushPassiveEffects=zu,Pr.flushSyncFromReconciler=function(g){var v=Br;Br|=1;var E=Qn.T,P=xc();try{if($r(2),Qn.T=null,g)return g()}finally{$r(P),Qn.T=E,Br=v,(Br&6)===0&&be(0)}},Pr.flushSyncWork=ov,Pr.focusWithin=function(g,v){if(!Ro)throw Error(i(363));for(g=vf(g),v=rm(g,v),v=Array.from(v),g=0;g<v.length;){var E=v[g++],P=E.tag;if(!Cf(E)){if((P===5||P===26||P===27)&&jd(E.stateNode))return!0;for(E=E.child;E!==null;)v.push(E),E=E.sibling}}return!1},Pr.getFindAllNodesFailureDescription=function(g,v){if(!Ro)throw Error(i(363));var E=0,P=[];g=[vf(g),0];for(var q=0;q<g.length;){var te=g[q++],Oe=te.tag,ut=g[q++],Ft=v[ut];if((Oe!==5&&Oe!==26&&Oe!==27||!Cf(te))&&(yf(te,Ft)&&(P.push(nm(Ft)),ut++,ut>E&&(E=ut)),ut<v.length))for(te=te.child;te!==null;)g.push(te,ut),te=te.sibling}if(E<v.length){for(g=[];E<v.length;E++)g.push(nm(v[E]));return`findAllNodes was able to match part of the selector:
  `+(P.join(" > ")+`

No matching component was found for:
  `)+g.join(" > ")}return null},Pr.getPublicRootInstance=function(g){if(g=g.current,!g.child)return null;switch(g.child.tag){case 27:case 5:return um(g.child.stateNode);default:return g.child.stateNode}},Pr.injectIntoDevTools=function(){var g={bundleType:0,version:wb,rendererPackageName:gg,currentDispatcherRef:Qn,reconcilerVersion:"19.2.0"};if(cm!==null&&(g.rendererConfig=cm),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")g=!1;else{var v=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(v.isDisabled||!v.supportsFiber)g=!0;else{try{Wh=v.inject(g),cl=v}catch{}g=!!v.checkDCE}}return g},Pr.isAlreadyRendering=function(){return(Br&6)!==0},Pr.observeVisibleRects=function(g,v,E,P){if(!Ro)throw Error(i(363));g=il(g,v);var q=_v(g,E,P).disconnect;return{disconnect:function(){q()}}},Pr.shouldError=function(){return null},Pr.shouldSuspend=function(){return!1},Pr.startHostTransition=function(g,v,E,P){if(g.tag!==5)throw Error(i(476));var q=wd(g).queue;_d(g,q,v,Uh,E===null?r:function(){var te=wd(g);return te.next===null&&(te=g.alternate.memoizedState),No(g,te.next.queue,{},fs()),E(P)})},Pr.updateContainer=function(g,v,E,P){var q=v.current,te=fs();return bb(q,te,g,v,E,P),te},Pr.updateContainerSync=function(g,v,E,P){return bb(v.current,2,g,v,E,P),2},Pr},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})})(MF)),MF.exports}var CF;function d6e(){return CF||(CF=1,SF.exports=u6e()),SF.exports}var f6e=d6e();const h6e=c6e(f6e);function p6e(t){const e=h6e(t);return e.injectIntoDevTools(),e}const eQ=0,Hy={},m6e=/^three(?=[A-Z])/,kE=t=>`${t[0].toUpperCase()}${t.slice(1)}`;let g6e=0;const x6e=t=>typeof t=="function";function v6e(t){if(x6e(t)){const e=`${g6e++}`;return Hy[e]=t,e}else Object.assign(Hy,t)}function tQ(t,e){const n=kE(t),r=Hy[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 y6e(t,e,n){var r;return t=kE(t)in Hy?t:t.replace(m6e,""),tQ(t,e),t==="primitive"&&(r=e.object)!=null&&r.__r3f&&delete e.object.__r3f,pT(e.object,n,t,e)}function b6e(t){if(!t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?gT(t.parent,t):Ic(t.object)&&(t.object.visible=!1),t.isHidden=!0,fb(t)}}function nQ(t){if(t.isHidden){var e;t.props.attach&&(e=t.parent)!=null&&e.object?mT(t.parent,t):Ic(t.object)&&t.props.visible!==!1&&(t.object.visible=!0),t.isHidden=!1,fb(t)}}function SI(t,e,n){const r=e.root.getState();if(!(!t.parent&&t.object!==r.scene)){if(!e.object){var i,s;const o=Hy[kE(e.type)];e.object=(i=e.props.object)!=null?i:new o(...(s=e.props.args)!=null?s:[]),e.object.__r3f=e}if(Qm(e.object,e.props),e.props.attach)mT(t,e);else if(Ic(e.object)&&Ic(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)SI(e,o);fb(e)}}function NN(t,e){e&&(e.parent=t,t.children.push(e),SI(t,e))}function EF(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),SI(t,e,n)}function rQ(t){if(typeof t.dispose=="function"){const e=()=>{try{t.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():YR.unstable_scheduleCallback(YR.unstable_IdlePriority,e)}}function ZR(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?gT(t,e):Ic(e.object)&&Ic(t.object)&&(t.object.remove(e.object),t6e($Z(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];ZR(e,o,i)}e.children.length=0,delete e.object.__r3f,i&&e.type!=="primitive"&&e.object.type!=="Scene"&&rQ(e.object),n===void 0&&fb(e)}function _6e(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 T2=[];function w6e(){for(const[n]of T2){const r=n.parent;if(r){n.props.attach?gT(r,n):Ic(n.object)&&Ic(r.object)&&r.object.remove(n.object);for(const i of n.children)i.props.attach?gT(n,i):Ic(i.object)&&Ic(n.object)&&n.object.remove(i.object)}n.isHidden&&nQ(n),n.object.__r3f&&delete n.object.__r3f,n.type!=="primitive"&&rQ(n.object)}for(const[n,r,i]of T2){n.props=r;const s=n.parent;if(s){var t,e;const o=Hy[kE(n.type)];n.object=(t=n.props.object)!=null?t:new o(...(e=n.props.args)!=null?e:[]),n.object.__r3f=n,_6e(i,n.object),Qm(n.object,n.props),n.props.attach?mT(s,n):Ic(n.object)&&Ic(s.object)&&s.object.add(n.object);for(const a of n.children)a.props.attach?mT(n,a):Ic(a.object)&&Ic(n.object)&&n.object.add(a.object);fb(n)}}T2.length=0}const kN=()=>{},AF={};let JM=eQ;const S6e=0,M6e=4,QR=p6e({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:y6e,removeChild:ZR,appendChild:NN,appendInitialChild:NN,insertBefore:EF,appendChildToContainer(t,e){const n=t.getState().scene.__r3f;!e||!n||NN(n,e)},removeChildFromContainer(t,e){const n=t.getState().scene.__r3f;!e||!n||ZR(n,e)},insertInContainerBefore(t,e,n){const r=t.getState().scene.__r3f;!e||!n||!r||EF(r,e,n)},getRootHostContext:()=>AF,getChildHostContext:()=>AF,commitUpdate(t,e,n,r,i){var s,o,a;tQ(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((f,h)=>{var m;return f!==((m=n.args)==null?void 0:m[h])}))&&(l=!0),l)T2.push([t,{...r},i]);else{const f=ZAe(t,r);Object.keys(f).length&&(Object.assign(t.props,f),Qm(t.object,f))}(i.sibling===null||(i.flags&M6e)===S6e)&&w6e()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:t=>t==null?void 0:t.object,prepareForCommit:()=>null,preparePortalMount:t=>pT(t.getState().scene,t,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:b6e,unhideInstance:nQ,createTextInstance:kN,hideTextInstance:kN,unhideTextInstance:kN,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:w.createContext(null),setCurrentUpdatePriority(t){JM=t},getCurrentUpdatePriority(){return JM},resolveUpdatePriority(){var t;if(JM!==eQ)return JM;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 a6e;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return s6e;default:return o6e}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:l6e.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}),Hx=new Map,w1={objects:"shallow",strict:!1};function T6e(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 C6e(t){const e=Hx.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||r6e(t7,kF),o=n||QR.createContainer(s,i6e,null,!1,null,"",i,i,i,null);e||Hx.set(t,{fiber:o,store:s});let a,l,c=!1,f=null;return{async configure(h={}){let m;f=new Promise(j=>m=j);let{gl:x,size:b,scene:_,events:S,onCreated:M,shadows:T=!1,linear:A=!1,flat:N=!1,legacy:D=!1,orthographic:k=!1,frameloop:O="always",dpr:R=[1,2],performance:L,raycaster:B,camera:H,onPointerMissed:$}=h,G=s.getState(),Z=G.gl;if(!G.gl){const j={canvas:t,powerPreference:"high-performance",antialias:!0,alpha:!0},X=typeof x=="function"?await x(j):x;wF(X)?Z=X:Z=new HZ({...j,...x}),G.set({gl:Z})}let V=G.raycaster;V||G.set({raycaster:V=new PZ});const{params:W,...J}=B||{};if(oo.equ(J,V,w1)||Qm(V,{...J}),oo.equ(W,V.params,w1)||Qm(V,{params:{...V.params,...W}}),!G.camera||G.camera===l&&!oo.equ(l,H,w1)){l=H;const j=H==null?void 0:H.isCamera,X=j?H:k?new sf(0,0,0,0,.1,1e3):new lo(75,0,.1,1e3);j||(X.position.z=5,H&&(Qm(X,H),X.manual||("aspect"in H||"left"in H||"right"in H||"bottom"in H||"top"in H)&&(X.manual=!0,X.updateProjectionMatrix())),!G.camera&&!(H!=null&&H.rotation)&&X.lookAt(0,0,0)),G.set({camera:X}),V.camera=X}if(!G.scene){let j;_!=null&&_.isScene?(j=_,pT(j,s,"",{})):(j=new $P,pT(j,s,"",{}),_&&Qm(j,_)),G.set({scene:j})}S&&!G.events.handlers&&G.set({events:S(s)});const ne=T6e(t,b);if(oo.equ(ne,G.size,w1)||G.setSize(ne.width,ne.height,ne.top,ne.left),R&&G.viewport.dpr!==YZ(R)&&G.setDpr(R),G.frameloop!==O&&G.setFrameloop(O),G.onPointerMissed||G.set({onPointerMissed:$}),L&&!oo.equ(L,G.performance,w1)&&G.set(j=>({performance:{...j.performance,...L}})),!G.xr){var ie;const j=(ce,oe)=>{const Q=s.getState();Q.frameloop!=="never"&&kF(ce,!0,Q,oe)},X=()=>{const ce=s.getState();ce.gl.xr.enabled=ce.gl.xr.isPresenting,ce.gl.xr.setAnimationLoop(ce.gl.xr.isPresenting?j:null),ce.gl.xr.isPresenting||t7(ce)},F={connect(){const ce=s.getState().gl;ce.xr.addEventListener("sessionstart",X),ce.xr.addEventListener("sessionend",X)},disconnect(){const ce=s.getState().gl;ce.xr.removeEventListener("sessionstart",X),ce.xr.removeEventListener("sessionend",X)}};typeof((ie=Z.xr)==null?void 0:ie.addEventListener)=="function"&&F.connect(),G.set({xr:F})}if(Z.shadowMap){const j=Z.shadowMap.enabled,X=Z.shadowMap.type;if(Z.shadowMap.enabled=!!T,oo.boo(T))Z.shadowMap.type=mw;else if(oo.str(T)){var z;const F={basic:QY,percentage:q1,soft:mw,variance:cx};Z.shadowMap.type=(z=F[T])!=null?z:mw}else oo.obj(T)&&Object.assign(Z.shadowMap,T);(j!==Z.shadowMap.enabled||X!==Z.shadowMap.type)&&(Z.shadowMap.needsUpdate=!0)}return li.enabled=!D,c||(Z.outputColorSpace=A?R0:yl,Z.toneMapping=N?vu:VC),G.legacy!==D&&G.set(()=>({legacy:D})),G.linear!==A&&G.set(()=>({linear:A})),G.flat!==N&&G.set(()=>({flat:N})),x&&!oo.fun(x)&&!wF(x)&&!oo.equ(x,Z,w1)&&Qm(Z,x),a=M,c=!0,m(),this},render(h){return!c&&!f&&this.configure(),f.then(()=>{QR.updateContainer(d.jsx(E6e,{store:s,children:h,onCreated:a,rootElement:t}),o,null,()=>{})}),s},unmount(){iQ(t)}}}function E6e({store:t,children:e,onCreated:n,rootElement:r}){return a3(()=>{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)},[]),d.jsx(QZ.Provider,{value:t,children:e})}function iQ(t,e){const n=Hx.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),QR.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(),XAe(i.scene),Hx.delete(t)}catch{}},500)})}}const A6e=new Set,N6e=new Set,k6e=new Set;function RN(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function Cw(t,e){switch(t){case"before":return RN(A6e,e);case"after":return RN(N6e,e);case"tail":return RN(k6e,e)}}let PN,IN;function JR(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),PN=e.internal.subscribers;for(let i=0;i<PN.length;i++)IN=PN[i],IN.ref.current(IN.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 xT=!1,e7=!1,DN,NF,S1;function sQ(t){NF=requestAnimationFrame(sQ),xT=!0,DN=0,Cw("before",t),e7=!0;for(const n of Hx.values()){var e;S1=n.store.getState(),S1.internal.active&&(S1.frameloop==="always"||S1.internal.frames>0)&&!((e=S1.gl.xr)!=null&&e.isPresenting)&&(DN+=JR(t,S1))}if(e7=!1,Cw("after",t),DN===0)return Cw("tail",t),xT=!1,cancelAnimationFrame(NF)}function t7(t,e=1){var n;if(!t)return Hx.forEach(r=>t7(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):e7?t.internal.frames=2:t.internal.frames=1,xT||(xT=!0,requestAnimationFrame(sQ)))}function kF(t,e=!0,n,r){if(e&&Cw("before",t),n)JR(t,n,r);else for(const i of Hx.values())JR(t,i.store.getState());e&&Cw("after",t)}const ON={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 R6e(t){const{handlePointer:e}=n6e(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(ON).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]=ON[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]=ON[i];r.connected.removeEventListener(o,s)}n(i=>({events:{...i.events,connected:void 0}}))}}}}function RF(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function P6e({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]=w.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=w.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,f=w.useRef(!1);w.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[h,m,x]=w.useMemo(()=>{const M=()=>{if(!a.current.element)return;const{left:T,top:A,width:N,height:D,bottom:k,right:O,x:R,y:L}=a.current.element.getBoundingClientRect(),B={left:T,top:A,width:N,height:D,bottom:k,right:O,x:R,y:L};a.current.element instanceof HTMLElement&&r&&(B.height=a.current.element.offsetHeight,B.width=a.current.element.offsetWidth),Object.freeze(B),f.current&&!L6e(a.current.lastBounds,B)&&o(a.current.lastBounds=B)};return[M,c?RF(M,c):M,l?RF(M,l):M]},[o,r,l,c]);function b(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(M=>M.removeEventListener("scroll",x,!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(x),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(M=>M.addEventListener("scroll",x,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{x()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const S=M=>{!M||M===a.current.element||(b(),a.current.element=M,a.current.scrollContainers=oQ(M),_())};return D6e(x,!!e),I6e(m),w.useEffect(()=>{b(),_()},[e,x,m]),w.useEffect(()=>b,[]),[S,s,h]}function I6e(t){w.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function D6e(t,e){w.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function oQ(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,...oQ(t.parentElement)]}const O6e=["x","y","top","bottom","left","right","width","height"],L6e=(t,e)=>O6e.every(n=>t[n]===e[n]);function j6e({ref:t,children:e,fallback:n,resize:r,style:i,gl:s,events:o=R6e,eventSource:a,eventPrefix:l,shadows:c,linear:f,flat:h,legacy:m,orthographic:x,frameloop:b,dpr:_,performance:S,raycaster:M,camera:T,scene:A,onPointerMissed:N,onCreated:D,...k}){w.useMemo(()=>v6e(MAe),[]);const O=WAe(),[R,L]=P6e({scroll:!0,debounce:{scroll:50,resize:0},...r}),B=w.useRef(null),H=w.useRef(null);w.useImperativeHandle(t,()=>B.current);const $=XZ(N),[G,Z]=w.useState(!1),[V,W]=w.useState(!1);if(G)throw G;if(V)throw V;const J=w.useRef(null);a3(()=>{const ie=B.current;if(L.width>0&&L.height>0&&ie){J.current||(J.current=C6e(ie));async function z(){await J.current.configure({gl:s,scene:A,events:o,shadows:c,linear:f,flat:h,legacy:m,orthographic:x,frameloop:b,dpr:_,performance:S,raycaster:M,camera:T,size:L,onPointerMissed:(...j)=>$.current==null?void 0:$.current(...j),onCreated:j=>{j.events.connect==null||j.events.connect(a?GAe(a)?a.current:a:H.current),l&&j.setEvents({compute:(X,F)=>{const ce=X[l+"X"],oe=X[l+"Y"];F.pointer.set(ce/F.size.width*2-1,-(oe/F.size.height)*2+1),F.raycaster.setFromCamera(F.pointer,F.camera)}}),D==null||D(j)}}),J.current.render(d.jsx(O,{children:d.jsx(qAe,{set:W,children:d.jsx(w.Suspense,{fallback:d.jsx($Ae,{set:Z}),children:e??null})})}))}z()}}),w.useEffect(()=>{const ie=B.current;if(ie)return()=>iQ(ie)},[]);const ne=a?"none":"auto";return d.jsx("div",{ref:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:ne,...i},...k,children:d.jsx("div",{ref:R,style:{width:"100%",height:"100%"},children:d.jsx("canvas",{ref:B,style:{display:"block"},children:n})})})}function z6e(t){return d.jsx(VZ,{children:d.jsx(j6e,{...t})})}function yh(){return yh=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},yh.apply(null,arguments)}const l3=new Ge,MI=new Ge,F6e=new Ge,PF=new qt;function U6e(t,e,n){const r=l3.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 B6e(t,e){const n=l3.setFromMatrixPosition(t.matrixWorld),r=MI.setFromMatrixPosition(e.matrixWorld),i=n.sub(r),s=e.getWorldDirection(F6e);return i.angleTo(s)>Math.PI/2}function H6e(t,e,n,r){const i=l3.setFromMatrixPosition(t.matrixWorld),s=i.clone();s.project(e),PF.set(s.x,s.y),n.setFromCamera(PF,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 G6e(t,e){if(e instanceof sf)return e.zoom;if(e instanceof lo){const n=l3.setFromMatrixPosition(t.matrixWorld),r=MI.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 V6e(t,e,n){if(e instanceof lo||e instanceof sf){const r=l3.setFromMatrixPosition(t.matrixWorld),i=MI.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 n7=t=>Math.abs(t)<1e-10?0:t;function aQ(t,e,n=""){let r="matrix3d(";for(let i=0;i!==16;i++)r+=n7(e[i]*t.elements[i])+(i!==15?",":")");return n+r}const W6e=(t=>e=>aQ(e,t))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),$6e=(t=>(e,n)=>aQ(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 q6e(t){return t&&typeof t=="object"&&"current"in t}const TI=w.forwardRef(({children:t,eps:e=.001,style:n,className:r,prepend:i,center:s,fullscreen:o,portal:a,distanceFactor:l,sprite:c=!1,transform:f=!1,occlude:h,onOcclude:m,castShadow:x,receiveShadow:b,material:_,geometry:S,zIndexRange:M=[16777271,0],calculatePosition:T=U6e,as:A="div",wrapperClass:N,pointerEvents:D="auto",...k},O)=>{const{gl:R,camera:L,scene:B,size:H,raycaster:$,events:G,viewport:Z}=Dc(),[V]=w.useState(()=>document.createElement(A)),W=w.useRef(null),J=w.useRef(null),ne=w.useRef(0),ie=w.useRef([0,0]),z=w.useRef(null),j=w.useRef(null),X=(a==null?void 0:a.current)||G.connected||R.domElement.parentNode,F=w.useRef(null),ce=w.useRef(!1),oe=w.useMemo(()=>h&&h!=="blending"||Array.isArray(h)&&h.length&&q6e(h[0]),[h]);w.useLayoutEffect(()=>{const fe=R.domElement;h&&h==="blending"?(fe.style.zIndex=`${Math.floor(M[0]/2)}`,fe.style.position="absolute",fe.style.pointerEvents="none"):(fe.style.zIndex=null,fe.style.position=null,fe.style.pointerEvents=null)},[h]),w.useLayoutEffect(()=>{if(J.current){const fe=W.current=EU.createRoot(V);if(B.updateMatrixWorld(),f)V.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const he=T(J.current,L,H);V.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${he[0]}px,${he[1]}px,0);transform-origin:0 0;`}return X&&(i?X.prepend(V):X.appendChild(V)),()=>{X&&X.removeChild(V),fe.unmount()}}},[X,f]),w.useLayoutEffect(()=>{N&&(V.className=N)},[N]);const Q=w.useMemo(()=>f?{position:"absolute",top:0,left:0,width:H.width,height:H.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-H.height/2,left:-H.width/2,width:H.width,height:H.height},...n},[n,s,o,H,f]),se=w.useMemo(()=>({position:"absolute",pointerEvents:D}),[D]);w.useLayoutEffect(()=>{if(ce.current=!1,f){var fe;(fe=W.current)==null||fe.render(w.createElement("div",{ref:z,style:Q},w.createElement("div",{ref:j,style:se},w.createElement("div",{ref:O,className:r,style:n,children:t}))))}else{var he;(he=W.current)==null||he.render(w.createElement("div",{ref:O,style:Q,className:r,children:t}))}});const re=w.useRef(!0);NE(fe=>{if(J.current){L.updateMatrixWorld(),J.current.updateWorldMatrix(!0,!1);const he=f?ie.current:T(J.current,L,H);if(f||Math.abs(ne.current-L.zoom)>e||Math.abs(ie.current[0]-he[0])>e||Math.abs(ie.current[1]-he[1])>e){const ae=B6e(J.current,L);let Se=!1;oe&&(Array.isArray(h)?Se=h.map(Re=>Re.current):h!=="blending"&&(Se=[B]));const de=re.current;if(Se){const Re=H6e(J.current,L,$,Se);re.current=Re&&!ae}else re.current=!ae;de!==re.current&&(m?m(!re.current):V.style.display=re.current?"block":"none");const Me=Math.floor(M[0]/2),Ce=h?oe?[M[0],Me]:[Me-1,0]:M;if(V.style.zIndex=`${V6e(J.current,L,Ce)}`,f){const[Re,le]=[H.width/2,H.height/2],He=L.projectionMatrix.elements[5]*le,{isOrthographicCamera:Le,top:ze,left:Ve,bottom:ue,right:Y}=L,xe=W6e(L.matrixWorldInverse),we=Le?`scale(${He})translate(${n7(-(Y+Ve)/2)}px,${n7((ze+ue)/2)}px)`:`translateZ(${He}px)`;let Te=J.current.matrixWorld;c&&(Te=L.matrixWorldInverse.clone().transpose().copyPosition(Te).scale(J.current.scale),Te.elements[3]=Te.elements[7]=Te.elements[11]=0,Te.elements[15]=1),V.style.width=H.width+"px",V.style.height=H.height+"px",V.style.perspective=Le?"":`${He}px`,z.current&&j.current&&(z.current.style.transform=`${we}${xe}translate(${Re}px,${le}px)`,j.current.style.transform=$6e(Te,1/((l||10)/400)))}else{const Re=l===void 0?1:G6e(J.current,L)*l;V.style.transform=`translate3d(${he[0]}px,${he[1]}px,0) scale(${Re})`}ie.current=he,ne.current=L.zoom}}if(!oe&&F.current&&!ce.current)if(f){if(z.current){const he=z.current.children[0];if(he!=null&&he.clientWidth&&he!=null&&he.clientHeight){const{isOrthographicCamera:ae}=L;if(ae||S)k.scale&&(Array.isArray(k.scale)?k.scale instanceof Ge?F.current.scale.copy(k.scale.clone().divideScalar(1)):F.current.scale.set(1/k.scale[0],1/k.scale[1],1/k.scale[2]):F.current.scale.setScalar(1/k.scale));else{const Se=(l||10)/400,de=he.clientWidth*Se,Me=he.clientHeight*Se;F.current.scale.set(de,Me,1)}ce.current=!0}}}else{const he=V.children[0];if(he!=null&&he.clientWidth&&he!=null&&he.clientHeight){const ae=1/Z.factor,Se=he.clientWidth*ae,de=he.clientHeight*ae;F.current.scale.set(Se,de,1),ce.current=!0}F.current.lookAt(fe.camera.position)}});const K=w.useMemo(()=>({vertexShader:f?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);
        }
      `}),[f]);return w.createElement("group",yh({},k,{ref:J}),h&&!oe&&w.createElement("mesh",{castShadow:x,receiveShadow:b,ref:F},S||w.createElement("planeGeometry",null),_||w.createElement("shaderMaterial",{side:uu,vertexShader:K.vertexShader,fragmentShader:K.fragmentShader})))}),lQ=parseInt(QS.replace(/\D+/g,"")),cQ=lQ>=125?"uv1":"uv2";function X6e(t,e=Math.PI/3){const n=Math.cos(e),r=(1+1e-10)*100,i=[new Ge,new Ge,new Ge],s=new Ge,o=new Ge,a=new Ge,l=new Ge;function c(_){const S=~~(_.x*r),M=~~(_.y*r),T=~~(_.z*r);return`${S},${M},${T}`}const f=t.index?t.toNonIndexed():t,h=f.attributes.position,m={};for(let _=0,S=h.count/3;_<S;_++){const M=3*_,T=i[0].fromBufferAttribute(h,M+0),A=i[1].fromBufferAttribute(h,M+1),N=i[2].fromBufferAttribute(h,M+2);s.subVectors(N,A),o.subVectors(T,A);const D=new Ge().crossVectors(s,o).normalize();for(let k=0;k<3;k++){const O=i[k],R=c(O);R in m||(m[R]=[]),m[R].push(D)}}const x=new Float32Array(h.count*3),b=new Xi(x,3,!1);for(let _=0,S=h.count/3;_<S;_++){const M=3*_,T=i[0].fromBufferAttribute(h,M+0),A=i[1].fromBufferAttribute(h,M+1),N=i[2].fromBufferAttribute(h,M+2);s.subVectors(N,A),o.subVectors(T,A),a.crossVectors(s,o).normalize();for(let D=0;D<3;D++){const k=i[D],O=c(k),R=m[O];l.set(0,0,0);for(let L=0,B=R.length;L<B;L++){const H=R[L];a.dot(H)>n&&l.add(H)}l.normalize(),b.setXYZ(M+D,l.x,l.y,l.z)}}return f.setAttribute("normal",b),f}var Y6e=Object.defineProperty,K6e=(t,e,n)=>e in t?Y6e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Z6e=(t,e,n)=>(K6e(t,e+"",n),n);class Q6e{constructor(){Z6e(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 J6e=Object.defineProperty,eNe=(t,e,n)=>e in t?J6e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,or=(t,e,n)=>(eNe(t,typeof e!="symbol"?e+"":e,n),n);const e2=new Zx,IF=new fp,tNe=Math.cos(70*(Math.PI/180)),DF=(t,e)=>(t%e+e)%e;let nNe=class extends Q6e{constructor(e,n){super(),or(this,"object"),or(this,"domElement"),or(this,"enabled",!0),or(this,"target",new Ge),or(this,"minDistance",0),or(this,"maxDistance",1/0),or(this,"minZoom",0),or(this,"maxZoom",1/0),or(this,"minPolarAngle",0),or(this,"maxPolarAngle",Math.PI),or(this,"minAzimuthAngle",-1/0),or(this,"maxAzimuthAngle",1/0),or(this,"enableDamping",!1),or(this,"dampingFactor",.05),or(this,"enableZoom",!0),or(this,"zoomSpeed",1),or(this,"enableRotate",!0),or(this,"rotateSpeed",1),or(this,"enablePan",!0),or(this,"panSpeed",1),or(this,"screenSpacePanning",!0),or(this,"keyPanSpeed",7),or(this,"zoomToCursor",!1),or(this,"autoRotate",!1),or(this,"autoRotateSpeed",2),or(this,"reverseOrbit",!1),or(this,"reverseHorizontalOrbit",!1),or(this,"reverseVerticalOrbit",!1),or(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),or(this,"mouseButtons",{LEFT:rx.ROTATE,MIDDLE:rx.DOLLY,RIGHT:rx.PAN}),or(this,"touches",{ONE:ix.ROTATE,TWO:ix.DOLLY_PAN}),or(this,"target0"),or(this,"position0"),or(this,"zoom0"),or(this,"_domElementKeyEvents",null),or(this,"getPolarAngle"),or(this,"getAzimuthalAngle"),or(this,"setPolarAngle"),or(this,"setAzimuthalAngle"),or(this,"getDistance"),or(this,"getZoomScale"),or(this,"listenToKeyEvents"),or(this,"stopListenToKeyEvents"),or(this,"saveState"),or(this,"reset"),or(this,"update"),or(this,"connect"),or(this,"dispose"),or(this,"dollyIn"),or(this,"dollyOut"),or(this,"getScale"),or(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=()=>f.phi,this.getAzimuthalAngle=()=>f.theta,this.setPolarAngle=Pe=>{let Ke=DF(Pe,2*Math.PI),rt=f.phi;rt<0&&(rt+=2*Math.PI),Ke<0&&(Ke+=2*Math.PI);let ye=Math.abs(Ke-rt);2*Math.PI-ye<ye&&(Ke<rt?Ke+=2*Math.PI:rt+=2*Math.PI),h.phi=Ke-rt,r.update()},this.setAzimuthalAngle=Pe=>{let Ke=DF(Pe,2*Math.PI),rt=f.theta;rt<0&&(rt+=2*Math.PI),Ke<0&&(Ke+=2*Math.PI);let ye=Math.abs(Ke-rt);2*Math.PI-ye<ye&&(Ke<rt?Ke+=2*Math.PI:rt+=2*Math.PI),h.theta=Ke-rt,r.update()},this.getDistance=()=>r.object.position.distanceTo(r.target),this.listenToKeyEvents=Pe=>{Pe.addEventListener("keydown",ge),this._domElementKeyEvents=Pe},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ge),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 Pe=new Ge,Ke=new Ge(0,1,0),rt=new Za().setFromUnitVectors(e.up,Ke),ye=rt.clone().invert(),$e=new Ge,Ze=new Za,ft=2*Math.PI;return function(){const Je=r.object.position;rt.setFromUnitVectors(e.up,Ke),ye.copy(rt).invert(),Pe.copy(Je).sub(r.target),Pe.applyQuaternion(rt),f.setFromVector3(Pe),r.autoRotate&&l===a.NONE&&Z($()),r.enableDamping?(f.theta+=h.theta*r.dampingFactor,f.phi+=h.phi*r.dampingFactor):(f.theta+=h.theta,f.phi+=h.phi);let Ae=r.minAzimuthAngle,We=r.maxAzimuthAngle;isFinite(Ae)&&isFinite(We)&&(Ae<-Math.PI?Ae+=ft:Ae>Math.PI&&(Ae-=ft),We<-Math.PI?We+=ft:We>Math.PI&&(We-=ft),Ae<=We?f.theta=Math.max(Ae,Math.min(We,f.theta)):f.theta=f.theta>(Ae+We)/2?Math.max(Ae,f.theta):Math.min(We,f.theta)),f.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,f.phi)),f.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(x,r.dampingFactor):r.target.add(x),r.zoomToCursor&&L||r.object.isOrthographicCamera?f.radius=F(f.radius):f.radius=F(f.radius*m),Pe.setFromSpherical(f),Pe.applyQuaternion(ye),Je.copy(r.target).add(Pe),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(h.theta*=1-r.dampingFactor,h.phi*=1-r.dampingFactor,x.multiplyScalar(1-r.dampingFactor)):(h.set(0,0,0),x.set(0,0,0));let De=!1;if(r.zoomToCursor&&L){let Ne=null;if(r.object instanceof lo&&r.object.isPerspectiveCamera){const ot=Pe.length();Ne=F(ot*m);const dt=ot-Ne;r.object.position.addScaledVector(O,dt),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const ot=new Ge(R.x,R.y,0);ot.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix(),De=!0;const dt=new Ge(R.x,R.y,0);dt.unproject(r.object),r.object.position.sub(dt).add(ot),r.object.updateMatrixWorld(),Ne=Pe.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Ne!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Ne).add(r.object.position):(e2.origin.copy(r.object.position),e2.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(e2.direction))<tNe?e.lookAt(r.target):(IF.setFromNormalAndCoplanarPoint(r.object.up,r.target),e2.intersectPlane(IF,r.target))))}else r.object instanceof sf&&r.object.isOrthographicCamera&&(De=m!==1,De&&(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix()));return m=1,L=!1,De||$e.distanceToSquared(r.object.position)>c||8*(1-Ze.dot(r.object.quaternion))>c?(r.dispatchEvent(i),$e.copy(r.object.position),Ze.copy(r.object.quaternion),De=!1,!0):!1}})(),this.connect=Pe=>{r.domElement=Pe,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",ke),r.domElement.addEventListener("pointerdown",Ve),r.domElement.addEventListener("pointercancel",Y),r.domElement.addEventListener("wheel",Te)},this.dispose=()=>{var Pe,Ke,rt,ye,$e,Ze;r.domElement&&(r.domElement.style.touchAction="auto"),(Pe=r.domElement)==null||Pe.removeEventListener("contextmenu",ke),(Ke=r.domElement)==null||Ke.removeEventListener("pointerdown",Ve),(rt=r.domElement)==null||rt.removeEventListener("pointercancel",Y),(ye=r.domElement)==null||ye.removeEventListener("wheel",Te),($e=r.domElement)==null||$e.ownerDocument.removeEventListener("pointermove",ue),(Ze=r.domElement)==null||Ze.ownerDocument.removeEventListener("pointerup",Y),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ge)};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,f=new VR,h=new VR;let m=1;const x=new Ge,b=new qt,_=new qt,S=new qt,M=new qt,T=new qt,A=new qt,N=new qt,D=new qt,k=new qt,O=new Ge,R=new qt;let L=!1;const B=[],H={};function $(){return 2*Math.PI/60/60*r.autoRotateSpeed}function G(){return Math.pow(.95,r.zoomSpeed)}function Z(Pe){r.reverseOrbit||r.reverseHorizontalOrbit?h.theta+=Pe:h.theta-=Pe}function V(Pe){r.reverseOrbit||r.reverseVerticalOrbit?h.phi+=Pe:h.phi-=Pe}const W=(()=>{const Pe=new Ge;return function(rt,ye){Pe.setFromMatrixColumn(ye,0),Pe.multiplyScalar(-rt),x.add(Pe)}})(),J=(()=>{const Pe=new Ge;return function(rt,ye){r.screenSpacePanning===!0?Pe.setFromMatrixColumn(ye,1):(Pe.setFromMatrixColumn(ye,0),Pe.crossVectors(r.object.up,Pe)),Pe.multiplyScalar(rt),x.add(Pe)}})(),ne=(()=>{const Pe=new Ge;return function(rt,ye){const $e=r.domElement;if($e&&r.object instanceof lo&&r.object.isPerspectiveCamera){const Ze=r.object.position;Pe.copy(Ze).sub(r.target);let ft=Pe.length();ft*=Math.tan(r.object.fov/2*Math.PI/180),W(2*rt*ft/$e.clientHeight,r.object.matrix),J(2*ye*ft/$e.clientHeight,r.object.matrix)}else $e&&r.object instanceof sf&&r.object.isOrthographicCamera?(W(rt*(r.object.right-r.object.left)/r.object.zoom/$e.clientWidth,r.object.matrix),J(ye*(r.object.top-r.object.bottom)/r.object.zoom/$e.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function ie(Pe){r.object instanceof lo&&r.object.isPerspectiveCamera||r.object instanceof sf&&r.object.isOrthographicCamera?m=Pe:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function z(Pe){ie(m/Pe)}function j(Pe){ie(m*Pe)}function X(Pe){if(!r.zoomToCursor||!r.domElement)return;L=!0;const Ke=r.domElement.getBoundingClientRect(),rt=Pe.clientX-Ke.left,ye=Pe.clientY-Ke.top,$e=Ke.width,Ze=Ke.height;R.x=rt/$e*2-1,R.y=-(ye/Ze)*2+1,O.set(R.x,R.y,1).unproject(r.object).sub(r.object.position).normalize()}function F(Pe){return Math.max(r.minDistance,Math.min(r.maxDistance,Pe))}function ce(Pe){b.set(Pe.clientX,Pe.clientY)}function oe(Pe){X(Pe),N.set(Pe.clientX,Pe.clientY)}function Q(Pe){M.set(Pe.clientX,Pe.clientY)}function se(Pe){_.set(Pe.clientX,Pe.clientY),S.subVectors(_,b).multiplyScalar(r.rotateSpeed);const Ke=r.domElement;Ke&&(Z(2*Math.PI*S.x/Ke.clientHeight),V(2*Math.PI*S.y/Ke.clientHeight)),b.copy(_),r.update()}function re(Pe){D.set(Pe.clientX,Pe.clientY),k.subVectors(D,N),k.y>0?z(G()):k.y<0&&j(G()),N.copy(D),r.update()}function K(Pe){T.set(Pe.clientX,Pe.clientY),A.subVectors(T,M).multiplyScalar(r.panSpeed),ne(A.x,A.y),M.copy(T),r.update()}function fe(Pe){X(Pe),Pe.deltaY<0?j(G()):Pe.deltaY>0&&z(G()),r.update()}function he(Pe){let Ke=!1;switch(Pe.code){case r.keys.UP:ne(0,r.keyPanSpeed),Ke=!0;break;case r.keys.BOTTOM:ne(0,-r.keyPanSpeed),Ke=!0;break;case r.keys.LEFT:ne(r.keyPanSpeed,0),Ke=!0;break;case r.keys.RIGHT:ne(-r.keyPanSpeed,0),Ke=!0;break}Ke&&(Pe.preventDefault(),r.update())}function ae(){if(B.length==1)b.set(B[0].pageX,B[0].pageY);else{const Pe=.5*(B[0].pageX+B[1].pageX),Ke=.5*(B[0].pageY+B[1].pageY);b.set(Pe,Ke)}}function Se(){if(B.length==1)M.set(B[0].pageX,B[0].pageY);else{const Pe=.5*(B[0].pageX+B[1].pageX),Ke=.5*(B[0].pageY+B[1].pageY);M.set(Pe,Ke)}}function de(){const Pe=B[0].pageX-B[1].pageX,Ke=B[0].pageY-B[1].pageY,rt=Math.sqrt(Pe*Pe+Ke*Ke);N.set(0,rt)}function Me(){r.enableZoom&&de(),r.enablePan&&Se()}function Ce(){r.enableZoom&&de(),r.enableRotate&&ae()}function Re(Pe){if(B.length==1)_.set(Pe.pageX,Pe.pageY);else{const rt=st(Pe),ye=.5*(Pe.pageX+rt.x),$e=.5*(Pe.pageY+rt.y);_.set(ye,$e)}S.subVectors(_,b).multiplyScalar(r.rotateSpeed);const Ke=r.domElement;Ke&&(Z(2*Math.PI*S.x/Ke.clientHeight),V(2*Math.PI*S.y/Ke.clientHeight)),b.copy(_)}function le(Pe){if(B.length==1)T.set(Pe.pageX,Pe.pageY);else{const Ke=st(Pe),rt=.5*(Pe.pageX+Ke.x),ye=.5*(Pe.pageY+Ke.y);T.set(rt,ye)}A.subVectors(T,M).multiplyScalar(r.panSpeed),ne(A.x,A.y),M.copy(T)}function He(Pe){const Ke=st(Pe),rt=Pe.pageX-Ke.x,ye=Pe.pageY-Ke.y,$e=Math.sqrt(rt*rt+ye*ye);D.set(0,$e),k.set(0,Math.pow(D.y/N.y,r.zoomSpeed)),z(k.y),N.copy(D)}function Le(Pe){r.enableZoom&&He(Pe),r.enablePan&&le(Pe)}function ze(Pe){r.enableZoom&&He(Pe),r.enableRotate&&Re(Pe)}function Ve(Pe){var Ke,rt;r.enabled!==!1&&(B.length===0&&((Ke=r.domElement)==null||Ke.ownerDocument.addEventListener("pointermove",ue),(rt=r.domElement)==null||rt.ownerDocument.addEventListener("pointerup",Y)),qe(Pe),Pe.pointerType==="touch"?Ue(Pe):xe(Pe))}function ue(Pe){r.enabled!==!1&&(Pe.pointerType==="touch"?be(Pe):we(Pe))}function Y(Pe){var Ke,rt,ye;Qe(Pe),B.length===0&&((Ke=r.domElement)==null||Ke.releasePointerCapture(Pe.pointerId),(rt=r.domElement)==null||rt.ownerDocument.removeEventListener("pointermove",ue),(ye=r.domElement)==null||ye.ownerDocument.removeEventListener("pointerup",Y)),r.dispatchEvent(o),l=a.NONE}function xe(Pe){let Ke;switch(Pe.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 rx.DOLLY:if(r.enableZoom===!1)return;oe(Pe),l=a.DOLLY;break;case rx.ROTATE:if(Pe.ctrlKey||Pe.metaKey||Pe.shiftKey){if(r.enablePan===!1)return;Q(Pe),l=a.PAN}else{if(r.enableRotate===!1)return;ce(Pe),l=a.ROTATE}break;case rx.PAN:if(Pe.ctrlKey||Pe.metaKey||Pe.shiftKey){if(r.enableRotate===!1)return;ce(Pe),l=a.ROTATE}else{if(r.enablePan===!1)return;Q(Pe),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function we(Pe){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;se(Pe);break;case a.DOLLY:if(r.enableZoom===!1)return;re(Pe);break;case a.PAN:if(r.enablePan===!1)return;K(Pe);break}}function Te(Pe){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(Pe.preventDefault(),r.dispatchEvent(s),fe(Pe),r.dispatchEvent(o))}function ge(Pe){r.enabled===!1||r.enablePan===!1||he(Pe)}function Ue(Pe){switch(nt(Pe),B.length){case 1:switch(r.touches.ONE){case ix.ROTATE:if(r.enableRotate===!1)return;ae(),l=a.TOUCH_ROTATE;break;case ix.PAN:if(r.enablePan===!1)return;Se(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case ix.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Me(),l=a.TOUCH_DOLLY_PAN;break;case ix.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Ce(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function be(Pe){switch(nt(Pe),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Re(Pe),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;le(Pe),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Le(Pe),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;ze(Pe),r.update();break;default:l=a.NONE}}function ke(Pe){r.enabled!==!1&&Pe.preventDefault()}function qe(Pe){B.push(Pe)}function Qe(Pe){delete H[Pe.pointerId];for(let Ke=0;Ke<B.length;Ke++)if(B[Ke].pointerId==Pe.pointerId){B.splice(Ke,1);return}}function nt(Pe){let Ke=H[Pe.pointerId];Ke===void 0&&(Ke=new qt,H[Pe.pointerId]=Ke),Ke.set(Pe.pageX,Pe.pageY)}function st(Pe){const Ke=Pe.pointerId===B[0].pointerId?B[1]:B[0];return H[Ke.pointerId]}this.dollyIn=(Pe=G())=>{j(Pe),r.update()},this.dollyOut=(Pe=G())=>{z(Pe),r.update()},this.getScale=()=>m,this.setScale=Pe=>{ie(Pe),r.update()},this.getZoomScale=()=>G(),n!==void 0&&this.connect(n),this.update()}};const OF=new Fo,t2=new Ge;class CI 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 jn(e,3)),this.setAttribute("uv",new jn(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 hT(n,6,1);return this.setAttribute("instanceStart",new pu(r,3,0)),this.setAttribute("instanceEnd",new pu(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 hT(r,n*2,1);return this.setAttribute("instanceColorStart",new pu(i,n,0)),this.setAttribute("instanceColorEnd",new pu(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 oI(e.geometry)),this}fromLineSegments(e){const n=e.geometry;return this.setPositions(n.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Fo);const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;e!==void 0&&n!==void 0&&(this.boundingBox.setFromBufferAttribute(e),OF.setFromBufferAttribute(n),this.boundingBox.union(OF))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ea),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++)t2.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(t2)),t2.fromBufferAttribute(n,s),i=Math.max(i,r.distanceToSquared(t2));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 uQ extends CI{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 EI extends Mu{constructor(e){super({type:"LineMaterial",uniforms:sS.clone(sS.merge([An.common,An.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new qt(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 <${lQ>=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 LN=new pi,LF=new Ge,jF=new Ge,Wa=new pi,$a=new pi,Wf=new pi,jN=new Ge,zN=new pr,Xa=new DZ,zF=new Ge,n2=new Fo,r2=new ea,$f=new pi;let ih,Ex;function FF(t,e,n){return $f.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),$f.multiplyScalar(1/$f.w),$f.x=Ex/n.width,$f.y=Ex/n.height,$f.applyMatrix4(t.projectionMatrixInverse),$f.multiplyScalar(1/$f.w),Math.abs(Math.max($f.x,$f.y))}function rNe(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++){Xa.start.fromBufferAttribute(i,a),Xa.end.fromBufferAttribute(s,a),Xa.applyMatrix4(n);const c=new Ge,f=new Ge;ih.distanceSqToSegment(Xa.start,Xa.end,f,c),f.distanceTo(c)<Ex*.5&&e.push({point:f,pointOnLine:c,distance:ih.origin.distanceTo(f),object:t,face:null,faceIndex:a,uv:null,[cQ]:null})}}function iNe(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,f=Math.min(a.instanceCount,l.count),h=-e.near;ih.at(1,Wf),Wf.w=1,Wf.applyMatrix4(e.matrixWorldInverse),Wf.applyMatrix4(r),Wf.multiplyScalar(1/Wf.w),Wf.x*=s.x/2,Wf.y*=s.y/2,Wf.z=0,jN.copy(Wf),zN.multiplyMatrices(e.matrixWorldInverse,o);for(let m=0,x=f;m<x;m++){if(Wa.fromBufferAttribute(l,m),$a.fromBufferAttribute(c,m),Wa.w=1,$a.w=1,Wa.applyMatrix4(zN),$a.applyMatrix4(zN),Wa.z>h&&$a.z>h)continue;if(Wa.z>h){const A=Wa.z-$a.z,N=(Wa.z-h)/A;Wa.lerp($a,N)}else if($a.z>h){const A=$a.z-Wa.z,N=($a.z-h)/A;$a.lerp(Wa,N)}Wa.applyMatrix4(r),$a.applyMatrix4(r),Wa.multiplyScalar(1/Wa.w),$a.multiplyScalar(1/$a.w),Wa.x*=s.x/2,Wa.y*=s.y/2,$a.x*=s.x/2,$a.y*=s.y/2,Xa.start.copy(Wa),Xa.start.z=0,Xa.end.copy($a),Xa.end.z=0;const _=Xa.closestPointToPointParameter(jN,!0);Xa.at(_,zF);const S=OK.lerp(Wa.z,$a.z,_),M=S>=-1&&S<=1,T=jN.distanceTo(zF)<Ex*.5;if(M&&T){Xa.start.fromBufferAttribute(l,m),Xa.end.fromBufferAttribute(c,m),Xa.start.applyMatrix4(o),Xa.end.applyMatrix4(o);const A=new Ge,N=new Ge;ih.distanceSqToSegment(Xa.start,Xa.end,N,A),n.push({point:N,pointOnLine:A,distance:ih.origin.distanceTo(N),object:t,face:null,faceIndex:m,uv:null,[cQ]:null})}}}class dQ extends Xs{constructor(e=new CI,n=new EI({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)LF.fromBufferAttribute(n,o),jF.fromBufferAttribute(r,o),i[a]=a===0?0:i[a-1],i[a+1]=i[a]+LF.distanceTo(jF);const s=new hT(i,2,1);return e.setAttribute("instanceDistanceStart",new pu(s,1,0)),e.setAttribute("instanceDistanceEnd",new pu(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;ih=e.ray;const o=this.matrixWorld,a=this.geometry,l=this.material;Ex=l.linewidth+s,a.boundingSphere===null&&a.computeBoundingSphere(),r2.copy(a.boundingSphere).applyMatrix4(o);let c;if(r)c=Ex*.5;else{const h=Math.max(i.near,r2.distanceToPoint(ih.origin));c=FF(i,h,l.resolution)}if(r2.radius+=c,ih.intersectsSphere(r2)===!1)return;a.boundingBox===null&&a.computeBoundingBox(),n2.copy(a.boundingBox).applyMatrix4(o);let f;if(r)f=Ex*.5;else{const h=Math.max(i.near,n2.distanceToPoint(ih.origin));f=FF(i,h,l.resolution)}n2.expandByScalar(f),ih.intersectsBox(n2)!==!1&&(r?rNe(this,n):iNe(this,i,n))}onBeforeRender(e){const n=this.material.uniforms;n&&n.resolution&&(e.getViewport(LN),this.material.uniforms.resolution.value.set(LN.z,LN.w))}}class sNe extends dQ{constructor(e=new uQ,n=new EI({color:Math.random()*16777215})){super(e,n),this.isLine2=!0,this.type="Line2"}}const oNe=w.forwardRef(function({points:e,color:n=16777215,vertexColors:r,linewidth:i,lineWidth:s,segments:o,dashed:a,...l},c){var f,h;const m=Dc(M=>M.size),x=w.useMemo(()=>o?new dQ:new sNe,[o]),[b]=w.useState(()=>new EI),_=(r==null||(f=r[0])==null?void 0:f.length)===4?4:3,S=w.useMemo(()=>{const M=o?new CI:new uQ,T=e.map(A=>{const N=Array.isArray(A);return A instanceof Ge||A instanceof pi?[A.x,A.y,A.z]:A instanceof qt?[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(M.setPositions(T.flat()),r){n=16777215;const A=r.map(N=>N instanceof Rn?N.toArray():N);M.setColors(A.flat(),_)}return M},[e,o,r,_]);return w.useLayoutEffect(()=>{x.computeLineDistances()},[e,x]),w.useLayoutEffect(()=>{a?b.defines.USE_DASH="":delete b.defines.USE_DASH,b.needsUpdate=!0},[a,b]),w.useEffect(()=>()=>{S.dispose(),b.dispose()},[S]),w.createElement("primitive",yh({object:x,ref:c},l),w.createElement("primitive",{object:S,attach:"geometry"}),w.createElement("primitive",yh({object:b,attach:"material",color:n,vertexColors:!!r,resolution:[m.width,m.height],linewidth:(h=i??s)!==null&&h!==void 0?h:1,dashed:a,transparent:_===4},l)))});function aNe(){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 f=i.getTransferables;if(f===void 0&&(f=null),!t[o])try{l=l.map(function(m){return m&&m.isWorkerModule&&(e(m,function(x){if(x instanceof Error)throw x}),m=t[m.id].value),m}),c=r("<"+a+">.init",c),f&&(f=r("<"+a+">.getTransferables",f));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:f},s(h)}catch(m){m&&m.noLog||console.error(m),s(m)}}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(f,function(h){return s(h instanceof Error?h:new Error(""+h))}):f(c)}catch(h){s(h)}function f(h){try{var m=t[a].getTransferables&&t[a].getTransferables(h);(!m||!Array.isArray(m)||!m.length)&&(m=void 0),s(h,m)}catch(x){console.error(x),s(x)}}}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,f){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:c},f||void 0)})}catch(c){postMessage({messageId:o,success:!1,error:c.stack})}})}function lNe(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 fQ=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 fQ=function(){return t},t},cNe=0,uNe=0,FN=!1,Ew=Object.create(null),Aw=Object.create(null),r7=Object.create(null);function hb(t){if((!t||typeof t.init!="function")&&!FN)throw new Error("requires `options.init` function");var e=t.dependencies,n=t.init,r=t.getTransferables,i=t.workerId,s=lNe(t);i==null&&(i="#default");var o="workerModule"+ ++cNe,a=t.name||o,l=null;e=e&&e.map(function(f){return typeof f=="function"&&!f.workerModuleData&&(FN=!0,f=hb({workerId:i,name:"<"+a+"> function dependency: "+f.name,init:`function(){return (
`+C2(f)+`
)}`}),FN=!1),f&&f.workerModuleData&&(f=f.workerModuleData),f});function c(){for(var f=[],h=arguments.length;h--;)f[h]=arguments[h];if(!fQ())return s.apply(void 0,f);if(!l){l=UF(i,"registerModule",c.workerModuleData);var m=function(){l=null,Aw[i].delete(m)};(Aw[i]||(Aw[i]=new Set)).add(m)}return l.then(function(x){var b=x.isCallable;if(b)return UF(i,"callModule",{id:o,args:f});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:C2(n),getTransferables:r&&C2(r)},c.onMainThread=s,c}function dNe(t){Aw[t]&&Aw[t].forEach(function(e){e()}),Ew[t]&&(Ew[t].terminate(),delete Ew[t])}function C2(t){var e=t.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function fNe(t){var e=Ew[t];if(!e){var n=C2(aNe);e=Ew[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=r7[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete r7[s],o(i)}}return e}function UF(t,e,n){return new Promise(function(r,i){var s=++uNe;r7[s]=function(o){o.success?r(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},fNe(t).postMessage({messageId:s,action:e,data:n})})}function hQ(){var t=(function(e){function n(ie,z,j,X,F,ce,oe,Q){var se=1-oe;Q.x=se*se*ie+2*se*oe*j+oe*oe*F,Q.y=se*se*z+2*se*oe*X+oe*oe*ce}function r(ie,z,j,X,F,ce,oe,Q,se,re){var K=1-se;re.x=K*K*K*ie+3*K*K*se*j+3*K*se*se*F+se*se*se*oe,re.y=K*K*K*z+3*K*K*se*X+3*K*se*se*ce+se*se*se*Q}function i(ie,z){for(var j=/([MLQCZ])([^MLQCZ]*)/g,X,F,ce,oe,Q;X=j.exec(ie);){var se=X[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(re){return parseFloat(re)});switch(X[1]){case"M":oe=F=se[0],Q=ce=se[1];break;case"L":(se[0]!==oe||se[1]!==Q)&&z("L",oe,Q,oe=se[0],Q=se[1]);break;case"Q":{z("Q",oe,Q,oe=se[2],Q=se[3],se[0],se[1]);break}case"C":{z("C",oe,Q,oe=se[4],Q=se[5],se[0],se[1],se[2],se[3]);break}case"Z":(oe!==F||Q!==ce)&&z("L",oe,Q,F,ce);break}}}function s(ie,z,j){j===void 0&&(j=16);var X={x:0,y:0};i(ie,function(F,ce,oe,Q,se,re,K,fe,he){switch(F){case"L":z(ce,oe,Q,se);break;case"Q":{for(var ae=ce,Se=oe,de=1;de<j;de++)n(ce,oe,re,K,Q,se,de/(j-1),X),z(ae,Se,X.x,X.y),ae=X.x,Se=X.y;break}case"C":{for(var Me=ce,Ce=oe,Re=1;Re<j;Re++)r(ce,oe,re,K,fe,he,Q,se,Re/(j-1),X),z(Me,Ce,X.x,X.y),Me=X.x,Ce=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 f(ie,z){var j=ie.getContext?ie.getContext("webgl",c):ie,X=l.get(j);if(!X){let Me=function(ze){var Ve=ce[ze];if(!Ve&&(Ve=ce[ze]=j.getExtension(ze),!Ve))throw new Error(ze+" not supported");return Ve},Ce=function(ze,Ve){var ue=j.createShader(Ve);return j.shaderSource(ue,ze),j.compileShader(ue),ue},Re=function(ze,Ve,ue,Y){if(!oe[ze]){var xe={},we={},Te=j.createProgram();j.attachShader(Te,Ce(Ve,j.VERTEX_SHADER)),j.attachShader(Te,Ce(ue,j.FRAGMENT_SHADER)),j.linkProgram(Te),oe[ze]={program:Te,transaction:function(Ue){j.useProgram(Te),Ue({setUniform:function(ke,qe){for(var Qe=[],nt=arguments.length-2;nt-- >0;)Qe[nt]=arguments[nt+2];var st=we[qe]||(we[qe]=j.getUniformLocation(Te,qe));j["uniform"+ke].apply(j,[st].concat(Qe))},setAttribute:function(ke,qe,Qe,nt,st){var Pe=xe[ke];Pe||(Pe=xe[ke]={buf:j.createBuffer(),loc:j.getAttribLocation(Te,ke),data:null}),j.bindBuffer(j.ARRAY_BUFFER,Pe.buf),j.vertexAttribPointer(Pe.loc,qe,j.FLOAT,!1,0,0),j.enableVertexAttribArray(Pe.loc),F?j.vertexAttribDivisor(Pe.loc,nt):Me("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Pe.loc,nt),st!==Pe.data&&(j.bufferData(j.ARRAY_BUFFER,st,Qe),Pe.data=st)}})}}}oe[ze].transaction(Y)},le=function(ze,Ve){se++;try{j.activeTexture(j.TEXTURE0+se);var ue=Q[ze];ue||(ue=Q[ze]=j.createTexture(),j.bindTexture(j.TEXTURE_2D,ue),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MIN_FILTER,j.NEAREST),j.texParameteri(j.TEXTURE_2D,j.TEXTURE_MAG_FILTER,j.NEAREST)),j.bindTexture(j.TEXTURE_2D,ue),Ve(ue,se)}finally{se--}},He=function(ze,Ve,ue){var Y=j.createFramebuffer();re.push(Y),j.bindFramebuffer(j.FRAMEBUFFER,Y),j.activeTexture(j.TEXTURE0+Ve),j.bindTexture(j.TEXTURE_2D,ze),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,j.TEXTURE_2D,ze,0);try{ue(Y)}finally{j.deleteFramebuffer(Y),j.bindFramebuffer(j.FRAMEBUFFER,re[--re.length-1]||null)}},Le=function(){ce={},oe={},Q={},se=-1,re.length=0};var K=Me,fe=Ce,he=Re,ae=le,Se=He,de=Le,F=typeof WebGL2RenderingContext<"u"&&j instanceof WebGL2RenderingContext,ce={},oe={},Q={},se=-1,re=[];j.canvas.addEventListener("webglcontextlost",function(ze){Le(),ze.preventDefault()},!1),l.set(j,X={gl:j,isWebGL2:F,getExtension:Me,withProgram:Re,withTexture:le,withTextureFramebuffer:He,handleContextLoss:Le})}z(X)}function h(ie,z,j,X,F,ce,oe,Q){oe===void 0&&(oe=15),Q===void 0&&(Q=null),f(ie,function(se){var re=se.gl,K=se.withProgram,fe=se.withTexture;fe("copy",function(he,ae){re.texImage2D(re.TEXTURE_2D,0,re.RGBA,F,ce,0,re.RGBA,re.UNSIGNED_BYTE,z),K("copy",o,a,function(Se){var de=Se.setUniform,Me=Se.setAttribute;Me("aUV",2,re.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),de("1i","image",ae),re.bindFramebuffer(re.FRAMEBUFFER,Q||null),re.disable(re.BLEND),re.colorMask(oe&8,oe&4,oe&2,oe&1),re.viewport(j,X,F,ce),re.scissor(j,X,F,ce),re.drawArrays(re.TRIANGLES,0,3)})})})}function m(ie,z,j){var X=ie.width,F=ie.height;f(ie,function(ce){var oe=ce.gl,Q=new Uint8Array(X*F*4);oe.readPixels(0,0,X,F,oe.RGBA,oe.UNSIGNED_BYTE,Q),ie.width=z,ie.height=j,h(oe,Q,0,0,X,F)})}var x=Object.freeze({__proto__:null,withWebGLContext:f,renderImageData:h,resizeWebGLCanvasWithoutClearing:m});function b(ie,z,j,X,F,ce){ce===void 0&&(ce=1);var oe=new Uint8Array(ie*z),Q=X[2]-X[0],se=X[3]-X[1],re=[];s(j,function(Me,Ce,Re,le){re.push({x1:Me,y1:Ce,x2:Re,y2:le,minX:Math.min(Me,Re),minY:Math.min(Ce,le),maxX:Math.max(Me,Re),maxY:Math.max(Ce,le)})}),re.sort(function(Me,Ce){return Me.maxX-Ce.maxX});for(var K=0;K<ie;K++)for(var fe=0;fe<z;fe++){var he=Se(X[0]+Q*(K+.5)/ie,X[1]+se*(fe+.5)/z),ae=Math.pow(1-Math.abs(he)/F,ce)/2;he<0&&(ae=1-ae),ae=Math.max(0,Math.min(255,Math.round(ae*255))),oe[fe*ie+K]=ae}return oe;function Se(Me,Ce){for(var Re=1/0,le=1/0,He=re.length;He--;){var Le=re[He];if(Le.maxX+le<=Me)break;if(Me+le>Le.minX&&Ce-le<Le.maxY&&Ce+le>Le.minY){var ze=M(Me,Ce,Le.x1,Le.y1,Le.x2,Le.y2);ze<Re&&(Re=ze,le=Math.sqrt(Re))}}return de(Me,Ce)&&(le=-le),le}function de(Me,Ce){for(var Re=0,le=re.length;le--;){var He=re[le];if(He.maxX<=Me)break;var Le=He.y1>Ce!=He.y2>Ce&&Me<(He.x2-He.x1)*(Ce-He.y1)/(He.y2-He.y1)+He.x1;Le&&(Re+=He.y1<He.y2?1:-1)}return Re!==0}}function _(ie,z,j,X,F,ce,oe,Q,se,re){ce===void 0&&(ce=1),Q===void 0&&(Q=0),se===void 0&&(se=0),re===void 0&&(re=0),S(ie,z,j,X,F,ce,oe,null,Q,se,re)}function S(ie,z,j,X,F,ce,oe,Q,se,re,K){ce===void 0&&(ce=1),se===void 0&&(se=0),re===void 0&&(re=0),K===void 0&&(K=0);for(var fe=b(ie,z,j,X,F,ce),he=new Uint8Array(fe.length*4),ae=0;ae<fe.length;ae++)he[ae*4+K]=fe[ae];h(oe,he,se,re,ie,z,1<<3-K,Q)}function M(ie,z,j,X,F,ce){var oe=F-j,Q=ce-X,se=oe*oe+Q*Q,re=se?Math.max(0,Math.min(1,((ie-j)*oe+(z-X)*Q)/se)):0,K=ie-(j+re*oe),fe=z-(X+re*Q);return K*K+fe*fe}var T=Object.freeze({__proto__:null,generate:b,generateIntoCanvas:_,generateIntoFramebuffer:S}),A="precision highp float;uniform vec4 uGlyphBounds;attribute vec2 aUV;attribute vec4 aLineSegment;varying vec4 vLineSegment;varying vec2 vGlyphXY;void main(){vLineSegment=aLineSegment;vGlyphXY=mix(uGlyphBounds.xy,uGlyphBounds.zw,aUV);gl_Position=vec4(mix(vec2(-1.0),vec2(1.0),aUV),0.0,1.0);}",N="precision highp float;uniform vec4 uGlyphBounds;uniform float uMaxDistance;uniform float uExponent;varying vec4 vLineSegment;varying vec2 vGlyphXY;float absDistToSegment(vec2 point,vec2 lineA,vec2 lineB){vec2 lineDir=lineB-lineA;float lenSq=dot(lineDir,lineDir);float t=lenSq==0.0 ? 0.0 : clamp(dot(point-lineA,lineDir)/lenSq,0.0,1.0);vec2 linePt=lineA+t*lineDir;return distance(point,linePt);}void main(){vec4 seg=vLineSegment;vec2 p=vGlyphXY;float dist=absDistToSegment(p,seg.xy,seg.zw);float val=pow(1.0-clamp(dist/uMaxDistance,0.0,1.0),uExponent)*0.5;bool crossing=(seg.y>p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y<vLineSegment.w;gl_FragColor=vec4(crossingUp ? 1.0/255.0 : 0.0,crossing&&!crossingUp ? 1.0/255.0 : 0.0,0.0,val);}",D="precision highp float;uniform sampler2D tex;varying vec2 vUV;void main(){vec4 color=texture2D(tex,vUV);bool inside=color.r!=color.g;float val=inside ? 1.0-color.a : color.a;gl_FragColor=vec4(val);}",k=new Float32Array([0,0,2,0,0,2]),O=null,R=!1,L={},B=new WeakMap;function H(ie){if(!R&&!V(ie))throw new Error("WebGL generation not supported")}function $(ie,z,j,X,F,ce,oe){if(ce===void 0&&(ce=1),oe===void 0&&(oe=null),!oe&&(oe=O,!oe)){var Q=typeof OffscreenCanvas=="function"?new OffscreenCanvas(1,1):typeof document<"u"?document.createElement("canvas"):null;if(!Q)throw new Error("OffscreenCanvas or DOM canvas not supported");oe=O=Q.getContext("webgl",{depth:!1})}H(oe);var se=new Uint8Array(ie*z*4);f(oe,function(he){var ae=he.gl,Se=he.withTexture,de=he.withTextureFramebuffer;Se("readable",function(Me,Ce){ae.texImage2D(ae.TEXTURE_2D,0,ae.RGBA,ie,z,0,ae.RGBA,ae.UNSIGNED_BYTE,null),de(Me,Ce,function(Re){Z(ie,z,j,X,F,ce,ae,Re,0,0,0),ae.readPixels(0,0,ie,z,ae.RGBA,ae.UNSIGNED_BYTE,se)})})});for(var re=new Uint8Array(ie*z),K=0,fe=0;K<se.length;K+=4)re[fe++]=se[K];return re}function G(ie,z,j,X,F,ce,oe,Q,se,re){ce===void 0&&(ce=1),Q===void 0&&(Q=0),se===void 0&&(se=0),re===void 0&&(re=0),Z(ie,z,j,X,F,ce,oe,null,Q,se,re)}function Z(ie,z,j,X,F,ce,oe,Q,se,re,K){ce===void 0&&(ce=1),se===void 0&&(se=0),re===void 0&&(re=0),K===void 0&&(K=0),H(oe);var fe=[];s(j,function(he,ae,Se,de){fe.push(he,ae,Se,de)}),fe=new Float32Array(fe),f(oe,function(he){var ae=he.gl,Se=he.isWebGL2,de=he.getExtension,Me=he.withProgram,Ce=he.withTexture,Re=he.withTextureFramebuffer,le=he.handleContextLoss;if(Ce("rawDistances",function(He,Le){(ie!==He._lastWidth||z!==He._lastHeight)&&ae.texImage2D(ae.TEXTURE_2D,0,ae.RGBA,He._lastWidth=ie,He._lastHeight=z,0,ae.RGBA,ae.UNSIGNED_BYTE,null),Me("main",A,N,function(ze){var Ve=ze.setAttribute,ue=ze.setUniform,Y=!Se&&de("ANGLE_instanced_arrays"),xe=!Se&&de("EXT_blend_minmax");Ve("aUV",2,ae.STATIC_DRAW,0,k),Ve("aLineSegment",4,ae.DYNAMIC_DRAW,1,fe),ue.apply(void 0,["4f","uGlyphBounds"].concat(X)),ue("1f","uMaxDistance",F),ue("1f","uExponent",ce),Re(He,Le,function(we){ae.enable(ae.BLEND),ae.colorMask(!0,!0,!0,!0),ae.viewport(0,0,ie,z),ae.scissor(0,0,ie,z),ae.blendFunc(ae.ONE,ae.ONE),ae.blendEquationSeparate(ae.FUNC_ADD,Se?ae.MAX:xe.MAX_EXT),ae.clear(ae.COLOR_BUFFER_BIT),Se?ae.drawArraysInstanced(ae.TRIANGLES,0,3,fe.length/4):Y.drawArraysInstancedANGLE(ae.TRIANGLES,0,3,fe.length/4)})}),Me("post",o,D,function(ze){ze.setAttribute("aUV",2,ae.STATIC_DRAW,0,k),ze.setUniform("1i","tex",Le),ae.bindFramebuffer(ae.FRAMEBUFFER,Q),ae.disable(ae.BLEND),ae.colorMask(K===0,K===1,K===2,K===3),ae.viewport(se,re,ie,z),ae.scissor(se,re,ie,z),ae.drawArrays(ae.TRIANGLES,0,3)})}),ae.isContextLost())throw le(),new Error("webgl context lost")})}function V(ie){var z=!ie||ie===O?L:ie.canvas||ie,j=B.get(z);if(j===void 0){R=!0;var X=null;try{var F=[97,106,97,61,99,137,118,80,80,118,137,99,61,97,106,97],ce=$(4,4,"M8,8L16,8L24,24L16,24Z",[0,0,32,32],24,1,ie);j=ce&&F.length===ce.length&&ce.every(function(oe,Q){return oe===F[Q]}),j||(X="bad trial run results",console.info(F,ce))}catch(oe){j=!1,X=oe.message}X&&console.warn("WebGL SDF generation not supported:",X),R=!1,B.set(z,j)}return j}var W=Object.freeze({__proto__:null,generate:$,generateIntoCanvas:G,generateIntoFramebuffer:Z,isSupported:V});function J(ie,z,j,X,F,ce){F===void 0&&(F=Math.max(X[2]-X[0],X[3]-X[1])/2),ce===void 0&&(ce=1);try{return $.apply(W,arguments)}catch(oe){return console.info("WebGL SDF generation failed, falling back to JS",oe),b.apply(T,arguments)}}function ne(ie,z,j,X,F,ce,oe,Q,se,re){F===void 0&&(F=Math.max(X[2]-X[0],X[3]-X[1])/2),ce===void 0&&(ce=1),Q===void 0&&(Q=0),se===void 0&&(se=0),re===void 0&&(re=0);try{return G.apply(W,arguments)}catch(K){return console.info("WebGL SDF generation failed, falling back to JS",K),_.apply(T,arguments)}}return e.forEachPathCommand=i,e.generate=J,e.generateIntoCanvas=ne,e.javascript=T,e.pathToLineSegments=s,e.webgl=W,e.webglUtils=x,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}function hNe(){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(le,He){r[le]=1<<He+1,i[r[le]]=le}),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,f=null;function h(){if(!f){f=new Map;var le=function(Le){if(n.hasOwnProperty(Le)){var ze=0;n[Le].split(",").forEach(function(Ve){var ue=Ve.split("+"),Y=ue[0],xe=ue[1];Y=parseInt(Y,36),xe=xe?parseInt(xe,36):0,f.set(ze+=Y,r[Le]);for(var we=0;we<xe;we++)f.set(++ze,r[Le])})}};for(var He in n)le(He)}}function m(le){return h(),f.get(le.codePointAt(0))||r.L}function x(le){return i[m(le)]}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 _(le,He){var Le=36,ze=0,Ve=new Map,ue=He&&new Map,Y;return le.split(",").forEach(function xe(we){if(we.indexOf("+")!==-1)for(var Te=+we;Te--;)xe(Y);else{Y=we;var ge=we.split(">"),Ue=ge[0],be=ge[1];Ue=String.fromCodePoint(ze+=parseInt(Ue,Le)),be=String.fromCodePoint(ze+=parseInt(be,Le)),Ve.set(Ue,be),He&&ue.set(be,Ue)}}),{map:Ve,reverseMap:ue}}var S,M,T;function A(){if(!S){var le=_(b.pairs,!0),He=le.map,Le=le.reverseMap;S=He,M=Le,T=_(b.canonical,!1).map}}function N(le){return A(),S.get(le)||null}function D(le){return A(),M.get(le)||null}function k(le){return A(),T.get(le)||null}var O=r.L,R=r.R,L=r.EN,B=r.ES,H=r.ET,$=r.AN,G=r.CS,Z=r.B,V=r.S,W=r.ON,J=r.BN,ne=r.NSM,ie=r.AL,z=r.LRO,j=r.RLO,X=r.LRE,F=r.RLE,ce=r.PDF,oe=r.LRI,Q=r.RLI,se=r.FSI,re=r.PDI;function K(le,He){for(var Le=125,ze=new Uint32Array(le.length),Ve=0;Ve<le.length;Ve++)ze[Ve]=m(le[Ve]);var ue=new Map;function Y(Yi,Ks){var Ms=ze[Yi];ze[Yi]=Ks,ue.set(Ms,ue.get(Ms)-1),Ms&a&&ue.set(a,ue.get(a)-1),ue.set(Ks,(ue.get(Ks)||0)+1),Ks&a&&ue.set(a,(ue.get(a)||0)+1)}for(var xe=new Uint8Array(le.length),we=new Map,Te=[],ge=null,Ue=0;Ue<le.length;Ue++)ge||Te.push(ge={start:Ue,end:le.length-1,level:He==="rtl"?1:He==="ltr"?0:hf(Ue,!1)}),ze[Ue]&Z&&(ge.end=Ue,ge=null);for(var be=F|X|j|z|s|re|ce|Z,ke=function(Yi){return Yi+(Yi&1?1:2)},qe=function(Yi){return Yi+(Yi&1?2:1)},Qe=0;Qe<Te.length;Qe++){ge=Te[Qe];var nt=[{_level:ge.level,_override:0,_isolate:0}],st=void 0,Pe=0,Ke=0,rt=0;ue.clear();for(var ye=ge.start;ye<=ge.end;ye++){var $e=ze[ye];if(st=nt[nt.length-1],ue.set($e,(ue.get($e)||0)+1),$e&a&&ue.set(a,(ue.get(a)||0)+1),$e&be)if($e&(F|X)){xe[ye]=st._level;var Ze=($e===F?qe:ke)(st._level);Ze<=Le&&!Pe&&!Ke?nt.push({_level:Ze,_override:0,_isolate:0}):Pe||Ke++}else if($e&(j|z)){xe[ye]=st._level;var ft=($e===j?qe:ke)(st._level);ft<=Le&&!Pe&&!Ke?nt.push({_level:ft,_override:$e&j?R:O,_isolate:0}):Pe||Ke++}else if($e&s){$e&se&&($e=hf(ye+1,!0)===1?Q:oe),xe[ye]=st._level,st._override&&Y(ye,st._override);var lt=($e===Q?qe:ke)(st._level);lt<=Le&&Pe===0&&Ke===0?(rt++,nt.push({_level:lt,_override:0,_isolate:1,_isolInitIndex:ye})):Pe++}else if($e&re){if(Pe>0)Pe--;else if(rt>0){for(Ke=0;!nt[nt.length-1]._isolate;)nt.pop();var Je=nt[nt.length-1]._isolInitIndex;Je!=null&&(we.set(Je,ye),we.set(ye,Je)),nt.pop(),rt--}st=nt[nt.length-1],xe[ye]=st._level,st._override&&Y(ye,st._override)}else $e&ce?(Pe===0&&(Ke>0?Ke--:!st._isolate&&nt.length>1&&(nt.pop(),st=nt[nt.length-1])),xe[ye]=st._level):$e&Z&&(xe[ye]=ge.level);else xe[ye]=st._level,st._override&&$e!==J&&Y(ye,st._override)}for(var Ae=[],We=null,De=ge.start;De<=ge.end;De++){var Ne=ze[De];if(!(Ne&l)){var ot=xe[De],dt=Ne&s,Pt=Ne===re;We&&ot===We._level?(We._end=De,We._endsWithIsolInit=dt):Ae.push(We={_start:De,_end:De,_level:ot,_startsWithPDI:Pt,_endsWithIsolInit:dt})}}for(var kt=[],wt=0;wt<Ae.length;wt++){var Vt=Ae[wt];if(!Vt._startsWithPDI||Vt._startsWithPDI&&!we.has(Vt._start)){for(var rn=[We=Vt],Bt=void 0;We&&We._endsWithIsolInit&&(Bt=we.get(We._end))!=null;)for(var Gt=wt+1;Gt<Ae.length;Gt++)if(Ae[Gt]._start===Bt){rn.push(We=Ae[Gt]);break}for(var Dt=[],Qt=0;Qt<rn.length;Qt++)for(var hn=rn[Qt],It=hn._start;It<=hn._end;It++)Dt.push(It);for(var Lt=xe[Dt[0]],zt=ge.level,pn=Dt[0]-1;pn>=0;pn--)if(!(ze[pn]&l)){zt=xe[pn];break}var Ot=Dt[Dt.length-1],Ct=xe[Ot],tn=ge.level;if(!(ze[Ot]&s)){for(var en=Ot+1;en<=ge.end;en++)if(!(ze[en]&l)){tn=xe[en];break}}kt.push({_seqIndices:Dt,_sosType:Math.max(zt,Lt)%2?R:O,_eosType:Math.max(tn,Ct)%2?R:O})}}for(var bn=0;bn<kt.length;bn++){var On=kt[bn],_e=On._seqIndices,tt=On._sosType,gt=On._eosType,pt=xe[_e[0]]&1?R:O;if(ue.get(ne))for(var xt=0;xt<_e.length;xt++){var $t=_e[xt];if(ze[$t]&ne){for(var sn=tt,Zt=xt-1;Zt>=0;Zt--)if(!(ze[_e[Zt]]&l)){sn=ze[_e[Zt]];break}Y($t,sn&(s|re)?W:sn)}}if(ue.get(L))for(var Fe=0;Fe<_e.length;Fe++){var bt=_e[Fe];if(ze[bt]&L)for(var Tt=Fe-1;Tt>=-1;Tt--){var Yt=Tt===-1?tt:ze[_e[Tt]];if(Yt&o){Yt===ie&&Y(bt,$);break}}}if(ue.get(ie))for(var Ht=0;Ht<_e.length;Ht++){var Cn=_e[Ht];ze[Cn]&ie&&Y(Cn,R)}if(ue.get(B)||ue.get(G))for(var zn=1;zn<_e.length-1;zn++){var Zn=_e[zn];if(ze[Zn]&(B|G)){for(var Xn=0,ir=0,dn=zn-1;dn>=0&&(Xn=ze[_e[dn]],!!(Xn&l));dn--);for(var Wi=zn+1;Wi<_e.length&&(ir=ze[_e[Wi]],!!(ir&l));Wi++);Xn===ir&&(ze[Zn]===B?Xn===L:Xn&(L|$))&&Y(Zn,Xn)}}if(ue.get(L))for(var vn=0;vn<_e.length;vn++){var ts=_e[vn];if(ze[ts]&L){for(var Ds=vn-1;Ds>=0&&ze[_e[Ds]]&(H|l);Ds--)Y(_e[Ds],L);for(vn++;vn<_e.length&&ze[_e[vn]]&(H|l|L);vn++)ze[_e[vn]]!==L&&Y(_e[vn],L)}}if(ue.get(H)||ue.get(B)||ue.get(G))for(var Li=0;Li<_e.length;Li++){var ws=_e[Li];if(ze[ws]&(H|B|G)){Y(ws,W);for(var wr=Li-1;wr>=0&&ze[_e[wr]]&l;wr--)Y(_e[wr],W);for(var mi=Li+1;mi<_e.length&&ze[_e[mi]]&l;mi++)Y(_e[mi],W)}}if(ue.get(L))for(var Os=0,ji=tt;Os<_e.length;Os++){var na=_e[Os],ba=ze[na];ba&L?ji===O&&Y(na,O):ba&o&&(ji=ba)}if(ue.get(a)){var Pa=R|L|$,ic=Pa|O,El=[];{for(var _a=[],Ls=0;Ls<_e.length;Ls++)if(ze[_e[Ls]]&a){var sc=le[_e[Ls]],el=void 0;if(N(sc)!==null)if(_a.length<63)_a.push({char:sc,seqIndex:Ls});else break;else if((el=D(sc))!==null)for(var Ia=_a.length-1;Ia>=0;Ia--){var Da=_a[Ia].char;if(Da===el||Da===D(k(sc))||N(k(Da))===sc){El.push([_a[Ia].seqIndex,Ls]),_a.length=Ia;break}}}El.sort(function(Yi,Ks){return Yi[0]-Ks[0]})}for(var Xc=0;Xc<El.length;Xc++){for(var Yc=El[Xc],oc=Yc[0],ra=Yc[1],ho=!1,Uo=0,Al=oc+1;Al<ra;Al++){var Ss=_e[Al];if(ze[Ss]&ic){ho=!0;var tl=ze[Ss]&Pa?R:O;if(tl===pt){Uo=tl;break}}}if(ho&&!Uo){Uo=tt;for(var nl=oc-1;nl>=0;nl--){var Kc=_e[nl];if(ze[Kc]&ic){var ii=ze[Kc]&Pa?R:O;ii!==pt?Uo=ii:Uo=pt;break}}}if(Uo){if(ze[_e[oc]]=ze[_e[ra]]=Uo,Uo!==pt){for(var Wr=oc+1;Wr<_e.length;Wr++)if(!(ze[_e[Wr]]&l)){m(le[_e[Wr]])&ne&&(ze[_e[Wr]]=Uo);break}}if(Uo!==pt){for(var ia=ra+1;ia<_e.length;ia++)if(!(ze[_e[ia]]&l)){m(le[_e[ia]])&ne&&(ze[_e[ia]]=Uo);break}}}}for(var Sr=0;Sr<_e.length;Sr++)if(ze[_e[Sr]]&a){for(var Si=Sr,zi=Sr,Kr=tt,Oa=Sr-1;Oa>=0;Oa--)if(ze[_e[Oa]]&l)Si=Oa;else{Kr=ze[_e[Oa]]&Pa?R:O;break}for(var Nl=gt,ac=Sr+1;ac<_e.length;ac++)if(ze[_e[ac]]&(a|l))zi=ac;else{Nl=ze[_e[ac]]&Pa?R:O;break}for(var Ao=Si;Ao<=zi;Ao++)ze[_e[Ao]]=Kr===Nl?Kr:pt;Sr=zi}}}for(var xi=ge.start;xi<=ge.end;xi++){var Nh=xe[xi],_d=ze[xi];if(Nh&1?_d&(O|L|$)&&xe[xi]++:_d&R?xe[xi]++:_d&($|L)&&(xe[xi]+=2),_d&l&&(xe[xi]=xi===0?ge.level:xe[xi-1]),xi===ge.end||m(le[xi])&(V|Z))for(var wd=xi;wd>=0&&m(le[wd])&c;wd--)xe[wd]=ge.level}}return{levels:xe,paragraphs:Te};function hf(Yi,Ks){for(var Ms=Yi;Ms<le.length;Ms++){var kl=ze[Ms];if(kl&(R|ie))return 1;if(kl&(Z|O)||Ks&&kl===re)return 0;if(kl&s){var No=wa(Ms);Ms=No===-1?le.length:No}}return 0}function wa(Yi){for(var Ks=1,Ms=Yi+1;Ms<le.length;Ms++){var kl=ze[Ms];if(kl&Z)break;if(kl&re){if(--Ks===0)return Ms}else kl&s&&Ks++}return-1}}var fe="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",he;function ae(){if(!he){var le=_(fe,!0),He=le.map,Le=le.reverseMap;Le.forEach(function(ze,Ve){He.set(Ve,ze)}),he=He}}function Se(le){return ae(),he.get(le)||null}function de(le,He,Le,ze){var Ve=le.length;Le=Math.max(0,Le==null?0:+Le),ze=Math.min(Ve-1,ze==null?Ve-1:+ze);for(var ue=new Map,Y=Le;Y<=ze;Y++)if(He[Y]&1){var xe=Se(le[Y]);xe!==null&&ue.set(Y,xe)}return ue}function Me(le,He,Le,ze){var Ve=le.length;Le=Math.max(0,Le==null?0:+Le),ze=Math.min(Ve-1,ze==null?Ve-1:+ze);var ue=[];return He.paragraphs.forEach(function(Y){var xe=Math.max(Le,Y.start),we=Math.min(ze,Y.end);if(xe<we){for(var Te=He.levels.slice(xe,we+1),ge=we;ge>=xe&&m(le[ge])&c;ge--)Te[ge]=Y.level;for(var Ue=Y.level,be=1/0,ke=0;ke<Te.length;ke++){var qe=Te[ke];qe>Ue&&(Ue=qe),qe<be&&(be=qe|1)}for(var Qe=Ue;Qe>=be;Qe--)for(var nt=0;nt<Te.length;nt++)if(Te[nt]>=Qe){for(var st=nt;nt+1<Te.length&&Te[nt+1]>=Qe;)nt++;nt>st&&ue.push([st+xe,nt+xe])}}}),ue}function Ce(le,He,Le,ze){var Ve=Re(le,He,Le,ze),ue=[].concat(le);return Ve.forEach(function(Y,xe){ue[xe]=(He.levels[Y]&1?Se(le[Y]):null)||le[Y]}),ue.join("")}function Re(le,He,Le,ze){for(var Ve=Me(le,He,Le,ze),ue=[],Y=0;Y<le.length;Y++)ue[Y]=Y;return Ve.forEach(function(xe){for(var we=xe[0],Te=xe[1],ge=ue.slice(we,Te+1),Ue=ge.length;Ue--;)ue[Te-Ue]=ge[Ue]}),ue}return e.closingToOpeningBracket=D,e.getBidiCharType=m,e.getBidiCharTypeName=x,e.getCanonicalBracket=k,e.getEmbeddingLevels=K,e.getMirroredCharacter=Se,e.getMirroredCharactersMap=de,e.getReorderSegments=Me,e.getReorderedIndices=Re,e.getReorderedString=Ce,e.openingToClosingBracket=N,Object.defineProperty(e,"__esModule",{value:!0}),e})({});return t}const pQ=/\bvoid\s+main\s*\(\s*\)\s*{/g;function i7(t){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function n(r,i){let s=Or[i];return s?i7(s):r}return t.replace(e,n)}const qa=[];for(let t=0;t<256;t++)qa[t]=(t<16?"0":"")+t.toString(16);function pNe(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(qa[t&255]+qa[t>>8&255]+qa[t>>16&255]+qa[t>>24&255]+"-"+qa[e&255]+qa[e>>8&255]+"-"+qa[e>>16&15|64]+qa[e>>24&255]+"-"+qa[n&63|128]+qa[n>>8&255]+"-"+qa[n>>16&255]+qa[n>>24&255]+qa[r&255]+qa[r>>8&255]+qa[r>>16&255]+qa[r>>24&255]).toUpperCase()}const ex=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},mNe=Date.now(),BF=new WeakMap,HF=new Map;let gNe=1e10;function s7(t,e){const n=bNe(e);let r=BF.get(t);if(r||BF.set(t,r=Object.create(null)),r[n])return new r[n];const i=`_onBeforeCompile${n}`,s=function(c,f){t.onBeforeCompile.call(this,c,f);const h=this.customProgramCacheKey()+"|"+c.vertexShader+"|"+c.fragmentShader;let m=HF[h];if(!m){const x=xNe(this,c,e,n);m=HF[h]=x}c.vertexShader=m.vertexShader,c.fragmentShader=m.fragmentShader,ex(c.uniforms,this.uniforms),e.timeUniform&&(c.uniforms[e.timeUniform]={get value(){return Date.now()-mNe}}),this[i]&&this[i](c)},o=function(){return a(e.chained?t:t.clone())},a=function(c){const f=Object.create(c,l);return Object.defineProperty(f,"baseMaterial",{value:t}),Object.defineProperty(f,"id",{value:gNe++}),f.uuid=pNe(),f.uniforms=ex({},c.uniforms,e.uniforms),f.defines=ex({},c.defines,e.defines),f.defines[`TROIKA_DERIVED_MATERIAL_${n}`]="",f.extensions=ex({},c.extensions,e.extensions),f._listeners=void 0,f},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 f=this.baseMaterial;return c===f||f.isDerivedMaterial&&f.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&&(ex(this.extensions,c.extensions),ex(this.defines,c.defines),ex(this.uniforms,sS.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=s7(t.isDerivedMaterial?t.getDepthMaterial():new wE({depthPacking:MK}),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=s7(t.isDerivedMaterial?t.getDistanceMaterial():new SE,e),c.defines.IS_DISTANCE_MATERIAL="",c.uniforms=this.uniforms),c}},dispose:{writable:!0,configurable:!0,value(){const{_depthMaterial:c,_distanceMaterial:f}=this;c&&c.dispose(),f&&f.dispose(),t.dispose.call(this)}}};return r[n]=o,new o}function xNe(t,{vertexShader:e,fragmentShader:n},r,i){let{vertexDefs:s,vertexMainIntro:o,vertexMainOutro:a,vertexTransform:l,fragmentDefs:c,fragmentMainIntro:f,fragmentMainOutro:h,fragmentColorTransform:m,customRewriter:x,timeUniform:b}=r;if(s=s||"",o=o||"",a=a||"",c=c||"",f=f||"",h=h||"",(l||x)&&(e=i7(e)),(m||x)&&(n=n.replace(/^[ \t]*#include <((?:tonemapping|encodings|colorspace|fog|premultiplied_alpha|dithering)_fragment)>/gm,`
//!BEGIN_POST_CHUNK $1
$&
//!END_POST_CHUNK
`),n=i7(n)),x){let _=x({vertexShader:e,fragmentShader:n});e=_.vertexShader,n=_.fragmentShader}if(m){let _=[];n=n.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,S=>(_.push(S),"")),h=`${m}
${_.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,(_,S,M,T)=>/\battribute\s+vec[23]\s+$/.test(T.substr(0,M))?S:`troika_${S}_${i}`),t.map&&t.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=GF(e,i,s,o,a),n=GF(n,i,c,f,h),{vertexShader:e,fragmentShader:n}}function GF(t,e,n,r,i){return(r||i||n)&&(t=t.replace(pQ,`
${n}
void troikaOrigMain${e}() {`),t+=`
void main() {
  ${r}
  troikaOrigMain${e}();
  ${i}
}`),t}function vNe(t,e){return t==="uniforms"?void 0:typeof e=="function"?e.toString():e}let yNe=0;const VF=new Map;function bNe(t){const e=JSON.stringify(t,vNe);let n=VF.get(e);return n==null&&VF.set(e,n=++yNe),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 _Ne(){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=[],f=0;f<l;f++){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 "],f={_data:i,_offset:a},h={},m=0;m<l;m++){var x=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[x]={offset:b,length:_}}for(m=0;m<c.length;m++){var S=c[m];h[S]&&(f[S.trim()]=e[S.trim()].parse(i,h[S].offset,h[S].length,f))}return f},_tabOffset:function(i,s,o){for(var a=e._bin,l=a.readUshort(i,o+4),c=o+12,f=0;f<l;f++){var h=a.readASCII(i,c,4);c+=4,a.readUint(i,c),c+=4;var m=a.readUint(i,c);if(c+=4,a.readUint(i,c),c+=4,h==s)return m}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,f={},h=s;c.readFixed(i,s),s+=4;var m=c.readUshort(i,s);s+=2;var x=c.readUshort(i,s);s+=2;var b=c.readUshort(i,s);return s+=2,f.scriptList=e._lctf.readScriptList(i,h+m),f.featureList=e._lctf.readFeatureList(i,h+x),f.lookupList=e._lctf.readLookupList(i,h+b,l),f},e._lctf.readLookupList=function(i,s,o){var a=e._bin,l=s,c=[],f=a.readUshort(i,s);s+=2;for(var h=0;h<f;h++){var m=a.readUshort(i,s);s+=2;var x=e._lctf.readLookupTable(i,l+m,o);c.push(x)}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 f=a.readUshort(i,s);s+=2;for(var h=c.ltype,m=0;m<f;m++){var x=a.readUshort(i,s);s+=2;var b=o(i,h,l+x,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 f=o.readUshort(i,s);s+=2;for(var h=0;h<f;h++)a.push(c+h),a.push(c+h),a.push(o.readUshort(i,s)),s+=2}if(l==2){var m=o.readUshort(i,s);for(s+=2,h=0;h<m;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 f=0;f<c;f++){var h=o.readASCII(i,s,4);s+=4;var m=o.readUshort(i,s);s+=2;var x=e._lctf.readFeatureTable(i,a+m);x.tag=h.trim(),l.push(x)}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 f=o.readUshort(i,s);s+=2,l.tab=[];for(var h=0;h<f;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 f=0;f<c;f++){var h=o.readASCII(i,s,4);s+=4;var m=o.readUshort(i,s);s+=2,l[h.trim()]=e._lctf.readScriptTable(i,a+m)}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 f=o.readUshort(i,s);s+=2;for(var h=0;h<f;h++){var m=o.readASCII(i,s,4);s+=4;var x=o.readUshort(i,s);s+=2,l[m.trim()]=e._lctf.readLangSysTable(i,a+x)}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=[],f=0;f<l.length-1;f++)c.push(a.readASCII(i,s+l[f],l[f+1]-l[f]));s+=l[l.length-1];var h=[];s=e.CFF.readIndex(i,s,h);var m=[];for(f=0;f<h.length-1;f++)m.push(e.CFF.readDict(i,s+h[f],s+h[f+1]));s+=h[h.length-1];var x=m[0],b=[];s=e.CFF.readIndex(i,s,b);var _=[];for(f=0;f<b.length-1;f++)_.push(a.readASCII(i,s+b[f],b[f+1]-b[f]));if(s+=b[b.length-1],e.CFF.readSubrs(i,s,x),x.CharStrings){s=x.CharStrings,b=[],s=e.CFF.readIndex(i,s,b);var S=[];for(f=0;f<b.length-1;f++)S.push(a.readBytes(i,s+b[f],b[f+1]-b[f]));x.CharStrings=S}if(x.ROS){s=x.FDArray;var M=[];for(s=e.CFF.readIndex(i,s,M),x.FDArray=[],f=0;f<M.length-1;f++){var T=e.CFF.readDict(i,s+M[f],s+M[f+1]);e.CFF._readFDict(i,T,_),x.FDArray.push(T)}s+=M[M.length-1],s=x.FDSelect,x.FDSelect=[];var A=i[s];if(s++,A!=3)throw A;var N=a.readUshort(i,s);for(s+=2,f=0;f<N+1;f++)x.FDSelect.push(a.readUshort(i,s),i[s+2]),s+=3}return x.Encoding&&(x.Encoding=e.CFF.readEncoding(i,x.Encoding,x.CharStrings.length)),x.charset&&(x.charset=e.CFF.readCharset(i,x.charset,x.CharStrings.length)),e.CFF._readFDict(i,x,_),x},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,f=l.length;c=f<1240?107:f<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 f=0;f<c;f++)a.push(i[s+f]);return a},e.CFF.readCharset=function(i,s,o){var a=e._bin,l=[".notdef"],c=i[s];if(s++,c==0)for(var f=0;f<o;f++){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 m=0;for(c==1?(m=i[s],s++):(m=a.readUshort(i,s),s+=2),f=0;f<=m;f++)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 f=0;f<l;f++)o.push(i[s+f]);else if(c==2)for(f=0;f<l;f++)o.push(a.readUshort(i,s+2*f));else if(c==3)for(f=0;f<l;f++)o.push(16777215&a.readUint(i,s+3*f-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 f=1,h=null,m=null;l<=20&&(h=l,f=1),l==12&&(h=100*l+c,f=2),21<=l&&l<=27&&(h=l,f=1),l==28&&(m=a.readShort(i,s+1),f=3),29<=l&&l<=31&&(h=l,f=1),32<=l&&l<=246&&(m=l-139,f=1),247<=l&&l<=250&&(m=256*(l-247)+c+108,f=2),251<=l&&l<=254&&(m=256*-(l-251)-c-108,f=2),l==255&&(m=a.readInt(i,s+1)/65535,f=5),o.val=m??"o"+h,o.size=f},e.CFF.readCharString=function(i,s,o){for(var a=s+o,l=e._bin,c=[];s<a;){var f=i[s],h=i[s+1];i[s+2],i[s+3],i[s+4];var m=1,x=null,b=null;f<=20&&(x=f,m=1),f==12&&(x=100*f+h,m=2),f!=19&&f!=20||(x=f,m=2),21<=f&&f<=27&&(x=f,m=1),f==28&&(b=l.readShort(i,s+1),m=3),29<=f&&f<=31&&(x=f,m=1),32<=f&&f<=246&&(b=f-139,m=1),247<=f&&f<=250&&(b=256*(f-247)+h+108,m=2),251<=f&&f<=254&&(b=256*-(f-251)-h-108,m=2),f==255&&(b=l.readInt(i,s+1)/65535,m=5),c.push(b??"o"+x),s+=m}return c},e.CFF.readDict=function(i,s,o){for(var a=e._bin,l={},c=[];s<o;){var f=i[s],h=i[s+1];i[s+2],i[s+3],i[s+4];var m=1,x=null,b=null;if(f==28&&(b=a.readShort(i,s+1),m=3),f==29&&(b=a.readInt(i,s+1),m=5),32<=f&&f<=246&&(b=f-139,m=1),247<=f&&f<=250&&(b=256*(f-247)+h+108,m=2),251<=f&&f<=254&&(b=256*-(f-251)-h-108,m=2),f==255)throw b=a.readInt(i,s+1)/65535,m=5,"unknown number";if(f==30){var _=[];for(m=1;;){var S=i[s+m];m++;var M=S>>4,T=15&S;if(M!=15&&_.push(M),T!=15&&_.push(T),T==15)break}for(var A="",N=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],D=0;D<_.length;D++)A+=N[_[D]];b=parseFloat(A)}f<=21&&(x=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][f],m=1,f==12&&(x=["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],m=2)),x!=null?(l[x]=c.length==1?c[0]:c,c=[]):c.push(b),s+=m}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 f=[];l.tables=[];for(var h=0;h<c;h++){var m=a.readUshort(i,s);s+=2;var x=a.readUshort(i,s);s+=2;var b=a.readUint(i,s);s+=4;var _="p"+m+"e"+x,S=f.indexOf(b);if(S==-1){var M;S=l.tables.length,f.push(b);var T=a.readUshort(i,b);T==0?M=e.cmap.parse0(i,b):T==4?M=e.cmap.parse4(i,b):T==6?M=e.cmap.parse6(i,b):T==12?M=e.cmap.parse12(i,b):console.debug("unknown format: "+T,m,x,b),l.tables.push(M)}if(l[_]!=null)throw"multiple tables for one platform+encoding";l[_]=S}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 f=o.readUshort(i,s);s+=2;var h=f/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 m=0;m<h;m++)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 f=s+12*c,h=o.readUint(i,f+0),m=o.readUint(i,f+4),x=o.readUint(i,f+8);a.groups.push([h,m,x])}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 f=0;f<c.noc;f++)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 m=c.endPts[c.noc-1]+1;for(c.flags=[],f=0;f<m;f++){var x=a[l];if(l++,c.flags.push(x),(8&x)!=0){var b=a[l];l++;for(var _=0;_<b;_++)c.flags.push(x),f++}}for(c.xs=[],f=0;f<m;f++){var S=(2&c.flags[f])!=0,M=(16&c.flags[f])!=0;S?(c.xs.push(M?a[l]:-a[l]),l++):M?c.xs.push(0):(c.xs.push(o.readShort(a,l)),l+=2)}for(c.ys=[],f=0;f<m;f++)S=(4&c.flags[f])!=0,M=(32&c.flags[f])!=0,S?(c.ys.push(M?a[l]:-a[l]),l++):M?c.ys.push(0):(c.ys.push(o.readShort(a,l)),l+=2);var T=0,A=0;for(f=0;f<m;f++)T+=c.xs[f],A+=c.ys[f],c.xs[f]=T,c.ys[f]=A}else{var N;c.parts=[];do{N=o.readUshort(a,l),l+=2;var D={m:{a:1,b:0,c:0,d:1,tx:0,ty:0},p1:-1,p2:-1};if(c.parts.push(D),D.glyphIndex=o.readUshort(a,l),l+=2,1&N){var k=o.readShort(a,l);l+=2;var O=o.readShort(a,l);l+=2}else k=o.readInt8(a,l),l++,O=o.readInt8(a,l),l++;2&N?(D.m.tx=k,D.m.ty=O):(D.p1=k,D.p2=O),8&N?(D.m.a=D.m.d=o.readF2dot14(a,l),l+=2):64&N?(D.m.a=o.readF2dot14(a,l),l+=2,D.m.d=o.readF2dot14(a,l),l+=2):128&N&&(D.m.a=o.readF2dot14(a,l),l+=2,D.m.b=o.readF2dot14(a,l),l+=2,D.m.c=o.readF2dot14(a,l),l+=2,D.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=[],f=0;f<R;f++)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,f={};if(f.fmt=l.readUshort(i,o),o+=2,s==1||s==2||s==3||s==7||s==8&&f.fmt<=2){var h=l.readUshort(i,o);o+=2,f.coverage=e._lctf.readCoverage(i,h+c)}if(s==1&&f.fmt==1){var m=l.readUshort(i,o);o+=2,m!=0&&(f.pos=e.GPOS.readValueRecord(i,o,m))}else if(s==2&&f.fmt>=1&&f.fmt<=2){m=l.readUshort(i,o),o+=2;var x=l.readUshort(i,o);o+=2;var b=e._lctf.numOfOnes(m),_=e._lctf.numOfOnes(x);if(f.fmt==1){f.pairsets=[];var S=l.readUshort(i,o);o+=2;for(var M=0;M<S;M++){var T=c+l.readUshort(i,o);o+=2;var A=l.readUshort(i,T);T+=2;for(var N=[],D=0;D<A;D++){var k=l.readUshort(i,T);T+=2,m!=0&&($=e.GPOS.readValueRecord(i,T,m),T+=2*b),x!=0&&(G=e.GPOS.readValueRecord(i,T,x),T+=2*_),N.push({gid2:k,val1:$,val2:G})}f.pairsets.push(N)}}if(f.fmt==2){var O=l.readUshort(i,o);o+=2;var R=l.readUshort(i,o);o+=2;var L=l.readUshort(i,o);o+=2;var B=l.readUshort(i,o);for(o+=2,f.classDef1=e._lctf.readClassDef(i,c+O),f.classDef2=e._lctf.readClassDef(i,c+R),f.matrix=[],M=0;M<L;M++){var H=[];for(D=0;D<B;D++){var $=null,G=null;m!=0&&($=e.GPOS.readValueRecord(i,o,m),o+=2*b),x!=0&&(G=e.GPOS.readValueRecord(i,o,x),o+=2*_),H.push({val1:$,val2:G})}f.matrix.push(H)}}}else if(s==4&&f.fmt==1)f.markCoverage=e._lctf.readCoverage(i,l.readUshort(i,o)+c),f.baseCoverage=e._lctf.readCoverage(i,l.readUshort(i,o+2)+c),f.markClassCount=l.readUshort(i,o+4),f.markArray=e.GPOS.readMarkArray(i,l.readUshort(i,o+6)+c),f.baseArray=e.GPOS.readBaseArray(i,l.readUshort(i,o+8)+c,f.markClassCount);else if(s==6&&f.fmt==1)f.mark1Coverage=e._lctf.readCoverage(i,l.readUshort(i,o)+c),f.mark2Coverage=e._lctf.readCoverage(i,l.readUshort(i,o+2)+c),f.markClassCount=l.readUshort(i,o+4),f.mark1Array=e.GPOS.readMarkArray(i,l.readUshort(i,o+6)+c),f.mark2Array=e.GPOS.readBaseArray(i,l.readUshort(i,o+8)+c,f.markClassCount);else{if(s==9&&f.fmt==1){var Z=l.readUshort(i,o);o+=2;var V=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+V)}console.debug("unsupported GPOS table LookupType",s,"format",f.fmt)}return f},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,f=a.readUshort(i,s);s+=2;for(var h=0;h<f;h++){for(var m=[],x=0;x<o;x++)m.push(e.GPOS.readAnchorRecord(i,c+a.readUshort(i,s))),s+=2;l.push(m)}return l},e.GPOS.readMarkArray=function(i,s){var o=e._bin,a=[],l=s,c=o.readUshort(i,s);s+=2;for(var f=0;f<c;f++){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,f={};if(f.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&&f.fmt<=2||s==6&&f.fmt<=2){var h=l.readUshort(i,o);o+=2,f.coverage=e._lctf.readCoverage(i,c+h)}if(s==1&&f.fmt>=1&&f.fmt<=2){if(f.fmt==1)f.delta=l.readShort(i,o),o+=2;else if(f.fmt==2){var m=l.readUshort(i,o);o+=2,f.newg=l.readUshorts(i,o,m),o+=2*f.newg.length}}else if(s==2&&f.fmt==1){m=l.readUshort(i,o),o+=2,f.seqs=[];for(var x=0;x<m;x++){var b=l.readUshort(i,o)+c;o+=2;var _=l.readUshort(i,b);f.seqs.push(l.readUshorts(i,b+2,_))}}else if(s==4)for(f.vals=[],m=l.readUshort(i,o),o+=2,x=0;x<m;x++){var S=l.readUshort(i,o);o+=2,f.vals.push(e.GSUB.readLigatureSet(i,c+S))}else if(s==5&&f.fmt==2){if(f.fmt==2){var M=l.readUshort(i,o);o+=2,f.cDef=e._lctf.readClassDef(i,c+M),f.scset=[];var T=l.readUshort(i,o);for(o+=2,x=0;x<T;x++){var A=l.readUshort(i,o);o+=2,f.scset.push(A==0?null:e.GSUB.readSubClassSet(i,c+A))}}}else if(s==6&&f.fmt==3){if(f.fmt==3){for(x=0;x<3;x++){m=l.readUshort(i,o),o+=2;for(var N=[],D=0;D<m;D++)N.push(e._lctf.readCoverage(i,c+l.readUshort(i,o+2*D)));o+=2*m,x==0&&(f.backCvg=N),x==1&&(f.inptCvg=N),x==2&&(f.ahedCvg=N)}m=l.readUshort(i,o),o+=2,f.lookupRec=e.GSUB.readSubstLookupRecords(i,o,m)}}else{if(s==7&&f.fmt==1){var k=l.readUshort(i,o);o+=2;var O=l.readUint(i,o);if(o+=4,a.ltype==9)a.ltype=k;else if(a.ltype!=k)throw"invalid extension substitution";return e.GSUB.subt(i,a.ltype,c+O)}console.debug("unsupported GSUB table LookupType",s,"format",f.fmt)}return f},e.GSUB.readSubClassSet=function(i,s){var o=e._bin.readUshort,a=s,l=[],c=o(i,s);s+=2;for(var f=0;f<c;f++){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 f=0;f<l-1;f++)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 f=0;f<c;f++){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 f=o.readUshort(i,s);s+=2,c==1&&f--,a[l[c]]=o.readUshorts(i,s,f),s+=2*a[l[c]].length}return f=o.readUshort(i,s),s+=2,a.subst=o.readUshorts(i,s,2*f),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 f=0;f<c;f++){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:[]},f=0,h=0,m=0;m<a.maxp.numGlyphs;m++)m<a.hhea.numberOfHMetrics&&(f=l.readUshort(i,s),s+=2,h=l.readShort(i,s),s+=2),c.aWidth.push(f),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 f=l.readUshort(i,s);s+=2;for(var h={glyph1:[],rval:[]},m=0;m<f;m++){s+=2,o=l.readUshort(i,s),s+=2;var x=l.readUshort(i,s);s+=2;var b=x>>>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 f={glyph1:[],rval:[]},h=0;h<c;h++){l.readUint(i,s),s+=4;var m=l.readUshort(i,s);s+=2,l.readUshort(i,s),s+=2;var x=m>>>8;if((x&=15)!=0)throw"unknown kern table format: "+x;s=e.kern.readFormat0(i,s,f)}return f},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 f=0;f<c;f++){var h=a.readUshort(i,s);s+=2;var m=a.readUshort(i,s);s+=2;var x=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(m),b.vals.push(x),l=h}return s},e.loca={},e.loca.parse=function(i,s,o,a){var l=e._bin,c=[],f=a.head.indexToLocFormat,h=a.maxp.numGlyphs+1;if(f==0)for(var m=0;m<h;m++)c.push(l.readUshort(i,s+(m<<1))<<1);if(f==1)for(m=0;m<h;m++)c.push(l.readUint(i,s+(m<<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 f,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"],m=s+=2,x=0;x<c;x++){var b=a.readUshort(i,s);s+=2;var _=a.readUshort(i,s);s+=2;var S=a.readUshort(i,s);s+=2;var M=a.readUshort(i,s);s+=2;var T=a.readUshort(i,s);s+=2;var A=a.readUshort(i,s);s+=2;var N,D=h[M],k=m+12*c+A;if(b==0)N=a.readUnicode(i,k,T/2);else if(b==3&&_==0)N=a.readUnicode(i,k,T/2);else if(_==0)N=a.readASCII(i,k,T);else if(_==1)N=a.readUnicode(i,k,T/2);else if(_==3)N=a.readUnicode(i,k,T/2);else{if(b!=1)throw"unknown encoding "+_+", platformID: "+b;N=a.readASCII(i,k,T),console.debug("reading unknown MAC encoding "+_+" as ASCII")}var O="p"+b+","+S.toString(16);l[O]==null&&(l[O]={}),l[O][D!==void 0?D:M]=N,l[O]._lang=S}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){f=R;break}return console.debug("returning name table with languageID "+l[f]._lang),l[f]},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,f=0;f<l.endCount.length;f++)if(s<=l.endCount[f]){c=f;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(f=0;f<l.groups.length;f++){var h=l.groups[f];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,f=i.CFF.Private;if(c.ROS){for(var h=0;c.FDSelect[h+2]<=s;)h+=2;f=c.FDArray[c.FDSelect[h+1]].Private}e.U._drawCFF(i.CFF.CharStrings[s],l,c,f,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 f=c==a?l:c-1,h=c==l?a:c+1,m=1&i.flags[c],x=1&i.flags[f],b=1&i.flags[h],_=i.xs[c],S=i.ys[c];if(c==a)if(m){if(!x){e.U.P.moveTo(s,_,S);continue}e.U.P.moveTo(s,i.xs[f],i.ys[f])}else x?e.U.P.moveTo(s,i.xs[f],i.ys[f]):e.U.P.moveTo(s,(i.xs[f]+_)/2,(i.ys[f]+S)/2);m?x&&e.U.P.lineTo(s,_,S):b?e.U.P.qcurveTo(s,_,S,i.xs[h],i.ys[h]):e.U.P.qcurveTo(s,_,S,(_+i.xs[h])/2,(S+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 f=c.m,h=0;h<l.crds.length;h+=2){var m=l.crds[h],x=l.crds[h+1];o.crds.push(m*f.a+x*f.b+f.tx),o.crds.push(m*f.c+x*f.d+f.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 f,h=o.tabs[c];if(!h.coverage||(f=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[f];else if(o.ltype==4)for(var m=h.vals[f],x=0;x<m.length;x++){var b=m[x],_=b.chain.length;if(!(_>l)){for(var S=!0,M=0,T=0;T<_;T++){for(;i[s+M+(1+T)]==-1;)M++;b.chain[T]!=i[s+M+(1+T)]&&(S=!1)}if(S){for(i[s]=b.nglyph,T=0;T<_+M;T++)i[s+T+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],D=h.scset[N],k=0;k<D.length;k++){var O=D[k],R=O.input;if(!(R.length>l)){for(S=!0,T=0;T<R.length;T++){var L=e._lctf.getInterval(h.cDef,i[s+1+T]);if(A==-1&&h.cDef[L+2]!=R[T]){S=!1;break}}if(S){var B=O.substLookupRecords;for(x=0;x<B.length;x+=2)B[x],B[x+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 H=h.lookupRec;for(k=0;k<H.length;k+=2){A=H[k];var $=a[H[k+1]];e.U._applySubs(i,s+A,$,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 f=s[c];if(f!=-1){for(var h=c<s.length-1&&s[c+1]!=-1?s[c+1]:0,m=e.U.glyphToPath(i,f),x=0;x<m.crds.length;x+=2)a.crds.push(m.crds[x]+l),a.crds.push(m.crds[x+1]);for(o&&a.cmds.push(o),x=0;x<m.cmds.length;x++)a.cmds.push(m.cmds[x]);o&&a.cmds.push("X"),l+=i.hmtx.aWidth[f],c<s.length-1&&(l+=e.U.getPairAdjustment(i,f,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,f){i.cmds.push("C"),i.crds.push(s,o,a,l,c,f)},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,f=s.nStems,h=s.haveWidth,m=s.width,x=s.open,b=0,_=s.x,S=s.y,M=0,T=0,A=0,N=0,D=0,k=0,O=0,R=0,L=0,B=0,H={val:0,size:0};b<i.length;){e.CFF.getCharString(i,b,H);var $=H.val;if(b+=H.size,$=="o1"||$=="o18")c.length%2!=0&&!h&&(m=c.shift()+a.nominalWidthX),f+=c.length>>1,c.length=0,h=!0;else if($=="o3"||$=="o23")c.length%2!=0&&!h&&(m=c.shift()+a.nominalWidthX),f+=c.length>>1,c.length=0,h=!0;else if($=="o4")c.length>1&&!h&&(m=c.shift()+a.nominalWidthX,h=!0),x&&e.U.P.closePath(l),S+=c.pop(),e.U.P.moveTo(l,_,S),x=!0;else if($=="o5")for(;c.length>0;)_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S);else if($=="o6"||$=="o7")for(var G=c.length,Z=$=="o6",V=0;V<G;V++){var W=c.shift();Z?_+=W:S+=W,Z=!Z,e.U.P.lineTo(l,_,S)}else if($=="o8"||$=="o24"){G=c.length;for(var J=0;J+6<=G;)M=_+c.shift(),T=S+c.shift(),A=M+c.shift(),N=T+c.shift(),_=A+c.shift(),S=N+c.shift(),e.U.P.curveTo(l,M,T,A,N,_,S),J+=6;$=="o24"&&(_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S))}else{if($=="o11")break;if($=="o1234"||$=="o1235"||$=="o1236"||$=="o1237")$=="o1234"&&(T=S,A=(M=_+c.shift())+c.shift(),B=N=T+c.shift(),k=N,R=S,_=(O=(D=(L=A+c.shift())+c.shift())+c.shift())+c.shift(),e.U.P.curveTo(l,M,T,A,N,L,B),e.U.P.curveTo(l,D,k,O,R,_,S)),$=="o1235"&&(M=_+c.shift(),T=S+c.shift(),A=M+c.shift(),N=T+c.shift(),L=A+c.shift(),B=N+c.shift(),D=L+c.shift(),k=B+c.shift(),O=D+c.shift(),R=k+c.shift(),_=O+c.shift(),S=R+c.shift(),c.shift(),e.U.P.curveTo(l,M,T,A,N,L,B),e.U.P.curveTo(l,D,k,O,R,_,S)),$=="o1236"&&(M=_+c.shift(),T=S+c.shift(),A=M+c.shift(),B=N=T+c.shift(),k=N,O=(D=(L=A+c.shift())+c.shift())+c.shift(),R=k+c.shift(),_=O+c.shift(),e.U.P.curveTo(l,M,T,A,N,L,B),e.U.P.curveTo(l,D,k,O,R,_,S)),$=="o1237"&&(M=_+c.shift(),T=S+c.shift(),A=M+c.shift(),N=T+c.shift(),L=A+c.shift(),B=N+c.shift(),D=L+c.shift(),k=B+c.shift(),O=D+c.shift(),R=k+c.shift(),Math.abs(O-_)>Math.abs(R-S)?_=O+c.shift():S=R+c.shift(),e.U.P.curveTo(l,M,T,A,N,L,B),e.U.P.curveTo(l,D,k,O,R,_,S));else if($=="o14"){if(c.length>0&&!h&&(m=c.shift()+o.nominalWidthX,h=!0),c.length==4){var ne=c.shift(),ie=c.shift(),z=c.shift(),j=c.shift(),X=e.CFF.glyphBySE(o,z),F=e.CFF.glyphBySE(o,j);e.U._drawCFF(o.CharStrings[X],s,o,a,l),s.x=ne,s.y=ie,e.U._drawCFF(o.CharStrings[F],s,o,a,l)}x&&(e.U.P.closePath(l),x=!1)}else if($=="o19"||$=="o20")c.length%2!=0&&!h&&(m=c.shift()+a.nominalWidthX),f+=c.length>>1,c.length=0,h=!0,b+=f+7>>3;else if($=="o21")c.length>2&&!h&&(m=c.shift()+a.nominalWidthX,h=!0),S+=c.pop(),_+=c.pop(),x&&e.U.P.closePath(l),e.U.P.moveTo(l,_,S),x=!0;else if($=="o22")c.length>1&&!h&&(m=c.shift()+a.nominalWidthX,h=!0),_+=c.pop(),x&&e.U.P.closePath(l),e.U.P.moveTo(l,_,S),x=!0;else if($=="o25"){for(;c.length>6;)_+=c.shift(),S+=c.shift(),e.U.P.lineTo(l,_,S);M=_+c.shift(),T=S+c.shift(),A=M+c.shift(),N=T+c.shift(),_=A+c.shift(),S=N+c.shift(),e.U.P.curveTo(l,M,T,A,N,_,S)}else if($=="o26")for(c.length%2&&(_+=c.shift());c.length>0;)M=_,T=S+c.shift(),_=A=M+c.shift(),S=(N=T+c.shift())+c.shift(),e.U.P.curveTo(l,M,T,A,N,_,S);else if($=="o27")for(c.length%2&&(S+=c.shift());c.length>0;)T=S,A=(M=_+c.shift())+c.shift(),N=T+c.shift(),_=A+c.shift(),S=N,e.U.P.curveTo(l,M,T,A,N,_,S);else if($=="o10"||$=="o29"){var ce=$=="o10"?a:o;if(c.length==0)console.debug("error: empty stack");else{var oe=c.pop(),Q=ce.Subrs[oe+ce.Bias];s.x=_,s.y=S,s.nStems=f,s.haveWidth=h,s.width=m,s.open=x,e.U._drawCFF(Q,s,o,a,l),_=s.x,S=s.y,f=s.nStems,h=s.haveWidth,m=s.width,x=s.open}}else if($=="o30"||$=="o31"){var se=c.length,re=(J=0,$=="o31");for(J+=se-(G=-3&se);J<G;)re?(T=S,A=(M=_+c.shift())+c.shift(),S=(N=T+c.shift())+c.shift(),G-J==5?(_=A+c.shift(),J++):_=A,re=!1):(M=_,T=S+c.shift(),A=M+c.shift(),N=T+c.shift(),_=A+c.shift(),G-J==5?(S=N+c.shift(),J++):S=N,re=!0),e.U.P.curveTo(l,M,T,A,N,_,S),J+=4}else{if(($+"").charAt(0)=="o")throw console.debug("Unknown operation: "+$,i),$;c.push($)}}}s.x=_,s.y=S,s.nStems=f,s.haveWidth=h,s.width=m,s.open=x};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 wNe(){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($,G){for(var Z=new n(31),V=0;V<31;++V)Z[V]=G+=1<<$[V-1];var W=new r(Z[30]);for(V=1;V<30;++V)for(var J=Z[V];J<Z[V+1];++J)W[J]=J-Z[V]<<5|V;return[Z,W]},l=a(i,2),c=l[0],f=l[1];c[28]=258,f[258]=28;for(var h=a(s,0)[0],m=new n(32768),x=0;x<32768;++x){var b=(43690&x)>>>1|(21845&x)<<1;b=(61680&(b=(52428&b)>>>2|(13107&b)<<2))>>>4|(3855&b)<<4,m[x]=((65280&b)>>>8|(255&b)<<8)>>>1}var _=function($,G,Z){for(var V=$.length,W=0,J=new n(G);W<V;++W)++J[$[W]-1];var ne,ie=new n(G);for(W=0;W<G;++W)ie[W]=ie[W-1]+J[W-1]<<1;{ne=new n(1<<G);var z=15-G;for(W=0;W<V;++W)if($[W])for(var j=W<<4|$[W],X=G-$[W],F=ie[$[W]-1]++<<X,ce=F|(1<<X)-1;F<=ce;++F)ne[m[F]>>>z]=j}return ne},S=new e(288);for(x=0;x<144;++x)S[x]=8;for(x=144;x<256;++x)S[x]=9;for(x=256;x<280;++x)S[x]=7;for(x=280;x<288;++x)S[x]=8;var M=new e(32);for(x=0;x<32;++x)M[x]=5;var T=_(S,9),A=_(M,5),N=function($){for(var G=$[0],Z=1;Z<$.length;++Z)$[Z]>G&&(G=$[Z]);return G},D=function($,G,Z){var V=G/8|0;return($[V]|$[V+1]<<8)>>(7&G)&Z},k=function($,G){var Z=G/8|0;return($[Z]|$[Z+1]<<8|$[Z+2]<<16)>>(7&G)},O=["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($,G,Z){var V=new Error(G||O[$]);if(V.code=$,Error.captureStackTrace&&Error.captureStackTrace(V,R),!Z)throw V;return V},L=function($,G,Z){var V=$.length;if(!V||Z&&!Z.l&&V<5)return G||new e(0);var W=!G||Z,J=!Z||Z.i;Z||(Z={}),G||(G=new e(3*V));var ne,ie=function(st){var Pe=G.length;if(st>Pe){var Ke=new e(Math.max(2*Pe,st));Ke.set(G),G=Ke}},z=Z.f||0,j=Z.p||0,X=Z.b||0,F=Z.l,ce=Z.d,oe=Z.m,Q=Z.n,se=8*V;do{if(!F){Z.f=z=D($,j,1);var re=D($,j+1,3);if(j+=3,!re){var K=$[(Le=((ne=j)/8|0)+(7&ne&&1)+4)-4]|$[Le-3]<<8,fe=Le+K;if(fe>V){J&&R(0);break}W&&ie(X+K),G.set($.subarray(Le,fe),X),Z.b=X+=K,Z.p=j=8*fe;continue}if(re==1)F=T,ce=A,oe=9,Q=5;else if(re==2){var he=D($,j,31)+257,ae=D($,j+10,15)+4,Se=he+D($,j+5,31)+1;j+=14;for(var de=new e(Se),Me=new e(19),Ce=0;Ce<ae;++Ce)Me[o[Ce]]=D($,j+3*Ce,7);j+=3*ae;var Re=N(Me),le=(1<<Re)-1,He=_(Me,Re);for(Ce=0;Ce<Se;){var Le,ze=He[D($,j,le)];if(j+=15&ze,(Le=ze>>>4)<16)de[Ce++]=Le;else{var Ve=0,ue=0;for(Le==16?(ue=3+D($,j,3),j+=2,Ve=de[Ce-1]):Le==17?(ue=3+D($,j,7),j+=3):Le==18&&(ue=11+D($,j,127),j+=7);ue--;)de[Ce++]=Ve}}var Y=de.subarray(0,he),xe=de.subarray(he);oe=N(Y),Q=N(xe),F=_(Y,oe),ce=_(xe,Q)}else R(1);if(j>se){J&&R(0);break}}W&&ie(X+131072);for(var we=(1<<oe)-1,Te=(1<<Q)-1,ge=j;;ge=j){var Ue=(Ve=F[k($,j)&we])>>>4;if((j+=15&Ve)>se){J&&R(0);break}if(Ve||R(2),Ue<256)G[X++]=Ue;else{if(Ue==256){ge=j,F=null;break}var be=Ue-254;if(Ue>264){var ke=i[Ce=Ue-257];be=D($,j,(1<<ke)-1)+c[Ce],j+=ke}var qe=ce[k($,j)&Te],Qe=qe>>>4;if(qe||R(3),j+=15&qe,xe=h[Qe],Qe>3&&(ke=s[Qe],xe+=k($,j)&(1<<ke)-1,j+=ke),j>se){J&&R(0);break}W&&ie(X+131072);for(var nt=X+be;X<nt;X+=4)G[X]=G[X-xe],G[X+1]=G[X+1-xe],G[X+2]=G[X+2-xe],G[X+3]=G[X+3-xe];X=nt}}Z.l=F,Z.p=ge,Z.b=X,F&&(z=1,Z.m=oe,Z.d=ce,Z.n=Q)}while(!z);return X==G.length?G:(function(st,Pe,Ke){(Ke==null||Ke>st.length)&&(Ke=st.length);var rt=new(st instanceof n?n:st instanceof r?r:e)(Ke-Pe);return rt.set(st.subarray(Pe,Ke)),rt})(G,0,X)},B=new e(0),H=typeof TextDecoder<"u"&&new TextDecoder;try{H.decode(B,{stream:!0})}catch{}return t.convert_streams=function($){var G=new DataView($),Z=0;function V(){var he=G.getUint16(Z);return Z+=2,he}function W(){var he=G.getUint32(Z);return Z+=4,he}function J(he){K.setUint16(fe,he),fe+=2}function ne(he){K.setUint32(fe,he),fe+=4}for(var ie={signature:W(),flavor:W(),length:W(),numTables:V(),reserved:V(),totalSfntSize:W(),majorVersion:V(),minorVersion:V(),metaOffset:W(),metaLength:W(),metaOrigLength:W(),privOffset:W(),privLength:W()},z=0;Math.pow(2,z)<=ie.numTables;)z++;z--;for(var j=16*Math.pow(2,z),X=16*ie.numTables-j,F=12,ce=[],oe=0;oe<ie.numTables;oe++)ce.push({tag:W(),offset:W(),compLength:W(),origLength:W(),origChecksum:W()}),F+=16;var Q,se=new Uint8Array(12+16*ce.length+ce.reduce((function(he,ae){return he+ae.origLength+4}),0)),re=se.buffer,K=new DataView(re),fe=0;return ne(ie.flavor),J(ie.numTables),J(j),J(z),J(X),ce.forEach((function(he){ne(he.tag),ne(he.origChecksum),ne(F),ne(he.origLength),he.outOffset=F,(F+=he.origLength)%4!=0&&(F+=4-F%4)})),ce.forEach((function(he){var ae,Se=$.slice(he.offset,he.offset+he.compLength);if(he.compLength!=he.origLength){var de=new Uint8Array(he.origLength);ae=new Uint8Array(Se,2),L(ae,de)}else de=new Uint8Array(Se);se.set(de,he.outOffset);var Me=0;(F=he.outOffset+he.origLength)%4!=0&&(Me=4-F%4),se.set(new Uint8Array(Me).buffer,he.outOffset+he.origLength),Q=F+Me})),re.slice(0,Q)},Object.defineProperty(t,"__esModule",{value:!0}),t})({}).convert_streams}function SNe(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 f;function h(O){if(!f){const R={R:s,L:i,D:o,C:l,U:c,T:a};f=new Map;for(let L in r){let B=0;r[L].split(",").forEach(H=>{let[$,G]=H.split("+");$=parseInt($,36),G=G?parseInt(G,36):0,f.set(B+=$,R[L]);for(let Z=G;Z--;)f.set(++B,R[L])})}}return f.get(O)||c}const m=1,x=2,b=3,_=4,S=[null,"isol","init","fina","medi"];function M(O){const R=new Uint8Array(O.length);let L=c,B=m,H=-1;for(let $=0;$<O.length;$++){const G=O.codePointAt($);let Z=h(G)|0,V=m;Z&a||(L&(i|o|l)?Z&(s|o|l)?(V=b,(B===m||B===b)&&R[H]++):Z&(i|c)&&(B===x||B===_)&&R[H]--:L&(s|c)&&(B===x||B===_)&&R[H]--,B=R[$]=V,L=Z,H=$,G>65535&&$++)}return R}function T(O,R){const L=[];for(let H=0;H<R.length;H++){const $=R.codePointAt(H);$>65535&&H++,L.push(t.U.codeToGlyph(O,$))}const B=O.GSUB;if(B){const{lookupList:H,featureList:$}=B;let G;const Z=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws|ccmp)$/,V=[];$.forEach(W=>{if(Z.test(W.tag))for(let J=0;J<W.tab.length;J++){if(V[W.tab[J]])continue;V[W.tab[J]]=!0;const ne=H[W.tab[J]],ie=/^(isol|init|fina|medi)$/.test(W.tag);ie&&!G&&(G=M(R));for(let z=0;z<L.length;z++)(!G||!ie||S[G[z]]===W.tag)&&t.U._applySubs(L,z,ne,H)}})}return L}function A(O,R){const L=new Int16Array(R.length*3);let B=0;for(;B<R.length;B++){const Z=R[B];if(Z===-1)continue;L[B*3+2]=O.hmtx.aWidth[Z];const V=O.GPOS;if(V){const W=V.lookupList;for(let J=0;J<W.length;J++){const ne=W[J];for(let ie=0;ie<ne.tabs.length;ie++){const z=ne.tabs[ie];if(ne.ltype===1){if(t._lctf.coverageIndex(z.coverage,Z)!==-1&&z.pos){G(z.pos,B);break}}else if(ne.ltype===2){let j=null,X=H();if(X!==-1){const F=t._lctf.coverageIndex(z.coverage,R[X]);if(F!==-1){if(z.fmt===1){const ce=z.pairsets[F];for(let oe=0;oe<ce.length;oe++)ce[oe].gid2===Z&&(j=ce[oe])}else if(z.fmt===2){const ce=t.U._getGlyphClass(R[X],z.classDef1),oe=t.U._getGlyphClass(Z,z.classDef2);j=z.matrix[ce][oe]}if(j){j.val1&&G(j.val1,X),j.val2&&G(j.val2,B);break}}}}else if(ne.ltype===4){const j=t._lctf.coverageIndex(z.markCoverage,Z);if(j!==-1){const X=H($),F=X===-1?-1:t._lctf.coverageIndex(z.baseCoverage,R[X]);if(F!==-1){const ce=z.markArray[j],oe=z.baseArray[F][ce.markClass];L[B*3]=oe.x-ce.x+L[X*3]-L[X*3+2],L[B*3+1]=oe.y-ce.y+L[X*3+1];break}}}else if(ne.ltype===6){const j=t._lctf.coverageIndex(z.mark1Coverage,Z);if(j!==-1){const X=H();if(X!==-1){const F=R[X];if(N(O,F)===3){const ce=t._lctf.coverageIndex(z.mark2Coverage,F);if(ce!==-1){const oe=z.mark1Array[j],Q=z.mark2Array[ce][oe.markClass];L[B*3]=Q.x-oe.x+L[X*3]-L[X*3+2],L[B*3+1]=Q.y-oe.y+L[X*3+1];break}}}}}}}}else if(O.kern&&!O.cff){const W=H();if(W!==-1){const J=O.kern.glyph1.indexOf(R[W]);if(J!==-1){const ne=O.kern.rval[J].glyph2.indexOf(Z);ne!==-1&&(L[W*3+2]+=O.kern.rval[J].vals[ne])}}}}return L;function H(Z){for(let V=B-1;V>=0;V--)if(R[V]!==-1&&(!Z||Z(R[V])))return V;return-1}function $(Z){return N(O,Z)===1}function G(Z,V){for(let W=0;W<3;W++)L[V*3+W]+=Z[W]||0}}function N(O,R){const L=O.GDEF&&O.GDEF.glyphClassDef;return L?t.U._getGlyphClass(R,L):0}function D(...O){for(let R=0;R<O.length;R++)if(typeof O[R]=="number")return O[R]}function k(O){const R=Object.create(null),L=O["OS/2"],B=O.hhea,H=O.head.unitsPerEm,$=D(L&&L.sTypoAscender,B&&B.ascender,H),G={unitsPerEm:H,ascender:$,descender:D(L&&L.sTypoDescender,B&&B.descender,0),capHeight:D(L&&L.sCapHeight,$),xHeight:D(L&&L.sxHeight,$),lineGap:D(L&&L.sTypoLineGap,B&&B.lineGap),supportsCodePoint(Z){return t.U.codeToGlyph(O,Z)>0},forEachGlyph(Z,V,W,J){let ne=0;const ie=1/G.unitsPerEm*V,z=T(O,Z);let j=0;const X=A(O,z);return z.forEach((F,ce)=>{if(F!==-1){let oe=R[F];if(!oe){const{cmds:Q,crds:se}=t.U.glyphToPath(O,F);let re="",K=0;for(let de=0,Me=Q.length;de<Me;de++){const Ce=n[Q[de]];re+=Q[de];for(let Re=1;Re<=Ce;Re++)re+=(Re>1?",":"")+se[K++]}let fe,he,ae,Se;if(se.length){fe=he=1/0,ae=Se=-1/0;for(let de=0,Me=se.length;de<Me;de+=2){let Ce=se[de],Re=se[de+1];Ce<fe&&(fe=Ce),Re<he&&(he=Re),Ce>ae&&(ae=Ce),Re>Se&&(Se=Re)}}else fe=ae=he=Se=0;oe=R[F]={index:F,advanceWidth:O.hmtx.aWidth[F],xMin:fe,yMin:he,xMax:ae,yMax:Se,path:re}}J.call(null,oe,ne+X[ce*3]*ie,X[ce*3+1]*ie,j),ne+=X[ce*3+2]*ie,W&&(ne+=W*V)}j+=Z.codePointAt(j)>65535?2:1}),ne}};return G}return function(R){const L=new Uint8Array(R,0,4),B=t._bin.readASCII(L,0,4);if(B==="wOFF")R=e(R);else if(B==="wOF2")throw new Error("woff2 fonts not supported");return k(t.parse(R)[0])}}const MNe=hb({name:"Typr Font Parser",dependencies:[_Ne,wNe,SNe],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 TNe(){return(function(t){var e=function(){this.buckets=new Map};e.prototype.add=function(A){var N=A>>5;this.buckets.set(N,(this.buckets.get(N)||0)|1<<(31&A))},e.prototype.has=function(A){var N=this.buckets.get(A>>5);return N!==void 0&&(N&1<<(31&A))!=0},e.prototype.serialize=function(){var A=[];return this.buckets.forEach((function(N,D){A.push((+D).toString(36)+":"+N.toString(36))})),A.join(",")},e.prototype.deserialize=function(A){var N=this;this.buckets.clear(),A.split(",").forEach((function(D){var k=D.split(":");N.buckets.set(parseInt(k[0],36),parseInt(k[1],36))}))};var n=Math.pow(2,8),r=n-1,i=~r;function s(A){var N=(function(k){return k&i})(A).toString(16),D=(function(k){return(k&i)+n-1})(A).toString(16);return"codepoint-index/plane"+(A>>16)+"/"+N+"-"+D+".json"}function o(A,N){var D=A&r,k=N.codePointAt(D/6|0);return((k=(k||48)-48)&1<<D%6)!=0}function a(A,N){var D;(D=A,D.replace(/U\+/gi,"").replace(/^,+|,+$/g,"").split(/,+/).map((function(k){return k.split("-").map((function(O){return parseInt(O.trim(),16)}))}))).forEach((function(k){var O=k[0],R=k[1];R===void 0&&(R=O),N(O,R)}))}function l(A,N){a(A,(function(D,k){for(var O=D;O<=k;O++)N(O)}))}var c={},f={},h=new WeakMap,m="https://cdn.jsdelivr.net/gh/lojjic/unicode-font-resolver@v1.0.1/packages/data";function x(A){var N=h.get(A);return N||(N=new e,l(A.ranges,(function(D){return N.add(D)})),h.set(A,N)),N}var b,_=new Map;function S(A,N,D){return A[N]?N:A[D]?D:(function(k){for(var O in k)return O})(A)}function M(A,N){var D=N;if(!A.includes(D)){D=1/0;for(var k=0;k<A.length;k++)Math.abs(A[k]-N)<Math.abs(D-N)&&(D=A[k])}return D}function T(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={},f={}},t.getFontsForString=function(A,N){N===void 0&&(N={});var D,k=N.lang;k===void 0&&(k=new RegExp("\\p{Script=Hangul}","u").test(D=A)?"ko":new RegExp("\\p{Script=Hiragana}|\\p{Script=Katakana}","u").test(D)?"ja":"en");var O=N.category;O===void 0&&(O="sans-serif");var R=N.style;R===void 0&&(R="normal");var L=N.weight;L===void 0&&(L=400);var B=(N.dataUrl||m).replace(/\/$/g,""),H=new Map,$=new Uint8Array(A.length),G={},Z={},V=new Array(A.length),W=new Map,J=!1;function ne(j){var X=_.get(j);return X||(X=fetch(B+"/"+j).then((function(F){if(!F.ok)throw new Error(F.statusText);return F.json().then((function(ce){if(!Array.isArray(ce)||ce[0]!==1)throw new Error("Incorrect schema version; need 1, got "+ce[0]);return ce[1]}))})).catch((function(F){if(B!==m)return J||(console.error('unicode-font-resolver: Failed loading from dataUrl "'+B+'", trying default CDN. '+F.message),J=!0),B=m,_.delete(j),ne(j);throw F})),_.set(j,X)),X}for(var ie=function(j){var X=A.codePointAt(j),F=s(X);V[j]=F,c[F]||W.has(F)||W.set(F,ne(F).then((function(ce){c[F]=ce}))),X>65535&&(j++,z=j)},z=0;z<A.length;z++)ie(z);return Promise.all(W.values()).then((function(){W.clear();for(var j=function(F){var ce=A.codePointAt(F),oe=null,Q=c[V[F]],se=void 0;for(var re in Q){var K=Z[re];if(K===void 0&&(K=Z[re]=new RegExp(re).test(k||"en")),K){for(var fe in se=re,Q[re])if(o(ce,Q[re][fe])){oe=fe;break}break}}if(!oe){e:for(var he in Q)if(he!==se){for(var ae in Q[he])if(o(ce,Q[he][ae])){oe=ae;break e}}}oe||(console.debug("No font coverage for U+"+ce.toString(16)),oe="latin"),V[F]=oe,f[oe]||W.has(oe)||W.set(oe,ne("font-meta/"+oe+".json").then((function(Se){f[oe]=Se}))),ce>65535&&(F++,X=F)},X=0;X<A.length;X++)j(X);return Promise.all(W.values())})).then((function(){for(var j,X=null,F=0;F<A.length;F++){var ce=A.codePointAt(F);if(X&&(T(ce)||x(X).has(ce)))$[F]=$[F-1];else{X=f[V[F]];var oe=G[X.id];if(!oe){var Q=X.typeforms,se=S(Q,O,"sans-serif"),re=S(Q[se],R,"normal"),K=M((j=Q[se])===null||j===void 0?void 0:j[re],L);oe=G[X.id]=B+"/font-files/"+X.id+"/"+se+"."+re+"."+K+".woff"}var fe=H.get(oe);fe==null&&(fe=H.size,H.set(oe,fe)),$[F]=fe}ce>65535&&(F++,$[F]=$[F-1])}return{fontUrls:Array.from(H.keys()),chars:$}}))},Object.defineProperty(t,"__esModule",{value:!0}),t})({})}function CNe(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 f=t(c.response);f.src=o,a(f)}catch(f){l(f)}},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(f=>f(c)),delete r[o]}))}return function(o,a,{lang:l,fonts:c=[],style:f="normal",weight:h="normal",unicodeFontsURL:m}={}){const x=new Uint8Array(o.length),b=[];o.length||T();const _=new Map,S=[];if(f!=="italic"&&(f="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 O=0;(function R(L=0){for(let B=L,H=o.length;B<H;B++){const $=o.codePointAt(B);if(O===1&&b[x[B-1]].supportsCodePoint($)||B>0&&/\s/.test(o[B]))x[B]=x[B-1],O===2&&(S[S.length-1][1]=B);else for(let G=x[B],Z=c.length;G<=Z;G++)if(G===Z){const V=O===2?S[S.length-1]:S[S.length]=[B,B];V[1]=B,O=2}else{x[B]=G;const{src:V,unicodeRange:W}=c[G];if(!W||A($,W)){const J=n[V];if(!J){s(V,()=>{R(B)});return}if(J.supportsCodePoint($)){let ne=_.get(J);typeof ne!="number"&&(ne=b.length,b.push(J),_.set(J,ne)),x[B]=ne,O=1;break}}}$>65535&&B+1<H&&(x[B+1]=x[B],B++,O===2&&(S[S.length-1][1]=B))}M()})()}else S.push([0,o.length-1]),M();function M(){if(S.length){const N=S.map(D=>o.substring(D[0],D[1]+1)).join(`
`);e.getFontsForString(N,{lang:l||void 0,style:f,weight:h,dataUrl:m}).then(({fontUrls:D,chars:k})=>{const O=b.length;let R=0;S.forEach(B=>{for(let H=0,$=B[1]-B[0];H<=$;H++)x[B[0]+H]=k[R++]+O;R++});let L=0;D.forEach((B,H)=>{s(B,$=>{b[H+O]=$,++L===D.length&&T()})})})}else T()}function T(){a({chars:x,fonts:b})}function A(N,D){for(let k=0;k<D.length;k++){const[O,R=O]=D[k];if(O<=N&&N<=R)return!0}return!1}}}const ENe=hb({name:"FontResolver",dependencies:[CNe,MNe,TNe],init(t,e,n){return t(e,n())}});function ANe(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:S,style:M,weight:T,preResolvedFonts:A,unicodeFontsURL:N},D){const k=({chars:O,fonts:R})=>{let L,B;const H=[];for(let $=0;$<O.length;$++)O[$]!==B?(B=O[$],H.push(L={start:$,end:$,fontObj:R[O[$]]})):L.end=$;D(H)};A?k(A):t(b,k,{lang:_,fonts:S,style:M,weight:T,unicodeFontsURL:N})}function a({text:b="",font:_,lang:S,sdfGlyphSize:M=64,fontSize:T=400,fontWeight:A=1,fontStyle:N="normal",letterSpacing:D=0,lineHeight:k="normal",maxWidth:O=1/0,direction:R,textAlign:L="left",textIndent:B=0,whiteSpace:H="normal",overflowWrap:$="normal",anchorX:G=0,anchorY:Z=0,metricsOnly:V=!1,unicodeFontsURL:W,preResolvedFonts:J=null,includeCaretPositions:ne=!1,chunkedBoundsSize:ie=8192,colorRanges:z=null},j){const X=h(),F={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,`
`)),T=+T,D=+D,O=+O,k=k||"normal",B=+B,o({text:b,lang:S,style:N,weight:A,fonts:typeof _=="string"?[{src:_}]:_,unicodeFontsURL:W,preResolvedFonts:J},ce=>{F.fontLoad=h()-X;const oe=isFinite(O);let Q=null,se=null,re=null,K=null,fe=null,he=null,ae=null,Se=null,de=0,Me=0,Ce=H!=="nowrap";const Re=new Map,le=h();let He=B,Le=0,ze=new m;const Ve=[ze];ce.forEach(Te=>{const{fontObj:ge}=Te,{ascender:Ue,descender:be,unitsPerEm:ke,lineGap:qe,capHeight:Qe,xHeight:nt}=ge;let st=Re.get(ge);if(!st){const $e=T/ke,Ze=k==="normal"?(Ue-be+qe)*$e:k*T,ft=(Ze-(Ue-be)*$e)/2,lt=Math.min(Ze,(Ue-be)*$e),Je=(Ue+be)/2*$e+lt/2;st={index:Re.size,src:ge.src,fontObj:ge,fontSizeMult:$e,unitsPerEm:ke,ascender:Ue*$e,descender:be*$e,capHeight:Qe*$e,xHeight:nt*$e,lineHeight:Ze,baseline:-ft-Ue*$e,caretTop:Je,caretBottom:Je-lt},Re.set(ge,st)}const{fontSizeMult:Pe}=st,Ke=b.slice(Te.start,Te.end+1);let rt,ye;ge.forEachGlyph(Ke,T,D,($e,Ze,ft,lt)=>{Ze+=Le,lt+=Te.start,rt=Ze,ye=$e;const Je=b.charAt(lt),Ae=$e.advanceWidth*Pe,We=ze.count;let De;if("isEmpty"in $e||($e.isWhitespace=!!Je&&new RegExp(i).test(Je),$e.canBreakAfter=!!Je&&s.test(Je),$e.isEmpty=$e.xMin===$e.xMax||$e.yMin===$e.yMax||r.test(Je)),!$e.isWhitespace&&!$e.isEmpty&&Me++,Ce&&oe&&!$e.isWhitespace&&Ze+Ae+He>O&&We){if(ze.glyphAt(We-1).glyphObj.canBreakAfter)De=new m,He=-Ze;else for(let ot=We;ot--;)if(ot===0&&$==="break-word"){De=new m,He=-Ze;break}else if(ze.glyphAt(ot).glyphObj.canBreakAfter){De=ze.splitAt(ot+1);const dt=De.glyphAt(0).x;He-=dt;for(let Pt=De.count;Pt--;)De.glyphAt(Pt).x-=dt;break}De&&(ze.isSoftWrapped=!0,ze=De,Ve.push(ze),de=O)}let Ne=ze.glyphAt(ze.count);Ne.glyphObj=$e,Ne.x=Ze+He,Ne.y=ft,Ne.width=Ae,Ne.charIndex=lt,Ne.fontData=st,Je===`
`&&(ze=new m,Ve.push(ze),He=-(Ze+Ae+D*T)+B)}),Le=rt+ye.advanceWidth*Pe+D*T});let ue=0;Ve.forEach(Te=>{let ge=!0;for(let Ue=Te.count;Ue--;){const be=Te.glyphAt(Ue);ge&&!be.glyphObj.isWhitespace&&(Te.width=be.x+be.width,Te.width>de&&(de=Te.width),ge=!1);let{lineHeight:ke,capHeight:qe,xHeight:Qe,baseline:nt}=be.fontData;ke>Te.lineHeight&&(Te.lineHeight=ke);const st=nt-Te.baseline;st<0&&(Te.baseline+=st,Te.cap+=st,Te.ex+=st),Te.cap=Math.max(Te.cap,Te.baseline+qe),Te.ex=Math.max(Te.ex,Te.baseline+Qe)}Te.baseline-=ue,Te.cap-=ue,Te.ex-=ue,ue+=Te.lineHeight});let Y=0,xe=0;if(G&&(typeof G=="number"?Y=-G:typeof G=="string"&&(Y=-de*(G==="left"?0:G==="center"?.5:G==="right"?1:c(G)))),Z&&(typeof Z=="number"?xe=-Z:typeof Z=="string"&&(xe=Z==="top"?0:Z==="top-baseline"?-Ve[0].baseline:Z==="top-cap"?-Ve[0].cap:Z==="top-ex"?-Ve[0].ex:Z==="middle"?ue/2:Z==="bottom"?ue:Z==="bottom-baseline"?-Ve[Ve.length-1].baseline:c(Z)*ue)),!V){const Te=e.getEmbeddingLevels(b,R);Q=new Uint16Array(Me),se=new Uint8Array(Me),re=new Float32Array(Me*2),K={},ae=[1/0,1/0,-1/0,-1/0],Se=[],ne&&(he=new Float32Array(b.length*4)),z&&(fe=new Uint8Array(Me*3));let ge=0,Ue=-1,be=-1,ke,qe;if(Ve.forEach((Qe,nt)=>{let{count:st,width:Pe}=Qe;if(st>0){let Ke=0;for(let lt=st;lt--&&Qe.glyphAt(lt).glyphObj.isWhitespace;)Ke++;let rt=0,ye=0;if(L==="center")rt=(de-Pe)/2;else if(L==="right")rt=de-Pe;else if(L==="justify"&&Qe.isSoftWrapped){let lt=0;for(let Je=st-Ke;Je--;)Qe.glyphAt(Je).glyphObj.isWhitespace&&lt++;ye=(de-Pe)/lt}if(ye||rt){let lt=0;for(let Je=0;Je<st;Je++){let Ae=Qe.glyphAt(Je);const We=Ae.glyphObj;Ae.x+=rt+lt,ye!==0&&We.isWhitespace&&Je<st-Ke&&(lt+=ye,Ae.width+=ye)}}const $e=e.getReorderSegments(b,Te,Qe.glyphAt(0).charIndex,Qe.glyphAt(Qe.count-1).charIndex);for(let lt=0;lt<$e.length;lt++){const[Je,Ae]=$e[lt];let We=1/0,De=-1/0;for(let Ne=0;Ne<st;Ne++)if(Qe.glyphAt(Ne).charIndex>=Je){let ot=Ne,dt=Ne;for(;dt<st;dt++){let Pt=Qe.glyphAt(dt);if(Pt.charIndex>Ae)break;dt<st-Ke&&(We=Math.min(We,Pt.x),De=Math.max(De,Pt.x+Pt.width))}for(let Pt=ot;Pt<dt;Pt++){const kt=Qe.glyphAt(Pt);kt.x=De-(kt.x+kt.width-We)}break}}let Ze;const ft=lt=>Ze=lt;for(let lt=0;lt<st;lt++){const Je=Qe.glyphAt(lt);Ze=Je.glyphObj;const Ae=Ze.index,We=Te.levels[Je.charIndex]&1;if(We){const De=e.getMirroredCharacter(b[Je.charIndex]);De&&Je.fontData.fontObj.forEachGlyph(De,0,0,ft)}if(ne){const{charIndex:De,fontData:Ne}=Je,ot=Je.x+Y,dt=Je.x+Je.width+Y;he[De*4]=We?dt:ot,he[De*4+1]=We?ot:dt,he[De*4+2]=Qe.baseline+Ne.caretBottom+xe,he[De*4+3]=Qe.baseline+Ne.caretTop+xe;const Pt=De-Ue;Pt>1&&f(he,Ue,Pt),Ue=De}if(z){const{charIndex:De}=Je;for(;De>be;)be++,z.hasOwnProperty(be)&&(qe=z[be])}if(!Ze.isWhitespace&&!Ze.isEmpty){const De=ge++,{fontSizeMult:Ne,src:ot,index:dt}=Je.fontData,Pt=K[ot]||(K[ot]={});Pt[Ae]||(Pt[Ae]={path:Ze.path,pathBounds:[Ze.xMin,Ze.yMin,Ze.xMax,Ze.yMax]});const kt=Je.x+Y,wt=Je.y+Qe.baseline+xe;re[De*2]=kt,re[De*2+1]=wt;const Vt=kt+Ze.xMin*Ne,rn=wt+Ze.yMin*Ne,Bt=kt+Ze.xMax*Ne,Gt=wt+Ze.yMax*Ne;Vt<ae[0]&&(ae[0]=Vt),rn<ae[1]&&(ae[1]=rn),Bt>ae[2]&&(ae[2]=Bt),Gt>ae[3]&&(ae[3]=Gt),De%ie===0&&(ke={start:De,end:De,rect:[1/0,1/0,-1/0,-1/0]},Se.push(ke)),ke.end++;const Dt=ke.rect;if(Vt<Dt[0]&&(Dt[0]=Vt),rn<Dt[1]&&(Dt[1]=rn),Bt>Dt[2]&&(Dt[2]=Bt),Gt>Dt[3]&&(Dt[3]=Gt),Q[De]=Ae,se[De]=dt,z){const Qt=De*3;fe[Qt]=qe>>16&255,fe[Qt+1]=qe>>8&255,fe[Qt+2]=qe&255}}}}}),he){const Qe=b.length-Ue;Qe>1&&f(he,Ue,Qe)}}const we=[];Re.forEach(({index:Te,src:ge,unitsPerEm:Ue,ascender:be,descender:ke,lineHeight:qe,capHeight:Qe,xHeight:nt})=>{we[Te]={src:ge,unitsPerEm:Ue,ascender:be,descender:ke,lineHeight:qe,capHeight:Qe,xHeight:nt}}),F.typesetting=h()-le,j({glyphIds:Q,glyphFontIndices:se,glyphPositions:re,glyphData:K,fontData:we,caretPositions:he,glyphColors:fe,chunkedBounds:Se,fontSize:T,topBaseline:xe+Ve[0].baseline,blockBounds:[Y,xe-ue,Y+de,xe],visibleBounds:ae,timings:F})})}function l(b,_){a({...b,metricsOnly:!0},S=>{const[M,T,A,N]=S.blockBounds;_({width:A-M,height:N-T})})}function c(b){let _=b.match(/^([\d.]+)%$/),S=_?parseFloat(_[1]):NaN;return isNaN(S)?0:S/100}function f(b,_,S){const M=b[_*4],T=b[_*4+1],A=b[_*4+2],N=b[_*4+3],D=(T-M)/S;for(let k=0;k<S;k++){const O=(_+k)*4;b[O]=M+D*k,b[O+1]=M+D*(k+1),b[O+2]=A,b[O+3]=N}}function h(){return(self.performance||Date).now()}function m(){this.data=[]}const x=["glyphObj","x","y","width","charIndex","fontData"];return m.prototype={width:0,lineHeight:0,baseline:0,cap:0,ex:0,isSoftWrapped:!1,get count(){return Math.ceil(this.data.length/x.length)},glyphAt(b){let _=m.flyweight;return _.data=this.data,_.index=b,_},splitAt(b){let _=new m;return _.data=this.data.splice(b*x.length),_}},m.flyweight=x.reduce((b,_,S,M)=>(Object.defineProperty(b,_,{get(){return this.data[this.index*x.length+S]},set(T){this.data[this.index*x.length+S]=T}}),b),{data:null,index:0}),{typeset:a,measure:l}}const Ax=()=>(self.performance||Date).now(),RE=hQ();let WF;function NNe(t,e,n,r,i,s,o,a,l,c,f=!0){return f?RNe(t,e,n,r,i,s,o,a,l,c).then(null,h=>(WF||(console.warn("WebGL SDF generation failed, falling back to JS",h),WF=!0),qF(t,e,n,r,i,s,o,a,l,c))):qF(t,e,n,r,i,s,o,a,l,c)}const E2=[],kNe=5;let o7=0;function mQ(){const t=Ax();for(;E2.length&&Ax()-t<kNe;)E2.shift()();o7=E2.length?setTimeout(mQ,0):0}const RNe=(...t)=>new Promise((e,n)=>{E2.push(()=>{const r=Ax();try{RE.webgl.generateIntoCanvas(...t),e({timing:Ax()-r})}catch(i){n(i)}}),o7||(o7=setTimeout(mQ,0))}),PNe=4,INe=2e3,$F={};let DNe=0;function qF(t,e,n,r,i,s,o,a,l,c){const f="TroikaTextSDFGenerator_JS_"+DNe++%PNe;let h=$F[f];return h||(h=$F[f]={workerModule:hb({name:f,workerId:f,dependencies:[hQ,Ax],init(m,x){const b=m().javascript.generate;return function(..._){const S=x();return{textureData:b(..._),timing:x()-S}}},getTransferables(m){return[m.textureData.buffer]}}),requests:0,idleTimer:null}),h.requests++,clearTimeout(h.idleTimer),h.workerModule(t,e,n,r,i,s).then(({textureData:m,timing:x})=>{const b=Ax(),_=new Uint8Array(m.length*4);for(let S=0;S<m.length;S++)_[S*4+c]=m[S];return RE.webglUtils.renderImageData(o,_,a,l,t,e,1<<3-c),x+=Ax()-b,--h.requests===0&&(h.idleTimer=setTimeout(()=>{dNe(f)},INe)),{timing:x}})}function ONe(t){t._warm||(RE.webgl.isSupported(t),t._warm=!0)}const LNe=RE.webglUtils.resizeWebGLCanvasWithoutClearing,nw={unicodeFontsURL:null,sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},jNe=new Rn;function M1(){return(self.performance||Date).now()}const XF=Object.create(null);function gQ(t,e){t=UNe({},t);const n=M1(),r=[];if(t.font&&r.push({label:"user",src:BNe(t.font)}),t.font=r,t.text=""+t.text,t.sdfGlyphSize=t.sdfGlyphSize||nw.sdfGlyphSize,t.unicodeFontsURL=t.unicodeFontsURL||nw.unicodeFontsURL,t.colorRanges!=null){let m={};for(let x in t.colorRanges)if(t.colorRanges.hasOwnProperty(x)){let b=t.colorRanges[x];typeof b!="number"&&(b=jNe.set(b).getHex()),m[x]=b}t.colorRanges=m}Object.freeze(t);const{textureWidth:i,sdfExponent:s}=nw,{sdfGlyphSize:o}=t,a=i/o*4;let l=XF[o];if(!l){const m=document.createElement("canvas");m.width=i,m.height=o*256/a,l=XF[o]={glyphCount:0,sdfGlyphSize:o,sdfCanvas:m,sdfTexture:new fo(m,void 0,void 0,void 0,as,as),contextLost:!1,glyphsByFont:new Map},l.sdfTexture.generateMipmaps=!1,zNe(l)}const{sdfTexture:c,sdfCanvas:f}=l;yQ(t).then(m=>{const{glyphIds:x,glyphFontIndices:b,fontData:_,glyphPositions:S,fontSize:M,timings:T}=m,A=[],N=new Float32Array(x.length*4);let D=0,k=0;const O=M1(),R=_.map(G=>{let Z=l.glyphsByFont.get(G.src);return Z||l.glyphsByFont.set(G.src,Z=new Map),Z});x.forEach((G,Z)=>{const V=b[Z],{src:W,unitsPerEm:J}=_[V];let ne=R[V].get(G);if(!ne){const{path:F,pathBounds:ce}=m.glyphData[W][G],oe=Math.max(ce[2]-ce[0],ce[3]-ce[1])/o*(nw.sdfMargin*o+.5),Q=l.glyphCount++,se=[ce[0]-oe,ce[1]-oe,ce[2]+oe,ce[3]+oe];R[V].set(G,ne={path:F,atlasIndex:Q,sdfViewBox:se}),A.push(ne)}const{sdfViewBox:ie}=ne,z=S[k++],j=S[k++],X=M/J;N[D++]=z+ie[0]*X,N[D++]=j+ie[1]*X,N[D++]=z+ie[2]*X,N[D++]=j+ie[3]*X,x[Z]=ne.atlasIndex}),T.quads=(T.quads||0)+(M1()-O);const L=M1();T.sdf={};const B=f.height,H=Math.ceil(l.glyphCount/a),$=Math.pow(2,Math.ceil(Math.log2(H*o)));$>B&&(console.info(`Increasing SDF texture size ${B}->${$}`),LNe(f,i,$),c.dispose()),Promise.all(A.map(G=>xQ(G,l,t.gpuAccelerateSDF).then(({timing:Z})=>{T.sdf[G.atlasIndex]=Z}))).then(()=>{A.length&&!l.contextLost&&(vQ(l),c.needsUpdate=!0),T.sdfTotal=M1()-L,T.total=M1()-n,e(Object.freeze({parameters:t,sdfTexture:c,sdfGlyphSize:o,sdfExponent:s,glyphBounds:N,glyphAtlasIndices:x,glyphColors:m.glyphColors,caretPositions:m.caretPositions,chunkedBounds:m.chunkedBounds,ascender:m.ascender,descender:m.descender,lineHeight:m.lineHeight,capHeight:m.capHeight,xHeight:m.xHeight,topBaseline:m.topBaseline,blockBounds:m.blockBounds,visibleBounds:m.visibleBounds,timings:m.timings}))})}),Promise.resolve().then(()=>{l.contextLost||ONe(f)})}function xQ({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}=nw,c=Math.max(n[2]-n[0],n[3]-n[1]),f=Math.floor(e/4),h=f%(a/r)*r,m=Math.floor(f/(a/r))*r,x=e%4;return NNe(r,r,t,n,c,l,i,h,m,x,o)}function zNe(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(xQ(s,t,!0))})}),Promise.all(r).then(()=>{vQ(t),t.sdfTexture.needsUpdate=!0})})}function FNe({font:t,characters:e,sdfGlyphSize:n},r){let i=Array.isArray(e)?e.join(`
`):""+e;gQ({font:t,sdfGlyphSize:n,text:i},r)}function UNe(t,e){for(let n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}let i2;function BNe(t){return i2||(i2=typeof document>"u"?{}:document.createElement("a")),i2.href=t,i2.href}function vQ(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 HNe=hb({name:"Typesetter",dependencies:[ANe,ENe,hNe],init(t,e,n){return t(e,n())}}),yQ=hb({name:"Typesetter",dependencies:[HNe],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}});yQ.onMainThread;const YF={};function GNe(t){let e=YF[t];return e||(e=YF[t]=new Wp(1,1,t,t).translate(.5,.5,0)),e}const VNe="aTroikaGlyphBounds",KF="aTroikaGlyphIndex",WNe="aTroikaGlyphColor";class $Ne 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 ea,this.boundingBox=new Fo}computeBoundingSphere(){}computeBoundingBox(){}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let n=GNe(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(VNe,e,4),this.updateAttributeData(KF,n,1),this.updateAttributeData(WNe,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,f=i/2,h=i*2,m=Math.abs(n),x=e[0]/m,b=e[2]/m,_=s((x+f)/h)!==s((b+f)/h)?-m:o(l(x)*m,l(b)*m),S=s((x-f)/h)!==s((b-f)/h)?m:a(l(x)*m,l(b)*m),M=s((x+i)/h)!==s((b+i)/h)?m*2:a(m-c(x)*m,m-c(b)*m);r.min.set(_,e[1],n<0?-M:0),r.max.set(S,e[3],n<0?0:M)}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(KF).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 Ux(n,r)),delete this._maxInstanceCount,this.dispose()):i&&this.deleteAttribute(e)}}const qNe=`
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;
`,XNe=`
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);
`,YNe=`
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;
}
`,KNe=`
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 ZNe(t){const e=s7(t,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new qt},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new pi(0,0,0,0)},uTroikaClipRect:{value:new pi(0,0,0,0)},uTroikaEdgeOffset:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new qt},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Rn},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Er},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:qNe,vertexTransform:XNe,fragmentDefs:YNe,fragmentColorTransform:KNe,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(pQ,`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 AI=new Vp({color:16777215,side:uu,transparent:!0}),ZF=8421504,QF=new pr,s2=new Ge,UN=new Ge,B_=[],QNe=new Ge,BN="+x+y";function JF(t){return Array.isArray(t)?t[0]:t}let bQ=()=>{const t=new Xs(new Wp(1,1),AI);return bQ=()=>t,t},_Q=()=>{const t=new Xs(new Wp(1,1,32,1),AI);return _Q=()=>t,t};const JNe={type:"syncstart"},eke={type:"synccomplete"},wQ=["font","fontSize","fontStyle","fontWeight","lang","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],tke=wQ.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let SQ=class extends Xs{constructor(){const e=new $Ne;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=ZF,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=BN,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(JNe),gQ({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(eke),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 ZNe(e)}get material(){let e=this._derivedMaterial;const n=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=AI.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 JF(this.material).getDepthMaterial()}set customDepthMaterial(e){}get customDistanceMaterial(){return JF(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,f=0,h=0,m,x,b,_=0,S=0;if(n){let{outlineWidth:T,outlineOffsetX:A,outlineOffsetY:N,outlineBlur:D,outlineOpacity:k}=this;c=this._parsePercent(T)||0,f=Math.max(0,this._parsePercent(D)||0),m=k,_=this._parsePercent(A)||0,S=this._parsePercent(N)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(b=this.strokeColor,r.uTroikaStrokeColor.value.set(b??ZF),x=this.strokeOpacity,x==null&&(x=1)),m=this.fillOpacity;r.uTroikaEdgeOffset.value=c,r.uTroikaPositionOffset.value.set(_,S),r.uTroikaBlurRadius.value=f,r.uTroikaStrokeWidth.value=h,r.uTroikaStrokeOpacity.value=x,r.uTroikaFillOpacity.value=m??1,r.uTroikaCurveRadius.value=this.curveRadius||0;let M=this.clipRect;if(M&&Array.isArray(M)&&M.length===4)r.uTroikaClipRect.value.fromArray(M);else{const T=(this.fontSize||.1)*100;r.uTroikaClipRect.value.set(l[0]-T,l[1]-T,l[2]+T,l[3]+T)}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 Rn;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||BN;if(o!==e._orientation){let a=r.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let l=o!==BN&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,f,h,m]=l;s2.set(0,0,0)[f]=c==="-"?1:-1,UN.set(0,0,0)[m]=h==="-"?-1:1,QF.lookAt(QNe,s2.cross(UN),UN),a.setFromMatrix4(QF)}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 qt){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 qt){return s2.copy(e),this.localPositionToTextCoords(this.worldToLocal(s2),n)}raycast(e,n){const{textRenderInfo:r,curveRadius:i}=this;if(r){const s=r.blockBounds,o=i?_Q():bQ(),a=o.geometry,{position:l,uv:c}=a.attributes;for(let f=0;f<c.count;f++){let h=s[0]+c.getX(f)*(s[2]-s[0]);const m=s[1]+c.getY(f)*(s[3]-s[1]);let x=0;i&&(x=i-Math.cos(h/i)*i,h=Math.sin(h/i)*i),l.setXYZ(f,h,m,x)}a.boundingSphere=this.geometry.boundingSphere,a.boundingBox=this.geometry.boundingBox,o.matrixWorld=this.matrixWorld,o.material.side=this.material.side,B_.length=0,o.raycast(e,B_);for(let f=0;f<B_.length;f++)B_[f].object=this,n.push(B_[f])}}copy(e){const n=this.geometry;return super.copy(e),this.geometry=n,tke.forEach(r=>{this[r]=e[r]}),this}clone(){return new this.constructor().copy(this)}};wQ.forEach(t=>{const e="_private_"+t;Object.defineProperty(SQ.prototype,t,{get(){return this[e]},set(n){n!==this[e]&&(this[e]=n,this._needsSync=!0)}})});new Fo;new Rn;const Co=w.forwardRef(({sdfGlyphSize:t=64,anchorX:e="center",anchorY:n="middle",font:r,fontSize:i=1,children:s,characters:o,onSync:a,...l},c)=>{const f=Dc(({invalidate:b})=>b),[h]=w.useState(()=>new SQ),[m,x]=w.useMemo(()=>{const b=[];let _="";return w.Children.forEach(s,S=>{typeof S=="string"||typeof S=="number"?_+=S:b.push(S)}),[b,_]},[s]);return jAe(()=>new Promise(b=>FNe({font:r,characters:o},b)),["troika-text",r,o]),w.useLayoutEffect(()=>void h.sync(()=>{f(),a&&a(h)})),w.useEffect(()=>()=>h.dispose(),[h]),w.createElement("primitive",yh({object:h,ref:c,font:r,text:x,anchorX:e,anchorY:n,fontSize:i,sdfGlyphSize:t},l),m)}),D0=w.forwardRef(({threshold:t=15,geometry:e,...n},r)=>{const i=w.useRef(null);w.useImperativeHandle(r,()=>i.current,[]);const s=w.useMemo(()=>[0,0,0,1,0,0],[]),o=w.useRef(null),a=w.useRef(null);return w.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 JP(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()}),w.createElement(oNe,yh({segments:!0,points:s,ref:i,raycast:()=>null},n))}),nke=w.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},f)=>{const h=Dc(k=>k.invalidate),m=Dc(k=>k.camera),x=Dc(k=>k.gl),b=Dc(k=>k.events),_=Dc(k=>k.setEvents),S=Dc(k=>k.set),M=Dc(k=>k.get),T=Dc(k=>k.performance),A=e||m,N=r||b.connected||x.domElement,D=w.useMemo(()=>new nNe(A),[A]);return NE(()=>{D.enabled&&D.update()},-1),w.useEffect(()=>(s&&D.connect(s===!0?N:s),D.connect(N),()=>void D.dispose()),[s,N,n,D,h]),w.useEffect(()=>{const k=L=>{h(),n&&T.regress(),o&&o(L)},O=L=>{a&&a(L)},R=L=>{l&&l(L)};return D.addEventListener("change",k),D.addEventListener("start",O),D.addEventListener("end",R),()=>{D.removeEventListener("start",O),D.removeEventListener("end",R),D.removeEventListener("change",k)}},[o,a,l,D,h,_]),w.useEffect(()=>{if(t){const k=M().controls;return S({controls:D}),()=>S({controls:k})}},[t,D]),w.createElement("primitive",yh({ref:f,object:D,enableDamping:i},c))}),Yf=1e-5;function rke(t,e,n){const r=new m0,i=n-Yf;return r.absarc(Yf,Yf,Yf,-Math.PI/2,-Math.PI,!0),r.absarc(Yf,e-i*2,Yf,Math.PI,Math.PI/2,!0),r.absarc(t-i*2,e-i*2,Yf,Math.PI/2,0,!0),r.absarc(t-i*2,Yf,Yf,0,-Math.PI/2,!0),r}const dd=w.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,...f},h){return w.createElement("mesh",yh({ref:h},f),w.createElement(ike,{args:[e,n,r],radius:i,steps:s,smoothness:o,bevelSegments:a,creaseAngle:l}),c)}),ike=w.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},f){const h=w.useMemo(()=>rke(e,n,i),[e,n,i]),m=w.useMemo(()=>({depth:r-i*2,bevelEnabled:!0,bevelSegments:a*2,steps:s,bevelSize:i-Yf,bevelThickness:i,curveSegments:o}),[r,i,o,a,s]),x=w.useRef(null);return w.useLayoutEffect(()=>{x.current&&(x.current.center(),X6e(x.current,l))},[h,m,l]),w.useImperativeHandle(f,()=>x.current),w.createElement("extrudeGeometry",yh({ref:x,args:[h,m]},c))});function yi(t){return!t||typeof t!="object"||Array.isArray(t)?null:t}function Lr(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 Ea(t){return typeof t=="string"?t:""}function HN(t){return!!t}function NI(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 yi(e)}function MQ(t){if(!t)return null;const e=NI(t.setup);if(!e)return null;const n=Ea(e.model),r=Ea(e.schema_version),i=yi(e.cluster);if(!i)return null;const s=Array.isArray(i.nodes)?i.nodes:[],o=yi(e.trainer),a=yi(e.inference),l=new Map,c=Array.isArray(o==null?void 0:o.nodes)?o.nodes:[];for(const m of c){const x=yi(m);if(!x)continue;const b=Lr(x.node_id);if(b===null)continue;const _=Array.isArray(x.gpus)?x.gpus:[];for(const S of _){const M=yi(S);if(!M)continue;const T=Lr(M.gpu_index);T!==null&&l.set(`${b}-${T}`,{role:"trainer",gpu_index:T,rank:Lr(M.rank)??void 0,dp_rank:Lr(M.dp_rank)??void 0,tp_rank:Lr(M.tp_rank)??void 0,pp_rank:Lr(M.pp_rank)??void 0})}}const f=Array.isArray(a==null?void 0:a.nodes)?a.nodes:[];for(const m of f){const x=yi(m);if(!x)continue;const b=Lr(x.node_id);if(b===null)continue;const _=Array.isArray(x.gpus)?x.gpus:[];for(const S of _){const M=yi(S);if(!M)continue;const T=Lr(M.gpu_index);T!==null&&l.set(`${b}-${T}`,{role:"inference",gpu_index:T,server_idx:Lr(M.server_idx)??void 0,tp_group_id:Lr(M.tp_group_id)??void 0,port:Lr(M.port)??void 0,url:Ea(M.url)||void 0})}}const h=[];for(const m of s){const x=yi(m);if(!x)continue;const b=Lr(x.node_id)??0,_=yi(x.hardware),S=yi(_==null?void 0:_.cpu),M={model:Ea(S==null?void 0:S.model),cores:Lr(S==null?void 0:S.cores)??0,logical_cores:Lr(S==null?void 0:S.logical_cores)??0,sockets:Lr(S==null?void 0:S.sockets)??1,architecture:Ea(S==null?void 0:S.architecture),frequency_mhz:Lr(S==null?void 0:S.frequency_mhz)??0},T=yi(_==null?void 0:_.memory),A={total_gb:Lr(T==null?void 0:T.total_gb)??0},N=yi(_==null?void 0:_.gpu),k=(Array.isArray(N==null?void 0:N.devices)?N.devices:[]).map((G,Z)=>{const V=yi(G),W=Z,J=`${b}-${W}`,ne=l.get(J)??{role:"unassigned",gpu_index:W};return{hardware:{name:Ea(V==null?void 0:V.name),memory_total_gb:Lr(V==null?void 0:V.memory_total_gb)??0,pcie_gen:Lr(V==null?void 0:V.pcie_gen)??0,pcie_width:Lr(V==null?void 0:V.pcie_width)??0,serial:Ea(V==null?void 0:V.serial),uuid:Ea(V==null?void 0:V.uuid)},role:ne,local_index:W}}),O=yi(N==null?void 0:N.interconnect),R=O?{nvlink:HN(O.nvlink),topology:Ea(O.topology),links_per_gpu:Lr(O.links_per_gpu)??0,speed_gbps:Lr(O.speed_gbps)??0,connections:Lr(O.connections)??0}:null,L=yi(x.software),B=yi(L==null?void 0:L.os),H=yi(L==null?void 0:L.container),$=yi(L==null?void 0:L.packages);h.push({node_id:b,hostname:Ea(x.hostname),ip:Ea(x.ip),is_driver:HN(x.is_driver),cpu:M,memory:A,gpus:k,interconnect:R,os:Ea(B==null?void 0:B.platform),container:H?{runtime:Ea(H.runtime),is_container:HN(H.is_container)}:null,software:{cuda:Ea($==null?void 0:$.cuda),pytorch:Ea($==null?void 0:$.pytorch),python:Ea($==null?void 0:$.python)}})}return{model:n,schema_version:r,nodes:h,total_gpus:Lr(i.total_gpus)??0,trainer_total_gpus:Lr(o==null?void 0:o.total_gpus)??0,inference_total_gpus:Lr(a==null?void 0:a.total_gpus)??0,trainer_config:o?{data_parallel_size:Lr(o.data_parallel_size)??0,megatron_tensor_parallel_size:Lr(o.megatron_tensor_parallel_size)??0,megatron_pipeline_parallel_size:Lr(o.megatron_pipeline_parallel_size)??0,backend:Ea(o.backend),world_size:Lr(o.world_size)??0}:null,inference_config:a?{num_servers:Lr(a.num_servers)??0,tensor_parallel_size:Lr(a.tensor_parallel_size)??0,placement_strategy:Ea(a.placement_strategy)}:null}}const ske={trainer:"#2563eb",inference:"#dc2626",unassigned:"#111111",nvlink:"#c7d5f0",nvlinkDot:"#f0f0f0",platform:"#ffffff",platformBorder:"#111111",gpuBody:"#ffffff",gpuBodyHover:"#ffffff",moduleBody:"#ffffff",moduleBodyHover:"#ffffff",chip:"#ffffff",chipBorder:"#ededed",textBlack:"#000000",textDark:"#000000",textMuted:"#000000",textLight:"#000000",background:"#ffffff",gridColor:"#ffffff"},oke={trainer:"#3b82f6",inference:"#ef4444",unassigned:"#d4d4d4",nvlink:"#3b5998",nvlinkDot:"#4a4a4a",platform:"#1e1e1e",platformBorder:"#555555",gpuBody:"#2a2a2a",gpuBodyHover:"#333333",moduleBody:"#2a2a2a",moduleBodyHover:"#333333",chip:"#2a2a2a",chipBorder:"#444444",textBlack:"#e5e5e5",textDark:"#e5e5e5",textMuted:"#a3a3a3",textLight:"#d4d4d4",background:"#141414",gridColor:"#141414"};function Eu(){return Kn(us)?oke:ske}function ake(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 lke({position:t,gpu:e,nodeId:n,onHover:r,onUnhover:i,onClick:s,isHovered:o}){const a=Eu(),l=e.role.role==="trainer"?a.trainer:e.role.role==="inference"?a.inference:a.unassigned,c=e.role.role==="trainer"?"Trainer":e.role.role==="inference"?"Inference":"",{brand:f,model:h}=ake(e.hardware.name),m=.095;return d.jsxs("group",{position:t,children:[d.jsxs(dd,{args:[.95,.18,.6],radius:0,smoothness:4,onPointerOver:x=>{x.stopPropagation(),r()},onPointerOut:i,onClick:x=>{x.stopPropagation(),s()},children:[d.jsx("meshBasicMaterial",{color:o?a.gpuBodyHover:a.gpuBody}),d.jsx(D0,{color:a.platformBorder,threshold:1,scale:1.002})]}),e.role.role!=="unassigned"&&d.jsxs(d.Fragment,{children:[d.jsxs("mesh",{position:[-.34,m-.003,-.2],rotation:[-Math.PI/2,0,0],children:[d.jsx("planeGeometry",{args:[.055,.055]}),d.jsx("meshStandardMaterial",{color:l,side:uu})]}),d.jsx(Co,{position:[-.285,m,-.2],rotation:[-Math.PI/2,0,0],fontSize:.04,color:a.textBlack,anchorX:"left",anchorY:"middle",children:c})]}),d.jsx(Co,{position:[0,m,-.04],rotation:[-Math.PI/2,0,0],fontSize:.055,color:a.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:f}),d.jsx(Co,{position:[0,m,.07],rotation:[-Math.PI/2,0,0],fontSize:.07,color:a.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:h}),d.jsx(Co,{position:[.4,m,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:a.textBlack,anchorX:"right",anchorY:"middle",children:`GPU ${e.local_index}`}),e.role.rank!==void 0&&d.jsx(Co,{position:[-.4,m,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:a.textBlack,anchorX:"left",anchorY:"middle",children:`Rank ${e.role.rank}`}),e.role.server_idx!==void 0&&d.jsx(Co,{position:[-.4,m,.2],rotation:[-Math.PI/2,0,0],fontSize:.032,color:a.textBlack,anchorX:"left",anchorY:"middle",children:`Server ${e.role.server_idx}`}),o&&d.jsx(TI,{position:[0,.35,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:d.jsxs("div",{className:"bg-background border border-foreground rounded-none px-3 py-2 min-w-[180px]",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-1",children:e.hardware.name}),d.jsxs("div",{className:"text-[10px] text-foreground space-y-0.5",children:[d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"VRAM"}),d.jsxs("span",{className:"font-mono",children:[e.hardware.memory_total_gb," GB"]})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"PCIe"}),d.jsxs("span",{className:"font-mono",children:["Gen",e.hardware.pcie_gen," x",e.hardware.pcie_width]})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Role"}),d.jsxs("span",{className:"font-semibold",style:{color:l},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})`]})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Node"}),d.jsxs("span",{className:"font-mono",children:["#",n]})]})]})]})})]})}function cke({position:t,memoryGb:e,isHovered:n,onHover:r,onUnhover:i}){const s=Eu(),o=.063;return d.jsxs("group",{position:t,children:[d.jsxs(dd,{args:[.85,.12,.35],radius:0,smoothness:4,onPointerOver:a=>{a.stopPropagation(),r()},onPointerOut:i,children:[d.jsx("meshBasicMaterial",{color:n?s.moduleBodyHover:s.moduleBody}),d.jsx(D0,{color:s.platformBorder,threshold:1,scale:1.002})]}),d.jsx(Co,{position:[0,o,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:s.textBlack,anchorX:"center",anchorY:"middle",children:"VRAM"}),d.jsx(Co,{position:[0,o,.05],rotation:[-Math.PI/2,0,0],fontSize:.055,color:s.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`${e}GB`})]})}function uke(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 dke({position:t,cpu:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const o=Eu(),a=uke(e.model);return d.jsxs("group",{position:t,children:[d.jsxs(dd,{args:[.6,.08,.6],radius:0,smoothness:4,onPointerOver:l=>{l.stopPropagation(),r()},onPointerOut:i,onClick:l=>{l.stopPropagation(),s()},children:[d.jsx("meshBasicMaterial",{color:n?o.gpuBodyHover:o.chip}),d.jsx(D0,{color:o.platformBorder,threshold:1,scale:1.002})]}),d.jsxs("mesh",{position:[0,.041,0],children:[d.jsx("boxGeometry",{args:[.45,.005,.45]}),d.jsx("meshBasicMaterial",{color:o.platform}),d.jsx(D0,{color:o.platformBorder,threshold:1,scale:1.002})]}),d.jsx(Co,{position:[0,.05,-.12],rotation:[-Math.PI/2,0,0],fontSize:.032,color:o.textBlack,anchorX:"center",anchorY:"middle",children:a}),d.jsx(Co,{position:[0,.05,0],rotation:[-Math.PI/2,0,0],fontSize:.045,color:o.textBlack,anchorX:"center",anchorY:"middle",children:"CPU"}),d.jsx(Co,{position:[0,.05,.1],rotation:[-Math.PI/2,0,0],fontSize:.028,color:o.textBlack,anchorX:"center",anchorY:"middle",children:`${e.cores}C / ${e.logical_cores}T`}),n&&d.jsx(TI,{position:[0,.3,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:d.jsxs("div",{className:"bg-background border border-foreground rounded-none px-3 py-2 min-w-[180px]",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-1",children:e.model}),d.jsxs("div",{className:"text-[10px] text-foreground space-y-0.5",children:[d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Cores"}),d.jsx("span",{className:"font-mono",children:e.cores})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Threads"}),d.jsx("span",{className:"font-mono",children:e.logical_cores})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Sockets"}),d.jsx("span",{className:"font-mono",children:e.sockets})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Frequency"}),d.jsxs("span",{className:"font-mono",children:[(e.frequency_mhz/1e3).toFixed(2)," GHz"]})]}),d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Arch"}),d.jsx("span",{className:"font-mono",children:e.architecture})]})]})]})})]})}function fke({position:t,memory:e,isHovered:n,onHover:r,onUnhover:i,onClick:s}){const o=Eu(),a=.063;return d.jsxs("group",{position:t,children:[d.jsxs(dd,{args:[.6,.12,.35],radius:0,smoothness:4,onPointerOver:l=>{l.stopPropagation(),r()},onPointerOut:i,onClick:l=>{l.stopPropagation(),s()},children:[d.jsx("meshBasicMaterial",{color:n?o.moduleBodyHover:o.moduleBody}),d.jsx(D0,{color:o.platformBorder,threshold:1,scale:1.002})]}),d.jsx(Co,{position:[0,a,-.06],rotation:[-Math.PI/2,0,0],fontSize:.035,color:o.textBlack,anchorX:"center",anchorY:"middle",children:"RAM"}),d.jsx(Co,{position:[0,a,.05],rotation:[-Math.PI/2,0,0],fontSize:.045,color:o.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`${Math.round(e.total_gb)}GB`}),n&&d.jsx(TI,{position:[0,.3,0],center:!0,distanceFactor:5,style:{pointerEvents:"none"},children:d.jsxs("div",{className:"bg-background border border-foreground rounded-none px-3 py-2 min-w-[140px]",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-1",children:"System Memory"}),d.jsx("div",{className:"text-[10px] text-foreground space-y-0.5",children:d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:"Total"}),d.jsxs("span",{className:"font-mono",children:[e.total_gb.toFixed(0)," GB"]})]})})]})})]})}function hke({vramPositions:t,vramDepth:e,interconnect:n}){const r=Eu();if(!(n!=null&&n.nvlink)||t.length<2)return null;const i=[...t].sort((m,x)=>m[0]-x[0]),s=i[0][0],o=i[i.length-1][0],a=(s+o)/2,l=o-s,f=t[0][2]-e/2-.18,h=.065;return d.jsxs("group",{children:[d.jsx(dd,{args:[l,.02,.035],radius:.002,smoothness:4,position:[a,h,f],children:d.jsx("meshBasicMaterial",{color:r.nvlink})}),t.map((m,x)=>{const b=m[2]-e/2,_=Math.abs(b-f),S=(b+f)/2;return d.jsx("group",{children:d.jsx(dd,{args:[.02,.02,_],radius:.001,smoothness:2,position:[m[0],h,S],children:d.jsx("meshBasicMaterial",{color:r.nvlink})})},x)}),d.jsx(Co,{position:[a,.035,f-.15],rotation:[-Math.PI/2,0,0],fontSize:.06,color:r.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,children:`NVLink · ${n.links_per_gpu} links/GPU · ${n.speed_gbps} Gbps`})]})}function pke({node:t,position:e,hoveredItem:n,setHoveredItem:r,setSelectedItem:i}){const s=Eu(),o=t.gpus.length,a=1.15,l=o*a,c=Math.max(l+1.8,3.5),f=3.2,h=.6,m=.35,x=.6,b=.06,_=-.15,S=_-h/2-b-m/2,M=_+h/2+.08,T=M+.4+x/2,A=t.gpus.map((D,k)=>[k*a-(l-a)/2,.14,_]),N=t.gpus.map((D,k)=>[k*a-(l-a)/2,.11,S]);return d.jsxs("group",{position:e,children:[d.jsxs(dd,{args:[c,.06,f],radius:0,smoothness:4,children:[d.jsx("meshBasicMaterial",{color:s.platform}),d.jsx(D0,{color:s.platformBorder,threshold:1,scale:1.002})]}),d.jsxs(Co,{position:[0,.04,-f/2+.15],rotation:[-Math.PI/2,0,0],fontSize:.09,color:s.textBlack,anchorX:"center",anchorY:"middle",children:[`Node ${t.node_id}`,t.is_driver?" (Driver)":""]}),d.jsx(Co,{position:[0,.04,-f/2+.3],rotation:[-Math.PI/2,0,0],fontSize:.05,color:s.textBlack,anchorX:"center",anchorY:"middle",children:`${t.hostname} · ${t.ip}`}),t.gpus.map((D,k)=>{const O=A[k],R=[e[0]+O[0],e[1]+O[1],e[2]+O[2]];return d.jsxs("group",{children:[d.jsx(lke,{position:O,gpu:D,nodeId:t.node_id,isHovered:n===`gpu-${t.node_id}-${D.local_index}`,onHover:()=>r(`gpu-${t.node_id}-${D.local_index}`),onUnhover:()=>r(null),onClick:()=>i({type:"gpu",nodeId:t.node_id,gpuIndex:D.local_index,data:D,worldPosition:R})}),d.jsx(cke,{position:N[k],memoryGb:D.hardware.memory_total_gb,isHovered:n===`vram-${t.node_id}-${D.local_index}`,onHover:()=>r(`vram-${t.node_id}-${D.local_index}`),onUnhover:()=>r(null)})]},k)}),d.jsx(hke,{vramPositions:N,vramDepth:m,interconnect:t.interconnect}),(()=>{const D=[0,.09,T],k=[.75,.11,T],O=[e[0]+D[0],e[1]+D[1],e[2]+D[2]],R=[e[0]+k[0],e[1]+k[1],e[2]+k[2]];return d.jsxs(d.Fragment,{children:[d.jsx(dke,{position:D,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:O})}),d.jsx(fke,{position:k,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:R})})]})})(),(()=>{var J,ne;const D=((J=t.gpus[0])==null?void 0:J.hardware.pcie_gen)??0,k=((ne=t.gpus[0])==null?void 0:ne.hardware.pcie_width)??0;if(D===0||o<1)return null;const O=[...A].sort((ie,z)=>ie[0]-z[0]),R=O[0][0],L=O[O.length-1][0],B=(R+L)/2,H=L-R,$=.065,G=M,Z=T-x/2,V=Math.abs(Z-G),W=(G+Z)/2;return d.jsxs("group",{children:[d.jsx(dd,{args:[H,.02,.035],radius:.002,smoothness:4,position:[B,$,M],children:d.jsx("meshBasicMaterial",{color:s.chipBorder})}),A.map((ie,z)=>{const j=_+h/2,X=Math.abs(M-j),F=(j+M)/2;return d.jsx("group",{children:d.jsx(dd,{args:[.02,.02,X],radius:.001,smoothness:2,position:[ie[0],$,F],children:d.jsx("meshBasicMaterial",{color:s.chipBorder})})},z)}),d.jsx(dd,{args:[.02,.02,V],radius:.001,smoothness:2,position:[0,$,W],children:d.jsx("meshBasicMaterial",{color:s.chipBorder})}),d.jsx(Co,{position:[.15,.035,W],rotation:[-Math.PI/2,0,-Math.PI/2],fontSize:.06,maxWidth:V-.1,color:s.textBlack,anchorX:"center",anchorY:"middle",fontWeight:700,textAlign:"center",children:`PCIe Gen${D} x${k}`})]})})(),(()=>{const D=[];return t.software.cuda&&D.push(`CUDA ${t.software.cuda}`),t.software.pytorch&&D.push(`PyTorch ${t.software.pytorch}`),t.software.python&&D.push(`Python ${t.software.python}`),D.length===0?null:d.jsx(Co,{position:[0,.035,f/2-.1],rotation:[-Math.PI/2,0,0],fontSize:.03,color:s.textBlack,anchorX:"center",anchorY:"middle",children:D.join(" · ")})})()]})}function TQ(){const t=Eu();return d.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,-.05,0],children:[d.jsx("planeGeometry",{args:[50,50]}),d.jsx("meshBasicMaterial",{color:t.background})]})}function mke({node:t,position:e,onClick:n}){const r=Eu(),[i,s]=w.useState(!1),o=w.useRef(null);w.useEffect(()=>()=>{document.body.style.cursor="auto"},[]);const a=t.gpus.filter(_=>_.role.role==="trainer").length,l=t.gpus.filter(_=>_.role.role==="inference").length,c=t.gpus.length,f=(()=>{const _=[`${c} GPUs`],S=[];return a>0&&S.push(`${a}T`),l>0&&S.push(`${l}I`),S.length>0&&_.push(S.join(" ")),_.join(" · ")})(),h=2.5,m=1.5,x=.5,b=x/2+.005;return NE(()=>{if(!o.current)return;const _=i?e[1]+.06:e[1];o.current.position.y+=(_-o.current.position.y)*.15}),d.jsxs("group",{ref:o,position:e,children:[d.jsxs(dd,{args:[h,x,m],radius:0,smoothness:4,onPointerOver:_=>{_.stopPropagation(),s(!0),document.body.style.cursor="pointer"},onPointerOut:()=>{s(!1),document.body.style.cursor="auto"},onClick:_=>{_.stopPropagation(),document.body.style.cursor="auto",n()},children:[d.jsx("meshBasicMaterial",{color:r.platform}),d.jsx(D0,{color:i?r.trainer:r.platformBorder,threshold:1,scale:1.002})]}),t.gpus.map((_,S)=>{const N=-(c*.18+(c-1)*.06)/2+.18/2+S*(.18+.06),D=_.role.role==="trainer"?r.trainer:_.role.role==="inference"?r.inference:r.unassigned;return d.jsxs("mesh",{position:[N,x/2+.025,-.15],children:[d.jsx("boxGeometry",{args:[.18,.04,.22]}),d.jsx("meshBasicMaterial",{color:D})]},S)}),d.jsxs(Co,{position:[-h/2+.15,b,-m/2+.15],rotation:[-Math.PI/2,0,0],fontSize:.12,color:r.textBlack,anchorX:"left",anchorY:"middle",fontWeight:700,children:[`Node ${t.node_id}`,t.is_driver?"  DRIVER":""]}),d.jsx(Co,{position:[-h/2+.15,b,-m/2+.35],rotation:[-Math.PI/2,0,0],fontSize:.07,color:r.textBlack,anchorX:"left",anchorY:"middle",children:t.hostname}),d.jsx(Co,{position:[-h/2+.15,b,.25],rotation:[-Math.PI/2,0,0],fontSize:.08,color:r.textBlack,anchorX:"left",anchorY:"middle",children:f}),d.jsx(Co,{position:[-h/2+.15,b,.45],rotation:[-Math.PI/2,0,0],fontSize:.06,color:r.textBlack,anchorX:"left",anchorY:"middle",children:`${t.cpu.cores}C CPU · ${Math.round(t.memory.total_gb)}GB RAM`})]})}function gke({topology:t,onSelectNode:e}){const n=Eu(),r=n.background==="#ffffff"?"#ffffff":"#888888",i=n.background==="#ffffff"?"#ffffff":"#333333",s=2.5,o=1.5,a=w.useMemo(()=>{const c=[],f=Math.ceil(Math.sqrt(t.nodes.length)),h=3.2,m=2.2;return t.nodes.forEach((x,b)=>{const _=Math.floor(b/f),S=b%f,T=-(Math.min(f,t.nodes.length-_*f)-1)*h/2;c.push([S*h+T,.3,_*m])}),c},[t.nodes]),l=w.useMemo(()=>{if(a.length===0)return{w:4,d:3,cx:0,cz:0};let c=1/0,f=-1/0,h=1/0,m=-1/0;for(const[b,,_]of a)c=Math.min(c,b-s/2),f=Math.max(f,b+s/2),h=Math.min(h,_-o/2),m=Math.max(m,_+o/2);const x=.6;return{w:f-c+x*2,d:m-h+x*2,cx:(c+f)/2,cz:(h+m)/2}},[a]);return d.jsxs(d.Fragment,{children:[d.jsx("color",{attach:"background",args:[n.background]}),d.jsx("ambientLight",{intensity:.7}),d.jsx("directionalLight",{position:[8,12,5],intensity:.8}),d.jsx("directionalLight",{position:[-5,8,-5],intensity:.4}),d.jsx("hemisphereLight",{color:r,groundColor:i,intensity:.5}),d.jsx(TQ,{}),d.jsx("gridHelper",{args:[50,50,n.gridColor,n.gridColor],position:[0,-.04,0]}),d.jsxs(dd,{args:[l.w,.06,l.d],radius:0,smoothness:4,position:[l.cx,0,l.cz],children:[d.jsx("meshBasicMaterial",{color:n.platform}),d.jsx(D0,{color:n.platformBorder,threshold:1,scale:1.002})]}),t.nodes.map((c,f)=>d.jsx(mke,{node:c,position:a[f],onClick:()=>e(c.node_id)},c.node_id))]})}function xke({focusTarget:t,overviewPosition:e,overviewLookAt:n}){const{camera:r}=Dc(),i=Dc(m=>m.controls),s=w.useRef(new Ge(...e)),o=w.useRef(new Ge(...n)),a=w.useRef(!1),l=w.useRef(null),c=w.useRef(e.join(",")),f=e.join(",");w.useEffect(()=>{c.current=f,!t&&i&&(r.position.set(...e),i.target.set(...n),i.update(),a.current=!1)},[f]);const h=t?t.position.join(","):null;return w.useEffect(()=>{if(l.current=h,t){const[m,x,b]=t.position;s.current.set(m+.8,x+1.2,b+1.4),o.current.set(m,x,b),a.current=!0}else a.current=!1},[h]),NE(()=>{if(!i||!a.current)return;const m=.06;r.position.lerp(s.current,m);const x=i;x.target.lerp(o.current,m),i.update();const b=r.position.distanceTo(s.current),_=x.target.distanceTo(o.current);b<.01&&_<.01&&(r.position.copy(s.current),x.target.copy(o.current),i.update(),a.current=!1)}),null}function es({label:t,value:e,mono:n=!0}){return d.jsxs("div",{className:"flex justify-between gap-4",children:[d.jsx("span",{children:t}),d.jsx("span",{className:n?"font-mono":"",children:e})]})}function vke({topology:t,focusedItem:e,onClose:n}){const r=Eu();return d.jsx("div",{className:"absolute top-4 right-4 w-72 max-h-[calc(100%-2rem)] overflow-auto",children:e?d.jsxs("div",{className:"bg-background border border-foreground rounded-none p-4",children:[e.type==="gpu"&&(()=>{const i=e.data,s=i.role.role==="trainer"?r.trainer:i.role.role==="inference"?r.inference:r.unassigned;return d.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"GPU Details"}),d.jsx("div",{className:"font-mono text-foreground text-xs mb-1",children:i.hardware.name}),d.jsx(es,{label:"Node / Index",value:`#${e.nodeId} / GPU ${i.local_index}`}),d.jsx(es,{label:"Role",value:d.jsx("span",{className:"font-semibold",style:{color:s},children:i.role.role.charAt(0).toUpperCase()+i.role.role.slice(1)}),mono:!1}),i.role.rank!==void 0&&d.jsx(es,{label:"Rank",value:i.role.rank}),i.role.dp_rank!==void 0&&d.jsx(es,{label:"DP / TP / PP",value:`${i.role.dp_rank} / ${i.role.tp_rank} / ${i.role.pp_rank}`}),i.role.server_idx!==void 0&&d.jsx(es,{label:"Server",value:i.role.server_idx}),i.role.url&&d.jsx(es,{label:"URL",value:d.jsx("span",{className:"text-[9px]",children:i.role.url})}),d.jsx("div",{className:"border-t border-foreground mt-1.5 pt-1.5"}),d.jsx(es,{label:"VRAM",value:`${i.hardware.memory_total_gb} GB`}),d.jsx(es,{label:"PCIe",value:`Gen${i.hardware.pcie_gen} x${i.hardware.pcie_width}`}),d.jsx(es,{label:"Serial",value:d.jsx("span",{className:"text-[9px]",children:i.hardware.serial})}),d.jsx(es,{label:"UUID",value:d.jsx("span",{className:"text-[9px] break-all",children:i.hardware.uuid})})]})})(),e.type==="cpu"&&(()=>{const i=e.data;return d.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"CPU Details"}),d.jsx("div",{className:"font-mono text-foreground text-xs mb-1",children:i.model}),d.jsx(es,{label:"Node",value:`#${e.nodeId}`}),d.jsx(es,{label:"Architecture",value:i.architecture}),d.jsx(es,{label:"Cores",value:i.cores}),d.jsx(es,{label:"Logical Cores",value:i.logical_cores}),d.jsx(es,{label:"Sockets",value:i.sockets}),d.jsx(es,{label:"Frequency",value:`${(i.frequency_mhz/1e3).toFixed(2)} GHz`})]})})(),e.type==="ram"&&(()=>{const i=e.data;return d.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"System Memory"}),d.jsx(es,{label:"Node",value:`#${e.nodeId}`}),d.jsx(es,{label:"Total",value:`${i.total_gb.toFixed(0)} GB`})]})})(),d.jsx("button",{onClick:n,className:"mt-4 w-full py-1.5 text-xs font-medium text-foreground border border-foreground rounded-none hover:bg-foreground hover:text-background transition-colors",children:"Close"})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"bg-background border border-foreground rounded-none p-4 mb-3",children:[d.jsx("div",{className:"text-xs font-semibold text-foreground mb-2",children:"Cluster Overview"}),d.jsxs("div",{className:"space-y-1 text-[11px] text-foreground",children:[d.jsx(es,{label:"Model",value:d.jsx("span",{className:"text-foreground",children:t.model||"—"}),mono:!1}),d.jsx(es,{label:"Nodes",value:t.nodes.length}),d.jsx(es,{label:"Total GPUs",value:t.total_gpus}),t.trainer_config&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"border-t border-foreground mt-2 pt-2 mb-1 text-[10px] font-semibold uppercase tracking-wider",style:{color:r.trainer},children:"Trainer"}),d.jsx(es,{label:"GPUs",value:t.trainer_total_gpus}),d.jsx(es,{label:"Backend",value:t.trainer_config.backend}),d.jsx(es,{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&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"border-t border-foreground mt-2 pt-2 mb-1 text-[10px] font-semibold uppercase tracking-wider",style:{color:r.inference},children:"Inference"}),d.jsx(es,{label:"GPUs",value:t.inference_total_gpus}),d.jsx(es,{label:"Servers",value:t.inference_config.num_servers}),d.jsx(es,{label:"TP Size",value:t.inference_config.tensor_parallel_size}),d.jsx(es,{label:"Placement",value:t.inference_config.placement_strategy})]})]})]}),d.jsxs("div",{className:"bg-background border border-foreground rounded-none p-3",children:[d.jsx("div",{className:"text-[10px] font-semibold text-foreground mb-1.5",children:"Legend"}),d.jsxs("div",{className:"space-y-1",children:[d.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[d.jsx("div",{className:"w-3 h-2",style:{background:r.trainer}}),"Trainer GPU"]}),d.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[d.jsx("div",{className:"w-3 h-2",style:{background:r.inference}}),"Inference GPU"]}),d.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[d.jsx("div",{className:"w-3 h-2",style:{background:r.unassigned}}),"Unassigned GPU"]}),d.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-foreground",children:[d.jsx("div",{className:"w-3 h-1",style:{background:r.nvlink}}),"NVLink"]})]})]})]})})}function yke({topology:t,hoveredItem:e,setHoveredItem:n,setSelectedItem:r,focusedItem:i}){const s=Eu(),o=s.background==="#ffffff"?"#ffffff":"#888888",a=s.background==="#ffffff"?"#ffffff":"#333333",l=w.useMemo(()=>{const c=[],f=Math.ceil(Math.sqrt(t.nodes.length)),h=6.5,m=3.5;return t.nodes.forEach((x,b)=>{const _=Math.floor(b/f),S=b%f,T=-(Math.min(f,t.nodes.length-_*f)-1)*h/2;c.push([S*h+T,0,_*m])}),c},[t.nodes]);return d.jsxs(d.Fragment,{children:[d.jsx("color",{attach:"background",args:[s.background]}),d.jsx("ambientLight",{intensity:.7}),d.jsx("directionalLight",{position:[8,12,5],intensity:.8}),d.jsx("directionalLight",{position:[-5,8,-5],intensity:.4}),d.jsx("hemisphereLight",{color:o,groundColor:a,intensity:.5}),d.jsx(TQ,{}),d.jsx("gridHelper",{args:[50,50,s.gridColor,s.gridColor],position:[0,-.04,0]}),t.nodes.map((c,f)=>d.jsx(pke,{node:c,position:l[f],hoveredItem:i?null:e,setHoveredItem:i?()=>{}:n,setSelectedItem:i?()=>{}:r},c.node_id))]})}function bke(){const t=Eu(),{gl:e}=Dc();return w.useEffect(()=>{e.setClearColor(t.background)},[e,t.background]),null}function CQ({topology:t}){const e=Eu(),[n,r]=w.useState(null),[i,s]=w.useState(null),[o,a]=w.useState(null),l=t.nodes.length>1,c=l&&o===null,f=w.useMemo(()=>{if(!l||o===null)return t;const T=t.nodes.find(A=>A.node_id===o);return T?{...t,nodes:[T]}:t},[t,o,l]),h=w.useMemo(()=>{const T=c?t:f,A=T.nodes.length,N=Math.max(...T.nodes.map(k=>k.gpus.length),1);if(c){const k=Math.max(4,A*1.5);return[k*.6,k*.9,k*.6]}const D=Math.max(3.5,A*1.8,N*.8);return[D*.8,D*.7,D*.8]},[t,f,c]),m=w.useMemo(()=>[0,0,0],[]),x=w.useCallback(T=>{s(T),T&&r(null)},[]),b=w.useCallback(()=>{s(null)},[]),_=w.useCallback(()=>{a(null),s(null),r(null)},[]),S=w.useCallback(T=>{a(T),s(null),r(null)},[]),M=i!==null;return d.jsxs("div",{className:"relative w-full h-full bg-background",children:[d.jsxs(z6e,{camera:{position:h,fov:45,near:.1,far:100},gl:{antialias:!0,alpha:!1},onCreated:({gl:T})=>{T.setClearColor(e.background),T.toneMapping=vu},children:[c?d.jsx(gke,{topology:t,onSelectNode:S}):d.jsx(yke,{topology:f,hoveredItem:n,setHoveredItem:r,setSelectedItem:x,focusedItem:i}),d.jsx(xke,{focusTarget:!c&&i?{position:i.worldPosition}:null,overviewPosition:h,overviewLookAt:m}),d.jsx(nke,{makeDefault:!0,enablePan:!0,enableZoom:!0,enableRotate:!0,minDistance:1,maxDistance:30,maxPolarAngle:Math.PI/2-.05,onStart:()=>{i&&b()}}),d.jsx(bke,{})]}),l&&o!==null&&d.jsx("button",{onClick:_,className:"absolute top-4 left-4 px-3 py-1.5 text-xs font-medium text-foreground bg-background border border-foreground rounded-none hover:bg-foreground hover:text-background transition-colors select-none",children:"← Back to cluster"}),d.jsx(vke,{topology:c?t:f,focusedItem:i,onClose:b}),d.jsx("div",{className:"absolute bottom-4 left-4 text-[10px] text-foreground/60 select-none",children:c?"Click a node to inspect · Drag to orbit · Scroll to zoom":M?"Move to dismiss · Click Close to return":"Drag to orbit · Scroll to zoom · Right-click to pan · Click an object to focus"})]})}function EQ(t){if(t&&typeof t=="object"&&"value"in t)return EQ(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 _ke=[1,5,10,30,60,120,300],GN=qi,eU=qi,wke=["torch_allocated_gb"],Ske="__timeline_noop_metric__";function PE(t){return NI(t==null?void 0:t.setup)}function Mke(t){const e=PE(t),n={},r=yi(e==null?void 0:e.trainer),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=yi(s);if(!o)continue;const a=Lr(o.node_id),l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const f=yi(c);if(!f)continue;const h=Lr(f.rank);h!==null&&(n[h]={node_id:a,local_rank:Lr(f.local_rank)})}}return n}function Tke(t){const e=PE(t),n=yi(e==null?void 0:e.inference);return Lr(n==null?void 0:n.num_servers)??void 0}function Cke(t){const e=PE(t),n={},r=yi(e==null?void 0:e.inference),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=yi(s);if(!o)continue;const a=Lr(o.node_id),l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const f=yi(c);if(!f)continue;const h=Lr(f.server_idx);h!==null&&(h in n||(n[h]=a))}}return n}function tU(t){const e=PE(t),n=yi(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 Eke(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 Ake({value:t,onChange:e}){const[n,r]=w.useState(!1),[i,s]=w.useState(""),o=w.useRef(null),a=c=>{c&&(s(GN(t)),setTimeout(()=>{var f;return(f=o.current)==null?void 0:f.select()},0)),r(c)},l=()=>{const c=Eke(i);c!==null&&(e(c),r(!1))};return d.jsxs(oC,{open:n,onOpenChange:a,children:[d.jsx(aC,{asChild:!0,children:d.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:[GN(t),d.jsx(Rr,{className:"size-3 text-muted-foreground"})]})}),d.jsxs(lC,{align:"start",className:"w-40 p-1.5 gap-1",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.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"}),d.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"})]}),d.jsx("div",{className:"flex flex-col",children:_ke.map(c=>d.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:GN(c)},c))})]})]})}function Nke(){var W,J,ne,ie,z;const t=Kn(wl),[e,n]=cn(bue),[r,i]=cn(_ue),s=!0,{data:o,isFetching:a,isPlaceholderData:l,error:c}=Nfe(t||"",e,r,!!t),{data:f}=KW(t||"",!!t),{data:h}=Sh(t||"",!!t,s),m=w.useMemo(()=>{var X;const j=(X=h==null?void 0:h.config)==null?void 0:X.trainer_devices;return EQ(j)},[(W=h==null?void 0:h.config)==null?void 0:W.trainer_devices]),x=(o==null?void 0:o.interval_start)??null,b=(o==null?void 0:o.interval_end)??null,_=a&&(l||!o),[S,M]=w.useState(()=>[...wke]),T=w.useMemo(()=>{const j=Array.from(new Set(S.filter(X=>typeof X=="string"&&X.trim().length>0))).sort((X,F)=>X.localeCompare(F));return j.length>0?j:[Ske]},[S]),A=w.useMemo(()=>Mke(h==null?void 0:h.summary),[h==null?void 0:h.summary]),N=w.useMemo(()=>{const j={},X=(o==null?void 0:o.trainer_events)??[];for(const F of X){const ce=F.rank;if(!Number.isFinite(ce))continue;const oe=j[ce]??{node_id:null,local_rank:null},Q=oe.node_id!==null?oe.node_id:typeof F.node_id=="number"&&Number.isFinite(F.node_id)?F.node_id:null,se=oe.local_rank!==null?oe.local_rank:typeof F.local_rank=="number"&&Number.isFinite(F.local_rank)?F.local_rank:null;j[ce]={node_id:Q,local_rank:se}}return j},[o==null?void 0:o.trainer_events]),D=w.useMemo(()=>{const j={};return new Set([...Object.keys(A).map(Number),...Object.keys(N).map(Number)]).forEach(F=>{const ce=A[F],oe=N[F];j[F]={node_id:(ce==null?void 0:ce.node_id)??(oe==null?void 0:oe.node_id)??null,local_rank:(ce==null?void 0:ce.local_rank)??(oe==null?void 0:oe.local_rank)??null}}),j},[A,N]),k=w.useMemo(()=>Cke(h==null?void 0:h.summary),[h==null?void 0:h.summary]),O=w.useMemo(()=>{const j={},X=(o==null?void 0:o.inference_events)??[];for(const F of X){const ce=F.server;Number.isFinite(ce)&&j[ce]===void 0&&typeof F.node_id=="number"&&Number.isFinite(F.node_id)&&(j[ce]=F.node_id)}return j},[o==null?void 0:o.inference_events]),R=w.useMemo(()=>{const j={};return new Set([...Object.keys(k).map(Number),...Object.keys(O).map(Number)]).forEach(F=>{j[F]=k[F]??O[F]??null}),j},[k,O]),L=w.useMemo(()=>{const j=((o==null?void 0:o.trainer_events)??[]).map(F=>F.rank).filter(F=>Number.isFinite(F)),X=Object.keys(D).map(Number);return Array.from(new Set([...j,...X])).sort((F,ce)=>F-ce)},[o==null?void 0:o.trainer_events,D]),B=w.useMemo(()=>L.map(j=>{var X,F;return{rank:j,node_id:((X=D[j])==null?void 0:X.node_id)??null,local_rank:((F=D[j])==null?void 0:F.local_rank)??null}}),[L,D]),H=w.useMemo(()=>{const j=[];let X=!1;return L.forEach(F=>{var oe;const ce=(oe=D[F])==null?void 0:oe.local_rank;ce!=null&&(j[F]=ce,X=!0)}),X?j:m},[D,L,m]),$=Pfe(t||"",T,B,x,b,!!t&&x!==null&&b!==null&&B.length>0),G=w.useMemo(()=>{const j={};return B.forEach((X,F)=>{var oe;const ce=(oe=$[F])==null?void 0:oe.data;j[X.rank]=(ce==null?void 0:ce.metrics)??[]}),j},[B,$]),Z=w.useMemo(()=>{const j=[];$.forEach(ce=>{const oe=ce.data;oe!=null&&oe.available_metrics&&oe.available_metrics.forEach(Q=>{typeof Q=="string"&&j.push(Q)})});const X=Array.from(new Set(j));if(X.length>0)return X;const F=new Set;return $.forEach(ce=>{var Q;const oe=ce.data;(Q=oe==null?void 0:oe.metrics)==null||Q.forEach(se=>{typeof se.metric_name=="string"&&F.add(se.metric_name)})}),Array.from(F).sort((ce,oe)=>ce.localeCompare(oe))},[$]),V=$.some(j=>j.isFetching);return t?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center gap-2 h-7",children:[d.jsx(NP,{currentPage:e,totalPages:(o==null?void 0:o.total_pages)??1,onPageChange:n}),d.jsx(Ake,{value:r,onChange:j=>{const X=Math.floor(e*r/j);i(j),n(X)}}),x!==null&&b!==null&&(o==null?void 0:o.global_min_time)!=null&&d.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[eU(x-o.global_min_time)," – ",eU(b-o.global_min_time)]})]})})}),d.jsx("div",{className:"flex-1 overflow-auto p-6",children:d.jsxs("div",{className:"max-w-7xl mx-auto",children:[c&&d.jsx(hd,{className:"border-destructive mb-6",children:d.jsx(dh,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error: ",c instanceof Error?c.message:"Unknown error"]})})}),d.jsx(mSe,{orchestratorData:o==null?void 0:o.orchestrator_events,trainerData:o==null?void 0:o.trainer_events,inferenceData:o==null?void 0:o.inference_events,inflightSnapshot:f,isLoading:_,intervalStart:(o==null?void 0:o.interval_start)??0,intervalEnd:(o==null?void 0:o.interval_end)??r,trainerGpuMetricsByRank:G,trainerGpuMetricsIsLoading:V,trainerAvailableGpuMetrics:Z,selectedTrainerGpuMetrics:S,onSelectedTrainerGpuMetricsChange:M,trainerSystemGpuIndices:H,trainerRankInfoByRank:D,totalSetupNodes:tU(h==null?void 0:h.summary),inferenceServerNodeMap:R,numInferenceServers:Tke(h==null?void 0:h.summary)??((J=h==null?void 0:h.config)==null?void 0:J.num_inference_servers),maxConcurrentPrompts:(ne=h==null?void 0:h.config)==null?void 0:ne.max_concurrent_prompts,groupSize:(ie=h==null?void 0:h.config)==null?void 0:ie.group_size,freeLaneAfterGeneration:(z=h==null?void 0:h.config)==null?void 0:z.free_lane_after_generation})]})}),d.jsx(kke,{runPath:t,trainerEvents:o==null?void 0:o.trainer_events,totalSetupNodes:tU(h==null?void 0:h.summary)})]}):d.jsx(V0,{description:"Select a run from the sidebar to view the timeline."})}function kke({runPath:t,trainerEvents:e,totalSetupNodes:n}){const r=Kn(us),{data:i}=KW(t||"",!!t),[s,o]=cn(zW),[a,l]=cn(jW),[c,f]=w.useState("inference"),[h,m]=w.useState(s),[x,b]=w.useState(a);s!==h&&(m(s),s&&f("inference")),a!==x&&(b(a),a&&f("trainer"));const{data:_}=kfe(t??"",(s==null?void 0:s.groupId)??null,!!s&&!!t),S=w.useMemo(()=>{if(!s||!(_!=null&&_.events))return null;const se={};for(const re of _.events)re.sample_id!==void 0&&(se[re.sample_id]||(se[re.sample_id]=[]),se[re.sample_id].push(re));return se},[s,_]),M=w.useMemo(()=>{if(!_)return null;const se=_.environment_response_times??[],re=_.compute_reward_times??[],K={};for(const he of se)K[he.sample_idx]||(K[he.sample_idx]=[]),K[he.sample_idx].push({turn_order:he.turn_order,time:he.time});for(const he of Object.values(K))he.sort((ae,Se)=>ae.turn_order-Se.turn_order);const fe={};for(const he of re)fe[he.sample_idx]=he.time;return{envBySample:K,rewardBySample:fe}},[_]),T=w.useMemo(()=>{var K;if(!S)return null;let se=1/0,re=-1/0;for(const[fe,he]of Object.entries(S)){for(const ae of he){se=Math.min(se,ae.start_time),re=Math.max(re,ae.end_time);let Se=ae.end_time;ae.environment_response_time&&ae.environment_response_time>0&&(Se+=ae.environment_response_time),ae.compute_reward_time&&ae.compute_reward_time>0&&(Se+=ae.compute_reward_time),re=Math.max(re,Se)}if(M){const ae=Number(fe),Se=[...he].sort((Re,le)=>Re.start_time-le.start_time),de=M.envBySample[ae]??[];let Me=-1/0;for(let Re=0;Re<Se.length;Re++)Me=Se[Re].end_time,Re<de.length&&de[Re].time>0&&(Me+=de[Re].time);const Ce=M.rewardBySample[ae]??0;Ce>0&&(Me+=Ce),re=Math.max(re,Me)}}if((K=i==null?void 0:i.running_compute_reward)!=null&&K.length&&i.snapshot_time&&s)for(const fe of i.running_compute_reward)fe.group_id===s.groupId&&(re=Math.max(re,i.snapshot_time));return se===1/0?null:{start:se,end:re,duration:re-se}},[S,M,i,s]),{data:A}=Rfe(t??"",(a==null?void 0:a.eventType)??null,(a==null?void 0:a.rank)??null,(a==null?void 0:a.step)??null,!!t&&!!a),N=w.useMemo(()=>A!=null&&A.events&&A.events.length>0?A.events:e??[],[A,e]),D=w.useMemo(()=>{if(N.length===0)return{};const se={};for(const re of N)se[re.rank]||(se[re.rank]=[]),se[re.rank].push(re);return se},[N]),k=w.useMemo(()=>a?(D[a.rank]||[]).find(re=>re.event_type===a.eventType&&re.step===a.step&&re.rank===a.rank&&!re.event_type.includes("/"))??null:null,[a,D]),O=w.useMemo(()=>a?(D[a.rank]||[]).filter(re=>re.event_type.startsWith(a.eventType+"/")&&re.step===a.step):[],[a,D]),R=Kn(KT),L=Kn(LW),B=w.useMemo(()=>!s||!S?[]:Object.keys(S).map(Number).map(se=>({group_id:s.groupId,sample_idx:se})),[s,S]),{data:H}=y8(t??"",B,!!t&&B.length>0&&R,!0),$=!R||B.length===0||!!H,G=w.useMemo(()=>!R||!(H!=null&&H.statuses)?!1:H.statuses.some(se=>se.kind==="rollouts_discarded"),[R,H]),Z=w.useMemo(()=>S?Object.values(S).some(se=>se.some(re=>re.is_canceled)):!1,[S]),V=w.useMemo(()=>{var se;return Z||G||!R||s!=null&&s.isEval?!1:!$||!((se=H==null?void 0:H.statuses)!=null&&se.length)?!0:!H.statuses.some(re=>re.kind==="rollouts")},[Z,G,R,$,H]),{data:W}=YW(t??"",(s==null?void 0:s.groupId)??null,(s==null?void 0:s.sampleId)??null,!!t&&!!s,s==null?void 0:s.isEval),J=w.useMemo(()=>!W||W.kind!=="rollouts_discarded"?null:W.discard_reason,[W]),ne=w.useMemo(()=>{if(!W||W.kind===null)return null;const se=W.samples_data;if(!se||se.length===0)return null;const re=se.map(K=>K.reward).filter(K=>K!==null);return re.length===0?null:re.every(K=>K===0)?"all_zero":re.every(K=>K>0)?"all_positive":null},[W]),ie=se=>{switch(se){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return se.split("_").map(re=>re.charAt(0).toUpperCase()+re.slice(1)).join(" ")}},z=!!s,j=!!a&&O.length>0&&!!k,X=c==="inference"&&!z&&j?"trainer":c==="trainer"&&!j&&z?"inference":c;if(!z&&!j)return null;const F=()=>{X==="inference"?(o(null),j&&f("trainer")):(l(null),z&&f("inference"))},ce=k?XW(k.event_type,k.step,k.microbatch,k.minibatch):null,oe=k?J2(k.event_type):void 0,Q=z&&j;return d.jsxs("footer",{className:"border-t bg-background shrink-0 h-[28vh] flex flex-col",children:[d.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 shrink-0",children:[Q&&d.jsxs("div",{className:"flex items-center bg-muted rounded-md p-0.5 gap-0.5",children:[d.jsx("button",{onClick:()=>f("inference"),className:`text-[11px] font-medium px-2.5 py-1 rounded transition-colors ${X==="inference"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Inference"}),d.jsx("button",{onClick:()=>f("trainer"),className:`text-[11px] font-medium px-2.5 py-1 rounded transition-colors ${X==="trainer"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Trainer"})]}),X==="inference"&&s&&d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:Z?r?Lw:"#adadad":G?r?"#9ca3af":"#6b7280":V?"rgba(161, 98, 7, 0.9)":s.isEval?"#047857":"#075985"}}),d.jsxs("span",{className:"text-xs font-medium",children:["Sample ",s.sampleId]})]}),d.jsx("span",{className:"text-muted-foreground",children:"/"}),d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx("div",{className:`w-2.5 h-2.5 rounded-sm${$?"":" animate-pulse bg-muted"}`,style:$?{backgroundColor:Z?r?Lw:dC:G?r?uC:cC:V?"rgba(202, 138, 4, 0.8)":s.isEval?"#10b981":"#0369a1"}:void 0}),d.jsxs("span",{className:"text-xs font-medium",children:["Group ",s.groupId]})]}),Z&&d.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-muted text-muted-foreground border border-border",children:"Canceled due to async policy"}),V&&!Z&&d.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-yellow-100 text-yellow-700 border border-yellow-200",children:"Waiting for Group"}),J&&d.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:ie(J)}),J==="zero_advantage"&&ne==="all_zero"&&d.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"}),J==="zero_advantage"&&ne==="all_positive"&&d.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"})]}),X==="trainer"&&ce&&k&&d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:oe}}),d.jsxs("span",{className:"text-xs font-medium",children:[ce.primary," Breakdown"]}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:["GPU ",k.rank]}),d.jsxs("span",{className:"text-xs text-muted-foreground",children:["(Step ",k.step,")"]})]}),d.jsx("button",{onClick:F,className:"ml-auto text-muted-foreground hover:text-foreground transition-colors p-1 rounded hover:bg-muted",children:d.jsx(ka,{className:"w-4 h-4"})})]}),d.jsxs("div",{className:"overflow-auto flex-1 min-h-0",children:[X==="inference"&&s&&S&&T&&d.jsx(DSe,{eventsBySampleId:S,selectedSampleId:s.sampleId,timeBounds:T,groupId:s.groupId,runPath:t??"",envResponseTimesBySample:M==null?void 0:M.envBySample,computeRewardTimeBySample:L?M==null?void 0:M.rewardBySample:void 0,inflightSnapshot:i,onSampleClick:se=>{o({sampleId:se,groupId:s.groupId,isEval:s.isEval})},showNodeLabel:typeof n=="number"&&n>1,isEval:s.isEval}),X==="trainer"&&k&&O.length>0&&d.jsx(VSe,{parentEvent:k,childEvents:O})]})]})}function kI(t,e){const n=typeof IntersectionObserver>"u",[r,i]=w.useState(n),[s,o]=w.useState(n),a=w.useRef(null),l=(e==null?void 0:e.root)??null,c=(e==null?void 0:e.rootMargin)??"0px",f=(e==null?void 0:e.threshold)??0;return w.useEffect(()=>{const h=t.current;if(!h||typeof IntersectionObserver>"u")return;const m=new IntersectionObserver(([x])=>{const b=x.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:f});return m.observe(h),()=>{m.disconnect(),a.current&&clearTimeout(a.current)}},[t,l,c,f]),r||s}function AQ(){const[t,e]=w.useState(!1);w.useEffect(()=>{if(!t)return;const i=s=>{s.key==="Escape"&&e(!1)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]);const n=w.useCallback(()=>e(i=>!i),[]),r=w.useCallback(i=>t?Yl.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function NQ({isFullscreen:t,onClick:e}){return d.jsx("button",{onClick:e,className:vt("h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all",t?"opacity-100":"opacity-0 group-hover/card:opacity-100"),title:t?"Exit fullscreen":"Fullscreen",children:t?d.jsx(iC,{className:"h-3 w-3"}):d.jsx(rC,{className:"h-3 w-3"})})}const o2={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"}]}},Rke={discarded_stats:{label:"Discarded Rollouts",metrics:[{prefix:"discarded_count",label:"Discarded Count",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_pct",label:"Discarded Zero Advantage %",simple:!0,group:"General"},{prefix:"discarded_max_async_pct",label:"Discarded Max Async %",simple:!0,group:"General"},{prefix:"discarded_stop_reason_length_pct",label:"Discarded % Stop Reason = Length",simple:!0,group:"General"},{prefix:"discarded_group_length_gini_mean",label:"Discarded Group Completion Length Gini",simple:!0,group:"General"},{prefix:"discarded_group_length_max_median_ratio_mean",label:"Discarded Group Completion Length Max/Median",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_all_zero_pct",label:"Discarded Zero Adv (All Reward = 0) %",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_all_positive_pct",label:"Discarded Zero Adv (All Reward > 0) %",simple:!0,group:"General"},{prefix:"discarded_zero_advantage_mean_reward",label:"Discarded 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"}},Pke={timeline_trainer_full_step:{label:"Timeline Trainer",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_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_trainer_microbatch:{label:"Timeline Trainer",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)"}]},timeline_inference:{label:"Timeline Inference",metrics:[{prefix:"timing_save_batch_total",label:"Batch Completion (Save Batch)",simple:!0,group:"Batch & Averages"},{prefix:"timing_avg_inference_time",label:"Avg Generation Time",simple:!0,group:"Batch & Averages"},{prefix:"timing_avg_compute_reward_time",label:"Avg Compute Reward Time",simple:!0,group:"Batch & Averages"},{prefix:"timing_generation_normal_pct",label:"Inference % Generation (Normal)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_generation_discarded_pct",label:"Inference % Generation (Discarded)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_generation_canceled_pct",label:"Inference % Generation (Canceled)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_generation_all_pct",label:"Inference % Generation (All)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_normal_pct",label:"Inference % Compute Reward (Normal)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_discarded_pct",label:"Inference % Compute Reward (Discarded)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_canceled_pct",label:"Inference % Compute Reward (Canceled)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_compute_reward_all_pct",label:"Inference % Compute Reward (All)",simple:!0,group:"Time Breakdown (% of Step Time)"},{prefix:"timing_idle_pct",label:"Inference % Idle Time",simple:!0,group:"Time Breakdown (% of Step Time)"}]}},a7=["mean","std","min","max"],P1="histogram",I1="distribution_over_time";function nU(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 Gm(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 f of a7){const h=`${r.prefix}_${f}`,m=f.charAt(0).toUpperCase()+f.slice(1);t.push({category:e,categoryLabel:n.label,group:s,metricKey:h,label:`${r.label} - ${m}`,prefix:r.prefix,suffix:f,showZeroLine:o,unit:a})}const l=`${r.prefix}_${P1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:l,label:`${r.label} - Histogram`,prefix:r.prefix,suffix:P1,showZeroLine:o,unit:a,isHistogram:!0,histogramMetricType:nU(r.prefix)});const c=`${r.prefix}_${I1}`;t.push({category:e,categoryLabel:n.label,group:s,metricKey:c,label:`${r.label} - Distribution Over Time`,prefix:r.prefix,suffix:I1,showZeroLine:o,unit:a,isDistributionOverTime:!0,histogramMetricType:nU(r.prefix)})}}function Ike(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}`;Gm(r,l,{label:E1(i),metrics:a.map(c=>({prefix:c,label:E1(c),simple:!0,group:o?E1(o):void 0}))})}Gm(r,"rewards",o2.rewards),t.length>0&&Gm(r,"rollout_metrics",{label:"Samples Metrics",metrics:t.flatMap(i=>[{prefix:`reward_${i}`,label:E1(i)},{prefix:`reward_${i}_gini_mean`,label:`${E1(i)} Sparsity (Gini)`,simple:!0}])}),Gm(r,"advantage",o2.advantage),r.push(...Dke(n)),Gm(r,"tokens",o2.tokens),Gm(r,"rollouts_general",o2.rollouts_general);for(const[i,s]of Object.entries(Rke))Gm(r,i,s);for(const[i,s]of Object.entries(Pke))Gm(r,i,s);for(const i of[{key:"inference_calls",label:"Inference Calls",inferenceMetricType:"inference_calls"},{key:"requests_done",label:"Requests Done",inferenceMetricType:"requests_done"},{key:"rollouts_group_done",label:"Rollouts Group Done",inferenceMetricType:"rollouts_group_done"},{key:"rollouts_group_done_kept",label:"Rollouts Group Done Kept",inferenceMetricType:"rollouts_group_done_kept"},{key:"rollouts_group_done_discarded",label:"Rollouts Group Done Discarded",inferenceMetricType:"rollouts_group_done_discarded"},{key:"rollouts_group_done_canceled",label:"Rollouts Group Done Canceled",inferenceMetricType:"rollouts_group_done_canceled"},{key:"avg_tokens_per_second_generation",label:"Tokens/s per Generation",inferenceMetricType:"avg_tokens_per_second_generation"},{key:"tokens_per_second_throughput",label:"Tokens/s Throughput",inferenceMetricType:"tokens_per_second_throughput"},{key:"avg_time_queue",label:"Avg Queue Time",inferenceMetricType:"avg_time_queue"},{key:"avg_time_ttft",label:"Avg Time to First Token",inferenceMetricType:"avg_time_ttft"},{key:"avg_time_prefill",label:"Avg Prefill Time",inferenceMetricType:"avg_time_prefill"},{key:"avg_time_decode",label:"Avg Decode Time",inferenceMetricType:"avg_time_decode"},{key:"avg_time_inference",label:"Avg Inference Time",inferenceMetricType:"avg_time_inference"},{key:"avg_time_e2e",label:"Avg E2E Latency",inferenceMetricType:"avg_time_e2e"},{key:"avg_time_generation",label:"Avg Generation Duration",inferenceMetricType:"avg_time_generation"},{key:"avg_time_compute_reward",label:"Avg Compute Reward Time",inferenceMetricType:"avg_time_compute_reward"},{key:"vllm_requests_running_avg",label:"vLLM Requests Running Average",inferenceMetricType:"vllm_requests_running_avg"},{key:"vllm_requests_waiting_avg",label:"vLLM Requests Waiting Average",inferenceMetricType:"vllm_requests_waiting_avg"},{key:"vllm_preemptions",label:"vLLM Preemptions",inferenceMetricType:"vllm_preemptions"},{key:"vllm_preemptions_per_request",label:"vLLM Preemptions per Request",inferenceMetricType:"vllm_preemptions_per_request"},{key:"vllm_ttft_avg",label:"vLLM TTFT Average",inferenceMetricType:"vllm_ttft_avg"}])r.push({category:"inference_performance",categoryLabel:"Inference Performance",metricKey:i.key,label:i.label,prefix:i.key,suffix:"",isInferencePerformance:!0,inferenceMetricType:i.inferenceMetricType});for(const i of Rq)r.push({category:"inference_utilization_area",categoryLabel:"Inference Performance",group:"Breakdown (Area)",metricKey:i.key,label:i.label,prefix:i.key,suffix:"",isInferenceUtilizationArea:!0,inferenceAreaCategories:[...i.categories]});for(const i of Nq)r.push({category:"inference_performance_area",categoryLabel:"Inference Performance",group:"Breakdown (Area)",metricKey:i.key,label:i.label,prefix:i.key,suffix:"",isInferencePerformanceArea:!0,inferenceAreaCategories:[...i.categories]});for(const i of Oq)r.push({category:"trainer_performance_area",categoryLabel:"Trainer Performance",group:"Time Breakdown (Area)",metricKey:i.key,label:i.label,prefix:i.key,suffix:"",isTrainerPerformanceArea:!0,trainerAreaCategories:[...i.categories]});for(const i of[{key:"trainer_perf_idle",label:"Trainer % Idle",trainerMetricType:"idle"},{key:"trainer_perf_working",label:"Trainer % Working",trainerMetricType:"working"},{key:"trainer_perf_working_except_weight_sync",label:"Trainer % Working (excl. Weight Sync)",trainerMetricType:"working_except_weight_sync"},{key:"trainer_perf_forward",label:"Trainer % Forward",trainerMetricType:"forward"},{key:"trainer_perf_backward",label:"Trainer % Backward",trainerMetricType:"backward"},{key:"trainer_perf_optimizer",label:"Trainer % Optimizer",trainerMetricType:"optimizer"},{key:"trainer_perf_loss_computation",label:"Trainer % Loss Computation",trainerMetricType:"loss_computation"},{key:"trainer_perf_weight_broadcast",label:"Trainer % Weight Sync",trainerMetricType:"weight_broadcast"},{key:"trainer_perf_data_wait",label:"Trainer % Data Wait",trainerMetricType:"data_wait"},{key:"trainer_perf_grad_clip",label:"Trainer % Grad Clip",trainerMetricType:"grad_clip"},{key:"trainer_perf_grad_norm",label:"Trainer % Grad Norm",trainerMetricType:"grad_norm"},{key:"trainer_perf_checkpoint",label:"Trainer % Checkpoint",trainerMetricType:"checkpoint"}])r.push({category:"trainer_performance",categoryLabel:"Trainer Performance",group:"% Time per Category",metricKey:i.key,label:i.label,prefix:i.key,suffix:"",isTrainerPerformance:!0,trainerMetricType:i.trainerMetricType});return r}function Dke(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=E1(s),a=`${r} / ${o}`,l=`${i}reward_${s}`,c="evals";for(const f of a7){const h=f.charAt(0).toUpperCase()+f.slice(1);e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${f}`,label:`${r} ${o} - ${h}`,prefix:l,suffix:f,isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${P1}`,label:`${r} ${o} - Histogram`,prefix:l,suffix:P1,isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${I1}`,label:`${r} ${o} - Distribution Over Time`,prefix:l,suffix:I1,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 f of a7){const h=f.charAt(0).toUpperCase()+f.slice(1);e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${f}`,label:`${r} ${o} - ${h}`,prefix:l,suffix:f,unit:"tokens",isEvalMetric:!0,evalName:r})}e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${P1}`,label:`${r} ${o} - Histogram`,prefix:l,suffix:P1,unit:"tokens",isHistogram:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r}),e.push({category:c,categoryLabel:"Evals",group:a,metricKey:`${l}_${I1}`,label:`${r} ${o} - Distribution Over Time`,prefix:l,suffix:I1,unit:"tokens",isDistributionOverTime:!0,histogramMetricType:l,isEvalMetric:!0,evalName:r})}}return e}function E1(t){return t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Oke(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 Lke(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.isInferencePerformance?"inference_performance":n.isInferencePerformanceArea?"inference_performance_area":n.isInferenceUtilizationArea?"inference_utilization_area":n.isTrainerPerformance?"trainer_performance":n.isTrainerPerformanceArea?"trainer_performance_area":n.isHistogram?"histogram":n.isDistributionOverTime?"distribution_over_time":n.isEvalMetric?"eval_metric":"step_metric",evalName:n.evalName,histogramMetricType:n.histogramMetricType,inferenceMetricType:n.inferenceMetricType,inferenceAreaCategories:n.inferenceAreaCategories,trainerMetricType:n.trainerMetricType,trainerAreaCategories:n.trainerAreaCategories,simple:!n.suffix}))}function RI({openAtom:t=h8}={}){const[e,n]=cn(t);return!Kn(wl)||e?null:d.jsx(Sn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Metrics"})}function Vm({id:t,children:e}){const{attributes:n,listeners:r,setNodeRef:i,transform:s,transition:o,isDragging:a}=vC({id:t}),l={transform:s?`translate3d(${Math.round(s.x)}px, ${Math.round(s.y)}px, 0)`:void 0,transition:o,opacity:a?.4:1,position:"relative",zIndex:a?50:void 0},c=d.jsx("button",{...n,...r,className:"-ml-1.5 cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-muted transition-all shrink-0 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100",children:d.jsx(nC,{className:"h-3 w-3 text-muted-foreground"})});return d.jsx("div",{ref:i,style:l,children:e(c)})}function PI({currentStep:t,maxSelectableStep:e,openAtom:n=h8,selectedMetricsAtom:r=Nue,selectedStepAtom:i=YT,includeDiscardedDefaults:s=!1,evalConfig:o}){const[a,l]=cn(n),[c,f]=cn(r),[h,m]=w.useState(!1),x=h&&(o==null?void 0:o.selectedSampleIdx)!=null,[b,_]=w.useState(!1),[S,M]=w.useState(10),[T,A]=w.useState("10"),N=Kn(wl),D=Kn(XT),k=Kn(ZT),O=!0,R=!!o,{data:L}=G0(),B=w.useMemo(()=>{const he=new Set(D);return N&&he.add(N),Array.from(he)},[N,D]),{customMetricSections:H,availableRewardNames:$,evalsList:G}=b8(B),Z=w.useRef(!1);w.useEffect(()=>{if(R||Z.current)return;if(c.length>0){Z.current=!0;return}if($.length===0&&H&&Object.keys(H).length===0)return;Z.current=!0;const he=["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",...$.flatMap(ae=>[`reward_${ae}_mean`,`reward_${ae}_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"]:[]];f(he)},[$,H,R]);const V=w.useRef(new Set);w.useEffect(()=>{if(R||$.length===0)return;const he=[];for(const ae of $){if(!V.current.has(ae)){const Se=`reward_${ae}_mean`,de=`reward_${ae}_distribution_over_time`;c.includes(Se)||he.push(Se),c.includes(de)||he.push(de)}V.current.add(ae)}he.length>0&&f(ae=>[...ae,...he])},[$,R]);const W=w.useRef("");w.useEffect(()=>{if(!R||!o)return;const he=`${o.prefix}|${o.rewardNames.join(",")}`;if(he===W.current)return;W.current=he;const ae=o.prefix,Se=[`${ae}length_completion_mean`,`${ae}length_completion_std`,`${ae}length_completion_min`,`${ae}length_completion_max`,`${ae}length_completion_distribution_over_time`,...o.rewardNames.flatMap(de=>[`${ae}reward_${de}_mean`,`${ae}reward_${de}_distribution_over_time`])];f(Se)},[o,R,f]);const J=w.useMemo(()=>{const he=(L==null?void 0:L.runs)||[],ae=new Set(D);return N&&ae.add(N),he.filter(Se=>ae.has(Se.run_id)).map(Se=>({runPath:Se.run_id,runName:Se.name,color:Se.color,isSelected:Se.run_id===N}))},[N,D,L==null?void 0:L.runs]),ne=w.useMemo(()=>Ike($,H,G),[$,H,G]);w.useMemo(()=>Oke(ne),[ne]);const ie=w.useMemo(()=>{const he=new Set(ne.map(Se=>Se.metricKey)),ae={};return c.map((Se,de)=>{const Me=ae[Se]||0;return ae[Se]=Me+1,{metricKey:Se,originalIndex:de,sortableId:`${Se}::${Me}`}}).filter(({metricKey:Se})=>he.has(Se))},[c,ne]),z=w.useMemo(()=>ie.map(he=>he.metricKey),[ie]),j=w.useMemo(()=>Lke(ne),[ne]),X=w.useMemo(()=>z.map(he=>{const ae=ne.find(Se=>Se.metricKey===he);return{id:he,metricKey:he,label:(ae==null?void 0:ae.label)||he,plotType:ae!=null&&ae.isInferencePerformance?"inference_performance":ae!=null&&ae.isInferencePerformanceArea?"inference_performance_area":ae!=null&&ae.isInferenceUtilizationArea?"inference_utilization_area":ae!=null&&ae.isTrainerPerformance?"trainer_performance":ae!=null&&ae.isTrainerPerformanceArea?"trainer_performance_area":ae!=null&&ae.isHistogram?"histogram":ae!=null&&ae.isDistributionOverTime?"distribution_over_time":ae!=null&&ae.isEvalMetric?"eval_metric":"step_metric"}}),[z,ne]),F=he=>{he&&f(ae=>[...ae,he])},ce=he=>{f(ae=>ae.filter((Se,de)=>de!==he))},oe=_y(ld(w0,{activationConstraint:{distance:5}}),ld(_0,{coordinateGetter:Ty})),Q=w.useCallback(he=>{const{active:ae,over:Se}=he;if(!Se||ae.id===Se.id)return;const de=ie.find(Ce=>Ce.sortableId===ae.id),Me=ie.find(Ce=>Ce.sortableId===Se.id);!de||!Me||f(Ce=>S0(Ce,de.originalIndex,Me.originalIndex))},[f,ie]),se=he=>ne.find(ae=>ae.metricKey===he),[re,K]=w.useState(null),fe=w.useCallback(he=>{if(!he||!a){K(null);return}const ae=he.querySelector('[data-slot="scroll-area-viewport"]');ae&&K(ae)},[a]);return!N||!a?null:d.jsxs("div",{className:"w-[320px] border-l border-border bg-card/50 backdrop-blur flex flex-col h-full min-h-0",children:[d.jsxs("div",{className:"px-4 py-2.5 border-b border-border flex items-center justify-between shrink-0",children:[d.jsx("h2",{className:"font-semibold text-sm",children:R?"Eval Metrics":"Training Metrics"}),d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>l(!1),children:d.jsx(Xde,{className:"h-4 w-4"})})]}),d.jsx("div",{className:"px-4 py-2 border-b border-border shrink-0",children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Ry,{catalog:j,onSelect:he=>F(he.metricKey),existingPlots:X,allowDuplicates:!0,children:d.jsxs("button",{type:"button",className:vt("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",z.length>0?"text-foreground":"text-muted-foreground"),children:[d.jsx("span",{className:"font-medium",children:"Charts"}),z.length>0&&d.jsx("span",{className:"text-[10px] bg-accent text-accent-foreground rounded px-1.5 py-0 font-medium",children:z.length}),d.jsx(Rr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 ml-auto"})]})}),d.jsx(Bw,{label:"EMA",variant:"selecting",size:"sm",enabled:b,onEnabledChange:_,value:T,onValueChange:A,onValueCommit:he=>{const ae=parseInt(he,10);!isNaN(ae)&&ae>=2&&ae<=100?(M(ae),A(ae.toString())):A(S.toString())},inputMin:2,inputMax:100,inputWidth:"w-10"})]})}),d.jsx($x,{ref:fe,className:"flex-1 min-h-0",children:d.jsxs("div",{className:"p-4 space-y-4",children:[R&&d.jsxs("div",{className:"flex items-center gap-1 mb-3",children:[d.jsx(Sn,{variant:h?"outline":"default",size:"sm",className:"h-6 px-2.5 text-xs",onClick:()=>m(!1),children:"All"}),d.jsx(Sn,{variant:h?"default":"outline",size:"sm",className:"h-6 px-2.5 text-xs",onClick:()=>m(!0),disabled:(o==null?void 0:o.selectedSampleIdx)==null,children:"Selected"})]}),z.length===0?d.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"}):d.jsx(Sy,{sensors:oe,collisionDetection:wy,onDragEnd:Q,children:d.jsx(My,{items:ie.map(({sortableId:he})=>he),strategy:A8,children:d.jsx("div",{className:"space-y-4",children:ie.map(({metricKey:he,originalIndex:ae,sortableId:Se})=>{const de=se(he);if(x&&(de!=null&&de.isHistogram||de!=null&&de.isDistributionOverTime||de!=null&&de.suffix&&de.suffix!=="mean"&&de.suffix!==""))return null;const Me=R&&x?`/s/${o.selectedSampleIdx}/`:"/",Re=R&&he.startsWith("eval/")?he.replace(/^(eval\/[^/]+)\//,`$1${Me}`):he,le=(de==null?void 0:de.histogramMetricType)||"",He=R&&le.startsWith("eval/")?le.replace(/^(eval\/[^/]+)\//,`$1${Me}`):le,Le=x&&(de==null?void 0:de.suffix)==="mean"?(de.label||he).replace(/ - Mean$/,""):(de==null?void 0:de.label)||he;if(de!=null&&de.isInferencePerformance&&de.inferenceMetricType){const ze=d.jsx("button",{onClick:()=>ce(ae),className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100 transition-opacity",children:d.jsx(ka,{className:"h-3.5 w-3.5"})});return d.jsx(Vm,{id:Se,children:Ve=>d.jsx(Aq,{runs:J,shouldPoll:O,hoveredRunId:k,scrollRoot:re,inferenceMetricType:de.inferenceMetricType,label:Le,headerPrefix:Ve,headerSuffix:ze})},Se)}if(de!=null&&de.isInferencePerformanceArea&&de.inferenceAreaCategories){const ze=d.jsx("button",{onClick:()=>ce(ae),className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100 transition-opacity",children:d.jsx(ka,{className:"h-3.5 w-3.5"})});return d.jsx(Vm,{id:Se,children:Ve=>d.jsx(kq,{runs:J,shouldPoll:O,scrollRoot:re,label:Le,categories:de.inferenceAreaCategories,headerPrefix:Ve,headerSuffix:ze})},Se)}if(de!=null&&de.isInferenceUtilizationArea&&de.inferenceAreaCategories){const ze=d.jsx("button",{onClick:()=>ce(ae),className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100 transition-opacity",children:d.jsx(ka,{className:"h-3.5 w-3.5"})});return d.jsx(Vm,{id:Se,children:Ve=>d.jsx(Pq,{runs:J,shouldPoll:O,scrollRoot:re,label:Le,categories:de.inferenceAreaCategories,headerPrefix:Ve,headerSuffix:ze})},Se)}if(de!=null&&de.isTrainerPerformance&&de.trainerMetricType){const ze=d.jsx("button",{onClick:()=>ce(ae),className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100 transition-opacity",children:d.jsx(ka,{className:"h-3.5 w-3.5"})});return d.jsx(Vm,{id:Se,children:Ve=>d.jsx(Dq,{runs:J,shouldPoll:O,hoveredRunId:k,scrollRoot:re,trainerMetricType:de.trainerMetricType,label:Le,headerPrefix:Ve,headerSuffix:ze})},Se)}if(de!=null&&de.isTrainerPerformanceArea&&de.trainerAreaCategories){const ze=d.jsx("button",{onClick:()=>ce(ae),className:"text-muted-foreground hover:text-foreground p-0.5 rounded hover:bg-muted/50 opacity-0 group-hover/card:opacity-100 group-hover/chart:opacity-100 transition-opacity",children:d.jsx(ka,{className:"h-3.5 w-3.5"})});return d.jsx(Vm,{id:Se,children:Ve=>d.jsx(Lq,{runs:J,shouldPoll:O,scrollRoot:re,label:Le,categories:de.trainerAreaCategories,headerPrefix:Ve,headerSuffix:ze})},Se)}return de!=null&&de.isHistogram?d.jsx(Vm,{id:Se,children:ze=>d.jsx(Uke,{runPath:N,step:t,metricType:He,label:Le,showZeroLine:de==null?void 0:de.showZeroLine,unit:de==null?void 0:de.unit,isTokenMetric:(de==null?void 0:de.category)==="tokens",onRemove:()=>ce(ae),scrollRoot:re,headerPrefix:ze})},Se):de!=null&&de.isDistributionOverTime?d.jsx(Vm,{id:Se,children:ze=>d.jsx(Hke,{runPath:N,metricType:He,label:Le,showZeroLine:de==null?void 0:de.showZeroLine,unit:de==null?void 0:de.unit,isTokenMetric:(de==null?void 0:de.category)==="tokens",currentStep:t,shouldPoll:O,onRemove:()=>ce(ae),selectedStepAtom:i,maxSelectableStep:e,scrollRoot:re,headerPrefix:ze})},Se):d.jsx(Vm,{id:Se,children:ze=>d.jsx(zke,{runs:J,shouldPoll:O,metricKey:Re,label:Le,showZeroLine:de==null?void 0:de.showZeroLine,unit:de==null?void 0:de.unit,isTokenMetric:(de==null?void 0:de.category)==="tokens",showEma:b,emaSpan:S,currentStep:t,onRemove:()=>ce(ae),hoveredRunId:k,selectedStepAtom:i,maxSelectableStep:e,scrollRoot:re,filterKey:`${he}-${ae}`,headerPrefix:ze})},Se)})})})})]})})]})}function jke(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 qf(t,e,n,r){const{isEval:i,evalName:s,rawMetricName:o,sampleIdx:a}=jke(e),l=ZW(t,e,n&&!i,r),c=jfe(t,s,o,n&&i,r,a);return i?c:l}function zke({runs:t,shouldPoll:e,metricKey:n,label:r,showZeroLine:i,unit:s,isTokenMetric:o,showEma:a=!1,emaSpan:l=10,currentStep:c,onRemove:f,hoveredRunId:h=null,selectedStepAtom:m=YT,maxSelectableStep:x,scrollRoot:b=null,filterKey:_,headerPrefix:S}){var st,Pe,Ke,rt,ye,$e,Ze,ft,lt,Je;const M=ad(m),T=Kn(us),{isFullscreen:A,toggleFullscreen:N,fullscreenPortal:D}=AQ(),k=w.useRef(null),O=w.useRef(null),R=w.useRef(null),L=w.useRef(null),B=w.useRef(null),H=_??n,[$,G]=cn(f8),Z=W8.has(n),V=$[H],W=(V==null?void 0:V.ignoreOutliers)??!1,J=(V==null?void 0:V.ignoreFirstStep)??Z,ne=(V==null?void 0:V.minY)??null,ie=(V==null?void 0:V.maxY)??null,z=w.useCallback(Ae=>{G(We=>{const De={ignoreOutliers:!1,ignoreFirstStep:Z,minY:null,maxY:null,tagFilters:{},envFilters:[]},Ne=We[H]??De,ot=Ae(Ne);if(ot.ignoreOutliers===De.ignoreOutliers&&ot.ignoreFirstStep===De.ignoreFirstStep&&ot.minY===De.minY&&ot.maxY===De.maxY&&Object.keys(ot.tagFilters??{}).length===0){if(!Object.prototype.hasOwnProperty.call(We,H))return We;const Pt={...We};return delete Pt[H],Pt}return{...We,[H]:ot}})},[H,G,Z]),j=w.useCallback(Ae=>z(We=>({...We,ignoreOutliers:Ae})),[z]),X=w.useCallback(Ae=>z(We=>({...We,ignoreFirstStep:Ae})),[z]),F=w.useCallback(Ae=>z(We=>({...We,minY:Ae})),[z]),ce=w.useCallback(Ae=>z(We=>({...We,maxY:Ae})),[z]),Q=kI(k,{root:b,threshold:0})||A,se=qf(((st=t[0])==null?void 0:st.runPath)||"",n,Q&&!!t[0],e),re=qf(((Pe=t[1])==null?void 0:Pe.runPath)||"",n,Q&&!!t[1],e),K=qf(((Ke=t[2])==null?void 0:Ke.runPath)||"",n,Q&&!!t[2],e),fe=qf(((rt=t[3])==null?void 0:rt.runPath)||"",n,Q&&!!t[3],e),he=qf(((ye=t[4])==null?void 0:ye.runPath)||"",n,Q&&!!t[4],e),ae=qf((($e=t[5])==null?void 0:$e.runPath)||"",n,Q&&!!t[5],e),Se=qf(((Ze=t[6])==null?void 0:Ze.runPath)||"",n,Q&&!!t[6],e),de=qf(((ft=t[7])==null?void 0:ft.runPath)||"",n,Q&&!!t[7],e),Me=qf(((lt=t[8])==null?void 0:lt.runPath)||"",n,Q&&!!t[8],e),Ce=qf(((Je=t[9])==null?void 0:Je.runPath)||"",n,Q&&!!t[9],e),Re=w.useMemo(()=>{const Ae=t.filter(De=>!De.isSelected),We=t.filter(De=>De.isSelected);return[...Ae,...We]},[t]),le=w.useMemo(()=>Re.slice(0,10),[Re]),He=w.useMemo(()=>{const Ae=new Map;return le.forEach((We,De)=>{Ae.set(We.runPath,De)}),Ae},[le]),{uplotData:Le,seriesConfig:ze,isFetching:Ve,isRefetching:ue,isPlaceholderData:Y,hasData:xe,minStep:we,maxStep:Te}=w.useMemo(()=>{const Ae=[se,re,K,fe,he,ae,Se,de,Me,Ce],We=new Map;t.forEach((Bt,Gt)=>{Gt<10&&We.set(Bt.runPath,Ae[Gt])});const De=new Set,Ne=new Map;let ot=!1,dt=!1,Pt=!1;if(Re.forEach((Bt,Gt)=>{var It;if(Gt>=10)return;const Dt=We.get(Bt.runPath);if(!Dt)return;Dt.isFetching&&(ot=!0),Dt.isRefetching&&(dt=!0),Dt.isPlaceholderData&&(Pt=!0);const Qt=((It=Dt.data)==null?void 0:It.metrics)||[],hn=new Map;Qt.forEach(Lt=>{De.add(Lt.step),hn.set(Lt.step,Lt.value)}),Ne.set(Gt,hn)}),De.size===0)return{uplotData:null,seriesConfig:[],isFetching:ot,isRefetching:dt,isPlaceholderData:Pt,hasData:!1,minStep:0,maxStep:0};const kt=Array.from(De).sort((Bt,Gt)=>Bt-Gt),wt=new Float64Array(kt),Vt=[{label:"Step"}],rn=[wt];return Re.forEach((Bt,Gt)=>{if(Gt>=10)return;const Dt=Ne.get(Gt)||new Map,Qt=kt.map(zt=>Dt.get(zt)??null),hn=h===Bt.runPath,It=h!==null;let Lt;It&&!hn?Lt=.1:Lt=a?.3:1,rn.push(Qt),Vt.push({label:Pp(Bt),stroke:Bt.color,width:1,alpha:Lt,spanGaps:!0,points:{show:!1}})}),a&&Re.forEach((Bt,Gt)=>{if(Gt>=10)return;const Dt=Ne.get(Gt)||new Map,Qt=2/(l+1);let hn=null;const It=[];kt.forEach(Ot=>{const Ct=Dt.get(Ot);Ct!==void 0?(hn===null?hn=Ct:hn=Qt*Ct+(1-Qt)*hn,It.push(hn)):It.push(null)});const Lt=h===Bt.runPath,zt=h!==null;let pn;zt&&!Lt?pn=.1:pn=1,rn.push(It),Vt.push({label:`${Pp(Bt)} (EMA)`,stroke:Bt.color,width:1.5,alpha:pn,spanGaps:!0,points:{show:!1}})}),{uplotData:rn,seriesConfig:Vt,isFetching:ot,isRefetching:dt,isPlaceholderData:Pt,hasData:!0,minStep:kt[0],maxStep:kt[kt.length-1]}},[t,Re,se,re,K,fe,he,ae,Se,de,Me,Ce,a,l,h]),ge=n.split("_").pop()||"",Ue=w.useCallback(Ae=>Ae==null?"N/A":o&&(ge==="min"||ge==="max")?Math.round(Ae).toLocaleString():_u(Ae),[o,ge]),be=w.useCallback(Ae=>Math.abs(Ae)>=1e3?`${parseFloat((Ae/1e3).toFixed(1))}k`:o?ge==="min"||ge==="max"?Math.round(Ae).toString():String(parseFloat(Ae.toFixed(1))):Number.isInteger(Ae)?Ae.toLocaleString():Math.abs(Ae)<.01&&Ae!==0?Ae.toExponential(1):String(parseFloat(Ae.toFixed(2))),[o,ge]),ke=w.useCallback(Ae=>Ae>=1e3?`${(Ae/1e3).toFixed(0)}k`:Ae.toString(),[]);w.useEffect(()=>{if(!O.current||!Le||!xe)return;const Ae=O.current,We=Ae.clientWidth,De=Ae.clientHeight||160;let Ne=null;if(W){const Ot=[];for(let Ct=1;Ct<Le.length;Ct++){const tn=Le[Ct],en=J?1:0;for(let bn=en;bn<tn.length;bn++){const On=tn[bn];On!=null&&Ot.push(On)}}Ne=EC(Ot)}let ot=1/0,dt=-1/0;for(let Ot=1;Ot<Le.length;Ot++){const Ct=Le[Ot],tn=J?1:0;for(let en=tn;en<Ct.length;en++){const bn=Ct[en];if(bn!=null){if(W&&Ne&&(bn<Ne.lower||bn>Ne.upper))continue;bn<ot&&(ot=bn),bn>dt&&(dt=bn)}}}const Pt=dt-ot,kt=Math.max(Math.abs(dt),Math.abs(ot)),wt=Math.max(kt*.05,1e-10),Vt=Math.max(Pt*.1,wt);let rn,Bt;i?(rn=Math.min(ot-Vt,0),Bt=Math.max(dt+Vt,0)):(rn=ot-Vt,Bt=dt+Vt),ne!==null&&(rn=ne),ie!==null&&(Bt=ie);const Gt=T?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",Dt=T?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Qt=(Ot,Ct)=>{if(!Ct||Ct.length===0)return 36;const tn=Math.max(...Ct.map(en=>en.length));return Math.max(36,tn*6+12)},hn=c!=null&&Number.isFinite(we)&&Number.isFinite(Te)&&c>=we&&c<=Te,It={width:We,height:De,padding:[4,4,0,0],cursor:{show:!0,x:!0,y:!1,points:{show:!1}},legend:{show:!1},scales:{x:{time:!1},y:{range:[rn,Bt]}},axes:[{stroke:Dt,grid:{stroke:Gt,width:1},ticks:{stroke:Gt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(Ot,Ct)=>Ct.map(ke)},{stroke:Dt,grid:{stroke:Gt,width:1},ticks:{stroke:Gt,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:Qt,values:(Ot,Ct)=>Ct.map(be)}],series:ze,hooks:{draw:[Ot=>{if(hn&&c!=null){const Ct=Ot.ctx,tn=Ot.valToPos(c,"x",!0),en=Ot.valToPos(Bt,"y",!0),bn=Ot.valToPos(rn,"y",!0);Ct.save(),Ct.strokeStyle=T?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.25)",Ct.lineWidth=2,Ct.beginPath(),Ct.moveTo(tn,en),Ct.lineTo(tn,bn),Ct.stroke(),Ct.restore()}if(i&&rn<0&&Bt>0){const Ct=Ot.ctx,tn=Ot.valToPos(0,"y",!0),en=Ot.valToPos(Ot.scales.x.min,"x",!0),bn=Ot.valToPos(Ot.scales.x.max,"x",!0);Ct.save(),Ct.strokeStyle=T?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",Ct.lineWidth=1,Ct.setLineDash([5,5]),Ct.beginPath(),Ct.moveTo(en,tn),Ct.lineTo(bn,tn),Ct.stroke(),Ct.restore()}}],setCursor:[Ot=>{if(!L.current)return;const{left:Ct,idx:tn}=Ot.cursor;if(B.current=tn??null,tn==null||Ct===void 0||Ct<0){L.current.style.display="none";return}const en=Le[0][tn];if(en===void 0){L.current.style.display="none";return}let bn=`<div class="font-medium mb-1">Step ${Number(en).toLocaleString()}</div>`;const On=le.length;t.forEach(xt=>{var bt,Tt;const $t=He.get(xt.runPath);if($t===void 0)return;const sn=$t+1,Zt=(bt=Le[sn])==null?void 0:bt[tn];let Fe;if(a){const Yt=On+$t+1;Fe=(Tt=Le[Yt])==null?void 0:Tt[tn]}Zt!=null&&(bn+=`
                <div class="mt-1">
                  <div class="flex items-center gap-2">
                    <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${xt.color}"></div>
                    <span>${GS(xt)}</span>
                  </div>
                  <div class="ml-4 flex items-center gap-2">
                    <span class="font-medium" style="opacity: ${a?.7:1}">${Ue(Zt)}${s?` ${s}`:""}</span>
                    ${a&&Fe!==void 0&&Fe!==null?`<span class="text-muted-foreground">(EMA: ${Ue(Fe)})</span>`:""}
                  </div>
                </div>
              `)}),L.current.innerHTML=bn,L.current.style.display="block",L.current.style.left="0px",L.current.style.top="0px";const _e=L.current.getBoundingClientRect(),tt=O.current.getBoundingClientRect();let gt=tt.left+Ct+15;gt+_e.width+20>window.innerWidth&&(gt=tt.left+Ct-_e.width-15+Ot.bbox.left),gt=Math.max(4,gt);let pt=tt.top-_e.height+20;pt<4&&(pt=tt.top+8),L.current.style.left=`${gt-_e.left}px`,L.current.style.top=`${pt-_e.top}px`}]}};R.current&&R.current.destroy();const Lt=new ls(It,Le,Ae);R.current=Lt;const zt=()=>{const Ot=B.current;if(Ot!=null){let Ct=Le[0][Ot];Ct!==void 0&&!isNaN(Ct)&&(x!=null&&Ct>x&&(Ct=x),M(Ct))}};Ae.addEventListener("click",zt);const pn=new ResizeObserver(Ot=>{for(const Ct of Ot){const{width:tn,height:en}=Ct.contentRect;Lt&&tn>0&&en>0&&Lt.setSize({width:tn,height:en})}});return pn.observe(Ae),()=>{Ae.removeEventListener("click",zt),pn.disconnect(),Lt.destroy(),R.current=null}},[Le,ze,xe,i,be,ke,Ue,Re,a,s,c,we,Te,M,x,t,le,He,T,W,J,ne,ie,A]);const qe=w.useCallback(()=>{L.current&&(L.current.style.display="none")},[]),Qe=Ve&&(!ue||Y),nt=W||J||ne!==null||ie!==null;return D(d.jsxs("div",{ref:k,className:vt("group/card bg-background",A?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!A&&Qe&&"opacity-50"),children:[d.jsxs("div",{className:"shrink-0 mb-2",children:[d.jsxs("div",{className:"flex items-center justify-between gap-2",children:[!A&&S,d.jsx("div",{className:"flex-1 min-w-0",children:d.jsx("h4",{className:vt("font-medium leading-snug line-clamp-2 break-words",A?"text-sm":"text-xs"),title:r,children:r})}),d.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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/card:opacity-100",children:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:W,onCheckedChange:j,children:"Ignore Outliers"}),d.jsx(hr,{checked:J,onCheckedChange:X,children:"Ignore First Step"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:ne??"",onChange:Ae=>{const We=Ae.target.value;F(We===""?null:Number(We))},onClick:Ae=>Ae.stopPropagation(),onKeyDown:Ae=>Ae.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:Ae=>{const We=Ae.target.value;ce(We===""?null:Number(We))},onClick:Ae=>Ae.stopPropagation(),onKeyDown:Ae=>Ae.stopPropagation()})]})]})]}),d.jsx(NQ,{isFullscreen:A,onClick:N}),!A&&d.jsx("button",{onClick:f,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:d.jsx(ka,{className:"h-3.5 w-3.5"})})]})]}),nt&&d.jsxs("div",{className:"flex items-center gap-1 mt-1 flex-wrap",children:[W&&d.jsx(os,{label:"Ignore Outliers",onRemove:()=>j(!1)}),J&&d.jsx(os,{label:"Ignore First Step",onRemove:()=>X(!1)}),ne!==null&&d.jsx(os,{label:`Min Y: ${ne}`,onRemove:()=>F(null)}),ie!==null&&d.jsx(os,{label:`Max Y: ${ie}`,onRemove:()=>ce(null)})]})]}),xe?d.jsxs("div",{className:vt("cursor-pointer relative bg-background rounded",A?"flex-1 min-h-0":"h-40"),ref:O,onMouseLeave:qe,children:[d.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"}}),ue&&!Y&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:vt("flex items-center justify-center text-muted-foreground text-xs rounded",A?"flex-1 min-h-0":"h-40"),children:Ve?"Loading...":"No data"})]}))}function Fke(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 Uke({runPath:t,step:e,metricType:n,label:r,showZeroLine:i,isTokenMetric:s,onRemove:o,scrollRoot:a=null,headerPrefix:l}){const c=Kn(us),f=w.useRef(null),h=w.useRef(null),m=w.useRef(null),x=w.useRef(null),b=kI(f,{root:a,threshold:0}),{data:_,isFetching:S,isRefetching:M,isPlaceholderData:T}=Ffe(t,e??null,n,b&&!!t&&e!==null&&e!==void 0&&!!n),{histogramData:A,hasData:N}=w.useMemo(()=>{const R=(_==null?void 0:_.values)??[];if(R.length===0)return{histogramData:null,hasData:!1};const{binEdges:L,counts:B}=Fke(R,25),H=L.slice(0,-1).map(($,G)=>($+L[G+1])/2);return{histogramData:{binEdges:L,binCenters:H,counts:B,totalCount:R.length,min:Math.min(...R),max:Math.max(...R),mean:R.reduce(($,G)=>$+G,0)/R.length},hasData:!0}},[_==null?void 0:_.values]),D=w.useCallback(R=>R==null?"N/A":s?Math.round(R).toLocaleString():_u(R),[s]);w.useEffect(()=>{if(!h.current||!A||!N)return;const R=h.current,L=R.clientWidth,B=R.clientHeight||160,H=new Float64Array(A.binCenters),$=new Float64Array(A.counts),G=[H,$],V=Math.max(...A.counts)*1.1,W=c?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",J=c?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",ne="rgba(59, 130, 246, 0.7)",ie=A.binEdges[1]-A.binEdges[0],j={width:L,height:B,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,V]}},axes:[{stroke:J,grid:{stroke:W,width:1},ticks:{stroke:W,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,values:(ce,oe)=>oe.map(Q=>Math.abs(Q)>=1e3?`${parseFloat((Q/1e3).toFixed(1))}k`:Math.abs(Q)<.01&&Q!==0?Q.toExponential(1):String(parseFloat(Q.toFixed(2))))},{stroke:J,grid:{stroke:W,width:1},ticks:{stroke:W,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(ce,oe)=>{if(!oe||oe.length===0)return 36;const Q=Math.max(...oe.map(se=>se.length));return Math.max(36,Q*6+12)},values:(ce,oe)=>oe.map(Q=>Q>=1e3?`${(Q/1e3).toFixed(0)}k`:Math.round(Q).toString())}],series:[{label:"Value"},{label:"Count",stroke:ne,fill:ne,width:0,paths:(ce,oe)=>{const Q=new Path2D,{data:se}=ce,re=se[0],K=se[oe];for(let fe=0;fe<re.length;fe++){const he=re[fe],ae=K[fe];if(ae==null||ae===0)continue;const Se=ce.valToPos(he-ie/2,"x",!0),de=ce.valToPos(he+ie/2,"x",!0),Me=ce.valToPos(0,"y",!0),Ce=ce.valToPos(ae,"y",!0),Re=Math.max(1,de-Se-1);Q.rect(Se+.5,Ce,Re,Me-Ce)}return{stroke:Q,fill:Q}}}],hooks:{draw:[ce=>{if(i&&A.min<0&&A.max>0){const oe=ce.ctx,Q=ce.valToPos(0,"x",!0),se=ce.valToPos(0,"y",!0),re=ce.valToPos(V,"y",!0);oe.save(),oe.strokeStyle=c?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",oe.lineWidth=1,oe.setLineDash([5,5]),oe.beginPath(),oe.moveTo(Q,se),oe.lineTo(Q,re),oe.stroke(),oe.restore()}}],setCursor:[ce=>{if(!x.current)return;const{left:oe,idx:Q}=ce.cursor;if(Q==null||oe===void 0||oe<0){x.current.style.display="none";return}const se=A.binCenters[Q],re=A.counts[Q],K=A.binEdges[Q],fe=A.binEdges[Q+1];if(se===void 0||re===void 0){x.current.style.display="none";return}const he=(re/A.totalCount*100).toFixed(1);x.current.innerHTML=`
              <div class="font-medium mb-1">Range: ${D(K)} - ${D(fe)}</div>
              <div class="text-muted-foreground">Count: ${re.toLocaleString()} (${he}%)</div>
            `,x.current.style.display="block",x.current.style.left="0px",x.current.style.top="0px";const ae=x.current.getBoundingClientRect(),Se=h.current.getBoundingClientRect();let de=Se.left+oe+15;de+ae.width+20>window.innerWidth&&(de=Se.left+oe-ae.width-15+ce.bbox.left),de=Math.max(4,de);let Me=Se.top-ae.height+20;Me<4&&(Me=Se.top+8),x.current.style.left=`${de-ae.left}px`,x.current.style.top=`${Me-ae.top}px`}]}};m.current&&m.current.destroy();const X=new ls(j,G,R);m.current=X;const F=new ResizeObserver(ce=>{for(const oe of ce){const{width:Q,height:se}=oe.contentRect;X&&Q>0&&se>0&&X.setSize({width:Q,height:se})}});return F.observe(R),()=>{F.disconnect(),X.destroy(),m.current=null}},[A,N,i,D,c]);const k=w.useCallback(()=>{x.current&&(x.current.style.display="none")},[]),O=S&&(!M||T);return d.jsxs("div",{ref:f,className:vt("group/card rounded-lg border border-border p-3 transition-opacity","bg-background",O&&"opacity-50"),children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l,d.jsx("div",{className:"flex-1 min-w-0",children:d.jsx("h4",{className:"text-xs font-medium leading-snug line-clamp-2 break-words",title:r,children:r})}),d.jsx("div",{className:"flex items-center gap-2",children:d.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:d.jsx(ka,{className:"h-3.5 w-3.5"})})})]}),N?d.jsxs("div",{className:"h-40 relative bg-background rounded",ref:h,onMouseLeave:k,children:[d.jsx("div",{ref:x,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"}}),M&&!T&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:"h-40 flex items-center justify-center text-muted-foreground text-xs rounded",children:S?"Loading...":e==null?"Select a step to view histogram":"No data"})]})}const vT=100;function Bke(t,e,n){const r=t.length;if(r<=vT)return{steps:t,counts:e};const i=Math.ceil(r/vT),s=[],o=[],a=n.length-1;for(let l=0;l<r;l+=i){const c=Math.min(l+i,r),f=Math.floor((l+c-1)/2);s.push(t[f]);const h=new Array(a).fill(0);for(let m=l;m<c;m++){const x=e[m];for(let b=0;b<a;b++)h[b]+=x[b]||0}o.push(h)}return{steps:s,counts:o}}function Hke({runPath:t,metricType:e,label:n,showZeroLine:r,isTokenMetric:i,currentStep:s,shouldPoll:o,onRemove:a,selectedStepAtom:l=YT,maxSelectableStep:c,scrollRoot:f=null,headerPrefix:h}){const m=Kn(us),{isFullscreen:x,toggleFullscreen:b,fullscreenPortal:_}=AQ(),S=w.useRef(null),M=w.useRef(null),T=w.useRef(null),A=w.useRef(null),N=w.useRef(null),D=ad(l),[k,O]=w.useState(0),L=kI(S,{root:f,threshold:0})||x,{data:B,isFetching:H,isRefetching:$,isPlaceholderData:G}=QW(t,e,L&&!!t&&!!e,o),Z=B&&B.steps.length>0&&B.bin_edges.length>0,V=Z&&B.steps.length>vT,W=w.useMemo(()=>!Z||!B?null:V?Bke(B.steps,B.counts,B.bin_edges):{steps:B.steps,counts:B.counts},[Z,B,V]),J=w.useCallback(ce=>ce==null?"N/A":i?Math.round(ce).toLocaleString():_u(ce),[i]),ne=w.useCallback(ce=>Math.abs(ce)>=1e3?`${parseFloat((ce/1e3).toFixed(1))}k`:i?Math.round(ce).toString():Number.isInteger(ce)?ce.toLocaleString():Math.abs(ce)<.01&&ce!==0?ce.toExponential(1):String(parseFloat(ce.toFixed(2))),[i]),ie=w.useCallback(()=>{const ce={top:8,right:8,bottom:24,left:40};if(!T.current||!B)return ce;const oe=T.current.getContext("2d");if(!oe)return ce;const Q="10px system-ui, sans-serif",se=5;let re=0;oe.save(),oe.setTransform(1,0,0,1,0,0),oe.font=Q;for(let K=0;K<se;K++){const fe=(B.global_min??0)+K/(se-1)*((B.global_max??0)-(B.global_min??0)),he=ne(fe);re=Math.max(re,oe.measureText(he).width)}return oe.restore(),{top:8,right:8,bottom:24,left:Math.max(36,Math.ceil(re)+12)}},[B,ne]);w.useEffect(()=>{if(!M.current||!T.current||!Z||!B||!W)return;const ce=M.current,oe=T.current,Q=oe.getContext("2d");if(!Q)return;const se=ce.clientWidth,re=ce.clientHeight||160,K=m?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",fe=m?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",he="10px system-ui, sans-serif",ae=window.devicePixelRatio||1;oe.width=se*ae,oe.height=re*ae,oe.style.width=`${se}px`,oe.style.height=`${re}px`,Q.scale(ae,ae),Q.font=he,Q.clearRect(0,0,se,re);const Se=ie(),de=se-Se.left-Se.right,Me=re-Se.top-Se.bottom,Ce=W.steps,Re=B.bin_edges,le=W.counts,He=Ce.length,Le=Re.length-1;if(He===0||Le===0)return;let ze=0;for(const Ue of le)for(const be of Ue)be>ze&&(ze=be);const Ve=Math.min(5,He),ue=5,Y=de/Math.max(He,1),xe=Ue=>Se.left+(Ue+.5)*Y,we=Ue=>{const be=(B.global_max??1)-(B.global_min??0),ke=(Ue-(B.global_min??0))/(be||1);return Se.top+Me-ke*Me},Te=Ue=>Ue===0?"transparent":`rgba(59, 130, 246, ${.15+Math.sqrt(Ue/ze)*.75})`;Q.strokeStyle=fe,Q.lineWidth=1;for(let Ue=0;Ue<Ve;Ue++){const be=Math.floor(Ue/Math.max(Ve-1,1)*(He-1)),ke=xe(be);Q.beginPath(),Q.moveTo(ke,Se.top),Q.lineTo(ke,re-Se.bottom),Q.stroke()}for(let Ue=0;Ue<ue;Ue++){const be=(B.global_min??0)+Ue/(ue-1)*((B.global_max??0)-(B.global_min??0)),ke=we(be);Q.beginPath(),Q.moveTo(Se.left,ke),Q.lineTo(se-Se.right,ke),Q.stroke()}const ge=Y;for(let Ue=0;Ue<He;Ue++){const be=Se.left+Ue*Y,ke=le[Ue];for(let qe=0;qe<Le;qe++){const Qe=ke[qe];if(Qe===0)continue;const nt=Re[qe+1],st=Re[qe],Pe=we(nt),Ke=we(st),rt=Math.max(1,Ke-Pe);Q.fillStyle=Te(Qe),Q.fillRect(be,Pe,ge,rt)}}if(r&&(B.global_min??0)<0&&(B.global_max??0)>0){const Ue=we(0);Q.strokeStyle=m?"rgba(255, 255, 255, 0.35)":"rgba(128, 128, 128, 0.5)",Q.lineWidth=1,Q.setLineDash([5,5]),Q.beginPath(),Q.moveTo(Se.left,Ue),Q.lineTo(se-Se.right,Ue),Q.stroke(),Q.setLineDash([])}if(s!=null){let Ue=-1,be=1/0;for(let ke=0;ke<Ce.length;ke++){const qe=Math.abs(Ce[ke]-s);qe<be&&(be=qe,Ue=ke)}if(Ue>=0){const ke=xe(Ue);Q.strokeStyle=m?"rgba(255, 255, 255, 0.2)":"rgba(128, 128, 128, 0.25)",Q.lineWidth=1,Q.beginPath(),Q.moveTo(ke,Se.top),Q.lineTo(ke,re-Se.bottom),Q.stroke()}}Q.strokeStyle=K,Q.lineWidth=1,Q.beginPath(),Q.moveTo(Se.left,re-Se.bottom),Q.lineTo(se-Se.right,re-Se.bottom),Q.stroke(),Q.beginPath(),Q.moveTo(Se.left,Se.top),Q.lineTo(Se.left,re-Se.bottom),Q.stroke(),Q.fillStyle=K,Q.font=he,Q.textAlign="center";for(let Ue=0;Ue<Ve;Ue++){const be=Math.floor(Ue/Math.max(Ve-1,1)*(He-1)),ke=Ce[be],qe=xe(be),Qe=ke>=1e3?`${(ke/1e3).toFixed(0)}k`:ke.toString();Q.fillText(Qe,qe,re-6)}Q.textAlign="right",Q.textBaseline="middle";for(let Ue=0;Ue<ue;Ue++){const be=(B.global_min??0)+Ue/(ue-1)*((B.global_max??0)-(B.global_min??0)),ke=we(be);Q.fillText(ne(be),Se.left-4,ke)}},[B,W,Z,r,s,ne,ie,m,k,x]),w.useEffect(()=>{if(!M.current)return;const ce=M.current,oe=new ResizeObserver(()=>{O(Q=>Q+1)});return oe.observe(ce),()=>{oe.disconnect()}},[]);const z=w.useCallback(ce=>{if(!B||!W||!T.current||!M.current)return;const oe=T.current.getBoundingClientRect(),Q=ce.clientX-oe.left,se=M.current.clientWidth,re=ie(),K=se-re.left-re.right;if(K<=0)return;const fe=(Q-re.left)/K,he=Math.round(fe*(W.steps.length-1));if(he>=0&&he<W.steps.length){let ae=W.steps[he];c!=null&&ae>c&&(ae=c),D(ae)}},[B,W,ie,D,c]),j=w.useCallback(ce=>{var Qe;if(!B||!W||!A.current||!T.current||!M.current)return;const oe=T.current.getBoundingClientRect(),Q=ce.clientX-oe.left,se=ce.clientY-oe.top,re=M.current.clientWidth,K=M.current.clientHeight||160,fe=ie(),he=re-fe.left-fe.right,ae=K-fe.top-fe.bottom;if(he<=0||ae<=0){N.current&&(N.current.style.display="none");return}if(Q<fe.left||Q>re-fe.right||se<fe.top||se>K-fe.bottom){A.current.style.display="none",N.current&&(N.current.style.display="none");return}const Se=(Q-fe.left)/he,de=Math.min(W.steps.length-1,Math.max(0,Math.round(Se*(W.steps.length-1)))),Me=W.steps[de];if(N.current){const nt=he/Math.max(W.steps.length,1),st=fe.left+(de+.5)*nt;N.current.style.display="block",N.current.style.left=`${st}px`,N.current.style.top=`${fe.top}px`,N.current.style.bottom=`${fe.bottom}px`}const Ce=1-(se-fe.top)/ae,Re=B.bin_edges.length-1,le=Math.min(Re-1,Math.max(0,Math.floor(Ce*Re))),He=B.bin_edges[le],Le=B.bin_edges[le+1],ze=((Qe=W.counts[de])==null?void 0:Qe[le])??0,ue=(W.counts[de]??[]).reduce((nt,st)=>nt+st,0),Y=ue>0?(ze/ue*100).toFixed(1):"0.0",we=V&&B.steps.length>vT?" (aggregated)":"";A.current.innerHTML=`
        <div class="font-medium mb-1">Step ${Me.toLocaleString()}${we}</div>
        <div class="text-muted-foreground">Range: ${J(He)} to ${J(Le)}</div>
        <div class="text-muted-foreground">Count: ${ze.toLocaleString()} (${Y}%)</div>
      `,A.current.style.display="block",A.current.style.left="0px",A.current.style.top="0px";const Te=A.current.getBoundingClientRect(),ge=ce.clientX;let Ue=ge;Ue+Te.width+20>window.innerWidth&&(Ue=ge-Te.width);const be=Math.max(4,window.innerWidth-Te.width-4);Ue=Math.min(Math.max(4,Ue),be);const ke=M.current.getBoundingClientRect();let qe=ke.top-Te.height+20;qe<4&&(qe=ke.top+8),A.current.style.left=`${Ue-Te.left}px`,A.current.style.top=`${qe-Te.top}px`},[B,W,J,ie,V]),X=w.useCallback(()=>{A.current&&(A.current.style.display="none"),N.current&&(N.current.style.display="none")},[]),F=H&&(!$||G);return _(d.jsxs("div",{ref:S,className:vt("group/card bg-background",x?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!x&&F&&"opacity-50"),children:[d.jsxs("div",{className:"flex items-center justify-between mb-2 shrink-0",children:[!x&&h,d.jsx("div",{className:"flex-1 min-w-0",children:d.jsx("h4",{className:vt("font-medium leading-snug line-clamp-2 break-words",x?"text-sm":"text-xs"),title:n,children:n})}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(NQ,{isFullscreen:x,onClick:b}),!x&&d.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:d.jsx(ka,{className:"h-3.5 w-3.5"})})]})]}),Z?d.jsxs("div",{className:vt("relative bg-background rounded",x?"flex-1 min-h-0":"h-40"),ref:M,children:[d.jsx("canvas",{className:"block w-full h-full max-w-full cursor-pointer",ref:T,onClick:z,onMouseMove:j,onMouseLeave:X}),d.jsx("div",{ref:N,className:"absolute z-[2] border-l border-dashed border-border pointer-events-none",style:{display:"none"}}),d.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"}}),$&&!G&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"})]}):d.jsx("div",{className:vt("flex items-center justify-center text-muted-foreground text-xs rounded",x?"flex-1 min-h-0":"h-40"),children:H?"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 Gke(t){return t===null||Number.isNaN(t)?null:`hsl(${Math.max(0,Math.min(1,t))*120} 70% 38%)`}function VN(t,e,n,r){if(e==null||n==null||e>=n)return;let i=Math.max(0,Math.min(1,(t-e)/(n-e)));return r&&(i=1-i),`hsl(${(i*120).toFixed(0)} 80% 38%)`}function rU(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 WN(t,e,n=85,r=!1){if(t===null||e===null||e<=0)return null;const i=Math.max(0,Math.min(e,t));return r?`hsl(0 0% ${30+i/e*60}%)`:`hsl(0 0% ${n-i/e*(n-5)}%)`}function II({openAtom:t=p8}={}){const[e,n]=cn(t);return!Kn(wl)||e?null:d.jsx(Sn,{variant:"outline",size:"sm",onClick:()=>n(!0),children:"Samples"})}const iU=["gen_length","gen_length_sum","gen_length_avg","reward","advantage"];function DI({prompts:t,data:e,samplesData:n,rolloutMetrics:r,availableMetricNames:i,isLoading:s,step:o,currentStepIndex:a,totalSteps:l,onStepChange:c,hasSteps:f,stepValues:h,openAtom:m=p8,selectedGroupIdAtom:x=FW,selectedSampleIdxAtom:b=UW,viewModeAtom:_=HW,getGroupBadge:S,renderLeftControls:M,onGroupClick:T,hideRewardAdvantage:A=!1,envDetailsOverride:N}){var rt,ye,$e,Ze,ft,lt,Je,Ae,We;const[D,k]=cn(m),[O,R]=cn(x),[L,B]=cn(b),[H,$]=cn(_),[G,Z]=cn(Rue),[V,W]=cn(Pue),J=Kn(wl),ne=Kn(us),{data:ie}=Sh(J||"",!!J,!0),z=(rt=ie==null?void 0:ie.config)==null?void 0:rt.max_tokens,j=w.useMemo(()=>rU(z),[z]),X=(ye=ie==null?void 0:ie.config)==null?void 0:ye.group_size,F=w.useMemo(()=>rU(X),[X]),ce=w.useMemo(()=>{if(F==null||F<=1)return null;const De=Math.sqrt(F-1);return{min:-De,max:De}},[F]),oe=N??(($e=ie==null?void 0:ie.config)==null?void 0:$e.environments),Q=w.useMemo(()=>KS(oe),[oe]),se=w.useMemo(()=>{var dt;const De=Dp(oe),Ne=Dp((dt=ie==null?void 0:ie.summary)==null?void 0:dt.env_details),ot=ZS(ie==null?void 0:ie.data_metric_ranges);return Op(Op(De,Ne),ot)},[oe,(Ze=ie==null?void 0:ie.summary)==null?void 0:Ze.env_details,ie==null?void 0:ie.data_metric_ranges]),re=w.useMemo(()=>{var Ne;const De=[oe,(Ne=ie==null?void 0:ie.summary)==null?void 0:Ne.env_details];for(const ot of De){const dt=AP(ot);if(dt.length!==0)return dt.some(Pt=>(Pt==null?void 0:Pt.is_multi_turn)===!0)}return!1},[oe,(ft=ie==null?void 0:ie.summary)==null?void 0:ft.env_details]),[K,fe]=w.useState(new Map),he=w.useMemo(()=>{if(!r)return null;const De=new Map;for(const Ne of r){let ot=De.get(Ne.sample_idx);ot||(ot=new Map,De.set(Ne.sample_idx,ot)),ot.set(Ne.metric_name,{value:Ne.value,env:Ne.env})}return De},[r]);he!==null&&he!==K&&fe(he);const ae=he??K,[Se,de]=w.useState([]),Me=w.useMemo(()=>{if(i!=null&&i.length)return i;if(!r)return null;const De=new Set;for(const Ne of r)De.add(Ne.metric_name);return[...De].sort()},[i,r]);Me!==null&&Me!==Se&&de(Me);const Ce=Me??Se,Re=(De,Ne)=>{Z(ot=>Ne===!0?ot.includes(De)?ot:[...ot,De]:ot.filter(dt=>dt!==De))};w.useEffect(()=>{if(!Ce.length&&!e)return;const De=new Set;A&&(De.add("reward"),De.add("advantage")),re?De.add("gen_length"):(De.add("gen_length_sum"),De.add("gen_length_avg"));const Ne=iU.filter(dt=>!De.has(dt)),ot=new Set([...Ne,...Ce]);Z(dt=>{let Pt=dt;!re&&!dt.includes("gen_length")&&(dt.includes("gen_length_avg")||dt.includes("gen_length_sum"))?Pt=[...Pt.filter(wt=>wt!=="gen_length_avg"&&wt!=="gen_length_sum"),"gen_length"]:re&&!dt.includes("gen_length_avg")&&dt.includes("gen_length")&&(Pt=[...Pt.filter(wt=>wt!=="gen_length"),"gen_length_avg"]);const kt=Pt.filter(wt=>ot.has(wt));return kt.length===dt.length&&kt.every((wt,Vt)=>wt===dt[Vt])?dt:kt})},[Ce,e,Z,A,re]);const le=w.useMemo(()=>{const De=new Set;A&&(De.add("reward"),De.add("advantage")),re?De.add("gen_length"):(De.add("gen_length_sum"),De.add("gen_length_avg"));const Ne=[],ot=new Set;for(const dt of iU)De.has(dt)||G.includes(dt)&&!ot.has(dt)&&(Ne.push(dt),ot.add(dt));for(const dt of Ce)G.includes(dt)&&!ot.has(dt)&&(Ne.push(dt),ot.add(dt));return Ne},[G,Ce,A,re]),[He,Le]=w.useState([]),ze=w.useRef(0),Ve=w.useRef(null),ue=w.useRef(o),Y=w.useRef(0);w.useEffect(()=>{var ot;const De=(ot=Ve.current)==null?void 0:ot.querySelector('[data-slot="scroll-area-viewport"]');if(!De)return;const Ne=()=>{Y.current=De.scrollTop};return De.addEventListener("scroll",Ne,{passive:!0}),()=>De.removeEventListener("scroll",Ne)},[D]),w.useEffect(()=>{var De;if(o!==ue.current){ue.current=o,ze.current=0,Y.current=0;const Ne=(De=Ve.current)==null?void 0:De.querySelector('[data-slot="scroll-area-viewport"]');Ne&&(Ne.scrollTop=0)}},[o]);const xe=w.useMemo(()=>{if(!t)return new Map;const De=new Map;for(const Ne of t)De.set(Ne.group_id,Ne);return De},[t]),we=w.useMemo(()=>{if(!n)return new Map;const De=new Map;for(const Ne of n)De.set(Ne.sample_idx,Ne);return De},[n]),Te=w.useMemo(()=>{if(!e)return null;const De=new Map,Ne=new Map;for(const kt of e){const wt=De.get(kt.sample_idx)||[];wt.push(kt),De.set(kt.sample_idx,wt),Ne.set(kt.sample_idx,kt.group_id)}const ot=new Map;for(const[kt,wt]of De){const Vt=[...wt].sort((Ct,tn)=>Ct.turn_order-tn.turn_order),rn=Ne.get(kt)??-1,Bt=xe.get(rn)??null,Gt=we.get(kt),Dt=Vt.find(Ct=>Ct.turn_type==="model"),Qt=(Dt==null?void 0:Dt.content)??"";let hn=null,It=null,Lt=0,zt=0;for(const Ct of Vt)Ct.turn_type==="model"&&typeof Ct.tokens=="number"&&(Lt+=Ct.tokens,zt+=1);zt>0&&(hn=Lt/zt,It=Lt);const pn={sample_idx:kt,group_id:rn,prompt:Bt,responsePreview:Qt,turnsCount:Vt.length,turnsData:Vt,reward:(Gt==null?void 0:Gt.reward)??null,advantage:(Gt==null?void 0:Gt.advantage)??null,assistantTokens:hn,assistantTokensTotal:It},Ot=ot.get(rn)||[];Ot.push(pn),ot.set(rn,Ot)}const dt=[];for(const[kt,wt]of ot){const Vt=xe.get(kt)??null;wt.sort((rn,Bt)=>rn.sample_idx-Bt.sample_idx),dt.push({group_id:kt,prompt:Vt,samples:wt,sampleCount:wt.length})}return dt.sort((kt,wt)=>kt.group_id-wt.group_id)},[e,xe,we]);Te!==null&&Te!==He&&Le(Te);const ge=Te??He;w.useLayoutEffect(()=>{var Ne;const De=(Ne=Ve.current)==null?void 0:Ne.querySelector('[data-slot="scroll-area-viewport"]');De&&Y.current>0&&De.scrollTop!==Y.current&&(De.scrollTop=Y.current)},[ge]);const Ue=w.useMemo(()=>O===null?null:ge.find(De=>De.group_id===O)??null,[ge,O]),be=Ue!==null,ke=w.useMemo(()=>{let De=0;for(const Ne of ge)for(const ot of Ne.samples)ot.assistantTokens!==null&&ot.assistantTokens>De&&(De=ot.assistantTokens);return De>0?De:null},[ge]),qe=j??ke,Qe=w.useMemo(()=>{let De=0;for(const Ne of ge)for(const ot of Ne.samples)ot.assistantTokensTotal!==null&&ot.assistantTokensTotal>De&&(De=ot.assistantTokensTotal);return De>0?De:null},[ge]),nt=j!=null?Math.max(j,Qe??0)||null:Qe;w.useEffect(()=>{!be&&H==="samples"&&!s&&$("groups")},[be,H,$,s]);const st=De=>{var ot;const Ne=(ot=Ve.current)==null?void 0:ot.querySelector('[data-slot="scroll-area-viewport"]');if(Ne&&(ze.current=Ne.scrollTop),T){const dt=ge.find(Pt=>Pt.group_id===De);dt&&T(De,dt);return}R(De),$("samples")},Pe=De=>{B(De)},Ke=De=>{var Ne;if(De==="samples"&&!be){$("groups");return}if(De==="groups"||De==="samples"){if(H==="groups"&&De==="samples"){const ot=(Ne=Ve.current)==null?void 0:Ne.querySelector('[data-slot="scroll-area-viewport"]');ot&&(ze.current=ot.scrollTop)}$(De)}};return w.useEffect(()=>{H==="groups"&&ze.current>0&&requestAnimationFrame(()=>{var Ne;const De=(Ne=Ve.current)==null?void 0:Ne.querySelector('[data-slot="scroll-area-viewport"]');De&&(De.scrollTop=ze.current,Y.current=ze.current)})},[H]),w.useEffect(()=>{H!=="samples"||L===null||requestAnimationFrame(()=>{var ot;const De=(ot=Ve.current)==null?void 0:ot.querySelector('[data-slot="scroll-area-viewport"]');if(!De)return;const Ne=De.querySelector(`[data-sample-idx="${L}"]`);Ne&&(Ne.scrollIntoView({block:"nearest",behavior:"smooth"}),setTimeout(()=>{Y.current=De.scrollTop},350))})},[H,L]),!J||!D?null:d.jsxs("div",{className:"w-[260px] border-r border-border bg-card/50 backdrop-blur flex flex-col h-full min-h-0",children:[d.jsxs("div",{className:"border-b border-sidebar-border shrink-0",children:[d.jsx("div",{className:"py-2.5 px-1 flex items-center justify-center h-12",children:f?d.jsx(NP,{currentPage:a,totalPages:l,onPageChange:c,pageValues:h}):d.jsx("span",{className:"text-xs text-muted-foreground",children:s?"Loading...":"No steps available"})}),d.jsxs("div",{className:"py-1.5 px-3 flex items-center justify-between border-t border-sidebar-border",children:[M?M({viewMode:H,setViewMode:$,hasSelectedGroupInStep:be,groups:ge}):d.jsxs(M0,{type:"single",variant:"outline",size:"sm",value:H,onValueChange:Ke,children:[d.jsx(Ka,{value:"groups",className:"text-xs px-2 py-1 h-7",children:"Groups"}),d.jsx(Ka,{value:"samples",className:"text-xs px-2 py-1 h-7",disabled:!be,children:"Samples"})]}),d.jsxs("div",{className:"flex items-center gap-0.5",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7",children:d.jsx($W,{className:"h-4 w-4"})})}),d.jsxs($s,{align:"end",className:"min-w-[180px]",children:[d.jsx(y0,{children:"Settings"}),d.jsx(ys,{}),d.jsx(hr,{checked:V,onCheckedChange:De=>W(De===!0),onSelect:De=>De.preventDefault(),children:"Show Tooltips"})]})]}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7",children:d.jsx(Fk,{className:"h-4 w-4"})})}),d.jsxs($s,{align:"end",className:"min-w-[180px]",children:[d.jsx(y0,{children:"Display Metrics"}),d.jsx(ys,{}),re?d.jsxs(d.Fragment,{children:[d.jsx(hr,{checked:G.includes("gen_length_sum"),onCheckedChange:De=>Re("gen_length_sum",De),onSelect:De=>De.preventDefault(),children:"Gen. Length Sum"}),d.jsx(hr,{checked:G.includes("gen_length_avg"),onCheckedChange:De=>Re("gen_length_avg",De),onSelect:De=>De.preventDefault(),children:"Gen. Length Avg"})]}):d.jsx(hr,{checked:G.includes("gen_length"),onCheckedChange:De=>Re("gen_length",De),onSelect:De=>De.preventDefault(),children:"Gen. Length"}),!A&&d.jsx(hr,{checked:G.includes("reward"),onCheckedChange:De=>Re("reward",De),onSelect:De=>De.preventDefault(),children:"Reward"}),!A&&d.jsx(hr,{checked:G.includes("advantage"),onCheckedChange:De=>Re("advantage",De),onSelect:De=>De.preventDefault(),children:"Advantage"}),Ce.length>0&&d.jsx(ys,{}),Ce.map(De=>d.jsx(hr,{checked:G.includes(De),onCheckedChange:Ne=>Re(De,Ne),onSelect:Ne=>Ne.preventDefault(),children:l7(De)},De))]})]}),d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>k(!1),children:d.jsx($de,{className:"h-4 w-4"})})]})]})]}),d.jsx($x,{ref:Ve,className:vt("flex-1 min-h-0 transition-opacity",s&&"opacity-50"),children:ge.length===0?d.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:s?"Loading...":"No samples available"}):H==="groups"||!Ue?d.jsx("div",{className:"p-2 space-y-1",children:ge.map(De=>d.jsx(Vke,{group:De,onClick:()=>st(De.group_id),isSelected:O===De.group_id,tokenScaleMax:qe,tokenScaleSumMax:nt,envRewardRanges:Q,envMetricRanges:se,advantageRange:ce,badge:S?S(De):null,displayMetrics:le,metricsBySampleIdx:ae,tooltipsEnabled:V,darkMode:ne},De.group_id))}):d.jsxs("div",{className:"flex flex-col min-h-0",children:[d.jsxs(Np,{delayDuration:300,open:V?void 0:!1,children:[d.jsx(kp,{asChild:!0,children:d.jsxs("div",{className:"p-3 border-b border-border bg-muted/30 shrink-0 cursor-default",children:[((lt=Ue.prompt)==null?void 0:lt.system_prompt)&&d.jsxs("div",{className:"mb-2",children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),d.jsx("p",{className:"text-xs text-foreground line-clamp-2 break-words overflow-hidden [overflow-wrap:anywhere]",children:dS(Ue.prompt.system_prompt,100)})]}),d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),d.jsx("p",{className:"text-xs text-foreground line-clamp-3 break-words overflow-hidden [overflow-wrap:anywhere]",children:dS((Je=Ue.prompt)==null?void 0:Je.prompt,150)})]})]})}),d.jsxs(Rp,{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:[((Ae=Ue.prompt)==null?void 0:Ae.system_prompt)&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),d.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:Ue.prompt.system_prompt})]}),((We=Ue.prompt)==null?void 0:We.prompt)&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),d.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:Ue.prompt.prompt})]})]})]}),d.jsx("div",{className:"p-2 space-y-1",children:Ue.samples.map(De=>d.jsx("div",{"data-sample-idx":De.sample_idx,children:d.jsx(Xke,{sample:De,isSelected:L===De.sample_idx,onClick:()=>Pe(De.sample_idx),envRewardRanges:Q,envMetricRanges:se,advantageRange:ce,displayMetrics:le,metricsBySampleIdx:ae,tokenScaleMax:qe,tokenScaleSumMax:nt,tooltipsEnabled:V,darkMode:ne})},De.sample_idx))})]})})]})}function Vke({group:t,onClick:e,isSelected:n,tokenScaleMax:r,tokenScaleSumMax:i,envRewardRanges:s,envMetricRanges:o,advantageRange:a,badge:l,displayMetrics:c,metricsBySampleIdx:f,tooltipsEnabled:h,darkMode:m}){var x,b,_,S;return d.jsxs(Np,{delayDuration:300,open:h?void 0:!1,children:[d.jsx(kp,{asChild:!0,children:d.jsx("button",{onClick:e,className:vt("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:d.jsxs("div",{className:"flex items-start justify-between gap-3",children:[d.jsxs("div",{className:"min-w-0 flex-1",children:[((x=t.prompt)==null?void 0:x.system_prompt)&&d.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)}),d.jsx("p",{className:"text-xs text-foreground line-clamp-2 break-words overflow-hidden [overflow-wrap:anywhere] break-all",children:dS((b=t.prompt)==null?void 0:b.prompt,80)}),l&&d.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:l})]}),c.length>0&&d.jsx("div",{className:"flex items-start gap-1 shrink-0 pt-0",children:c.map(M=>d.jsx("div",{className:"flex flex-col items-start gap-[0.5px]",children:t.samples.map(T=>{const A=c7(T,M,f,r,i,s,a,o,void 0,m);return d.jsx("div",{title:A.label,className:vt("h-1.5 w-1.5 rounded-none",A.color?"":"bg-muted"),style:A.color?{backgroundColor:A.color}:void 0},T.sample_idx)})},M))})]})})}),d.jsxs(Rp,{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:[((_=t.prompt)==null?void 0:_.system_prompt)&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"System Prompt"}),d.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:t.prompt.system_prompt})]}),((S=t.prompt)==null?void 0:S.prompt)&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5",children:"Prompt"}),d.jsx("p",{className:"text-xs whitespace-pre-wrap break-words",children:t.prompt.prompt})]})]})]})}function Wke(t){return t==="model"?"Assistant":t==="env"||t==="env_response"?"User":t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function l7(t){return t.replace(/_reward$/,"").split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function kQ(t){return Number.isInteger(t)?t.toString():t.toFixed(2)}function $ke(t,e){switch(e){case"gen_length":case"gen_length_sum":case"gen_length_avg":return Math.round(t).toString();default:return kQ(t)}}function qke(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 c7(t,e,n,r,i,s,o,a,l,c){var f,h;switch(e){case"gen_length":return{value:t.assistantTokensTotal,color:WN(t.assistantTokensTotal,i,l,c),label:t.assistantTokensTotal!==null?`Gen. Length: ${t.assistantTokensTotal}`:"Gen. Length: n/a"};case"gen_length_sum":return{value:t.assistantTokensTotal,color:WN(t.assistantTokensTotal,i,l,c),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:WN(t.assistantTokens,r,l,c),label:t.assistantTokens!==null?`Gen. Length Avg: ${Math.round(t.assistantTokens)}`:"Gen. Length Avg: n/a"};case"reward":{const m=((f=t.prompt)==null?void 0:f.env)??null,x=m?s==null?void 0:s.get(m):void 0;return{value:t.reward,color:t.reward!==null?VN(t.reward,(x==null?void 0:x.min)??null,(x==null?void 0:x.max)??null)??Gke(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?VN(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 m=n.get(t.sample_idx),x=m==null?void 0:m.get(e);if(!x)return{value:null,color:null,label:`${l7(e)}: n/a`};const b=x.env??((h=t.prompt)==null?void 0:h.env)??null,_=qke(a,b,e),S=VN(x.value,(_==null?void 0:_.min)??null,(_==null?void 0:_.max)??null,_==null?void 0:_.invert);return{value:x.value,color:S??null,label:`${l7(e)}: ${kQ(x.value)}`}}}}function Xke({sample:t,isSelected:e,onClick:n,envRewardRanges:r,envMetricRanges:i,advantageRange:s,displayMetrics:o,metricsBySampleIdx:a,tokenScaleMax:l,tokenScaleSumMax:c,tooltipsEnabled:f,darkMode:h}){return d.jsxs(Np,{delayDuration:300,open:f?void 0:!1,children:[d.jsx(kp,{asChild:!0,children:d.jsx("button",{onClick:n,className:vt("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:d.jsxs("div",{className:"flex items-stretch justify-between gap-2 min-w-0",children:[d.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(m=>c7(t,m,a,l,c,r,s,i,70,h).value!==null).length):2,overflowWrap:"anywhere"},children:dS(t.responsePreview,300)||"No response"}),o.length>0&&d.jsx("div",{className:"flex items-start gap-1 shrink-0",children:d.jsx("div",{className:"flex flex-col items-center gap-0.5",children:o.map(m=>{const x=c7(t,m,a,l,c,r,s,i,70,h);return x.value===null?null:d.jsx("span",{className:"text-[10px] font-semibold tabular-nums leading-none",style:x.color?{color:x.color}:void 0,title:x.label,children:$ke(x.value,m)},m)})})})]})})}),d.jsx(Rp,{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:d.jsxs("div",{className:"space-y-3",children:[t.turnsData.map(m=>d.jsxs("div",{children:[d.jsxs("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider mb-0.5 flex items-center gap-2",children:[d.jsx("span",{children:Wke(m.turn_type)}),m.tokens!=null&&d.jsxs("span",{className:"font-normal normal-case",children:[m.tokens.toLocaleString()," tokens"]})]}),d.jsx("p",{className:"text-xs whitespace-pre-wrap break-words font-sans",children:m.content||"(empty)"})]},`${m.sample_idx}-${m.turn_order}`)),t.turnsData.length===0&&d.jsx("p",{className:"text-xs text-muted-foreground",children:"No turns available"})]})})]})}function Yke(){var de,Me,Ce,Re,le;const t=Kn(wl),[e]=_7(),[n,r]=cn(YT),[i,s]=cn(FW),[o,a]=cn(UW),l=Kn(BW),[c,f]=cn(p8),[,h]=cn(HW),m=Kn(h8),[x,b]=cn(QT),[_,S]=cn(JT),M=x.length+(_?1:0),T=He=>{b(Le=>Le.includes(He)?Le.filter(ze=>ze!==He):[...Le,He])},[A,N]=w.useState(0),[D,k]=w.useState(0),[O,R]=w.useState(!0),L=!0,B=w.useMemo(()=>{const He=e.get("step");if(!He)return null;const Le=Number(He);return Number.isFinite(Le)?Le:null},[e]),H=w.useMemo(()=>{const He=e.get("sample");if(!He)return null;const Le=Number(He);return Number.isFinite(Le)?Le:null},[e]),$=w.useMemo(()=>{const He=e.get("group");if(!He)return null;const Le=Number(He);return Number.isFinite(Le)?Le:null},[e]),G=w.useRef(null),Z=w.useRef({group:null,sample:null});w.useEffect(()=>{if(!t){G.current=null,Z.current={group:null,sample:null};return}if(B==null){G.current=null;return}B!==G.current&&(r(B),G.current=B)},[B,t,r]),w.useEffect(()=>{t&&($==null||H==null||Z.current.group===$&&Z.current.sample===H||(s($),a(H),f(!0),h("samples"),Z.current={group:$,sample:H}))},[$,H,t,s,a,f,h]);const{data:V,isLoading:W,error:J}=Sfe(t||"",n,!!t),{data:ne}=Sh(t||"",!!t,L),ie=w.useMemo(()=>{var He;return KS((He=ne==null?void 0:ne.config)==null?void 0:He.environments)},[(de=ne==null?void 0:ne.config)==null?void 0:de.environments]),z=w.useMemo(()=>{var Ve,ue;const He=Dp((Ve=ne==null?void 0:ne.config)==null?void 0:Ve.environments),Le=Dp((ue=ne==null?void 0:ne.summary)==null?void 0:ue.env_details),ze=ZS(ne==null?void 0:ne.data_metric_ranges);return Op(Op(He,Le),ze)},[(Me=ne==null?void 0:ne.config)==null?void 0:Me.environments,(Ce=ne==null?void 0:ne.summary)==null?void 0:Ce.env_details,ne==null?void 0:ne.data_metric_ranges]),j=w.useMemo(()=>{var Ve;const He=(Ve=ne==null?void 0:ne.config)==null?void 0:Ve.group_size,Le=typeof He=="object"&&He!==null&&"value"in He?Number(He.value):Number(He);if(!Le||isNaN(Le)||Le<=1)return null;const ze=Math.sqrt(Le-1);return{min:-ze,max:ze}},[(Re=ne==null?void 0:ne.config)==null?void 0:Re.group_size]),X=w.useMemo(()=>{var He;return(He=V==null?void 0:V.available_steps)!=null&&He.length&&n===null?V.available_steps[V.available_steps.length-1]:null},[V,n]);w.useEffect(()=>{X!==null&&n===null&&B==null&&r(X)},[X,B,n,r]);const F=He=>{r(He)},[ce,oe]=w.useState([]),[Q,se]=w.useState(null);t!==Q&&(oe([]),se(t));const re=V==null?void 0:V.available_steps,K=w.useMemo(()=>{const He=re??[];return[...new Set([...ce,...He])].sort((ze,Ve)=>ze-Ve)},[re,ce]);K.length>ce.length&&oe(K);const fe=K.length>0,he=fe?K[K.length-1]:0,ae=w.useMemo(()=>{if(n==null)return K.length-1;const He=K.indexOf(n);return He>=0?He:K.length-1},[K,n]),Se=He=>{He>=0&&He<K.length&&F(K[He])};return t?d.jsxs("div",{className:"flex h-full overflow-hidden",children:[d.jsx(DI,{prompts:V==null?void 0:V.prompts,data:V==null?void 0:V.rollouts,samplesData:V==null?void 0:V.samples_data,rolloutMetrics:V==null?void 0:V.rollout_metrics,availableMetricNames:V==null?void 0:V.available_rollout_metric_names,isLoading:W,step:n??void 0,currentStepIndex:ae,totalSteps:K.length,onStepChange:Se,hasSteps:fe,stepValues:K}),d.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center justify-between h-7",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(II,{}),l&&d.jsxs("div",{className:"text-sm text-muted-foreground",children:[d.jsxs("span",{children:["Step ",((le=l.sample.turns[0])==null?void 0:le.step)??n]})," · ",d.jsxs("span",{children:["Group ",l.sample.group_id]})," · ",d.jsxs("span",{children:["Sample ",l.sample.sample_idx]})]}),(l==null?void 0:l.sample.raw_string)&&d.jsx(GC,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&d.jsxs(d.Fragment,{children:[d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(He=>He+1),R(!1)},children:"Collapse All"}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{k(He=>He+1),R(!0)},children:"Expand All"}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",M>0&&` (${M})`]})}),d.jsxs($s,{align:"start",className:"w-auto",children:[d.jsx(hr,{checked:_,onCheckedChange:He=>S(!!He),onSelect:He=>He.preventDefault(),children:"Format Think"}),d.jsx(hr,{checked:x.includes("markdown"),onCheckedChange:()=>T("markdown"),onSelect:He=>He.preventDefault(),children:"Markdown"}),d.jsx(hr,{checked:x.includes("latex"),onCheckedChange:()=>T("latex"),onSelect:He=>He.preventDefault(),children:"LaTeX"}),d.jsx(hr,{checked:x.includes("code"),onCheckedChange:()=>T("code"),onSelect:He=>He.preventDefault(),children:"Code"})]})]})]})]}),d.jsx(RI,{})]})})}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:d.jsxs("div",{className:c||m?"max-w-5xl mx-auto":"",children:[J&&d.jsx(hd,{className:"border-destructive mb-6",children:d.jsx(dh,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error:"," ",J instanceof Error?J.message:"Unknown error"]})})}),d.jsx($1,{prompts:V==null?void 0:V.prompts,data:V==null?void 0:V.rollouts,samplesData:V==null?void 0:V.samples_data,rolloutMetrics:V==null?void 0:V.rollout_metrics,goldenAnswers:V==null?void 0:V.golden_answers,infoTurns:V==null?void 0:V.info_turns,isLoading:W,step:n??void 0,scrollToSampleId:H,filterGroupId:i,filterSampleIdx:o,collapseAllSignal:A,expandAllSignal:D,defaultSectionsOpen:O,envRewardRanges:ie,envMetricRanges:z,advantageRange:j,renderOptions:x,formatThinkBlocks:_})]})})]}),d.jsx(PI,{currentStep:n,maxSelectableStep:he})]}):d.jsx(V0,{description:"Select a run from the sidebar to view rollouts."})}function Kke(){var we,Te,ge,Ue,be;const t=Kn(wl),[e]=_7(),[n,r]=cn(P9),[i,s]=cn(I9),[o,a]=cn(D9),l=Kn(O9),[c,f]=cn(OA),[,h]=cn(L9),m=Kn(DA),[x,b]=cn(QT),[_,S]=cn(JT),M=x.length+(_?1:0),T=ke=>{b(qe=>qe.includes(ke)?qe.filter(Qe=>Qe!==ke):[...qe,ke])},[A,N]=w.useState(0),[D,k]=w.useState(0),[O,R]=w.useState(!0),L=!0,B=w.useMemo(()=>{const ke=e.get("step")??e.get("trainer_step");if(!ke)return null;const qe=Number(ke);return Number.isFinite(qe)?qe:null},[e]),H=w.useMemo(()=>{const ke=e.get("sample");if(!ke)return null;const qe=Number(ke);return Number.isFinite(qe)?qe:null},[e]),$=w.useMemo(()=>{const ke=e.get("group");if(!ke)return null;const qe=Number(ke);return Number.isFinite(qe)?qe:null},[e]),G=w.useRef(null),Z=w.useRef({group:null,sample:null});w.useEffect(()=>{if(!t){G.current=null,Z.current={group:null,sample:null};return}if(B==null){G.current=null;return}B!==G.current&&(r(B),G.current=B)},[B,t,r]),w.useEffect(()=>{t&&($==null||H==null||Z.current.group===$&&Z.current.sample===H||(s($),a(H),f(!0),h("samples"),Z.current={group:$,sample:H}))},[$,H,t,s,a,f,h]);const{data:V,isLoading:W,error:J}=Mfe(t||"",n,!!t),{data:ne}=Sh(t||"",!!t,L),ie=w.useMemo(()=>{var ke;return KS((ke=ne==null?void 0:ne.config)==null?void 0:ke.environments)},[(we=ne==null?void 0:ne.config)==null?void 0:we.environments]),z=w.useMemo(()=>{var nt,st;const ke=Dp((nt=ne==null?void 0:ne.config)==null?void 0:nt.environments),qe=Dp((st=ne==null?void 0:ne.summary)==null?void 0:st.env_details),Qe=ZS(ne==null?void 0:ne.data_metric_ranges);return Op(Op(ke,qe),Qe)},[(Te=ne==null?void 0:ne.config)==null?void 0:Te.environments,(ge=ne==null?void 0:ne.summary)==null?void 0:ge.env_details,ne==null?void 0:ne.data_metric_ranges]),j=w.useMemo(()=>{var nt;const ke=(nt=ne==null?void 0:ne.config)==null?void 0:nt.group_size,qe=typeof ke=="object"&&ke!==null&&"value"in ke?Number(ke.value):Number(ke);if(!qe||isNaN(qe)||qe<=1)return null;const Qe=Math.sqrt(qe-1);return{min:-Qe,max:Qe}},[(Ue=ne==null?void 0:ne.config)==null?void 0:Ue.group_size]),X=w.useMemo(()=>{var ke;return(ke=V==null?void 0:V.available_trainer_steps)!=null&&ke.length&&n===null?V.available_trainer_steps[V.available_trainer_steps.length-1]:null},[V,n]);w.useEffect(()=>{X!==null&&n===null&&B==null&&r(X)},[X,B,n,r]);const F=ke=>{r(ke)},[ce,oe]=w.useState([]),[Q,se]=w.useState(null),[re,K]=w.useState(new Map);t!==Q&&(oe([]),se(t),K(new Map));const fe=V==null?void 0:V.available_trainer_steps,he=w.useMemo(()=>{const ke=fe??[];return[...new Set([...ce,...ke])].sort((Qe,nt)=>Qe-nt)},[fe,ce]);he.length>ce.length&&oe(he);const ae=he.length>0,Se=ae?he[he.length-1]:0,de=w.useMemo(()=>{if(n==null)return he.length-1;const ke=he.indexOf(n);return ke>=0?ke:he.length-1},[he,n]),Me=ke=>{ke>=0&&ke<he.length&&F(he[ke])},Ce=w.useMemo(()=>{if(V!=null&&V.prompts)return V.prompts.map(ke=>({step:ke.trainer_step,group_id:ke.group_id,env:ke.env,system_prompt:ke.system_prompt,tokens_system_prompt:ke.tokens_system_prompt,prompt:ke.prompt,tokens_prompt:ke.tokens_prompt}))},[V]),Re=w.useMemo(()=>{if(V!=null&&V.rollouts)return V.rollouts.map(ke=>({step:ke.trainer_step,group_id:ke.group_id,sample_idx:ke.sample_idx,turn_order:ke.turn_order,turn_type:ke.turn_type,content:ke.content,tokens:ke.tokens}))},[V]),le=w.useMemo(()=>{if(V!=null&&V.samples_data)return V.samples_data.map(ke=>({step:ke.trainer_step,group_id:ke.group_id,sample_idx:ke.sample_idx,reward:ke.reward,advantage:ke.advantage,turns:ke.turns,total_tokens:ke.total_tokens,raw_string:ke.raw_string}))},[V]),He=w.useMemo(()=>{if(!(V!=null&&V.rollout_metrics))return;const ke=n??0;return V.rollout_metrics.map(qe=>({step:ke,sample_idx:qe.sample_idx,env:qe.env,metric_name:qe.metric_name,value:qe.value}))},[V,n]),Le=w.useMemo(()=>{if(!(V!=null&&V.golden_answers))return;const ke=n??0;return V.golden_answers.map(qe=>({step:ke,sample_idx:qe.sample_idx,env:qe.env,key:qe.key,value:qe.value}))},[V,n]),ze=w.useMemo(()=>{if(!(V!=null&&V.info_turns))return;const ke=n??0;return V.info_turns.map(qe=>({step:ke,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}))},[V,n]),Ve=w.useMemo(()=>{if(!(V!=null&&V.prompts))return null;const ke=new Map;for(const qe of V.prompts)ke.set(qe.group_id,qe.discard_reason);return ke},[V]),ue=Ve??re;Ve&&Ve!==re&&K(Ve);const Y=ke=>{switch(ke){case"max_async":return"Max Async";case"zero_advantage":return"Zero Advantage";default:return ke.split("_").map(qe=>qe.charAt(0).toUpperCase()+qe.slice(1)).join(" ")}},xe=ke=>{switch(ke){case"max_async":return"destructive";case"zero_advantage":return"destructive";default:return"outline"}};return t?d.jsxs("div",{className:"flex h-full overflow-hidden",children:[d.jsx(DI,{prompts:Ce,data:Re,samplesData:le,rolloutMetrics:He,isLoading:W,step:n??void 0,currentStepIndex:de,totalSteps:he.length,onStepChange:Me,hasSteps:ae,stepValues:he,openAtom:OA,selectedGroupIdAtom:I9,selectedSampleIdxAtom:D9,viewModeAtom:L9,getGroupBadge:ke=>{const qe=ue.get(ke.group_id);return qe?d.jsx(Cy,{variant:xe(qe),className:"text-[10px] h-4 px-1.5",children:Y(qe)}):null}}),d.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center justify-between h-7",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(II,{openAtom:OA}),l&&d.jsxs("div",{className:"text-sm text-muted-foreground",children:[d.jsxs("span",{children:["Step"," ",((be=l.sample.turns[0])==null?void 0:be.step)??n]})," · ",d.jsxs("span",{children:["Group ",l.sample.group_id]})," · ",d.jsxs("span",{children:["Sample ",l.sample.sample_idx]})]}),(l==null?void 0:l.sample.raw_string)&&d.jsx(GC,{rawString:l.sample.raw_string,totalTokens:l.sample.total_tokens,turns:l.sample.turns.length}),l&&d.jsxs(d.Fragment,{children:[d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{N(ke=>ke+1),R(!1)},children:"Collapse All"}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{k(ke=>ke+1),R(!0)},children:"Expand All"}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",M>0&&` (${M})`]})}),d.jsxs($s,{align:"start",className:"w-auto",children:[d.jsx(hr,{checked:_,onCheckedChange:ke=>S(!!ke),onSelect:ke=>ke.preventDefault(),children:"Format Think"}),d.jsx(hr,{checked:x.includes("markdown"),onCheckedChange:()=>T("markdown"),onSelect:ke=>ke.preventDefault(),children:"Markdown"}),d.jsx(hr,{checked:x.includes("latex"),onCheckedChange:()=>T("latex"),onSelect:ke=>ke.preventDefault(),children:"LaTeX"}),d.jsx(hr,{checked:x.includes("code"),onCheckedChange:()=>T("code"),onSelect:ke=>ke.preventDefault(),children:"Code"})]})]})]})]}),d.jsx(RI,{openAtom:DA})]})})}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:d.jsxs("div",{className:c||m?"max-w-5xl mx-auto":"",children:[J&&d.jsx(hd,{className:"border-destructive mb-6",children:d.jsx(dh,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error:"," ",J instanceof Error?J.message:"Unknown error"]})})}),d.jsx($1,{prompts:Ce,data:Re,samplesData:le,rolloutMetrics:He,goldenAnswers:Le,infoTurns:ze,isLoading:W,step:n??void 0,scrollToSampleId:H,filterGroupId:i,filterSampleIdx:o,lastValidSampleAtom:O9,collapseAllSignal:A,expandAllSignal:D,defaultSectionsOpen:O,envRewardRanges:ie,envMetricRanges:z,advantageRange:j,renderOptions:x,formatThinkBlocks:_})]})})]}),d.jsx(PI,{currentStep:n,maxSelectableStep:Se,openAtom:DA,selectedMetricsAtom:kue,selectedStepAtom:P9,includeDiscardedDefaults:!0})]}):d.jsx(V0,{description:"Select a run from the sidebar to view discarded rollouts."})}function Zke(){const t=Kn(wl),{data:e,error:n}=Sh(t||"",!!t,!1),r=w.useMemo(()=>MQ(e==null?void 0:e.summary),[e==null?void 0:e.summary]);return t?n?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load topology data"}),d.jsx("div",{className:"text-xs text-muted-foreground",children:n instanceof Error?n.message:"Unknown error"})]})}):e?!r||r.nodes.length===0?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No topology data available"}),d.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have setup information in its W&B summary."})]})}):d.jsx("div",{className:"h-full w-full",children:d.jsx(CQ,{topology:r})}):d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading topology…"})}):d.jsx(V0,{description:"Select a run from the sidebar to view cluster topology."})}const vs=["#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6","#06b6d4","#eab308","#ec4899"],u7=["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"],sU=["torch_allocated_gb","torch_reserved_gb","torch_max_allocated_gb"],oU=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],aU=["requests_running","requests_waiting","cache_usage","requests_total","prompt_tokens_total","generation_tokens_total","preemptions_total","cache_hits_total","cache_queries_total","ttft_mean","e2e_latency_mean","itl_mean","queue_time_mean","inference_time_mean","prefill_time_mean","decode_time_mean","iteration_tokens_mean","generation_tokens_per_request_mean","prompt_tokens_per_request_mean"];function Qke(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 yT(t,e,n){return n?`${t??"?"}:${e}`:`gpu:${e}`}function fS(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 d7(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:yT(i.node_id,i.gpu_index,e),...i,label:e?`Node ${i.node_id??"?"} GPU ${i.gpu_index}`:`GPU ${i.gpu_index}`,color:e?vs[s%vs.length]:vs[i.gpu_index%vs.length]}))}function Jke(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:yT(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?vs[s%vs.length]:vs[i.gpu_index%vs.length]}))}function f7({series:t,activeSeriesKeys:e,onSeriesHover:n,onSeriesToggle:r}){return t.length===0?null:d.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 d.jsxs("div",{className:vt("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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:o?fS(i.color,.25):i.color}}),d.jsx("span",{className:"text-xs text-muted-foreground",children:i.label})]},i.seriesKey)})})}function eRe({trainerLabels:t,inferenceLabels:e,activeSeriesKeys:n,onSeriesHover:r,onSeriesToggle:i}){return t.length===0&&e.length===0?null:d.jsxs("div",{className:"space-y-2 mb-3",children:[t.length>0&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground mb-1",children:"Trainer"}),d.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 d.jsxs("div",{className:vt("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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?fS(s.color,.25):s.color}}),d.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`trainer-${s.seriesKey}`)})})]}),e.length>0&&d.jsxs("div",{children:[d.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground mb-1",children:"Inference"}),d.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 d.jsxs("div",{className:vt("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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?fS(s.color,.25):s.color}}),d.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},`inference-${s.seriesKey}`)})})]})]})}function RQ(t){const e=Math.abs(t);if(e>=60)return hC(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 wu(t)}const PQ=28;function IQ(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,f=l<t.length?t[l]:void 0,h=c!=null,m=f!=null;if(h&&m){const x=Math.abs(Number(e[a])-i),_=Math.abs(Number(e[l])-i)<x?l:a;return s(_)?_:null}if(h)return s(a)?a:null;if(m)return s(l)?l:null;a-=1,l+=1}return null}function DQ(t){if(t.length<4)return null;const e=[...t].sort((c,f)=>c-f),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 Y1({label:t,onRemove:e}){return d.jsxs("span",{className:"group inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] bg-background border border-border text-muted-foreground rounded-full cursor-pointer hover:bg-muted transition-colors",onClick:n=>{n.stopPropagation(),e()},children:[t,d.jsx(ka,{className:"h-2.5 w-2.5 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function OQ(){const[t,e]=w.useState(!1);w.useEffect(()=>{if(!t)return;const i=s=>{s.key==="Escape"&&e(!1)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]);const n=w.useCallback(()=>e(i=>!i),[]),r=w.useCallback(i=>t?Yl.createPortal(i,document.body):i,[t]);return{isFullscreen:t,toggleFullscreen:n,fullscreenPortal:r}}function LQ({isFullscreen:t,onClick:e}){return d.jsx("button",{onClick:e,className:vt("h-5 px-1.5 text-[10px] rounded border border-border hover:bg-muted flex items-center gap-1 transition-all",t?"opacity-100":"opacity-0 group-hover/chart:opacity-100"),title:t?"Exit fullscreen":"Fullscreen",children:t?d.jsx(iC,{className:"h-3 w-3"}):d.jsx(rC,{className:"h-3 w-3"})})}function tRe({metricName:t,data:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const o=Kn(us),{isFullscreen:a,toggleFullscreen:l,fullscreenPortal:c}=OQ(),f=w.useRef(null),h=w.useRef(null),m=w.useRef(null),[x,b]=w.useState(!1),[_,S]=w.useState(null),[M,T]=w.useState(null),A=AC[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:N,seriesConfig:D,hasData:k,nodeIds:O,timeRange:R,outlierBounds:L}=w.useMemo(()=>{if(e.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:[],timeRange:i??{start:0,end:1},outlierBounds:null};const G=new Set;let Z=1/0,V=-1/0;const W=[];for(const oe of e){const Q=typeof oe.node_id=="number"&&Number.isFinite(oe.node_id)?oe.node_id:0;G.add(Q),oe.timestamp<Z&&(Z=oe.timestamp),oe.timestamp>V&&(V=oe.timestamp),W.push(oe.value)}const J=Array.from(G).sort((oe,Q)=>oe-Q),ne=i??{start:Z,end:V},ie={},z=new Set;for(const oe of e){const Q=typeof oe.node_id=="number"&&Number.isFinite(oe.node_id)?oe.node_id:0;z.add(oe.timestamp),ie[oe.timestamp]||(ie[oe.timestamp]={}),ie[oe.timestamp][Q]=oe.value}const j=Array.from(z).sort((oe,Q)=>oe-Q);if(j.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,nodeIds:J,timeRange:ne,outlierBounds:null};const X=j.map(oe=>oe-ne.start),F=[{label:"Time"}],ce=[X];for(let oe=0;oe<J.length;oe++){const Q=J[oe],se=j.map(re=>{var K;return((K=ie[re])==null?void 0:K[Q])??null});ce.push(se),F.push({label:`Node ${Q}`,stroke:vs[oe%vs.length],width:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:ce,seriesConfig:F,hasData:!0,nodeIds:J,timeRange:ne,outlierBounds:DQ(W)}},[e,i]),B=O.length>1,H=w.useCallback(G=>Math.abs(G)>=1e3?`${parseFloat((G/1e3).toFixed(1))}k`:Number.isInteger(G)?G.toLocaleString():Math.abs(G)<.01&&G!==0?G.toExponential(1):String(parseFloat(G.toFixed(2))),[]);w.useEffect(()=>{if(!f.current||!N||!k)return;const G=f.current,Z=G.clientWidth,V=200;let W=Number.POSITIVE_INFINITY,J=Number.NEGATIVE_INFINITY;for(let K=1;K<N.length;K+=1){const fe=N[K];for(let he=0;he<fe.length;he+=1){const ae=fe[he];ae!=null&&(x&&L?ae>=L.lower&&ae<=L.upper&&(ae<W&&(W=ae),ae>J&&(J=ae)):(ae<W&&(W=ae),ae>J&&(J=ae)))}}W===Number.POSITIVE_INFINITY&&L&&(W=L.lower,J=L.upper);const ne=J-W,ie=Math.max(Math.abs(J),Math.abs(W)),z=Math.max(ie*.05,1e-10),j=Math.max(ne*.1,z),X=[_!==null?_:Math.max(0,W-j),M!==null?M:J+j],F=o?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",ce=o?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Q={width:Z,height:V,padding:[4,24,0,4],cursor:{show:!0,x:!0,y:!1,points:{show:!1},drag:{x:!0,y:!1}},legend:{show:B},select:{show:!0,left:0,top:0,width:0,height:0},scales:{x:{time:!1,range:(K,fe,he)=>{const ae=R.end-R.start;return ae>0?[0,ae]:[fe,he]}},y:{range:X}},axes:[{stroke:ce,grid:{stroke:F,width:1},ticks:{stroke:F,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:(K,fe,he,ae)=>[he,ae],values:(K,fe)=>fe.map(he=>b0(R.start+Number(he),R.end-R.start))},{stroke:ce,grid:{stroke:F,width:1},ticks:{stroke:F,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(K,fe)=>{if(!fe||fe.length===0)return 40;const he=Math.max(...fe.map(ae=>ae.length));return Math.max(40,he*7+14)},values:(K,fe)=>fe.map(H)}],series:D,hooks:{setCursor:[K=>{if(!m.current||!f.current)return;const{left:fe,idx:he}=K.cursor;if(he==null||fe===void 0||fe<0){m.current.style.display="none";return}const ae=N[0][he];if(ae===void 0){m.current.style.display="none";return}const Se=N[0],de=(()=>{const Y=K.scales.x,xe=Number(Y.min),we=Number(Y.max);if(!Number.isFinite(xe)||!Number.isFinite(we))return null;const Te=Math.abs(we-xe);if(Te<=0)return null;const ge=Math.max(1,K.bbox.width);return Te*PQ/ge})(),Me=RQ(Number(ae)+s),Ce=R.start+Number(ae);let le=`<div class="font-medium mb-1">${b0(Ce,R.end-R.start)}</div>`;le+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${Me}</div>`,le+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Ce.toFixed(3)}</div>`;let He=!1;for(let Y=0;Y<O.length;Y+=1){const xe=N[Y+1],we=IQ(xe,Se,he,de);if(we===null)continue;const Te=xe==null?void 0:xe[we];if(Te==null)continue;He=!0;const ge=_u(Te);le+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${vs[Y%vs.length]}"></div>
                  <span class="text-muted-foreground">Node ${O[Y]}:</span>
                  <span class="font-medium">${ge} ${A.unit}</span>
                </div>
              `}if(!He){m.current.style.display="none";return}m.current.innerHTML=le,m.current.style.display="block";const Le=f.current.getBoundingClientRect(),ze=m.current.getBoundingClientRect();let Ve=Le.left+fe+15;Ve+ze.width+20>window.innerWidth&&(Ve=Le.left+fe-ze.width-15+K.bbox.left),Ve=Math.max(4,Ve);let ue=Le.top-ze.height+20;ue<4&&(ue=Le.top+8),m.current.style.left=`${Ve}px`,m.current.style.top=`${ue}px`}]}};h.current&&h.current.destroy();const se=new ls(Q,N,G);h.current=se;const re=new ResizeObserver(K=>{for(const fe of K){const{width:he,height:ae}=fe.contentRect;se&&he>0&&ae>0&&se.setSize({width:he,height:ae})}});return re.observe(G),()=>{re.disconnect(),se.destroy(),h.current=null}},[N,k,D,t,R,s,B,A.unit,O,H,x,L,_,M,o,a]);const $=w.useCallback(()=>{m.current&&(m.current.style.display="none")},[]);return c(d.jsxs("div",{className:vt("group/chart bg-background",a?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!a&&n&&"opacity-60"),children:[d.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2 shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h4",{className:vt("font-medium truncate",a?"text-sm":"text-xs"),title:t,children:A.label}),x&&d.jsx(Y1,{label:"Ignore Outliers",onRemove:()=>b(!1)}),_!==null&&d.jsx(Y1,{label:`Min Y: ${_}`,onRemove:()=>S(null)}),M!==null&&d.jsx(Y1,{label:`Max Y: ${M}`,onRemove:()=>T(null)})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:x,onCheckedChange:b,children:"Ignore Outliers"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:_??"",onChange:G=>{const Z=G.target.value;S(Z===""?null:Number(Z))},onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:M??"",onChange:G=>{const Z=G.target.value;T(Z===""?null:Number(Z))},onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation()})]})]})]}),d.jsx(LQ,{isFullscreen:a,onClick:l})]})]}),k?d.jsxs("div",{className:vt("relative bg-background rounded",a?"flex-1 min-h-0":"h-[200px]"),ref:f,onMouseLeave:$,children:[r&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),d.jsx("div",{ref:m,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"}})]}):d.jsx("div",{className:vt("flex items-center justify-center text-muted-foreground text-xs rounded",a?"flex-1 min-h-0":"h-[200px]"),children:n?"Loading...":`No data for ${A.label}`})]}))}function h7({data:t,metricNames:e,intervalStart:n,intervalEnd:r,gpuIndices:i,seriesMode:s,isLoading:o,isRefetching:a,seriesRoles:l,activeSeriesKeys:c,xOffset:f=0}){const h=w.useMemo(()=>{const x=new Map;for(const b of t)x.set(b.metric_name,(x.get(b.metric_name)??0)+1);return e.filter(b=>(x.get(b)??0)>0)},[t,e]),m=w.useMemo(()=>o&&e.length>0?e:o&&e.length===0?u7:h,[o,e,h]);return m.length===0&&!o?d.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-border bg-background",children:"No GPU metrics data available"}):d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:m.map(x=>{const b=t.filter(_=>_.metric_name===x);return d.jsx(Uq,{metricName:x,data:b,gpuIndices:i,intervalStart:n,intervalEnd:r,seriesMode:s,showLegend:!1,isLoading:o,isRefetching:a,seriesRoles:l,activeSeriesKeys:c,xOffset:f,xAxisMode:"clock",xAxisTicks:"bounds"},x)})})}function nRe({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s=0}){const o=w.useMemo(()=>{const l=new Set;for(const f of t)f.metric_name.startsWith("cpu_core_")||l.add(f.metric_name);for(const f of e??[])f.startsWith("cpu_core_")||l.add(f);const c=oU.filter(f=>l.has(f));for(const f of l)c.includes(f)||c.push(f);return c},[t,e]),a=w.useMemo(()=>o.length>0?o:n?oU:o,[o,n]);return a.length===0&&!n?d.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-border bg-background",children:"No CPU metrics data available"}):d.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(f=>f.metric_name===l);return d.jsx(tRe,{metricName:l,data:c,isLoading:n,isRefetching:r,overrideTimeRange:i,xOffset:s},l)})})}function rRe({metricName:t,data:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o=0}){const a=Kn(us),{isFullscreen:l,toggleFullscreen:c,fullscreenPortal:f}=OQ(),h=w.useRef(null),m=w.useRef(null),x=w.useRef(null),[b,_]=w.useState(!1),[S,M]=w.useState(null),[T,A]=w.useState(null),N=AC[t]||{label:t.replace(/_/g," "),unit:""},{uplotData:D,seriesConfig:k,hasData:O,serverIds:R,timeRange:L,outlierBounds:B}=w.useMemo(()=>{if(e.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:[],timeRange:s??{start:0,end:1},outlierBounds:null};const G=new Set;let Z=1/0,V=-1/0;const W=[];for(const oe of e)G.add(oe.server),oe.timestamp<Z&&(Z=oe.timestamp),oe.timestamp>V&&(V=oe.timestamp),W.push(oe.value);const J=Array.from(G).sort((oe,Q)=>oe-Q),ne=s??{start:Z,end:V},ie={},z=new Set;for(const oe of e)z.add(oe.timestamp),ie[oe.timestamp]||(ie[oe.timestamp]={}),ie[oe.timestamp][oe.server]=oe.value;const j=Array.from(z).sort((oe,Q)=>oe-Q);if(j.length===0)return{uplotData:null,seriesConfig:[],hasData:!1,serverIds:J,timeRange:ne,outlierBounds:null};const X=j.map(oe=>oe-ne.start),F=[{label:"Time"}],ce=[X];for(let oe=0;oe<J.length;oe++){const Q=J[oe],se=j.map(K=>{var fe;return((fe=ie[K])==null?void 0:fe[Q])??null}),re=!!i&&i.size>0&&!i.has(Q);ce.push(se),F.push({label:`Server ${Q}`,stroke:re?fS(vs[oe%vs.length],.25):vs[oe%vs.length],width:re?1:1.5,spanGaps:!0,points:{show:!1}})}return{uplotData:ce,seriesConfig:F,hasData:!0,serverIds:J,timeRange:ne,outlierBounds:DQ(W)}},[e,s,i]),H=w.useCallback(G=>Math.abs(G)>=1e3?`${parseFloat((G/1e3).toFixed(1))}k`:Number.isInteger(G)?G.toLocaleString():Math.abs(G)<.01&&G!==0?G.toExponential(1):String(parseFloat(G.toFixed(2))),[]);w.useEffect(()=>{if(!h.current||!D||!O)return;const G=h.current,Z=G.clientWidth,V=200;let W=Number.POSITIVE_INFINITY,J=Number.NEGATIVE_INFINITY;for(let K=1;K<D.length;K+=1){const fe=D[K];for(let he=0;he<fe.length;he+=1){const ae=fe[he];ae!=null&&(b&&B?ae>=B.lower&&ae<=B.upper&&(ae<W&&(W=ae),ae>J&&(J=ae)):(ae<W&&(W=ae),ae>J&&(J=ae)))}}W===Number.POSITIVE_INFINITY&&B&&(W=B.lower,J=B.upper);const ne=J-W,ie=Math.max(Math.abs(J),Math.abs(W)),z=Math.max(ie*.05,1e-10),j=Math.max(ne*.1,z),X=[S!==null?S:Math.max(0,W-j),T!==null?T:J+j],F=a?"rgba(255, 255, 255, 0.1)":"rgba(128, 128, 128, 0.15)",ce=a?"rgba(255, 255, 255, 0.65)":"rgba(100, 100, 100, 0.9)",Q={width:Z,height:V,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:(K,fe,he)=>{const ae=L.end-L.start;return ae>0?[0,ae]:[fe,he]}},y:{range:X}},axes:[{stroke:ce,grid:{stroke:F,width:1},ticks:{stroke:F,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:24,splits:(K,fe,he,ae)=>[he,ae],values:(K,fe)=>fe.map(he=>b0(L.start+Number(he),L.end-L.start))},{stroke:ce,grid:{stroke:F,width:1},ticks:{stroke:F,width:1},font:"10px system-ui, sans-serif",labelFont:"10px system-ui, sans-serif",size:(K,fe)=>{if(!fe||fe.length===0)return 40;const he=Math.max(...fe.map(ae=>ae.length));return Math.max(40,he*7+14)},values:(K,fe)=>fe.map(H)}],series:k,hooks:{setCursor:[K=>{if(!x.current||!h.current)return;const{left:fe,idx:he}=K.cursor;if(he==null||fe===void 0||fe<0){x.current.style.display="none";return}const ae=D[0][he];if(ae===void 0){x.current.style.display="none";return}const Se=D[0],de=(()=>{const Y=K.scales.x,xe=Number(Y.min),we=Number(Y.max);if(!Number.isFinite(xe)||!Number.isFinite(we))return null;const Te=Math.abs(we-xe);if(Te<=0)return null;const ge=Math.max(1,K.bbox.width);return Te*PQ/ge})(),Me=RQ(Number(ae)+o),Ce=L.start+Number(ae);let le=`<div class="font-medium mb-1">${b0(Ce,L.end-L.start)}</div>`;le+=`<div class="text-[10px] text-muted-foreground font-sans">Time Run: ${Me}</div>`,le+=`<div class="text-[10px] text-muted-foreground font-sans mb-1">Timestamp: ${Ce.toFixed(3)}</div>`;let He=!1;for(let Y=0;Y<R.length;Y+=1){const xe=D[Y+1],we=IQ(xe,Se,he,de);if(we===null)continue;const Te=xe==null?void 0:xe[we];if(Te==null)continue;He=!0;const ge=_u(Te);le+=`
                <div class="flex items-center gap-2 mt-0.5">
                  <div class="w-2 h-2 rounded-full shrink-0" style="background-color: ${vs[Y%vs.length]}"></div>
                  <span class="text-muted-foreground">Server ${R[Y]}:</span>
                  <span class="font-medium">${ge} ${N.unit}</span>
                </div>
              `}if(!He){x.current.style.display="none";return}x.current.innerHTML=le,x.current.style.display="block";const Le=h.current.getBoundingClientRect(),ze=x.current.getBoundingClientRect();let Ve=Le.left+fe+15;Ve+ze.width+20>window.innerWidth&&(Ve=Le.left+fe-ze.width-15+K.bbox.left),Ve=Math.max(4,Ve);let ue=Le.top-ze.height+20;ue<4&&(ue=Le.top+8),x.current.style.left=`${Ve}px`,x.current.style.top=`${ue}px`}]}};m.current&&m.current.destroy();const se=new ls(Q,D,G);m.current=se;const re=new ResizeObserver(K=>{for(const fe of K){const{width:he,height:ae}=fe.contentRect;se&&he>0&&ae>0&&se.setSize({width:he,height:ae})}});return re.observe(G),()=>{re.disconnect(),se.destroy(),m.current=null}},[D,O,k,t,L,o,N.unit,R,H,b,B,S,T,a,l]);const $=w.useCallback(()=>{x.current&&(x.current.style.display="none")},[]);return f(d.jsxs("div",{className:vt("group/chart bg-background",l?"fixed inset-0 left-56 z-50 p-6 flex flex-col":"rounded-lg border border-border p-3 transition-opacity",!l&&n&&"opacity-60"),children:[d.jsxs("div",{className:"flex items-center justify-between mb-2 gap-2 shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[d.jsx("h4",{className:vt("font-medium truncate",l?"text-sm":"text-xs"),title:t,children:N.label}),b&&d.jsx(Y1,{label:"Ignore Outliers",onRemove:()=>_(!1)}),S!==null&&d.jsx(Y1,{label:`Min Y: ${S}`,onRemove:()=>M(null)}),T!==null&&d.jsx(Y1,{label:`Max Y: ${T}`,onRemove:()=>A(null)})]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.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:d.jsx(df,{className:"h-3 w-3"})})}),d.jsxs($s,{align:"end",className:"min-w-[160px]",children:[d.jsx(hr,{checked:b,onCheckedChange:_,children:"Ignore Outliers"}),d.jsx(ys,{}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Min Y"}),d.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:S??"",onChange:G=>{const Z=G.target.value;M(Z===""?null:Number(Z))},onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation()})]}),d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[d.jsx("span",{className:"text-xs text-muted-foreground font-medium w-10",children:"Max Y"}),d.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:T??"",onChange:G=>{const Z=G.target.value;A(Z===""?null:Number(Z))},onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation()})]})]})]}),d.jsx(LQ,{isFullscreen:l,onClick:c})]})]}),O?d.jsxs("div",{className:vt("relative bg-background rounded",l?"flex-1 min-h-0":"h-[200px]"),ref:h,onMouseLeave:$,children:[r&&d.jsx(Ml,{className:"absolute bottom-0.5 left-0.5 h-3 w-3 animate-spin text-muted-foreground"}),d.jsx("div",{ref:x,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"}})]}):d.jsx("div",{className:vt("flex items-center justify-center text-muted-foreground text-xs rounded",l?"flex-1 min-h-0":"h-[200px]"),children:n?"Loading...":`No data for ${N.label}`})]}))}function iRe({data:t,activeServerIds:e,onServerHover:n,onServerToggle:r}){const i=w.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:vs[l%vs.length]}))},[t]);return i.length<=1?null:d.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 d.jsxs("div",{className:vt("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:[d.jsx("div",{className:"w-2.5 h-2.5 rounded-sm",style:{backgroundColor:a?fS(s.color,.25):s.color}}),d.jsx("span",{className:"text-xs text-muted-foreground",children:s.label})]},s.label)})})}function sRe({data:t,availableMetricNames:e,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o=0}){const a=w.useMemo(()=>{const c=new Set;for(const h of t)c.add(h.metric_name);for(const h of e??[])c.add(h);const f=aU.filter(h=>c.has(h));for(const h of c)f.includes(h)||f.push(h);return f},[t,e]),l=w.useMemo(()=>a.length>0?a:n?aU:a,[a,n]);return l.length===0&&!n?d.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-border bg-background",children:"No vLLM metrics data available"}):d.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:l.map(c=>{const f=t.filter(h=>h.metric_name===c);return d.jsx(rRe,{metricName:c,data:f,isLoading:n,isRefetching:r,activeServerIds:i,overrideTimeRange:s,xOffset:o},c)})})}function oRe({nodeId:t,gpuCount:e,children:n}){const[r,i]=w.useState(!0),s=t===null?"Unknown Node":`Node ${t}`;return d.jsxs(Pi,{open:r,onOpenChange:i,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!r&&"-rotate-90")}),d.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:s}),d.jsxs("span",{className:"text-[11px] text-muted-foreground/80",children:[e," GPU",e!==1?"s":""]})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"mt-3",children:n})})]})}function lU({title:t,gpuData:e,gpuMetricNames:n,timeRange:r,nodeGpuMap:i,isLoading:s,isRefetching:o,open:a,onOpenChange:l,nodeMode:c,onNodeModeChange:f,xOffset:h=0}){const[m,x]=w.useState(!0),[b,_]=w.useState("combined"),S=a??m,M=l??x,T=c??b,A=f??_,[N,D]=w.useState(null),[k,O]=w.useState([]),R=i.size>1,L=w.useMemo(()=>{const ne=[],ie=Array.from(i.keys()).sort((z,j)=>z-j);for(const z of ie){const j=[...i.get(z)??[]].sort((X,F)=>X-F);for(const X of j)ne.push({nodeId:z,gpuIndex:X})}return ne.map((z,j)=>({seriesKey:yT(z.nodeId,z.gpuIndex,R),node_id:z.nodeId,gpu_index:z.gpuIndex,label:R?`Node ${z.nodeId} GPU ${z.gpuIndex}`:`GPU ${z.gpuIndex}`,color:R?vs[j%vs.length]:vs[z.gpuIndex%vs.length]}))},[i,R]),B=w.useMemo(()=>{const ne=d7(e,R);return ne.length>0?ne:L},[e,R,L]),H=w.useMemo(()=>{const ne=new Set;for(const ie of e)ne.add(ie.gpu_index);return Array.from(ne).sort((ie,z)=>ie-z)},[e]),$=w.useMemo(()=>{const ne=[],ie=Array.from(i.keys()).sort((z,j)=>z-j);for(const z of ie){const j=i.get(z),X=e.filter(oe=>(typeof oe.node_id=="number"?oe.node_id:null)===z&&j.includes(oe.gpu_index)),F=d7(X,!1),ce=F.length>0?F:j.map(oe=>({seriesKey:yT(z,oe,!1),node_id:z,gpu_index:oe,label:`GPU ${oe}`,color:vs[oe%vs.length]}));ne.push({nodeId:z,gpuIndices:j,data:X,labels:ce})}return ne},[e,i]),G=w.useMemo(()=>{const ne=new Set;return T==="combined"||!R?(B.forEach(ie=>ne.add(ie.seriesKey)),ne):($.forEach(ie=>{ie.labels.forEach(z=>ne.add(z.seriesKey))}),ne)},[T,R,B,$]),Z=w.useCallback(ne=>{O(ie=>{const z=ie.filter(oe=>!G.has(oe)),j=ie.filter(oe=>G.has(oe)),F=j.includes(ne)?j.filter(oe=>oe!==ne):[...j,ne],ce=G.size>0&&F.length===G.size?[]:F;return[...z,...ce]})},[G]),V=w.useMemo(()=>G.size===0?k:k.filter(ne=>G.has(ne)),[k,G]),W=w.useMemo(()=>N&&(G.size===0||G.has(N))?N:null,[N,G]),J=w.useMemo(()=>V.length>0?new Set(V):W?new Set([W]):null,[V,W]);return d.jsxs(Pi,{open:S,onOpenChange:M,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(Ii,{asChild:!0,children:d.jsxs("div",{className:"flex items-center gap-1.5 py-1.5 px-2 -ml-2 cursor-pointer hover:bg-muted rounded transition-colors",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!S&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:t})]})}),S&&R&&d.jsxs(M0,{type:"single",variant:"selecting",size:"sm",value:T,onValueChange:ne=>{ne&&A(ne)},children:[d.jsx(Ka,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"}),d.jsx(Ka,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Nodes"})]})]}),d.jsx(Di,{children:d.jsx("div",{className:"space-y-6",children:T==="combined"||!R?d.jsxs(d.Fragment,{children:[d.jsx(f7,{series:B,activeSeriesKeys:J,onSeriesHover:D,onSeriesToggle:Z}),d.jsx(h7,{data:e,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:H,seriesMode:R?"node_gpu":"gpu",isLoading:s,isRefetching:o,activeSeriesKeys:J,xOffset:h})]}):$.map(ne=>d.jsxs(oRe,{nodeId:ne.nodeId,gpuCount:ne.gpuIndices.length,children:[d.jsx(f7,{series:ne.labels,activeSeriesKeys:J,onSeriesHover:D,onSeriesToggle:Z}),d.jsx(h7,{data:ne.data,metricNames:n,intervalStart:r.start,intervalEnd:r.end,gpuIndices:ne.gpuIndices,seriesMode:"gpu",isLoading:s,isRefetching:o,activeSeriesKeys:J,xOffset:h})]},ne.nodeId))})})]})}function aRe({gpuMetrics:t,cpuMetrics:e,vllmMetrics:n,availableGpuMetrics:r,availableCpuMetrics:i,availableVllmMetrics:s,trainerGpus:o,inferenceGpus:a,isLoading:l,isRefetching:c,systemMetricsOpen:f,onSystemMetricsOpenChange:h,cpuMetricsOpen:m,onCpuMetricsOpenChange:x,vllmMetricsOpen:b,onVllmMetricsOpenChange:_,roleMode:S,onRoleModeChange:M,trainerSectionOpen:T,onTrainerSectionOpenChange:A,inferenceSectionOpen:N,onInferenceSectionOpenChange:D,trainerNodeMode:k,onTrainerNodeModeChange:O,inferenceNodeMode:R,onInferenceNodeModeChange:L,overrideTimeRange:B,xOffset:H=0}){const[$,G]=w.useState(!0),[Z,V]=w.useState(!0),[W,J]=w.useState(!0),[ne,ie]=w.useState("separated"),z=f??$,j=h??G,X=m??Z,F=x??V,ce=b??W,oe=_??J,Q=S??ne,se=M??ie,[re,K]=w.useState(null),[fe,he]=w.useState([]),[ae,Se]=w.useState(null),[de,Me]=w.useState([]),Ce=w.useMemo(()=>B||Qke(t),[t,B]),Re=w.useMemo(()=>{const Ae=new Set(r),We=u7.filter(dt=>Ae.has(dt)),De=sU.filter(dt=>Ae.has(dt)),Ne=new Set([...u7,...sU]),ot=r.filter(dt=>!Ne.has(dt)).sort();return[...We,...De,...ot]},[r]),le=w.useMemo(()=>new Set(o.map(Ae=>`${Ae.node_id}:${Ae.gpu_index}`)),[o]),He=w.useMemo(()=>new Set(a.map(Ae=>`${Ae.node_id}:${Ae.gpu_index}`)),[a]),Le=w.useMemo(()=>le.size===0?[]:t.filter(Ae=>{const We=typeof Ae.node_id=="number"&&Number.isFinite(Ae.node_id)?Ae.node_id:null;return We===null?!1:le.has(`${We}:${Ae.gpu_index}`)}),[t,le]),ze=w.useMemo(()=>He.size===0?[]:t.filter(Ae=>{const We=typeof Ae.node_id=="number"&&Number.isFinite(Ae.node_id)?Ae.node_id:null;return We===null?!1:He.has(`${We}:${Ae.gpu_index}`)}),[t,He]),Ve=w.useMemo(()=>{const Ae=new Map;for(const We of o){const De=Ae.get(We.node_id)??[];De.includes(We.gpu_index)||De.push(We.gpu_index),Ae.set(We.node_id,De)}for(const[We,De]of Ae)Ae.set(We,De.sort((Ne,ot)=>Ne-ot));return Ae},[o]),ue=w.useMemo(()=>{const Ae=new Map;for(const We of a){const De=Ae.get(We.node_id)??[];De.includes(We.gpu_index)||De.push(We.gpu_index),Ae.set(We.node_id,De)}for(const[We,De]of Ae)Ae.set(We,De.sort((Ne,ot)=>Ne-ot));return Ae},[a]),Y=w.useMemo(()=>{const Ae=new Set;for(const We of t)Ae.add(We.gpu_index);return Array.from(Ae).sort((We,De)=>We-De)},[t]),xe=w.useMemo(()=>{const Ae=new Set;for(const We of t){const De=typeof We.node_id=="number"&&Number.isFinite(We.node_id)?We.node_id:null;Ae.add(De)}return Ae.size>1},[t]),we=w.useMemo(()=>d7(t,xe),[t,xe]),Te=w.useMemo(()=>{if(o.length===0&&a.length===0)return[];const Ae=[...o,...a],We=new Set(Ae.map(De=>De.node_id)).size>1;return Jke(Ae,We)},[o,a]),ge=w.useMemo(()=>{const Ae=we.length>0?we:Te,We=new Set(o.map(De=>`${De.node_id}:${De.gpu_index}`));return Ae.filter(De=>{const Ne=`${De.node_id??"?"}:${De.gpu_index}`;return We.has(Ne)||We.has(`${De.node_id}:${De.gpu_index}`)})},[we,Te,o]),Ue=w.useMemo(()=>{const Ae=we.length>0?we:Te,We=new Set(a.map(De=>`${De.node_id}:${De.gpu_index}`));return Ae.filter(De=>{const Ne=`${De.node_id??"?"}:${De.gpu_index}`;return We.has(Ne)||We.has(`${De.node_id}:${De.gpu_index}`)})},[we,Te,a]),be=w.useMemo(()=>{const Ae={},We=new Set(o.map(Ne=>`${Ne.node_id}:${Ne.gpu_index}`)),De=new Set(a.map(Ne=>`${Ne.node_id}:${Ne.gpu_index}`));if(xe)for(const Ne of t){const ot=typeof Ne.node_id=="number"&&Number.isFinite(Ne.node_id)?Ne.node_id:null,dt=`${ot??"?"}:${Ne.gpu_index}`,Pt=`${ot}:${Ne.gpu_index}`;We.has(Pt)||We.has(dt)?Ae[dt]="Trainer":(De.has(Pt)||De.has(dt))&&(Ae[dt]="Inference")}else{for(const Ne of o)Ae[`gpu:${Ne.gpu_index}`]="Trainer";for(const Ne of a)Ae[`gpu:${Ne.gpu_index}`]="Inference"}return Ae},[t,o,a,xe]),ke=o.length>0||a.length>0,qe=Le.length>0||!!l&&o.length>0,Qe=ze.length>0||!!l&&a.length>0,nt=w.useMemo(()=>{if(!ke)return we;const Ae=new Map;for(const We of ge)Ae.set(We.seriesKey,We);for(const We of Ue)Ae.set(We.seriesKey,We);return Array.from(Ae.values())},[ke,we,ge,Ue]),st=w.useMemo(()=>new Set(nt.map(Ae=>Ae.seriesKey)),[nt]),Pe=w.useMemo(()=>st.size===0?fe:fe.filter(Ae=>st.has(Ae)),[fe,st]),Ke=w.useCallback(Ae=>{he(We=>{const De=We.filter(kt=>!st.has(kt)),Ne=We.filter(kt=>st.has(kt)),dt=Ne.includes(Ae)?Ne.filter(kt=>kt!==Ae):[...Ne,Ae],Pt=st.size>0&&dt.length===st.size?[]:dt;return[...De,...Pt]})},[st]),rt=w.useMemo(()=>re&&(st.size===0||st.has(re))?re:null,[re,st]),ye=w.useMemo(()=>Pe.length>0?st.size>0&&Pe.length===st.size?null:new Set(Pe):rt?new Set([rt]):null,[Pe,rt,st]),$e=w.useMemo(()=>{const Ae=new Set;for(const We of n??[])Ae.add(We.server);return Ae},[n]),Ze=w.useMemo(()=>$e.size===0?de:de.filter(Ae=>$e.has(Ae)),[de,$e]),ft=w.useCallback(Ae=>{Me(We=>{const De=We.filter(kt=>!$e.has(kt)),Ne=We.filter(kt=>$e.has(kt)),dt=Ne.includes(Ae)?Ne.filter(kt=>kt!==Ae):[...Ne,Ae],Pt=$e.size>0&&dt.length===$e.size?[]:dt;return[...De,...Pt]})},[$e]),lt=w.useMemo(()=>ae===null?null:$e.size===0||$e.has(ae)?ae:null,[ae,$e]),Je=w.useMemo(()=>Ze.length>0?$e.size>0&&Ze.length===$e.size?null:new Set(Ze):lt!==null?new Set([lt]):null,[Ze,lt,$e]);return d.jsxs("div",{className:"space-y-4",children:[d.jsxs(Pi,{open:z,onOpenChange:j,children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!z&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"GPU Metrics"})]})})}),z&&ke&&d.jsxs(M0,{type:"single",variant:"selecting",size:"sm",value:Q,onValueChange:Ae=>{Ae&&se(Ae)},children:[d.jsx(Ka,{value:"separated",className:"text-xs px-2 py-1 h-7",children:"Separate Trainer/Inference"}),d.jsx(Ka,{value:"combined",className:"text-xs px-2 py-1 h-7",children:"Combined"})]})]}),d.jsx(Di,{children:d.jsx("div",{className:"space-y-6 mt-3 mb-4",children:Q==="combined"||!ke?d.jsxs(d.Fragment,{children:[ke?d.jsx(eRe,{trainerLabels:ge,inferenceLabels:Ue,activeSeriesKeys:ye,onSeriesHover:K,onSeriesToggle:Ke}):d.jsx(f7,{series:we,activeSeriesKeys:ye,onSeriesHover:K,onSeriesToggle:Ke}),d.jsx(h7,{data:t,metricNames:Re,intervalStart:Ce.start,intervalEnd:Ce.end,gpuIndices:Y,seriesMode:xe?"node_gpu":"gpu",isLoading:l,isRefetching:c,seriesRoles:ke?be:void 0,activeSeriesKeys:ye,xOffset:H})]}):d.jsxs(d.Fragment,{children:[qe&&d.jsx(lU,{title:"Trainer",gpuData:Le,gpuMetricNames:Re,timeRange:Ce,nodeGpuMap:Ve,isLoading:l,isRefetching:c,open:T,onOpenChange:A,nodeMode:k,onNodeModeChange:O,xOffset:H}),Qe&&d.jsxs(d.Fragment,{children:[qe&&d.jsx("div",{className:"border-t border-border my-3"}),d.jsx(lU,{title:"Inference",gpuData:ze,gpuMetricNames:Re,timeRange:Ce,nodeGpuMap:ue,isLoading:l,isRefetching:c,open:N,onOpenChange:D,nodeMode:R,onNodeModeChange:L,xOffset:H})]}),!l&&Le.length===0&&ze.length===0&&d.jsx("div",{className:"h-24 flex items-center justify-center text-muted-foreground text-xs rounded-lg border border-border bg-background",children:"No GPU data matches the trainer/inference role configuration"})]})})})]}),d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:X,onOpenChange:F,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!X&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"CPU Metrics"})]})})}),d.jsx(Di,{children:d.jsx("div",{className:"mt-3 mb-4",children:d.jsx(nRe,{data:e,availableMetricNames:i,isLoading:l,isRefetching:c,overrideTimeRange:B,xOffset:H})})})]}),n&&n.length>0||s&&s.length>0||l?d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"border-t border-border my-3"}),d.jsxs(Pi,{open:ce,onOpenChange:oe,children:[d.jsx(Ii,{asChild:!0,children:d.jsx("div",{className:"py-1.5 px-2 -mx-2 cursor-pointer hover:bg-muted rounded transition-colors",children:d.jsxs("div",{className:"flex items-center gap-1.5",children:[d.jsx(Rr,{className:vt("h-4 w-4 text-muted-foreground transition-transform",!ce&&"-rotate-90")}),d.jsx("h3",{className:"text-sm font-semibold",children:"vLLM Metrics"})]})})}),d.jsx(Di,{children:d.jsxs("div",{className:"space-y-6 mt-3 mb-4",children:[d.jsx(iRe,{data:n??[],activeServerIds:Je,onServerHover:Se,onServerToggle:ft}),d.jsx(sRe,{data:n??[],availableMetricNames:s,isLoading:l,isRefetching:c,activeServerIds:Je,overrideTimeRange:B,xOffset:H})]})})]})]}):null]})}function lRe(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=$N(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),S=l[3];let M=l[4];const T=i[i.length-1];if(M.endsWith(")")){M=M.slice(0,-1);const A={name:b,type:S,args:M,children:[],depth:i.length,repeatCount:_,estimatedParams:0};A.estimatedParams=$N(S,M),T.children.push(A)}else{const A={name:b,type:S,args:"",children:[],depth:i.length,repeatCount:_,estimatedParams:0};T.children.push(A),i.push(A)}continue}const c=a.match(/^\(([^)]*)\):\s*(\w[\w.]*)\((.*)$/);if(!c)continue;const f=c[1],h=c[2];let m=c[3];const x=i[i.length-1];if(m.endsWith(")")){m=m.slice(0,-1);const b={name:f,type:h,args:m,children:[],depth:i.length,repeatCount:1,estimatedParams:0};b.estimatedParams=$N(h,m),x.children.push(b)}else{const b={name:f,type:h,args:"",children:[],depth:i.length,repeatCount:1,estimatedParams:0};x.children.push(b),i.push(b)}}return jQ(r),FQ(r),r}function cU(t){return/^\d+(-\d+)?$/.test(t)}function jQ(t){for(const r of t.children)jQ(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&&cU(r.name)&&cU(t.children[n+i].name)&&zQ(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 zQ(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(!zQ(t.children[n],e.children[n]))return!1;return!0}function FQ(t){if(t.children.length===0)return t.estimatedParams*(t.repeatCount||1);let e=0;for(const n of t.children)e+=FQ(n);return t.estimatedParams=e,e*(t.repeatCount||1)}function $N(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 cRe(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 UQ(t,e,1),e}function UQ(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=uRe(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 f=Math.max(l[0],l[1]);e.hiddenSize&&f>e.hiddenSize&&(!e.intermediateSize||f>e.intermediateSize)&&(e.intermediateSize=f)}}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)UQ(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 uRe(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 Gy(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 BQ(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 uU={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"}},dU={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?dU[t]?dU[t]:t.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()):""}function dRe(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 bT(){return d.jsx("div",{className:"w-px h-4 bg-border mx-auto"})}function fRe({node:t}){const e=IE(t.name)||t.type,n=BQ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?Gy(t.estimatedParams):null;return d.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full text-center",children:[d.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),r&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 break-all",children:r}),i&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:i})]})}function hRe({node:t}){const e=IE(t.name)||t.type,n=BQ(t.type,t.args),r=n?`${t.type}(${n})`:t.type!==e?t.type:"",i=t.estimatedParams>0?Gy(t.estimatedParams):null;return d.jsxs("div",{className:"rounded-md border bg-background px-2.5 py-2 flex-1 min-w-0 text-center",children:[d.jsx("div",{className:"text-xs font-medium text-foreground",children:e}),r&&d.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5 break-all",children:r}),i&&d.jsx("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:i})]})}function pRe({node:t}){const e=IE(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?Gy(t.estimatedParams):null;return d.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full text-center",children:[d.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),n&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:n}),r&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r}),d.jsx("div",{className:"flex gap-1.5 flex-wrap mt-2",children:t.children.map((i,s)=>d.jsx(hRe,{node:i},s))})]})}function OI({node:t}){return t.children.length===0?d.jsx(fRe,{node:t}):t.repeatCount>1?d.jsx(mRe,{node:t}):t.children.every(n=>n.children.length===0)?d.jsx(pRe,{node:t}):d.jsx(gRe,{node:t})}function mRe({node:t}){return d.jsxs("div",{className:"relative w-full",children:[d.jsx("div",{className:"rounded-lg border-2 border-dashed border-muted-foreground/25 p-3 w-full",children:d.jsx("div",{className:"flex flex-col items-center w-full",children:t.children.map((e,n)=>d.jsxs("div",{className:"flex flex-col items-center w-full",children:[n>0&&d.jsx(bT,{}),d.jsx(OI,{node:e})]},n))})}),d.jsx("div",{className:"absolute left-full top-1/2 -translate-y-1/2 pl-5 pointer-events-none select-none",children:d.jsxs("span",{className:"text-4xl font-extralight text-muted-foreground/50 whitespace-nowrap leading-tight",children:["×",t.repeatCount,d.jsx("br",{}),d.jsx("span",{className:"text-2xl",children:"layers"})]})})]})}function gRe({node:t}){const e=IE(t.name)||t.type,n=t.type!==e?t.type:"",r=t.estimatedParams>0?Gy(t.estimatedParams):null;return d.jsxs("div",{className:"rounded-lg border bg-card px-3 py-2.5 w-full",children:[d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"font-medium text-sm text-foreground",children:e}),n&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:n}),r&&d.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r})]}),d.jsx("div",{className:"flex flex-col items-center w-full mt-2",children:t.children.map((i,s)=>d.jsxs("div",{className:"flex flex-col items-center w-full",children:[s>0&&d.jsx(bT,{}),d.jsx(OI,{node:i})]},s))})]})}function xRe({root:t}){const e=w.useMemo(()=>dRe(t),[t]);return d.jsxs("div",{className:"flex flex-col items-center py-8 px-6 max-w-2xl mx-auto",children:[d.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Input"}),e.map((n,r)=>d.jsxs("div",{className:"flex flex-col items-center w-full",children:[d.jsx(bT,{}),d.jsx(OI,{node:n})]},r)),d.jsx(bT,{}),d.jsx("div",{className:"rounded-full border bg-background px-5 py-1.5 text-xs text-muted-foreground",children:"Output"})]})}function vRe({stats:t,rawRepr:e}){const[n,r]=w.useState(!1),i=t.totalParams,s=w.useMemo(()=>Object.entries(t.paramsByCategory).filter(([,a])=>a>0).sort((a,l)=>l[1]-a[1]),[t.paramsByCategory]),o=w.useMemo(()=>Object.entries(t.layerTypeCounts).sort((a,l)=>l[1]-a[1]),[t.layerTypeCounts]);return d.jsxs("div",{className:"w-72 shrink-0 border-l overflow-y-auto p-4 space-y-5",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-base font-semibold",children:t.modelName}),i>0&&d.jsxs("p",{className:"text-sm text-muted-foreground",children:["~",Gy(i)," parameters"]})]}),(t.numLayers>0||t.hiddenSize||t.vocabSize)&&d.jsxs("div",{children:[d.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Architecture"}),d.jsxs("div",{className:"space-y-1 text-sm",children:[t.numLayers>0&&d.jsx(a2,{label:"Layers",value:String(t.numLayers)}),t.hiddenSize&&d.jsx(a2,{label:"Hidden size",value:t.hiddenSize.toLocaleString()}),t.vocabSize&&d.jsx(a2,{label:"Vocab size",value:t.vocabSize.toLocaleString()}),t.intermediateSize&&d.jsx(a2,{label:"Intermediate",value:t.intermediateSize.toLocaleString()})]})]}),i>0&&s.length>0&&d.jsxs("div",{children:[d.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Parameters"}),d.jsx("div",{className:"flex h-2 rounded-full overflow-hidden mb-2.5",children:s.map(([a,l])=>d.jsx("div",{className:`${uU[a].bar}`,style:{width:`${l/i*100}%`,minWidth:l>0?"2px":0}},a))}),d.jsx("div",{className:"space-y-0.5",children:s.map(([a,l])=>d.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[d.jsx("div",{className:`w-2 h-2 rounded-sm shrink-0 ${uU[a].bar}`}),d.jsx("span",{className:"capitalize text-muted-foreground",children:a}),d.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:[Gy(l)," (",(l/i*100).toFixed(0),"%)"]})]},a))})]}),o.length>0&&d.jsxs("div",{children:[d.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider mb-2",children:"Layer Types"}),d.jsx("div",{className:"space-y-0.5",children:o.map(([a,l])=>d.jsxs("div",{className:"flex items-center text-xs",children:[d.jsx("span",{className:"text-foreground",children:a}),d.jsxs("span",{className:"ml-auto text-muted-foreground tabular-nums",children:["×",l]})]},a))})]}),d.jsxs(Pi,{open:n,onOpenChange:r,children:[d.jsxs(Ii,{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider hover:text-foreground transition-colors",children:[n?d.jsx(Rr,{className:"size-3"}):d.jsx(p0,{className:"size-3"}),"Raw repr"]}),d.jsx(Di,{children:d.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 a2({label:t,value:e}){return d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsx("span",{className:"text-muted-foreground",children:t}),d.jsx("span",{className:"font-medium tabular-nums",children:e})]})}function yRe({modelRepr:t}){const e=w.useMemo(()=>lRe(t),[t]),n=w.useMemo(()=>e?cRe(e):null,[e]);return!e||!n?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx(Lde,{className:"size-8 text-muted-foreground mx-auto mb-2"}),d.jsx("div",{className:"text-sm text-muted-foreground",children:"Could not parse model architecture"})]})}):d.jsxs("div",{className:"flex h-full",children:[d.jsx("div",{className:"flex-1 overflow-auto",children:d.jsx(xRe,{root:e})}),d.jsx(vRe,{stats:n,rawRepr:t})]})}function HQ(t){return NI(t==null?void 0:t.setup)}function bRe(t){const e=HQ(t),n=[],r=yi(e==null?void 0:e.trainer),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=yi(s);if(!o)continue;const a=Lr(o.node_id);if(a===null)continue;const l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const f=yi(c);if(!f)continue;const h=Lr(f.gpu_index);h!==null&&n.push({node_id:a,gpu_index:h})}}return n}function _Re(t){const e=HQ(t),n=[],r=yi(e==null?void 0:e.inference),i=Array.isArray(r==null?void 0:r.nodes)?r.nodes:[];for(const s of i){const o=yi(s);if(!o)continue;const a=Lr(o.node_id);if(a===null)continue;const l=Array.isArray(o.gpus)?o.gpus:[];for(const c of l){const f=yi(c);if(!f)continue;const h=Lr(f.gpu_index);h!==null&&n.push({node_id:a,gpu_index:h})}}return n}const wRe=["cpu_utilization_percent","system_memory_used_gb","system_memory_available_gb","system_memory_total_gb","system_memory_percent"],SRe=[1,5,10,30,60,120,300],qN=qi;function MRe(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 l2(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 TRe(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 CRe(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 ERe(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 ARe(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 NRe({value:t,onChange:e}){const[n,r]=w.useState(!1),[i,s]=w.useState(""),o=w.useRef(null),a=c=>{c&&(s(qN(t)),setTimeout(()=>{var f;return(f=o.current)==null?void 0:f.select()},0)),r(c)},l=()=>{const c=MRe(i);c!==null&&(e(c),r(!1))};return d.jsxs(oC,{open:n,onOpenChange:a,children:[d.jsx(aC,{asChild:!0,children:d.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:[qN(t),d.jsx(Rr,{className:"size-3 text-muted-foreground"})]})}),d.jsxs(lC,{align:"start",className:"w-40 p-1.5 gap-1",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.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"}),d.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"})]}),d.jsx("div",{className:"flex flex-col",children:SRe.map(c=>d.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:qN(c)},c))})]})]})}function kRe(){var kt;const[t,e]=w.useState(null),n=w.useRef(0),r=Kn(wl),i=!0,[s,o]=cn(Lue),[a,l]=cn(jue),[c,f]=cn(zue),[h,m]=cn(Fue),[x,b]=cn(Uue),[_,S]=cn(Bue),[M,T]=cn(Hue),[A,N]=cn(Gue),[D,k]=cn(Vue),[O,R]=cn(Wue),[L,B]=cn(Kue),[H,$]=cn($ue),[G,Z]=cn(que),[V,W]=cn(Xue),[J,ne]=cn(Yue),[ie,z]=w.useState(l2(_));w.useEffect(()=>{t&&(t.scrollTop=M,n.current=M)},[t]),w.useEffect(()=>{if(!t)return;const wt=()=>{n.current=t.scrollTop};return t.addEventListener("scroll",wt,{passive:!0}),()=>{t.removeEventListener("scroll",wt),T(n.current)}},[t]);const{data:j,error:X}=Sh(r||"",!!r,i),F=w.useMemo(()=>MQ(j==null?void 0:j.summary),[j==null?void 0:j.summary]),{data:ce,isFetching:oe,isPlaceholderData:Q}=Ife(r||"",a,c,h,!!r),se=!!r&&ce!==void 0,{data:re,isFetching:K,isPlaceholderData:fe}=Dfe(r||"",a,c,(ce==null?void 0:ce.global_min_time)??null,h,wRe,se),he=!!r&&ce!==void 0,{data:ae,isFetching:Se,isPlaceholderData:de}=Ofe(r||"",a,c,(ce==null?void 0:ce.global_min_time)??null,h,null,he),Me=(ce==null?void 0:ce.total_pages)??(re==null?void 0:re.total_pages)??null,Ce=ce,Re=re,le=ae,[He,Le]=w.useState([]),[ze,Ve]=w.useState([]),[ue,Y]=w.useState([]);w.useEffect(()=>{Ce!=null&&Ce.available_metrics&&Ce.available_metrics.length>0&&Le(Ce.available_metrics)},[Ce==null?void 0:Ce.available_metrics]),w.useEffect(()=>{Re!=null&&Re.available_metrics&&Re.available_metrics.length>0&&Ve(Re.available_metrics)},[Re==null?void 0:Re.available_metrics]),w.useEffect(()=>{le!=null&&le.available_metrics&&le.available_metrics.length>0&&Y(le.available_metrics)},[le==null?void 0:le.available_metrics]);const[xe,we]=w.useState(1),[Te,ge]=w.useState(null),[Ue,be]=w.useState(null),[ke,qe]=w.useState(null);w.useEffect(()=>{Me!==null&&Me>0&&we(Me)},[Me]),w.useEffect(()=>{const wt=(Ce==null?void 0:Ce.global_min_time)??(Re==null?void 0:Re.global_min_time)??null;wt!==null&&ge(wt)},[Ce==null?void 0:Ce.global_min_time,Re==null?void 0:Re.global_min_time]),w.useEffect(()=>{const wt=(Ce==null?void 0:Ce.interval_start)??(Re==null?void 0:Re.interval_start)??null,Vt=(Ce==null?void 0:Ce.interval_end)??(Re==null?void 0:Re.interval_end)??null;wt!==null&&Vt!==null&&be({start:wt,end:Vt})},[Ce==null?void 0:Ce.interval_start,Ce==null?void 0:Ce.interval_end,Re==null?void 0:Re.interval_start,Re==null?void 0:Re.interval_end]),w.useEffect(()=>{we(1),ge(null),be(null),qe(null)},[r]);const Qe=Me??xe,nt=(Ce==null?void 0:Ce.interval_start)??(Re==null?void 0:Re.interval_start)??null,st=(Ce==null?void 0:Ce.interval_end)??(Re==null?void 0:Re.interval_end)??null,Pe=(Ce==null?void 0:Ce.global_min_time)??(Re==null?void 0:Re.global_min_time)??Te;w.useEffect(()=>{if(h&&Me!==null&&Me>0){const wt=Me-1;a!==wt&&l(wt)}},[h,Me,a,l]);const Ke=wt=>{m(!1),l(wt)},rt=wt=>{if(!h){const Vt=Math.floor(a*c/wt);l(Vt)}f(wt)},ye=()=>{h?m(!1):(m(!0),Me!==null&&Me>0&&l(Me-1))};w.useEffect(()=>{z(l2(_))},[_]);const $e=w.useMemo(()=>{const wt=(Ce==null?void 0:Ce.metrics)??[];return!x||_<=0?wt:CRe(wt,_)},[Ce==null?void 0:Ce.metrics,x,_]),Ze=w.useMemo(()=>{const wt=(Re==null?void 0:Re.metrics)??[];return!x||_<=0?wt:ERe(wt,_)},[Re==null?void 0:Re.metrics,x,_]),ft=w.useMemo(()=>{const wt=(le==null?void 0:le.metrics)??[];return!x||_<=0?wt:ARe(wt,_)},[le==null?void 0:le.metrics,x,_]),lt=w.useMemo(()=>{if(h){const Gt=[],Dt=[];if((Ce==null?void 0:Ce.interval_start)!=null&&Dt.push(Ce.interval_start),(Ce==null?void 0:Ce.interval_end)!=null&&Gt.push(Ce.interval_end),(Re==null?void 0:Re.interval_start)!=null&&Dt.push(Re.interval_start),(Re==null?void 0:Re.interval_end)!=null&&Gt.push(Re.interval_end),(le==null?void 0:le.interval_start)!=null&&Dt.push(le.interval_start),(le==null?void 0:le.interval_end)!=null&&Gt.push(le.interval_end),Gt.length===0)return null;const Qt=Math.min(...Gt),hn=Math.max(Pe??Qt,Qt-c),It=Dt.length>0?Math.max(...Dt):hn;return{start:Math.min(Qt,Math.max(hn,It)),end:Qt}}const wt=(Ue==null?void 0:Ue.start)??null,Vt=(Ue==null?void 0:Ue.end)??null,rn=nt??wt,Bt=st??Vt;return rn===null||Bt===null?null:{start:rn,end:Bt}},[h,Ce==null?void 0:Ce.interval_end,Ce==null?void 0:Ce.interval_start,Re==null?void 0:Re.interval_end,Re==null?void 0:Re.interval_start,le==null?void 0:le.interval_end,le==null?void 0:le.interval_start,Pe,c,nt,st,Ue==null?void 0:Ue.start,Ue==null?void 0:Ue.end]);w.useEffect(()=>{lt&&qe(lt)},[lt]);const Je=lt??ke,Ae=w.useMemo(()=>!Je||Pe===null?0:Je.start-Pe,[Je,Pe]),We=oe&&Q||K&&fe||Se&&de,De=oe&&!Ce||se&&K&&!Re||he&&Se&&!le,Ne=!We&&!De&&(oe&&!!Ce||K&&!!Re||Se&&!!le),ot=We||De,dt=w.useMemo(()=>bRe(j==null?void 0:j.summary),[j==null?void 0:j.summary]),Pt=w.useMemo(()=>_Re(j==null?void 0:j.summary),[j==null?void 0:j.summary]);return r?d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm sticky top-0 z-10",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center gap-2 h-7",children:[d.jsxs(M0,{type:"single",variant:"selecting",size:"sm",value:s,onValueChange:wt=>{wt&&o(wt)},children:[d.jsx(Ka,{value:"metrics",className:"text-xs px-2 py-1 h-7",children:"Metrics"}),d.jsx(Ka,{value:"topology",className:"text-xs px-2 py-1 h-7",children:"Topology"}),d.jsx(Ka,{value:"model",className:"text-xs px-2 py-1 h-7",children:"Model"})]}),s==="metrics"&&d.jsxs(d.Fragment,{children:[d.jsx(NP,{currentPage:a,totalPages:Qe,onPageChange:Ke}),d.jsx(NRe,{value:c,onChange:rt}),Je&&d.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[b0(Je.start,Je.end-Je.start)," ","–"," ",b0(Je.end,Je.end-Je.start)]}),d.jsx("button",{onClick:ye,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"}),d.jsx(Bw,{label:"Aggregate",variant:"selecting",size:"sm",inputType:"text",enabled:x,onEnabledChange:b,value:ie,onValueChange:z,onValueCommit:wt=>{const Vt=TRe(wt);Vt!==null?(S(Vt),z(l2(Vt))):z(l2(_))},inputWidth:"w-10"})]})]})})}),s==="metrics"&&d.jsx("div",{className:"flex-1 overflow-auto p-6",ref:e,children:d.jsxs("div",{className:"max-w-7xl mx-auto",children:[X&&d.jsx(hd,{className:"border-destructive mb-6",children:d.jsx(dh,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error:"," ",X instanceof Error?X.message:"Unknown error"]})})}),d.jsx(aRe,{gpuMetrics:$e,cpuMetrics:Ze,vllmMetrics:ft,availableGpuMetrics:(Ce==null?void 0:Ce.available_metrics)??He,availableCpuMetrics:(Re==null?void 0:Re.available_metrics)??ze,availableVllmMetrics:(le==null?void 0:le.available_metrics)??ue,trainerGpus:dt,inferenceGpus:Pt,isLoading:ot,isRefetching:Ne,roleMode:A,onRoleModeChange:N,systemMetricsOpen:D,onSystemMetricsOpenChange:k,cpuMetricsOpen:O,onCpuMetricsOpenChange:R,vllmMetricsOpen:L,onVllmMetricsOpenChange:B,trainerSectionOpen:H,onTrainerSectionOpenChange:$,inferenceSectionOpen:G,onInferenceSectionOpenChange:Z,trainerNodeMode:V,onTrainerNodeModeChange:W,inferenceNodeMode:J,onInferenceNodeModeChange:ne,overrideTimeRange:Je,xOffset:Ae})]})}),s==="topology"&&d.jsx("div",{className:"flex-1 overflow-hidden",children:X?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load topology data"}),d.jsx("div",{className:"text-xs text-muted-foreground",children:X instanceof Error?X.message:"Unknown error"})]})}):j?!F||F.nodes.length===0?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No topology data available"}),d.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have setup information in its W&B summary."})]})}):d.jsx("div",{className:"h-full w-full",children:d.jsx(CQ,{topology:F})}):d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading topology…"})})}),s==="model"&&d.jsx("div",{className:"flex-1 overflow-hidden",children:X?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-destructive mb-2",children:"Failed to load model data"}),d.jsx("div",{className:"text-xs text-muted-foreground",children:X instanceof Error?X.message:"Unknown error"})]})}):j?(kt=j.summary)!=null&&kt.model_architecture?d.jsx("div",{className:"h-full w-full",children:d.jsx(yRe,{modelRepr:j.summary.model_architecture})}):d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-sm text-muted-foreground mb-2",children:"No model architecture available"}),d.jsx("div",{className:"text-xs text-muted-foreground/70",children:"The selected run does not have model_architecture in its W&B summary."})]})}):d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loading model architecture…"})})})]}):d.jsx(V0,{description:"Select a run from the sidebar to view infrastructure metrics."})}const GQ=1e4;function H_(t,e){return t*GQ+e}function RRe(){var ge,Ue;const t=Kn(wl),[e]=_7(),[n,r]=cn(j9),[i,s]=cn(Due),[o,a]=cn(z9),[l,c]=cn(F9),f=Kn(U9),[h]=cn(LA),[,m]=cn(B9),x=Kn(jA),[b,_]=cn(QT),[S,M]=cn(JT),T=b.length+(S?1:0),A=be=>{_(ke=>ke.includes(be)?ke.filter(qe=>qe!==be):[...ke,be])},[N,D]=w.useState(0),[k,O]=w.useState(0),[R,L]=w.useState(!0),B=!0,H=w.useMemo(()=>{const be=e.get("step");if(!be)return null;const ke=Number(be);return Number.isFinite(ke)?ke:null},[e]),$=w.useRef(null);w.useEffect(()=>{if(!t){$.current=null;return}if(H==null){$.current=null;return}H!==$.current&&(r(H),$.current=H)},[H,t,r]);const{data:G,isLoading:Z,error:V}=Tfe(t||"",n,i,!!t),{data:W}=Sh(t||"",!!t,B),J=((ge=W==null?void 0:W.summary)==null?void 0:ge.eval_env_details)??((Ue=W==null?void 0:W.config)==null?void 0:Ue.eval_env_details),ne=w.useMemo(()=>KS(J),[J]),ie=w.useMemo(()=>{const be=Dp(J),ke=ZS(W==null?void 0:W.data_metric_ranges);return Op(be,ke)},[J,W==null?void 0:W.data_metric_ranges]),[z,j]=w.useState([]),X=G==null?void 0:G.available_rollout_metric_names,F=X&&X.length>0?X:z;X&&X.length>0&&X!==z&&j(X);const ce=w.useMemo(()=>{if(i)return{prefix:`eval/${i}/`,rewardNames:F,selectedSampleIdx:o}},[i,F,o]);w.useEffect(()=>{if(!G)return;const be=G.available_eval_names;be.length&&(i&&be.includes(i)||s(be[0]))},[G==null?void 0:G.available_eval_names,i,s,G]);const oe=w.useMemo(()=>{var be;return(be=G==null?void 0:G.available_steps)!=null&&be.length&&n===null?G.available_steps[G.available_steps.length-1]:null},[G==null?void 0:G.available_steps,n]);w.useEffect(()=>{oe!==null&&n===null&&H==null&&r(oe)},[oe,H,n,r]);const Q=be=>{r(be)},[se,re]=w.useState([]),[K,fe]=w.useState(null);t!==K&&(re([]),fe(t));const he=G==null?void 0:G.available_steps,ae=w.useMemo(()=>{const be=he??[];return[...new Set([...se,...be])].sort((qe,Qe)=>qe-Qe)},[he,se]);ae.length>se.length&&re(ae);const Se=ae.length>0,de=Se?ae[ae.length-1]:0,Me=w.useMemo(()=>{if(n==null)return ae.length-1;const be=ae.indexOf(n);return be>=0?be:ae.length-1},[ae,n]),Ce=be=>{be>=0&&be<ae.length&&Q(ae[be])},Re=w.useMemo(()=>{if(G!=null&&G.prompts)return G.prompts.map(be=>({step:be.step,group_id:be.sample_idx,env:be.env,system_prompt:be.system_prompt,tokens_system_prompt:be.tokens_system_prompt,prompt:be.prompt,tokens_prompt:be.tokens_prompt}))},[G]),le=w.useMemo(()=>{if(G!=null&&G.rollouts)return G.rollouts.map(be=>({step:be.step,group_id:be.sample_idx,sample_idx:H_(be.sample_idx,be.completion_idx),turn_order:be.turn_order,turn_type:be.turn_type,content:be.content,tokens:be.tokens}))},[G]),He=w.useMemo(()=>{if(G!=null&&G.samples_data)return G.samples_data.map(be=>({step:be.step,group_id:be.sample_idx,sample_idx:H_(be.sample_idx,be.completion_idx),reward:null,advantage:null,turns:be.turns,total_tokens:null,raw_string:null}))},[G]),Le=w.useMemo(()=>{if(G!=null&&G.rollout_metrics)return G.rollout_metrics.map(be=>({step:be.step,sample_idx:H_(be.sample_idx,be.completion_idx),env:be.env,metric_name:be.metric_name,value:be.value}))},[G]),ze=w.useMemo(()=>{if(G!=null&&G.golden_answers)return G.golden_answers.map(be=>({step:be.step,sample_idx:H_(be.sample_idx,be.completion_idx),env:be.env,key:be.key,value:be.value}))},[G]),Ve=w.useMemo(()=>{if(G!=null&&G.info_turns)return G.info_turns.map(be=>({step:be.step,sample_idx:H_(be.sample_idx,be.completion_idx),turn_order:be.turn_order,env:be.env,info_key:be.info_key,info_value:be.info_value,info_type:be.info_type}))},[G]),ue=w.useMemo(()=>{if(!(G!=null&&G.samples_data))return new Map;const be=new Map;for(const ke of G.samples_data)be.set(ke.sample_idx,(be.get(ke.sample_idx)??0)+1);return be},[G]),Y=w.useCallback((be,ke)=>{const qe=ue.get(be)??ke.samples.length;if(a(be),qe<=1){const Qe=ke.samples[0];Qe&&c(Qe.sample_idx)}else m("samples")},[ue,a,c,m]),xe=w.useCallback(()=>{m("groups")},[m]),we=w.useCallback(({viewMode:be})=>d.jsxs("div",{className:"flex items-center gap-1 min-w-0 flex-1",children:[be==="samples"&&d.jsx(Sn,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:xe,children:d.jsx(eC,{className:"h-4 w-4"})}),d.jsxs(gy,{value:i??"",onValueChange:ke=>{s(ke),a(null),c(null),m("groups")},children:[d.jsx(vy,{className:"h-7 text-xs min-w-0 flex-1",children:d.jsx(xy,{placeholder:"Select eval..."})}),d.jsx(yy,{children:((G==null?void 0:G.available_eval_names)??[]).map(ke=>d.jsx(Ox,{value:ke,className:"text-xs",children:ke},ke))})]})]}),[i,G==null?void 0:G.available_eval_names,s,a,c,m,xe]),Te=w.useMemo(()=>{var st;if(!f)return null;const be=((st=f.sample.turns[0])==null?void 0:st.step)??n,ke=f.sample.group_id,Qe=f.sample.sample_idx%GQ,nt=ue.get(ke)??1;return{step:be,evalSampleIdx:ke,completionIdx:Qe,numCompletions:nt}},[f,n,ue]);return t?d.jsxs("div",{className:"flex h-full overflow-hidden",children:[d.jsx(DI,{prompts:Re,data:le,samplesData:He,rolloutMetrics:Le,availableMetricNames:F,isLoading:Z,step:n??void 0,currentStepIndex:Me,totalSteps:ae.length,onStepChange:Ce,hasSteps:Se,stepValues:ae,openAtom:LA,selectedGroupIdAtom:z9,selectedSampleIdxAtom:F9,viewModeAtom:B9,renderLeftControls:we,onGroupClick:Y,hideRewardAdvantage:!0,envDetailsOverride:J}),d.jsxs("div",{className:"flex-1 flex flex-col min-w-0 min-h-0",children:[d.jsx("header",{className:"border-b bg-card/50 backdrop-blur-sm shrink-0",children:d.jsx("div",{className:"py-2.5 px-4",children:d.jsxs("div",{className:"flex items-center justify-between h-7",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx(II,{openAtom:LA}),Te&&d.jsxs("div",{className:"text-sm text-muted-foreground",children:[d.jsxs("span",{children:["Step ",Te.step]}),i&&d.jsxs(d.Fragment,{children:[" · ",d.jsx("span",{children:i})]})," · ",d.jsxs("span",{children:["Sample ",Te.evalSampleIdx]}),Te.numCompletions>1&&d.jsxs(d.Fragment,{children:[" · ",d.jsxs("span",{children:["Completion ",Te.completionIdx]})]})]}),(f==null?void 0:f.sample.raw_string)&&d.jsx(GC,{rawString:f.sample.raw_string,totalTokens:f.sample.total_tokens,turns:f.sample.turns.length}),f&&d.jsxs(d.Fragment,{children:[d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{D(be=>be+1),L(!1)},children:"Collapse All"}),d.jsx(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>{O(be=>be+1),L(!0)},children:"Expand All"}),d.jsxs(Vs,{children:[d.jsx(Ws,{asChild:!0,children:d.jsxs(Sn,{variant:"outline",size:"sm",className:"h-7 px-2 text-xs whitespace-nowrap shrink-0",children:["Render",T>0&&` (${T})`]})}),d.jsxs($s,{align:"start",className:"w-auto",children:[d.jsx(hr,{checked:S,onCheckedChange:be=>M(!!be),onSelect:be=>be.preventDefault(),children:"Format Think"}),d.jsx(hr,{checked:b.includes("markdown"),onCheckedChange:()=>A("markdown"),onSelect:be=>be.preventDefault(),children:"Markdown"}),d.jsx(hr,{checked:b.includes("latex"),onCheckedChange:()=>A("latex"),onSelect:be=>be.preventDefault(),children:"LaTeX"}),d.jsx(hr,{checked:b.includes("code"),onCheckedChange:()=>A("code"),onSelect:be=>be.preventDefault(),children:"Code"})]})]})]})]}),ce&&d.jsx(RI,{openAtom:jA})]})})}),d.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3",children:d.jsxs("div",{className:h||x?"max-w-5xl mx-auto":"",children:[V&&d.jsx(hd,{className:"border-destructive mb-6",children:d.jsx(dh,{className:"pt-6",children:d.jsxs("p",{className:"text-destructive",children:["Error:"," ",V instanceof Error?V.message:"Unknown error"]})})}),d.jsx($1,{prompts:Re,data:le,samplesData:He,rolloutMetrics:Le,goldenAnswers:ze,infoTurns:Ve,isLoading:Z,step:n??void 0,filterGroupId:o,filterSampleIdx:l,lastValidSampleAtom:U9,collapseAllSignal:N,expandAllSignal:k,defaultSectionsOpen:R,envRewardRanges:ne,envMetricRanges:ie,renderOptions:b,formatThinkBlocks:S})]})})]}),ce&&d.jsx(PI,{currentStep:n,maxSelectableStep:de,openAtom:jA,selectedMetricsAtom:Oue,selectedStepAtom:j9,evalConfig:ce})]}):d.jsx(V0,{description:"Select a run from the sidebar to view evals."})}function PRe(){const t=Kn(us),{data:e}=ci({queryKey:["version-check"],queryFn:async()=>(await fetch(`${Gn}/version-check`)).json(),staleTime:3600*1e3,refetchOnWindowFocus:!1});return d.jsx("div",{className:"h-full flex items-center justify-center overflow-auto pb-40",children:d.jsxs("div",{className:"max-w-2xl px-6 py-12 text-center",children:[d.jsxs("div",{className:"flex flex-col items-center justify-center mb-8 gap-2",children:[d.jsx("img",{src:t?"/logo-full-dark.svg":"/logo-full.svg",alt:"Telescope",className:"h-12"}),(e==null?void 0:e.current)&&d.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["v",e.current]})]}),d.jsxs("div",{className:"space-y-4 text-base text-foreground/60 leading-relaxed text-justify",children:[d.jsx("p",{children:"Telescope is a framework to post-train LLMs with reinforcement learning for reasoning and agents."}),d.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."}),d.jsx("p",{children:"This visualization tool provides critical insight into your runs: metrics, rollouts, infrastructure, inference traces, trainer GPU events, and more."}),d.jsx("p",{children:"Telescope is built with a modern stack and focused on infrastructure, observability, scalability, and reliability."}),d.jsxs("p",{children:["You can find the documentation at"," ",d.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"}),"."]})]}),d.jsxs("div",{className:"mt-10 flex items-center justify-center gap-6 text-xs text-muted-foreground",children:[d.jsx("a",{href:"https://github.com/eduardoslonski/telescope",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Trainer"}),d.jsx("span",{className:"text-border",children:"|"}),d.jsx("a",{href:"https://github.com/eduardoslonski/telescope-ui",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"UI Visualization"}),d.jsx("span",{className:"text-border",children:"|"}),d.jsx("a",{href:"https://eduardoslonski.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground transition-colors",children:"Created by Eduardo Slonski"})]})]})})}function IRe(){return d.jsxs(Jue,{children:[d.jsx(che,{}),d.jsx("main",{className:"ml-56 h-screen overflow-hidden bg-background",children:d.jsxs(Aee,{children:[d.jsx(Xf,{path:"/",element:d.jsx(Fge,{})}),d.jsx(Xf,{path:"/metrics",element:d.jsx(Bge,{})}),d.jsx(Xf,{path:"/timeline",element:d.jsx(Nke,{})}),d.jsx(Xf,{path:"/rollouts",element:d.jsx(Yke,{})}),d.jsx(Xf,{path:"/rollouts-discarded",element:d.jsx(Kke,{})}),d.jsx(Xf,{path:"/topology",element:d.jsx(Zke,{})}),d.jsx(Xf,{path:"/infra",element:d.jsx(kRe,{})}),d.jsx(Xf,{path:"/evals",element:d.jsx(RRe,{})}),d.jsx(Xf,{path:"/about",element:d.jsx(PRe,{})})]})})]})}EU.createRoot(document.getElementById("root")).render(d.jsx(w.StrictMode,{children:d.jsx(Jee,{children:d.jsx(IRe,{})})}));
